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: <D9CK8IQAKV4Z.2YOX7NIAGTOS4@proton.me>
Date: Mon, 21 Apr 2025 19:23:09 +0000
From: Benno Lossin <benno.lossin@...ton.me>
To: Guangbo Cui <2407018371@...com>
Cc: a.hindborg@...nel.org, alex.gaynor@...il.com, aliceryhl@...gle.com, bjorn3_gh@...tonmail.com, boqun.feng@...il.com, gary@...yguo.net, gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org, ojeda@...nel.org, rust-for-linux@...r.kernel.org, simona.vetter@...ll.ch, tmgross@...ch.edu
Subject: Re: [PATCH v3 3/4] rust: validate: add `Validate` trait

On Mon Apr 21, 2025 at 6:47 PM CEST, Guangbo Cui wrote:
> Really cool patch! I got a few thoughts below.

Thanks!

>> +    /// Validate the underlying untrusted data.
>> +    ///
>> +    /// See the [`Validate`] trait for more information.
>> +    pub fn validate_mut<'a, V: Validate<&'a mut Self>>(&'a mut self) -> Result<V, V::Err> {
>> +        V::validate(&mut self.0)
>> +    }
>>  }
>
> The `validate_ref` and `validate_mut` functions should just call `V::validate(self)`
> directly, since self is an Untrusted<T>, and you already implemented ValidateInput for it.
> Calling `V::validate(&self.0)` would cause a type mismatch error.

Ah good catch, but the fix should be a different one. I intend to remove
the `Untrusted` wrapper in the input to `Validate::validate`, as
otherwise one would not be able to access the underlying value.

Maybe I don't need the `ValidateInput` trait after all. So the signature
of `validate{,_ref,_mut}` should ask for `V: Validate<{T, &T, &mut T}>`
instead.

---
Cheers,
Benno


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ