HomeFreeBSD

kern_malloc: Restore working KASAN runtime after free() and zfree() folding

Description

kern_malloc: Restore working KASAN runtime after free() and zfree() folding

In the zfree() case, the explicit_bzero() calls zero all the allocation,
including the redzone which malloc() has marked as invalid. So calling
kasan_mark() before those is in fact necessary.

This fixes a crash at boot when 'ldconfig' is run and tries to get
random bytes through getrandom() (relevant part of the stack is
read_random_uio() -> zfree() -> explicit_bzero()) for kernels with KASAN
compiled in.

Approved by: markj (mentor)
Fixes: 4fab5f005482 ("kern_malloc: fold free and zfree together into one __always_inline func")
MFC after: 10 days
MFC with: 4fab5f005482
Sponsored by: The FreeBSD Foundation

Details

Provenance
olceAuthored on Aug 1 2024, 7:22 PM
Parents
rGa48f7a2eb90b: fibs: Suppress the WARNING message for setups with multiple fibs
Branches
Unknown
Tags
Unknown