Commit a8cdf51c authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'hardening-fix1-v6.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux

Pull hardening fixes from Kees Cook:

 - tools headers: rename missed CONFIG_CFI_CLANG in merge (Carlos
   Llamas)

 - kconfig: Avoid prompting for transitional symbols

* tag 'hardening-fix1-v6.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  tools headers: kcfi: rename missed CONFIG_CFI_CLANG
  kconfig: Avoid prompting for transitional symbols
parents 16d1ba7c b157dd22
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -411,7 +411,7 @@ bool sym_dep_errors(void)
void sym_calc_value(struct symbol *sym)
{
	struct symbol_value newval, oldval;
	struct property *prop;
	struct property *prop = NULL;
	struct menu *choice_menu;

	if (!sym)
@@ -520,6 +520,19 @@ void sym_calc_value(struct symbol *sym)
		;
	}

	/*
	 * If the symbol lacks a user value but its value comes from a
	 * single transitional symbol with an existing user value, mark
	 * this symbol as having a user value to avoid prompting.
	 */
	if (prop && !sym_has_value(sym)) {
		struct symbol *ds = prop_get_symbol(prop);
		if (ds && (ds->flags & SYMBOL_TRANS) && sym_has_value(ds)) {
			sym->def[S_DEF_USER] = newval;
			sym->flags |= SYMBOL_DEF_USER;
		}
	}

	sym->curr = newval;
	sym_validate_range(sym);

+32 −0
Original line number Diff line number Diff line
@@ -96,5 +96,37 @@ config OLD_WITH_HELP
	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"
+7 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ This tests that:
- OLD_* options in existing .config cause NEW_* options to be set
- OLD_* options are not written to the new .config file
- NEW_* options appear in the new .config file with correct values
- NEW_* options with defaults from transitional symbols are not prompted
- All Kconfig types work correctly: bool, tristate, string, hex, int
- User-set NEW values take precedence over conflicting OLD transitional values
"""
@@ -16,3 +17,9 @@ def test(conf):

    # Check that the configuration matches expected output
    assert conf.config_contains('expected_config')

    # Test oldconfig to ensure symbols with transitional defaults are not prompted
    assert conf.oldconfig(dot_config='initial_config', in_keys='n\n') == 0

    # Except for when conditional default evaluates to 'no'
    assert conf.stdout_contains('expected_stdout')
+3 −0
Original line number Diff line number Diff line
@@ -9,4 +9,7 @@ CONFIG_NEW_STRING_PRECEDENCE="user value"
CONFIG_NEW_TRISTATE_PRECEDENCE=y
CONFIG_NEW_HEX_PRECEDENCE=0xABCD
CONFIG_NEW_INT_PRECEDENCE=100
# CONFIG_NEW_DISABLED is not set
# CONFIG_DEPENDENCY_TEST is not set
# CONFIG_NEW_CONDITIONAL_DEFAULT is not set
# CONFIG_REGULAR_OPTION is not set
+1 −0
Original line number Diff line number Diff line
New option with conditional default (NEW_CONDITIONAL_DEFAULT) [N/y/?] (NEW) n
Loading