Commit Graph

9980 Commits

Author SHA1 Message Date
Linus Torvalds
bb29b957ea Kbuild / Kconfig updates for 7.4
Kbuild:
 
 - Suppress compiler flags in debug info for external module builds
 
 - Use '-fmacro-prefix-map' in more places in the build
 
 - Merge initial set of changes from Lorenzo's speed up series, along
   with some fixes found through testing
 
   - Avoid allocating .modinfo in vmlinux
 
   - Speed up kallsyms by indexing symbols by token and outputting binary
     data to disk directly then including in assembly via .incbin
 
   - Don't sort $(NM) output when unnecessary
 
   - Only emit relocations on the final vmlinx link
 
   - Reimplement mksysmap in C
 
   - Move many cc-option and ld-option calls into the Kconfig stage to
     cache their results
 
   - Use pigz for gzip compression when available
 
 - Move gen_init_cpio and gen_initramfs.sh from usr/ to scripts/
 
 - Add a TOML configuration to scripts/container and update documentation
   accordingly
 
 - Add a generic, opt-in mechanism for checking that headers can compile
   standalone
 
 - Update machine function splitting argument for LLVM 24 rename in
   AutoFDO build
 
 - Miscellaneous minor clean ups, fixes, and hardening, mostly
   found/fixed via LLMs
 
 Kconfig:
 
 - Turn recursive ranges into an error
 
 - Fix savedefconfig for defaults that were adjusted for being out of
   range and revert a previously applied workaround
 
 - Improvements and hardening around integer and hexadecimal values
 
 - Emit a warning when selecting or implying a choice symbol, which has no
   effect
 
 - Emit a warning when KCONFIG_PROBABILITY is malformed
 
 - Introduce def_string / def_int / def_hex to mirror the existing
   def_bool / def_tristate to succinctly set a value and type at the same
   time.
 
 - Add cc-option-str and ld-option-str macros to act like Kbuild's
   cc-option and ld-option, returning the string when the option is
   supported, allowing many checks to be moved into Kconfig
 
 - Minor usability improvements to Kconfig tests
 
 Signed-off-by: Nathan Chancellor <nathan@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQR74yXHMTGczQHYypIdayaRccAalgUCatRBoQAKCRAdayaRccAa
 lg+JAQCyjmh+xC2lLSHFGB9qTzqYpVoIT0Z9/6EGx09nYgMr5AEAmzg/+dor5u+6
 vjklzsGs95G01yetVE5ifNNsLvVxTAo=
 =HbPA
 -----END PGP SIGNATURE-----

Merge tag 'kbuild-7.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux

Pull Kbuild / Kconfig updates from Nathan Chancellor:
 "Kbuild:

   - Suppress compiler flags in debug info for external module builds

   - Use '-fmacro-prefix-map' in more places in the build

   - Merge initial set of changes from Lorenzo's speed up series, along
     with some fixes found through testing:

     - Avoid allocating .modinfo in vmlinux

     - Speed up kallsyms by indexing symbols by token and outputting
       binary data to disk directly then including in assembly via
       .incbin

     - Don't sort $(NM) output when unnecessary

     - Only emit relocations on the final vmlinx link

     - Reimplement mksysmap in C

     - Move many cc-option and ld-option calls into the Kconfig stage to
       cache their results

     - Use pigz for gzip compression when available

   - Move gen_init_cpio and gen_initramfs.sh from usr/ to scripts/

   - Add a TOML configuration to scripts/container and update
     documentation accordingly

   - Add a generic, opt-in mechanism for checking that headers can
     compile standalone

   - Update machine function splitting argument for LLVM 24 rename in
     AutoFDO build

   - Miscellaneous minor clean ups, fixes, and hardening, mostly
     found/fixed via LLMs

  Kconfig:

   - Turn recursive ranges into an error

   - Fix savedefconfig for defaults that were adjusted for being out of
     range and revert a previously applied workaround

   - Improvements and hardening around integer and hexadecimal values

   - Emit a warning when selecting or implying a choice symbol, which
     has no effect

   - Emit a warning when KCONFIG_PROBABILITY is malformed

   - Introduce def_string / def_int / def_hex to mirror the existing
     def_bool / def_tristate to succinctly set a value and type at the
     same time.

   - Add cc-option-str and ld-option-str macros to act like Kbuild's
     cc-option and ld-option, returning the string when the option is
     supported, allowing many checks to be moved into Kconfig

   - Minor usability improvements to Kconfig tests"

* tag 'kbuild-7.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux: (59 commits)
  kbuild: AutoFDO: Update split machine function argument for upstream rename
  kbuild: Mark the initcall ordering recipe as recursive
  kbuild: Mark the gzip recipes as recursive
  localmodconfig: Explicitly report boolean configs during integrity check
  scripts/make_fit: Ignore schema checks when decomposing DTBs
  clang-tools: Import os for broken pipe handling
  kconfig: use the value argument in sym_get_near_range_bound()
  kconfig: fix infinite loop in conf_choice() when no choice value is visible
  kconfig: cleanup stale comment about 'keys' array
  kconfig: Improve ergonomics around disabling warnings with cc-option
  scripts/Kconfig.toolchain: Drop compiler symbols from dependencies
  checkkconfigsymbols.py: Parse Git status output line by line
  gen_init_cpio: stop parsing on lines with a missing argument list
  .gitignore: drop Module.markers
  .gitignore: ignore pacman package signatures
  kbuild: add header check facility as a manually run static analyzer
  Documentation: dev-tools: refer to user ID rather than id
  Documentation: dev-tools: update container.rst with config file
  scripts: add TOML config to container tool
  kconfig: tests: {old,save}defconfig: Forward dynamic keyword arguments
  ...
2026-10-21 10:45:44 -10:00
Linus Torvalds
12d5fc96eb Rust changes for v7.4
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:🆕:<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.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEPjU5OPd5QIZ9jqqOGXyLc2htIW0FAmrU9HoACgkQGXyLc2ht
 IW2t/A/8CWBNGMU1HlM23gKmG9z3UuOp9RdebQMQxcjKcW5+odHHLtLn5ytuKfds
 TwGHoPXBlm9iyVBTCbklJfRmVqXwGgg/Dr5PyUpFSMLPKfeTDANnseJmFzcnNtkr
 3ChqB4D1J91OWZuUbS2YqNyXYuQQHhPCfu4idi/HjqdDPDZr8bAG3RdYhydTHITu
 ahlbeisR6fyFO2ctWkxCFbbsAJ6nX37TVDF8lTKu5vxbJp5b7r4u9u2cQ2OEWrNc
 sh/n3tv7JZSoIWapOAlsDpRXX00MsPFqiO1Ytuf8JOb3kwoVDDT0Ww3dDbmkiVKN
 NEcEkYUcFRkAltscPHSos8MuElVqXQyY+ZrjCykXrFsxwKWeGXHYwBS9HBVPs49Q
 AYzdbNe+hsUfqNJo4lP/9R8U9SQTv4/0T0cvgg9W1sdYJCePuzOwuTgaFDPs6zUL
 vz/RZ6tIA0UbRQVnLnjoD8xWne+kpfDaZVinTCGqHpOBmEvPSxWwsHKj9Q5qJsC8
 1UakcpFQ3gsvXn4Od7VAL2ODrc/gxSHEG7J1Zj0625CbrSd81Ga0fvE3VxtjxpRH
 AQF9W/fnZ17pV4xBlqYZP2TR0/QNCHH8b/JCevOg1Rkafe3eqf2FjarfbrhVyOTT
 wrm9gdDVwv40j0K1tVVnOAo+ey3wjlh+Q5jqVrnu15FpMsfzxlE=
 =nyUg
 -----END PGP SIGNATURE-----

Merge tag 'rust-7.4' of 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:🆕:<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
  ...
2026-10-21 10:20:36 -10:00
Linus Torvalds
14c8977403 It was a reasonably busy cycle for docs; changes include:
- Add the AGENTS.md symbolic link into the top-level directory in the hopes
   that LLMs will read it and produce better work.
 
 - The removal of the Assisted-by requirement, as concluded at the
   Maintainer Summit.
 
 - A new "testdocs" make target to run the documentation unit tests.
 
 - Lots of work on the Portuguese, and Chinese translations; there is now
   maintenance for the traditional Chinese translations as well.
 
 ...and the usual pile of minor fixes, documentation updates, etc.
 -----BEGIN PGP SIGNATURE-----
 
 iQFDBAABCgAtFiEEIw+MvkEiF49krdp9F0NaE2wMflgFAmrXgRMPHGNvcmJldEBs
 d24ubmV0AAoJEBdDWhNsDH5YAScH/28hCTx+pChtG42h1qHi+4zMHvJG3L7he2pG
 NxCJnrSPdYOEtdF7QW31he//D5KS0utAf3lxka3kouG/wAyFnXPi4BvSZNlq63FS
 9SSrcVfp3QZiLo/5Q8vvKX4USKLaGo6JxgI9yQBoYejUTYpfejbP+8Xu+qP3qnd8
 pPFLZGGtc4QBJveJH9F7LKJo8VcgHD8S8YdwOPUnJ5N7m1A8+ZN3JPONO6UZYQip
 3STTENdk/fNrfONuyS6URN6Z3TA8+63IpPS5u3+jfCqohxDqeHpnj0Ibsh2pVd8V
 rpz3YaOYRiMlXVe5uIXxqywf6XzdMRW34NWwB+X/F87hxQFm0Lo=
 =Sk+o
 -----END PGP SIGNATURE-----

Merge tag 'docs-7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/docs/linux

Pull documentation updates from Jonathan Corbet:
 "It was a reasonably busy cycle for docs; changes include:

   - Add the AGENTS.md symbolic link into the top-level directory in the
     hopes that LLMs will read it and produce better work

   - The removal of the Assisted-by requirement, as concluded at the
     Maintainer Summit

   - A new "testdocs" make target to run the documentation unit tests

   - Lots of work on the Portuguese, and Chinese translations; there is
     now maintenance for the traditional Chinese translations as well

  ...and the usual pile of minor fixes, documentation updates, etc"

* tag 'docs-7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/docs/linux: (125 commits)
  docs: add AGENTS.md as a symlink to README
  docs: kernel-parameters: adjust reserve_mem build option
  docs: kernel-parameters: don't mix cmdline options & build options
  docs/ja_JP: translate submitting-patches.rst (review and report tags)
  docs: remove Assisted-by references
  Revert "docs: landlock: fix ENOMSG condition in create_ruleset kernel-doc"
  docs: kdoc: parse context_lock_struct() as struct declaration
  docs: timers: hpet: Document userspace API and ioctl commands
  docs: timers: hpet: Modernize file references
  Documentation: sched-preemption: Add a SPDX license identifier
  docs: ABI: sysfs-driver-xdata: use literal blocks for console commands
  docs: ABI: sysfs-class-firmware-attributes: use literal blocks for console commands
  ABI: sysfs-bus-usb: use literal block for console commands
  docs/ABI: testing: aspeed-uart-routing: use literal block for console commands
  docs: kernel-parameters: fix a truncated sentence for preempt=lazy
  sched/doc: add a preemption model overview
  docs: ABI: TMR manager: use literal blocks for console I/O
  Documentation/ABI: IFS: use literal blocks for commands
  ABI: sysfs-bus-pci: use literal blocks for commands
  docs: translations: pt_BR: add debugging index
  ...
2026-10-20 14:38:38 -10:00
Linus Torvalds
742f62b639 alpha updates for v7.4
- alpha: add bounded Clipper console-log scanning
 - alpha: decode Clipper environmental events
 - alpha: decode and acknowledge Tsunami system machine checks
 - alpha: bound EV6 logout decoding by the processor area
 - alpha: describe the Tsunami system machine check frame
 - alpha: move Tsunami machine check handling to err_tsunami.c
 - alpha: fill in pc for software event samples
 - alpha: add HAVE_PERF_REGS and HAVE_PERF_USER_STACK_DUMP support
 - alpha: use user_stack_pointer() in KSTK_ESP() and dump_elf_thread()
 - alpha: stop storing the user stack pointer in pt_regs
 - alpha: fix stale user_stack_pointer()
 - selftests/seccomp: add Alpha support to seccomp_bpf
 - alpha: do not skip TLB shootdown IPIs for kthread-borrowed mms
 - alpha: do not clear remote MMU contexts in migrate_flush_tlb_page()
 - alpha: invalidate the local context in flush_icache_user_page()
 - alpha: invalidate the local context in flush_tlb_mm()
 - alpha: fix the local TLB invalidate in the UP flush_tlb_page()
 - alpha: fix the local TLB invalidate in flush_tlb_page()
 - alpha: invalidate the local context in flush_tlb_page()
 - alpha: only use a targeted tbi() when the target mm is really current
 - alpha: run check_mmu_context() from finish_arch_post_lock_switch()
 - alpha: load the MMU context when switch_mm() switches the current task
 - alpha: implement hugetlb support
 - alpha: align hugetlb mappings in arch_get_unmapped_area()
 - alpha: define granularity hint PTE bits
 - alpha: describe the PTE read and write enable bits
 - alpha: handle VM_FAULT_HWPOISON in do_page_fault()
 - alpha: add missing page_table_check_pte_clear() to ptep_get_and_clear()
 - alpha: default NR_CPUS to 32 for Wildfire
 - alpha: link platform help text to the alphalinux.org wiki
 - alpha: correct system descriptions in Kconfig help text
 - alpha: replace dead links in Kconfig help text
 - alpha: support the remaining kernel compression formats
 - alpha: add self-extracting compressed kernel boot stub
 - xz: add arch-specific tuning for alpha
 - alpha: select SPARSE_IRQ
 - alpha: select ARCH_WANT_IRQS_OFF_ACTIVATE_MM
 - alpha: select ARCH_WANT_LD_ORPHAN_WARN
 - alpha: discard .eh_frame and the relocation sections
 - alpha: select SYSCTL_EXCEPTION_TRACE
 - alpha: select ARCH_USE_MEMTEST
 - alpha: select HAVE_GUP_FAST
 - alpha: select ARCH_HAS_DEBUG_VM_PGTABLE
 - alpha: add ARCH_SUPPORTS_PAGE_TABLE_CHECK support
 - alpha: add ARCH_HAS_PTE_SPECIAL support
 - alpha: add HAVE_ARCH_THREAD_STRUCT_WHITELIST support
 - alpha: select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
 - alpha: select HAVE_ARCH_COMPILER_H
 - alpha: select ARCH_SUPPORTS_INT128
 - alpha: select ARCH_HAS_FAST_MULTIPLIER
 - alpha: select ARCH_SUPPORTS_ATOMIC_RMW
 - alpha: select EDAC_SUPPORT
 - alpha: select HAVE_DEBUG_KMEMLEAK
 - alpha: select ARCH_HAS_GCOV_PROFILE_ALL
 - alpha: select ARCH_HAS_UBSAN
 - alpha: enter hardirq context before looking up the irq descriptor
 - alpha: enable GENERIC_ENTRY
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQTIw07U9ivnHy+tugnaDr6nZQzE/AUCatZIQgAKCRDaDr6nZQzE
 /AqTAP9RHaiXEn9o6NkcvCfiCLin7UUQmDb0GVBMQCO6elERWQEAoTYaCYWB0cKj
 wsF8DtzdXBKHZt7MKy56uiuESF7zlwk=
 =1yco
 -----END PGP SIGNATURE-----

Merge tag 'alpha-for-v7.4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/lindholm/alpha

Pull alpha updates from Magnus Lindholm:
 "This completes Alpha's conversion to GENERIC_ENTRY and enables a range
  of kernel features through Kconfig updates, including UBSAN, gcov,
  kmemleak, page-table checking, fast GUP and sparse IRQs.

  It includes TLB and MMU context fixes prompted by glibc test-suite
  failures, HugeTLB support for 64KB, 512KB and 4MB pages, and fixes for
  poisoned-page faults and page-table checking.

  Machine-check handling is improved on Tsunami platforms, with bounded
  EV6 logout decoding, Clipper environmental event reporting and safer
  firmware console-log scanning.

  Other changes add self-extracting compressed kernels with support for
  all kernel compression formats, Alpha-specific XZ tuning, perf
  register and user-stack sampling, and Alpha support in the seccomp
  selftests. The series also fixes user stack-pointer reporting and IRQ
  entry ordering, adds 128-bit shift helpers, cleans up linker sections,
  and updates Kconfig help"

* tag 'alpha-for-v7.4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/lindholm/alpha: (57 commits)
  alpha: add bounded Clipper console-log scanning
  alpha: decode Clipper environmental events
  alpha: decode and acknowledge Tsunami system machine checks
  alpha: bound EV6 logout decoding by the processor area
  alpha: describe the Tsunami system machine check frame
  alpha: move Tsunami machine check handling to err_tsunami.c
  alpha: fill in pc for software event samples
  alpha: add HAVE_PERF_REGS and HAVE_PERF_USER_STACK_DUMP support
  alpha: use user_stack_pointer() in KSTK_ESP() and dump_elf_thread()
  alpha: stop storing the user stack pointer in pt_regs
  alpha: fix stale user_stack_pointer()
  selftests/seccomp: add Alpha support to seccomp_bpf
  alpha: do not skip TLB shootdown IPIs for kthread-borrowed mms
  alpha: do not clear remote MMU contexts in migrate_flush_tlb_page()
  alpha: invalidate the local context in flush_icache_user_page()
  alpha: invalidate the local context in flush_tlb_mm()
  alpha: fix the local TLB invalidate in the UP flush_tlb_page()
  alpha: fix the local TLB invalidate in flush_tlb_page()
  alpha: invalidate the local context in flush_tlb_page()
  alpha: only use a targeted tbi() when the target mm is really current
  ...
2026-10-20 14:31:24 -10:00
Linus Torvalds
303bff3637 Core features:
- Remove big-endian kernel support: CONFIG_CPU_BIG_ENDIAN has depended
    on BROKEN for a while, so drop the remaining code (BE hypervisor
    object, BPF JIT, assembly/crypto/library routines, endianness helper
    macros, selftests) and force a little-endian build
 
  - Add preemptible this_cpu_*() operations (read/write, RMW, xchg,
    cmpxchg and cmpxchg128) that no longer need to disable preemption
    around the per-CPU address generation and access
 
  - Preparation patches for implementing CONFIG_HOTPLUG_PARALLEL on
    arm64
 
 Memory management:
 
  - Treat faults taken by EFI runtime firmware as kernel faults
 
  - Clear PTE_WRITE for EFI_MEMORY_RO mappings (with hardware dirty state
    management enabled, this is not truly read-only)
 
  - Raise the default ARCH_MMAP_RND_BITS for 48-bit and 52-bit VA
    configurations (28/26/24 bits for 4K/16K/64K pages)
 
  - Implement clear_page[s]() using memset()
 
  - Enable BBML2 no-abort (a.k.a. BBML3) for the NVIDIA Rigel CPU
 
 Perf and PMU:
 
  - Support for HiSilicon's ITS PMU
 
  - Add support for some new events: INST_SIMD_ALU_VEC for Apple PMUs and
    a cycle counter for the latest version of HiSilicon's MN PMU hardware
 
  - A bunch of fixes to the CXL PMU driver to address pre-existing issues
    from Sashiko
 
  - Fix generation of PERF_RECORD_ITRACE_START records for SPE and ETM
    drivers
 
  - Reduce excessive stack consumption in the Marvell DDR PMU driver
 
  - Minor driver updates and cleanups all over
 
 Arm Confidential Compute Architecture (CCA):
 
  - Add an Arm SMCCC bus for firmware services discovered through SMCCC
    and move the TRNG and CCA guest (TSM provider) drivers onto it,
    removing the dummy CCA platform device and adding a sysfs ABI for
    Realm guests
 
  - Move the Realm Service Interface (RSI) code out of arch/arm64/ into
    drivers/firmware/arm_rmm/
 
  - Add the host side of the Realm Management Interface (RMI): detect,
    configure and activate the RMM, add SRO support and wrappers for the
    Realm RMI commands
 
  - Block hibernation (new arch hook in the PM core) and kexec while the
    RMM is active. To be revisited in the future with proper support for
    deactivation
 
  - Handle Granule Protection Faults (GPFs) taken by the host, caused by
    accesses to memory delegated to the RMM. In a future patch, the
    exception table lookup will be limited to is_kdump_kernel() cases
 
 MPAM (Memory Partitioning And Monitoring):
 
  - Add support for the MPAM firmware-backed (Fb) interface, allowing
    MSC accesses to be mediated by firmware
 
  - Fix a list of theoretical issues with the driver (MSC access error
    propagation, MBWU monitor save/restore and locking, resctrl class
    handling, error interrupt restore, maximum number of PARTIDs)
 
  - Add the mailing list and a missing file to the MAINTAINERS entry
 
  - Document when to set arm64.nompam
 
 Errata and CPU features:
 
  - Add the NXP i.MX8QM/8QP workaround for the Cortex-A53 cache coherency
    issue (ERR050104), using a new ARM64_CPUCAP_SOC_ERRATUM capability
    type for SoC-level errata
 
 Miscellaneous:
 
  - Mask debug exceptions (DAIF) around the hardware breakpoint register
    manipulations when called from generic kernel code
 
  - Don't zero the SVE state buffer when the SVE state is live
 
  - Return -EPERM instead of -EBUSY from the GCS prctl() locking
    failures (matching x86), with the selftest updated. Slight ABI change
    but no software deployment yet
 
  - kselftest: fix unsound MTE fault skipping by introducing MTE-safe
    memory accessors, avoid copying each signal test binary more than
    once
 
  - Update sysreg definitions (fix three enum values and two field names,
    mark architecturally dropped fields as RES0) and remove the TME
    transaction state check from the BRBE driver
 
  - Fix the description of ARM64_HAS_LPA2 and remove a redundant
    ID_AA64MMFR0 define
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE5RElWfyWxS+3PLO2a9axLQDIXvEFAmrRImIACgkQa9axLQDI
 XvG+mw/+Lu/PONW1zxo4M65u3vR2bTBqhx8Xo3MP15ANaNVEb3guiUX0ZGAMVdz7
 NgN5NAQFQ5lwb8V8F5LSPGPlHTZ/KEYbiu2IRqwNvUrr2xU+Bz2AZKGvTfScEokO
 PiNfe84I7pWG+U77eBotZ5TxBQiLRe+8VWetIlPOQK9QUm0PG6Z50vhBBahg5kvJ
 b0nf2K3mSIscQRskykkCfIAwTShJM1NvW4+Ygfz6UjHaTtvPg+wsHPMZunKLJW5F
 tbXjZxcJQPziTl7lsRZuKbBrW7Sm5XRl54Q5Tl5ToXQ/C8h2jKjaNoqyXfV+ETJx
 MnFMQfmSIXuKlPuhZTiZK1viVXJe886iCi0vavMwKIR1zNJBKWLWeFz7cepe/jfq
 PHnZo9dX9dNRS7vzBGVq1aYUe/pn5eVeYrUQjMWCyKF2aLvSLm5n4Tf+XtvDUrkA
 O5EuP7sHL8xY9wCJ+Mw45gX1sQiJRy2jBOBbUvZ2/F6ACgG8dvKS9lhpbIn8IsKU
 rFkwacTcsUCoKCnthOwupRApUU/S2fiyzEoUc/R/gDubmnDET3nLcSsspg/FacqP
 OOq/6ErxAQ3HA5ltK0Siq8/qud9mnpYa0xyoxs7EED3jpX2A3lLf9UZduZ+r/2IP
 k5KI+4yRkYPBqGoFjwO8nMrk8jgvZzAtTMh86EOI4LZkcNEvuzU=
 =YdKt
 -----END PGP SIGNATURE-----

Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux

Pull arm64 updates from Catalin Marinas:
 "Here are the arm64 updates for 7.4.

  The more interesting bits are the removal of big-endian kernel support
  (already marked BROKEN for some time), preemptible this_cpu_*()
  operations and MPAM support for the firmware-backed (Fb) interface.

  CCA (Arm's confidential compute) is slowly trickling in with host RMI
  (Realm Management Interface) support and some refactoring, including a
  dedicated SMCCC bus to advertise firmware services. There are also the
  usual PMU updates for new hardware and a few fixes/cleanups.

  Core features:

   - Remove big-endian kernel support: CONFIG_CPU_BIG_ENDIAN has
     depended on BROKEN for a while, so drop the remaining code (BE
     hypervisor object, BPF JIT, assembly/crypto/library routines,
     endianness helper macros, selftests) and force a little-endian
     build

   - Add preemptible this_cpu_*() operations (read/write, RMW, xchg,
     cmpxchg and cmpxchg128) that no longer need to disable preemption
     around the per-CPU address generation and access

   - Preparation patches for implementing CONFIG_HOTPLUG_PARALLEL on
     arm64

  Memory management:

   - Treat faults taken by EFI runtime firmware as kernel faults

   - Clear PTE_WRITE for EFI_MEMORY_RO mappings (with hardware dirty
     state management enabled, this is not truly read-only)

   - Raise the default ARCH_MMAP_RND_BITS for 48-bit and 52-bit VA
     configurations (28/26/24 bits for 4K/16K/64K pages)

   - Implement clear_page[s]() using memset()

   - Enable BBML2 no-abort (a.k.a. BBML3) for the NVIDIA Rigel CPU

  Perf and PMU:

   - Support for HiSilicon's ITS PMU

   - Add support for some new events: INST_SIMD_ALU_VEC for Apple PMUs
     and a cycle counter for the latest version of HiSilicon's MN PMU
     hardware

   - A bunch of fixes to the CXL PMU driver to address pre-existing
     issues from Sashiko

   - Fix generation of PERF_RECORD_ITRACE_START records for SPE and ETM
     drivers

   - Reduce excessive stack consumption in the Marvell DDR PMU driver

   - Minor driver updates and cleanups all over

  Arm Confidential Compute Architecture (CCA):

   - Add an Arm SMCCC bus for firmware services discovered through SMCCC
     and move the TRNG and CCA guest (TSM provider) drivers onto it,
     removing the dummy CCA platform device and adding a sysfs ABI for
     Realm guests

   - Move the Realm Service Interface (RSI) code out of arch/arm64/ into
     drivers/firmware/arm_rmm/

   - Add the host side of the Realm Management Interface (RMI): detect,
     configure and activate the RMM, add SRO support and wrappers for
     the Realm RMI commands

   - Block hibernation (new arch hook in the PM core) and kexec while
     the RMM is active. To be revisited in the future with proper
     support for deactivation

   - Handle Granule Protection Faults (GPFs) taken by the host, caused
     by accesses to memory delegated to the RMM. In a future patch, the
     exception table lookup will be limited to is_kdump_kernel() cases

  MPAM (Memory Partitioning And Monitoring):

   - Add support for the MPAM firmware-backed (Fb) interface, allowing
     MSC accesses to be mediated by firmware

   - Fix a list of theoretical issues with the driver (MSC access error
     propagation, MBWU monitor save/restore and locking, resctrl class
     handling, error interrupt restore, maximum number of PARTIDs)

   - Add the mailing list and a missing file to the MAINTAINERS entry

   - Document when to set arm64.nompam

  Errata and CPU features:

   - Add the NXP i.MX8QM/8QP workaround for the Cortex-A53 cache
     coherency issue (ERR050104), using a new ARM64_CPUCAP_SOC_ERRATUM
     capability type for SoC-level errata

  Miscellaneous:

   - Mask debug exceptions (DAIF) around the hardware breakpoint
     register manipulations when called from generic kernel code

   - Don't zero the SVE state buffer when the SVE state is live

   - Return -EPERM instead of -EBUSY from the GCS prctl() locking
     failures (matching x86), with the selftest updated. Slight ABI
     change but no software deployment yet

   - kselftest: fix unsound MTE fault skipping by introducing MTE-safe
     memory accessors, avoid copying each signal test binary more than
     once

   - Update sysreg definitions (fix three enum values and two field
     names, mark architecturally dropped fields as RES0) and remove the
     TME transaction state check from the BRBE driver

   - Fix the description of ARM64_HAS_LPA2 and remove a redundant
     ID_AA64MMFR0 define"

* tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: (144 commits)
  arm64: cpufeature: Enable BBML2 for NVIDIA Rigel
  arm64: cputype: Add NVIDIA Rigel definitions
  arm64: raise default ARCH_MMAP_RND_BITS for 48-bit and 52-bit VA
  arm64/debug: mask debug exceptions when called from common code
  kselftest/arm64: signal: copy each test binary only once
  kselftest/arm64: Check for -EPERM not -EBUSY in the locking test
  arm64: gcs: Return -EPERM not -EBUSY for prctl() locking failures
  perf: arm_brbe: Remove the check for TME transaction states
  arm64: sysreg: Mark fields the architecture dropped as RES0
  arm64: sysreg: Fix the names of two misspelt fields
  arm64: sysreg: Fix three incorrect enum values
  arm64: smp: Defer RCU registration during secondary CPU bringup
  arm64: smp: Don't bother printing the I-cache policy for each CPU
  arm64: smp: Defer update of secondary CPU capabilities
  arm64: smp: Tidy up cpuinfo init and cpufeature updates
  arm64: smp: Tidy up smp_prepare_cpus()
  arm64: cpufeature: Store every ID register with its overrides applied
  arm64: cpufeature: Read MPAMIDR_EL1 in __cpuinfo_store_cpu()
  arm64: cpufeature: Add read_cpuid_with_overrides()
  arm64: cpufeature: Check arm64_ftr_regs[] before the first store
  ...
2026-10-20 07:55:19 -10:00
Matt Turner
7d1b7e5670 xz: add arch-specific tuning for alpha
Alpha has fixed-length, 4-byte-aligned instructions and no XZ BCJ
filter, so it wants the same LZMA2 settings as the other 4-byte-aligned
targets. Without an entry it hits the default case, which warns

  scripts/xz_wrap.sh: Arch-specific tuning is missing for 'alpha'

and conservatively assumes 2-byte alignment. Alpha gains HAVE_KERNEL_XZ
later in this series; the correct alignment also shrinks a UP1500
kernel's XZ image from 6469320 to 6448840 bytes.

Signed-off-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Magnus Lindholm <linmag7@gmail.com>
Tested-by: Magnus Lindholm <linmag7@gmail.com>
Reviewed-by: Lasse Collin <lasse.collin@tukaani.org>
Link: https://lore.kernel.org/r/20261017-alpha-kernel-compression-v2-1-c71e6b08dc63@gmail.com
Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18 00:44:43 +02:00
Nathan Chancellor
997208ce9f
Merge branch 'kbuild-next-speedups' into kbuild-next
This is the first round of commits and fix-ups from Lorenzo's Kbuild
speed up series.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-10-17 15:20:23 -07:00
Nathan Chancellor
2b358510d5
kbuild: AutoFDO: Update split machine function argument for upstream rename
A recent LLVM commit [1] renamed the internal LLVM plugin option
'-split-machine-functions' to '-function-splitting=all', breaking the
AutoFDO + ThinLTO build with:

  ld.lld: error: -plugin-opt=-: ld.lld: Unknown command line argument '-split-machine-functions'.  Try: 'ld.lld --help'

The plugin option is needed for in-process ThinLTO, so handle the rename
accordingly using ld-option.

Cc: stable@vger.kernel.org
Closes: https://github.com/ClangBuiltLinux/linux/issues/2186
Fixes: 2fd65f7afd ("AutoFDO: Enable machine function split optimization for AutoFDO")
Link: 3e6acc87c5 [1]
Link: https://patch.msgid.link/20261014-update-autofdo-split-machine-function-option-v1-1-5c71b3005e89@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-10-14 16:42:38 -07:00
Sasha Levin
1e035297ff docs: remove Assisted-by references
Commit 78d979db6c ("docs: add AI Coding Assistants documentation") asked
contributors to add an Assisted-by tag to patches developed with help from an
LLM, and commit 816d9992d9 ("coding-assistants: simplify attribution") later
reduced the tag to "Assisted-by: LLM".

A proposal to drop the tag was turned down in July [1]. The main argument for
keeping it was that maintainers wanted a signal that a patch was LLM-assisted,
so that they could review it accordingly.

The tag came up again at the 2026 Maintainers Summit [2]. Roughly 10% of the
18,533 non-merge commits in 7.3 through -rc7 carry an Assisted-by tag, while
actual LLM use is far more widespread. Some contributors do not know about the
rule, others leave the tag off on purpose, and few maintainers ask about it. As
a result, the tag does not provide the signal it was kept for: its absence says
nothing about how a patch was made, and for developers who use these tools for
almost everything, its presence says little more. The choice was between
finding a way to enforce the requirement and dropping it, and there was a
strong, though not unanimous, consensus in the room to drop it. Greg
Kroah-Hartman, who argued for keeping the tag in July, supports removing it now
[3].

Maintainers do still want to know how a patch was created, but the view at the
Summit was that this belongs in the cover letter, where it can describe how the
tools were used, rather than in the changelog.
Documentation/process/generated-content.rst already asks contributors to be
transparent about tool use and is not changed here. The rules on the DCO and on
the submitter's responsibility for the patch stay as they are.

Remove the Assisted-by sections from coding-assistants.rst,
submitting-patches.rst, and the Italian, Brazilian Portuguese and Traditional
Chinese translations, and drop the handling of the tag from checkpatch.

[1] https://lore.kernel.org/workflows/2026070224-unholy-commode-cf45@gregkh/
[2] https://lwn.net/Articles/1099594/
[3] https://lore.kernel.org/all/2026101327-cupid-legal-6cf6@gregkh/

Acked-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Reviewed-by: Kees Cook <kees@kernel.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Jori Koolstra <jkoolstra@xs4all.nl>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: SJ Park <sj@kernel.org>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Acked-by: Mark Brown <broonie@kernel.org>
Acked-by: Daniel Pereira <danielmaraboo@gmail.com>
Acked-by: Shuah Khan <skhan@linuxfoundation.org>
Acked-by: Weijie Yuan <wy@wyuan.org>
Reviewed-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Message-ID: <20261013121501.3738437-1-sashal@kernel.org>
2026-10-14 10:51:49 -06:00
Kees Cook
ae5f6044c4
kbuild: Mark the initcall ordering recipe as recursive
generate_initcall_order.pl, which orders initcalls for Clang LTO, forks
a child per input file, up to the job count scripts/jobserver-exec
passes it in PARALLELISM. It used to run from link-vmlinux.sh, which
the top-level Makefile invokes as a recursive recipe, but
commit 5d45950dfb ("kbuild: move vmlinux.o link to
scripts/Makefile.vmlinux_o") moved it into a recipe without "+".

GNU Make passes the jobserver pipe only to recipes it treats as
recursive, and the make 4.3 in CentOS Stream 9 also hides it in
sub-makes (a backport of the fix for GNU Make bug 58232), so
jobserver-exec cannot open it and prints:

  WARNING: Unable to reopen jobserver read-side pipe: FileNotFoundError(2, 'No such file or directory')

PARALLELISM is then left unset, and the script caps its children at the
number of online CPUs instead of the free job slots.

Mark the recipe as recursive again (this makes "make -n" runs the script
again too, as it did from link-vmlinux.sh). Masahiro posted the same
change and withdrew it because the script was given only vmlinux.a, and
so never ran more than one child [1]. But on arm64, LoongArch, and RISC-V
with CONFIG_EFI_STUB, KBUILD_VMLINUX_LIBS also gives it the EFI stub's
lib.a. Either way, the warning is silenced.

Tested ARCH=x86_64 defconfig with CONFIG_LTO_CLANG_THIN=y, LLVM=1
(Clang 24.0.0git), and GNU Make 4.3 plus CentOS Stream 9's
make-4.3-cloexec.patch.

Fixes: 5d45950dfb ("kbuild: move vmlinux.o link to scripts/Makefile.vmlinux_o")
Link: https://lore.kernel.org/all/CAK7LNARCM=rUm8mA8GRQ7ufeyfneGf4OEvHmESKt=zuxs2KrHw@mail.gmail.com/ [1]
Assisted-by: LLM
Reviewed-by: Nicolas Schier <n.schier@fritz.com>
Signed-off-by: Kees Cook <kees@kernel.org>
Tested-by: Paul E. McKenney <paulmck@kernel.org>
Link: https://patch.msgid.link/20261010081914.540611-2-kees@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-10-11 01:20:05 +01:00
Aaron Tomlin
46d4ccf3b6
localmodconfig: Explicitly report boolean configs during integrity check
When running make localmodconfig, streamline_config.pl reads loaded
modules and maps each module object to its corresponding Kconfig
symbol(s) using repository Makefiles.

In several instances, a loaded module corresponds to an object
controlled by a boolean symbol (e.g. config FOO declared as bool), or is
a composite module that depends on a boolean configuration. Because
boolean options only accept "=y" or disabled, they cannot be configured
as loadable modules ("=m").

Previously, if such a symbol was not already built-in ("=y") in the
baseline configuration, the final integrity check emitted an ambiguous
diagnostic. For example

    foo did not have configs CONFIG_FOO

Further investigation is required by developers to determine whether the
module was out-of-tree, its dependencies were unmet, or it failed due to
a type constraint. Address this by:
    1.  Tracking symbol types in a %types hash during Kconfig parsing.

    2.  Enhancing the final integrity check when running localmodconfig
        (!$localyesconfig) to explicitly annotate boolean symbols.

For example:

    module cec did not have configs CONFIG_CEC_CORE (tristate) CONFIG_RAS_CEC (boolean, not supported with =m)

Signed-off-by: Aaron Tomlin <atomlin@atomlin.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Link: https://patch.msgid.link/20260925181230.130525-1-atomlin@atomlin.com
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-10-11 01:14:08 +01:00
Ting-Han Hou
3bf2237f59
scripts/make_fit: Ignore schema checks when decomposing DTBs
With CHECK_DTBS enabled, Kbuild appends a schema validation command to
the fdtoverlay command saved in a composite DTB's .cmd file. When DTB
decomposition is requested, process_dtb() treats every word after -i as
an input file, including the semicolon and the validator arguments.
FIT generation then fails with FileNotFoundError while opening or
checking the size of those words as files.

Limit the input list to the fdtoverlay command before extracting its
arguments. This preserves the base DTB and overlay order and ignores
the subsequent schema validation command.

Fixes: 17c31aded9 ("scripts/make_fit: Support decomposing DTBs")
Assisted-by: LLM
Signed-off-by: Ting-Han Hou <ue081723@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Link: https://patch.msgid.link/CA+NtrhQBK8uW32qO3dXxVxO1GSN-0EJfyJ16tnyx0o52T17WtQ@mail.gmail.com
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-10-09 22:40:27 +02:00
Ting-Han Hou
d26ab84593
clang-tools: Import os for broken pipe handling
The BrokenPipeError handler in run-clang-tools.py calls os.open() and
os.dup2() without importing os. If this handler is reached, it raises
NameError instead of redirecting stdout and exiting with status 1.

Import os so the handler can work as intended.

Fixes: 87c7ee67de ("scripts: handle BrokenPipeError for python scripts")
Assisted-by: LLM
Signed-off-by: Ting-Han Hou <ue081723@gmail.com>
Link: https://patch.msgid.link/20261009175836.2277-1-ue081723@gmail.com
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-10-09 22:39:52 +02:00
Leizhen Zhang
a8f72a75b3
kconfig: use the value argument in sym_get_near_range_bound()
sym_get_near_range_bound() is meant to check whether the given value is
outside of the active range of an int/hex symbol, and is called with the
symbol's current value from sym_calc_value() and with the default value
from sym_get_string_default().

Since commit 9b8719973e ("kconfig: use unsigned integers for hex range
checks") it ignores its value argument and uses the current value of the
symbol (via sym_get_range_val()) instead. As a result, an out-of-range
default is no longer clamped in sym_get_string_default(), and
savedefconfig writes out values that are equal to the effective default
again, for example CONFIG_A=4 for:

  config A
  	int "a"
  	range 1 4
  	default 8

The existing savedefconfig_range test did not catch this because it only
covers symbols without a prompt.

Parse the value argument again, and add a test case for a symbol with a
prompt.

Found while fuzzing Kconfig input with ASan/UBSan.

Fixes: 9b8719973e ("kconfig: use unsigned integers for hex range checks")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Leizhen Zhang <lzsx618@gmail.com>
Tested-by: Julian Braha <julianbraha@gmail.com>
Reviewed-by: Julian Braha <julianbraha@gmail.com>
Link: https://patch.msgid.link/20261008164540.3686383-1-lzsx618@gmail.com
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-10-09 22:31:53 +02:00
Leizhen Zhang
52f26261e2
kconfig: fix infinite loop in conf_choice() when no choice value is visible
If a choice is visible but none of its choice values is, conf_choice()
counts cnt == 0 visible values and finds no default. When the choice has
to be asked, e.g. because a new symbol was added to the same menu
(oldconfig, syncconfig) or because stdin is at EOF (oldaskconfig), the
loop that maps the answer to a menu entry never finds one and the
while (1) loop repeats forever, printing "choice[1-0?]: 0" each time.

This happens in the tree for s390 when the compiler supports none of the
-march=z* options (e.g. a non-s390 host compiler), so that all values of
the "Processor type" choice are invisible:

  $ make ARCH=s390 defconfig
  $ sed -i '/^CONFIG_NR_CPUS=/d' .config
  $ make ARCH=s390 oldconfig     # hangs

Before the removal of tristate choice support, conf_choice() returned
early in this case. Do the same when there is no visible choice value.

Found by fuzzing Kconfig input with ASan/UBSan.

Fixes: fde192511b ("kconfig: remove tristate choice support")
Assisted-by: Claude:claude-opus-5-5 libFuzzer
Signed-off-by: Leizhen Zhang <lzsx618@gmail.com>
Reviewed-by: Julian Braha <julianbraha@gmail.com>
Tested-by: Julian Braha <julianbraha@gmail.com>
Link: https://patch.msgid.link/20261008164521.3684735-1-lzsx618@gmail.com
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-10-09 22:30:48 +02:00
Julian Braha
2160297cab
kconfig: cleanup stale comment about 'keys' array
'keys' was removed from 'dialog_textbox' in:
commit e14f1242a8 ("kconfig: menuconfig: simplify global jump key assignment")
but the comment referencing it was never removed.

Let's cleanup this stale comment.

Signed-off-by: Julian Braha <julianbraha@gmail.com>
Reviewed-by: Nicolas Schier <n.schier@fritz.com>
Link: https://patch.msgid.link/20261009094617.17322-1-julianbraha@gmail.com
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-10-09 22:29:34 +02:00
Nathan Chancellor
7202c08793
kconfig: Improve ergonomics around disabling warnings with cc-option
This is essentially a port of commit 550ccb178d ("Make 'cc-option'
work correctly for the -Wno-xyzzy pattern") to scripts/Kconfig.include,
which simplifies the definition of many of the newly added CC_OPT_WNO_
symbols in scripts/Kconfig.toolchain and matches cc-option's behavior in
Kbuild.

Reviewed-by: Nicolas Schier <nsc@kernel.org>
Reviewed-by: Kees Cook <kees@kernel.org>
Link: https://patch.msgid.link/20261007-scripts-kconfig-toolchain-improvements-v1-2-1e524178da11@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-10-09 22:26:56 +02:00
Nathan Chancellor
c4c24fd63a
scripts/Kconfig.toolchain: Drop compiler symbols from dependencies
Commit 454e00cf8e ("kbuild: avoid re-running compiler and linker
probes") moved many cc-option calls from the main Makefile into Kconfig.
In the process, code such as

  ifdef CONFIG_CC_IS_GCC
  KBUILD_CFLAGS += $(call cc-option,-foo)
  endif

was converted into Kconfig as

  config CC_OPT_FOO
      def_string "$(cc-option-str,-foo)" if CC_IS_GCC

The 'if CC_IS_GCC' is generally unnecessary because it does not prevent
the cc-option-str call from running (which is the primary reason the
ifdef guards exists in the Makefile), as cc-option-str and the like are
run before Kconfig even parses the dependency. It only impacts the
symbol's visibility, which does not really matter in the general case,
so remove these dependencies.

Reviewed-by: Nicolas Schier <nsc@kernel.org>
Reviewed-by: Kees Cook <kees@kernel.org>
Link: https://patch.msgid.link/20261007-scripts-kconfig-toolchain-improvements-v1-1-1e524178da11@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-10-09 22:26:56 +02:00
Ting-Han Hou
72a61a7fef
checkkconfigsymbols.py: Parse Git status output line by line
tree_is_dirty() iterates over the string returned by execute() one
character at a time. Its status check therefore examines filenames as
well as the two status columns.

An otherwise clean tree containing an untracked README is reported as
dirty because its name contains letters matched by [URMADC]. This
prevents --commit and --diff from running, whereas an untracked
notes.txt does not trigger the check.

Split the output into lines before examining the two status columns so
that filenames do not affect the dirty-tree check.

Fixes: b1a3f24348 ("checkkconfigsymbols.py: make it Git aware")
Assisted-by: LLM
Signed-off-by: Ting-Han Hou <ue081723@gmail.com>
Link: https://patch.msgid.link/CA+NtrhQqXgjT+4eg6W4P94Hc=DqdV3gQXz3EKKCxWvdWzfND6A@mail.gmail.com
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-10-07 14:22:39 +02:00
Leizhen Zhang
c8dd1aa027
gen_init_cpio: stop parsing on lines with a missing argument list
When a line in the cpio list consists of a file type followed only by
whitespace and no newline (e.g. "slink " as the last line of the file),
strtok(NULL, "\n") returns NULL. main() prints an error and sets ec, but
then carries on and passes the NULL args pointer to the type handler,
which hands it to sscanf() and crashes:

  AddressSanitizer: SEGV on unknown address 0x000000000000
    #4 __isoc99_sscanf
    #5 cpio_mkslink_line usr/gen_init_cpio.c:169

Break out of the loop as is already done for the other format error, so
that the error is reported and gen_init_cpio exits with a failure status.

Found by fuzzing gen_init_cpio built with ASan/UBSan.

Reproducer:
  printf 'slink ' > list && usr/gen_init_cpio list

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Assisted-by: Claude:claude-opus-5-5 ASan UBSan
Signed-off-by: Leizhen Zhang <lzsx618@gmail.com>
Link: https://patch.msgid.link/20261005085729.872402-1-lzsx618@gmail.com
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-10-07 12:11:14 +02:00
Gary Guo
a41ec2936d rust: doctest: generate Rust kunit test suites
For doctest, instead of generating C FFI functions, generate a Rust test
suite with `#[kunit_tests]` and `#[test]` attributes. This makes the C glue
no longer needed.

Reviewed-by: David Gow <david@davidgow.net>
Signed-off-by: Gary Guo <gary@garyguo.net>
Link: https://patch.msgid.link/20260902-kunit-v2-3-eda3ed6c00c5@garyguo.net
[ Removed generated file from `rust/.gitignore` and added it to
  `scripts/remove-stale-files`. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-10-03 14:04:56 +02:00
Gary Guo
e9a35442ef rust: kunit: use line!() inside kunit_assert!
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-03 14:04:56 +02:00
Gary Guo
3504d1bce9 rust: kunit: use file!() inside kunit_assert!
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-03 14:04:56 +02:00
Jani Nikula
26d665bef4
kbuild: add header check facility as a manually run static analyzer
There have been various attempts at adding a header test or check
mechanism in the kernel build system. The header check primarily
consists of ensuring headers are self-contained, have include guards,
and, in some cases, pass kernel-doc.

The main problems have been:

- The dependency tracking creates undesirable artefacts (infamously also
  known as disgusting turds) in the build directory.

- Gating the feature behind a kconfig option is complicated due to
  allyesconfig builds. It's possible, but requires a verbose and
  confusing negative proxy config option.

- Naming the dependency tracking files with a dot prefix or placing them
  in a dot prefixed subdirectory in the build directory to hide them has
  been exceedingly difficult to achieve. (In part due to some Makefiles
  building files in subdirectory hierarchies.)

- The debate which headers, if any, should really be self-contained is
  virtually open-ended.

Approach the problem from a slightly different angle. Add a top level
"headercheck" static analysis target which you have to explicitly run,
and where you have to explicitly state which headers to check:

$ make HEADER_CHECK="(headers|dirs)" headercheck

For example:

$ make HEADER_CHECK="include/drm drivers/gpu/drm/drm_draw_internal.h" headercheck

You can specify multiple path/to/header.h or path/to/dir, relative to
$(srctree), where path/to/dir is recursively scanned for any .h files.

Add a generic %.header-check rule in scripts/Makefile.build to support
this. Note that this rule should *not* be used in, say, driver or
subsystem makefile targets, precisely because of the problems listed
above.

While this still generates the .header-check dependency tracking
artefacts in the build directory, you will only get them as a result of
manually running 'make headercheck', not as part of the regular build.

This approach also allows anyone to check any headers in the tree, with
no makefile modification or kconfig changes required. What you do with
the results is up to you, and the header check facility does not enforce
anything like it would as part of the regular build.

Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nicolas Schier <nsc@kernel.org>
Cc: Jason Gunthorpe <jgg@nvidia.com>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: linux-kbuild@vger.kernel.org
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://patch.msgid.link/20260915104331.255636-1-jani.nikula@intel.com
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-10-02 22:21:40 +02:00
Guillaume Tucker
69cb84e259
scripts: add TOML config to container tool
Add support for a TOML configuration file to the scripts/container
tool.  This improves user experience by not having to keep passing the
same command line options all the time or overly relying on built-in
default values.  Include the concept of 'profiles' with different
named sections in the file to cover various use cases.

Command line options take precedence over the config file, and values
defined in profile sections take precedence over the default one.

Add a -c option to override the location of the .container.toml config
file which should otherwise be located in the current working
directory.  If not found, the file is silently ignored as it is not
strictly required unless the -c option is used.

Add a -p option to choose a particular profile section in the config
file rather than the default.

Signed-off-by: Guillaume Tucker <gtucker@gtucker.io>
Acked-by: Nicolas Schier <n.schier@fritz.com>
Link: https://patch.msgid.link/68b14a76a4cb2e6437c869bab948983a98acffbd.1788779245.git.gtucker@gtucker.io
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-10-02 22:17:21 +02:00
Gary Guo
c82c75ae11 rust: doctest: trim function name for reproducibility
Currently rustdoc will generate function names like
"_doctest_main__home_gary_Projects_linux_rust_kernel_io_rs_824_0" for a
doctest located at rust/kernel/io.rs:824, when building with separate
outdir using `O=`. This creates overlong symbol names and is also not
reproducible.

[ `rustdoc` already remaps these paths when we use Rust >= 1.95, thus
  this fix is needed for older toolchains. - Miguel ]

Fix it by doing a custom remapping to trim it to something like
`_doctest_main_rust_kernel_io_rs_824_0`.

Signed-off-by: Gary Guo <gary@garyguo.net>
Link: https://patch.msgid.link/20260924005052.2805129-1-gary@kernel.org
[ Added `TODO` comment about the minimum version bump. Reworded title
  and comment for typos. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-09-30 16:56:31 +02:00
Nicolas Schier
34f3b44760
kconfig: tests: {old,save}defconfig: Forward dynamic keyword arguments
Let kconfig test framework forward dynamic keyword arguments for
'olddefconfig' and 'savedefconfig' and update the _run_conf() calls in
warn_changed_input to use the corrsponding wrappers instead.

The warn_changed_input test needed to use _run_conf() as the
{old,save}defconfig wrapper did not provide the necessary flexibility
for common calls.  With dynamic keyword arguments, there is no need to
use the framework-internal _run_conf() any more.

Reviewed-by: Julian Braha <julianbraha@gmail.com>
Signed-off-by: Nicolas Schier <n.schier@fritz.com>
Link: https://patch.msgid.link/20260929-kconfig-tests-minor-updates-v2-4-c5902bee1d0c@fritz.com
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-30 15:45:29 +02:00
Nicolas Schier
ecc9c2b15a
kconfig: tests: warn_changed_input: Simplify by reusing the extra env
Define the extra environment once and re-use it for the respective
_run_conf() calls to increase readability.

Reviewed-by: Julian Braha <julianbraha@gmail.com>
Signed-off-by: Nicolas Schier <n.schier@fritz.com>
Link: https://patch.msgid.link/20260929-kconfig-tests-minor-updates-v2-3-c5902bee1d0c@fritz.com
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-30 15:45:28 +02:00
Nicolas Schier
09bd92ba15
kconfig: tests: Provide defconfig outfile for savedefconfig
Let kconfig test framework's 'savedefconfig' forward the requested
output 'defconfig' filename to 'conf'.

The original implementation was calling 'conf' with '--savedefconfig'
but missed the mandatory filename for the defconfig output file.

While at it, honour the 'dot_config' argument which points to the input
config file.

Fixes: 022a4bf6b5 ("kconfig: tests: add framework for Kconfig unit testing")
Reviewed-by: Julian Braha <julianbraha@gmail.com>
Signed-off-by: Nicolas Schier <n.schier@fritz.com>
Link: https://patch.msgid.link/20260929-kconfig-tests-minor-updates-v2-2-c5902bee1d0c@fritz.com
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-30 15:45:28 +02:00
Nicolas Schier
8688f0b29d
kconfig: tests: Reset all KCONFIG_* env variables by default
Reset all environment variables with names starting with 'KCONFIG_' from
the user-provided environment.

This fixes the 'warn_changed_input' test on systems with
KCONFIG_WARN_CHANGED_INPUT=1 and ensures a cleaner test environment.

Fixes: 645323a7f4 ("kconfig: add optional warnings for changed input values")
Signed-off-by: Nicolas Schier <n.schier@fritz.com>
Reviewed-by: Julian Braha <julianbraha@gmail.com>
Link: https://patch.msgid.link/20260929-kconfig-tests-minor-updates-v2-1-c5902bee1d0c@fritz.com
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-30 15:45:28 +02:00
Nicolas Schier
33bef82263
kbuild: Move gen_init_cpio and gen_initramfs.sh to scripts/
gen_init_cpio and gen_initramfs.sh are part of kbuild and required for
all kernel builds w/ CONFIG_BLK_DEV_INITRD.  Move both to scripts/ to be
more clear about their importance.

Link: https://lore.kernel.org/all/aSdrCFkUQup3qb-q@derry.ads.avm.de/
Reviewed-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Nicolas Schier <nsc@kernel.org>
Link: https://patch.msgid.link/20260928-move-gen_init_cpio-to-scripts-v4-2-f437a33c40ac@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-29 22:40:23 +02:00
Lorenzo Stoakes (ARM)
48ebe1cbbe
kbuild: compress the kernel with pigz if available
The gzip step of a kernel build is very lengthy, especially for larger
builds such as allmodconfig.

gzip itself cannot be run in parallel, however an alternative tool exists
that can, providing the same feature set as gzip itself - pigz - which
works as a drop-in replacement.

On a 128-core Threadripper, gzip -9 of a 36 MiB x86-64 vmlinux.bin takes
1.6s, and with pigz it takes 0.09s, so the performance increase is
significant.

Therefore introduce the KPGZIP build variable which specifies the
compressor to use for the kernel image and default it to pigz if available,
or KGZIP otherwise (which itself defaults to gzip).

Modules, packaging and the embedded kernel configuration (CONFIG_IKCONFIG)
continue to use KGZIP which defaults to a single-threaded gzip instance.

Module compression is run in parallel by make, so pigz offers no benefit
there, packaging sits outside the build and the embedded configuration is
too small to matter.

pigz is executed using scripts/jobserver-exec, which reserves the job slots
make has free - necessary, as otherwise pigz would just grab unbounded
CPUs.

The kernel image compression step is always performed at the end of the
build so should typically have all job slots available.

pigz always provides byte-for-byte identical output across runs regardless
of thread count, but pigz and gzip are not guaranteed to generate the same
binary output, so reproducible builds must use the same tools consistently.

Also update Documentation/kbuild/kbuild.rst to describe KPGZIP and
Documentation/process/changes.rst to list the optional pigz dependency.

While there, add entries for the other compressor programs.

Finally, update scripts/ver_linux to include the pigz version there.

Every x86 build ends with the compression of vmlinux.bin, 36MB for
defconfig and over 200MB for allmodconfig, no-op builds are unchanged.

Whole build, 128-thread Threadripper 9980X, best of N runs:

                                         before   after     delta
                                         -------------------------------
  x86 defconfig, touch mm/vma.c, gcc        7.7s     6.0s     -1.7s (-22%)
  x86 defconfig, touch mm/vma.c, clang      6.9s     5.4s     -1.5s (-21%)
  x86 defconfig, clean, gcc                28.2s    26.3s     -1.8s (-6%)
  x86 defconfig, clean, clang              28.7s    27.2s     -1.5s (-5%)
  x86 allmodconfig, touch mm/vma.c, gcc    23.7s    15.4s     -8.3s (-35%)
  x86 allmodconfig, touch mm/vma.c, clang  22.5s    15.6s     -7.0s (-31%)
  x86 allmodconfig, clean, gcc            294.1s   278.6s     -15.5s (-5%)
  x86 allmodconfig, clean, clang          283.9s   266.8s     -17.1s (-6%)

Suggested-by: Kees Cook <kees@kernel.org>
Link: https://zlib.net/pigz/
Assisted-by: LLM
Reviewed-by: Manuel Ebner <manuelebnerli@mailbox.org>
Reviewed-by: Kees Cook <kees@kernel.org>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Link: https://patch.msgid.link/20260923-build-speedup-v4-22-73128809a4a4@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-26 00:16:36 +01:00
Lorenzo Stoakes (ARM)
454e00cf8e
kbuild: avoid re-running compiler and linker probes
Each kernel make invocation begins with ~30 compiler and linker runs each
of which performs duplicate probe for a number of compiler and linker
options.

This is useless work - the compiler and its version is known, so use these
to determine which options are available, once.

Using the newly introduced cc-option-str, track the result of each probe in
CC_OPT_*, LD_OPT_* variables and have Makefile's simply append the symbol.

Some care has to be taken around negative options, i.e. -Wno-xxx, as gcc
accepts an unknown -Wno- without complaint and only complains later, so
instead probe the positive form for these cases.

Use CC_HAS_* For those probes that gate a Makefile conditional rather than
a simple option, as per the established pattern for this.

This change avoids a subtle issue with ppc32 (big endian) - clang doesn't
accept -fno-stack-clash-protection on this sub-target, so keep this option
in the Makefile.

With gcc and clang, defconfig and allmodconfig, the recorded command
lines are unchanged, a build with nothing to do rebuilds nothing and W=1
continues to function correctly.

Doing this improves all builds, but has a particularly positive impact on
no-op builds (builds where nothing has changed).

Whole build, 128-thread Threadripper 9980X, best of N runs:

                                         before   after     delta
                                         -------------------------------
  x86 defconfig, no-op make, gcc           0.78s    0.60s    -0.18s (-23%)
  x86 defconfig, no-op make, clang         0.94s    0.66s    -0.28s (-30%)
  x86 defconfig, touch mm/vma.c, gcc        8.6s     8.5s    -0.16s (-2%)
  x86 defconfig, touch mm/vma.c, clang      8.0s     7.7s    -0.24s (-3%)
  x86 defconfig, clean, clang              29.8s    29.4s    -0.37s (-1%)
  x86 allmodconfig, no-op make, gcc        12.9s    12.7s    -0.23s (-2%)
  x86 allmodconfig, no-op make, clang      14.2s    13.9s    -0.29s (-2%)
  x86 allmodconfig, touch mm/vma.c, clang  32.2s    31.9s    -0.30s (-1%)

Assisted-by: LLM
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Link: https://patch.msgid.link/20260923-build-speedup-v4-12-73128809a4a4@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-26 00:16:36 +01:00
Lorenzo Stoakes (ARM)
f85147b291
kbuild: move the toolchain checks into scripts/Kconfig.toolchain
init/Kconfig opens with two hundred lines identifying the compiler,
assembler, linker and rustc and probing which options they support, none of
it to do with init.

Move them into their own file, sourced from the top of init/Kconfig, so
that the next commit can add to them without growing init/Kconfig further.

Also update MAINTAINERS to put the new file in the KCONFIG entry.

No functional change intended.

Assisted-by: LLM
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Link: https://patch.msgid.link/20260923-build-speedup-v4-11-73128809a4a4@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-26 00:16:36 +01:00
Lorenzo Stoakes (ARM)
531980b4b1
kallsyms: reimplement mksysmap in C
mksysmap is a sed script consisting of 30 patterns which link-vmlinux.sh
uses to generate *.syms files, and which kallsyms is then called against to
generate *.kallsyms files, with the final vmlinux build ultimately
generating System.map.

For an x86-64 allmodconfig build, this involves three nm runs over a 250
MiB file and half a million lines written and read each time - 0.5s per
pass for llvm-nm, and 0.2s for GNU nm, with parsing on top of that.

This is unnecessary, instead have kallsyms simply read the ELF file
directly making use of the existing elf-parse library in scripts/.

This changes kallsyms such that its input is no longer the output from nm,
but rather an ELF file.

However, if the input file is empty, it outputs an empty table, which
retains the same behaviour on first pass that the build system expects.

System.map is byte-identical to nm | mksysmap for GNU nm and llvm-nm on
two x86 configurations each, and for llvm-nm on arm64, arm, s390 and
loongarch defconfigs, so are the kallsyms tables of every pass.

Relinking vmlinux, link steps included:

                        before    after
  allmodconfig clang     9.1s     7.9s
  allmodconfig gcc       7.8s     7.6s
  defconfig clang        3.7s     3.0s
  defconfig gcc          3.5s     3.4s

Whole build, 128-thread Threadripper 9980X, best of N runs:

                                         before   after     delta
                                         -------------------------------
  x86 defconfig, touch mm/vma.c, gcc        9.1s     8.6s    -0.43s (-5%)
  x86 defconfig, touch mm/vma.c, clang      9.0s     8.0s     -1.1s (-12%)
  x86 defconfig, clean, gcc                29.5s    28.9s    -0.64s (-2%)
  x86 defconfig, clean, clang              31.2s    29.8s     -1.4s (-5%)
  x86 allmodconfig, touch mm/vma.c, gcc    35.8s    35.0s    -0.77s (-2%)
  x86 allmodconfig, touch mm/vma.c, clang  35.8s    33.7s     -2.0s (-6%)

Assisted-by: LLM
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Link: https://patch.msgid.link/20260923-build-speedup-v4-8-73128809a4a4@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-26 00:16:35 +01:00
Lorenzo Stoakes (ARM)
5005f8043c
elf-parse: add section flags, symbol binding and mapping helpers
Extend elf-parse to be able to read the symbol table of vmlinux in
kallsyms.

This requires the ability to open ELF files in read-only mode, so provide
elf_map_ro() to do so.

It also requires accessors for section flags and symbol bindings, so
provide these via shdr_flags() and sym_bind().

It's useful to be able to open an ELF file, map it, and then have easy
access to its section headers, names and symbol table, so introduce struct
elf_file to store this.

In order to obtain this data also provide elf_open_ro() and elf_close().

Also, check for the file being an ELF file first in elf_parse(). This is
the logical thing to check for first, but additionally prevents kallsyms
from having to check this it self.

Assisted-by: LLM
Reviewed-by: Kees Cook <kees@kernel.org>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Link: https://patch.msgid.link/20260923-build-speedup-v4-7-73128809a4a4@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-26 00:16:35 +01:00
Lorenzo Stoakes (ARM)
8050568e0a
kbuild: only emit vmlinux relocations when required
A kernel build consists of more than one linking pass on vmlinux.o and
vmlinux, at minimum two, and with CONFIG_KALLSYMS and BTF enabled on x86-64
for example there are 5 such stages.

For architectures that build their own relocation tables (x86, riscv, mips,
s390), vmlinux is linked with the --emit-relocs parameter specified.

However, this is only required on the final vmlinux link.

Symbol tables of trial links preceding it don't need it because they
already check that System.map matches kallsyms symbols on each build.

GNU ld is slow at emitting relocation tables, so this results in a
reduction in build time.

Whole build, 128-thread Threadripper 9980X, best of N runs:

                                         before   after     delta
                                         -------------------------------
  x86 defconfig, touch mm/vma.c, gcc        9.5s     9.1s    -0.42s (-4%)
  x86 defconfig, clean, gcc                30.1s    29.5s    -0.59s (-2%)
  x86 allmodconfig, touch mm/vma.c, gcc    37.2s    35.8s     -1.4s (-4%)

Note that this has little impact on LLVM ld which performs this operation
more efficiently.

Assisted-by: LLM
Reviewed-by: Nicolas Schier <n.schier@fritz.com>
Reviewed-by: Kees Cook <kees@kernel.org>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Link: https://patch.msgid.link/20260923-build-speedup-v4-6-73128809a4a4@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-26 00:16:35 +01:00
Lorenzo Stoakes (ARM)
c2970d8b52
kbuild: do not sort nm output where the order is irrelevant
Unless instructed otherwise, nm sorts by name.

There are places where this is unnecessary - an invocation from
scripts/sorttable every vmlinux link, scripts/check-function-names.sh run
after every vmlinux.o link, and the x86 VOFFSET and ZOFFSET listings
between vmlinux and bzImage.

Both GNU nm and llvm-nm accept the same '-p' parameter to disable sorting
in these instances, so use that to prevent this unnecessary work.

Each nm run on its own, x86-64, median of 5:

                             GNU nm 2.47              llvm-nm 22
                          before  after   delta    before  after   delta
  defconfig
  sorttable, nm -S vmlinux 0.080s 0.039s -0.041s   0.265s 0.113s -0.152s
  check-function-names.sh  0.072s 0.033s -0.039s   0.244s 0.102s -0.142s
  VOFFSET                  0.077s 0.034s -0.043s   0.261s 0.113s -0.148s
  ZOFFSET                  0.007s 0.005s -0.002s   0.005s 0.005s  0.000s
  TOTAL                                  -0.125s                 -0.442s

  allmodconfig
  sorttable, nm -S vmlinux 0.156s 0.063s -0.093s   0.539s 0.223s -0.316s
  check-function-names.sh  0.149s 0.054s -0.095s   0.537s 0.217s -0.320s
  VOFFSET                  0.146s 0.052s -0.094s   0.524s 0.221s -0.303s
  ZOFFSET                  0.007s 0.005s -0.002s   0.006s 0.004s -0.002s
  TOTAL                                  -0.284s                 -0.941s

llvm-nm appears to be a lot slower than GNU nm, so these builds naturally
improve the most.

The four run one after another in the serial tail of every build that links
vmlinux so impact kernel builds directly.

In an allmodconfig the decompressor is built in parallel while the modules,
so only the two before the vmlinux link contribute to build time.

The build outputs remain unchanged.

Whole build, 128-thread Threadripper 9980X, best of N runs:

                                          before    after     delta
                                        ---------------------------------
  x86 defconfig, touch mm/vma.c, gcc        9.7s     9.5s    -0.18s (-2%)
  x86 defconfig, touch mm/vma.c, clang      9.3s     9.0s    -0.27s (-3%)
  x86 defconfig, clean, gcc                30.3s    30.1s    -0.16s (-1%)
  x86 defconfig, clean, clang              31.7s    31.2s    -0.55s (-2%)
  x86 allmodconfig, touch mm/vma.c, clang  36.4s    35.8s    -0.67s (-2%)

Assisted-by: LLM
Reviewed-by: Nicolas Schier <n.schier@fritz.com>
Reviewed-by: Kees Cook <kees@kernel.org>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Link: https://patch.msgid.link/20260923-build-speedup-v4-5-73128809a4a4@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-26 00:16:34 +01:00
Lorenzo Stoakes (ARM)
4719513c0f
sorttable: parse nm output correctly
sorttable reads a list of functions from vmlinux, provided by the output of
nm, with the -S flag specified providing function sizes.

It does so using fscanf(fp, "%16s %16s %c %*s\n", ...) reading address,
size, type (a single character) and name.

However, nm outputs no size for a symbol which has none, meaning that it
misinterprets these entries - interpreting the type character as the size,
and, if the name is a single character, ignores the newline and swallows
the address of the next entry.

Size-less single character names exist (e.g. the assemblers' loop counters
left over as local absolute symbols):

      0000000000000001 a i
      000000000000000f a i
      0000000000000050 a j
      0000000000000052 a t
      000000000000009f a i
      0000000000000200 a i

sorttable is looking for functions and these are not that, and with nm's
output sorted, it just so happens to be that what's swallowed is never a
function.

However the next commit in this series stops sorting nm's output, so this
bug can results in function names being lost.

Fix the issue by using '%*[^\n]' in fscanf() rather than '%*s' such that
the scan cannot move past the newline.

Then, compare the address and size fields (which are always padded to the
same width if output by nm) - if they differ, then this is a misread, so
simply discard the entry.

It's fine to discard these, as sorttable's raison d'être is to discover
whether a call site is contained within a function and an empty function
can't contain anything.

Assisted-by: LLM
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Link: https://patch.msgid.link/20260923-build-speedup-v4-4-73128809a4a4@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-26 00:16:34 +01:00
Lorenzo Stoakes (ARM)
83da9f3197
kallsyms: output binary data to speed output and kallsyms assembly
kallsyms generates an assembly file that consists mostly of .byte entries
containing compressed names, token strings and name-sorted sequence
numbers.

For an x86-64 build with 158k symbols that is a 37 MiB .S file which takes
0.57s to assemble each of the two to three times it is built over a kernel
build.

Each time it is generated it also takes kallsyms a similar amount of time
to output it.

Avoid this overhead by instead outputting this data as binary and importing
it into the assembly using the .incbin directive.

Tables that are wider than a byte remain part of the assembly to ensure
endianness and relative relocations are performed correctly.

With this change, the output assembly file shrinks from 37 MiB to 9.8 MiB,
with a 2.6 MiB binary data file alongside it, and the object remains
identical.

The generated binary file is deleted correctly on build clean along with
all other ephemeral data.

On an x86-64 system with CONFIG_KALLSYMS_ALL set:

                       before   after    delta
  scripts/kallsyms     0.24s    0.18s    0.06s
  assemble             0.57s    0.16s    0.41s

Per kallsyms invocation/assembly, for a total of 0.47s time saving upon
invocation.

An incremental build on the same system was reduced from 11.15s to 9.65s,
indicating a total of 1.5 seconds saved over the build.

The kallsyms runs and their assembly are on the serial tail of every build
that links vmlinux, no-op builds are unchanged.

Whole build, 128-thread Threadripper 9980X, best of N runs:

                                         before   after     delta
                                         -------------------------------
  x86 defconfig, touch mm/vma.c, gcc       10.6s     9.7s    -0.89s (-8%)
  x86 defconfig, touch mm/vma.c, clang     10.5s     9.3s     -1.2s (-11%)
  x86 defconfig, clean, gcc                31.3s    30.3s     -1.0s (-3%)
  x86 defconfig, clean, clang              33.3s    31.7s     -1.6s (-5%)
  x86 allmodconfig, touch mm/vma.c, gcc    38.7s    37.2s     -1.4s (-4%)
  x86 allmodconfig, touch mm/vma.c, clang  39.1s    36.4s     -2.6s (-7%)

Assisted-by: LLM
Reviewed-by: Kees Cook <kees@kernel.org>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Link: https://patch.msgid.link/20260923-build-speedup-v4-3-73128809a4a4@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-26 00:16:34 +01:00
Lorenzo Stoakes (ARM)
6f014bf46f
kallsyms: index symbols by token to speed up table compression
The kallsyms program compresses symbols by figuring out the most commonly
used substrings in all of the input symbols then uses special character
codes to represent them.

For instance, 0xf7 might end up representing "write_", then every single
symbol that contains "write_" can use 0xf7 as a shorthand and save 5 bytes
each time.

'Special' character codes are any byte value that is not used in any
symbol, either due to being an invalid character, or not being present in
any symbol (e.g. if no symbol contains 'z', then 'z' can be used as special
character).

It does this by first figuring out which special characters are available
in insert_real_symbols_in_table(), then iterating through every available
special character, counting how many times each pair of adjacent characters
appear in symbols in build_initial_token_table().

These adjacent pairs are known as 'tokens'.

Token counts are initially obtained by build_initial_token_table(), then
optimize_result() calls find_best_token() to determine the token that
appeared the most number of times and assigns it the next special
character.

Finally, optimize_result() calls compress_symbols() to replace every token
in every symbol with its special character, which updates token_profit[] as
it does so.

This process is repeated for each remaining available special character,
with tokens now perhaps containing previously assigned special
characters (e.g. if 'wr' was assigned 0x80, then the token representing
'wri' would be '\x80i').

This compresses that token by 50% in each symbol it appears in (two bytes
are now represented by one) and thus by repeatedly doing this kallsyms
obtains good symbol compression.

However, compress_symbols() is seriously inefficient - it iterates through
EVERY symbol for EVERY special character assignment, i.e. ~256 *
nr_symbols.

Modern x86-64 kernels, for instance, have ~158,000 symbols, so millions of
iterations are performed, most of which are entirely unnecessary (tokens
don't appear in most symbols).

In practice kallsyms spends half its runtime doing this, two or three times
per vmlinux link step.

Fix this by tracking which symbols each token appears in token_syms[], and
only compress symbols which actually need to be updated.

Each time a token is compressed that token can no longer appear in any
symbol, so that token_syms[] entry can be freed.

However new token_syms[] entries must be created for each new token
containing the assigned special character, but this is bounded by the
number of replacements in the symbol which is very small.

In testing on an x86-64 platform using clang, each kallsyms invocation
dropped from 0.59s to 0.33s with CONFIG_KALLSYMS_ALL set and from 0.38s to
0.22s without it set.

The data was carefully checked and verified to be byte-for-byte identical
for six symbol sets (two vmlinux passes, vmlinux.o, three userspace
binaries) with all option combinations.

As part of this change, additionally refactor the code to be a little
easier to follow.

kallsyms runs two or three times on the serial tail of every build that
links vmlinux, no-op builds do not link and are unchanged.

Whole build, 128-thread Threadripper 9980X, best of N runs:

                                         before   after     delta
                                         -------------------------------
  x86 defconfig, touch mm/vma.c, gcc       11.1s    10.6s    -0.53s (-5%)
  x86 defconfig, touch mm/vma.c, clang     11.1s    10.5s    -0.64s (-6%)
  x86 defconfig, clean, gcc                32.3s    31.3s     -1.0s (-3%)
  x86 defconfig, clean, clang              34.2s    33.3s    -0.89s (-3%)
  x86 allmodconfig, touch mm/vma.c, gcc    39.7s    38.7s     -1.0s (-3%)
  x86 allmodconfig, touch mm/vma.c, clang  40.3s    39.1s     -1.3s (-3%)

Assisted-by: LLM
Reviewed-by: Kees Cook <kees@kernel.org>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Link: https://patch.msgid.link/20260923-build-speedup-v4-2-73128809a4a4@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-26 00:16:33 +01:00
Lorenzo Stoakes (ARM)
5fe4dd5966
kbuild: do not allocate .modinfo in vmlinux
Commit 3e86e4d74c ("kbuild: keep .modinfo section in vmlinux.unstripped")
placed MODULE_INFO() strings in the .modinfo section in vmlinux.unstripped,
however it left the section allocatable, so it gets assigned an address and
on arm64, arm and riscv, the section is tagged as PT_LOAD.

This is useless as the data is ultimately stripped anyway.

Doing this results in a lot of unnecessary work - each pass copies the
whole file, 450 MiB with relocations for an x86 allmodconfig build and 250
MiB for an arm64 allmodconfig build.

This adds ~0.7s on the serial tail of every build for arm64 and ~0.2s for
x86 (the tail is single-threaded work done after parallel work has
finished).

Nothing requires .modinfo to exist at an address, so mark the output
section (INFO) so that it's not allocated and use --dump-section to extract
it as -O only emits allocated sections.

The dump doesn't pick up the arch's OBJCOPYFLAGS any longer as they should
not impact the output of this section.

Image, bzImage, System.map and modules.builtin.modinfo are unchanged and
the stripped vmlinux differs only in its program headers.

The objcopy passes are on the serial tail of every build that links
vmlinux, no-op builds are unchanged.

Whole build, 128-thread Threadripper 9980X, best of N runs:

                                         before   after     delta
                                         -------------------------------
  x86 defconfig, touch mm/vma.c, gcc       11.2s    11.1s    -0.15s (-1%)
  x86 defconfig, touch mm/vma.c, clang     11.3s    11.1s    -0.19s (-2%)
  x86 defconfig, clean, gcc                32.5s    32.3s    -0.16s (-1%)
  x86 defconfig, clean, clang              34.5s    34.2s    -0.26s (-1%)
  x86 allmodconfig, touch mm/vma.c, gcc    40.1s    39.7s    -0.44s (-1%)

Assisted-by: LLM
Reviewed-by: Kees Cook <kees@kernel.org>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Reviewed-by: Nicolas Schier <n.schier@fritz.com>
Link: https://patch.msgid.link/20260923-build-speedup-v4-1-73128809a4a4@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-26 00:16:33 +01:00
Kees Cook
cfcc465018
kconfig: Add "ld-option-str"
Add the linker counterpart to $(cc-option-str), sharing a $(ld-probe)
with $(ld-option) the way the compiler macros share $(cc-probe). Like
$(cc-option-str), it can now be used as:

	config LD_OPT_FOO
		def_string "$(ld-option-str,--new-option,--old-option)"

An omitted fallback expands to the empty string.

Build tested ARCH=x86_64 defconfig with GCC 16.2.0, and checked against
GNU ld 2.47.

Assisted-by: LLM
Signed-off-by: Kees Cook <kees@kernel.org>
Tested-by: Julian Braha <julianbraha@gmail.com>
Reviewed-by: Julian Braha <julianbraha@gmail.com>
Link: https://patch.msgid.link/20260919005929.4077729-3-kees@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-24 11:37:05 -04:00
Kees Cook
889a621272
kconfig: Replace "cc-option-bit" with "cc-option-str"
$(cc-option-bit) returns the flag it was given when the compiler accepts
it, and an empty string otherwise. It was originally only used
internally for machine bit flags, but it is generally useful[1].

Rename it to $(cc-option-str), which says what it returns rather than
what it was first used for, and extract the probe logic from the existing
$(cc-option) macro to reuse it. Additionally add support for an optional
fallback, much like the Kbuild cc-option macro. This can be used as:

	config CC_OPT_FOO
		def_string "$(cc-option-str,-fnew-option,-fold-option)"

If the fallback is omitted, it is just an empty string.

Build tested ARCH=x86_64 defconfig with GCC 16.2.0.

Assisted-by: LLM
Signed-off-by: Kees Cook <kees@kernel.org>
Tested-by: Julian Braha <julianbraha@gmail.com>
Reviewed-by: Julian Braha <julianbraha@gmail.com>
Link: https://patch.msgid.link/20260919005929.4077729-2-kees@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-24 11:37:05 -04:00
Kees Cook
651fb291c4
kconfig: Add "def_string", "def_int" and "def_hex"
Kconfig has offered "def_bool" and "def_tristate" as a shorthand for a
type definition plus a default since before the git era, but has never
offered the equivalent for the other three types. Conor Dooley ran into
this gap[1] when fixing a symbol that had been given the wrong type:

  Unfortunately, there is no such thing as "def_string", but in this
  case we can use "default" to propagate the value of ...

Nothing in the grammar requires the restriction. The rule that consumes
a default is already type agnostic. Add the three missing types. No
changes are needed to existing diagnostics. E.g. declaring a symbol
"bool" and then assigning it with "def_string" still reports

  warning: ignoring type redefinition of 'CONFLICT' from 'bool' to 'string'

Added tests for the types.

Build tested ARCH=x86_64 with GCC 16.2.0. Tests pass with "make testconfig".

Link: https://lore.kernel.org/all/20230111104848.2088516-1-conor.dooley@microchip.com/ [1]
Assisted-by: LLM
Signed-off-by: Kees Cook <kees@kernel.org>
Tested-by: Julian Braha <julianbraha@gmail.com>
Reviewed-by: Julian Braha <julianbraha@gmail.com>
Link: https://patch.msgid.link/20260919005929.4077729-1-kees@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-24 11:37:05 -04:00
Dmitrii Tulnov
9f01cd3a32
kconfig: warn about malformed KCONFIG_PROBABILITY values
randconfig checks the numeric range of each probability but does not
validate where strtol() stops. For example, KCONFIG_PROBABILITY=50% is
accepted as 50:0:0: the '%' is parsed repeatedly as zero. For the
documented value 50, tristate y/m/n probabilities are 25%/25%/50%.
With 50%, both y/m probabilities silently become zero, reducing the
coverage of random configuration builds. Empty fields and extra fields
are also accepted.

Warn when the value does not follow the documented decimal format. For
malformed inputs whose parsed probabilities are in range, preserve the
existing interpretation unless KCONFIG_WERROR is set. In that case, exit
with an error before writing the configuration. Leading whitespace and
signs are accepted by strtol(), but also trigger the warning because they
are outside the documented format.

Keep the strtol() result as long until the range check. This rejects
out-of-range values that narrowing to int previously made valid, such as
4294967296 becoming zero on a 64-bit host, regardless of KCONFIG_WERROR.

Add regression tests for one warning per malformed input, preserved
configurations, KCONFIG_WERROR, out-of-range values, the supported
probability formats, and the documented empty-value default.

Fixes: e43956e607 ("kconfig: implement KCONFIG_PROBABILITY for randconfig")
Assisted-by: LLM
Signed-off-by: Dmitrii Tulnov <tulnov.dl@gmail.com>
Tested-by: Julian Braha <julianbraha@gmail.com>
Reviewed-by: Julian Braha <julianbraha@gmail.com>
Link: https://patch.msgid.link/20260918213430.3-1-tulnov.dl@gmail.com
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-24 11:30:42 -04:00
Aneesh Kumar K.V (Arm)
fe7f2a8054 firmware: smccc: Add an Arm SMCCC bus
SMCCC-discovered firmware services are currently represented by separate
platform devices, such as smccc_trng and arm-cca-dev. Those devices do not
represent independent DT/ACPI-described platform resources; they are
features of the SMCCC firmware interface.

Add an Arm SMCCC bus for services discovered through the SMCCC firmware
interface. The bus provides SMCCC device and driver registration
helpers, function ID based matching, modalias generation, and a sysfs
modalias attribute so SMCCC service drivers can bind to discovered
firmware services and autoload as modules.

Follow-up changes can then register SMCCC firmware services as arm-smccc
devices instead of creating independent per-feature platform devices.

Based on arm_ffa code

Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Sudeep Holla <sudeep.holla@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Lorenzo Pieralisi <lpieralisi@kernel.org>
Cc: Sudeep Holla <sudeep.holla@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nicolas Schier <nsc@kernel.org>
Signed-off-by: Aneesh Kumar K.V (Arm) <aneesh.kumar@kernel.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2026-09-24 11:36:22 +01:00
Linus Torvalds
fe2ec83746 hid-for-linus-2026092202
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEL65usyKPHcrRDEicpmLzj2vtYEkFAmqyY7EACgkQpmLzj2vt
 YEnprxAAofmpQUorlic97WALU2CamXN/hdzLGlra2RPW6eJyxQUlwqR8xcUptx3e
 14OM5X4WDHfFD1lRFx7/flzn2J5h5CLXUWnNUp5DR7W0GLQSnSwOiuawfb5/Enkd
 aqhgsqC2nfEjxQ3iqdsY1MTASN/MEjolNU66tP31DQH5D+CGY6eZtivNwFHaHjJI
 Ps4/vr2nuddSCsXaWRKwdBQ9wMr8g+F7dIeI8vqAJlWg5IdN0tu3ClAuHUqMr6X3
 zMHJ7xkkrRg7S40xeQsajDiPGRRWPkC6G3lrJ1OSFOP1IEMKT5dLLg5HB2wLwfzI
 Xzw4CJZiSIaNKyMQLQJcik8wZZbc60A2ulDscbpk9PLlr9nweBc+7wzVZ0mOQ6Lo
 rD2iYG7ROG684Jt5HVd9SPrIgjCDnlOXDBT9JLyPCw38eEysEHOdSlwA0CSJyR21
 cD0UmfIUgFDXxR/omcPbZDVng8683eRR3W/Tj2XPBOyKZYF/JtnIsrbowIN2dmGe
 PKnsrtp2LW5/xiO/lTfEsiiHL8WoxtXj/Mwoq/NuZm4TvZ/C3nd3ZiEaL5UQeYYc
 AyTFOqBe4DoLauyS2M50gitvDpSBFS9i5xrjCukalpJGfTUlX8lQjU7kdH7O5rbh
 VlMjlYqPNSyd4Yo/nveqIS3ELrKGs5z3oDSxwSB05h1nCgn3dgo=
 =k0Hr
 -----END PGP SIGNATURE-----

Merge tag 'hid-for-linus-2026092202' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid

Pull HID fixes from Jiri Kosina:

 - new device IDs/quirks (Logitech G502X, Elecom M-XT4DRBK, Steelseries
   Arctis 7, Asus Rog Z13 Folio, Lenovo Yoga Slim Gen 11)

 - fixes for various code issues found by LLMs

* tag 'hid-for-linus-2026092202' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
  selftests/hid: add unnumbered variant to the hid_bpf tests
  HID: bpf: fix __hid_bpf_hw_check_params report length
  selftests/hid: add define for commonly used buf size
  HID: amd_sfh: Validate PCI BAR size before mapping
  HID: elecom: fix bus type for M-XGL20DLBK
  HID: elecom: Add support for ELECOM M-XT4DRBK (018E)
  HID: corsair-void: Fix firmware event packet description
  HID: i2c-hid: Add i2c-hid-quirk-bad-input-size quirk for 0911:5288 device
  HID: hid-oxp: use cancel_delayed_work_sync() in remove
  HID: i2c-hid: add reset quirk for Lenovo Yoga Slim 7x Gen 11 keyboard
  HID: roccat: fix locking in roccat_connect() and roccat_disconnect()
  HID: steelseries: Add support for Arctis 7 (2018)
  HID: logitech-hidpp: Add support for G502 X Lightspeed USB mouse
  HID: fix semantic patch and improve its performance
  HID: alps: fix use-after-free on input2 registration failure
  HID: alps: unregister DualPoint Stick input device on remove
  HID: winwing: fix use-after-free in force feedback teardown
  HID: multitouch: Add report ID mismatch quirk for ASUS ROG Z13 Folio
  HID: wacom: fix OOB read in wacom_wac_pen_serial_enforce()
  HID: quirks: add ALWAYS_POLL quirk for SDINNOVATION gaming keyboard
2026-09-22 10:30:17 -07:00
Linus Torvalds
156fa7417f x86 fixes:
- Reject the loading of a potentially problematic microcode version
    on Intel Granite Rapids systems (Chang S. Bae)
 
  - On FRED, reconstruct the proper #GP context for rejected INT
    instructions, to fix a signal ABI regression (Matthew Schwartz)
 
  - Add a test for this signal ABI regression the x86
    self-test suite (Matthew Schwartz)
 
  - Don't emit the new and not yet properly supported EGPR instructions
    (%r16-%r31) on CONFIG_X86_NATIVE_CPU=y builds (Chang S. Bae)
 
 Signed-off-by: Ingo Molnar <mingo@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmqvrhgRHG1pbmdvQGtl
 cm5lbC5vcmcACgkQEnMQ0APhK1inbQ/9G4Q0h9esQ945n0uYRYvVLuj2P8DvE3XN
 9d5IJ5pIYdhJCvlv8yXyv1u3sq59QYNmUgpBMghHJonhqobtnchvBSiznoAMgi8L
 yjRlcaFBPX9qjFQV1W9WJQuUHhW/12QFy9Bo9n1uXEv6pYspYVDwodCaS+rEvkTF
 0wK3TjETv90TravGjFscYTt2VLAiy+cd/FxkUA0sBaMLjhFpUyAPHGJe/vcf8vT3
 rEXkY8EeSjv5F6eKMTDVacrSZu2c9wco1bJIsSFEcxZGFzhDbuCOGiDCkwmB3uuD
 ReKbEUC0KmF8qd4Ubf0dMGpbHT9LDu9Ggex619cHFOHMupPubP+yym7aCpm3v7Sb
 gZe6eV6VrSREJ+oBVKsqMrWXsg1YDj6uJhC/5K3S78xBeRq64kKsmBbC93Zp20TC
 QpSAxKIFqp8C+tfKzpBmcSbcipRUfATJxLjp94QaQDp467jjJCvpDJdc12mV7WR9
 0gMtFjxUaIe8BGX7s2PuWPgZ8+CIH0hZQuttxUU4QWvM2RGU+QrDaMwTeAY7wme4
 xomc0wpXQb5enrjmFu8betlD0xfjgt7k6eW0njezRpWSk3wyHDd5w/6Vfn8pA6Fx
 AQV4UuszXzQmG+W2pdIjLhnjmsjEeWMpmwgzn0rkcqujWHeh8XOSvQIjULFrFtFv
 srSbum6vEfk=
 =MP1H
 -----END PGP SIGNATURE-----

Merge tag 'x86-urgent-2026-09-20' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Ingo Molnar:

 - Reject the loading of a potentially problematic microcode version
   on Intel Granite Rapids systems (Chang S. Bae)

 - On FRED, reconstruct the proper #GP context for rejected INT
   instructions, to fix a signal ABI regression (Matthew Schwartz)

 - Add a test for this signal ABI regression the x86
   self-test suite (Matthew Schwartz)

 - Don't emit the new and not yet properly supported EGPR instructions
   (%r16-%r31) on CONFIG_X86_NATIVE_CPU=y builds (Chang S. Bae)

* tag 'x86-urgent-2026-09-20' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/build/64: Prevent native builds from generating EGPR use
  selftests/x86: Check signal state for rejected software interrupts
  x86/fred: Reconstruct the #GP context for rejected INT instructions
  x86/microcode/intel: Reject problematic loading on Granite Rapids systems
2026-09-20 09:49:10 -07:00
Chang S. Bae
63edf5a009 x86/build/64: Prevent native builds from generating EGPR use
Omar reports that CONFIG_X86_NATIVE_CPU=y allows builds to opportunistically
emit instructions using %r16-%r31 (EGPRs) when the build host supports APX
since the commit:

  ea1dcca1de ("x86/kbuild/64: Add the CONFIG_X86_NATIVE_CPU option to locally optimize the kernel with '-march=native'")

But the kernel is not yet prepared to use new registers internally. For
example, there is no context-switch support for general in-kernel use.

Explicitly disable EGPR use when building with -march=native.

For C, since GCC 14 and Clang 18, both compilers support suppressing EGPR
use with -mno-apx-features=egpr, whose availability can be detected via
cc-option.

For Rust, pass features=-apxf through the generated JSON to avoid
unstable-feature warnings, see

  https://github.com/rust-lang/rust/issues/139284

Note Rust only accepts the option to disable APX instructions entirely or not.

Support for this gating also depends on the Rust/LLVM combination. Rust
1.88 introduced the `apxf` feature option, but versions prior to 1.93 may
emit an `apxf` attribute to the backend that only LLVM 23 or later can
interpret. Restrict native Rust builds accordingly.

Fixes: ea1dcca1de ("x86/kbuild/64: Add the CONFIG_X86_NATIVE_CPU option to locally optimize the kernel with '-march=native'")
Reported-by: Omar Avelar <omar.avelar@intel.com>
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Acked-by: Miguel Ojeda <ojeda@kernel.org>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260916230003.1144622-1-chang.seok.bae@intel.com
2026-09-18 21:43:38 -07:00