public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] landlock: Fix TSYNC deadlock and clean up error path
@ 2026-02-25  2:47 Yihan Ding
  2026-02-25  2:47 ` [PATCH v2 1/2] landlock: Serialize TSYNC thread restriction Yihan Ding
  2026-02-25  2:47 ` [PATCH v2 2/2] landlock: Clean up interrupted thread logic in TSYNC Yihan Ding
  0 siblings, 2 replies; 7+ messages in thread
From: Yihan Ding @ 2026-02-25  2:47 UTC (permalink / raw)
  To: Mickaël Salaün, Günther Noack
  Cc: Paul Moore, Jann Horn, linux-security-module, linux-kernel,
	syzbot+7ea2f5e9dfd468201817, Yihan Ding

Hello,

This patch series fixes a deadlock in the Landlock TSYNC multithreading 
support, originally reported by syzbot, and cleans up the associated 
interrupt recovery path.

The deadlock occurs when multiple threads concurrently call 
landlock_restrict_self() with sibling thread restriction enabled, 
causing them to mutually queue task_works on each other and block 
indefinitely.

* Patch 1 fixes the root cause by serializing the TSYNC operations 
  within the same process using the exec_update_lock.
* Patch 2 cleans up the interrupt recovery path by replacing an 
  unnecessary wait_for_completion() with a straightforward loop break, 
  avoiding Use-After-Free while unblocking remaining task_works.

Changes in v2:
- Split the changes into a 2-patch series for clearer logical separation.
- Patch 1: Adopted down_write_killable() instead of down_write() to 
  ensure responsiveness to fatal signals (suggested by Günther Noack).
- Patch 2: Removed wait_for_completion(&shared_ctx.all_prepared) and 
  replaced it with a `break`. The function's bottom wait for 
  'all_finished' already provides the necessary UAF protection 
  (suggested by Günther Noack).

Link to v1: https://lore.kernel.org/all/20260224062729.2908692-1-dingyihan@uniontech.com/

Yihan Ding (2):
  landlock: Serialize TSYNC thread restriction
  landlock: Clean up interrupted thread logic in TSYNC

 security/landlock/tsync.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

-- 
2.51.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-02-26  1:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-25  2:47 [PATCH v2 0/2] landlock: Fix TSYNC deadlock and clean up error path Yihan Ding
2026-02-25  2:47 ` [PATCH v2 1/2] landlock: Serialize TSYNC thread restriction Yihan Ding
2026-02-25 12:07   ` Günther Noack
2026-02-25 22:33     ` Günther Noack
2026-02-26  1:43       ` Ding Yihan
2026-02-25  2:47 ` [PATCH v2 2/2] landlock: Clean up interrupted thread logic in TSYNC Yihan Ding
2026-02-25 12:09   ` Günther Noack

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox