Skip to content

fuzz: Enable additional hardening checks#10830

Open
tmleman wants to merge 2 commits into
thesofproject:mainfrom
tmleman:topic/upstream/pr/fuzzing/enhancement/part2
Open

fuzz: Enable additional hardening checks#10830
tmleman wants to merge 2 commits into
thesofproject:mainfrom
tmleman:topic/upstream/pr/fuzzing/enhancement/part2

Conversation

@tmleman
Copy link
Copy Markdown
Contributor

@tmleman tmleman commented Jun 1, 2026

Since performance is not so important in fuzzing builds I decided to enable additional debug utilities that allow detecting more issues related to memory corruption issues.

Copilot AI review requested due to automatic review settings June 1, 2026 16:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enables extra runtime hardening checks in the Zephyr native POSIX libFuzzer build configuration to improve detection of memory corruption issues during fuzzing.

Changes:

  • Enable CONFIG_SYS_HEAP_HARDENING_EXTREME for stronger heap corruption detection.
  • Enable CONFIG_STACK_SENTINEL to detect stack overflows in fuzzing builds.

tmleman added 2 commits June 1, 2026 19:27
IPC fuzzer is built with Zephyr sys_heap. Because we have a custom
allocator, the compiler sanitizers alone are not able to detect all
errors related to memory allocation. Enabling heap hardening aims to
increase the number of potentially detectable errors in fuzz builds.

CONFIG_SYS_HEAP_HARDENING_EXTREME: adds per-chunk canary trailers
(catching buffer overflows that spill even a single byte into the next
chunk), double-free detection, free-list pointer validation, and
a full heap structure walk after every alloc/free operation. This last
check catches external corruption (e.g. a wild write from an unrelated
component damaging heap metadata) before the allocator acts on it,
rather than letting the damage propagate silently to the next allocation
that happens to touch the corrupted region. The measured cost is ~7%
throughput (288k -> 280k execs/30s), negligible given the class of bugs
it surfaces.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
Enable Zephyr stack sentinel checks for the native libFuzzer build.
This complements the heap hardening option by catching Zephyr thread
stack overflows closer to the corrupting input.

CONFIG_STACK_SENTINEL: stores a magic value at the lowest addresses of
each thread stack and checks it on context switch, interrupt return,
k_yield(), and thread exit. When the sentinel is corrupted the system
traps immediately, giving the fuzzer a clear crash signal instead of
allowing silent corruption that manifests later in an unrelated path.
This is particularly useful in UBSan-only fuzz runs where ASan stack
redzones are not available.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.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.

2 participants