lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <wwIvK-PQ1cuvgLu7VlX_kR2Re7O4IZ_czCWYKQ6BevpEE-rW8OKdXhh5aSpZaZxoAsbMx37508f_7SzbKOd1xEMvYYlsVkNET4fliKbH7ac=@protonmail.com>
Date:   Wed, 15 Feb 2023 17:55:03 +0000
From:   Björn Roy Baron <bjorn3_gh@...tonmail.com>
To:     David Gow <davidgow@...gle.com>
Cc:     Miguel Ojeda <ojeda@...nel.org>,
        Alex Gaynor <alex.gaynor@...il.com>,
        Wedson Almeida Filho <wedsonaf@...il.com>,
        Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
        rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
        stable@...r.kernel.org
Subject: Re: [PATCH] rust: kernel: Mark rust_fmt_argument as extern "C"

On Tuesday, February 14th, 2023 at 23:47, David Gow <davidgow@...gle.com> wrote:

> The rust_fmt_argument function is called from printk() to handle the %pA
> format specifier.
> 
> Since it's called from C, we should mark it extern "C" to make sure it's
> ABI compatible.
> 
> Cc: stable@...r.kernel.org
> Fixes: 247b365dc8dc ("rust: add `kernel` crate")
> Signed-off-by: David Gow davidgow@...gle.com

Reviewed-by: Björn Roy Baron <bjorn3_gh@...tonmail.com>

> 
> ---
> 
> See discussion in:
> https://github.com/Rust-for-Linux/linux/pull/967
> and
> https://github.com/Rust-for-Linux/linux/pull/966
> 
> ---
>  rust/kernel/print.rs | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/rust/kernel/print.rs b/rust/kernel/print.rs
> index 30103325696d..ec457f0952fe 100644
> --- a/rust/kernel/print.rs
> +++ b/rust/kernel/print.rs
> @@ -18,7 +18,7 @@ use crate::bindings;
> 
>  // Called from `vsprintf` with format specifier `%pA`.
>  #[no_mangle]
> -unsafe fn rust_fmt_argument(buf: *mut c_char, end: *mut c_char, ptr: *const c_void) -> *mut c_char {
> +unsafe extern "C" fn rust_fmt_argument(buf: *mut c_char, end: *mut c_char, ptr: *const c_void) -> *mut c_char {
>      use fmt::Write;
>      // SAFETY: The C contract guarantees that `buf` is valid if it's less than `end`.
>      let mut w = unsafe { RawFormatter::from_ptrs(buf.cast(), end.cast()) };
> --
> 2.39.1.581.gbfd45094c4-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ