linux-stable/rust
Miguel Ojeda 60cd03ffe9 rust: print: avoid evaluating arguments in `pr_*` macros in `unsafe` blocks
commit 6618d69aa1 upstream.

At the moment it is possible to perform unsafe operations in
the arguments of `pr_*` macros since they are evaluated inside
an `unsafe` block:

    let x = &10u32 as *const u32;
    pr_info!("{}", *x);

In other words, this is a soundness issue.

Fix it so that it requires an explicit `unsafe` block.

Reported-by: Wedson Almeida Filho <wedsonaf@gmail.com>
Reported-by: Domen Puncer Kugler <domen.puncerkugler@nccgroup.com>
Link: https://github.com/Rust-for-Linux/linux/issues/479
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Björn Roy Baron <bjorn3_gh@protonmail.com>
Reviewed-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-02-06 08:06:34 +01:00
..
alloc rust: adapt `alloc` crate to the kernel 2022-09-28 08:57:01 +02:00
bindings rust: add `bindings` crate 2022-09-28 08:58:00 +02:00
kernel rust: print: avoid evaluating arguments in `pr_*` macros in `unsafe` blocks 2023-02-06 08:06:34 +01:00
macros rust: add `macros` crate 2022-09-28 08:58:00 +02:00
.gitignore Kbuild: add Rust support 2022-09-28 09:02:20 +02:00
Makefile Kbuild: add Rust support 2022-09-28 09:02:20 +02:00
bindgen_parameters Kbuild: add Rust support 2022-09-28 09:02:20 +02:00
compiler_builtins.rs rust: add `compiler_builtins` crate 2022-09-28 08:58:00 +02:00
exports.c rust: export generated symbols 2022-09-28 08:59:52 +02:00
helpers.c