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: <20250425150130.13917-1-remo@buenzli.dev>
Date: Fri, 25 Apr 2025 17:01:23 +0200
From: Remo Senekowitsch <remo@...nzli.dev>
To: Rob Herring <robh@...nel.org>,
	Saravana Kannan <saravanak@...gle.com>,
	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>,
	Danilo Krummrich <dakr@...nel.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	"Rafael J. Wysocki" <rafael@...nel.org>,
	Dirk Behme <dirk.behme@...bosch.com>,
	Remo Senekowitsch <remo@...nzli.dev>
Cc: linux-kernel@...r.kernel.org,
	devicetree@...r.kernel.org,
	rust-for-linux@...r.kernel.org
Subject: [PATCH v3 0/7] More Rust bindings for device property reads

This adds more Rust bindings for reading device properties, based on
Rob Herring's work. I'm working on a driver[1] that uses these, but the
driver has more dependencies than this.

Best regards,
Remo

changes in v3:
* (started testing myself with Rust 1.78 and doctests enabled)
* Fix doctest and platform driver sample.
* Move property.rs to device/property.rs (a submodule of device).
* Make `Device::fwnode` fallible, avoiding a panic.
* Remove the duplicated property reading methods on Device. Now that
  `Device::fwnode` is fallible, these methods would have confusingly
  different signatures than the ones on `FwNode`. It will be clearer for
  users to explicitly convert from `&Device` to `&FwNode` first,
  handling that error case separately, and then reading properties on
  `FwNode`.
* Split off separate commits for:
  - printing fwnode name and path
  - adding PropertyGuard
* Do not access `fwnode_handle.dev` in PropertyGuard for
  device-associated logging, fwnode_handle doesn't own a reference to
  the device.
* Rename some extension trait methods to be more descriptive:
  - Property::read => read_from_fwnode_property
  - PropertyInt::read_array => read_array_from_fwnode_property
  These methods are not meant to be used directly and won't be
  accessible unless their traits are in scope. (And there is no reason
  for API users to pull them into scope.) Nevertheless, this reduces the
  risk of confusion caused by non-descriptive methods like "read" being
  attached to primitive types.
* Implement fwnode printing logic in Rust directly instead of calling
  scnprintf.
* Improve some safety comments.

Link: https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/DS90UB954.20driver.20done.2C.20ready.20to.20upstream.3F/with/507874342 [1]

Remo Senekowitsch (7):
  rust: property: Move property_present to separate file
  rust: property: Enable printing fwnode name and path
  rust: property: Introduce PropertyGuard
  rust: property: Add bindings for reading device properties
  rust: property: Add child accessor and iterator
  rust: property: Add property_get_reference_args
  samples: rust: platform: Add property read examples

 MAINTAINERS                                  |   3 +-
 drivers/of/unittest-data/tests-platform.dtsi |   3 +
 rust/helpers/helpers.c                       |   1 +
 rust/helpers/property.c                      |   8 +
 rust/kernel/{device.rs => device/mod.rs}     |   9 +-
 rust/kernel/device/property.rs               | 578 +++++++++++++++++++
 samples/rust/rust_driver_platform.rs         |  72 ++-
 7 files changed, 663 insertions(+), 11 deletions(-)
 create mode 100644 rust/helpers/property.c
 rename rust/kernel/{device.rs => device/mod.rs} (97%)
 create mode 100644 rust/kernel/device/property.rs

-- 
2.49.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ