diff options
| author | Kunwu Chan <kunwu.chan@gmail.com> | 2026-09-20 15:07:50 +0800 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-09-25 11:33:50 +0200 |
| commit | fd00a46e36a12c5279d3d163f0d0c8f83d12dc09 (patch) | |
| tree | fe5d2eaa2a43d82f7b0de75a5da9add72819ead3 /include | |
| parent | 8421a62085ec2d0be97b17ef66536344f472703e (diff) | |
| download | linux-next-fd00a46e36a12c5279d3d163f0d0c8f83d12dc09.tar.gz linux-next-fd00a46e36a12c5279d3d163f0d0c8f83d12dc09.zip | |
kthread: Annotate lockless to_kthread() flags access
do_exit() calls synchronize_group_exit(), which modifies task->flags
under sighand->siglock:
tsk->flags |= PF_POSTCOREDUMP;
The sanity check in to_kthread() reads the same flags word without
holding that lock:
WARN_ON(!(k->flags & PF_KTHREAD));
PF_KTHREAD is set once when the task becomes a kthread and is never
cleared for the lifetime of the task. Since PF_KTHREAD is immutable,
the check does not depend on synchronization with updates to other
bits in task->flags.
Use READ_ONCE() to annotate the intentional lockless access.
Signed-off-by: Kunwu Chan <kunwu.chan@gmail.com>
Link: https://patch.msgid.link/20260920070750.2871923-1-kunwu.chan@gmail.com
Reviewed-by: Bradley Morgan <brads@mainlining.org>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions
