linux/security/landlock
Yihan Ding 697f514ad9
landlock: Clean up interrupted thread logic in TSYNC
In landlock_restrict_sibling_threads(), when the calling thread is
interrupted while waiting for sibling threads to prepare, it executes
a recovery path.

Previously, this path included a wait_for_completion() call on
all_prepared to prevent a Use-After-Free of the local shared_ctx.
However, this wait is redundant. Exiting the main do-while loop
already leads to a bottom cleanup section that unconditionally waits
for all_finished. Therefore, replacing the wait with a simple break
is safe, prevents UAF, and correctly unblocks the remaining task_works.

Clean up the error path by breaking the loop and updating the
surrounding comments to accurately reflect the state machine.

Suggested-by: Günther Noack <gnoack3000@gmail.com>
Signed-off-by: Yihan Ding <dingyihan@uniontech.com>
Tested-by: Günther Noack <gnoack3000@gmail.com>
Reviewed-by: Günther Noack <gnoack3000@gmail.com>
Link: https://lore.kernel.org/r/20260306021651.744723-3-dingyihan@uniontech.com
Signed-off-by: Mickaël Salaün <mic@digikod.net>
2026-03-10 18:22:58 +01:00
..
errata landlock: Add errata documentation section 2026-02-06 17:54:43 +01:00
.kunitconfig landlock: Add unique ID generator 2025-03-26 13:59:34 +01:00
Kconfig landlock: Add support for KUnit tests 2024-02-27 11:21:45 +01:00
Makefile landlock: Multithreading support for landlock_restrict_self() 2026-02-06 17:54:37 +01:00
access.h landlock: Transpose the layer masks data structure 2026-02-10 16:46:50 +01:00
audit.c landlock: Transpose the layer masks data structure 2026-02-10 16:46:50 +01:00
audit.h landlock: Transpose the layer masks data structure 2026-02-10 16:46:50 +01:00
common.h landlock: Add support for KUnit tests 2024-02-27 11:21:45 +01:00
cred.c landlock: Identify domain execution crossing 2025-03-26 13:59:37 +01:00
cred.h landlock: Multithreading support for landlock_restrict_self() 2026-02-06 17:54:37 +01:00
domain.c landlock: Fix formatting 2026-03-04 18:28:08 +01:00
domain.h landlock: Transpose the layer masks data structure 2026-02-10 16:46:50 +01:00
errata.h landlock: Prepare to add second errata 2025-03-21 12:12:21 +01:00
fs.c landlock: Transpose the layer masks data structure 2026-02-10 16:46:50 +01:00
fs.h landlock: Log scoped denials 2025-03-26 13:59:42 +01:00
id.c landlock: Fix warning from KUnit tests 2025-06-27 10:10:37 +02:00
id.h landlock: Add unique ID generator 2025-03-26 13:59:34 +01:00
limits.h landlock: Multithreading support for landlock_restrict_self() 2026-02-06 17:54:37 +01:00
net.c landlock: Transpose the layer masks data structure 2026-02-10 16:46:50 +01:00
net.h landlock: Support network rules with TCP bind and connect 2023-10-26 21:07:15 +02:00
object.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
object.h landlock: Format with clang-format 2022-05-09 12:31:10 +02:00
ruleset.c landlock: Fix formatting 2026-03-04 18:28:08 +01:00
ruleset.h landlock: Transpose the layer masks data structure 2026-02-10 16:46:50 +01:00
setup.c lsm: replace the name field with a pointer to the lsm_id struct 2025-10-22 19:24:18 -04:00
setup.h landlock: Add the errata interface 2025-03-21 12:12:19 +01:00
syscalls.c landlock: Add errata documentation section 2026-02-06 17:54:43 +01:00
task.c landlock: Improve the comment for domain_is_scoped 2025-12-29 16:19:39 +01:00
task.h landlock: Rename "ptrace" files to "task" 2024-03-08 18:22:16 +01:00
tsync.c landlock: Clean up interrupted thread logic in TSYNC 2026-03-10 18:22:58 +01:00
tsync.h landlock: Multithreading support for landlock_restrict_self() 2026-02-06 17:54:37 +01:00