From: sashiko-bot@kernel.org
To: "Christopher Lusk" <clusk@northecho.dev>
Cc: linux-serial@vger.kernel.org
Subject: Re: [RFC PATCH 1/2] tty: mediate TIOCSIG through task_kill LSM hooks
Date: Sun, 13 Sep 2026 22:37:15 +0000 [thread overview]
Message-ID: <20260913223715.B8E511F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260913221958.839429-2-clusk@northecho.dev>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Passing SEND_SIG_PRIV (1) directly to the task_kill LSM hook causes a kernel panic when dereferenced by an eBPF LSM program.
--
commit 0444b1560acb73813cdf2e4fa3082c4f0aaf7e00
Author: Christopher Lusk <clusk@northecho.dev>
tty: mediate TIOCSIG through task_kill LSM hooks
This commit changes the pty_signal() function to invoke the task_kill LSM hook
before delivering signals to the process group. It introduces kill_pgrp_lsm()
and __kill_pgrp_info_filtered() to perform this check while holding
tasklist_lock.
Link: https://lore.kernel.org/r/56bffc24f3d0d08b45a686a48e99766b0a0821fa.1780614610.git.hexlabsecurity@proton.me
> diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
> index cc7f7091ed9a2..8f5eea156ce4c 100644
> --- a/drivers/tty/pty.c
> +++ b/drivers/tty/pty.c
[ ... ]
> @@ -195,10 +196,13 @@ static int pty_signal(struct tty_struct *tty, int sig)
> if (tty->link) {
> pgrp = tty_get_pgrp(tty->link);
> if (pgrp)
> - kill_pgrp(pgrp, sig, 1);
> + ret = kill_pgrp_lsm(pgrp, sig, 1);
> put_pid(pgrp);
> }
[ ... ]
> diff --git a/kernel/signal.c b/kernel/signal.c
> index a5e15bf09d319..758393b7257d6 100644
> --- a/kernel/signal.c
> +++ b/kernel/signal.c
[ ... ]
> @@ -1426,13 +1426,22 @@ int group_send_sig_info(int sig, struct kernel_siginfo *info,
[ ... ]
> +static int __kill_pgrp_info_filtered(int sig, struct kernel_siginfo *info,
> + struct pid *pgrp, bool check_lsm)
> {
> struct task_struct *p = NULL;
> int ret = -ESRCH;
>
> do_each_pid_task(pgrp, PIDTYPE_PGID, p) {
> - int err = group_send_sig_info(sig, info, p, PIDTYPE_PGID);
> + int err = 0;
> +
> + if (check_lsm) {
> + rcu_read_lock();
> + err = security_task_kill(p, info, sig, NULL);
[Severity: High]
Does this pass SEND_SIG_PRIV ((void *)1) directly to the task_kill LSM hook?
pty_signal() initiates this by calling kill_pgrp_lsm() with priv=1, which
translates to SEND_SIG_PRIV via __si_special(priv). This invalid pointer is
then passed directly as the `info` argument to security_task_kill().
When an eBPF LSM program is attached to bpf_lsm_task_kill, it receives `info`
as a PTR_TO_BTF_ID | PTR_TRUSTED pointer. The PTR_TRUSTED flag disables BPF's
PROBE_MEM fault protection, as the pointer is assumed safe to dereference.
If the eBPF program attempts to read info->si_signo, it will execute a normal
kernel memory load from address 0x1, causing an immediate kernel panic.
Before this patch, check_kill_permission() filtered out SEND_SIG_PRIV via
si_fromuser(), preventing it from ever reaching the LSM hook.
> + rcu_read_unlock();
> + }
> + if (!err)
> + err = group_send_sig_info(sig, info, p, PIDTYPE_PGID);
[ ... ]
> @@ -1886,6 +1900,18 @@ int kill_pgrp(struct pid *pid, int sig, int priv)
> }
> EXPORT_SYMBOL(kill_pgrp);
>
> +int kill_pgrp_lsm(struct pid *pid, int sig, int priv)
> +{
> + int ret;
> +
> + read_lock(&tasklist_lock);
> + ret = __kill_pgrp_info_filtered(sig, __si_special(priv), pid, true);
> + read_unlock(&tasklist_lock);
> +
> + return ret;
> +}
> +EXPORT_SYMBOL_GPL(kill_pgrp_lsm);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260913221958.839429-1-clusk@northecho.dev?part=1
next prev parent reply other threads:[~2026-09-13 22:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-13 22:19 [RFC PATCH 0/2] Landlock signal scope and TIOCSIG Christopher Lusk
2026-09-13 22:19 ` [RFC PATCH 1/2] tty: mediate TIOCSIG through task_kill LSM hooks Christopher Lusk
2026-09-13 22:37 ` sashiko-bot [this message]
2026-09-13 23:49 ` Christopher Lusk
2026-09-13 22:19 ` [RFC PATCH 2/2] selftests/landlock: cover TIOCSIG signal scoping Christopher Lusk
2026-09-13 22:26 ` sashiko-bot
2026-09-14 9:34 ` [RFC PATCH 0/2] Landlock signal scope and TIOCSIG Günther Noack
2026-09-14 13:40 ` Christopher Lusk
2026-09-14 17:13 ` Günther Noack
2026-09-23 10:03 ` Mickaël Salaün
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260913223715.B8E511F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=clusk@northecho.dev \
--cc=linux-serial@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.