HomeFreeBSD

arm/unwind: Check stack pointer boundaries before dereferencing

Description

arm/unwind: Check stack pointer boundaries before dereferencing

If the unwinder somehow ends up with a stack pointer that lies outside
the stack, then an attempt to dereference can lead to a fault, which
causes the kernel to panic again and unwind the stack, which leads to a
fault...

Add kstack_contains() checks at points where we dereference the stack
pointer. This avoids the aforementioned infinite loop in one case I hit
where some OpenSSL assembly code apparently confuses the unwinder.

Reviewed by: jhb
MFC after: 2 weeks
Sponsored by: Klara, Inc.
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D41210

Details

Provenance
markjAuthored on Jul 27 2023, 7:44 PM
Reviewer
jhb
Differential Revision
D41210: arm/unwind: Check stack pointer boundaries before dereferencing
Parents
rG81a7ce44047f: src.conf.5: Regen
Branches
Unknown
Tags
Unknown