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: <20250528221525.1705117-1-abdiel.janulgue@gmail.com>
Date: Thu, 29 May 2025 01:14:04 +0300
From: Abdiel Janulgue <abdiel.janulgue@...il.com>
To: jgg@...pe.ca,
	acourbot@...dia.com,
	dakr@...nel.org,
	lyude@...hat.com
Cc: Miguel Ojeda <ojeda@...nel.org>,
	Alex Gaynor <alex.gaynor@...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@...nel.org>,
	Alice Ryhl <aliceryhl@...gle.com>,
	Trevor Gross <tmgross@...ch.edu>,
	Valentin Obst <kernel@...entinobst.de>,
	linux-kernel@...r.kernel.org (open list),
	Marek Szyprowski <m.szyprowski@...sung.com>,
	Robin Murphy <robin.murphy@....com>,
	airlied@...hat.com,
	rust-for-linux@...r.kernel.org,
	iommu@...ts.linux.dev (open list:DMA MAPPING HELPERS),
	Petr Tesarik <petr@...arici.cz>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Herbert Xu <herbert@...dor.apana.org.au>,
	Sui Jingfeng <sui.jingfeng@...ux.dev>,
	Randy Dunlap <rdunlap@...radead.org>,
	Michael Kelley <mhklinux@...look.com>,
	Abdiel Janulgue <abdiel.janulgue@...il.com>
Subject: [PATCH 0/2] rust: add initial scatterlist abstraction

Hello all, this patch series is the next version of the initial
scatterlist rust abstraction initially sent as RFC[0]. I appreciate
all the feedback especially from Jason Gunthorpe[1] and Alexandre
Courbot[2] in shaping the design of the API.

This particular version implements the typestate pattern referred to
by Alexandre to fix the limitations of the scatterlist API. We now
have two iterators, one for building the list and the other when the
list is mapped via DMA for a device. This version introduces a cleaner
flow of the state transitions and enforces restrictions in calling
functions that are not allowed in a particular state of the sg_table
i.e, querying the dma_addresses on a table that is not yet mapped via
DMA or setting the pages on a sg_table that is already mapped via DMA.

Doesn't apply to rust-next yet but is based instead on top of
driver-core-next which provides the needed Device<Bound> functionality.

[0] https://lore.kernel.org/rust-for-linux/20250512095544.3334680-1-abdiel.janulgue@gmail.com/
[1] https://lore.kernel.org/rust-for-linux/20250512164247.GF138689@ziepe.ca/
[2] https://lore.kernel.org/rust-for-linux/D9VWA9ZQLY85.277DFA3YTH5R0@nvidia.com/

Abdiel Janulgue (2):
  rust: add initial scatterlist bindings
  samples: rust: add sample code for scatterlist bindings

 rust/bindings/bindings_helper.h |   1 +
 rust/helpers/helpers.c          |   1 +
 rust/helpers/scatterlist.c      |  25 +++
 rust/kernel/dma.rs              |  17 ++
 rust/kernel/lib.rs              |   1 +
 rust/kernel/scatterlist.rs      | 369 ++++++++++++++++++++++++++++++++
 samples/rust/rust_dma.rs        |  21 +-
 7 files changed, 434 insertions(+), 1 deletion(-)
 create mode 100644 rust/helpers/scatterlist.c
 create mode 100644 rust/kernel/scatterlist.rs


-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ