Re: [RFC PATCH 1/2] tty: mediate TIOCSIG through task_kill LSM hooks
From: Christopher Lusk
Date: Sun Sep 13 2026 - 19:50:12 EST
The bot's finding is correct, and this is a regression this patch
introduces, so I want to flag it and the v2 direction up front.
kill_pgrp_lsm() calls security_task_kill() with __si_special(priv), i.e.
SEND_SIG_PRIV ((void *)1). On the ordinary paths,
check_kill_permission() returns early via si_fromuser() before the hook,
so security_task_kill() never receives that sentinel. This patch reaches
the hook directly and breaks that invariant. The in-tree C LSMs do not
dereference info, but task_kill is a trusted BPF LSM hook. An attached BPF
LSM program is therefore allowed to dereference info and can fault when it
receives (void *)1.
v2 will synthesize a valid kernel_siginfo for the LSM check
(user-attributed, since TIOCSIG is user-triggered) and keep the privileged
delivery unchanged, so the hook always sees a valid pointer.
This does not change the two questions the RFC is really asking (whether
TIOCSIG should be mediated at all, and task_kill versus a dedicated TTY
signal hook). If the answer is a dedicated hook, the siginfo concern goes
away with it.