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: <DA6GUB3YOVBD.RWGBCC8CTE7K@kernel.org>
Date: Tue, 27 May 2025 01:03:26 +0200
From: "Benno Lossin" <lossin@...nel.org>
To: "Tamir Duberstein" <tamird@...il.com>
Cc: "Michal Rostecki" <vadorovsky@...tonmail.com>, "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>, "Andreas
 Hindborg" <a.hindborg@...nel.org>, "Alice Ryhl" <aliceryhl@...gle.com>,
 "Trevor Gross" <tmgross@...ch.edu>, "Brendan Higgins"
 <brendan.higgins@...ux.dev>, "David Gow" <davidgow@...gle.com>, "Rae Moar"
 <rmoar@...gle.com>, "Danilo Krummrich" <dakr@...nel.org>, "Maarten
 Lankhorst" <maarten.lankhorst@...ux.intel.com>, "Maxime Ripard"
 <mripard@...nel.org>, "Thomas Zimmermann" <tzimmermann@...e.de>, "David
 Airlie" <airlied@...il.com>, "Simona Vetter" <simona@...ll.ch>, "Greg
 Kroah-Hartman" <gregkh@...uxfoundation.org>, "Rafael J. Wysocki"
 <rafael@...nel.org>, "Luis Chamberlain" <mcgrof@...nel.org>, "Russ Weight"
 <russ.weight@...ux.dev>, "FUJITA Tomonori" <fujita.tomonori@...il.com>,
 "Rob Herring" <robh@...nel.org>, "Saravana Kannan" <saravanak@...gle.com>,
 "Peter Zijlstra" <peterz@...radead.org>, "Ingo Molnar" <mingo@...hat.com>,
 "Will Deacon" <will@...nel.org>, "Waiman Long" <longman@...hat.com>,
 "Nathan Chancellor" <nathan@...nel.org>, "Nick Desaulniers"
 <nick.desaulniers+lkml@...il.com>, "Bill Wendling" <morbo@...gle.com>,
 "Justin Stitt" <justinstitt@...gle.com>, "Andrew Lunn" <andrew@...n.ch>,
 "Heiner Kallweit" <hkallweit1@...il.com>, "Russell King"
 <linux@...linux.org.uk>, "David S. Miller" <davem@...emloft.net>, "Eric
 Dumazet" <edumazet@...gle.com>, "Jakub Kicinski" <kuba@...nel.org>, "Paolo
 Abeni" <pabeni@...hat.com>, "Bjorn Helgaas" <bhelgaas@...gle.com>, "Arnd
 Bergmann" <arnd@...db.de>, "Jens Axboe" <axboe@...nel.dk>,
 Krzysztof Wilczyński <kwilczynski@...nel.org>,
 <rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
 <linux-kselftest@...r.kernel.org>, <kunit-dev@...glegroups.com>,
 <dri-devel@...ts.freedesktop.org>, <netdev@...r.kernel.org>,
 <devicetree@...r.kernel.org>, <llvm@...ts.linux.dev>,
 <linux-pci@...r.kernel.org>, <nouveau@...ts.freedesktop.org>,
 <linux-block@...r.kernel.org>
Subject: Re: [PATCH v10 3/5] rust: replace `CStr` with `core::ffi::CStr`

On Tue May 27, 2025 at 12:24 AM CEST, Tamir Duberstein wrote:
> On Mon, May 26, 2025 at 10:56 AM Benno Lossin <lossin@...nel.org> wrote:
>>
>> On Sat May 24, 2025 at 10:33 PM CEST, Tamir Duberstein wrote:
>> > `std::ffi::CStr` was moved to `core::ffi::CStr` in Rust 1.64. Replace
>> > `kernel::str::CStr` with `core::ffi::CStr` now that we can.
>>
>> What's this supposed to mean?
>
> It means that kernel::str::CStr was introduced before core::ffi:CStr
> was available. I didn't check this before, but it is indeed true - see
> https://github.com/Rust-for-Linux/linux/commit/faa3cbcca03d0dec8f8e43f1d8d5c0860d98a23f.

I see, then just write that and mention the commit.

>> > C-String literals were added in Rust 1.77. Opportunistically replace
>> > instances of `kernel::c_str!` with C-String literals where other code
>> > changes were already necessary; the rest will be done in a later commit.
>>
>> Similarly this, the message should explain the motivation for the
>> change, the change itself and can include additional information.
>
> The motivation is implied (that using standard types is preferable to
> having custom ones; this is also implicit rather than explicit in
> https://github.com/Rust-for-Linux/linux/issues/1075), but I can
> sharpen it.

Please add this information to the commit message.

>> > Signed-off-by: Tamir Duberstein <tamird@...il.com>
>> > ---
>> >  drivers/gpu/drm/drm_panic_qr.rs |   2 +-
>> >  rust/kernel/device.rs           |   4 +-
>> >  rust/kernel/error.rs            |   4 +-
>> >  rust/kernel/firmware.rs         |  11 +-
>> >  rust/kernel/kunit.rs            |   6 +-
>> >  rust/kernel/miscdevice.rs       |   2 +-
>> >  rust/kernel/net/phy.rs          |   2 +-
>> >  rust/kernel/of.rs               |   2 +-
>> >  rust/kernel/prelude.rs          |   5 +-
>> >  rust/kernel/seq_file.rs         |   4 +-
>> >  rust/kernel/str.rs              | 358 +++++++++-------------------------------
>> >  rust/kernel/sync/condvar.rs     |   2 +-
>> >  rust/kernel/sync/lock.rs        |   2 +-
>> >  rust/kernel/sync/lock/global.rs |   2 +-
>> >  14 files changed, 112 insertions(+), 294 deletions(-)
>>
>> I'm a bit confused by some of the diffs here, they seem pretty messy,
>> any chance that they can be improved?
>
> I'm open to suggestions. I think the confusion arises from git trying
> to keep code from moving; fundamentally much of the change is moving
> methods to an extension trait, which means git has to choose between
> keeping the documentation where it is, or keeping the implementation
> where it is. If I use `--patience` then everything moves together, but
> then the diffstat swells. Thoughts?

I haven't viewed this patch with color-moved (since I haven't applied it
locally), I can try that first and see if it helps.

---
Cheers,
Benno

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ