798bb342 | 26-Nov-2024 |
Linus Torvalds <torvalds@linux-foundation.org> |
Merge tag 'rust-6.13' of https://github.com/Rust-for-Linux/linux
Pull rust updates from Miguel Ojeda: "Toolchain and infrastructure:
- Enable a series of lints, including safety-related ones, e
Merge tag 'rust-6.13' of https://github.com/Rust-for-Linux/linux
Pull rust updates from Miguel Ojeda: "Toolchain and infrastructure:
- Enable a series of lints, including safety-related ones, e.g. the compiler will now warn about missing safety comments, as well as unnecessary ones. How safety documentation is organized is a frequent source of review comments, thus having the compiler guide new developers on where they are expected (and where not) is very nice.
- Start using '#[expect]': an interesting feature in Rust (stabilized in 1.81.0) that makes the compiler warn if an expected warning was _not_ emitted. This is useful to avoid forgetting cleaning up locally ignored diagnostics ('#[allow]'s).
- Introduce '.clippy.toml' configuration file for Clippy, the Rust linter, which will allow us to tweak its behaviour. For instance, our first use cases are declaring a disallowed macro and, more importantly, enabling the checking of private items.
- Lints-related fixes and cleanups related to the items above.
- Migrate from 'receiver_trait' to 'arbitrary_self_types': to get the kernel into stable Rust, one of the major pieces of the puzzle is the support to write custom types that can be used as 'self', i.e. as receivers, since the kernel needs to write types such as 'Arc' that common userspace Rust would not. 'arbitrary_self_types' has been accepted to become stable, and this is one of the steps required to get there.
- Remove usage of the 'new_uninit' unstable feature.
- Use custom C FFI types. Includes a new 'ffi' crate to contain our custom mapping, instead of using the standard library 'core::ffi' one. The actual remapping will be introduced in a later cycle.
- Map '__kernel_{size_t,ssize_t,ptrdiff_t}' to 'usize'/'isize' instead of 32/64-bit integers.
- Fix 'size_t' in bindgen generated prototypes of C builtins.
- Warn on bindgen < 0.69.5 and libclang >= 19.1 due to a double issue in the projects, which we managed to trigger with the upcoming tracepoint support. It includes a build test since some distributions backported the fix (e.g. Debian -- thanks!). All major distributions we list should be now OK except Ubuntu non-LTS.
'macros' crate:
- Adapt the build system to be able run the doctests there too; and clean up and enable the corresponding doctests.
'kernel' crate:
- Add 'alloc' module with generic kernel allocator support and remove the dependency on the Rust standard library 'alloc' and the extension traits we used to provide fallible methods with flags.
Add the 'Allocator' trait and its implementations '{K,V,KV}malloc'. Add the 'Box' type (a heap allocation for a single value of type 'T' that is also generic over an allocator and considers the kernel's GFP flags) and its shorthand aliases '{K,V,KV}Box'. Add 'ArrayLayout' type. Add 'Vec' (a contiguous growable array type) and its shorthand aliases '{K,V,KV}Vec', including iterator support.
For instance, now we may write code such as:
let mut v = KVec::new(); v.push(1, GFP_KERNEL)?; assert_eq!(&v, &[1]);
Treewide, move as well old users to these new types.
- 'sync' module: add global lock support, including the 'GlobalLockBackend' trait; the 'Global{Lock,Guard,LockedBy}' types and the 'global_lock!' macro. Add the 'Lock::try_lock' method.
- 'error' module: optimize 'Error' type to use 'NonZeroI32' and make conversion functions public.
- 'page' module: add 'page_align' function.
- Add 'transmute' module with the existing 'FromBytes' and 'AsBytes' traits.
- 'block::mq::request' module: improve rendered documentation.
- 'types' module: extend 'Opaque' type documentation and add simple examples for the 'Either' types.
drm/panic:
- Clean up a series of Clippy warnings.
Documentation:
- Add coding guidelines for lints and the '#[expect]' feature.
- Add Ubuntu to the list of distributions in the Quick Start guide.
MAINTAINERS:
- Add Danilo Krummrich as maintainer of the new 'alloc' module.
And a few other small cleanups and fixes"
* tag 'rust-6.13' of https://github.com/Rust-for-Linux/linux: (82 commits) rust: alloc: Fix `ArrayLayout` allocations docs: rust: remove spurious item in `expect` list rust: allow `clippy::needless_lifetimes` rust: warn on bindgen < 0.69.5 and libclang >= 19.1 rust: use custom FFI integer types rust: map `__kernel_size_t` and friends also to usize/isize rust: fix size_t in bindgen prototypes of C builtins rust: sync: add global lock support rust: macros: enable the rest of the tests rust: macros: enable paste! use from macro_rules! rust: enable macros::module! tests rust: kbuild: expand rusttest target for macros rust: types: extend `Opaque` documentation rust: block: fix formatting of `kernel::block::mq::request` module rust: macros: fix documentation of the paste! macro rust: kernel: fix THIS_MODULE header path in ThisModule doc comment rust: page: add Rust version of PAGE_ALIGN rust: helpers: remove unnecessary header includes rust: exports: improve grammar in commentary drm/panic: allow verbose version check ...
show more ...
/linux/.clippy.toml/linux/.gitignore/linux/Documentation/ABI/testing/sysfs-fs-f2fs/linux/Documentation/admin-guide/kernel-parameters.txt/linux/Documentation/admin-guide/media/index.rst/linux/Documentation/admin-guide/sysctl/fs.rst/linux/Documentation/admin-guide/sysctl/kernel.rst/linux/Documentation/core-api/gfp_mask-from-fs-io.rst/linux/Documentation/core-api/index.rst/linux/Documentation/core-api/min_heap.rst/linux/Documentation/devicetree/bindings/arm/airoha,en7581-chip-scu.yaml/linux/Documentation/devicetree/bindings/i2c/marvell,mv64xxx-i2c.yaml/linux/Documentation/devicetree/bindings/i2c/snps,designware-i2c.yaml/linux/Documentation/devicetree/bindings/i2c/st,nomadik-i2c.yaml/linux/Documentation/devicetree/bindings/mailbox/microchip,mpfs-mailbox.yaml/linux/Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.yaml/linux/Documentation/devicetree/bindings/mailbox/qcom-ipcc.yaml/linux/Documentation/devicetree/bindings/mailbox/thead,th1520-mbox.yaml/linux/Documentation/devicetree/bindings/mfd/airoha,en7581-gpio-sysctl.yaml/linux/Documentation/devicetree/bindings/pinctrl/airoha,en7581-pinctrl.yaml/linux/Documentation/devicetree/bindings/pinctrl/amlogic,meson8-pinctrl-cbus.yaml/linux/Documentation/devicetree/bindings/pinctrl/canaan,k230-pinctrl.yaml/linux/Documentation/devicetree/bindings/pinctrl/fsl,imx35-pinctrl.yaml/linux/Documentation/devicetree/bindings/pinctrl/microchip,mcp23s08.yaml/linux/Documentation/devicetree/bindings/pinctrl/mscc,ocelot-pinctrl.yaml/linux/Documentation/devicetree/bindings/pinctrl/pinctrl-single.yaml/linux/Documentation/devicetree/bindings/pinctrl/qcom,ipq5424-tlmm.yaml/linux/Documentation/devicetree/bindings/pinctrl/qcom,pmic-gpio.yaml/linux/Documentation/devicetree/bindings/pinctrl/qcom,pmic-mpp.yaml/linux/Documentation/devicetree/bindings/pinctrl/qcom,qcs615-tlmm.yaml/linux/Documentation/devicetree/bindings/pinctrl/qcom,qcs8300-tlmm.yaml/linux/Documentation/devicetree/bindings/pinctrl/qcom,sa8775p-tlmm.yaml/linux/Documentation/devicetree/bindings/pinctrl/qcom,sar2130p-tlmm.yaml/linux/Documentation/devicetree/bindings/pinctrl/qcom,sm8650-lpass-lpi-pinctrl.yaml/linux/Documentation/devicetree/bindings/pinctrl/qcom,sm8750-tlmm.yaml/linux/Documentation/devicetree/bindings/pinctrl/renesas,rzg2l-pinctrl.yaml/linux/Documentation/devicetree/bindings/pinctrl/samsung,pinctrl-wakeup-interrupt.yaml/linux/Documentation/devicetree/bindings/pinctrl/samsung,pinctrl.yaml/linux/Documentation/devicetree/bindings/pinctrl/semtech,sx1501q.yaml/linux/Documentation/devicetree/bindings/pinctrl/sophgo,cv1800-pinctrl.yaml/linux/Documentation/devicetree/bindings/pinctrl/spacemit,k1-pinctrl.yaml/linux/Documentation/devicetree/bindings/pinctrl/thead,th1520-pinctrl.yaml/linux/Documentation/devicetree/bindings/pinctrl/xlnx,versal-pinctrl.yaml/linux/Documentation/devicetree/bindings/pwm/airoha,en7581-pwm.yaml/linux/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml/linux/Documentation/doc-guide/kernel-doc.rst/linux/Documentation/driver-api/pwrseq.rst/linux/Documentation/filesystems/autofs.rst/linux/Documentation/filesystems/dlmfs.rst/linux/Documentation/filesystems/f2fs.rst/linux/Documentation/filesystems/fsverity.rst/linux/Documentation/filesystems/path-lookup.rst/linux/Documentation/filesystems/path-lookup.txt/linux/Documentation/filesystems/ramfs-rootfs-initramfs.rst/linux/Documentation/kernel-hacking/hacking.rst/linux/Documentation/mm/slub.rst/linux/Documentation/process/debugging/driver_development_debugging_guide.rst/linux/Documentation/process/debugging/index.rst/linux/Documentation/process/debugging/media_specific_debugging_guide.rst/linux/Documentation/process/debugging/userspace_debugging_guide.rst/linux/Documentation/process/index.rst/linux/Documentation/process/license-rules.rst/linux/Documentation/rust/coding-guidelines.rst/linux/Documentation/rust/quick-start.rst/linux/MAINTAINERS/linux/Makefile/linux/arch/alpha/include/asm/spinlock_types.h/linux/arch/arm/include/asm/spinlock_types.h/linux/arch/arm/mach-imx/Kconfig/linux/arch/arm64/include/asm/spinlock_types.h/linux/arch/hexagon/include/asm/spinlock_types.h/linux/arch/powerpc/include/asm/simple_spinlock_types.h/linux/arch/powerpc/include/asm/spinlock_types.h/linux/arch/s390/include/asm/spinlock_types.h/linux/arch/sh/include/asm/spinlock_types.h/linux/arch/xtensa/include/asm/spinlock_types.h/linux/drivers/block/rnull.rs/linux/drivers/firewire/core-topology.c/linux/drivers/firewire/core.h/linux/drivers/firewire/ohci.c/linux/drivers/gpu/drm/drm_framebuffer.c/linux/drivers/gpu/drm/drm_panic_qr.rs/linux/drivers/gpu/drm/i915/i915_gpu_error.c/linux/drivers/i2c/busses/i2c-designware-common.c/linux/drivers/i2c/busses/i2c-designware-core.h/linux/drivers/i2c/busses/i2c-designware-master.c/linux/drivers/i2c/busses/i2c-designware-platdrv.c/linux/drivers/i2c/busses/i2c-nomadik.c/linux/drivers/i2c/busses/i2c-qup.c/linux/drivers/mailbox/Kconfig/linux/drivers/mailbox/Makefile/linux/drivers/mailbox/arm_mhuv2.c/linux/drivers/mailbox/bcm-flexrm-mailbox.c/linux/drivers/mailbox/bcm-pdc-mailbox.c/linux/drivers/mailbox/imx-mailbox.c/linux/drivers/mailbox/mailbox-mpfs.c/linux/drivers/mailbox/mailbox-test.c/linux/drivers/mailbox/mailbox-th1520.c/linux/drivers/mailbox/mtk-cmdq-mailbox.c/linux/drivers/mailbox/pcc.c/linux/drivers/mailbox/qcom-apcs-ipc-mailbox.c/linux/drivers/mailbox/qcom-ipcc.c/linux/drivers/mailbox/stm32-ipcc.c/linux/drivers/mailbox/sun6i-msgbox.c/linux/drivers/mailbox/tegra-hsp.c/linux/drivers/mailbox/ti-msgmgr.c/linux/drivers/mailbox/zynqmp-ipi-mailbox.c/linux/drivers/md/bcache/Kconfig/linux/drivers/md/bcache/alloc.c/linux/drivers/md/bcache/bset.c/linux/drivers/md/bcache/extents.c/linux/drivers/md/bcache/movinggc.c/linux/drivers/md/dm-bio-prison-v1.c/linux/drivers/md/dm-bio-prison-v1.h/linux/drivers/md/dm-bufio.c/linux/drivers/md/dm-cache-background-tracker.c/linux/drivers/md/dm-cache-background-tracker.h/linux/drivers/md/dm-cache-metadata.c/linux/drivers/md/dm-cache-metadata.h/linux/drivers/md/dm-ioctl.c/linux/drivers/md/dm-table.c/linux/drivers/md/dm-thin.c/linux/drivers/md/dm-vdo/Kconfig/linux/drivers/md/dm-vdo/block-map.c/linux/drivers/md/dm-vdo/data-vio.c/linux/drivers/md/dm-vdo/data-vio.h/linux/drivers/md/dm-vdo/dedupe.c/linux/drivers/md/dm-vdo/encodings.c/linux/drivers/md/dm-vdo/indexer/index-layout.c/linux/drivers/md/dm-vdo/indexer/indexer.h/linux/drivers/md/dm-vdo/int-map.c/linux/drivers/md/dm-vdo/io-submitter.c/linux/drivers/md/dm-vdo/murmurhash3.c/linux/drivers/md/dm-vdo/packer.c/linux/drivers/md/dm-vdo/physical-zone.c/linux/drivers/md/dm-vdo/recovery-journal.c/linux/drivers/md/dm-vdo/repair.c/linux/drivers/md/dm-vdo/slab-depot.c/linux/drivers/md/dm-vdo/vdo.c/linux/drivers/md/dm-vdo/vio.c/linux/drivers/md/dm-verity-target.c/linux/drivers/md/dm-verity.h/linux/drivers/md/dm-zoned-metadata.c/linux/drivers/md/dm-zoned.h/linux/drivers/md/dm.c/linux/drivers/md/dm.h/linux/drivers/md/persistent-data/dm-space-map-common.c/linux/drivers/message/fusion/mptlan.h/linux/drivers/message/fusion/mptsas.c/linux/drivers/nvdimm/dax_devs.c/linux/drivers/nvdimm/nd.h/linux/drivers/nvdimm/nd_virtio.c/linux/drivers/nvdimm/pfn_devs.c/linux/drivers/nvdimm/pmem.c/linux/drivers/pinctrl/Kconfig/linux/drivers/pinctrl/Makefile/linux/drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c/linux/drivers/pinctrl/cirrus/pinctrl-madera-core.c/linux/drivers/pinctrl/core.c/linux/drivers/pinctrl/core.h/linux/drivers/pinctrl/freescale/Kconfig/linux/drivers/pinctrl/freescale/pinctrl-imx.c/linux/drivers/pinctrl/freescale/pinctrl-imx1.c/linux/drivers/pinctrl/freescale/pinctrl-imx27.c/linux/drivers/pinctrl/intel/pinctrl-cherryview.c/linux/drivers/pinctrl/intel/pinctrl-elkhartlake.c/linux/drivers/pinctrl/intel/pinctrl-intel.c/linux/drivers/pinctrl/mediatek/Kconfig/linux/drivers/pinctrl/mediatek/Makefile/linux/drivers/pinctrl/mediatek/pinctrl-airoha.c/linux/drivers/pinctrl/nomadik/pinctrl-abx500.c/linux/drivers/pinctrl/nxp/pinctrl-s32g2.c/linux/drivers/pinctrl/pinctrl-amd.c/linux/drivers/pinctrl/pinctrl-amd.h/linux/drivers/pinctrl/pinctrl-artpec6.c/linux/drivers/pinctrl/pinctrl-aw9523.c/linux/drivers/pinctrl/pinctrl-cy8c95x0.c/linux/drivers/pinctrl/pinctrl-k210.c/linux/drivers/pinctrl/pinctrl-k230.c/linux/drivers/pinctrl/pinctrl-ocelot.c/linux/drivers/pinctrl/pinctrl-rockchip.c/linux/drivers/pinctrl/pinctrl-single.c/linux/drivers/pinctrl/pinctrl-stmfx.c/linux/drivers/pinctrl/pinctrl-sx150x.c/linux/drivers/pinctrl/pinctrl-tb10x.c/linux/drivers/pinctrl/pinctrl-th1520.c/linux/drivers/pinctrl/pinctrl-xway.c/linux/drivers/pinctrl/pinctrl-zynqmp.c/linux/drivers/pinctrl/pinmux.c/linux/drivers/pinctrl/qcom/Kconfig.msm/linux/drivers/pinctrl/qcom/Makefile/linux/drivers/pinctrl/qcom/pinctrl-apq8064.c/linux/drivers/pinctrl/qcom/pinctrl-apq8084.c/linux/drivers/pinctrl/qcom/pinctrl-ipq4019.c/linux/drivers/pinctrl/qcom/pinctrl-ipq5018.c/linux/drivers/pinctrl/qcom/pinctrl-ipq5332.c/linux/drivers/pinctrl/qcom/pinctrl-ipq5424.c/linux/drivers/pinctrl/qcom/pinctrl-ipq6018.c/linux/drivers/pinctrl/qcom/pinctrl-ipq8064.c/linux/drivers/pinctrl/qcom/pinctrl-ipq8074.c/linux/drivers/pinctrl/qcom/pinctrl-ipq9574.c/linux/drivers/pinctrl/qcom/pinctrl-mdm9607.c/linux/drivers/pinctrl/qcom/pinctrl-mdm9615.c/linux/drivers/pinctrl/qcom/pinctrl-msm.c/linux/drivers/pinctrl/qcom/pinctrl-msm8226.c/linux/drivers/pinctrl/qcom/pinctrl-msm8660.c/linux/drivers/pinctrl/qcom/pinctrl-msm8909.c/linux/drivers/pinctrl/qcom/pinctrl-msm8916.c/linux/drivers/pinctrl/qcom/pinctrl-msm8953.c/linux/drivers/pinctrl/qcom/pinctrl-msm8960.c/linux/drivers/pinctrl/qcom/pinctrl-msm8976.c/linux/drivers/pinctrl/qcom/pinctrl-msm8994.c/linux/drivers/pinctrl/qcom/pinctrl-msm8996.c/linux/drivers/pinctrl/qcom/pinctrl-msm8998.c/linux/drivers/pinctrl/qcom/pinctrl-msm8x74.c/linux/drivers/pinctrl/qcom/pinctrl-qcm2290.c/linux/drivers/pinctrl/qcom/pinctrl-qcs404.c/linux/drivers/pinctrl/qcom/pinctrl-qcs615.c/linux/drivers/pinctrl/qcom/pinctrl-qcs8300.c/linux/drivers/pinctrl/qcom/pinctrl-qdf2xxx.c/linux/drivers/pinctrl/qcom/pinctrl-qdu1000.c/linux/drivers/pinctrl/qcom/pinctrl-sa8775p.c/linux/drivers/pinctrl/qcom/pinctrl-sar2130p.c/linux/drivers/pinctrl/qcom/pinctrl-sc7180.c/linux/drivers/pinctrl/qcom/pinctrl-sc7280-lpass-lpi.c/linux/drivers/pinctrl/qcom/pinctrl-sc7280.c/linux/drivers/pinctrl/qcom/pinctrl-sc8180x.c/linux/drivers/pinctrl/qcom/pinctrl-sc8280xp-lpass-lpi.c/linux/drivers/pinctrl/qcom/pinctrl-sc8280xp.c/linux/drivers/pinctrl/qcom/pinctrl-sdm660.c/linux/drivers/pinctrl/qcom/pinctrl-sdm670.c/linux/drivers/pinctrl/qcom/pinctrl-sdm845.c/linux/drivers/pinctrl/qcom/pinctrl-sdx55.c/linux/drivers/pinctrl/qcom/pinctrl-sdx65.c/linux/drivers/pinctrl/qcom/pinctrl-sdx75.c/linux/drivers/pinctrl/qcom/pinctrl-sm4250-lpass-lpi.c/linux/drivers/pinctrl/qcom/pinctrl-sm4450.c/linux/drivers/pinctrl/qcom/pinctrl-sm6115-lpass-lpi.c/linux/drivers/pinctrl/qcom/pinctrl-sm6115.c/linux/drivers/pinctrl/qcom/pinctrl-sm6125.c/linux/drivers/pinctrl/qcom/pinctrl-sm6350.c/linux/drivers/pinctrl/qcom/pinctrl-sm6375.c/linux/drivers/pinctrl/qcom/pinctrl-sm7150.c/linux/drivers/pinctrl/qcom/pinctrl-sm8150.c/linux/drivers/pinctrl/qcom/pinctrl-sm8250-lpass-lpi.c/linux/drivers/pinctrl/qcom/pinctrl-sm8250.c/linux/drivers/pinctrl/qcom/pinctrl-sm8350-lpass-lpi.c/linux/drivers/pinctrl/qcom/pinctrl-sm8350.c/linux/drivers/pinctrl/qcom/pinctrl-sm8450-lpass-lpi.c/linux/drivers/pinctrl/qcom/pinctrl-sm8450.c/linux/drivers/pinctrl/qcom/pinctrl-sm8550-lpass-lpi.c/linux/drivers/pinctrl/qcom/pinctrl-sm8550.c/linux/drivers/pinctrl/qcom/pinctrl-sm8650-lpass-lpi.c/linux/drivers/pinctrl/qcom/pinctrl-sm8650.c/linux/drivers/pinctrl/qcom/pinctrl-sm8750.c/linux/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c/linux/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c/linux/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c/linux/drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c/linux/drivers/pinctrl/qcom/pinctrl-x1e80100.c/linux/drivers/pinctrl/renesas/Kconfig/linux/drivers/pinctrl/renesas/pinctrl-rza1.c/linux/drivers/pinctrl/renesas/pinctrl-rza2.c/linux/drivers/pinctrl/renesas/pinctrl-rzg2l.c/linux/drivers/pinctrl/renesas/pinctrl-rzn1.c/linux/drivers/pinctrl/samsung/pinctrl-exynos-arm64.c/linux/drivers/pinctrl/samsung/pinctrl-exynos.h/linux/drivers/pinctrl/samsung/pinctrl-samsung.c/linux/drivers/pinctrl/samsung/pinctrl-samsung.h/linux/drivers/pinctrl/sophgo/Kconfig/linux/drivers/pinctrl/spacemit/Kconfig/linux/drivers/pinctrl/spacemit/Makefile/linux/drivers/pinctrl/spacemit/pinctrl-k1.c/linux/drivers/pinctrl/spacemit/pinctrl-k1.h/linux/drivers/pinctrl/sprd/pinctrl-sprd-sc9860.c/linux/drivers/scsi/a3000.c/linux/drivers/scsi/a4000t.c/linux/drivers/scsi/aacraid/aacraid.h/linux/drivers/scsi/aacraid/commsup.c/linux/drivers/scsi/aic7xxx/aic7770.c/linux/drivers/scsi/aic7xxx/aic7xxx.h/linux/drivers/scsi/atari_scsi.c/linux/drivers/scsi/bfa/bfa.h/linux/drivers/scsi/bfa/bfa_core.c/linux/drivers/scsi/bfa/bfa_defs_fcs.h/linux/drivers/scsi/bfa/bfa_fcpim.c/linux/drivers/scsi/bfa/bfa_fcpim.h/linux/drivers/scsi/bfa/bfa_fcs.h/linux/drivers/scsi/bfa/bfa_fcs_lport.c/linux/drivers/scsi/bfa/bfa_fcs_rport.c/linux/drivers/scsi/bfa/bfa_ioc.c/linux/drivers/scsi/bfa/bfa_ioc.h/linux/drivers/scsi/bfa/bfa_modules.h/linux/drivers/scsi/bfa/bfa_svc.c/linux/drivers/scsi/bfa/bfa_svc.h/linux/drivers/scsi/bfa/bfad.c/linux/drivers/scsi/bfa/bfad_drv.h/linux/drivers/scsi/bfa/bfi.h/linux/drivers/scsi/bvme6000_scsi.c/linux/drivers/scsi/esas2r/esas2r.h/linux/drivers/scsi/esas2r/esas2r_vda.c/linux/drivers/scsi/hisi_sas/hisi_sas.h/linux/drivers/scsi/hisi_sas/hisi_sas_main.c/linux/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c/linux/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c/linux/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c/linux/drivers/scsi/jazz_esp.c/linux/drivers/scsi/lpfc/lpfc_bsg.c/linux/drivers/scsi/lpfc/lpfc_crtn.h/linux/drivers/scsi/lpfc/lpfc_ct.c/linux/drivers/scsi/lpfc/lpfc_debugfs.c/linux/drivers/scsi/lpfc/lpfc_disc.h/linux/drivers/scsi/lpfc/lpfc_els.c/linux/drivers/scsi/lpfc/lpfc_hbadisc.c/linux/drivers/scsi/lpfc/lpfc_init.c/linux/drivers/scsi/lpfc/lpfc_nportdisc.c/linux/drivers/scsi/lpfc/lpfc_nvme.c/linux/drivers/scsi/lpfc/lpfc_nvmet.c/linux/drivers/scsi/lpfc/lpfc_scsi.c/linux/drivers/scsi/lpfc/lpfc_sli.c/linux/drivers/scsi/lpfc/lpfc_version.h/linux/drivers/scsi/lpfc/lpfc_vport.c/linux/drivers/scsi/mac_esp.c/linux/drivers/scsi/mac_scsi.c/linux/drivers/scsi/mvme16x_scsi.c/linux/drivers/scsi/pm8001/pm8001_defs.h/linux/drivers/scsi/pm8001/pm8001_init.c/linux/drivers/scsi/pm8001/pm8001_sas.c/linux/drivers/scsi/pm8001/pm8001_sas.h/linux/drivers/scsi/pm8001/pm80xx_hwi.c/linux/drivers/scsi/qedf/qedf_main.c/linux/drivers/scsi/qedi/qedi_main.c/linux/drivers/scsi/qlogicpti.c/linux/drivers/scsi/sg.c/linux/drivers/scsi/sgiwd93.c/linux/drivers/scsi/sni_53c710.c/linux/drivers/scsi/st.c/linux/drivers/scsi/sun3_scsi.c/linux/drivers/scsi/sun3x_esp.c/linux/drivers/scsi/sun_esp.c/linux/drivers/target/target_core_pscsi.c/linux/drivers/ufs/core/ufs-mcq.c/linux/drivers/ufs/core/ufshcd.c/linux/drivers/ufs/host/tc-dwc-g210-pci.c/linux/drivers/ufs/host/ufs-exynos.c/linux/drivers/ufs/host/ufs-exynos.h/linux/drivers/ufs/host/ufs-mediatek.c/linux/drivers/ufs/host/ufs-qcom.c/linux/drivers/ufs/host/ufs-renesas.c/linux/drivers/ufs/host/ufshcd-pci.c/linux/fs/bcachefs/Kconfig/linux/fs/bcachefs/clock.c/linux/fs/bcachefs/ec.c/linux/fs/ecryptfs/main.c/linux/fs/exec.c/linux/fs/exportfs/expfs.c/linux/fs/f2fs/acl.c/linux/fs/f2fs/checkpoint.c/linux/fs/f2fs/data.c/linux/fs/f2fs/debug.c/linux/fs/f2fs/extent_cache.c/linux/fs/f2fs/f2fs.h/linux/fs/f2fs/file.c/linux/fs/f2fs/gc.c/linux/fs/f2fs/gc.h/linux/fs/f2fs/inode.c/linux/fs/f2fs/node.c/linux/fs/f2fs/recovery.c/linux/fs/f2fs/segment.c/linux/fs/f2fs/segment.h/linux/fs/f2fs/super.c/linux/fs/f2fs/sysfs.c/linux/fs/fhandle.c/linux/fs/fuse/Makefile/linux/fs/fuse/cuse.c/linux/fs/fuse/dax.c/linux/fs/fuse/dev.c/linux/fs/fuse/dir.c/linux/fs/fuse/file.c/linux/fs/fuse/fuse_i.h/linux/fs/fuse/inode.c/linux/fs/fuse/ioctl.c/linux/fs/fuse/readdir.c/linux/fs/fuse/sysctl.c/linux/fs/fuse/virtio_fs.c/linux/fs/gfs2/glock.c/linux/fs/gfs2/glock.h/linux/fs/gfs2/glops.c/linux/fs/gfs2/incore.h/linux/fs/gfs2/inode.c/linux/fs/gfs2/inode.h/linux/fs/gfs2/lock_dlm.c/linux/fs/gfs2/rgrp.c/linux/fs/gfs2/super.c/linux/fs/lockd/clntxdr.c/linux/fs/lockd/svc4proc.c/linux/fs/lockd/svclock.c/linux/fs/lockd/svcproc.c/linux/fs/lockd/xdr4.c/linux/fs/nfs_common/nfslocalio.c/linux/fs/nfsd/export.c/linux/fs/nfsd/export.h/linux/fs/nfsd/filecache.c/linux/fs/nfsd/filecache.h/linux/fs/nfsd/lockd.c/linux/fs/nfsd/nfs4acl.c/linux/fs/nfsd/nfs4callback.c/linux/fs/nfsd/nfs4proc.c/linux/fs/nfsd/nfs4recover.c/linux/fs/nfsd/nfs4state.c/linux/fs/nfsd/nfs4xdr.c/linux/fs/nfsd/nfsfh.c/linux/fs/nfsd/nfsfh.h/linux/fs/nfsd/state.h/linux/fs/nfsd/trace.h/linux/fs/nfsd/vfs.c/linux/fs/nfsd/vfs.h/linux/fs/nfsd/xdr4.h/linux/fs/nilfs2/alloc.c/linux/fs/nilfs2/alloc.h/linux/fs/nilfs2/cpfile.c/linux/fs/nilfs2/dat.c/linux/fs/nilfs2/dir.c/linux/fs/nilfs2/ifile.c/linux/fs/nilfs2/ifile.h/linux/fs/nilfs2/inode.c/linux/fs/nilfs2/mdt.c/linux/fs/nilfs2/page.c/linux/fs/nilfs2/page.h/linux/fs/nilfs2/recovery.c/linux/fs/nilfs2/segbuf.c/linux/fs/nilfs2/sufile.c/linux/fs/ocfs2/alloc.c/linux/fs/ocfs2/aops.h/linux/fs/ocfs2/cluster/quorum.c/linux/fs/ocfs2/dlm/dlmapi.h/linux/fs/ocfs2/dlm/dlmdebug.c/linux/fs/ocfs2/file.c/linux/fs/ocfs2/quota.h/linux/fs/proc/array.c/linux/fs/proc/kcore.c/linux/include/acpi/pcc.h/linux/include/acpi/platform/aclinux.h/linux/include/linux/compiler-clang.h/linux/include/linux/compiler-gcc.h/linux/include/linux/dax.h/linux/include/linux/exportfs.h/linux/include/linux/f2fs_fs.h/linux/include/linux/firmware/xlnx-zynqmp.h/linux/include/linux/iommu.h/linux/include/linux/lockd/lockd.h/linux/include/linux/lockd/xdr.h/linux/include/linux/min_heap.h/linux/include/linux/mm.h/linux/include/linux/nfslocalio.h/linux/include/linux/notifier.h/linux/include/linux/percpu-defs.h/linux/include/linux/pm_wakeup.h/linux/include/linux/rwlock.h/linux/include/linux/rwlock_api_smp.h/linux/include/linux/scatterlist.h/linux/include/linux/sched.h/linux/include/linux/slab.h/linux/include/linux/spinlock_api_smp.h/linux/include/linux/spinlock_types_up.h/linux/include/linux/spinlock_up.h/linux/include/linux/sunrpc/xdr.h/linux/include/linux/sunrpc/xdrgen/_defs.h/linux/include/linux/util_macros.h/linux/include/uapi/linux/f2fs.h/linux/include/uapi/linux/fcntl.h/linux/include/ufs/ufshcd.h/linux/init/Kconfig/linux/ipc/msg.c/linux/ipc/namespace.c/linux/kernel/auditsc.c/linux/kernel/crash_core.c/linux/kernel/events/core.c/linux/kernel/events/hw_breakpoint.c/linux/kernel/hung_task.c/linux/kernel/kthread.c/linux/kernel/notifier.c/linux/kernel/reboot.c/linux/kernel/resource.c/linux/kernel/watchdog.c/linux/lib/Kconfig/linux/lib/Kconfig.debug/linux/lib/Makefile/linux/lib/crc16_kunit.c/linux/lib/list-test.c/linux/lib/list_sort.c/linux/lib/min_heap.c/linux/lib/scatterlist.c/linux/lib/slub_kunit.c/linux/lib/test_min_heap.c/linux/lib/util_macros_kunit.c/linux/mm/folio-compat.c/linux/mm/kasan/generic.c/linux/mm/kasan/kasan_test_rust.rs/linux/mm/page-writeback.c/linux/mm/slab.h/linux/mm/slab_common.c/linux/mm/slub.c/linux/mm/util.c/linux/net/sunrpc/cache.c/linux/net/sunrpc/xprtrdma/svc_rdma.c/linux/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c/linux/rust/Makefile/linux/rust/bindgen_parametersbindings_helper.hlib.rs/linux/rust/exports.c/linux/rust/ffi.rs/linux/rust/helpers/build_bug.c/linux/rust/helpers/err.c/linux/rust/helpers/helpers.c/linux/rust/helpers/kunit.c/linux/rust/helpers/mutex.c/linux/rust/helpers/pid_namespace.c/linux/rust/helpers/refcount.c/linux/rust/helpers/signal.c/linux/rust/helpers/slab.c/linux/rust/helpers/spinlock.c/linux/rust/helpers/task.c/linux/rust/helpers/vmalloc.c/linux/rust/helpers/wait.c/linux/rust/helpers/workqueue.c/linux/rust/kernel/alloc.rs/linux/rust/kernel/alloc/allocator.rs/linux/rust/kernel/alloc/allocator_test.rs/linux/rust/kernel/alloc/kbox.rs/linux/rust/kernel/alloc/kvec.rs/linux/rust/kernel/alloc/layout.rs/linux/rust/kernel/block/mq/operations.rs/linux/rust/kernel/block/mq/raw_writer.rs/linux/rust/kernel/block/mq/request.rs/linux/rust/kernel/block/mq/tag_set.rs/linux/rust/kernel/error.rs/linux/rust/kernel/init.rs/linux/rust/kernel/init/__internal.rs/linux/rust/kernel/init/macros.rs/linux/rust/kernel/ioctl.rs/linux/rust/kernel/lib.rs/linux/rust/kernel/list.rs/linux/rust/kernel/list/arc.rs/linux/rust/kernel/list/arc_field.rs/linux/rust/kernel/net/phy.rs/linux/rust/kernel/page.rs/linux/rust/kernel/pid_namespace.rs/linux/rust/kernel/prelude.rs/linux/rust/kernel/print.rs/linux/rust/kernel/rbtree.rs/linux/rust/kernel/std_vendor.rs/linux/rust/kernel/str.rs/linux/rust/kernel/sync.rs/linux/rust/kernel/sync/arc.rs/linux/rust/kernel/sync/arc/std_vendor.rs/linux/rust/kernel/sync/condvar.rs/linux/rust/kernel/sync/lock.rs/linux/rust/kernel/sync/lock/global.rs/linux/rust/kernel/sync/lock/mutex.rs/linux/rust/kernel/sync/lock/spinlock.rs/linux/rust/kernel/sync/locked_by.rs/linux/rust/kernel/task.rs/linux/rust/kernel/time.rs/linux/rust/kernel/transmute.rs/linux/rust/kernel/types.rs/linux/rust/kernel/uaccess.rs/linux/rust/kernel/workqueue.rs/linux/rust/macros/lib.rs/linux/rust/macros/module.rs/linux/rust/macros/paste.rs/linux/rust/uapi/lib.rs/linux/samples/hw_breakpoint/data_breakpoint.c/linux/samples/rust/rust_minimal.rs/linux/samples/rust/rust_print_main.rs/linux/scripts/Makefile.build/linux/scripts/checkpatch.pl/linux/scripts/decode_stacktrace.sh/linux/scripts/gdb/linux/modules.py/linux/scripts/gdb/linux/symbols.py/linux/scripts/generate_rust_analyzer.py/linux/scripts/rust_is_available.sh/linux/scripts/rust_is_available_bindgen_libclang_concat.h/linux/scripts/rust_is_available_test.py/linux/scripts/spelling.txt/linux/security/lsm_audit.c/linux/security/selinux/selinuxfs.c/linux/tools/bpf/bpftool/pids.c/linux/tools/firewire/decode-fcp.c/linux/tools/firewire/nosy-dump.c/linux/tools/include/linux/compiler-gcc.h/linux/tools/lib/list_sort.c/linux/tools/net/sunrpc/extract.sh/linux/tools/net/sunrpc/xdrgen/README/linux/tools/net/sunrpc/xdrgen/generators/__init__.py/linux/tools/net/sunrpc/xdrgen/generators/enum.py/linux/tools/net/sunrpc/xdrgen/generators/pointer.py/linux/tools/net/sunrpc/xdrgen/generators/struct.py/linux/tools/net/sunrpc/xdrgen/generators/typedef.py/linux/tools/net/sunrpc/xdrgen/generators/union.py/linux/tools/net/sunrpc/xdrgen/grammars/xdr.lark/linux/tools/net/sunrpc/xdrgen/subcmds/definitions.py/linux/tools/net/sunrpc/xdrgen/subcmds/source.py/linux/tools/net/sunrpc/xdrgen/templates/C/enum/declaration/enum.j2/linux/tools/net/sunrpc/xdrgen/templates/C/enum/decoder/enum.j2/linux/tools/net/sunrpc/xdrgen/templates/C/enum/decoder/enum_be.j2/linux/tools/net/sunrpc/xdrgen/templates/C/enum/definition/close.j2/linux/tools/net/sunrpc/xdrgen/templates/C/enum/definition/close_be.j2/linux/tools/net/sunrpc/xdrgen/templates/C/enum/encoder/enum.j2/linux/tools/net/sunrpc/xdrgen/templates/C/enum/encoder/enum_be.j2/linux/tools/net/sunrpc/xdrgen/templates/C/enum/maxsize/enum.j2/linux/tools/net/sunrpc/xdrgen/templates/C/pointer/decoder/string.j2/linux/tools/net/sunrpc/xdrgen/templates/C/pointer/definition/string.j2/linux/tools/net/sunrpc/xdrgen/templates/C/pointer/encoder/string.j2/linux/tools/net/sunrpc/xdrgen/templates/C/pointer/maxsize/pointer.j2/linux/tools/net/sunrpc/xdrgen/templates/C/program/decoder/result.j2/linux/tools/net/sunrpc/xdrgen/templates/C/source_top/client.j2/linux/tools/net/sunrpc/xdrgen/templates/C/struct/decoder/string.j2/linux/tools/net/sunrpc/xdrgen/templates/C/struct/definition/string.j2/linux/tools/net/sunrpc/xdrgen/templates/C/struct/encoder/string.j2/linux/tools/net/sunrpc/xdrgen/templates/C/struct/maxsize/struct.j2/linux/tools/net/sunrpc/xdrgen/templates/C/typedef/declaration/string.j2/linux/tools/net/sunrpc/xdrgen/templates/C/typedef/decoder/string.j2/linux/tools/net/sunrpc/xdrgen/templates/C/typedef/definition/string.j2/linux/tools/net/sunrpc/xdrgen/templates/C/typedef/encoder/string.j2/linux/tools/net/sunrpc/xdrgen/templates/C/typedef/maxsize/basic.j2/linux/tools/net/sunrpc/xdrgen/templates/C/typedef/maxsize/fixed_length_opaque.j2/linux/tools/net/sunrpc/xdrgen/templates/C/typedef/maxsize/string.j2/linux/tools/net/sunrpc/xdrgen/templates/C/typedef/maxsize/variable_length_array.j2/linux/tools/net/sunrpc/xdrgen/templates/C/typedef/maxsize/variable_length_opaque.j2/linux/tools/net/sunrpc/xdrgen/templates/C/union/decoder/case_spec_be.j2/linux/tools/net/sunrpc/xdrgen/templates/C/union/decoder/string.j2/linux/tools/net/sunrpc/xdrgen/templates/C/union/encoder/case_spec_be.j2/linux/tools/net/sunrpc/xdrgen/templates/C/union/maxsize/union.j2/linux/tools/net/sunrpc/xdrgen/xdr_ast.py/linux/tools/net/sunrpc/xdrgen/xdrgen/linux/tools/perf/check-header_ignore_hunks/lib/list_sort.c/linux/tools/testing/shared/linux.c |
91d39024 | 30-Oct-2024 |
Alice Ryhl <aliceryhl@google.com> |
rust: samples: add tracepoint to Rust sample
This updates the Rust printing sample to invoke a tracepoint. This ensures that we have a user in-tree from the get-go even though the patch is being mer
rust: samples: add tracepoint to Rust sample
This updates the Rust printing sample to invoke a tracepoint. This ensures that we have a user in-tree from the get-go even though the patch is being merged before its real user.
Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Josh Poimboeuf <jpoimboe@kernel.org> Cc: Jason Baron <jbaron@akamai.com> Cc: Ard Biesheuvel <ardb@kernel.org> Cc: Miguel Ojeda <ojeda@kernel.org> Cc: Alex Gaynor <alex.gaynor@gmail.com> Cc: Wedson Almeida Filho <wedsonaf@gmail.com> Cc: Gary Guo <gary@garyguo.net> Cc: " =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= " <bjorn3_gh@protonmail.com> Cc: Benno Lossin <benno.lossin@proton.me> Cc: Andreas Hindborg <a.hindborg@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Sean Christopherson <seanjc@google.com> Cc: Uros Bizjak <ubizjak@gmail.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Marc Zyngier <maz@kernel.org> Cc: Oliver Upton <oliver.upton@linux.dev> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Ryan Roberts <ryan.roberts@arm.com> Cc: Fuad Tabba <tabba@google.com> Cc: Paul Walmsley <paul.walmsley@sifive.com> Cc: Palmer Dabbelt <palmer@dabbelt.com> Cc: Albert Ou <aou@eecs.berkeley.edu> Cc: Anup Patel <apatel@ventanamicro.com> Cc: Andrew Jones <ajones@ventanamicro.com> Cc: Alexandre Ghiti <alexghiti@rivosinc.com> Cc: Conor Dooley <conor.dooley@microchip.com> Cc: Samuel Holland <samuel.holland@sifive.com> Cc: Huacai Chen <chenhuacai@kernel.org> Cc: WANG Xuerui <kernel@xen0n.name> Cc: Bibo Mao <maobibo@loongson.cn> Cc: Tiezhu Yang <yangtiezhu@loongson.cn> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Tianrui Zhao <zhaotianrui@loongson.cn> Link: https://lore.kernel.org/20241030-tracepoint-v12-3-eec7f0f8ad22@google.com Reviewed-by: Boqun Feng <boqun.feng@gmail.com> Signed-off-by: Alice Ryhl <aliceryhl@google.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
show more ...
|
ad37bcd9 | 30-Oct-2024 |
Alice Ryhl <aliceryhl@google.com> |
rust: add tracepoint support
Make it possible to have Rust code call into tracepoints defined by C code. It is still required that the tracepoint is declared in a C header, and that this header is i
rust: add tracepoint support
Make it possible to have Rust code call into tracepoints defined by C code. It is still required that the tracepoint is declared in a C header, and that this header is included in the input to bindgen.
Instead of calling __DO_TRACE directly, the exported rust_do_trace_ function calls an inline helper function. This is because the `cond` argument does not exist at the callsite of DEFINE_RUST_DO_TRACE.
__DECLARE_TRACE always emits an inline static and an extern declaration that is only used when CREATE_RUST_TRACE_POINTS is set. These should not end up in the final binary so it is not a problem that they sometimes are emitted without a user.
Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Josh Poimboeuf <jpoimboe@kernel.org> Cc: Jason Baron <jbaron@akamai.com> Cc: Ard Biesheuvel <ardb@kernel.org> Cc: Miguel Ojeda <ojeda@kernel.org> Cc: Alex Gaynor <alex.gaynor@gmail.com> Cc: Wedson Almeida Filho <wedsonaf@gmail.com> Cc: " =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= " <bjorn3_gh@protonmail.com> Cc: Benno Lossin <benno.lossin@proton.me> Cc: Andreas Hindborg <a.hindborg@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Sean Christopherson <seanjc@google.com> Cc: Uros Bizjak <ubizjak@gmail.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Marc Zyngier <maz@kernel.org> Cc: Oliver Upton <oliver.upton@linux.dev> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Ryan Roberts <ryan.roberts@arm.com> Cc: Fuad Tabba <tabba@google.com> Cc: Paul Walmsley <paul.walmsley@sifive.com> Cc: Palmer Dabbelt <palmer@dabbelt.com> Cc: Albert Ou <aou@eecs.berkeley.edu> Cc: Anup Patel <apatel@ventanamicro.com> Cc: Andrew Jones <ajones@ventanamicro.com> Cc: Alexandre Ghiti <alexghiti@rivosinc.com> Cc: Conor Dooley <conor.dooley@microchip.com> Cc: Samuel Holland <samuel.holland@sifive.com> Cc: Huacai Chen <chenhuacai@kernel.org> Cc: WANG Xuerui <kernel@xen0n.name> Cc: Bibo Mao <maobibo@loongson.cn> Cc: Tiezhu Yang <yangtiezhu@loongson.cn> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Tianrui Zhao <zhaotianrui@loongson.cn> Link: https://lore.kernel.org/20241030-tracepoint-v12-2-eec7f0f8ad22@google.com Reviewed-by: Carlos Llamas <cmllamas@google.com> Reviewed-by: Gary Guo <gary@garyguo.net> Reviewed-by: Boqun Feng <boqun.feng@gmail.com> Signed-off-by: Alice Ryhl <aliceryhl@google.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
show more ...
|
ac681835 | 15-Sep-2024 |
Alice Ryhl <aliceryhl@google.com> |
rust: file: add abstraction for `poll_table`
The existing `CondVar` abstraction is a wrapper around `wait_queue_head`, but it does not support all use-cases of the C `wait_queue_head` type. To be sp
rust: file: add abstraction for `poll_table`
The existing `CondVar` abstraction is a wrapper around `wait_queue_head`, but it does not support all use-cases of the C `wait_queue_head` type. To be specific, a `CondVar` cannot be registered with a `struct poll_table`. This limitation has the advantage that you do not need to call `synchronize_rcu` when destroying a `CondVar`.
However, we need the ability to register a `poll_table` with a `wait_queue_head` in Rust Binder. To enable this, introduce a type called `PollCondVar`, which is like `CondVar` except that you can register a `poll_table`. We also introduce `PollTable`, which is a safe wrapper around `poll_table` that is intended to be used with `PollCondVar`.
The destructor of `PollCondVar` unconditionally calls `synchronize_rcu` to ensure that the removal of epoll waiters has fully completed before the `wait_queue_head` is destroyed.
That said, `synchronize_rcu` is rather expensive and is not needed in all cases: If we have never registered a `poll_table` with the `wait_queue_head`, then we don't need to call `synchronize_rcu`. (And this is a common case in Binder - not all processes use Binder with epoll.) The current implementation does not account for this, but if we find that it is necessary to improve this, a future patch could store a boolean next to the `wait_queue_head` to keep track of whether a `poll_table` has ever been registered.
Reviewed-by: Benno Lossin <benno.lossin@proton.me> Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Reviewed-by: Trevor Gross <tmgross@umich.edu> Signed-off-by: Alice Ryhl <aliceryhl@google.com> Link: https://lore.kernel.org/r/20240915-alice-file-v10-8-88484f7a3dcf@google.com Signed-off-by: Christian Brauner <brauner@kernel.org>
show more ...
|
8ad1a41f | 15-Sep-2024 |
Alice Ryhl <aliceryhl@google.com> |
rust: file: add `Kuid` wrapper
Adds a wrapper around `kuid_t` called `Kuid`. This allows us to define various operations on kuids such as equality and current_euid. It also lets us provide conversio
rust: file: add `Kuid` wrapper
Adds a wrapper around `kuid_t` called `Kuid`. This allows us to define various operations on kuids such as equality and current_euid. It also lets us provide conversions from kuid into userspace values.
Rust Binder needs these operations because it needs to compare kuids for equality, and it needs to tell userspace about the pid and uid of incoming transactions.
To read kuids from a `struct task_struct`, you must currently use various #defines that perform the appropriate field access under an RCU read lock. Currently, we do not have a Rust wrapper for rcu_read_lock, which means that for this patch, there are two ways forward:
1. Inline the methods into Rust code, and use __rcu_read_lock directly rather than the rcu_read_lock wrapper. This gives up lockdep for these usages of RCU.
2. Wrap the various #defines in helpers and call the helpers from Rust.
This patch uses the second option. One possible disadvantage of the second option is the possible introduction of speculation gadgets, but as discussed in [1], the risk appears to be acceptable.
Of course, once a wrapper for rcu_read_lock is available, it is preferable to use that over either of the two above approaches.
Link: https://lore.kernel.org/all/202312080947.674CD2DC7@keescook/ [1] Reviewed-by: Benno Lossin <benno.lossin@proton.me> Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Reviewed-by: Trevor Gross <tmgross@umich.edu> Signed-off-by: Alice Ryhl <aliceryhl@google.com> Link: https://lore.kernel.org/r/20240915-alice-file-v10-7-88484f7a3dcf@google.com Signed-off-by: Christian Brauner <brauner@kernel.org>
show more ...
|
94d356c0 | 15-Sep-2024 |
Alice Ryhl <aliceryhl@google.com> |
rust: security: add abstraction for secctx
Add an abstraction for viewing the string representation of a security context.
This is needed by Rust Binder because it has a feature where a process can
rust: security: add abstraction for secctx
Add an abstraction for viewing the string representation of a security context.
This is needed by Rust Binder because it has a feature where a process can view the string representation of the security context for incoming transactions. The process can use that to authenticate incoming transactions, and since the feature is provided by the kernel, the process can trust that the security context is legitimate.
This abstraction makes the following assumptions about the C side: * When a call to `security_secid_to_secctx` is successful, it returns a pointer and length. The pointer references a byte string and is valid for reading for that many bytes. * The string may be referenced until `security_release_secctx` is called. * If CONFIG_SECURITY is set, then the three methods mentioned in rust/helpers are available without a helper. (That is, they are not a #define or `static inline`.)
Reviewed-by: Benno Lossin <benno.lossin@proton.me> Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Reviewed-by: Trevor Gross <tmgross@umich.edu> Reviewed-by: Gary Guo <gary@garyguo.net> Signed-off-by: Alice Ryhl <aliceryhl@google.com> Link: https://lore.kernel.org/r/20240915-alice-file-v10-5-88484f7a3dcf@google.com Acked-by: Paul Moore <paul@paul-moore.com> Reviewed-by: Kees Cook <kees@kernel.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
show more ...
|
a3df991d | 15-Sep-2024 |
Wedson Almeida Filho <wedsonaf@gmail.com> |
rust: cred: add Rust abstraction for `struct cred`
Add a wrapper around `struct cred` called `Credential`, and provide functionality to get the `Credential` associated with a `File`.
Rust Binder mu
rust: cred: add Rust abstraction for `struct cred`
Add a wrapper around `struct cred` called `Credential`, and provide functionality to get the `Credential` associated with a `File`.
Rust Binder must check the credentials of processes when they attempt to perform various operations, and these checks usually take a `&Credential` as parameter. The security_binder_set_context_mgr function would be one example. This patch is necessary to access these security_* methods from Rust.
This Rust abstraction makes the following assumptions about the C side: * `struct cred` is refcounted with `get_cred`/`put_cred`. * It's okay to transfer a `struct cred` across threads, that is, you do not need to call `put_cred` on the same thread as where you called `get_cred`. * The `euid` field of a `struct cred` never changes after initialization. * The `f_cred` field of a `struct file` never changes after initialization.
Signed-off-by: Wedson Almeida Filho <wedsonaf@gmail.com> Co-developed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Trevor Gross <tmgross@umich.edu> Reviewed-by: Benno Lossin <benno.lossin@proton.me> Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Reviewed-by: Gary Guo <gary@garyguo.net> Signed-off-by: Alice Ryhl <aliceryhl@google.com> Link: https://lore.kernel.org/r/20240915-alice-file-v10-4-88484f7a3dcf@google.com Reviewed-by: Kees Cook <kees@kernel.org> Reviewed-by: Paul Moore <paul@paul-moore.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
show more ...
|
85184982 | 15-Sep-2024 |
Wedson Almeida Filho <wedsonaf@gmail.com> |
rust: file: add Rust abstraction for `struct file`
This abstraction makes it possible to manipulate the open files for a process. The new `File` struct wraps the C `struct file`. When accessing it u
rust: file: add Rust abstraction for `struct file`
This abstraction makes it possible to manipulate the open files for a process. The new `File` struct wraps the C `struct file`. When accessing it using the smart pointer `ARef<File>`, the pointer will own a reference count to the file. When accessing it as `&File`, then the reference does not own a refcount, but the borrow checker will ensure that the reference count does not hit zero while the `&File` is live.
Since this is intended to manipulate the open files of a process, we introduce an `fget` constructor that corresponds to the C `fget` method. In future patches, it will become possible to create a new fd in a process and bind it to a `File`. Rust Binder will use these to send fds from one process to another.
We also provide a method for accessing the file's flags. Rust Binder will use this to access the flags of the Binder fd to check whether the non-blocking flag is set, which affects what the Binder ioctl does.
This introduces a struct for the EBADF error type, rather than just using the Error type directly. This has two advantages: * `File::fget` returns a `Result<ARef<File>, BadFdError>`, which the compiler will represent as a single pointer, with null being an error. This is possible because the compiler understands that `BadFdError` has only one possible value, and it also understands that the `ARef<File>` smart pointer is guaranteed non-null. * Additionally, we promise to users of the method that the method can only fail with EBADF, which means that they can rely on this promise without having to inspect its implementation. That said, there are also two disadvantages: * Defining additional error types involves boilerplate. * The question mark operator will only utilize the `From` trait once, which prevents you from using the question mark operator on `BadFdError` in methods that return some third error type that the kernel `Error` is convertible into. (However, it works fine in methods that return `Error`.)
Signed-off-by: Wedson Almeida Filho <wedsonaf@gmail.com> Co-developed-by: Daniel Xu <dxu@dxuuu.xyz> Signed-off-by: Daniel Xu <dxu@dxuuu.xyz> Co-developed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Benno Lossin <benno.lossin@proton.me> Signed-off-by: Alice Ryhl <aliceryhl@google.com> Link: https://lore.kernel.org/r/20240915-alice-file-v10-3-88484f7a3dcf@google.com Reviewed-by: Gary Guo <gary@garyguo.net> Signed-off-by: Christian Brauner <brauner@kernel.org>
show more ...
|
f85bea18 | 09-Jul-2024 |
Miguel Ojeda <ojeda@kernel.org> |
rust: allow `dead_code` for never constructed bindings
Starting with the upcoming Rust 1.80.0 (since upstream commit 35130d7233e9 ("Detect pub structs never constructed and unused associated constan
rust: allow `dead_code` for never constructed bindings
Starting with the upcoming Rust 1.80.0 (since upstream commit 35130d7233e9 ("Detect pub structs never constructed and unused associated constants in traits")), the `dead_code` pass detects more cases, which triggers in the `bindings` crate:
warning: struct `boot_params` is never constructed --> rust/bindings/bindings_generated.rs:10684:12 | 10684 | pub struct boot_params { | ^^^^^^^^^^^ | = note: `#[warn(dead_code)]` on by default
As well as in the `uapi` one:
warning: struct `boot_params` is never constructed --> rust/uapi/uapi_generated.rs:10392:12 | 10392 | pub struct boot_params { | ^^^^^^^^^^^ | = note: `#[warn(dead_code)]` on by default
These are all expected, since we do not use all the structs in the bindings that `bindgen` generates from the C headers.
Therefore, allow them.
Reviewed-by: Björn Roy Baron <bjorn3_gh@protonmail.com> Reviewed-by: Finn Behrens <me@kloenk.dev> Tested-by: Benno Lossin <benno.lossin@proton.me> Tested-by: Andreas Hindborg <a.hindborg@samsung.com> Link: https://lore.kernel.org/r/20240709160615.998336-4-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
show more ...
|
fc6e66f4 | 28-May-2024 |
Alice Ryhl <aliceryhl@google.com> |
rust: add abstraction for `struct page`
Adds a new struct called `Page` that wraps a pointer to `struct page`. This struct is assumed to hold ownership over the page, so that Rust code can allocate
rust: add abstraction for `struct page`
Adds a new struct called `Page` that wraps a pointer to `struct page`. This struct is assumed to hold ownership over the page, so that Rust code can allocate and manage pages directly.
The page type has various methods for reading and writing into the page. These methods will temporarily map the page to allow the operation. All of these methods use a helper that takes an offset and length, performs bounds checks, and returns a pointer to the given offset in the page.
This patch only adds support for pages of order zero, as that is all Rust Binder needs. However, it is written to make it easy to add support for higher-order pages in the future. To do that, you would add a const generic parameter to `Page` that specifies the order. Most of the methods do not need to be adjusted, as the logic for dealing with mapping multiple pages at once can be isolated to just the `with_pointer_into_page` method.
Rust Binder needs to manage pages directly as that is how transactions are delivered: Each process has an mmap'd region for incoming transactions. When an incoming transaction arrives, the Binder driver will choose a region in the mmap, allocate and map the relevant pages manually, and copy the incoming transaction directly into the page. This architecture allows the driver to copy transactions directly from the address space of one process to another, without an intermediate copy to a kernel buffer.
This code is based on Wedson's page abstractions from the old rust branch, but it has been modified by Alice by removing the incomplete support for higher-order pages, by introducing the `with_*` helpers to consolidate the bounds checking logic into a single place, and various other changes.
Co-developed-by: Wedson Almeida Filho <wedsonaf@gmail.com> Signed-off-by: Wedson Almeida Filho <wedsonaf@gmail.com> Reviewed-by: Andreas Hindborg <a.hindborg@samsung.com> Reviewed-by: Trevor Gross <tmgross@umich.edu> Reviewed-by: Benno Lossin <benno.lossin@proton.me> Reviewed-by: Boqun Feng <boqun.feng@gmail.com> Signed-off-by: Alice Ryhl <aliceryhl@google.com> Link: https://lore.kernel.org/r/20240528-alice-mm-v7-4-78222c31b8f4@google.com [ Fixed typos and added a few intra-doc links. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
show more ...
|