[PATCH] landlock: Do not hold exec_update_lock across the TSYNC wait

Christian Brauner brauner at kernel.org
Tue Nov 24 15:09:08 UTC 2026


On Fri, Nov 20, 2026 at 04:15:52PM +0100, Mickaël Salaün wrote:
> landlock_restrict_sibling_threads() write-locks
> current->signal->exec_update_lock to serialize TSYNC callers, and holds
> it until every sibling thread has run its task_work.  This wait is
> unbounded: TWA_SIGNAL does not wake a TASK_KILLABLE sleeper, so a
> sibling blocked as a vfork() parent runs it only once its child execs or
> exits.
> 
> Meanwhile, readers of this lock block, mostly in D state:
> /proc/<pid>/stat, mm_access(), pidfd_getfd(), kcmp(), perf_event_open(),
> etc.  An unprivileged process can thus stall tools run by other users,
> including root, such as ps and top.
> 
> Only a per-process "TSYNC in progress" marker is needed.  Use an unused
> signal_struct.flags bit, protected by sighand->siglock, which is held
> only to set or clear the marker.  A second caller still restarts the
> syscall, and a cleanup class releases the marker on every return.
> 
> Like de_thread(), treat a group exit or an ongoing exec as a held
> marker: a group exit may overwrite the flags, and both kill the other
> threads, which the restart lets the caller handle.
> 
> Add KUnit tests for taking a free marker and for rejecting a held one.
> A concurrent TSYNC caller cannot be started deterministically from user
> space, but a KUnit thread has no sibling and can hold the marker itself.
> 
> Cc: Christian Brauner <brauner at kernel.org>
> Cc: Günther Noack <gnoack at google.com>
> Cc: Nickolai Zeldovich <nickolai at csail.mit.edu>
> Cc: Oleg Nesterov <oleg at redhat.com>
> Cc: Tejun Heo <tj at kernel.org>
> Cc: Yihan Ding <dingyihan at uniontech.com>
> Cc: stable at vger.kernel.org
> Reported-by: Lee Seong Hyeon <ihopenre at gmail.com>
> Suggested-by: Lee Seong Hyeon <ihopenre at gmail.com>
> Fixes: ff88df67dbf7 ("landlock: Serialize TSYNC thread restriction")
> Signed-off-by: Mickaël Salaün <mic at digikod.net>
> ---

Yes please, this came up in another series that I'm about to send and
this has been bothering me. exec_update_lock should not be taken lightly
at all. We really need a way to limit the exposure of this forsaken
lock,

Acked-by: Christian Brauner (Amutable) <brauner at kernel.org>



More information about the Linux-security-module-archive mailing list