summaryrefslogtreecommitdiff
path: root/rust/kernel
AgeCommit message (Collapse)Author
13 hoursMerge branch 'rust-fixes' of https://github.com/Rust-for-Linux/linux.gitMark Brown
# Conflicts: # rust/bindgen_parameters
25 hoursMerge tag 'net-next-7.4' of ↵stableLinus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next Pull networking updates from Paolo Abeni: "This includes a significant number of low-priority fixes - especially in the NIC drivers area - that we deferred from the last few RCs in the previous cycle, which can't be easily outlined in the synopsis below. Core & protocols: - Continue the work on removing rtnl_lock dependencies: - per-netns ARP and ND neighbour tables, with the default settings now configurable per netns (inheritance from init_net is controlled by the new net.core.neigh_inherit_init_net sysctl) - RCU-protected configuration and rtnl_lock-less fill_info() for hsr, netkit, sit, vlan and vxlan devices - per-netns device unregistration for ip tunnel and gre devices - use the netdev instance lock instead of rtnl_lock when reading speed and duplex via sysfs - batch the flushing of uncached routes at device unregistration time, relieving rtnl_lock contention on netns dismantle. - Add hardware pacing offload support, admin-controlled via a new rtnetlink attribute, with sch_fq integration (implemented in idpf). - Re-segment BIG TCP GSO packets into GSO packets fitting the egress device limits instead of plain MSS-sized segments, improving throughput for mixed BIG TCP / non-BIG TCP paths by up to 70%. - Generate RSS keys that spread flows over all the RX queues; the previous random keys could leave some queues unused. - Optimize the bridge VLAN forwarding paths: cache the port-VLAN in fdb entries and consider only VLAN members when flooding, for ~10% more Mpps in the fdb forwarding path. - A few TCP/IP performance improvements aimed at efficient cache usage and reducing contention. - Add the TCP ROCCET congestion control, a CUBIC variant aimed at avoiding bufferbloat in cellular networks. - Continue the conversion of getsockopt callbacks to sockopt_t. - Add an ethtool command to list the front-facing ports of an interface, including SFP cages and modules, using the phy_port representation. - Enable BIG TCP support for bareudp tunnels. - Remove the IPV6_ADDRFORM socket option and disallow buggy TCP state transitions (listen() + shutdown() + connect() and connect() + connect(AF_UNSPEC) + listen()). - Remove most BUG_ON()s from core packet processing, replacing them with error paths. Wireless: - Latency improvements, including lockless station get/dump and beacon updates, plus RTNL reduction and locking cleanups. - Infrastructure for non-station TX/RX with MLO. - NAN (Wi-Fi Aware) Instant Communication support and other NAN improvements. - Control frame Integrity Protocol (CIP) and protected TWT support. - Improvements for AP regulatory checks. Netfilter: - Disable br_netfilter in user namespaces and schedule it for removal in 2027. - Restrict the raw table in nft_compat to the specific family, hook and priority. - Prepare the flowtable for mixed IPv4-over-IPv6 tunneling (and vice versa). - Use GFP_KERNEL_ACCOUNT for most netfilter allocations, for better integration with memcg. - Allow discovering conntrack zone filtering support in ctnetlink dumps, and fix nfnetlink_hook handling of large dumps. Deletions: - Move the LLC type 2 sockets out of tree. There are no known users and the code attracts a never-ending stream of LLM-driven fixes. Device drivers: - New drivers: - Meta Platforms NIC (mpnic), the second-generation NIC from Meta - initial skeleton of the Nebula-matrix NICs driver (nbl) - X-Powers AC200/AC300 Fast Ethernet PHYs - Ethernet high-speed NICs: - Intel: - i40e: XDP metadata support for RX hash and VLAN tag - ice: expose the E825 TSPLL state via the DPLL subsystem - nVidia/Mellanox: - move the data direct infrastructure from IB to core, in preparation for netdev support. - reduce the memory used per offloaded TC rule - Meta (fbnic): - support large io_uring zero-copy RX buffers - Microsoft vNIC (mana): - add BQL support - Ethernet NICs consumer, and embedded: - Airoha: - LRO offload support - Cadence (macb): - context swapping for ringparam and MTU changes, avoiding buffer loss under memory pressure - Mucse (rnpgbe): - TX/RX and link status support - NXP (enetc): - SR-IOV improvements and VF support for ENETC v4 - Qualcomm (ppe): - IPQ5424 support - Realtek PCI (r8169): - phylink support - RSS support for RTL8127 - Renesas (ravb): - gPTP support for R-Car Gen4 - Synopsys (stmmac): - XDP multi-buffer support on the TX side - tc mqprio hw queue priority offload - support for RK3568 SGMII, Allwinner H616 EMAC1, UltraRISC DP1000 and Qualcomm sa8255p - Ethernet switches: - Mediatek (mt7530): - fast age and change conduit support - Microchip (ksz): - support for KSZ8995XA/KS8995XA - Microchip (lan966x): - PCIe FDMA support, ~20x throughput increase in PCIe endpoint - Microchip (sparx5): - Time Aware Shaper (taprio) offload - Motorcomm (yt921x): - LED and SerDes PCS support - Realtek (rtl8365mb): - EEE support - Ethernet PHYs: - Broadcom: - enable jumbo frames on BCM54xx - Realtek: - support for RTL8261CE_CG and RTL8261D_VM - MDIO support for RTL838x and RTL839x - WiFi drivers: - Broadcom (brcmfmac): - FT/OKC roaming offload - Intel (iwlwifi): - UHR sniffer support - support for newer UEFI/BIOS tables - MediaTek (mt76): - mt7925 NAN improvements - offchannel/scan improvements and MLO fixes - Morse Micro (mm81x): - monitor mode support - Qualcomm (ath12k): - IPQ5332 platform infrastructure - Realtek (rtw88): - RTL8723BS support - SDIO TX performance improvements - Realtek (rtw89): - P2P_DEVICE support - BT-coex updates for RTL8922D - Bluetooth: - move H:4 reassembly into the Bluetooth core - add generic support for vendor packets - MGMT: add security level changed event - Bluetooth drivers: - btusb: support Bulk Serialization Mode - Intel: support Draco and Titan Lake, allow unsigned firmware - Mediatek: MT7928 support - Qualcomm: QCC2072 support - Broadcom: Synaptics 4384 support" * tag 'net-next-7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next: (2126 commits) Bluetooth: btusb: disable by default Qualcomm multi-subsystem tipc: fix broadcast sender hang on last acker departure tipc: fix use-after-free of broadcast reception link at node release r8169: clear TX LPI on RTL8168h at link up after phylink conversion tun: Require CAP_NET_ADMIN to attach to an ownerless device net/sched/sch_cake: drop dead nla_nest_end() error check net/sched/sch_cake: widen buffer_used to u64 net/sched/sch_cake: reduce parent backlog when clearing a tin net/sched/sch_cake: serialize reconfiguration with the datapath tg3: Add Datto SIRIS 5 1U Server to restart AER quirk table net/mlx5e: Stop asserting for RTNL when closing channels net: shrink the payload-only part of skb dataref to one bit net: wwan: iosm: validate msg_head before indexing msg_ring net: bgmac: rate limit RX error messages selftests: net: veth: test XDP_TX to a peer with GRO enabled veth: schedule the peer's NAPI after XDP_TX when only GRO is enabled pppoe: delete session hash entries by pointer match net: lan969x: don't disable hardirqs in fdma tx clear net: sparx5/lan969x: do not clobber the PSFP cycle timer update period net: lan969x: fix DSM calendar for empty taxis ...
27 hoursMerge tag 'for-linus-fwctl' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/fwctl/fwctl Pull fwctl update from Jason Gunthorpe: - One bug fix for a CFI issue in the Rust bindings * tag 'for-linus-fwctl' of git://git.kernel.org/pub/scm/linux/kernel/git/fwctl/fwctl: rust: fwctl: declare cfi_encoding for fwctl_rpc_scope
34 hoursrust: missed rustfmt fix up in rust/kernel/mem.rsLinus Torvalds
Miguel had mentioned this rustfmt issue, but I overlooked this one when doing the driver core merge. Make rustfmt happy again. Reminded-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
38 hoursrust: dma: declare cfi_encoding for dma_data_directionSami Tolvanen
bindgen generates bindings::dma_data_direction as an integer by default, while C callback tables such as dma_buf_ops declare the parameter as enum dma_data_direction. kCFI encodes enum types by name even with integer normalization, so the type ids would not match when C calls into a Rust callback taking bindings::dma_data_direction. Generate dma_data_direction as a newtype with a cfi_encoding, as is done for lru_status, and convert DataDirection through the newtype's constants. Signed-off-by: Sami Tolvanen <samitolvanen@google.com> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Gary Guo <gary@garyguo.net> Acked-by: Danilo Krummrich <dakr@kernel.org> Cc: stable@vger.kernel.org Fixes: c2437c43cfb1 ("rust: dma: implement DataDirection") Link: https://patch.msgid.link/20261019-rust-cfi-fixes-v1-3-9503472ba738@google.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
38 hoursrust: hrtimer: declare cfi_encoding for hrtimer_restartSami Tolvanen
The hrtimer callbacks return bindings::hrtimer_restart, which bindgen generates as c_uint. C calls them through hrtimer->function, which returns enum hrtimer_restart. kCFI encodes enum types by name even with integer normalization, so the type ids never match and every call fails the CFI check. Generate hrtimer_restart as a newtype with a cfi_encoding, as is done for lru_status, and adapt HrTimerRestart to the newtype. Fixes: 8a8afe9349fb ("rust: hrtimer: introduce hrtimer support") Signed-off-by: Sami Tolvanen <samitolvanen@google.com> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: FUJITA Tomonori <fujita.tomonori@gmail.com> Tested-by: FUJITA Tomonori <fujita.tomonori@gmail.com> Acked-by: Andreas Hindborg <a.hindborg@kernel.org> Reviewed-by: Gary Guo <gary@garyguo.net> Acked-by: Danilo Krummrich <dakr@kernel.org> Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20261019-rust-cfi-fixes-v1-2-9503472ba738@google.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
38 hoursrust: irq: declare cfi_encoding for irqreturnSami Tolvanen
The IRQ callbacks return c_uint. C calls them through irq_handler_t, which returns enum irqreturn. kCFI encodes enum types by name even with integer normalization, so the type ids never match and every call fails the CFI check. Generate irqreturn as a newtype with a cfi_encoding, as is done for lru_status, and return bindings::irqreturn_t from the callbacks. Fixes: 0851d34a8cc3 ("rust: irq: add support for non-threaded IRQs and handlers") Fixes: 135d40523244 ("rust: irq: add support for threaded IRQs and handlers") Signed-off-by: Sami Tolvanen <samitolvanen@google.com> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Gary Guo <gary@garyguo.net> Acked-by: Danilo Krummrich <dakr@kernel.org> Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20261019-rust-cfi-fixes-v1-1-9503472ba738@google.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
46 hoursMerge tag 'driver-core-7.4-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core Pull driver core updates from Danilo Krummrich: "Core: - Add TAINT_FORCED_BIND to taint the kernel and driver module before manual sysfs bind/unbind operations; make add_taint_module() available to driver core and update taint decoding tools and documentation - Constify device_show/store_*() attribute parameters and adapt x86 MCE and perf users to prepare for const dev_ext_attribute instances - Fix UAF in NUMA access node registration failure handling by dropping the device reference with put_device() instead of directly freeing the node debugfs: - Make debugfs_create_str() read-only to eliminate double-free races between concurrent writers; reject writable modes; convert interconnect and SoundWire users to local file operations with mutex-protected strings kobject: - Fix out-of-bounds access in kobject_action_type() when parsing action strings containing embedded NUL bytes - Fix the kobject_set_name() reference in kset_register() kernel-doc Rust: - DMA: - Tie Coherent, CoherentBox and CoherentHandle to the device's bound lifetime to prevent retaining DMA allocations beyond driver unbind; propagate the lifetime through nova-core and the DMA sample driver - I/O: - Require explicit base types for registers and replace relative registers with typed subregion projections; reimplement register!() as a proc macro, support registers using existing types without inline bitfields, and convert nova-core, Tyr and the PCI sample; add AsRepr/AsReprMut and transmute helpers with deferred size checks for representation conversions - Wrap ResourceSize in a transparent newtype with explicit conversions, including checked conversion to usize - PCI: - Add typed PCIe extended capability lookup and SR-IOV accessors for the First VF Offset and decoded VF BAR addresses and widths, keeping raw SR-IOV registers private to preserve PCI core ownership of their state - scatterlist: - Honor the device's maximum segment size as well as the DMA mapping limit when constructing SG tables - Return u32 from SGEntry::dma_len() to match the C segment length type - misc: - Validate auxiliary DeviceId name length explicitly to improve compile-time diagnostics for oversized device ID table entries - Drop unnecessary 'static bounds from debugfs ScopedDir file creation methods to support data containing non-'static references, including DMA buffers Misc: - Add Johan Hovold as driver core maintainer - Simplify platform_device_alloc() by returning early on allocation failure - Fix typos in driver core and kernfs comments" * tag 'driver-core-7.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core: (41 commits) rust: pci: add extended capability and SR-IOV support kobject: Fix the kobj_set_name reference in kset_register() kernel-doc rust: io: convert ResourceSize into a transparent newtype rust: scatterlist: return u32 from SGEntry::dma_len() MAINTAINERS: add myself as driver core maintainer debugfs: make debugfs_create_str() read-only soundwire: debugfs: replace writable string helper interconnect: debugfs: replace writable string helper docs: admin-guide: Handle TAINT_FORCED_BIND when parsing /proc/sys/kernel/tainted driver core: platform: Simplify platform_device_alloc() kobject: fix out-of-bounds access in kobject_action_type() rust: scatterlist: honor the device's maximum segment size driver core: add TAINT_FORCED_BIND for when userspace manually messes with devices and drivers module: fix up documentation for add_taint() and add_taint_module() module: pull out add_taint_module() to be public driver core: Constify the signature of device_show/store_*() drivers: perf: Use __DEVICE_ATTR() macro to initialize dev_ext_attribute x86/mce: Use __DEVICE_ATTR() macro to initialize dev_ext_attribute rust: auxiliary: validate DeviceId name length driver core: fix typos in comments ...
2 daysMerge tag 'pm-7.4-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm Pull power management updates from Rafael Wysocki: "This time, the most visible part are the ACPI CPPC updates from Christian Loehle, including CPPC cpufreq driver changes, even though updates of cpufreq drivers proper are still the largest topic group. However, the updates of cpufreq drivers depend on the ACPI CPPC updates, so they should really be counted together and that is well over 1/2 of the total commit count. Interestingly enough, almost all of the updates included here are fixes or cleanups, with some new feature support in the amd-pstate cpufreq driver and IPQ9650 support in the qcom-nvmem cpufreq driver. The runtime PM documentation improvements from Brian Norris can also be mostly regarded as fixes, but a new kunit test goes along with them. Specifics: - Fix multiple issues related to input validation, synchronization, access safety, memory layout and register field validation, and error handling in the ACPI CPPC library (Christian Loehle and Sumit Gupta) - Select the frequency-invariance callback per CPU in the CPPC cpufreq driver and create the FIE worker before enabling PCC callbacks in it to avoid queueing work through a missing worker and dereferencing a NULL pointer (Christian Loehle) - Update the CPPC cpufreq driver entry in MAINTAINERS and add a new entry for the ACPI CPPC library (Christian Loehle) - Minor fixes in various cpufreq drivers (Alexander Koskovich, Daniel Schwierzeck, Frank Zhang, Haotian Zhang, Kathiravan Thirumoorthy, Sumeet Pawnikar, and Xueqin Luo) - Fix wrong behaviors on multi-node servers in the Loongson cpufreq driver (Huacai Chen) - Reject NULL from cpufreq_cpu_get() in the Rust code (Mehmet Koseoglu) - Add suspend OPP to mediatek cpufreq driver and DT (Ryan Brue) - Fixups for a few bugs identified by Sashiko in the amd-pstate cpufreq driver (Mario Limoncielloi, Wentao Guan) - Initial support for maximum frequency capacity handling on Zen6 client in amd-pstate (Mario Limonciello) - Fix for amd-pstate-ut with 'Requested CPU Min frequency' BIOS option (K Prateek Nayak) - New Zen6 tuning values for EPP in amd-pstate (Mario Limonciello, Vishal Badole) - amd-pstate documentation fix (Karl Mehltretter) - Restrict deferred downscaling to low load for shared policies in the conservative cpufreq governor to avoid undesirable CPU frequency reduction in some cases (Shengming Hu) - Serialize sugov_start() against rate limit updates in the schedutil cpufreq governor to avoid using a stale rate limit value (Hui Su) - Prevent cpuidle governors menu and teo from returning idle state 0 after it has been disabled (Xueqin Luo) - Replace min_t() with the better alternatives in the intel_idle driver and make it use 2-argument strscpy() (Andy Shevchenko) - Fix two repeated phrase instances in cpuidle (Hemanth Selam, Syazwina Fazrul) - Add rugged Panther Lake support to the intel_rapl power capping driver and make it use %pe for printing error pointers (Srinivas Pandruvada and Sumeet Pawnikar) - Update and improve runtime PM documentation and add a kunit test for supplier idle/suspend (Brian Norris) - Add a pm_runtime_dont_use_autosuspend() call to pm_runtime_reinit() to ensure autosuspend disabling on driver teardown (Joshua Crofts) - Ignore page-zero RAM in E820 checksum during hibernation on x86 to avoid rejecting images created after kexec() (Matthias Goergens) - Add resume event mapping for PMSG_POWEROFF to the PM core to allow it to carry out device shutdown in the future (Mario Limonciello) - Add DPM watchdog to prepare/late/early/noirq/complete phases of device suspend and resume (Mayank Rungta) - Update swsusp.txt references to swsusp.rst in hibernation documentation (Li Jun) - Fix use-after-free of perf domain in netlink doit handlers for energy models (Fan Wu) - Add synchronize_rcu() back to cpu_pm_unregister_notifier() after it was removed inadvertently in previous development cycles to avoid use-after-free (Bradley Morgan) - Unregister CPU PM notifier outside the timer lock in the timer-ti-dm clocksource driver (Bradley Morgan) - Fix typo "sucessfully" in a comment in pm_clk_add_clk() kerneldoc comment and typo "hierachy" in a comment in pm-graph (Hemanth Selam) - Fix the return value in dev_pm_opp_get_of_node() kernel-doc (Karl Mehltretter)" * tag 'pm-7.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (89 commits) cpufreq: loongson3: Replace IOCSR read/write with MMIO ones cpufreq: loongson3: Use global physical CPU ID in get/target callbacks cpufreq: loongson3: Replace per-package mutex with per-node cpufreq: loongson3: Adjust the width of id and val in smc_message cpufreq: loongson3: Make this driver depend on MACH_LOONGSON64 PM: runtime: Expand introduction with core concepts and structure cpufreq: schedutil: Serialize sugov_start() against rate limit updates MAINTAINERS: ACPI: Add a separate CPPC entry MAINTAINERS: cpufreq: Replace CPPC reviewer arm64: dts: mediatek: mt8173: Mark the lowest CPU OPPs for suspend cpufreq: mediatek: Enter system sleep at the suspend OPP cpufreq: qcom-cpufreq-hw: fix device node refcount leak in phandle parsing cpufreq: qcom-nvmem: Add IPQ9650 support cpufreq: Add Milos to cpufreq-dt-platdev blocklist cpufreq: Use %pe to print error pointers symbolically rust: rcpufreq_dt: add module alias cpufreq: sti: avoid NULL dereference in dev_err() cpufreq: tegra194: fix double-pointer error in get_cpu_ndiv cpufreq: sparc-us2e: fix frequency table index copy-paste error rust: cpufreq: reject NULL from cpufreq_cpu_get() ...
2 daysMerge tag 'rust-7.4' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/ojeda/linux Pull Rust updates from Miguel Ojeda: "Toolchain and infrastructure: - Update vendored 'zerocopy' crate to v0.8.62 (released 2026-10-08). This update advances 8 releases, with 3 of them carrying most of the changes. It contains new features as well as fixes. However, almost nothing has changed that requires updates on our side (a move of our non-ASCII change and the addition of an SPDX license identifier). - Generate Rust KUnit test suites for doctests reusing the '#[kunit_tests]' and '#[test]' attributes instead of C FFI functions, which allows to remove the generated C glue file. Relatedly, simplify 'kunit_assert!' by using 'file!()' and 'line!()' inside (which doctests override as needed), which allows to remove the 'file' helper and 'CONFIG_RUSTC_HAS_SPAN_FILE'. - Trim the function names in doctests generated by 'rustdoc' < 1.95.0 when building with 'O=', which were not reproducible. - Fix the 'VM_MAYSHARE' value in the generated bindings and its blocklist entry, due to typos. - Build 'core' with '--cfg no_io_statics' to ensure 'core' does not introduce any use of 'core::sync::atomic' into the kernel image since upstream Rust is moving 'std::io::Error' into 'core', which uses a global atomic pointer. Upstream Rust merged a PR to add a test checking that builds of 'core' are warning-free with that 'cfg' enabled. - Enable the unstable 'proc_macro_span' feature in 'proc-macro2', which provides 'Span::join' and thus improves the quality of the diagnostics of all our procedural macros, notably 'pin-init'. This is only used for producing diagnostics, thus there is no hard reliance on the feature. - Globally allow 'clippy::comparison_chain', since its suggestions are not always ideal and upstream downgraded it to 'pedantic' too. 'kernel' crate: - New 'mem' module: add the 'Align<N>' zero-sized type so that alignment can be specified via const generics ('repr(align(...))' only works with integer literals), e.g.: const N: usize = 128; struct S { _align: Align<N>, } assert_eq!(align_of::<S>(), N); - New 'ratelimit' module: add the 'Ratelimit' abstraction for 'struct ratelimit_state' and, based on it, the 'pr_*_ratelimited!' printing macros, which can be used for printing that may be triggered by userspace. In addition, convert Rust Binder to use them. - 'sync' module: to construct a global 'struct ratelimit_state', add a 'const' constructor for 'raw_spinlock_t'. In addition, move the lockdep types into a new 'sync::lockdep' submodule, since there were starting to be too many of them. - 'num' module: add the 'cv!' macro to create constant values ("cv") from an integer constant expression, with validity checked at compile time, inferring the target type from the context. It works for any type that implements the new 'FromConst' trait, e.g.: let a: Alignment = cv!(4096); let b: Bounded<u32, 4> = cv!(15); // Any integer constant expression works, not only literals. let m: NonZero<usize> = cv!(usize::MAX); // Checked narrowing, including in `const` items. const SMALL: u8 = cv!(200u32); // The target type can be given explicitly. let e = cv!(200u32 => u8); // With an explicit primitive target, the expression can use // generic parameters. const fn as_u64<const KEY: u16>() -> u64 { cv!(KEY => u64) } This avoids the verbose turbofish syntax which disincentivized using these types at interface boundaries (e.g. 'Alignment::new::<8>()'). - 'alloc' module: - Allow different error types in 'KBox::pin_slice()', enabling use of infallible initializers. - Add 'NumaNode::id()' accessor to retrieve the underlying NUMA node identifier. - 'time' module: - Add 'Delta::to_jiffies_timeout()' for use in timeout arguments. - Add 'Delta::as_jiffies_unsigned()'. - Make 'Delta::ZERO' generic over the time unit. - Warn and assert when passing out-of-range inputs to 'fsleep' and 'udelay'. - Rename 'ClockSource' to 'ClockId' to better align with naming conventions in C kernel. - Make 'CONFIG_HZ' value available as 'bindings::HZ'. - Add implementation detail documentation for 'HrTimer'. - 'bitmap' module: - Add contiguous area operations ('next_zero_area{,_off}', 'set' and 'clear'), with extra checks compared to the underlying C code, plus additional ones under 'CONFIG_RUST_BITMAP_HARDENED'. It includes tests demonstrating the edge cases. - Restrict bitmap length to at most 'i32::MAX', matching 'BitmapVec::MAX_LEN' and simplifying a few things. This also fixes 'u32' casts truncating in 'copy_and_extend', which could otherwise lead to OOB writes. - 'bug' module: - Fix 'warn_on!' on UML which called 'warn_slowpath_fmt()' with the wrong arguments; and fix its '// SAFETY:' comment too. - Add a KUnit test for 'warn_on!'. - 'id_pool' module: add contiguous ID reservation via the new 'reserve_ids' and 'release_ids' methods, built on top of the new bitmap area operations. - 'sizes' module: add the sub-1K size constants ('SZ_1' to 'SZ_512') and implement 'SizeConstants' for 'Alignment', so that one can write e.g. 'Alignment::SZ_8'. 'macros' crate: - Add '#[optional]' attribute for optional methods in '#[vtable]' to replace the 'build_error!(VTABLE_DEFAULT_ERROR)' boilerplate, e.g.: #[vtable] pub trait Operations: Sized { #[optional] fn f(&self) -> Result; } In addition, apply it to miscdevice and hide generated 'HAS_' constants for required methods. - Allow non-ASCII characters in the 'authors' field of the 'module!' macro, which was unintentionally restricted when multiple authors support was introduced. 'pin-init' crate: [ Extra context from Gary's pull request: "This is a cycle packed with feature updates. Two of the most anticipated features, tuple struct support and safe self reference creation, has been included in this pull request. Safe self reference is a big one and is pushed a bit late in the cycle. The initial plan was to include a minimum subset for this cycle because I was worried about potential soundness issues; however during Plumbers it was agreed that the features should be upstreamed at once. This is because the initial users (Nova, JobQueue) would all need the advanced features, so it is better to ensure that the feature get put into use for real, and it can iterate with users, rather than being fully designed on paper. The existing safety checks are already very comprehensive, and Benno and I are confident that if new ones are discovered, it wouldn't affect the overall design. That said, the the usage of the advanced features (invariance, existential lifetime) shall be limited to the pre-agreed users only, so even in case where the feature needs to be reworked, the blast radius is limited. Another theme in this cycle is to improve the developer experience when things are used wrongly. A lot of work has been done to use proper spans from user-provided tokens so error message point to things that cause them. Many common misuse scenarios also gain additional custom diagnostics." ] - User visible changes: - Support tuple structs. - Allow safe creation of self references. - Vastly improve diagnostics for common misuse scenarios. - Other changes: - Use 'mixed_site' hygiene consistently. 'MAINTAINERS': - Add 'RUST [BUG]' entry for the Rust 'bug' module (i.e. 'warn_on!'), which will be maintained by FUJITA Tomonori -- thank you! - Add Alice Ryhl as co-maintainer for 'Rust [ALLOC]'. And some other fixes, cleanups and improvements. * tag 'rust-7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/ojeda/linux: (91 commits) rust: zerocopy: update to v0.8.62 rust: zerocopy: fix link to upstream `README.md` rust: id_pool: add contiguous ID reservation rust: bitmap: add contiguous area operations rust: sizes: implement SizeConstants for Alignment rust: sizes: add sub-1K size constants rust: bitmap: restrict bitmap length to at most i32::MAX rust: bitmap: use function-level cfg on kunit test rust: num: add cv! macro to create values from constant expressions rust: bug: update the SAFETY comment for warn_slowpath_fmt() on UML rust: time: add Delta::as_jiffies_unsigned() rust: time: make Delta::ZERO generic over the time unit rust_binder: use pr_*_ratelimited! for printing rust: add pr_*_ratelimited! macros for printing rust: sync: add const constructor for raw_spinlock_t rust: sync: move lockdep types to rust/kernel/sync/lockdep.rs rust: pin-init: internal: suppress `explicit_outlives_requirements` MAINTAINERS: add entry for the Rust `bug` module rust: pin-init: internal: pin_data: support existential lifetimes rust: pin-init: internal: pin_data: support shared projection ...
2 daysMerge tag 'bitmap-for-v7.4-rc1' of https://github.com/norov/linuxLinus Torvalds
Pull bitmap updates from Yury Norov: "This includes __MAKE_OP() macro removal from me with the follow-up from Mark, cleanups for bitmaps parser from Shashank and a couple Rust docs fixes from Georgios" * tag 'bitmap-for-v7.4-rc1' of https://github.com/norov/linux: rust: bitmap: document panics in `next_bit` and `next_zero_bit` rust: id_pool: document panics in `find_unused_id` and `release_id` bitmap: test bitmap_parselist() with a group size close to UINT_MAX bitmap: bitmap_parselist(): don't wrap around on a huge group size bitmap: test bitmap_parselist() with text after the group size bitmap: bitmap_parselist(): reject trailing characters after group size bitmap: test bitmap_parse() with an illegal character before 8 hex digits bitmap: bitmap_parse(): reject non-hex character before 8 digits bitfield: Restore be16_replace_bits() bitfield: get rid of __MAKE_OP machinery
2 daysrust: fwctl: declare cfi_encoding for fwctl_rpc_scopeAlice Ryhl
Currently, VTable::fw_rpc_callback() takes scope as a u32, whereas C calls fwctl_ops::fw_rpc with enum fwctl_rpc_scope. With kCFI enabled, enum types are encoded distinctly from integers, causing every fw_rpc indirect call into a Rust fwctl driver to trip a CFI failure. Thus, generate fwctl_rpc_scope as a newtype with a cfi_encoding attribute and use it in fw_rpc_callback(). Link: https://patch.msgid.link/r/20261020-fwctl-cfi-encoding-v1-1-ebb30d1500df@google.com Cc: stable@vger.kernel.org Fixes: e052daab94ee ("rust: introduce abstractions for fwctl") Signed-off-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Zhi Wang <zhiw@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
3 daysMerge tag 'lsm-pr-20261016' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm Pull lsm updates from Paul Moore: - Add LSM hooks, object blobs, and audit records for namespaces Add the necessary bits to enable LSMs to enforce access controls on the management of various kernel namespaces. While this pull request does not contain any in-tree users of these hooks, the Landlock pull request for Linux v7.4 will include Landlock support and the next merge window will likely include SELinux support as well. Considering the development behind these hooks, I expect that BPF LSM developers will also be making use of the namespace hooks, if they haven't already. - Update the inode LSM hooks to include mount idmaps This allows LSMs to incorporate the mount ID mapping into their access control decisions. While there are no current in-tree users of this, it was requested by those developing BPF LSM programs and this pull request includes a BPF LSM selftest. - Preserve the full 32-bit ioctl command in LSM audit records Previously only the low 16 bits were logged, ignoring the direction and size information in the upper 16 bits. The pull request also includes a Landlock based selftest to verify the full 32-bit ioctl value. - Ensure we don't call security_backing_file_free() multiple times Thankfully we don't have a problem with the current code base, but we want to fix this behavior now before it becomes a problem. - Clarify that only the current task may access current->cred The current code is a bit misleading around safely accessing the cred field in a task struct. Through comment and code corrections, this pull request clarifies that only the task itself may access its cred field. - Add SLAB_NO_MERGE to the credential object cache Harden the credential cache by ensuring credential objects live on dedicated slab pages. - Make use of safe memory zero'ing in the LSM Rust bindings - Update the docs for the current behavior of /sys/kernel/security/lsm - Update the docs for CONFIG_LSM and the "lsm=" command line option - Remove unnecessary code * tag 'lsm-pr-20261016' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm: lsm: remove redundant NULL check in security_init() selftests/landlock: Check full ioctl commands in audit records lsm: Preserve full ioctl commands in audit records doc: fix LSM ordering description for /sys/kernel/security/lsm doc: describe CONFIG_LSM and lsm= as the selection mechanism selftests/bpf: verify mount idmaps reach inode hooks lsm: expose mount idmaps to inode hooks rust: lsm: replace `core::mem::zeroed` with `pin_init::zeroed` cred: prevent slab cache merging for cred_jar lsm: don't call security_backing_file_free() multiple times lsm: delete duplicate assignment in lsm_prepare() lsm: update the BUILD_BUG_ON() in audit_log_lsm_data() lsm: add LSM_AUDIT_DATA_NS for namespace audit records lsm: add LSM blob and hooks for namespaces ns: Free anonymous mount namespaces via ns_common_free() cred: clarify that task_struct::cred is only for the current task
3 daysrust: workqueue: replace deprecated system_wq with system_{percpu,dfl}_wqDanilo Krummrich
system_wq is deprecated and triggers a runtime warning: [ 0.857414] workqueue: work func ...WorkItemPointerKy0_E3runB7_ enqueued on deprecated workqueue. Use system_{percpu|dfl}_wq instead. Replace system() with system_percpu() and system_dfl(), to match the previous behavior of the deprecated system() and convert doc examples and tests to system_dfl(). system_unbound_wq is deprecated in the same way, in favor of system_dfl_wq. Since system_unbound() has no users, just remove it as well. Fixes: 64d8eae3f895 ("workqueue: Add warnings and fallback if system_{unbound}_wq is used") Signed-off-by: Danilo Krummrich <dakr@kernel.org> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Reviewed-by: Boqun Feng <boqun@kernel.org> Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn> Signed-off-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Gary Guo <gary@garyguo.net> Acked-by: Marco Crivellari <marco.crivellari@suse.com> Acked-by: Tejun Heo <tj@kernel.org> Link: https://patch.msgid.link/20261014-rust-workqueue-system-fix-v2-1-c018b8f870f9@google.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
5 daysMerge branch 'pm-cpufreq'Rafael J. Wysocki
Merge cpufreq updates for 7.4: - Minor fixes in various cpufreq drivers (Alexander Koskovich, Daniel Schwierzeck, Frank Zhang, Haotian Zhang, Kathiravan Thirumoorthy, Sumeet Pawnikar, and Xueqin Luo) - Fix wrong behaviors on multi-node servers in the Loongson cpufreq driver (Huacai Chen) - Reject NULL from cpufreq_cpu_get() in the Rust code (Mehmet Koseoglu) - Add suspend OPP to mediatek cpufreq driver and DT (Ryan Brue) - Fixups for a few bugs identified by Sashiko in the amd-pstate cpufreq driver (Mario Limoncielloi, Wentao Guan) - Initial support for maximum frequency capacity handling on Zen6 client in amd-pstate (Mario Limonciello) - Fix for amd-pstate-ut with 'Requested CPU Min frequency' BIOS option (K Prateek Nayak) - New Zen6 tuning values for EPP in amd-pstate (Mario Limonciello, Vishal Badole) - amd-pstate documentation fix (Karl Mehltretter) - Restrict deferred downscaling to low load for shared policies in the conservative cpufreq governor to avoid undesirable CPU frequency reduction in some cases (Shengming Hu) - Serialize sugov_start() against rate limit updates in the schedutil cpufreq governor to avoid using a stale rate limit value (Hui Su) * pm-cpufreq: (34 commits) cpufreq: loongson3: Replace IOCSR read/write with MMIO ones cpufreq: loongson3: Use global physical CPU ID in get/target callbacks cpufreq: loongson3: Replace per-package mutex with per-node cpufreq: loongson3: Adjust the width of id and val in smc_message cpufreq: loongson3: Make this driver depend on MACH_LOONGSON64 cpufreq: schedutil: Serialize sugov_start() against rate limit updates arm64: dts: mediatek: mt8173: Mark the lowest CPU OPPs for suspend cpufreq: mediatek: Enter system sleep at the suspend OPP cpufreq: qcom-cpufreq-hw: fix device node refcount leak in phandle parsing cpufreq: qcom-nvmem: Add IPQ9650 support cpufreq: Add Milos to cpufreq-dt-platdev blocklist cpufreq: Use %pe to print error pointers symbolically rust: rcpufreq_dt: add module alias cpufreq: sti: avoid NULL dereference in dev_err() cpufreq: tegra194: fix double-pointer error in get_cpu_ndiv cpufreq: sparc-us2e: fix frequency table index copy-paste error rust: cpufreq: reject NULL from cpufreq_cpu_get() cpufreq: amd-pstate-ut: Fix max_freq and EPP test failures on Zen6 cpufreq: amd-pstate: Propagate cppc_set_auto_sel() errors on mode change cpufreq: amd-pstate: Restore previous mode when changing driver mode fails ...
7 daysAutomated merge of 'lsm/dev' into 'stable-7.4'Paul Moore
Manual merge fixup in ns_common_types.h:ns_common to work around a conflict with the nsfs RCU grace period fix. * lsm/dev: lsm: remove redundant NULL check in security_init() selftests/landlock: Check full ioctl commands in audit records lsm: Preserve full ioctl commands in audit records doc: fix LSM ordering description for /sys/kernel/security/lsm doc: describe CONFIG_LSM and lsm= as the selection mechanism selftests/bpf: verify mount idmaps reach inode hooks lsm: expose mount idmaps to inode hooks rust: lsm: replace `core::mem::zeroed` with `pin_init::zeroed` cred: prevent slab cache merging for cred_jar lsm: don't call security_backing_file_free() multiple times lsm: delete duplicate assignment in lsm_prepare() lsm: update the BUILD_BUG_ON() in audit_log_lsm_data() lsm: add LSM_AUDIT_DATA_NS for namespace audit records lsm: add LSM blob and hooks for namespaces ns: Free anonymous mount namespaces via ns_common_free() cred: clarify that task_struct::cred is only for the current task
7 daysMerge tag 'rust-configfs-for-v7.4-rc1' of ↵Breno Leitao
https://git.kernel.org/pub/scm/linux/kernel/git/a.hindborg/linux into updates-v7.4 Rust configfs changes for v7.4-rc1 Three changes for the Rust configfs bindings. One typo fix for a safety comment and two bug fixes. * tag 'rust-configfs-for-v7.4-rc1' of https://git.kernel.org/pub/scm/linux/kernel/git/a.hindborg/linux: rust: configfs: fix data offset calculation for subsystem callbacks rust: configfs: require thread-safe callback data rust: configfs: fix release safety documentation
7 daysconfigfs: Allow the registration of const struct configfs_attributeThomas Weißschuh
The attribute structure defined in driver code never need to be modified. Allow them to be marked as const. As there are many drivers which use these attributes, prepare for a phased transition by using a union of const and non-const attributes. After all drivers have been migrated to the const variant, the non-const one can be replaced by the const one and the transition machinery will be removed again. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Andreas Hindborg <a.hindborg@kernel.org> Link: https://patch.msgid.link/20260716-configfs-const-base-v1-5-c545a4053cb5@weissschuh.net Signed-off-by: Breno Leitao <leitao@debian.org>
7 daysconfigfs: Constify configfs_bin_attributeThomas Weißschuh
The configfs_bin_attribute structures defined by driver are never modified. Make them const. As there are only two users of these attributes, adapt them in the same commit to avoid a phased transition. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Andreas Hindborg <a.hindborg@kernel.org> Link: https://patch.msgid.link/20260716-configfs-const-base-v1-4-c545a4053cb5@weissschuh.net Signed-off-by: Breno Leitao <leitao@debian.org>
7 daysrust: configfs: remove mutability from some field initializersThomas Weißschuh
These fields do not require mutable pointers. Use regular immutable ones. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Andreas Hindborg <a.hindborg@kernel.org> Link: https://patch.msgid.link/20260716-configfs-const-base-v1-1-c545a4053cb5@weissschuh.net Signed-off-by: Breno Leitao <leitao@debian.org>
8 daysMerge tag 'cpufreq-arm-updates-7.4' of ↵Rafael J. Wysocki
git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm Pull CPUFreq Arm updates for 7.4 from Viresh Kumar: "- Minor fixes to in various cpufreq drivers (Alexander Koskovich, Daniel Schwierzeck, Frank Zhang, Haotian Zhang, Kathiravan Thirumoorthy, Sumeet Pawnikar, and Xueqin Luo). - Fix wrong behaviors on multi-node servers in Loongson driver (Huacai Chen). - Reject NULL from cpufreq_cpu_get() in the Rust code (Mehmet Koseoglu). - Add suspend OPP to mediatek driver and DT (Ryan Brue)." * tag 'cpufreq-arm-updates-7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm: cpufreq: loongson3: Replace IOCSR read/write with MMIO ones cpufreq: loongson3: Use global physical CPU ID in get/target callbacks cpufreq: loongson3: Replace per-package mutex with per-node cpufreq: loongson3: Adjust the width of id and val in smc_message cpufreq: loongson3: Make this driver depend on MACH_LOONGSON64 arm64: dts: mediatek: mt8173: Mark the lowest CPU OPPs for suspend cpufreq: mediatek: Enter system sleep at the suspend OPP cpufreq: qcom-cpufreq-hw: fix device node refcount leak in phandle parsing cpufreq: qcom-nvmem: Add IPQ9650 support cpufreq: Add Milos to cpufreq-dt-platdev blocklist cpufreq: Use %pe to print error pointers symbolically rust: rcpufreq_dt: add module alias cpufreq: sti: avoid NULL dereference in dev_err() cpufreq: tegra194: fix double-pointer error in get_cpu_ndiv cpufreq: sparc-us2e: fix frequency table index copy-paste error rust: cpufreq: reject NULL from cpufreq_cpu_get() cpufreq: airoha: fix probe failure with correct error check
11 daysrust: id_pool: add contiguous ID reservationEliot Courtney
Add `IdPool::reserve_ids` which allocates a contiguous range with the given offset, count, and alignment. Reviewed-by: Burak Emir <burak.emir@gmail.com> Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Eliot Courtney <ecourtney@nvidia.com> Reviewed-by: Yury Norov <ynorov@nvidia.com> Link: https://patch.msgid.link/20260930-chid-v9-7-0d6cca376cff@nvidia.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
11 daysrust: bitmap: add contiguous area operationsEliot Courtney
Add bindings for area operations on bitmaps. Each one is made safe by adding some extra checks compared to the underlying C code (for example, checking bounds) and with additional checks to catch likely erroneous usage if `CONFIG_RUST_BITMAP_HARDENED` is on. Add tests demonstrating the edge cases. Reviewed-by: Burak Emir <burak.emir@gmail.com> Signed-off-by: Eliot Courtney <ecourtney@nvidia.com> Reviewed-by: Yury Norov <yury.norov@gmail.com> Link: https://patch.msgid.link/20260930-chid-v9-6-0d6cca376cff@nvidia.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
11 daysrust: sizes: implement SizeConstants for AlignmentEliot Courtney
Currently, constructing an alignment is quite verbose [1]: Alignment::new::<8>() It's unfortunate because it disincentivizes using it at interface boundaries. Implement `SizeConstants` for `Alignment` so we can write e.g. `Alignment::SZ_8` instead. Link: https://lore.kernel.org/an4xDp29VX8Am0uR@yury [1] Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Eliot Courtney <ecourtney@nvidia.com> Link: https://patch.msgid.link/20260930-chid-v9-4-0d6cca376cff@nvidia.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
11 daysrust: sizes: add sub-1K size constantsEliot Courtney
Add some more size constants, mirroring include/linux/sizes.h. This is useful for making `Alignment` implement `SizeConstants` in a following patch, because these are more common alignment values. Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Eliot Courtney <ecourtney@nvidia.com> Link: https://patch.msgid.link/20260930-chid-v9-3-0d6cca376cff@nvidia.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
11 daysrust: bitmap: restrict bitmap length to at most i32::MAXEliot Courtney
It is currently possible to construct a non-`BitmapVec` backed `Bitmap` using `Bitmap::from_raw` that is larger than `i32::MAX`, and it is not part of the unsafe requirements. Restricting all bitmaps (even non-`BitmapVec` backed ones) to a maximum size of `i32::MAX` simplifies a few things and matches `BitmapVec::MAX_LEN`. For example, `copy_and_extend` truncates `len` to u32, which is wrong for > u32::MAX size. `__bitmap_set` and `__bitmap_clear` need i32 for `size` and u32 for `start` - so they can't be run on a `Bitmap` with a > i32::MAX size. Rather than adding runtime checks to account for the case of a non `BitmapVec` backed `Bitmap`, just include that in the requirements for `Bitmap`. Add that requirement to the unsafe requirements on `Bitmap::from_raw` and `Bitmap::from_raw_mut`, and to the invariants on `Bitmap`. This also fixes u32 casts truncating in `copy_and_extend`, which could otherwise lead to OOB writes. Fixes: 11eca92a2cae ("rust: add bitmap API.") Link: https://lore.kernel.org/DKG0U8RLO7LZ.2I1AIH0S38PAP@nvidia.com Reviewed-by: Yury Norov <ynorov@nvidia.com> Reviewed-by: Burak Emir <burak.emir@gmail.com> Signed-off-by: Eliot Courtney <ecourtney@nvidia.com> Link: https://patch.msgid.link/20260930-chid-v9-2-0d6cca376cff@nvidia.com Cc: stable@vger.kernel.org [ Added a few intra-doc links. Added backticks to C types. Capitalize tagged comments. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
11 daysrust: bitmap: use function-level cfg on kunit testEliot Courtney
Since commit c652dc44192d ("rust: kunit: allow `cfg` on `test`s"), we no longer need this workaround. Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Yury Norov <ynorov@nvidia.com> Reviewed-by: Burak Emir <burak.emir@gmail.com> Reviewed-by: Gary Guo <gary@garyguo.net> Signed-off-by: Eliot Courtney <ecourtney@nvidia.com> Link: https://patch.msgid.link/20260930-chid-v9-1-0d6cca376cff@nvidia.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
11 daysrust: num: add cv! macro to create values from constant expressionsEliot Courtney
Currently, using NonZero/Bounded constants is quite verbose. It's unfortunate because it disincentivizes using it in interface boundaries. Introduce a macro to make it nicer to use. The macro `cv!` (for constant value) takes a const integer expression and widens it to i128 (at build time only) before passing it as a const generic value to a new trait `FromConst`. The value is then converted and appears in the associated constant `FromConst::VALUE`. The trait is implemented by NonZero, Bounded, and Alignment and lets values of each be constructed from constants without a verbose turbofish syntax. For example, `const { NonZero::new(1).unwrap() }` can be written as `cv!(1)`. Add the `cv!` macro to the prelude so it doesn't need to be imported explicitly to use it. Suggested-by: Gary Guo <gary@garyguo.net> Reviewed-by: Gary Guo <gary@garyguo.net> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Acked-by: Danilo Krummrich <dakr@kernel.org> Signed-off-by: Eliot Courtney <ecourtney@nvidia.com> Acked-by: Alexandre Courbot <acourbot@nvidia.com> Link: https://patch.msgid.link/20261013-cv-v5-1-113a538dfaef@nvidia.com [ Added a few intra-doc links. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
11 daysrust: pci: add extended capability and SR-IOV supportZhi Wang
Rust PCI drivers have no typed interface for locating and accessing PCIe extended capabilities. The SR-IOV extended capability describes VF topology and VF BARs. Expose this information through the Rust PCI abstraction so drivers can use the existing typed configuration-space accessors instead of raw bindings. Define ExtCapability to associate a capability ID with a register layout, and add ConfigSpace::find_ext_capability() to locate and project that layout. Bound the view at the next capability or the end of extended configuration space. Add ExtSriovRegs and a decoded VF BAR iterator that reads and validates all six VF BAR register slots up front, yields decoded BAR addresses and widths in logical order, and keeps the raw configuration-space slot advancement internal. Since PCI_EXT_CAP_NEXT() is a function-like macro, expose it through a Rust helper. Keep raw SR-IOV registers private because PCI core owns their state. Expose the current First VF Offset through a read-only accessor because the Nova GSP ABI needs the raw 16-bit First VF Offset in Routing ID space. The pci_iov_virtfn_devfn() helper instead returns the low eight bits of a calculated VF Routing ID. Cc: Alexandre Courbot <acourbot@nvidia.com> Cc: Gary Guo <gary@garyguo.net> Cc: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Zhi Wang <zhiw@nvidia.com> Link: https://patch.msgid.link/20260906060404.3336193-2-zhiw@nvidia.com Signed-off-by: Danilo Krummrich <dakr@kernel.org>
11 daysrust: bug: update the SAFETY comment for warn_slowpath_fmt() on UMLFUJITA Tomonori
The SAFETY comment says that it is always safe to call `warn_slowpath_fmt()` with a valid null-terminated string. This is not true. The taint argument must also be a valid taint number. Commit 951d09ca450c ("rust: bug: pass TAINT_WARN to warn_slowpath_fmt() on UML") fixed a bug where it was not. List each condition that the call meets: the file name, the taint number, and the null `fmt`. Suggested-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com> Link: https://patch.msgid.link/20261002104550.2877930-1-tomo@flapping.org Cc: stable@vger.kernel.org Fixes: dff64b072708 ("rust: Add warn_on macro") Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
12 daysrust: time: add Delta::as_jiffies_unsigned()FUJITA Tomonori
Delta<Jiffy> is signed, but some C functions, such as queue_delayed_work_on(), take a span in jiffies as unsigned long. So each caller has to clamp a negative value to zero and cast it before it passes the value to C. Add a helper that does both. Suggested-by: Gary Guo <gary@garyguo.net> Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com> Acked-by: Andreas Hindborg <a.hindborg@kernel.org> Reviewed-by: Gary Guo <gary@garyguo.net> Link: https://patch.msgid.link/20261002050428.2746277-3-tomo@flapping.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
12 daysrust: time: make Delta::ZERO generic over the time unitFUJITA Tomonori
Delta::ZERO is defined only for Delta<Nsec>, so code that needs a zero Delta<Jiffy> has to write Delta::from_jiffies(0). Define ZERO for every Delta<U> instead. An integer literal cannot be used for a generic U::Repr, so add ZERO to TimeUnit. Suggested-by: Markus Probst <markus.probst@posteo.de> Suggested-by: Gary Guo <gary@garyguo.net> Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com> Acked-by: Andreas Hindborg <a.hindborg@kernel.org> Reviewed-by: Gary Guo <gary@garyguo.net> Link: https://patch.msgid.link/20261002050428.2746277-2-tomo@flapping.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
12 daysrust: add pr_*_ratelimited! macros for printingAlice Ryhl
Printing can be very expensive if it occurs often, so printing that can be triggered by userspace should be rate limited. For this purpose, add a Rust wrapper around `struct ratelimit_state` and use it in the new macros. The new files will fall under the catch-all RUST maintainers entry. Tested-by: Alvin Sun <alvin.sun@linux.dev> Reviewed-by: Carlos Llamas <cmllamas@google.com> Link: https://github.com/Rust-for-Linux/linux/issues/122 Acked-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Alice Ryhl <aliceryhl@google.com> Link: https://patch.msgid.link/20261007-pr-ratelimited-v6-3-f14accd4ea3b@google.com [ Removed unused link reference definitions. On the `static`, allowed the `non_upper_case_globals` lint so that `kernel` users (and users providing their own name) do not warn. Reworded title for typo. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
12 daysrust: sync: add const constructor for raw_spinlock_tAlice Ryhl
The abstractions for pr_*_ratelimited! need to construct a global `struct ratelimit_state`, which contains a `raw_spinlock_t` field. Thus, add a const constructor for the `raw_spinlock_t` type. The SPINLOCK_OWNER_INIT constant isn't mirrored via a const helper because bindgen generates a 'static mut' instead of a constant from the pointer constant., The __ARCH_SPIN_LOCK_UNLOCKED constant cannot be translated by bindgen because it's a define for a struct without type annotations, so it's explicitly declared in Rust. Reviewed-by: Boqun Feng <boqun@kernel.org> Reviewed-by: Carlos Llamas <cmllamas@google.com> Acked-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Alice Ryhl <aliceryhl@google.com> Link: https://patch.msgid.link/20261007-pr-ratelimited-v6-2-f14accd4ea3b@google.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
12 daysrust: sync: move lockdep types to rust/kernel/sync/lockdep.rsAlice Ryhl
The lockdep types are currently stored directly in rust/kernel/sync.rs, but there are starting to be too many of them to keep them in that file. Thus, move them to a submodule. The new module is listed under LOCKING PRIMITIVES in the MAINTAINERS file. For commonly used lockdep logic it's useful to keep re-exports in kernel::sync, and this also avoids the need to update any users. Reviewed-by: Gary Guo <gary@garyguo.net> Reviewed-by: Boqun Feng <boqun@kernel.org> Reviewed-by: Carlos Llamas <cmllamas@google.com> Acked-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Alice Ryhl <aliceryhl@google.com> Link: https://patch.msgid.link/20261007-pr-ratelimited-v6-1-f14accd4ea3b@google.com [ Used the "kernel vertical" imports style. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
12 daysMerge tag 'rust-timekeeping-for-v7.4-rc1' of ↵Miguel Ojeda
https://github.com/Rust-for-Linux/linux into rust-next Pull timekeeping updates from Andreas Hindborg: - Warn and assert when passing out-of-range inputs to 'fsleep' and 'udelay'. - Rename 'ClockSource' to 'ClockId' to better align with naming conventions in C kernel. - Make 'CONFIG_HZ' value available as 'bindings::HZ'. - Add a conversion method to convert 'Delta' to 'jiffies' for use in timeout arguments. - Add implementation detail documentation for 'HrTimer'. * tag 'rust-timekeeping-for-v7.4-rc1' of https://github.com/Rust-for-Linux/linux: rust: hrtimer: document handle based design rationale rust: time: add Delta::to_jiffies_timeout() for timeout conversion rust: bindings: set HZ to CONFIG_HZ rust: time: rename ClockSource trait to ClockId rust: time: warn and assert out-of-range input in fsleep() and udelay()
12 daysMerge tag 'alloc-7.4-rc1' of https://github.com/Rust-for-Linux/linux into ↵Miguel Ojeda
rust-next Pull alloc updates from Danilo Krummrich: - Add Alice Ryhl as co-maintainer for Rust [ALLOC] - Allow different error types in KBox::pin_slice(), enabling use of infallible initializers - Add NumaNode::id() accessor to retrieve the underlying NUMA node identifier * tag 'alloc-7.4-rc1' of https://github.com/Rust-for-Linux/linux: rust: alloc: add `NumaNode::id()` accessor rust: alloc: allow different error types in `KBox::pin_slice` MAINTAINERS: add Alice Ryhl as co-maintainer for Rust [ALLOC]
2026-10-06rust: bitmap: document panics in `next_bit` and `next_zero_bit`Georgios Androutsopoulos
`next_bit()` and `next_zero_bit()` use `bitmap_assert!()` to check that `start` is less than `self.len()`, which panics when `CONFIG_RUST_BITMAP_HARDENED` is enabled. However, neither function has a `# Panics` section, and both document that `None` is returned for exactly the input that triggers the panic. Update the documentation of `next_bit()` and `next_zero_bit()` to add the missing `# Panics` sections, add the missing blank doc comment line before `Returns` in `next_zero_bit()`, and simplify the wording. Fixes: 11eca92a2cae ("rust: add bitmap API.") Closes: https://github.com/Rust-for-Linux/linux/issues/1252 Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Georgios Androutsopoulos <georgeandrout13@gmail.com> Signed-off-by: Yury Norov <ynorov@nvidia.com>
2026-10-06rust: id_pool: document panics in `find_unused_id` and `release_id`Georgios Androutsopoulos
`find_unused_id()` calls `Bitmap::next_zero_bit()` and `release_id()` calls `Bitmap::clear_bit()`, both of which panic when `CONFIG_RUST_BITMAP_HARDENED` is enabled and the index is out of bounds. Neither `IdPool` method documents this. Add the missing `# Panics` sections and state the bounds requirement on `offset` and `id`. Fixes: 2cdae413cd3e ("rust: add dynamic ID pool abstraction for bitmap") Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Georgios Androutsopoulos <georgeandrout13@gmail.com> Signed-off-by: Yury Norov <ynorov@nvidia.com>
2026-10-05rust: cpufreq: reject NULL from cpufreq_cpu_get()Mehmet Koseoglu
cpufreq_cpu_get() returns either a referenced policy or NULL. PolicyCpu::from_cpu() passed its return value to from_err_ptr(), which rejects ERR_PTR values but accepts NULL. If the lookup fails, Policy::from_raw_mut() therefore constructs a mutable reference from NULL. Dropping the resulting PolicyCpu then passes the invalid pointer to cpufreq_cpu_put(), causing an oops in kobject_put(). Reject NULL with NonNull before constructing the Policy reference. Return ENODEV instead. A KUnit negative-control run reproduced the oops with the original conversion. The same test passed with this change. The reproducer is available on request. Fixes: 6ebdd7c93177 ("rust: cpufreq: Extend abstractions for policy and driver ops") Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Mehmet Koseoglu <mehmet.mkoseoglu@gmail.com> Reviewed-by: Onur Özkan <work@onurozkan.dev> Reviewed-by: spidermana <xuyiwen14@gmail.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2026-10-03rust: kunit: use `line!()` inside `kunit_assert!`Gary Guo
The `diff` parameter is needed currently because doctests want to override the line number. Simplify it by changing it to use `line!()`. Have doctests override `line!()` macro to achieve the current behavior. An existing doctest requires `line!()` to expand to a literal; so update it to use `::core::line!()` instead. Reviewed-by: David Gow <david@davidgow.net> Signed-off-by: Gary Guo <gary@garyguo.net> Link: https://patch.msgid.link/20260902-kunit-v2-2-eda3ed6c00c5@garyguo.net [ Removed spurious `///`-to-`//` change and adjusted `line!` to match. Added a comment to match `file!`'s. Made `NOTE:` more precise. Reworded to say it is only one doctest being updated. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-10-03rust: kunit: use `file!()` inside `kunit_assert!`Gary Guo
This parameter is needed currently because doctests want to override the file. Simplify it by changing it to use `file!()`. Have doctests override `file!()` macro to achieve the current behavior. This allows us to remove the `file` helper and associated Kconfig options. Reviewed-by: David Gow <david@davidgow.net> Signed-off-by: Gary Guo <gary@garyguo.net> Link: https://patch.msgid.link/20260902-kunit-v2-1-eda3ed6c00c5@garyguo.net Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-10-02rust: miscdevice: use `#[optional]` attribute of `#[vtable]` macroGary Guo
Replace the `build_error!(VTABLE_DEFAULT_ERROR)` boilerplate with the `#[optional]` attribute. Signed-off-by: Gary Guo <gary@garyguo.net> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://patch.msgid.link/20260811-vtable_macro-v1-3-50c5aab3c211@garyguo.net [ Reworded title for prefix. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-10-02rust: mem: add `Align` typeGary Guo
Rust's `repr(align())` only works with integers. Add an `Align` type so it can also be specified via const generics. Signed-off-by: Gary Guo <gary@garyguo.net> Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org> Link: https://patch.msgid.link/20260610-const-align-v2-1-ccd12f0aedb7@garyguo.net [ Adjusted the title of the new module to match the one used in patch "rust: mem: add `transmute` with deferred size check" (landing via driver-core), which is also closer to the upstream standard library title. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-10-02rust: io: convert ResourceSize into a transparent newtypeLorenzo Delgado
`ResourceSize` is a bare type alias for `resource_size_t`, so it inherits every integer operation and `as` cast. That allows operations that make no sense for the size of a hardware resource, such as mixing it with unrelated integers or truncating it with a cast. Wrap it in a `#[repr(transparent)]` newtype so each conversion at a boundary is explicit. The representation is unchanged, so this is ABI-identical; only the spelling at the FFI boundary changes. Provide `from_raw`/`into_raw`, `From` in both directions, and a fallible `TryFrom<ResourceSize> for usize`, since `resource_size_t` can be wider than `usize` on 32-bit. Update the producer, `Resource::size`, and its consumers in `Region` and `request_region`. Suggested-by: Miguel Ojeda <ojeda@kernel.org> Link: https://github.com/Rust-for-Linux/linux/issues/1203 Signed-off-by: Lorenzo Delgado <lnsdev@proton.me> Link: https://patch.msgid.link/20260927-resource-size-newtype-v4-2-447a08af23fb@proton.me Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-10-02rust: scatterlist: return u32 from SGEntry::dma_len()Lorenzo Delgado
`SGEntry::dma_len()` returns `ResourceSize`, but the length of a DMA segment is not the size of a resource. The C side stores it as an `unsigned int` (`dma_length` in `struct scatterlist`), the helper returns `unsigned int`, and a single segment is bounded by the device's `max_segment_size`, which is an `unsigned int` as well. The method only widens the value to `resource_size_t`. Return `u32`, which is what the binding already produces, and drop the `.into()` along with its `clippy::useless_conversion` allow. Tyr widens the length to `u64`, which is now a real conversion on every architecture, so drop its `useless_conversion` allow too. nova-core converts it to `usize` through `FromSafeCast`, which already covers `u32`, so it needs no change. Suggested-by: Danilo Krummrich <dakr@kernel.org> Link: https://lore.kernel.org/r/DLNPXJ4WPH4L.2MBUGV1TAESYY@kernel.org Signed-off-by: Lorenzo Delgado <lnsdev@proton.me> Link: https://patch.msgid.link/20260927-resource-size-newtype-v4-1-447a08af23fb@proton.me Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-10-01rust: bitfield: remove unnecessary `#[allow]`Gary Guo
The `#[allow(non_camel_case_types)]` was there because register names can be commonly SCREAMING_CASE and thus not CamelCase. However, when a bitfield type is created by itself, this justification does not apply. Thus, remove it. Users that want to use non-standard styles can add the `#[allow]` themselves. For example, the invocation of `bitfield!` inside `register!` macro carry this annotation. Signed-off-by: Gary Guo <gary@garyguo.net> Acked-by: Alexandre Courbot <acourbot@nvidia.com> Link: https://patch.msgid.link/20260910170542.92010-1-gary@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-10-01rust: bug: add a KUnit test for warn_on!FUJITA Tomonori
The test runs warn_on!(false) and warn_on!(true) inside a KUnit warning suppression block, then checks that one warning was counted. The counter is incremented by the kernel warning path, not by warn_on! itself, so a count of one means the warning was really reported. warn_flags! has a different definition per architecture. The test does not look at any of them, so it runs on every architecture that supports Rust. The new CONFIG_RUST_BUG_KUNIT_TEST depends on BUG. With CONFIG_BUG=n, warn_on! does nothing and no warning is counted. Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com> Link: https://patch.msgid.link/20260916140952.3290924-1-tomo@flapping.org [ Added newlines for clarity. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-10-01rust: bug: pass TAINT_WARN to warn_slowpath_fmt() on UMLFUJITA Tomonori
On UML, `warn_flags!` calls `warn_slowpath_fmt()` directly. Its third argument is a taint number, but `warn_on!` passes its bug flags there. As a result, `add_taint()` gets 2304 instead of 9 (`TAINT_WARN`). The warning is not recorded: `/proc/sys/kernel/tainted` stays 0 after `warn_on!` fires, where it should be 512. It also causes an out-of-bounds write in `add_taint()`. Pass `TAINT_WARN` directly, as C does on UML. Cc: stable@vger.kernel.org Fixes: dff64b072708 ("rust: Add warn_on macro") Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com> Link: https://patch.msgid.link/20261001123103.2198104-1-tomo@flapping.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-10-01Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski
Cross-merge networking fixes after downstream PR (net-7.3-rc6). Conflicts: net/mac80211/tx.c net/mac80211/ieee80211_i.h 8effab902fa34 ("wifi: mac80211: prevent AP VLAN tx from other interfaces") 78b843974fb83 ("wifi: mac80211: report multicast transmission from lookup_ra_sta()") https://lore.kernel.org/arJmcuhpJ69wAvYK@sirena.co.uk drivers/net/ethernet/realtek/r8169_main.c 3cdeaef1754ab ("r8169: disable EEE on RTL8168h/8111h") 8a3c76523e449 ("r8169: add support for phylink") https://lore.kernel.org/ar5vAxEqS8tO8aVT@sirena.org.uk Adjacent changes: rust/kernel/net/netlink.rs 5e5916923759 ("rust: net: netlink: Migrate to zerocopy's IntoBytes") 0923198be4ae ("rust: net: netlink: validate attribute length before casting to `c_int`") Signed-off-by: Jakub Kicinski <kuba@kernel.org>