Patch "rust: task: restrict Task::group_leader() to current" has been added to the 6.18-stable tree
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 58 lines · Sasha Levin
This is a note to let you know that I've just added the patch titled
rust: task: restrict
Task::group_leader()to currentto the 6.18-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summaryThe filename of the patch is:
rust-task-restrict-task-group_leader-to-current.patch
and it can be found in the queue-6.18 subdirectory.If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
commit
afd4cb72fea7e256c378bc90efc19e140da35e00Author: Alice Ryhl <[email protected]> Date: Wed Jan 7 08:28:46 2026 +0000rust: task: restrict
Task::group_leader()to current[ Upstream commit
105ddfb2d2b3acec7a7d9695463df48733d91e6c]The
Task::group_leader()method currently allows you to access thegroup_leader()of any task, for example one you hold a refcount to. But this is not safe in general since the group leader could change when a task exits. See for example commita15f37a40145c("kernel/sys.c: fix the racy usage oftask_lock(tsk->group_leader)insys_prlimit64()paths").All existing users of
Task::group_leader()call this method on current, which is guaranteed running, so there's not an actual issue in Rust code today. But to prevent code in the future from making this mistake, restrictTask::group_leader()so that it can only be called on current.There are some other cases where accessing
task->group_leaderis okay. For example it can be safe if you holdtasklist_lockorrcu_read_lock(). However, only supportingcurrent->group_leaderis sufficient for all in-tree Rust users ofgroup_leaderright now. Safe Rust functionality for accessing it under rcu or while holdingtasklist_lockmay be added in the future if required by any future Rust module.This patch is a bugfix in that it prevents users of this API from writing incorrect code. It doesn't change behavior of correct code.
Signed-off-by Alice Ryhl <[email protected]>Fixes 313c4281bc9d ("rust: add basic `Task`")Reported-by Oleg Nesterov <[email protected]>Reviewed-by Boqun Feng <[email protected]>Reviewed-by Gary Guo <[email protected]>Cc Andreas Hindborg <[email protected]>Cc Benno Lossin <[email protected]>Cc "Björn Roy Baron" <[email protected]>Cc Björn Roy Baron <[email protected]>Cc Christian Brauner <[email protected]>
Quoted 8 lines
Cc Danilo Krummrich <[email protected]>Cc FUJITA Tomonori <[email protected]>Cc Miguel Ojeda <[email protected]>Cc Panagiotis Foliadis <[email protected]>Cc Shankari Anand <[email protected]>Cc Trevor Gross <[email protected]>Signed-off-by Andrew Morton <[email protected]>Signed-off-by Sasha Levin <[email protected]>
I noticed that this was backported to 6.18, but not to 6.12. Is that because the first user of this function was merged in 6.18, or is there some other reason?
Alice
Quoted 4 lines · Alice Ryhl
I noticed that this was backported to 6.18, but not to 6.12. Is that because the first user of this function was merged in 6.18, or is there some other reason?
If it was meant to be backported, then the commit should have Cc:
[email protected].
Perhaps it was picked for 6.18 (and 6.19) because it applied cleanly.
Cheers,
Miguel
Quoted 10 lines · Miguel Ojeda
Quoted 4 lines · Alice Ryhl
I noticed that this was backported to 6.18, but not to 6.12. Is that because the first user of this function was merged in 6.18, or is there some other reason?
If it was meant to be backported, then the commit should have Cc:
[email protected].Perhaps it was picked for 6.18 (and 6.19) because it applied cleanly.
That is correct, we take "Fixes:" only commits as a "best effort" type of thing. This doesn't apply cleanly to 6.12.y so it was not applied there, nor was there a FAILED email sent as it wasn't asked directly to be applied by the developer/maintainer.
hope this helps explain,
greg k-h
Quoted 11 lines · Greg KH
Quoted 9 lines · Miguel Ojeda
Quoted 4 lines · Alice Ryhl
I noticed that this was backported to 6.18, but not to 6.12. Is that because the first user of this function was merged in 6.18, or is there some other reason?
If it was meant to be backported, then the commit should have Cc:
[email protected].
Quoted 8 lines
Quoted 1 line
Perhaps it was picked for 6.18 (and 6.19) because it applied cleanly.
That is correct, we take "Fixes:" only commits as a "best effort" type of thing. This doesn't apply cleanly to 6.12.y so it was not applied there, nor was there a FAILED email sent as it wasn't asked directly to be applied by the developer/maintainer.
hope this helps explain,
ah, ok, that makes sense, thanks!
Alice