[PATCH 1/2] seccomp: Use FIFO semantics to order notifications

From: Sargun Dhillon
Date: Wed Apr 27 2022 - 21:56:24 EST


Previously, the seccomp notifier used LIFO semantics, where each
notification would be added on top of the stack, and notifications
were popped off the top of the stack. This could result one process
that generates a large number of notifications preventing other
notifications from being handled. This patch moves from LIFO (stack)
semantics to FIFO (queue semantics).

Signed-off-by: Sargun Dhillon <sargun@xxxxxxxxx>
---
kernel/seccomp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/seccomp.c b/kernel/seccomp.c
index db10e73d06e0..2cb3bcd90eb3 100644
--- a/kernel/seccomp.c
+++ b/kernel/seccomp.c
@@ -1101,7 +1101,7 @@ static int seccomp_do_user_notification(int this_syscall,
n.data = sd;
n.id = seccomp_next_notify_id(match);
init_completion(&n.ready);
- list_add(&n.list, &match->notif->notifications);
+ list_add_tail(&n.list, &match->notif->notifications);
INIT_LIST_HEAD(&n.addfd);

up(&match->notif->request);
--
2.25.1