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: <549e2bc42037ca6b366947160784794091069a07.camel@nvidia.com>
Date: Mon, 12 May 2025 20:51:53 +0000
From: Timur Tabi <ttabi@...dia.com>
To: "tmgross@...ch.edu" <tmgross@...ch.edu>, "benno.lossin@...ton.me"
	<benno.lossin@...ton.me>, "gregkh@...uxfoundation.org"
	<gregkh@...uxfoundation.org>, "gary@...yguo.net" <gary@...yguo.net>,
	"mmaurer@...gle.com" <mmaurer@...gle.com>, "a.hindborg@...nel.org"
	<a.hindborg@...nel.org>, "bjorn3_gh@...tonmail.com"
	<bjorn3_gh@...tonmail.com>, "boqun.feng@...il.com" <boqun.feng@...il.com>,
	"dakr@...nel.org" <dakr@...nel.org>, "alex.gaynor@...il.com"
	<alex.gaynor@...il.com>, "aliceryhl@...gle.com" <aliceryhl@...gle.com>,
	"ojeda@...nel.org" <ojeda@...nel.org>, "rafael@...nel.org"
	<rafael@...nel.org>, "samitolvanen@...gle.com" <samitolvanen@...gle.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"rust-for-linux@...r.kernel.org" <rust-for-linux@...r.kernel.org>
Subject: Re: [PATCH v5 2/4] rust: debugfs: Bind file creation for long-lived
 Display

On Mon, 2025-05-05 at 23:51 +0000, Matthew Maurer wrote:
> +    pub(crate) unsafe extern "C" fn display_act<T: Display>(
> +        seq: *mut bindings::seq_file,
> +        _: *mut core::ffi::c_void,
> +    ) -> i32 {
> +        // SAFETY: By caller precondition, this pointer is live, points to a value of type `T`,
> and
> +        // is not being mutated.
> +        let data = unsafe { &*((*seq).private as *mut T) };
> +        // SAFETY: By caller precondition, `seq_file` points to a live `seq_file`, so we can lift
> +        // it.
> +        let seq_file = unsafe { SeqFile::from_raw(seq) };
> +        seq_print!(seq_file, "{}", data);

Doesn't this restrict T to data types that are supported by "{}"?  So, for example, T cannot be a
Vec, correct?

For nova-core, we need to be able to "print" an array of bytes as-is.  Specifically, a DMA buffer
that just contains binary data.  But by using seq_print!, aren't we forcing T to contain only
printable characters?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ