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: <CANiq72m0cuf5YKfOY8oNg83dzWEqqyddGKKh_6fwQQ4hoCp+yQ@mail.gmail.com>
Date: Sat, 3 May 2025 13:18:40 +0200
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Andreas Hindborg <a.hindborg@...nel.org>
Cc: Danilo Krummrich <dakr@...nel.org>, 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>, 
	Benno Lossin <benno.lossin@...ton.me>, Alice Ryhl <aliceryhl@...gle.com>, 
	Trevor Gross <tmgross@...ch.edu>, Joel Becker <jlbec@...lplan.org>, 
	Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>, 
	Waiman Long <longman@...hat.com>, Fiona Behrens <me@...enk.dev>, 
	Charalampos Mitrodimas <charmitro@...teo.net>, Daniel Almeida <daniel.almeida@...labora.com>, 
	Breno Leitao <leitao@...ian.org>, rust-for-linux@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6 1/3] rust: configfs: introduce rust support for configfs

On Fri, May 2, 2025 at 8:57 AM Andreas Hindborg <a.hindborg@...nel.org> wrote:
>
> Right, they are not from const context, but they are inside a `let`
> statement, so if all the captured variables are constant (which they
> are), the let statement will be evaluated in const context [1], right?

No, I don't think so. Though I don't know what you mean by "captured
variables" here or why you point to [const-eval.const-context.init].

The way I read the reference is that Rust only guarantees evaluation
at compile-time within const contexts, and a `let` statement is not a
const context and its initializer is not one of the ones listed in
[const-eval.const-context.init]. `const fn` isn't a const context
either.

Which makes sense -- the `let` initializers are just "normal"
expressions, i.e. you don't want to limit the kinds of code you can
run there.

For instance, here there is a panic at runtime trying to mimic a bit the patch:

    https://godbolt.org/z/v5qdK9vve

Similarly, if I take your patch and put there an `assert!(false)` in
`add` -- I see no build error and `objdump` shows the panic call from
the sample.

Cheers,
Miguel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ