summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-10-10 11:56:27 -0400
committerTavian Barnes <tavianator@tavianator.com>2024-10-10 11:56:27 -0400
commit39ff273df97e51b1285358b9e6808b117ea8adb1 (patch)
treede29177b5af341791096d0f303ef6bb4fae8302b /tests
parent7b33959d38374d18950b16a2f3ff2ca42406a895 (diff)
downloadbfs-39ff273df97e51b1285358b9e6808b117ea8adb1.tar.xz
sighook: Don't forget to reset list->tail on the last sigpop()
This was causing a UAF if we ever unregistered the last hook for a signal and then re-registered one. Fixes: 75b7f70 ("sighook: Make sigunhook() O(1)")
Diffstat (limited to 'tests')
-rw-r--r--tests/sighook.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/sighook.c b/tests/sighook.c
index d785a55..0cb8de2 100644
--- a/tests/sighook.c
+++ b/tests/sighook.c
@@ -60,6 +60,13 @@ void check_sighook(void) {
return;
}
+ // Check that we can unregister and re-register a hook
+ sigunhook(hook);
+ hook = sighook(SIGALRM, alrm_hook, NULL, SH_CONTINUE);
+ if (!bfs_echeck(hook, "sighook(SIGALRM)")) {
+ return;
+ }
+
// Create a timer that sends SIGALRM every 100 microseconds
struct timespec ival = { .tv_nsec = 100 * 1000 };
struct timer *timer = xtimer_start(&ival);