Skip to content

rust: task: clean up safety issues wrt de_thread()

Jann Horn lkml rust-for-linux 2 versions In review

Get series with b4
b4 am [email protected] change-id 20260212-rust-de_thread-0ad9154aedb0

Versions newest first

  1. v2 Latest2 patches 5 repliesIn review
  2. v11 patch 2 repliesSuperseded

Changes in v2 from the cover letter

- split into two patches (Boqun)
- use relaxed atomic load instead of volatile load (Boqun)
- Link to v1: https://lore.kernel.org/r/[email protected]

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2rust: task: limit group_leader() to currentrust/kernel/task.rs+13 -133 replies
2/2rust: task: use atomic read for pid()rust/kernel/task.rs+9 -32 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchAlice RyhlBoqun Feng
1/2
2/2R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] rust: task: clean up safety issues wrt de_thread()

Task::pid() and Task::group_leader() wrongly assume that task::pid and task::group_leader remain constant until the task refcount drops to zero, but those members can actually change due to concurrent de_thread(). Fix those assumptions.

---
Changes in v2:
- split into two patches (Boqun)
- use relaxed atomic load instead of volatile load (Boqun)
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Jann Horn (2):
rust: task: limit group_leader() to current
rust: task: use atomic read for pid()

 rust/kernel/task.rs | 38 ++++++++++++++++++++++----------------
 1 file changed, 22 insertions(+), 16 deletions(-)

---
base-commit: 192c0159402e6bfbe13de6f8379546943297783d
change-id: 20260212-rust-de_thread-0ad9154aedb0

Signature · 1 line
Jann Horn <[email protected]>