Re: [PATCH v10 11/27] rust: add `bindings` crate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
> Signed-off-by: Alex Gaynor <alex.gaynor@xxxxxxxxx>
> Co-developed-by: Finn Behrens <me@xxxxxxxxx>
> Signed-off-by: Finn Behrens <me@xxxxxxxxx>
> Co-developed-by: Wedson Almeida Filho <wedsonaf@xxxxxxxxxx>
> Signed-off-by: Wedson Almeida Filho <wedsonaf@xxxxxxxxxx>
> Co-developed-by: Sven Van Asbroeck <thesven73@xxxxxxxxx>
> Signed-off-by: Sven Van Asbroeck <thesven73@xxxxxxxxx>
> Co-developed-by: Gary Guo <gary@xxxxxxxxxxx>
> Signed-off-by: Gary Guo <gary@xxxxxxxxxxx>
> Co-developed-by: Maciej Falkowski <m.falkowski@xxxxxxxxxxx>
> Signed-off-by: Maciej Falkowski <m.falkowski@xxxxxxxxxxx>
> Co-developed-by: Jiapeng Chong <jiapeng.chong@xxxxxxxxxxxxxxxxx>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@xxxxxxxxxxxxxxxxx>
> Co-developed-by: Björn Roy Baron <bjorn3_gh@xxxxxxxxxxxxxx>
> Signed-off-by: Björn Roy Baron <bjorn3_gh@xxxxxxxxxxxxxx>
> Signed-off-by: Miguel Ojeda <ojeda@xxxxxxxxxx>
> ---
>  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@xxxxxxxxxxxxxxxxxxx>



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux