From 39ff273df97e51b1285358b9e6808b117ea8adb1 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 10 Oct 2024 11:56:27 -0400 Subject: 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)") --- src/sighook.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/sighook.c b/src/sighook.c index 4356fdb..0cc81fa 100644 --- a/src/sighook.c +++ b/src/sighook.c @@ -291,6 +291,8 @@ static void sigpop(struct siglist *list, struct sighook *hook) { rcu_update(hook->self, next); if (next) { next->self = hook->self; + } else { + list->tail = &list->head; } } -- cgit v1.2.3