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: <CAH5fLgg3aOoFAA5YEXinMsLFpBV0Q86VDizdbTb8unMQgFKnZQ@mail.gmail.com>
Date: Thu, 7 Nov 2024 13:59:09 +0100
From: Alice Ryhl <aliceryhl@...gle.com>
To: Rasmus Villemoes <ravi@...vas.dk>
Cc: FUJITA Tomonori <fujita.tomonori@...il.com>, anna-maria@...utronix.de, 
	frederic@...nel.org, tglx@...utronix.de, jstultz@...gle.com, sboyd@...nel.org, 
	linux-kernel@...r.kernel.org, netdev@...r.kernel.org, 
	rust-for-linux@...r.kernel.org, andrew@...n.ch, hkallweit1@...il.com, 
	tmgross@...ch.edu, ojeda@...nel.org, alex.gaynor@...il.com, gary@...yguo.net, 
	bjorn3_gh@...tonmail.com, benno.lossin@...ton.me, a.hindborg@...sung.com, 
	arnd@...db.de
Subject: Re: [PATCH v5 6/7] rust: Add read_poll_timeout functions

On Thu, Nov 7, 2024 at 1:50 PM Rasmus Villemoes <ravi@...vas.dk> wrote:
>
> On Fri, Nov 01 2024, FUJITA Tomonori <fujita.tomonori@...il.com> wrote:
>
> > For the proper debug info, readx_poll_timeout() and __might_sleep()
> > are implemented as a macro. We could implement them as a normal
> > function if there is a clean way to get a null-terminated string
> > without allocation from core::panic::Location::file().
>
> Would it be too much to hope for either a compiler flag or simply
> default behaviour for having the backing, static store of the file!()
> &str being guaranteed to be followed by a nul character? (Of course that
> nul should not be counted in the slice's length). That would in general
> increase interop with C code.
>
> This is hardly the last place where Rust code would pass
> Location::file() into C, and having to pass that as a (ptr,len) pair
> always and updating the receiving C code to use %.*s seems like an
> uphill battle, especially when the C code passes the const char* pointer
> through a few layers before it is finally passed to a printf-like
> function.

This is actively being discussed at:
https://github.com/rust-lang/libs-team/issues/466

> And creating the nul-terminated strings with c_str! needlessly doubles
> the storage needed for the file names (unless the rust compiler is smart
> enough to then re-use the c_str result for the backing store of the
> file!() &str).

For the case of c_str!(file!()), the compiler should do the right
thing. Not via deduplication, but via removal of unused globals.

Alice

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ