summaryrefslogtreecommitdiff
path: root/tools/lib/python
diff options
context:
space:
mode:
authorLeizhen Zhang <lzsx618@gmail.com>2026-10-08 11:45:21 -0500
committerNathan Chancellor <nathan@kernel.org>2026-10-09 22:30:48 +0200
commit52f26261e27dbdb7c6dea75d8f1a92ea805b2c58 (patch)
tree8e582a5ee627b4494c13e407aef32d00915b7c4b /tools/lib/python
parent2160297cabd4bd121ef2e7327c6a6f376c0fbf3c (diff)
downloadlinux-next-52f26261e27dbdb7c6dea75d8f1a92ea805b2c58.tar.gz
linux-next-52f26261e27dbdb7c6dea75d8f1a92ea805b2c58.zip
kconfig: fix infinite loop in conf_choice() when no choice value is visible
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>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions