* FAILED: patch "[PATCH] rust: kbuild: workaround `rustdoc` doctests modifier bug" failed to apply to 6.12-stable tree
@ 2025-11-08 5:24 gregkh
2025-11-08 14:03 ` [PATCH 6.12.y] rust: kbuild: workaround `rustdoc` doctests modifier bug Sasha Levin
2025-11-09 17:28 ` FAILED: patch "[PATCH] rust: kbuild: workaround `rustdoc` doctests modifier bug" failed to apply to 6.12-stable tree Miguel Ojeda
0 siblings, 2 replies; 7+ messages in thread
From: gregkh @ 2025-11-08 5:24 UTC (permalink / raw)
To: ojeda, aliceryhl, jforbes; +Cc: stable
The patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x fad472efab0a805dd939f017c5b8669a786a4bcf
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2025110805-fame-viability-c333@gregkh' --subject-prefix 'PATCH 6.12.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From fad472efab0a805dd939f017c5b8669a786a4bcf Mon Sep 17 00:00:00 2001
From: Miguel Ojeda <ojeda@kernel.org>
Date: Sun, 2 Nov 2025 22:28:53 +0100
Subject: [PATCH] rust: kbuild: workaround `rustdoc` doctests modifier bug
The `rustdoc` modifiers bug [1] was fixed in Rust 1.90.0 [2], for which
we added a workaround in commit abbf9a449441 ("rust: workaround `rustdoc`
target modifiers bug").
However, `rustdoc`'s doctest generation still has a similar issue [3],
being fixed at [4], which does not affect us because we apply the
workaround to both, and now, starting with Rust 1.91.0 (released
2025-10-30), `-Zsanitizer` is a target modifier too [5], which means we
fail with:
RUSTDOC TK rust/kernel/lib.rs
error: mixing `-Zsanitizer` will cause an ABI mismatch in crate `kernel`
--> rust/kernel/lib.rs:3:1
|
3 | //! The `kernel` crate.
| ^
|
= help: the `-Zsanitizer` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely
= note: unset `-Zsanitizer` in this crate is incompatible with `-Zsanitizer=kernel-address` in dependency `core`
= help: set `-Zsanitizer=kernel-address` in this crate or unset `-Zsanitizer` in `core`
= help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=sanitizer` to silence this error
A simple way around is to add the sanitizer to the list in the existing
workaround (especially if we had not started to pass the sanitizer
flags in the previous commit, since in that case that would not be
necessary). However, that still applies the workaround in more cases
than necessary.
Instead, only modify the doctests flags to ignore the check for
sanitizers, so that it is more local (and thus the compiler keeps checking
it for us in the normal `rustdoc` calls). Since the previous commit
already treated the `rustdoc` calls as kernel objects, this should allow
us in the future to easily remove this workaround when the time comes.
By the way, the `-Cunsafe-allow-abi-mismatch` flag overwrites previous
ones rather than appending, so it needs to be all done in the same flag.
Moreover, unknown modifiers are rejected, and thus we have to gate based
on the version too.
Finally, `-Zsanitizer-cfi-normalize-integers` is not affected (in Rust
1.91.0), so it is not needed in the workaround for the moment.
Cc: stable@vger.kernel.org # Needed in 6.12.y and later (Rust is pinned in older LTSs).
Link: https://github.com/rust-lang/rust/issues/144521 [1]
Link: https://github.com/rust-lang/rust/pull/144523 [2]
Link: https://github.com/rust-lang/rust/issues/146465 [3]
Link: https://github.com/rust-lang/rust/pull/148068 [4]
Link: https://github.com/rust-lang/rust/pull/138736 [5]
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Tested-by: Justin M. Forbes <jforbes@fedoraproject.org>
Link: https://patch.msgid.link/20251102212853.1505384-2-ojeda@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
diff --git a/rust/Makefile b/rust/Makefile
index a9fb9354b659..3e545c1a0ff4 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -69,6 +69,9 @@ core-edition := $(if $(call rustc-min-version,108700),2024,2021)
# the time being (https://github.com/rust-lang/rust/issues/144521).
rustdoc_modifiers_workaround := $(if $(call rustc-min-version,108800),-Cunsafe-allow-abi-mismatch=fixed-x18)
+# Similarly, for doctests (https://github.com/rust-lang/rust/issues/146465).
+doctests_modifiers_workaround := $(rustdoc_modifiers_workaround)$(if $(call rustc-min-version,109100),$(comma)sanitizer)
+
# `rustc` recognizes `--remap-path-prefix` since 1.26.0, but `rustdoc` only
# since Rust 1.81.0. Moreover, `rustdoc` ICEs on out-of-tree builds since Rust
# 1.82.0 (https://github.com/rust-lang/rust/issues/138520). Thus workaround both
@@ -236,7 +239,7 @@ quiet_cmd_rustdoc_test_kernel = RUSTDOC TK $<
--extern bindings --extern uapi \
--no-run --crate-name kernel -Zunstable-options \
--sysroot=/dev/null \
- $(rustdoc_modifiers_workaround) \
+ $(doctests_modifiers_workaround) \
--test-builder $(objtree)/scripts/rustdoc_test_builder \
$< $(rustdoc_test_kernel_quiet); \
$(objtree)/scripts/rustdoc_test_gen
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 6.12.y] rust: kbuild: workaround `rustdoc` doctests modifier bug
2025-11-08 5:24 FAILED: patch "[PATCH] rust: kbuild: workaround `rustdoc` doctests modifier bug" failed to apply to 6.12-stable tree gregkh
@ 2025-11-08 14:03 ` Sasha Levin
2025-11-09 17:21 ` Miguel Ojeda
2025-11-09 17:28 ` FAILED: patch "[PATCH] rust: kbuild: workaround `rustdoc` doctests modifier bug" failed to apply to 6.12-stable tree Miguel Ojeda
1 sibling, 1 reply; 7+ messages in thread
From: Sasha Levin @ 2025-11-08 14:03 UTC (permalink / raw)
To: stable; +Cc: Miguel Ojeda, Alice Ryhl, Justin M. Forbes, Sasha Levin
From: Miguel Ojeda <ojeda@kernel.org>
[ Upstream commit fad472efab0a805dd939f017c5b8669a786a4bcf ]
The `rustdoc` modifiers bug [1] was fixed in Rust 1.90.0 [2], for which
we added a workaround in commit abbf9a449441 ("rust: workaround `rustdoc`
target modifiers bug").
However, `rustdoc`'s doctest generation still has a similar issue [3],
being fixed at [4], which does not affect us because we apply the
workaround to both, and now, starting with Rust 1.91.0 (released
2025-10-30), `-Zsanitizer` is a target modifier too [5], which means we
fail with:
RUSTDOC TK rust/kernel/lib.rs
error: mixing `-Zsanitizer` will cause an ABI mismatch in crate `kernel`
--> rust/kernel/lib.rs:3:1
|
3 | //! The `kernel` crate.
| ^
|
= help: the `-Zsanitizer` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely
= note: unset `-Zsanitizer` in this crate is incompatible with `-Zsanitizer=kernel-address` in dependency `core`
= help: set `-Zsanitizer=kernel-address` in this crate or unset `-Zsanitizer` in `core`
= help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=sanitizer` to silence this error
A simple way around is to add the sanitizer to the list in the existing
workaround (especially if we had not started to pass the sanitizer
flags in the previous commit, since in that case that would not be
necessary). However, that still applies the workaround in more cases
than necessary.
Instead, only modify the doctests flags to ignore the check for
sanitizers, so that it is more local (and thus the compiler keeps checking
it for us in the normal `rustdoc` calls). Since the previous commit
already treated the `rustdoc` calls as kernel objects, this should allow
us in the future to easily remove this workaround when the time comes.
By the way, the `-Cunsafe-allow-abi-mismatch` flag overwrites previous
ones rather than appending, so it needs to be all done in the same flag.
Moreover, unknown modifiers are rejected, and thus we have to gate based
on the version too.
Finally, `-Zsanitizer-cfi-normalize-integers` is not affected (in Rust
1.91.0), so it is not needed in the workaround for the moment.
Cc: stable@vger.kernel.org # Needed in 6.12.y and later (Rust is pinned in older LTSs).
Link: https://github.com/rust-lang/rust/issues/144521 [1]
Link: https://github.com/rust-lang/rust/pull/144523 [2]
Link: https://github.com/rust-lang/rust/issues/146465 [3]
Link: https://github.com/rust-lang/rust/pull/148068 [4]
Link: https://github.com/rust-lang/rust/pull/138736 [5]
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Tested-by: Justin M. Forbes <jforbes@fedoraproject.org>
Link: https://patch.msgid.link/20251102212853.1505384-2-ojeda@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
[ added --remap-path-prefix comments missing in stable branch ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
rust/Makefile | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/rust/Makefile b/rust/Makefile
index 07c13100000cd..bd1d21f116e30 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -59,6 +59,8 @@ core-edition := $(if $(call rustc-min-version,108700),2024,2021)
# the time being (https://github.com/rust-lang/rust/issues/144521).
rustdoc_modifiers_workaround := $(if $(call rustc-min-version,108800),-Cunsafe-allow-abi-mismatch=fixed-x18)
+# Similarly, for doctests (https://github.com/rust-lang/rust/issues/146465).
+doctests_modifiers_workaround := $(rustdoc_modifiers_workaround)$(if $(call rustc-min-version,109100),$(comma)sanitizer)
quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $<
cmd_rustdoc = \
OBJTREE=$(abspath $(objtree)) \
@@ -183,7 +185,7 @@ quiet_cmd_rustdoc_test_kernel = RUSTDOC TK $<
--extern bindings --extern uapi \
--no-run --crate-name kernel -Zunstable-options \
--sysroot=/dev/null \
- $(rustdoc_modifiers_workaround) \
+ $(doctests_modifiers_workaround) \
--test-builder $(objtree)/scripts/rustdoc_test_builder \
$< $(rustdoc_test_kernel_quiet); \
$(objtree)/scripts/rustdoc_test_gen
--
2.51.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 6.12.y] rust: kbuild: workaround `rustdoc` doctests modifier bug
2025-11-08 14:03 ` [PATCH 6.12.y] rust: kbuild: workaround `rustdoc` doctests modifier bug Sasha Levin
@ 2025-11-09 17:21 ` Miguel Ojeda
2025-11-09 17:24 ` Miguel Ojeda
2025-11-10 12:15 ` Sasha Levin
0 siblings, 2 replies; 7+ messages in thread
From: Miguel Ojeda @ 2025-11-09 17:21 UTC (permalink / raw)
To: Sasha Levin; +Cc: stable, Miguel Ojeda, Alice Ryhl, Justin M. Forbes
On Sat, Nov 8, 2025 at 3:03 PM Sasha Levin <sashal@kernel.org> wrote:
>
> [ added --remap-path-prefix comments missing in stable branch ]
Do you mean you added the patch that added that workaround? Which branch?
The resolution below does not show the comments, so I am confused. The
resolution itself seems OK, but that line on the log plus not seeing
the comments in the diff that are supposedly added somewhere else
seems odd.
(I would add a new line here before `quiet_cmd_rustdoc`).
Thanks!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 6.12.y] rust: kbuild: workaround `rustdoc` doctests modifier bug
2025-11-09 17:21 ` Miguel Ojeda
@ 2025-11-09 17:24 ` Miguel Ojeda
2025-11-10 12:15 ` Sasha Levin
1 sibling, 0 replies; 7+ messages in thread
From: Miguel Ojeda @ 2025-11-09 17:24 UTC (permalink / raw)
To: Sasha Levin; +Cc: stable, Miguel Ojeda, Alice Ryhl, Justin M. Forbes
On Sun, Nov 9, 2025 at 6:21 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> Do you mean you added the patch that added that workaround? Which branch?
>
> The resolution below does not show the comments, so I am confused. The
> resolution itself seems OK, but that line on the log plus not seeing
> the comments in the diff that are supposedly added somewhere else
> seems odd.
Or maybe the line means it is adding the comments here, because the
stable branch misses them, but those comments are not in the
resolution either (and I am not sure why we would add them here in
this patch anyway).
Cheers,
Miguel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: FAILED: patch "[PATCH] rust: kbuild: workaround `rustdoc` doctests modifier bug" failed to apply to 6.12-stable tree
2025-11-08 5:24 FAILED: patch "[PATCH] rust: kbuild: workaround `rustdoc` doctests modifier bug" failed to apply to 6.12-stable tree gregkh
2025-11-08 14:03 ` [PATCH 6.12.y] rust: kbuild: workaround `rustdoc` doctests modifier bug Sasha Levin
@ 2025-11-09 17:28 ` Miguel Ojeda
1 sibling, 0 replies; 7+ messages in thread
From: Miguel Ojeda @ 2025-11-09 17:28 UTC (permalink / raw)
To: gregkh; +Cc: ojeda, aliceryhl, jforbes, stable
On Sat, Nov 8, 2025 at 6:24 AM <gregkh@linuxfoundation.org> wrote:
>
> The patch below does not apply to the 6.12-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.
>
> To reproduce the conflict and resubmit, you may use the following commands:
>
> git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
> git checkout FETCH_HEAD
> git cherry-pick -x fad472efab0a805dd939f017c5b8669a786a4bcf
> # <resolve conflicts, build, test, etc.>
> git commit -s
> git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2025110805-fame-viability-c333@gregkh' --subject-prefix 'PATCH 6.12.y' HEAD^..
I replied in Sasha's sibling resolution -- there is something odd in
the log which I would like to understand.
Cheers,
Miguel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 6.12.y] rust: kbuild: workaround `rustdoc` doctests modifier bug
2025-11-09 17:21 ` Miguel Ojeda
2025-11-09 17:24 ` Miguel Ojeda
@ 2025-11-10 12:15 ` Sasha Levin
2025-11-10 12:16 ` Miguel Ojeda
1 sibling, 1 reply; 7+ messages in thread
From: Sasha Levin @ 2025-11-10 12:15 UTC (permalink / raw)
To: Miguel Ojeda; +Cc: stable, Miguel Ojeda, Alice Ryhl, Justin M. Forbes
On Sun, Nov 09, 2025 at 06:21:19PM +0100, Miguel Ojeda wrote:
>On Sat, Nov 8, 2025 at 3:03 PM Sasha Levin <sashal@kernel.org> wrote:
>>
>> [ added --remap-path-prefix comments missing in stable branch ]
>
>Do you mean you added the patch that added that workaround? Which branch?
>
>The resolution below does not show the comments, so I am confused. The
>resolution itself seems OK, but that line on the log plus not seeing
>the comments in the diff that are supposedly added somewhere else
>seems odd.
Sorry, it should have been s/added/removed - there's a comment upstream about
--remap-path-prefix that doesn't exist in the 6.12 tree.
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 6.12.y] rust: kbuild: workaround `rustdoc` doctests modifier bug
2025-11-10 12:15 ` Sasha Levin
@ 2025-11-10 12:16 ` Miguel Ojeda
0 siblings, 0 replies; 7+ messages in thread
From: Miguel Ojeda @ 2025-11-10 12:16 UTC (permalink / raw)
To: Sasha Levin; +Cc: stable, Miguel Ojeda, Alice Ryhl, Justin M. Forbes
On Mon, Nov 10, 2025 at 1:15 PM Sasha Levin <sashal@kernel.org> wrote:
>
> Sorry, it should have been s/added/removed - there's a comment upstream about
> --remap-path-prefix that doesn't exist in the 6.12 tree.
Ah, so just adjusting context -- got it, thanks!
(I got confused because in the other Rust patch you said that, so I
thought this was about something more involved.)
Cheers,
Miguel
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-11-10 12:16 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-08 5:24 FAILED: patch "[PATCH] rust: kbuild: workaround `rustdoc` doctests modifier bug" failed to apply to 6.12-stable tree gregkh
2025-11-08 14:03 ` [PATCH 6.12.y] rust: kbuild: workaround `rustdoc` doctests modifier bug Sasha Levin
2025-11-09 17:21 ` Miguel Ojeda
2025-11-09 17:24 ` Miguel Ojeda
2025-11-10 12:15 ` Sasha Levin
2025-11-10 12:16 ` Miguel Ojeda
2025-11-09 17:28 ` FAILED: patch "[PATCH] rust: kbuild: workaround `rustdoc` doctests modifier bug" failed to apply to 6.12-stable tree Miguel Ojeda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox