[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YzMVcM/TxIA7S/1B@kroah.com>
Date: Tue, 27 Sep 2022 17:23:28 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Miguel Ojeda <ojeda@...nel.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org, patches@...ts.linux.dev,
Jarkko Sakkinen <jarkko@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Finn Behrens <me@...enk.de>,
Wedson Almeida Filho <wedsonaf@...gle.com>,
Sven Van Asbroeck <thesven73@...il.com>,
Gary Guo <gary@...yguo.net>,
Maciej Falkowski <m.falkowski@...sung.com>,
Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Boqun Feng <boqun.feng@...il.com>
Subject: Re: [PATCH v10 11/27] rust: add `bindings` crate
On Tue, Sep 27, 2022 at 03:14:42PM +0200, Miguel Ojeda wrote:
> This crate contains the bindings to the C side of the kernel.
>
> Calling C (in general, FFI) is assumed to be unsafe in Rust
> and, in many cases, this is accurate. For instance, virtually
> all C functions that take a pointer are unsafe since, typically,
> it will be dereferenced at some point (and in most cases there
> is no way for the callee to check its validity beforehand).
>
> Since one of the goals of using Rust in the kernel is precisely
> to avoid unsafe code in "leaf" kernel modules (e.g. drivers),
> these bindings should not be used directly by them.
>
> Instead, these bindings need to be wrapped into safe abstractions.
> These abstractions provide a safe API that kernel modules can use.
> In this way, unsafe code in kernel modules is minimized.
>
> Co-developed-by: Alex Gaynor <alex.gaynor@...il.com>
> Signed-off-by: Alex Gaynor <alex.gaynor@...il.com>
> Co-developed-by: Finn Behrens <me@...enk.de>
> Signed-off-by: Finn Behrens <me@...enk.de>
> Co-developed-by: Wedson Almeida Filho <wedsonaf@...gle.com>
> Signed-off-by: Wedson Almeida Filho <wedsonaf@...gle.com>
> Co-developed-by: Sven Van Asbroeck <thesven73@...il.com>
> Signed-off-by: Sven Van Asbroeck <thesven73@...il.com>
> Co-developed-by: Gary Guo <gary@...yguo.net>
> Signed-off-by: Gary Guo <gary@...yguo.net>
> Co-developed-by: Maciej Falkowski <m.falkowski@...sung.com>
> Signed-off-by: Maciej Falkowski <m.falkowski@...sung.com>
> Co-developed-by: Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>
> Co-developed-by: Björn Roy Baron <bjorn3_gh@...tonmail.com>
> Signed-off-by: Björn Roy Baron <bjorn3_gh@...tonmail.com>
> Signed-off-by: Miguel Ojeda <ojeda@...nel.org>
> ---
> rust/bindings/bindings_helper.h | 13 ++++++++
> rust/bindings/lib.rs | 53 +++++++++++++++++++++++++++++++++
> 2 files changed, 66 insertions(+)
> create mode 100644 rust/bindings/bindings_helper.h
> create mode 100644 rust/bindings/lib.rs
Reviewed-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Powered by blists - more mailing lists