From: Greg Kroah-Hartman Date: Wed, 11 Sep 2024 12:43:45 +0000 (+0200) Subject: drop queue-6.1/rust-macros-provide-correct-provenance-when-construc.patch X-Git-Tag: v4.19.322~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2d210ed5862dde89421319834d9d2c408a63a82c;p=thirdparty%2Fkernel%2Fstable-queue.git drop queue-6.1/rust-macros-provide-correct-provenance-when-construc.patch --- diff --git a/queue-6.1/rust-macros-provide-correct-provenance-when-construc.patch b/queue-6.1/rust-macros-provide-correct-provenance-when-construc.patch deleted file mode 100644 index a80f8f0f701..00000000000 --- a/queue-6.1/rust-macros-provide-correct-provenance-when-construc.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 5b320b29ddf985d8de92c3afa9aebe13ecd5cfad Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Wed, 28 Aug 2024 11:01:29 -0700 -Subject: rust: macros: provide correct provenance when constructing - THIS_MODULE - -From: Boqun Feng - -[ Upstream commit a5a3c952e82c1ada12bf8c55b73af26f1a454bd2 ] - -Currently while defining `THIS_MODULE` symbol in `module!()`, the -pointer used to construct `ThisModule` is derived from an immutable -reference of `__this_module`, which means the pointer doesn't have -the provenance for writing, and that means any write to that pointer -is UB regardless of data races or not. However, the usage of -`THIS_MODULE` includes passing this pointer to functions that may write -to it (probably in unsafe code), and this will create soundness issues. - -One way to fix this is using `addr_of_mut!()` but that requires the -unstable feature "const_mut_refs". So instead of `addr_of_mut()!`, -an extern static `Opaque` is used here: since `Opaque` is transparent -to `T`, an extern static `Opaque` will just wrap the C symbol (defined -in a C compile unit) in an `Opaque`, which provides a pointer with -writable provenance via `Opaque::get()`. This fix the potential UBs -because of pointer provenance unmatched. - -Reported-by: Alice Ryhl -Signed-off-by: Boqun Feng -Reviewed-by: Alice Ryhl -Reviewed-by: Trevor Gross -Reviewed-by: Benno Lossin -Reviewed-by: Gary Guo -Closes: https://rust-for-linux.zulipchat.com/#narrow/stream/x/topic/x/near/465412664 -Fixes: 1fbde52bde73 ("rust: add `macros` crate") -Cc: stable@vger.kernel.org # 6.6.x: be2ca1e03965: ("rust: types: Make Opaque::get const") -Link: https://lore.kernel.org/r/20240828180129.4046355-1-boqun.feng@gmail.com -[ Fixed two typos, reworded title. - Miguel ] -Signed-off-by: Miguel Ojeda -Signed-off-by: Sasha Levin ---- - rust/macros/module.rs | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/rust/macros/module.rs b/rust/macros/module.rs -index 031028b3dc41..071b96639a2e 100644 ---- a/rust/macros/module.rs -+++ b/rust/macros/module.rs -@@ -183,7 +183,11 @@ pub(crate) fn module(ts: TokenStream) -> TokenStream { - // freed until the module is unloaded. - #[cfg(MODULE)] - static THIS_MODULE: kernel::ThisModule = unsafe {{ -- kernel::ThisModule::from_ptr(&kernel::bindings::__this_module as *const _ as *mut _) -+ extern \"C\" {{ -+ static __this_module: kernel::types::Opaque; -+ }} -+ -+ kernel::ThisModule::from_ptr(__this_module.get()) - }}; - #[cfg(not(MODULE))] - static THIS_MODULE: kernel::ThisModule = unsafe {{ --- -2.43.0 - diff --git a/queue-6.1/series b/queue-6.1/series index fb1ec77db98..e72e33a4efc 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -150,7 +150,6 @@ clocksource-drivers-imx-tpm-fix-next-event-not-taking-effect-sometime.patch clocksource-drivers-timer-of-remove-percpu-irq-related-code.patch uprobes-use-kzalloc-to-allocate-xol-area.patch perf-aux-fix-aux-buffer-serialization.patch -rust-macros-provide-correct-provenance-when-construc.patch fuse-add-expire-only-mode-to-fuse_notify_inval_entry.patch fuse-allow-non-extending-parallel-direct-writes-on-t.patch fuse-add-request-extension.patch