public inbox for rust-for-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: Jann Horn <jannh@google.com>
To: "Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>
Cc: Wedson Almeida Filho <walmeida@microsoft.com>,
	 Martin Rodriguez Reboredo <yakoyoku@gmail.com>,
	 rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Jann Horn <jannh@google.com>
Subject: [PATCH v2 0/2] rust: task: clean up safety issues wrt de_thread()
Date: Thu, 12 Feb 2026 23:12:05 +0100	[thread overview]
Message-ID: <20260212-rust-de_thread-v2-0-7d274c4fd02e@google.com> (raw)

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.

Signed-off-by: Jann Horn <jannh@google.com>
---
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/20260212-rust-de_thread-v1-1-948f5b992624@google.com

---
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

--  
Jann Horn <jannh@google.com>


             reply	other threads:[~2026-02-12 22:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-12 22:12 Jann Horn [this message]
2026-02-12 22:12 ` [PATCH v2 1/2] rust: task: limit group_leader() to current Jann Horn
2026-02-13  7:52   ` Alice Ryhl
2026-02-13 13:37     ` Jann Horn
2026-02-13 13:42       ` Alice Ryhl
2026-02-12 22:12 ` [PATCH v2 2/2] rust: task: use atomic read for pid() Jann Horn
2026-02-13 16:20   ` Alice Ryhl
2026-02-13 16:49   ` Boqun Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260212-rust-de_thread-v2-0-7d274c4fd02e@google.com \
    --to=jannh@google.com \
    --cc=a.hindborg@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    --cc=walmeida@microsoft.com \
    --cc=yakoyoku@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox