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: <081f7e9b-a769-b4cf-4df4-b0bb5c9a1594@antgroup.com>
Date:   Mon, 17 Jul 2023 11:42:34 +0800
From:   "Qingsong Chen" <changxian.cqs@...group.com>
To:     Benno Lossin <benno.lossin@...ton.me>
Cc:     <linux-kernel@...r.kernel.org>,
        "田洪亮" <tate.thl@...group.com>,
        "Miguel Ojeda" <ojeda@...nel.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>,
        <rust-for-linux@...r.kernel.org>
Subject: Re: [RFC PATCH 2/8] rust: kernel: add `request` related
 TargetOperations

On 7/14/23 11:49 PM, Benno Lossin wrote:
>> @@ -31,6 +31,39 @@ pub trait TargetOperations: Sized {
>>      /// Map block IOs. Return [`MapState`] to indicate how to handle the `bio`
>>      /// later (end or resubmit).
>>      fn map(t: &mut Target<Self>, bio: Pin<&mut Bio>) -> MapState;
>> +
>> +    /// Map `request`. Return [`MapState`] and the optional cloned `request`.
>> +    #[allow(unused)]
>> +    fn clone_and_map_rq<'a>(
>> +        t: &mut Target<Self>,
>> +        rq: Pin<&mut Request>,
>> +        map_ctx: &mut MapInfo,
>> +    ) -> (MapState, Option<Pin<&'a mut Request>>) {
>> +        unimplemented!()
> 
> Note that these should be implemented when you submit this as an actual
> patch. (Not sure what you would do in this case, but throwing a panic is
> not a good idea.) This also applies to all subsequent patches.
> I think you might have done this, because you want the C side to choose
> the default implementation. But it should also be possible to call these
> from the Rust side.

In fact, we don't want users to call these callbacks manually. The 
normal call-chain would be like this: `map_request`(c) ->
`dm_clone_and_map_rq_fn`(unsafe rust) -> `clone_and_map_rq`(rust).
If users don't implement `clone_and_map_rq`, we would check the
corresponding field of `TargetType`, using the `check_target_operations`
macro. So it won't call the default implementation generally.

Regards,
Qingsong

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ