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-next>] [day] [month] [year] [list]
Message-ID: <20240118-alice-file-v3-0-9694b6f9580c@google.com>
Date: Thu, 18 Jan 2024 14:36:41 +0000
From: Alice Ryhl <aliceryhl@...gle.com>
To: 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>, Benno Lossin <benno.lossin@...ton.me>, 
	Andreas Hindborg <a.hindborg@...sung.com>, Peter Zijlstra <peterz@...radead.org>, 
	Alexander Viro <viro@...iv.linux.org.uk>, Christian Brauner <brauner@...nel.org>, 
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>, 
	"Arve Hjønnevåg" <arve@...roid.com>, Todd Kjos <tkjos@...roid.com>, Martijn Coenen <maco@...roid.com>, 
	Joel Fernandes <joel@...lfernandes.org>, Carlos Llamas <cmllamas@...gle.com>, 
	Suren Baghdasaryan <surenb@...gle.com>
Cc: Dan Williams <dan.j.williams@...el.com>, Kees Cook <keescook@...omium.org>, 
	Matthew Wilcox <willy@...radead.org>, Thomas Gleixner <tglx@...utronix.de>, Daniel Xu <dxu@...uu.xyz>, 
	linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org, 
	linux-fsdevel@...r.kernel.org, Alice Ryhl <aliceryhl@...gle.com>
Subject: [PATCH v3 0/9] File abstractions needed by Rust Binder

This patchset contains the file abstractions needed by the Rust
implementation of the Binder driver.

Please see the Rust Binder RFC for usage examples:
https://lore.kernel.org/rust-for-linux/20231101-rust-binder-v1-0-08ba9197f637@google.com/

Users of "rust: file: add Rust abstraction for `struct file`":
        [PATCH RFC 02/20] rust_binder: add binderfs support to Rust binder
        [PATCH RFC 03/20] rust_binder: add threading support

Users of "rust: cred: add Rust abstraction for `struct cred`":
        [PATCH RFC 05/20] rust_binder: add nodes and context managers
        [PATCH RFC 06/20] rust_binder: add oneway transactions
        [PATCH RFC 11/20] rust_binder: send nodes in transaction
        [PATCH RFC 13/20] rust_binder: add BINDER_TYPE_FD support

Users of "rust: security: add abstraction for secctx":
        [PATCH RFC 06/20] rust_binder: add oneway transactions

Users of "rust: types: add `NotThreadSafe`":
        [PATCH 5/9] rust: file: add `FileDescriptorReservation`

Users of "rust: file: add `FileDescriptorReservation`":
        [PATCH RFC 13/20] rust_binder: add BINDER_TYPE_FD support
        [PATCH RFC 14/20] rust_binder: add BINDER_TYPE_FDA support

Users of "rust: task: add `Task::current_raw`":
        [PATCH 7/9] rust: file: add `Kuid` wrapper
        [PATCH 8/9] rust: file: add `DeferredFdCloser`

Users of "rust: file: add `Kuid` wrapper":
        [PATCH RFC 05/20] rust_binder: add nodes and context managers
        [PATCH RFC 06/20] rust_binder: add oneway transactions

Users of "rust: file: add `DeferredFdCloser`":
        [PATCH RFC 14/20] rust_binder: add BINDER_TYPE_FDA support

Users of "rust: file: add abstraction for `poll_table`":
        [PATCH RFC 07/20] rust_binder: add epoll support

This patchset has some uses of read_volatile in place of READ_ONCE.
Please see the following rfc for context on this:
https://lore.kernel.org/all/20231025195339.1431894-1-boqun.feng@gmail.com/

Signed-off-by: Alice Ryhl <aliceryhl@...gle.com>
---
Changes in v3:
- Completely rewrite comments about refcounting in the first patch.
  - And add a note to the documentation in fs/file.c.
- Discuss speculation gadgets in commit message for the Kuid wrapper.
- Introduce NotThreadSafe and Task::current_raw patches and use them in
  later patches.
- Improve safety comments in DeferredFdCloser.
- Some other minor changes.
- Link to v2: https://lore.kernel.org/r/20231206-alice-file-v2-0-af617c0d9d94@google.com

Changes in v2:
- Update various docs and safety comments.
- Rename method names to match the C name.
- Use ordinary read instead of READ_ONCE in File::cred.
- Changed null check in secctx.
- Add type alias for PhantomData in FileDescriptorReservation.
- Use Kuid::from_raw in Kuid::current_euid.
- Make DeferredFdCloser fallible if it is unable to schedule a task
  work. And also schedule the task work *before* closing the file.
- Moved PollCondVar to rust/kernel/sync.
- Updated PollCondVar to use wake_up_pollfree.
- Link to v1: https://lore.kernel.org/all/20231129-alice-file-v1-0-f81afe8c7261@google.com/

Link to RFC:
https://lore.kernel.org/all/20230720152820.3566078-1-aliceryhl@google.com/

---
Alice Ryhl (6):
  rust: security: add abstraction for secctx
  rust: types: add `NotThreadSafe`
  rust: task: add `Task::current_raw`
  rust: file: add `Kuid` wrapper
  rust: file: add `DeferredFdCloser`
  rust: file: add abstraction for `poll_table`

Wedson Almeida Filho (3):
  rust: file: add Rust abstraction for `struct file`
  rust: cred: add Rust abstraction for `struct cred`
  rust: file: add `FileDescriptorReservation`

 fs/file.c                       |   7 +
 rust/bindings/bindings_helper.h |   8 +
 rust/helpers.c                  |  94 ++++++
 rust/kernel/cred.rs             |  74 +++++
 rust/kernel/file.rs             | 512 ++++++++++++++++++++++++++++++++
 rust/kernel/lib.rs              |   3 +
 rust/kernel/security.rs         |  71 +++++
 rust/kernel/sync.rs             |   1 +
 rust/kernel/sync/lock.rs        |  15 +-
 rust/kernel/sync/poll.rs        | 113 +++++++
 rust/kernel/task.rs             | 112 ++++++-
 rust/kernel/types.rs            |  17 ++
 12 files changed, 1015 insertions(+), 12 deletions(-)
 create mode 100644 rust/kernel/cred.rs
 create mode 100644 rust/kernel/file.rs
 create mode 100644 rust/kernel/security.rs
 create mode 100644 rust/kernel/sync/poll.rs
---
base-commit: 711cbfc717650532624ca9f56fbaf191bed56e67
change-id: 20231123-alice-file-525b98e8a724

Best regards,
--
Alice Ryhl <aliceryhl@...gle.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ