summaryrefslogtreecommitdiff
path: root/scripts/kconfig
AgeCommit message (Collapse)Author
14 dayslocalmodconfig: Explicitly report boolean configs during integrity checkAaron Tomlin
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-09kconfig: use the value argument in sym_get_near_range_bound()Leizhen Zhang
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 9b8719973ee2 ("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: 9b8719973ee2 ("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-09kconfig: fix infinite loop in conf_choice() when no choice value is visibleLeizhen Zhang
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: fde192511bdb ("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-09kconfig: cleanup stale comment about 'keys' arrayJulian Braha
'keys' was removed from 'dialog_textbox' in: commit e14f1242a8be ("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-09-30kconfig: tests: {old,save}defconfig: Forward dynamic keyword argumentsNicolas Schier
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-30kconfig: tests: warn_changed_input: Simplify by reusing the extra envNicolas Schier
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-30kconfig: tests: Provide defconfig outfile for savedefconfigNicolas Schier
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: 022a4bf6b59d ("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-30kconfig: tests: Reset all KCONFIG_* env variables by defaultNicolas Schier
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: 645323a7f4e5 ("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-24kconfig: Add "def_string", "def_int" and "def_hex"Kees Cook
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-24kconfig: warn about malformed KCONFIG_PROBABILITY valuesDmitrii Tulnov
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: e43956e60769 ("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-17kconfig: Warn on dead select or imply for choice valuesNicolas Schier
Update the internal kconfig check to print a warning on 'select' and 'imply' statements that target on choice values. Julian Braha reported that kconfig's 'select' and 'imply' do not work for choice values but have no effect all. Show a warning instead of error-out to allow kconfig to check the whole kconfig rule set. Reported-by: Julian Braha <julianbraha@gmail.com> Closes: https://lore.kernel.org/linux-kbuild/20260715220149.48700-1-julianbraha@gmail.com/ # [1] Suggested-by: Kees Cook <kees@kernel.org> Suggested-by: Jani Nikula <jani.nikula@linux.intel.com> Signed-off-by: Nicolas Schier <nsc@kernel.org> Reviewed-by: Julian Braha <julianbraha@gmail.com> Tested-by: Julian Braha <julianbraha@gmail.com> Link: https://patch.msgid.link/20260804-kconfig-warn-on-dead-select-for-choice-value-v1-1-e5c9a274d291@kernel.org Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-17kconfig: use unsigned integers for hex range checksJulian Braha
While 'hex' values should use the bounds of 64-bit unsigned integers, the range values are treated as signed (checks use strtoll). For example: config HEX_RANGE hex range 0 0xfffffffffffffffe default 0xffffffffffffffff the default value should adjust down to the upper bound of 0xfffffffffffffffe, but since the check incorrectly parses both as LLONG_MAX, the value stays at the out-of-range default of 0xffffffffffffffff. To fix this, let's use a union of signed and unsigned integers to represent both 'int' and 'hex' range values, then use both strtoll and strtoull where appropriate. Assisted-by: LLM Signed-off-by: Julian Braha <julianbraha@gmail.com> Reviewed-by: Nicolas Schier <n.schier@fritz.com> Link: https://patch.msgid.link/20260915211508.291790-6-julianbraha@gmail.com Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-17kconfig: prevent out-of-bounds user input for numeric optionsJulian Braha
Currently, user input of out-of-bounds values for 'int' and 'hex' options is possible, leading to later silent failures in Kconfig if that value is used in a comparison, or a warning by GCC or error by Clang if used in the C code. Let's factor out the out-of-bounds check on constants, so that it can be reused for checking user input. The frontend will now reject an attempted user input of an out-of-bounds numeric value, similarly to how a value outside the active 'range' already does. For migration of existing configurations, a .config file with an out-of-bounds numeric value will be allowed for now, but will warn the user when read in by confdata.c Assisted-by: LLM Signed-off-by: Julian Braha <julianbraha@gmail.com> Reviewed-by: Nicolas Schier <n.schier@fritz.com> Link: https://patch.msgid.link/20260915211508.291790-5-julianbraha@gmail.com Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-17kconfig: check for hex and int mismatchesJulian Braha
Using a numeric option of one type (e.g. 'int') to determine the value of a different numeric type (e.g. 'hex') currently fails silently in various ways if attempted, because the underlying string representation is naively reused. Example 1: config I int default -1 config HEX_DEFAULT_INT hex default I Here, HEX_DEFAULT_INT actually gets set to '0x-1', which is of course not a valid hex value. Example 2: config H hex default A config INT_DEFAULT_HEX int default H Here, INT_DEFAULT_HEX actually gets set to 'A', without even converting into the base-10 equivalent of 10. This value, 'A', is otherwise a rejected int value if entered in the frontend, or read in from an existing .config file. These int-hex mismatches currently do not appear anywhere in the tree, so it is already safe to make these error out. Assisted-by: LLM Signed-off-by: Julian Braha <julianbraha@gmail.com> Reviewed-by: Nicolas Schier <n.schier@fritz.com> Link: https://patch.msgid.link/20260915211508.291790-4-julianbraha@gmail.com Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-17kconfig: check for out-of-bounds numeric constantsJulian Braha
The Kconfig interpreter internally represents constants as strings, then attempts to parse them as 64-bit signed integers for 'int' options, and 64-bit unsigned integers for 'hex' options. However, there is currently no check that the conversion succeeds, leading to failures when the values are actually used. For example: config LARGE_INT int default 10000000000000000000 config BUGGED_INT_COMPARISON bool default y if LARGE_INT < 2 Obviously 10000000000000000000 is larger than 2, but the Kconfig interpreter will fallback to comparing the two values with strcmp() after the numeric conversion fails, causing the first character, '1', to be compared with '2', and giving the wrong result. Since none of these out-of-bounds values are used as constants anywhere in the tree, we can already make these error out. Assisted-by: LLM Signed-off-by: Julian Braha <julianbraha@gmail.com> Reviewed-by: Nicolas Schier <n.schier@fritz.com> Link: https://patch.msgid.link/20260915211508.291790-3-julianbraha@gmail.com Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-17kconfig: promote invalid numeric reference from warning to errorJulian Braha
The Kconfig interpreter already warns if a numeric option attempts to use a non-numeric option (bool, tristate, or string) to set its value (for example, with a 'default' or 'range'). Since there is nowhere in the tree that attempts this, we can safely promote this check from warning to error. Assisted-by: LLM Signed-off-by: Julian Braha <julianbraha@gmail.com> Reviewed-by: Nicolas Schier <n.schier@fritz.com> Link: https://patch.msgid.link/20260915211508.291790-2-julianbraha@gmail.com Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-17kconfig: fix extra output from savedefconfig on out-of-range defaultsJulian Braha
The Kconfig interpreter currently allows defaults that are outside of the range bounds. In these cases, the 'sym_validate_range' function will adjust the default value to the nearest range bound. For example, see this example: config A int range 1 2 default 16 Here, since the default value of 16 is greater than the bounds, the effective default value gets adjusted down to the upper bound, 2. However, 'savedefconfig' writes non-default values, and without being aware of the automatic adjustment to the range bound, it would write: A=2 This limitation is also documented in a comment: "The following fails to handle the situation where a default value is further limited by the valid range." To resolve this, let's factor out the default-range adjustment logic from the existing 'sym_validate_range' function into its own 'sym_get_near_range_bound' function for 'savedefconfig' to use too, so that it compares against the effective value. Adds tests, accordingly. Fixes: 7cf3d73b4360 ("kconfig: add savedefconfig") Assisted-by: Codex:gpt-5.6-sol Reported-by: Geert Uytterhoeven <geert+renesas@glider.be> Closes: https://lore.kernel.org/lkml/CAMuHMdVyUAA3L4mUkSjmnuE3cvj-+N8z-Bhxsh1wa-FQWc=fjw@mail.gmail.com/ Signed-off-by: Julian Braha <julianbraha@gmail.com> Tested-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Link: https://patch.msgid.link/20260830221129.2668354-1-julianbraha@gmail.com Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-08-31kconfig: error out for recursive rangeJulian Braha
Currently, it is possible to create recursive ranges with Kconfig, such as: config C int "Enable C" default 1 range A B config A int "Enable A" default 2 range B C config B int "Enable B" default 3 range A C The current outcome of this example above, is that all 3 options are set to 2. There is currently no warning or error if a user attempts this. Several attributes are already checked for recursion, including 'depends on', 'select', and 'imply', and we can extend this to 'range' for numeric options (int and hex types). Recursive ranges are currently not used anywhere in the tree, so it is already safe to make this a hard error. Assisted-by: Codex:gpt-5.6-sol Signed-off-by: Julian Braha <julianbraha@gmail.com> Link: https://patch.msgid.link/20260816215354.1499059-1-julianbraha@gmail.com Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-08-14kconfig: fix submenu rendering of negative dependenciesJulian Braha
The Kconfig frontend should render options that depend on a previous option in the submenu of that previous option. But currently, this breaks for negative dependencies. For example, option FOO may be rendered in the submenu of option BAR, despite FOO actually depending on !BAR. Let's fix this ironic rendering by modifying Kconfig to explicitly check negative dependencies. I've only tested locally on x86, but as far as I can tell, this only changes how 2 options are rendered in the menu: 1. NTFS3_FS, no longer in the NTFS_FS submenu, and 2. MTD_BLOCK_RO, no longer in the MTD_BLOCK submenu. Tested-by: Nathan Chancellor <nathan@kernel.org> Reported-by: Xi Ruoyao <xry111@xry111.site> Closes: https://lore.kernel.org/all/cbe95c15d2760f6fce8eaf207c969ce8fd3703aa.camel@xry111.site/ Assisted-by: Claude:claude-4.8-opus Signed-off-by: Julian Braha <julianbraha@gmail.com> Link: https://patch.msgid.link/20260801145238.2140291-1-julianbraha@gmail.com Reviewed-by: Nicolas Schier <nsc@kernel.org> Tested-by: Nicolas Schier <nsc@kernel.org> Signed-off-by: Nicolas Schier <nsc@kernel.org>
2026-08-05kconfig: fix minor typos in commentsJulian Braha
Some typos I noticed: 1. expressoin -> expression 2. A property represent -> A property represents Signed-off-by: Julian Braha <julianbraha@gmail.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Link: https://patch.msgid.link/20260719210536.9577-1-julianbraha@gmail.com Reviewed-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Nicolas Schier <nsc@kernel.org>
2026-08-05kconfig: abort rather than loop for ever on EOFSimon Glass
When a non-interactive 'make oldconfig' or 'syncconfig' meets a new int or hex symbol whose default cannot be applied, conf_string() reads a value from stdin. At end of file fgets() returns NULL, no value is set and the loop asks again. The result is an endless loop which fills the output until it exhausts memory, rather than a clean failure. Detect this in conf_string(): if the value cannot be set and stdin is at end of file, stop with an error that names the symbol. Note that a symbol with no default doesn't trigger this, since sym_calc_value() falls back to 0, which is accepted at end of file. The loop is triggered by a broken Kconfig file, with a default whose text fails sym_string_valid(). Such mistakes do creep in from time to time and are hard to debug, since the build fills the log with repeated prompts instead of pointing at the offending symbol. Some bad defaults draw a parse-time warning, but menu_validate_number() accepts a reference to any int or hex symbol, so a cross-type reference loops with no warning at all. For example, "0xff" is not a valid int value: config HEXSYM hex default 0xff config VAL int "Value" default HEXSYM Interactive use is unaffected, since feof() only becomes true once a read actually hits end of file: an invalid answer at a terminal still re-prompts, while Ctrl-D at such a prompt exits with the error instead of looping. bool and tristate symbols and choices already accept the default on an empty line, so they still take their defaults in a non-interactive build. Tested with int and hex symbols carrying such defaults: with empty stdin, the code without this change produces around 190MB of repeated prompts within two seconds, while with the change it exits 1 naming the symbol. Piped and interactive (pty) sessions still re-prompt on an invalid answer and then accept a valid one. A new string symbol with no default still takes the empty string at end of file, since any text is valid for a string. Signed-off-by: Simon Glass <sjg@chromium.org> Link: https://patch.msgid.link/20260714133545.3294648-1-sjg@chromium.org Signed-off-by: Nicolas Schier <nsc@kernel.org>
2026-07-13scripts: kconfig: merge_config.sh: keep temp file in the output dirGustavo Luiz Duarte
merge_config.sh currently creates a temporary file in the current directory. Create it under $OUTPUT instead, which allows running the script against a read-only source tree. The default behavior is unchanged: $OUTPUT is "." so the file stays in the cwd. Reviewed-by: Breno Leitao <leitao@debian.org> Signed-off-by: Gustavo Luiz Duarte <gustavold@gmail.com> Reviewed-by: Nicolas Schier <n.schier@fritz.com> Tested-by: Nicolas Schier <n.schier@fritz.com> Link: https://patch.msgid.link/20260710-merge_config_output-v2-1-8be3de601612@gmail.com Signed-off-by: Nicolas Schier <nsc@kernel.org>
2026-06-25Merge tag 'kbuild-7.2-2' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux Pull more Kbuild updates from Nathan Chancellor: - Link host programs with ld.lld when $(LLVM) is set to match user's expectations that LLVM will be used exclusively during the build process - Fix modpost warnings from static variable name promotion that can happen more aggressively with the recently merged distributed ThinLTO support - Add an optional warning for user-supplied Kconfig values that changed after processing, such as out of range values or options that have incorrect / missing dependencies * tag 'kbuild-7.2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux: kconfig: add optional warnings for changed input values modpost: Ignore Clang LTO suffixes in symbol matching kbuild: Use ld.lld for linking host programs when LLVM is set
2026-06-18kconfig: add optional warnings for changed input valuesPengpeng Hou
When reading .config input, Kconfig stores user-provided values first and then resolves the final value after applying dependencies, ranges, and other constraints. If the final value differs from the user input, Kconfig already tracks that state internally, but it does not provide a focused diagnostic to show which explicit inputs were adjusted. This is particularly confusing for requested values that get forced down by unmet dependencies or clamped by ranges. Add an opt-in diagnostic controlled by KCONFIG_WARN_CHANGED_INPUT. Emit the warnings from conf_write() and conf_write_defconfig() after value resolution. Print the diagnostic to stderr directly, not through the normal message callback, so it remains visible when conf is run with -s, such as from make -s. Keep the diagnostic out of the conf_message() formatting buffer so long warning lists are not truncated, and mark processed symbols as written before the SYMBOL_WRITE check so duplicate menu nodes cannot emit duplicate warnings. Document the new environment variable and add tests for olddefconfig, savedefconfig, and the silent-conf path. Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn> Tested-by: Julian Braha <julianbraha@gmail.com> Link: https://patch.msgid.link/20260611060000.23858-1-pengpeng@iscas.ac.cn Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-06-15Merge tag 'kbuild-7.2-1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux Pull Kbuild / Kconfig updates from Nathan Chancellor: "Kbuild: - Remove broken module linking exclusion for BTF - Add documentation around how offset header files work - Include unstripped vDSO libraries in pacman packages - Bump minimum version of LLVM for building the kernel to 17.0.1 and clean up unnecessary workarounds - Use a context manager in run-clang-tools - Add dist macro value if present to release tag for RPM packages - Detect and report truncated buf_printf() output in modpost - Add __llvm_covfun and __llvm_covmap to section whitelist in modpost - Support Clang's distributed ThinLTO mode - Remove architecture specific configurations for AutoFDO and Propeller to ease individual architecture maintenance Kconfig: - Add kconfig-sym-check target to look for dangling Kconfig symbol references and invalid tristate literal values - Harden against potential NULL pointer dereference - Fix typo in Kconfig test comment" * tag 'kbuild-7.2-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux: (31 commits) kconfig: tests: fix typo in comment kconfig: Remove the architecture specific config for Propeller kconfig: Remove the architecture specific config for AutoFDO modpost: Add __llvm_covfun and __llvm_covmap to section_white_list kconfig: add kconfig-sym-check static checker kbuild: Remove unnecessary 'T' modifier in cmd_ar_builtin_fixup kbuild: distributed build support for Clang ThinLTO kbuild: move vmlinux.a build rule to scripts/Makefile.vmlinux_a scripts: modpost: detect and report truncated buf_printf() output kbuild: rpm-pkg: append %{?dist} macro to Release tag run-clang-tools: run multiprocessing.Pool as context manager compiler-clang.h: Drop explicit version number from "all" diagnostic macro compiler-clang.h: Remove __cleanup -Wunused-variable workaround kbuild: Remove check for broken scoping with clang < 17 in CC_HAS_ASM_GOTO_OUTPUT x86/entry/vdso32: Remove conditional omission of '.cfi_offset eflags' x86/module: Revert "Deal with GOT based stack cookie load on Clang < 17" x86/build: Drop unnecessary '-ffreestanding' addition to KBUILD_CFLAGS scripts/Makefile.warn: Drop -Wformat handling for clang < 16 riscv: Drop tautological condition from TOOLCHAIN_NEEDS_OLD_ISA_SPEC riscv: Remove tautological condition from selection of ARCH_SUPPORTS_CFI ...
2026-06-09kconfig: tests: fix typo in commentEthan Nelson-Moore
scripts/kconfig/tests/no_write_if_dep_unmet/__init__.py contains a typo "COFIG_" for "CONFIG_". Fix it. Discovered while searching for typos in CONFIG_* variable references. Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com> Link: https://patch.msgid.link/20260609021712.7965-1-enelsonmoore@gmail.com Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-06-05kconfig: Fix repeated include selftest expectationZhou Yuhang
The err_repeated_inc test was added with an expected stderr fixture that does not match the diagnostic printed by kconfig. Running "make testconfig" currently fails in that test even though the parser reports the duplicated include correctly: [stderr] Kconfig.inc1:4: error: repeated inclusion of Kconfig.inc3 Kconfig.inc2:3: note: location of first inclusion of Kconfig.inc3 The fixture expects "Repeated" and "Location" with capital letters, but the diagnostic emitted by scripts/kconfig/util.c uses lowercase words. Update the fixture to match the real message. Fixes: 102d712ded3e ("kconfig: Error out on duplicated kconfig inclusion") Signed-off-by: Zhou Yuhang <zhouyuhang@kylinos.cn> Tested-by: Nicolas Schier <nsc@kernel.org> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Link: https://patch.msgid.link/20260520070800.2265479-1-zhouyuhang1010@163.com Signed-off-by: Nicolas Schier <nsc@kernel.org>
2026-06-03kconfig: add kconfig-sym-check static checkerAndrew Jones
Add 'make kconfig-sym-check', a static checker that finds Kconfig symbols referenced in expressions (select, depends on, default, etc.) but never defined via config/menuconfig anywhere in the tree. New dangling symbols are reported as errors (exit 1) unless they are listed in an exclusion file, e.g. KCONFIG_SYM_CHECK_EXCLUDES=sym-check-excludes make kconfig-sym-check The exclusion file lists one symbol per line; blank lines and lines starting with '#' are ignored. The checker also warns about uppercase N/Y/M used as tristate literal values following the same logic as checkpatch. This new static checker is the script used for [1] with a few improvements to avoid some false positives. Link: https://bugzilla.kernel.org/show_bug.cgi?id=216748 [1] Assisted-by: Claude:claude-sonnet-4-6 Signed-off-by: Andrew Jones <andrew.jones@linux.dev> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Julian Braha <julianbraha@gmail.com> Tested-by: Nicolas Schier <nsc@kernel.org> Acked-by: Nicolas Schier <nsc@kernel.org> Link: https://patch.msgid.link/20260527142703.107110-1-andrew.jones@linux.dev Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-04-29kconfig: fix potential NULL pointer dereference in conf_askvalueXingjing Deng
In conf_askvalue(), the 'def' argument (retrieved via sym_get_string_value) can be NULL. While current call sites ensure that 'def' is valid, calling printf("%s\n", def) is technically undefined behavior and could lead to a segmentation fault on certain libc implementations if the function were called with a NULL pointer in the future. Improve the robustness of conf_askvalue() by providing an empty string as a fallback. Additionally, remove the redundant re-initialization of the 'line' buffer inside the !sym_is_changeable(sym) block, as it is already properly initialized at the function entry. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Xingjing Deng <micro6947@gmail.com> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Link: https://patch.msgid.link/20260306021709.27068-1-micro6947@gmail.com Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-04-14Merge tag 'kbuild-7.1-1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux Pull Kbuild/Kconfig updates from Nicolas Schier: "Kbuild: - reject unexpected values for LLVM= - uapi: remove usage of toolchain headers - switch from '-fms-extensions' to '-fms-anonymous-structs' when available (currently: clang >= 23.0.0) - reduce the number of compiler-generated suffixes for clang thin-lto build - reduce output spam ("GEN Makefile") when building out of tree - improve portability for testing headers - also test UAPI headers against C++ compilers - drop build ID architecture allow-list in vdso_install - only run checksyscalls when necessary - update the debug information notes in reproducible-builds.rst - expand inlining hints with -fdiagnostics-show-inlining-chain Kconfig: - forbid multiple entries with the same symbol in a choice - error out on duplicated kconfig inclusion" * tag 'kbuild-7.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux: (35 commits) kbuild: expand inlining hints with -fdiagnostics-show-inlining-chain kconfig: forbid multiple entries with the same symbol in a choice Documentation: kbuild: Update the debug information notes in reproducible-builds.rst checksyscalls: move instance functionality into generic code checksyscalls: only run when necessary checksyscalls: fail on all intermediate errors checksyscalls: move path to reference table to a variable kbuild: vdso_install: drop build ID architecture allow-list kbuild: vdso_install: gracefully handle images without build ID kbuild: vdso_install: hide readelf warnings kbuild: vdso_install: split out the readelf invocation kbuild: uapi: also test UAPI headers against C++ compilers kbuild: uapi: provide a C++ compatible dummy definition of NULL kbuild: uapi: handle UML in architecture-specific exclusion lists kbuild: uapi: move all include path flags together kbuild: uapi: move some compiler arguments out of the command definition check-uapi: use dummy libc includes check-uapi: honor ${CROSS_COMPILE} setting check-uapi: link into shared objects kbuild: reduce output spam when building out of tree ...
2026-04-05kconfig: forbid multiple entries with the same symbol in a choiceMasahiro Yamada
Commit 6a859f1a19d1 ("powerpc: unify two CONFIG_POWERPC64_CPU entries in the same choice block") removed the only occurrence of this tricky use case. Disallow this pattern in choice_check_sanity() and revert commit 4d46b5b623e0 ("kconfig: fix infinite loop in sym_calc_choice()"). Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Link: https://patch.msgid.link/20260330115736.1559962-1-masahiroy@kernel.org Reviewed-by: Nicolas Schier <nsc@kernel.org> Signed-off-by: Nicolas Schier <nsc@kernel.org>
2026-03-11scripts: kconfig: merge_config.sh: fix indentationDaniel Gomez
Replace spaces with tabs for consistency with the rest of the script. Fixes: 5fa9b82cbcfc5 ("scripts: kconfig: merge_config.sh: refactor from shell/sed/grep to awk") Signed-off-by: Daniel Gomez <da.gomez@samsung.com> Link: https://patch.msgid.link/20260310-fixes-merge-config-v1-2-beaeeaded6bd@samsung.com Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-03-11scripts: kconfig: merge_config.sh: pass output file as awk variableDaniel Gomez
The refactoring commit 5fa9b82cbcfc5 ("scripts: kconfig: merge_config.sh: refactor from shell/sed/grep to awk") passes $TMP_FILE.new as ARGV[3] to awk, using it as both an output destination and an input file argument. When the base file is empty, nothing is written to ARGV[3] during processing, so awk fails trying to open it for reading: awk: cmd. line:52: fatal: cannot open file `./.tmp.config.grcQin34jb.new' for reading: No such file or directory mv: cannot stat './.tmp.config.grcQin34jb.new': No such file or directory Pass the output path via -v outfile instead and drop the FILENAME == ARGV[3] { nextfile }. Fixes: 5fa9b82cbcfc5 ("scripts: kconfig: merge_config.sh: refactor from shell/sed/grep to awk") Signed-off-by: Daniel Gomez <da.gomez@samsung.com> Link: https://patch.msgid.link/20260310-fixes-merge-config-v1-1-beaeeaded6bd@samsung.com Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-03-09scripts: kconfig: merge_config.sh: fix unexpected operator warningWeizhao Ouyang
Fix a warning for: $ ./scripts/kconfig/merge_config.sh .config extra.config Using .config as base Merging extra.config ./scripts/kconfig/merge_config.sh: 384: [: false: unexpected operator The shellcheck report is also attached: if [ "$STRICT" == "true" ] && [ "$STRICT_MODE_VIOLATED" == "true" ]; then ^-- SC3014 (warning): In POSIX sh, == in place of = is undefined. ^-- SC3014 (warning): In POSIX sh, == in place of = is undefined. Fixes: dfc97e1c5da5 ("scripts: kconfig: merge_config.sh: use awk in checks too") Signed-off-by: Weizhao Ouyang <o451686892@gmail.com> Reviewed-by: Mikko Rapeli <mikko.rapeli@linaro.org> Link: https://patch.msgid.link/20260309121505.40454-1-o451686892@gmail.com Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-02-27kconfig: Error out on duplicated kconfig inclusionNicolas Schier
Let kconfig exit with error on duplicated Kconfig file inclusion. Repeated inclusion of Kbuild files are considered bad-practise with regard to maintenance; and Kconfig language is rich enough that there should be no need for that. If repeated inclusion of Kconfig files is detected, error out with messages like: Kconfig.inc1:4: error: repeated inclusion of Kconfig.inc3 Kconfig.inc2:3: note: location of first inclusion of Kconfig.inc3 While commit f094f8a1b273 ("kconfig: allow multiple inclusion of the same file") introduced detection of recursive inclusions of Kconfig files, it explicitly allowed repeated inclusions, unfortunately w/o reasoning. Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Closes: https://lore.kernel.org/all/CAHk-=wj03hLzK2D=+OYmjgcmGM+XYymp8GyaEs=C0=rXG2nb7w@mail.gmail.com/ Reviewed-by: Nathan Chancellor <nathan@kernel.org> Tested-by: Nathan Chancellor <nathan@kernel.org> Link: https://patch.msgid.link/20260220-kconfig-error-out-on-duplicated-inclusion-v1-1-be78aa241a53@kernel.org Signed-off-by: Nicolas Schier <nsc@kernel.org>
2026-02-11Merge tag 'kbuild-7.0-1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux Pull Kbuild/Kconfig updates from Nathan Chancellor: "Kbuild: - Drop '*_probe' pattern from modpost section check allowlist, which hid legitimate warnings (Johan Hovold) - Disable -Wtype-limits altogether, instead of enabling at W=2 (Vincent Mailhol) - Improve UAPI testing to skip testing headers that require a libc when CONFIG_CC_CAN_LINK is not set, opening up testing of headers with no libc dependencies to more environments (Thomas Weißschuh) - Update gendwarfksyms documentation with required dependencies (Jihan LIN) - Reject invalid LLVM= values to avoid unintentionally falling back to system toolchain (Thomas Weißschuh) - Add a script to help run the kernel build process in a container for consistent environments and testing (Guillaume Tucker) - Simplify kallsyms by getting rid of the relative base (Ard Biesheuvel) - Performance and usability improvements to scripts/make_fit.py (Simon Glass) - Minor various clean ups and fixes Kconfig: - Move XPM icons to individual files, clearing up GTK deprecation warnings (Rostislav Krasny) - Support depends on FOO if BAR as syntactic sugar for depends on FOO || !BAR (Nicolas Pitre, Graham Roff) - Refactor merge_config.sh to use awk over shell/sed/grep, dramatically speeding up processing large number of config fragments (Anders Roxell, Mikko Rapeli)" * tag 'kbuild-7.0-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux: (39 commits) kbuild: remove dependency of run-command on config scripts/make_fit: Compress dtbs in parallel scripts/make_fit: Support a few more parallel compressors kbuild: Support a FIT_EXTRA_ARGS environment variable scripts/make_fit: Move dtb processing into a function scripts/make_fit: Support an initial ramdisk scripts/make_fit: Speed up operation rust: kconfig: Don't require RUST_IS_AVAILABLE for rustc-option MAINTAINERS: Add scripts/install.sh into Kbuild entry modpost: Amend ppc64 save/restfpr symnames for -Os build MIPS: tools: relocs: Ship a definition of R_MIPS_PC32 streamline_config.pl: remove superfluous exclamation mark kbuild: dummy-tools: Add python3 scripts: kconfig: merge_config.sh: warn on duplicate input files scripts: kconfig: merge_config.sh: use awk in checks too scripts: kconfig: merge_config.sh: refactor from shell/sed/grep to awk kallsyms: Get rid of kallsyms relative base mips: Add support for PC32 relocations in vmlinux Documentation: dev-tools: add container.rst page scripts: add tool to run containerized builds ...
2026-02-02streamline_config.pl: remove superfluous exclamation markDiego Viola
In order to make the output cleaner and more consistent with other scripts. Signed-off-by: Diego Viola <diego.viola@gmail.com> Link: https://patch.msgid.link/20260202054541.17399-1-diego.viola@gmail.com Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-01-22scripts: kconfig: merge_config.sh: warn on duplicate input filesMikko Rapeli
External scripts like yocto kernel scc may provide same input config fragment multiple times. This may be a bug since processing same fragments multiple times can be time consuming. Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org> Link: https://patch.msgid.link/20260122105751.2186609-3-mikko.rapeli@linaro.org Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-01-22scripts: kconfig: merge_config.sh: use awk in checks tooMikko Rapeli
Converting from shell/sed/grep loop to awk improves runtime checks of Yocto genericarm64 kernel config from 20 seconds to under 1 second. The checks catch this kind of issues: WARNING: CONFIG_BLK_DEV_DM differs: Requested value: CONFIG_BLK_DEV_DM=y Actual value: CONFIG_BLK_DEV_DM=m WARNING: CONFIG_SECURITY_NETWORK differs: Requested value: CONFIG_SECURITY_NETWORK=n Actual value: CONFIG_SECURITY_NETWORK=y WARNING: Value requested for CONFIG_ARM64_BTI_KERNEL not in final .config Requested value: CONFIG_ARM64_BTI_KERNEL=y Actual value: Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org> Link: https://patch.msgid.link/20260122105751.2186609-2-mikko.rapeli@linaro.org Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-01-22scripts: kconfig: merge_config.sh: refactor from shell/sed/grep to awkAnders Roxell
merge_config.sh shell/sed/grep loop scales poorly and is slow. With Yocto genericarm64 kernel and around 190 config fragments the script takes more than 20 minutes to run on a fast build machine. Re-implementation with awk does the same job in 10 seconds. Using awk since it is likely available in the build environments and using perl, python etc would introduce more complex runtime dependencies. awk is good enough and lot better than shell/sed/grep. Output stays the same but changed execution time means that parallel job output may be ordered differently. Signed-off-by: Anders Roxell <anders.roxell@linaro.org> Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org> Link: https://patch.msgid.link/20260122105751.2186609-1-mikko.rapeli@linaro.org Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-01-14kconfig: fix static linking of nconfArkadiusz Kozdra
When running make nconfig with a static linking host toolchain, the libraries are linked in an incorrect order, resulting in errors similar to the following: $ MAKEFLAGS='HOSTCC=cc\ -static' make nconfig /usr/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/14.2.1/../../../../lib64/libpanel.a(p_new.o): in function `new_panel': (.text+0x13): undefined reference to `_nc_panelhook_sp' /usr/bin/ld: (.text+0x6c): undefined reference to `_nc_panelhook_sp' Fixes: 1c5af5cf9308 ("kconfig: refactor ncurses package checks for building mconf and nconf") Signed-off-by: Arusekk <floss@arusekk.pl> Link: https://patch.msgid.link/20260110114808.22595-1-floss@arusekk.pl [nsc: Added comment about library order] Signed-off-by: Nicolas Schier <nsc@kernel.org>
2026-01-06kconfig: Support conditional deps using "depends on X if Y"Nicolas Pitre
Extend the "depends on" syntax to support conditional dependencies using "depends on X if Y". While functionally equivalent to "depends on X || (Y == n)", "depends on X if Y" is much more readable and makes the kconfig language uniform in supporting the "if <expr>" suffix. This also improves readability for "optional" dependencies, which are the subset of conditional dependencies where X is Y. Previously such optional dependencies had to be expressed as the counterintuitive "depends on X || !X", now this can be represented as "depends on X if X". The change is implemented by converting the "X if Y" syntax into the "X || (Y == n)" syntax during "depends on" token processing. Signed-off-by: Nicolas Pitre <nico@fluxnic.net> [Graham Roff: Rewrote commit message, updated patch, added tests] Signed-off-by: Graham Roff <grahamr@qti.qualcomm.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Link: https://patch.msgid.link/20251215-kconfig_conditional_deps-v3-1-59519af0a5df@qti.qualcomm.com [nathan: Minor adjustments to spacing] Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2025-12-19kconfig: move XPM icons to separate filesRostislav Krasny
Replace deprecated gdk_pixbuf_new_from_xpm_data() with gdk_pixbuf_new_from_file() and update both GTK and QT frontends to load XPM icons from separate files in scripts/kconfig/icons/ instead of from the code. xpm_menu_inv and xpm_void were removed and not converted into xpm files because they are not used since commit 64285dc5c41f ("kconfig: gconf: inline fill_row() into set_node()"). This eliminates the GTK deprecation warnings at compile time and improves memory usage and code organization. Signed-off-by: Rostislav Krasny <rostiprodev@gmail.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Randy Dunlap <rdunlap@infradead.org> Link: https://patch.msgid.link/20251217015409.30102-2-rostiprodev@gmail.com [nathan: Minor commit message clean ups] Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2025-11-01kconfig/nconf: Initialize the default locale at startupJakub Horký
Fix bug where make nconfig doesn't initialize the default locale, which causes ncurses menu borders to be displayed incorrectly (lqqqqk) in UTF-8 terminals that don't support VT100 ACS by default, such as PuTTY. Signed-off-by: Jakub Horký <jakub.git@horky.net> Link: https://patch.msgid.link/20251014144405.3975275-2-jakub.git@horky.net [nathan: Alphabetize locale.h include] Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2025-11-01kconfig/mconf: Initialize the default locale at startupJakub Horký
Fix bug where make menuconfig doesn't initialize the default locale, which causes ncurses menu borders to be displayed incorrectly (lqqqqk) in UTF-8 terminals that don't support VT100 ACS by default, such as PuTTY. Signed-off-by: Jakub Horký <jakub.git@horky.net> Link: https://patch.msgid.link/20251014154933.3990990-1-jakub.git@horky.net [nathan: Alphabetize locale.h include] Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2025-10-07kconfig: Avoid prompting for transitional symbolsKees Cook
The "transitional" symbol keyword, while working with the "olddefconfig" target, was prompting during "oldconfig". This occurred because these symbols were not being marked as user-defined when they received values from transitional symbols that had user values. The "olddefconfig" target explicitly doesn't prompt for anything, so this deficiency wasn't noticed. The issue manifested when a symbol's value came from a transitional symbol's user value but the receiving symbol wasn't marked with SYMBOL_DEF_USER. Thus the "oldconfig" logic would then prompt for these symbols unnecessarily. Check after value calculation whether a symbol without a user value gets its value from a single transitional symbol that does have a user value. In such cases, mark the receiving symbol as user-defined to prevent prompting. Update regression tests to verify that symbols with transitional defaults are not prompted in "oldconfig", except when conditional defaults evaluate to 'no' and should legitimately be prompted. Build tested with "make testconfig". Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Closes: https://lore.kernel.org/lkml/CAHk-=wgZjUk4Cy2XgNkTrQoO8XCmNUHrTe5D519Fij1POK+3qw@mail.gmail.com/ Fixes: f9afce4f32e9 ("kconfig: Add transitional symbol attribute for migration support") Cc: Vegard Nossum <vegard.nossum@oracle.com> Link: https://lore.kernel.org/r/20250930154514.it.623-kees@kernel.org Signed-off-by: Kees Cook <kees@kernel.org>
2025-10-01Merge tag 'kbuild-6.18-1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux Pull Kbuild updates from Nathan Chancellor: - Extend modules.builtin.modinfo to include module aliases from MODULE_DEVICE_TABLE for builtin modules so that userspace tools (such as kmod) can verify that a particular module alias will be handled by a builtin module - Bump the minimum version of LLVM for building the kernel to 15.0.0 - Upgrade several userspace API checks in headers_check.pl to errors - Unify and consolidate CONFIG_WERROR / W=e handling - Turn assembler and linker warnings into errors with CONFIG_WERROR / W=e - Respect CONFIG_WERROR / W=e when building userspace programs (userprogs) - Enable -Werror unconditionally when building host programs (hostprogs) - Support copy_file_range() and data segment alignment in gen_init_cpio to improve performance on filesystems that support reflinks such as btrfs and XFS - Miscellaneous small changes to scripts and configuration files * tag 'kbuild-6.18-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux: (47 commits) modpost: Initialize builtin_modname to stop SIGSEGVs Documentation: kbuild: note CONFIG_DEBUG_EFI in reproducible builds kbuild: vmlinux.unstripped should always depend on .vmlinux.export.o modpost: Create modalias for builtin modules modpost: Add modname to mod_device_table alias scsi: Always define blogic_pci_tbl structure kbuild: extract modules.builtin.modinfo from vmlinux.unstripped kbuild: keep .modinfo section in vmlinux.unstripped kbuild: always create intermediate vmlinux.unstripped s390: vmlinux.lds.S: Reorder sections KMSAN: Remove tautological checks objtool: Drop noinstr hack for KCSAN_WEAK_MEMORY lib/Kconfig.debug: Drop CLANG_VERSION check from DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT riscv: Remove ld.lld version checks from many TOOLCHAIN_HAS configs riscv: Unconditionally use linker relaxation riscv: Remove version check for LTO_CLANG selects powerpc: Drop unnecessary initializations in __copy_inst_from_kernel_nofault() mips: Unconditionally select ARCH_HAS_CURRENT_STACK_POINTER arm64: Remove tautological LLVM Kconfig conditions ARM: Clean up definition of ARM_HAS_GROUP_RELOCS ...
2025-09-24kconfig: Add transitional symbol attribute for migration supportKees Cook
During kernel option migrations (e.g. CONFIG_CFI_CLANG to CONFIG_CFI), existing .config files need to maintain backward compatibility while preventing deprecated options from appearing in newly generated configurations. This is challenging with existing Kconfig mechanisms because: 1. Simply removing old options breaks existing .config files. 2. Manually listing an option as "deprecated" leaves it needlessly visible and still writes them to new .config files. 3. Using any method to remove visibility (.e.g no 'prompt', 'if n', etc) prevents the option from being processed at all. Add a "transitional" attribute that creates symbols which are: - Processed during configuration (can influence other symbols' defaults) - Hidden from user menus (no prompts appear) - Omitted from newly written .config files (gets migrated) - Restricted to only having help sections (no defaults, selects, etc) making it truly just a "prior value pass-through" option. The transitional syntax requires a type argument and prevents type redefinition: config NEW_OPTION bool "New option" default OLD_OPTION config OLD_OPTION bool transitional help Transitional config for OLD_OPTION migration. This allows seamless migration: olddefconfig processes existing CONFIG_OLD_OPTION=y settings to enable CONFIG_NEW_OPTION=y, while CONFIG_OLD_OPTION is omitted from newly generated .config files. Added positive and negative testing via "testconfig" make target. Co-developed-by: Vegard Nossum <vegard.nossum@oracle.com> Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Tested-by: Nathan Chancellor <nathan@kernel.org> Link: https://lore.kernel.org/r/20250923213422.1105654-2-kees@kernel.org Signed-off-by: Kees Cook <kees@kernel.org>
2025-09-24kconfig: Fix BrokenPipeError warnings in selftestsKees Cook
The kconfig test harness ("make testconfig") was generating BrokenPipeError warnings when running interactive tests like oldaskconfig and oldconfig: /usr/lib/python3/dist-packages/_pytest/unraisableexception.py:85: PytestUnraisableExceptionWarning: Exception ignored in: <_io.BufferedWriter name=12> Traceback (most recent call last): File "/srv/code/scripts/kconfig/tests/conftest.py", line 127, in oldaskconfig return self._run_conf('--oldaskconfig', dot_config=dot_config, ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ interactive=True, in_keys=in_keys) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ BrokenPipeError: [Errno 32] Broken pipe The issue occurred when the test framework attempted to write to stdin after the conf subprocess had already exited. Wrap stdin write operations in try/except to catch BrokenPipeError and stop sending more input. Add explicit flush() after writes so we can see delivery errors immediately. Ignore BrokenPipeError when closing stdin. Explicitly call wait() to validate subprocess termination. Reviewed-by: Nathan Chancellor <nathan@kernel.org> Tested-by: Nathan Chancellor <nathan@kernel.org> Link: https://lore.kernel.org/r/20250923213422.1105654-1-kees@kernel.org Signed-off-by: Kees Cook <kees@kernel.org>
2025-08-18kconfig: qconf/xconfig: show the OptionsMode radio button setting at startupRandy Dunlap
When qconf (xconfig) exits, it saves the current Option settings for Show Name, Show Debug Info, and Show {Normal|All|Prompt} Options. When it is next run, it loads these Option settings from its config file. It correctly shows the flag settings for Show Name and Show Debug Info, but it does not show which of the 3 Show...Options is set. This can lead to confusing output, e.g., if the user thinks that xconfig is in Show All Options mode but kconfig options which have an unmet dependency are still being listed. Add code to show the radio button for the current Show...Options mode during startup so that it will reflect the current config setting. Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Nicolas Schier <nsc@kernel.org> Acked-by: Nicolas Schier <nsc@kernel.org> Link: https://lore.kernel.org/r/20250812223502.1356426-1-rdunlap@infradead.org Signed-off-by: Nathan Chancellor <nathan@kernel.org>