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] [day] [month] [year] [list]
Message-Id: <DA8ZZA7P2QUW.ODHEX4NB0RTB@kernel.org>
Date: Fri, 30 May 2025 00:28:37 +0200
From: "Benno Lossin" <lossin@...nel.org>
To: "Tamir Duberstein" <tamird@...il.com>
Cc: "Alice Ryhl" <aliceryhl@...gle.com>, "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>,
 "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 4/5] rust: replace `kernel::c_str!` with C-Strings

On Fri May 30, 2025 at 12:21 AM CEST, Tamir Duberstein wrote:
> On Wed, May 28, 2025 at 11:35 AM Benno Lossin <lossin@...nel.org> wrote:
>> On Wed May 28, 2025 at 12:36 PM CEST, Alice Ryhl wrote:
>> > On Mon, May 26, 2025 at 06:29:46PM -0400, Tamir Duberstein wrote:
>> >> On Mon, May 26, 2025 at 11:04 AM Benno Lossin <lossin@...nel.org> wrote:
>> >> >
>> >> > On Sat May 24, 2025 at 10:33 PM CEST, Tamir Duberstein wrote:
>> >> > > +macro_rules! c_str_avoid_literals {
>> >> >
>> >> > I don't like this name, how about `concat_to_c_str` or
>> >> > `concat_with_nul`?
>> >> >
>> >> > This macro also is useful from macros that have a normal string literal,
>> >> > but can't turn it into a `c""` one.
>> >>
>> >> Uh, can you give an example? I'm not attached to the name.
>> >
>> > I also think it should be renamed. Right now it sounds like it creates a
>> > c string while avoiding literals in the input ... whatever that means.
>>
>> Yeah that's a good way to put why the name is weird.
>>
>> > I like Benno's suggestions, but str_to_cstr! could also work?
>>
>> Hmm, I think then people won't know that it can also concat? I don't
>> think it matters too much, the macro probably won't be used that often
>> and if someone needs to use it, they probably wouldn't fine it by name
>> alone.
>
> What do you mean by "it can also concat"? This macro by itself doesn't
> concat, it takes only a single expr.

Oh right, seems like I thought it took `$($t:tt)*`...

> The example in the docs illustrates:
>
>     const MY_CSTR: &CStr = c_str_avoid_literals!(concat!(...));
>
> I think str_to_cstr is ok - I'll do that in v11.

Sounds good!

---
Cheers,
Benno

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ