mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-01-13 10:05:39 +00:00
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>
133 lines
2.5 KiB
Plaintext
133 lines
2.5 KiB
Plaintext
# SPDX-License-Identifier: GPL-2.0
|
|
# Test transitional symbols for config migration with all Kconfig types
|
|
|
|
# Enable module support for tristate testing
|
|
config MODULES
|
|
bool "Enable loadable module support"
|
|
modules
|
|
default y
|
|
|
|
# Basic migration tests for all types
|
|
config NEW_BOOL
|
|
bool "New bool option"
|
|
default OLD_BOOL
|
|
|
|
config OLD_BOOL
|
|
bool
|
|
transitional
|
|
|
|
config NEW_TRISTATE
|
|
tristate "New tristate option"
|
|
default OLD_TRISTATE
|
|
|
|
config OLD_TRISTATE
|
|
tristate
|
|
transitional
|
|
|
|
config NEW_STRING
|
|
string "New string option"
|
|
default OLD_STRING
|
|
|
|
config OLD_STRING
|
|
string
|
|
transitional
|
|
|
|
config NEW_HEX
|
|
hex "New hex option"
|
|
default OLD_HEX
|
|
|
|
config OLD_HEX
|
|
hex
|
|
transitional
|
|
|
|
config NEW_INT
|
|
int "New int option"
|
|
default OLD_INT
|
|
|
|
config OLD_INT
|
|
int
|
|
transitional
|
|
|
|
# Precedence tests for all types
|
|
config NEW_BOOL_PRECEDENCE
|
|
bool "New bool option with precedence"
|
|
default OLD_BOOL_PRECEDENCE
|
|
|
|
config OLD_BOOL_PRECEDENCE
|
|
bool
|
|
transitional
|
|
|
|
config NEW_STRING_PRECEDENCE
|
|
string "New string option with precedence"
|
|
default OLD_STRING_PRECEDENCE
|
|
|
|
config OLD_STRING_PRECEDENCE
|
|
string
|
|
transitional
|
|
|
|
config NEW_TRISTATE_PRECEDENCE
|
|
tristate "New tristate option with precedence"
|
|
default OLD_TRISTATE_PRECEDENCE
|
|
|
|
config OLD_TRISTATE_PRECEDENCE
|
|
tristate
|
|
transitional
|
|
|
|
config NEW_HEX_PRECEDENCE
|
|
hex "New hex option with precedence"
|
|
default OLD_HEX_PRECEDENCE
|
|
|
|
config OLD_HEX_PRECEDENCE
|
|
hex
|
|
transitional
|
|
|
|
config NEW_INT_PRECEDENCE
|
|
int "New int option with precedence"
|
|
default OLD_INT_PRECEDENCE
|
|
|
|
config OLD_INT_PRECEDENCE
|
|
int
|
|
transitional
|
|
|
|
# Test that help sections are allowed for transitional symbols
|
|
config OLD_WITH_HELP
|
|
bool
|
|
transitional
|
|
help
|
|
This transitional symbol has a help section to validate that help is allowed.
|
|
|
|
# Test that we can set something to =n via transitional symbol
|
|
config NEW_DISABLED
|
|
tristate "Check for setting to disabled"
|
|
default OLD_DISABLED
|
|
|
|
config OLD_DISABLED
|
|
tristate
|
|
transitional
|
|
|
|
# Test that a potential new value disappears if it lacks a prompt
|
|
config NEW_DISABLED_UNSAVED
|
|
tristate
|
|
default OLD_DISABLED
|
|
|
|
config OLD_DISABLED_UNSAVED
|
|
tristate
|
|
transitional
|
|
|
|
# Test conditional default: transitional value should not prevent prompting
|
|
# when default visibility makes the expression evaluate to 'no'
|
|
config DEPENDENCY_TEST
|
|
bool "Dependency for testing"
|
|
default n
|
|
|
|
config NEW_CONDITIONAL_DEFAULT
|
|
bool "New option with conditional default"
|
|
default OLD_CONDITIONAL_DEFAULT if DEPENDENCY_TEST
|
|
|
|
config OLD_CONDITIONAL_DEFAULT
|
|
bool
|
|
transitional
|
|
|
|
config REGULAR_OPTION
|
|
bool "Regular option"
|