1
0
Fork 0
mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-01-22 07:53:11 -05:00
linux/samples
Linus Torvalds e3610441d1 Rust changes for v6.14
Toolchain and infrastructure:
 
  - Finish the move to custom FFI integer types started in the previous
    cycle and finally map 'long' to 'isize' and 'char' to 'u8'. Do a few
    cleanups on top thanks to that.
 
  - Start to use 'derive(CoercePointee)' on Rust >= 1.84.0.
 
    This is a major milestone on the path to build the kernel using only
    stable Rust features. In particular, previously we were using the
    unstable features 'coerce_unsized', 'dispatch_from_dyn' and 'unsize',
    and now we will use the new 'derive_coerce_pointee' one, which is on
    track to stabilization. This new feature is a macro that essentially
    expands into code that internally uses the unstable features that we
    were using before, without having to expose those.
 
    With it, stable Rust users, including the kernel, will be able to
    build custom smart pointers that work with trait objects, e.g.:
 
        fn f(p: &Arc<dyn Display>) {
            pr_info!("{p}\n");
        }
 
        let a: Arc<dyn Display> = Arc::new(42i32, GFP_KERNEL)?;
        let b: Arc<dyn Display> = Arc::new("hello there", GFP_KERNEL)?;
 
        f(&a); // Prints "42".
        f(&b); // Prints "hello there".
 
    Together with the 'arbitrary_self_types' feature that we started
    using in the previous cycle, using our custom smart pointers like
    'Arc' will eventually only rely in stable Rust.
 
  - Introduce 'PROCMACROLDFLAGS' environment variable to allow to link
    Rust proc macros using different flags than those used for linking
    Rust host programs (e.g. when 'rustc' uses a different C library
    than the host programs' one), which Android needs.
 
  - Help kernel builds under macOS with Rust enabled by accomodating
    other naming conventions for dynamic libraries (i.e. '.so' vs.
    '.dylib') which are used for Rust procedural macros. The actual
    support for macOS (i.e. the rest of the pieces needed) is provided
    out-of-tree by others, following the policy used for other parts of
    the kernel by Kbuild.
 
  - Run Clippy for 'rusttest' code too and clean the bits it spotted.
 
  - Provide Clippy with the minimum supported Rust version to improve
    the suggestions it gives.
 
  - Document 'bindgen' 0.71.0 regression.
 
 'kernel' crate:
 
  - 'build_error!': move users of the hidden function to the documented
    macro, prevent such uses in the future by moving the function
    elsewhere and add the macro to the prelude.
 
  - 'types' module: add improved version of 'ForeignOwnable::borrow_mut'
    (which was removed in the past since it was problematic); change
    'ForeignOwnable' pointer type to '*mut'.
 
  - 'alloc' module: implement 'Display' for 'Box' and align the 'Debug'
    implementation to it; add example (doctest) for 'ArrayLayout::new()'.
 
  - 'sync' module: document 'PhantomData' in 'Arc'; use
    'NonNull::new_unchecked' in 'ForeignOwnable for Arc' impl.
 
  - 'uaccess' module: accept 'Vec's with different allocators in
    'UserSliceReader::read_all'.
 
  - 'workqueue' module: enable run-testing a couple more doctests.
 
  - 'error' module: simplify 'from_errno()'.
 
  - 'block' module: fix formatting in code documentation (a lint to catch
    these is being implemented).
 
  - Avoid 'unwrap()'s in doctests, which also improves the examples by
    showing how kernel code is supposed to be written.
 
  - Avoid 'as' casts with 'cast{,_mut}' calls which are a bit safer.
 
 And a few other cleanups.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEPjU5OPd5QIZ9jqqOGXyLc2htIW0FAmeNeRsACgkQGXyLc2ht
 IW0exRAAx3ag/JaiR3n5aDBJqUX/Vi6/u+3fTiHOGp9oMFK4ZYR9rlWIr0ArU8a0
 4PApTR5ozrD+lgD1gCjHikhvpacLoTcz0WD0sP8qWlSqQFiMcTXmmWQfeJc7hheE
 4zyKlxswvbHjnOs/k24i5FS4E/CRpC7TJT5RkybaWVunsIps/im4xTnXfUzMhjVG
 SWcRaJtQA8xze9iiRlqw9EFQL6iT5gIKAe0I2i2J+zYzsY6m23fQ/8IxvglaiSDT
 /GIIqDscMH6drfQFRsvTtkcw0Mq64e6hlyWS9s4b9Q0IhgS0sju0qbQrfLLet75t
 1r+JlBZYhQy+4LXZTgBmQ8mVR8NEurnsOullm2AoTy6EYCPvXExSv4JCXYVvgPh+
 d4j/0pCeKUg9aDUtuEAUPHGQk1j7mORGf4J8jPQXla/7/YfqJvluycpMe54gLZpA
 FU24aqtb5/q3/Gqm8omKe/7FdYsu44E1haiP77bhNeYM3pWJrlIovBCafBtc1mQM
 lMtK6EjiQqrz1kEWutx+RQeeiir1G++GlVNGO2LSdNi/6qfjfBQM9dEqsCc8i3XL
 rsLL368SEKQENhSNJFceg6RX37WPwcyIkHAeZ91ijSz6W4I5HtUZpD3UPcgJoiaS
 xuOi44bR6Lt0zXF7eaXZTUh2gf8o++tsgfc4OZPaZ3azn6Y3pXw=
 =VLNX
 -----END PGP SIGNATURE-----

Merge tag 'rust-6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/ojeda/linux

Pull rust updates from Miguel Ojeda:
 "Toolchain and infrastructure:

   - Finish the move to custom FFI integer types started in the previous
     cycle and finally map 'long' to 'isize' and 'char' to 'u8'. Do a
     few cleanups on top thanks to that.

   - Start to use 'derive(CoercePointee)' on Rust >= 1.84.0.

     This is a major milestone on the path to build the kernel using
     only stable Rust features. In particular, previously we were using
     the unstable features 'coerce_unsized', 'dispatch_from_dyn' and
     'unsize', and now we will use the new 'derive_coerce_pointee' one,
     which is on track to stabilization. This new feature is a macro
     that essentially expands into code that internally uses the
     unstable features that we were using before, without having to
     expose those.

     With it, stable Rust users, including the kernel, will be able to
     build custom smart pointers that work with trait objects, e.g.:

         fn f(p: &Arc<dyn Display>) {
             pr_info!("{p}\n");
         }

         let a: Arc<dyn Display> = Arc::new(42i32, GFP_KERNEL)?;
         let b: Arc<dyn Display> = Arc::new("hello there", GFP_KERNEL)?;

         f(&a); // Prints "42".
         f(&b); // Prints "hello there".

     Together with the 'arbitrary_self_types' feature that we started
     using in the previous cycle, using our custom smart pointers like
     'Arc' will eventually only rely in stable Rust.

   - Introduce 'PROCMACROLDFLAGS' environment variable to allow to link
     Rust proc macros using different flags than those used for linking
     Rust host programs (e.g. when 'rustc' uses a different C library
     than the host programs' one), which Android needs.

   - Help kernel builds under macOS with Rust enabled by accomodating
     other naming conventions for dynamic libraries (i.e. '.so' vs.
     '.dylib') which are used for Rust procedural macros. The actual
     support for macOS (i.e. the rest of the pieces needed) is provided
     out-of-tree by others, following the policy used for other parts of
     the kernel by Kbuild.

   - Run Clippy for 'rusttest' code too and clean the bits it spotted.

   - Provide Clippy with the minimum supported Rust version to improve
     the suggestions it gives.

   - Document 'bindgen' 0.71.0 regression.

  'kernel' crate:

   - 'build_error!': move users of the hidden function to the documented
     macro, prevent such uses in the future by moving the function
     elsewhere and add the macro to the prelude.

   - 'types' module: add improved version of 'ForeignOwnable::borrow_mut'
     (which was removed in the past since it was problematic); change
     'ForeignOwnable' pointer type to '*mut'.

   - 'alloc' module: implement 'Display' for 'Box' and align the 'Debug'
     implementation to it; add example (doctest) for 'ArrayLayout::new()'

   - 'sync' module: document 'PhantomData' in 'Arc'; use
     'NonNull::new_unchecked' in 'ForeignOwnable for Arc' impl.

   - 'uaccess' module: accept 'Vec's with different allocators in
     'UserSliceReader::read_all'.

   - 'workqueue' module: enable run-testing a couple more doctests.

   - 'error' module: simplify 'from_errno()'.

   - 'block' module: fix formatting in code documentation (a lint to catch
     these is being implemented).

   - Avoid 'unwrap()'s in doctests, which also improves the examples by
     showing how kernel code is supposed to be written.

   - Avoid 'as' casts with 'cast{,_mut}' calls which are a bit safer.

  And a few other cleanups"

* tag 'rust-6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/ojeda/linux: (32 commits)
  kbuild: rust: add PROCMACROLDFLAGS
  rust: uaccess: generalize userSliceReader to support any Vec
  rust: kernel: add improved version of `ForeignOwnable::borrow_mut`
  rust: kernel: reorder `ForeignOwnable` items
  rust: kernel: change `ForeignOwnable` pointer to mut
  rust: arc: split unsafe block, add missing comment
  rust: types: avoid `as` casts
  rust: arc: use `NonNull::new_unchecked`
  rust: use derive(CoercePointee) on rustc >= 1.84.0
  rust: alloc: add doctest for `ArrayLayout::new()`
  rust: init: update `stack_try_pin_init` examples
  rust: error: import `kernel`'s `LayoutError` instead of `core`'s
  rust: str: replace unwraps with question mark operators
  rust: page: remove unnecessary helper function from doctest
  rust: rbtree: remove unwrap in asserts
  rust: init: replace unwraps with question mark operators
  rust: use host dylib naming convention to support macOS
  rust: add `build_error!` to the prelude
  rust: kernel: move `build_error` hidden function to prevent mistakes
  rust: use the `build_error!` macro, not the hidden function
  ...
2025-01-21 17:48:03 -08:00
..
acrn virt: acrn: Fix typos 2024-05-04 18:59:44 +02:00
auxdisplay
binderfs
bpf samples/bpf: Remove unnecessary -I flags from libbpf EXTRA_CFLAGS 2024-12-03 13:29:04 -08:00
cgroup samples/cgroup: add .gitignore file for generated samples 2024-01-24 11:52:40 -08:00
configfs samples: configfs: add missing MODULE_DESCRIPTION() macro 2024-07-10 14:59:01 +02:00
connector
coresight
fanotify
fprobe fprobe: Use ftrace_regs in fprobe exit handler 2024-12-26 10:50:03 -05:00
ftrace samples/ftrace: Add support for ftrace direct samples on powerpc 2024-10-31 11:00:55 +11:00
hid HID: samples: fix the 2 struct_ops definitions 2024-07-05 14:08:31 +02:00
hidraw
hw_breakpoint perf/hw_breakpoint: use ERR_PTR_PCPU(), IS_ERR_PCPU() and PTR_ERR_PCPU() macros 2024-11-05 17:12:32 -08:00
kdb
kfifo kfifo: don't include dma-mapping.h in kfifo.h 2024-10-23 08:05:20 +02:00
kmemleak kmemleak-test: add percpu leak 2024-09-01 20:25:50 -07:00
kobject samples/kobject: add missing MODULE_DESCRIPTION() macros 2024-06-04 18:04:28 +02:00
kprobes samples: kprobes: add missing MODULE_DESCRIPTION() macros 2024-06-12 08:44:27 +09:00
landlock samples/landlock: Clarify option parsing behaviour 2024-10-22 20:43:43 +02:00
livepatch
mei
nitro_enclaves
pfsm
pidfd
pktgen samples: pktgen: correct dev to DEV 2024-11-13 18:54:33 -08:00
qmi Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
rpmsg
rust rust: use derive(CoercePointee) on rustc >= 1.84.0 2025-01-13 23:45:30 +01:00
seccomp samples: user-trap: fix strict-aliasing warning 2024-02-12 10:42:02 -08:00
timers
trace_events tracing: Add __print_dynamic_array() helper 2024-10-30 17:24:32 +01:00
trace_printk
uhid
user_events
v4l media: samples: v4l2-pci-skeleton.c: drop vb2_ops_wait_prepare/finish 2024-10-28 09:20:10 +01:00
vfio-mdev module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
vfs samples/vfs: fix build warnings 2025-01-20 13:14:21 +01:00
watch_queue
watchdog
Kconfig
Makefile