[PATCH v1] rust: bug: pass TAINT_WARN to warn_slowpath_fmt() on UML

Miguel Ojeda miguel.ojeda.sandonis at gmail.com
Fri Oct 2 00:06:47 PDT 2026


On Thu, Oct 1, 2026 at 2:31 PM FUJITA Tomonori <tomo at flapping.org> wrote:
>
> From: FUJITA Tomonori <fujita.tomonori at gmail.com>
>
> On UML, `warn_flags!` calls `warn_slowpath_fmt()` directly. Its third
> argument is a taint number, but `warn_on!` passes its bug flags there.
>
> As a result, `add_taint()` gets 2304 instead of 9 (`TAINT_WARN`). The
> warning is not recorded: `/proc/sys/kernel/tainted` stays 0 after
> `warn_on!` fires, where it should be 512. It also causes an
> out-of-bounds write in `add_taint()`.
>
> Pass `TAINT_WARN` directly, as C does on UML.
>
> Cc: stable at vger.kernel.org
> Fixes: dff64b072708 ("rust: Add warn_on macro")
> Signed-off-by: FUJITA Tomonori <fujita.tomonori at gmail.com>

Applied to `rust-next` -- thanks!

We should update the `// SAFETY: It is always safe to call
`warn_slowpath_fmt() ...` comment to cover everything that may go
wrong (like it did).

Cheers,
Miguel



More information about the linux-um mailing list