kconfig: Avoid prompting for transitional symbolsThe "transitional" symbol keyword, while working with the "olddefconfig"target, was prompting during "oldconfig". This occurred because thesesymbo
kconfig: Avoid prompting for transitional symbolsThe "transitional" symbol keyword, while working with the "olddefconfig"target, was prompting during "oldconfig". This occurred because thesesymbols were not being marked as user-defined when they received valuesfrom transitional symbols that had user values. The "olddefconfig" targetexplicitly doesn't prompt for anything, so this deficiency wasn't noticed.The issue manifested when a symbol's value came from a transitionalsymbol's user value but the receiving symbol wasn't marked withSYMBOL_DEF_USER. Thus the "oldconfig" logic would then prompt for thesesymbols unnecessarily.Check after value calculation whether a symbol without a user valuegets its value from a single transitional symbol that does have a uservalue. In such cases, mark the receiving symbol as user-defined toprevent prompting.Update regression tests to verify that symbols with transitional defaultsare not prompted in "oldconfig", except when conditional defaults evaluateto '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.orgSigned-off-by: Kees Cook <kees@kernel.org>
show more ...
kconfig: Add transitional symbol attribute for migration supportDuring kernel option migrations (e.g. CONFIG_CFI_CLANG to CONFIG_CFI),existing .config files need to maintain backward compatibility
kconfig: Add transitional symbol attribute for migration supportDuring kernel option migrations (e.g. CONFIG_CFI_CLANG to CONFIG_CFI),existing .config files need to maintain backward compatibility whilepreventing deprecated options from appearing in newly generatedconfigurations. This is challenging with existing Kconfig mechanismsbecause: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 typeredefinition: 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 existingCONFIG_OLD_OPTION=y settings to enable CONFIG_NEW_OPTION=y, whileCONFIG_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.orgSigned-off-by: Kees Cook <kees@kernel.org>