mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/9] kbuild: fix memory safety and UB bugs in host tools found by fuzzing
@ 2026-10-05 10:40 lzhan011
  2026-10-05 10:40 ` [PATCH 1/9] kconfig: fix NULL pointer dereference for defaults taken from choice members lzhan011
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: lzhan011 @ 2026-10-05 10:40 UTC (permalink / raw)
  To: nathan, nsc; +Cc: rostedt, linux-kbuild, linux-kernel

From: lzhan011 <zhangleizhen645@gmail.com>

This series fixes bugs in kbuild host programs found by building them
with AddressSanitizer and UndefinedBehaviorSanitizer and fuzzing their
inputs. Most patches include a reproducer.

Patches 1 and 2 fix bugs that also trigger without sanitizers:

 - kconfig: a string/int/hex symbol whose default is a choice member
   gets a NULL value and crashes conf (since v6.11).
 - genksyms: a declaration such as "int a, f(int);" makes genksyms loop
   forever while allocating memory (since v6.14; earlier versions
   silently recorded wrong types for such declarations).

Patches 3-9 fix out-of-bounds reads (fixdep, modpost) and undefined
behaviour reported by UBSan (kallsyms, modpost, sorttable,
tools/include byteshift helpers), several of which trigger on every
normal x86_64 build when the host tools are built with UBSan.

The series is based on next-20261002. With it applied, a defconfig +
MODULES + MODVERSIONS x86_64 build succeeds; for kconfig, the generated
.config files for the def/allyes/allno/allmod/rand configs on seven
architectures are unchanged, and for genksyms, the symtypes/CRCs of 149
preprocessed kernel sources are unchanged.

lzhan011 (9):
  kconfig: fix NULL pointer dereference for defaults taken from choice
    members
  genksyms: fix infinite loop on declarations with parameter lists
  fixdep: fix out-of-bounds read on a comment ending with a backslash
  kallsyms: do not call qsort() with a NULL table
  modpost: fix stack out-of-bounds read for unterminated PNP ids
  modpost: fix handling of short reads in read_text_file()
  modpost: fix pointer arithmetic on NULL in parse_source_files()
  sorttable: avoid pointer arithmetic overflow when locating sort_needed
  tools/include: fix signed shift overflow in 32-bit unaligned accessors

 scripts/basic/fixdep.c             |  2 +-
 scripts/genksyms/parse.y           | 23 +++++++++++++++++++----
 scripts/kallsyms.c                 |  6 ++++--
 scripts/kconfig/symbol.c           |  4 ++--
 scripts/mod/file2alias.c           | 10 ++++++----
 scripts/mod/modpost.c              |  6 +++++-
 scripts/mod/sumversion.c           |  3 ++-
 scripts/sorttable.c                |  2 +-
 tools/include/tools/be_byteshift.h |  2 +-
 tools/include/tools/le_byteshift.h |  2 +-
 10 files changed, 42 insertions(+), 18 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-10-08 16:04 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-05 10:40 [PATCH 0/9] kbuild: fix memory safety and UB bugs in host tools found by fuzzing lzhan011
2026-10-05 10:40 ` [PATCH 1/9] kconfig: fix NULL pointer dereference for defaults taken from choice members lzhan011
2026-10-08 16:04   ` Julian Braha
2026-10-05 10:40 ` [PATCH 2/9] genksyms: fix infinite loop on declarations with parameter lists lzhan011
2026-10-05 10:40 ` [PATCH 3/9] fixdep: fix out-of-bounds read on a comment ending with a backslash lzhan011
2026-10-05 10:40 ` [PATCH 4/9] kallsyms: do not call qsort() with a NULL table lzhan011
2026-10-05 10:40 ` [PATCH 5/9] modpost: fix stack out-of-bounds read for unterminated PNP ids lzhan011
2026-10-05 10:40 ` [PATCH 6/9] modpost: fix handling of short reads in read_text_file() lzhan011
2026-10-05 10:40 ` [PATCH 7/9] modpost: fix pointer arithmetic on NULL in parse_source_files() lzhan011
2026-10-05 10:40 ` [PATCH 8/9] sorttable: avoid pointer arithmetic overflow when locating sort_needed lzhan011
2026-10-05 10:40 ` [PATCH 9/9] tools/include: fix signed shift overflow in 32-bit unaligned accessors lzhan011

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®