Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Miguel Ojeda <ojeda@kernel.org>
To: stable@vger.kernel.org, sashal@kernel.org
Cc: ojeda@kernel.org, FUJITA Tomonori <fujita.tomonori@gmail.com>
Subject: [PATCH 6.18.y 2/2] rust: bug: update the SAFETY comment for warn_slowpath_fmt() on UML
Date: Sun,  8 Nov 2026 05:33:27 +0100	[thread overview]
Message-ID: <20261108043327.98801-2-ojeda@kernel.org> (raw)
In-Reply-To: <20261108043327.98801-1-ojeda@kernel.org>

From: FUJITA Tomonori <fujita.tomonori@gmail.com>

commit 5c94956f2bfb87025c1eaded6c51d5841d38d333 upstream.

The SAFETY comment says that it is always safe to call
`warn_slowpath_fmt()` with a valid null-terminated string. This is not
true. The taint argument must also be a valid taint number.
Commit 951d09ca450c ("rust: bug: pass TAINT_WARN to warn_slowpath_fmt()
on UML") fixed a bug where it was not.

List each condition that the call meets: the file name, the taint
number, and the null `fmt`.

Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Link: https://patch.msgid.link/20261002104550.2877930-1-tomo@flapping.org
Cc: stable@vger.kernel.org
Fixes: dff64b072708 ("rust: Add warn_on macro")
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
---
 rust/kernel/bug.rs | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/rust/kernel/bug.rs b/rust/kernel/bug.rs
index 364d90c6404c..95bfd195c986 100644
--- a/rust/kernel/bug.rs
+++ b/rust/kernel/bug.rs
@@ -83,8 +83,10 @@ macro_rules! warn_flags {
             _ = $flags;
         }
 
-        // SAFETY: It is always safe to call `warn_slowpath_fmt()`
-        // with a valid null-terminated string.
+        // SAFETY:
+        // - The file name is a null-terminated string with `'static` lifetime.
+        // - `TAINT_WARN` is a valid taint number.
+        // - `fmt` can be NULL, and NULL is passed.
         unsafe {
             $crate::bindings::warn_slowpath_fmt(
                 $crate::c_str!(::core::file!()).as_char_ptr(),
-- 
2.56.0


      reply	other threads:[~2026-11-08  4:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 14:12 FAILED: patch "[PATCH] rust: bug: pass TAINT_WARN to warn_slowpath_fmt() on UML" failed to apply to 6.18-stable tree gregkh
2026-11-04 20:18 ` [PATCH 6.18.y] rust: bug: pass TAINT_WARN to warn_slowpath_fmt() on UML Sasha Levin
2026-11-06  8:23   ` Miguel Ojeda
2026-11-08  4:33 ` [PATCH 6.18.y 1/2] " Miguel Ojeda
2026-11-08  4:33   ` Miguel Ojeda [this message]

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=20261108043327.98801-2-ojeda@kernel.org \
    --to=ojeda@kernel.org \
    --cc=fujita.tomonori@gmail.com \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /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