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: <2c9504c3-2498-4b59-8e26-0911a8be8e96@gmail.com>
Date: Wed, 11 Jun 2025 23:02:45 -0500
From: Andrew Ballance <andrewjballance@...il.com>
To: Alice Ryhl <aliceryhl@...gle.com>
Cc: jbaron@...mai.com, jim.cromie@...il.com, daniel.almeida@...labora.com,
 acourbot@...dia.com, ojeda@...nel.org, alex.gaynor@...il.com,
 boqun.feng@...il.com, gary@...yguo.net, bjorn3_gh@...tonmail.com,
 lossin@...nel.org, a.hindborg@...nel.org, tmgross@...ch.edu,
 dakr@...nel.org, gregkh@...uxfoundation.org, rafael@...nel.org,
 rostedt@...dmis.org, viresh.kumar@...aro.org, lina+kernel@...hilina.net,
 tamird@...il.com, jubalh@...oru.org, rust-for-linux@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 2/3] rust: device add support for dynamic debug to
 pr_debug!

On 6/11/25 4:38 PM, Alice Ryhl wrote:
> Please define a STATIC_KEY_INIT_FALSE constant in
> rust/kernel/jump_label.rs and refer to it. You can use mem::zeroed()
> in the definition of the constant.

Will do for the v2.

> No, we can't use mutable references like this. In Rust, the real
> meaning of &mut is exclusive, not mutable. (And the real meaning of &
> is shared.) We don't have exclusive access to the DEBUG_INFO static
> here - the access is shared, so we must use &_ references instead of
> &mut _ references here.
> 
> Note that by using Opaque, it's possible to mutate the value even if
> it's behind a &_ reference.
> #[repr(transparent)]
> pub struct _Ddebug {
>      pub inner: Opaque<bindings::_ddebug>,
> }
> and then you can do DEBUG_INFO.inner.get() to obtain a mutable raw
> pointer to the contents.
> 

Unfortunately, static_branch_unlikely does not work with keys contained
within a Opaque, because it uses offset_of and sym. I can create a macro
specifically for dealing with Opaque::<type_that_contains_a_static_key>
because I imagine that many uses of static branch will end up wrapped
in an Opaque.

Best regards,
Andrew Ballance

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ