Skip to content

[amd64-v6.18.63-generic] check-config: fail on entries for symbols the tree does not declare - #340

Open
NopeCharon wants to merge 1 commit into
lf-edge:eve-kernel-amd64-v6.18.63-genericfrom
NopeCharon:check-config-undeclared-symbols
Open

NopeCharon wants to merge 1 commit into
lf-edge:eve-kernel-amd64-v6.18.63-genericfrom
NopeCharon:check-config-undeclared-symbols

Conversation

@NopeCharon

Copy link
Copy Markdown

Summary

eve/check-config.py gets a new fatal section, defconfig and fragment symbols declared in this tree. It fails the build when the flavour's base defconfig or one of its fragments sets a symbol that no Kconfig in the tree declares.

Fixes #338

Why

olddefconfig silently drops assignments to undeclared symbols, and the fragments are merged with merge_config.sh -m, which skips merge_config's own final-value check. After a kernel bump removes or renames a symbol EVE sets:

  • a fragment's # CONFIG_X is not set always "holds", because check_fragment_values counts a symbol missing from .config as n;
  • no check reads the base defconfig's own entries;
  • a fragment's =y/=m shows up only as requested y, got n.

eve/drift/core-6.12-to-6.18.txt shows this already happened: CRYPTO_CRC32_PCLMUL, CRYPTO_KEYWRAP, CRYPTO_VMAC and X86_5LEVEL are 6.12 eve-core_defconfig entries that 6.18 does not declare at all.

Changes

  • check_symbols_declared(sources, symbol_map) looks up every entry of the base defconfig and the fragments, in apply order, in the symbol map the checker already builds from the tree's Kconfig files. For each stale entry it reports the symbol, the file and the value.
  • run_checks() takes an optional base_defconfig (path, values) pair. main() takes an optional --base-defconfig. Without it, only the fragments are checked.
  • Dockerfile.gcc passes --base-defconfig "arch/x86/configs/${BASE_DEFCONFIG}".
  • eve/tests/test_check_config.py adds unit tests for the new check, run_checks() cases where it is the only failing section, and main() tests for the new option.

Validation

  • python3 -m unittest discover -s eve/tests: 51 tests pass. With check-config.py reverted to the base, the 8 new tests fail.
  • Ran the checker on this branch's own tree with each flavour's real base defconfig and fragment list (core, rt, hwe). The new section is PASS for all three: every entry of eve-core_defconfig (974), eve-hwe_defconfig (6333) and every fragment names a declared symbol, so no build changes today.
  • Appended # CONFIG_GONE_UPSTREAM is not set to deny.fragment and re-ran hwe:
    FAIL  defconfig and fragment symbols declared in this tree (1)
            CONFIG_GONE_UPSTREAM: arch/x86/configs/deny.fragment sets n, but no Kconfig in this tree declares it
    

olddefconfig drops an assignment to a symbol that no Kconfig declares,
and Dockerfile.gcc merges fragments with merge_config.sh -m, which skips
merge_config's own "requested value not in final .config" check. So when
a symbol EVE sets is removed or renamed upstream, its defconfig or
fragment entry quietly stops doing anything:

- a fragment's "# CONFIG_X is not set" always holds, because
  check_fragment_values counts a symbol missing from .config as n, so a
  denial that no longer matches anything is never reported;
- no check reads the base defconfig's own entries at all;
- a fragment's =y or =m is reported only as "requested y, got n", which
  reads like a dependency problem.

eve/drift/core-6.12-to-6.18.txt lists CRYPTO_CRC32_PCLMUL, CRYPTO_VMAC,
CRYPTO_KEYWRAP and X86_5LEVEL among the eve-core_defconfig entries the
6.12 -> 6.18 move dropped: 6.18 declares none of them, and the list had
to be put together outside the build.

Add check_symbols_declared(), a fatal section that looks up every symbol
named by the flavour's base defconfig and each of its fragments in the
symbol map the checker already builds from the tree's Kconfig files, and
names the file of every entry it cannot find. The base defconfig comes
from a new optional --base-defconfig option, which Dockerfile.gcc fills
from BASE_DEFCONFIG; without it only the fragments are checked, so
existing callers keep working.

The 6.18.63 tree passes: every entry of eve-core_defconfig (974),
eve-hwe_defconfig (6333) and every fragment names a declared symbol, so
this changes no build today. The next bump that drops a symbol EVE sets
fails at the policy-check step, before the compile, instead of shipping
a config that silently lost the entry.

Fixes: lf-edge#338
Signed-off-by: NopeCharon <115794254+NopeCharon@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant