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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZC3UdivcMmcZ5MTJ@wedsonaf-dev>
Date:   Wed, 5 Apr 2023 17:05:10 -0300
From:   Wedson Almeida Filho <wedsonaf@...il.com>
To:     Greg KH <gregkh@...uxfoundation.org>
Cc:     rust-for-linux@...r.kernel.org, Miguel Ojeda <ojeda@...nel.org>,
        Alex Gaynor <alex.gaynor@...il.com>,
        Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
        Björn Roy Baron <bjorn3_gh@...tonmail.com>,
        linux-kernel@...r.kernel.org,
        Wedson Almeida Filho <walmeida@...rosoft.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>,
        Waiman Long <longman@...hat.com>
Subject: Re: [PATCH v2 01/13] rust: sync: introduce `LockClassKey`

On Wed, Apr 05, 2023 at 08:00:15PM +0200, Greg KH wrote:
> On Wed, Apr 05, 2023 at 02:50:59PM -0300, Wedson Almeida Filho wrote:
> > From: Wedson Almeida Filho <walmeida@...rosoft.com>
> > 
> > +/// Represents a lockdep class. It's a wrapper around C's `lock_class_key`.
> > +#[repr(transparent)]
> > +pub struct LockClassKey(Opaque<bindings::lock_class_key>);
> 
> Will this disappear into "nothing" if lockdep is disabled in the build?
> 
> If not, it should, if so, I couldn't see where that option was, sorry
> for the noise.

Yeah, the C definition of lock_class_key is an empty struct, which is a
zero-sized type. So instances of this type will occupy 0 bytes.

We'll still have the cost of passing pointers from Rust to C of instances of
this type, which we could add an alternate version (dependent on lockdep being
enabled or not) in Rust to avoid, but since it will be optimised away when LTO
is enabled and doesn't add up to much when LTO is disabled, we chose the simpler
option of having a single implementation.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ