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]
Date: Mon, 8 Apr 2024 11:26:23 +0200
From: Alice Ryhl <aliceryhl@...gle.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Cc: Benno Lossin <benno.lossin@...ton.me>, Miguel Ojeda <ojeda@...nel.org>, 
	Matthew Wilcox <willy@...radead.org>, Al Viro <viro@...iv.linux.org.uk>, 
	Andrew Morton <akpm@...ux-foundation.org>, Kees Cook <keescook@...omium.org>, 
	Alex Gaynor <alex.gaynor@...il.com>, Wedson Almeida Filho <wedsonaf@...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@...sung.com>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>, 
	Arve Hjønnevåg <arve@...roid.com>, 
	Todd Kjos <tkjos@...roid.com>, Martijn Coenen <maco@...roid.com>, 
	Joel Fernandes <joel@...lfernandes.org>, Carlos Llamas <cmllamas@...gle.com>, 
	Suren Baghdasaryan <surenb@...gle.com>, Arnd Bergmann <arnd@...db.de>, linux-mm@...ck.org, 
	linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org, 
	Christian Brauner <brauner@...nel.org>
Subject: Re: [PATCH v4 4/4] rust: add abstraction for `struct page`

On Mon, Apr 8, 2024 at 11:19 AM Miguel Ojeda
<miguel.ojeda.sandonis@...il.com> wrote:
>
> On Mon, Apr 8, 2024 at 9:54 AM Alice Ryhl <aliceryhl@...gle.com> wrote:
> >
> > From bindgen's point of view, this constant is just an integer literal
> > with no type information. So I don't see how we can expect it to
> > always be generated as a usize?
>
> In the case of `PAGE_SIZE`, there is type information (`size_t`),
> since it comes from the constant helper:
>
>     const size_t RUST_CONST_HELPER_PAGE_SIZE = PAGE_SIZE;
>
> For the other one, `PAGE_SHIFT`, there is also type information
> (`int`), but bindgen currently picks a type based on the value for
> those (but ideally/eventually bindgen should respect it instead).
>
> So for the former, the allow and the cast are not needed since we are
> already handling it explicitly. And for the latter, if we want to have
> it as `usize`, we should have the cast but not the allow, because now
> it does `u32`, but if it respected the type, it would be `c_int` or
> `i32`. So either way we would need the cast.

Good point. Will fix this for next version.

Alice

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ