Page MenuHomeFreeBSD

arm/unwind: Check stack pointer boundaries before dereferencing
ClosedPublic

Authored by markj on Jul 27 2023, 3:11 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 14, 9:01 AM
Unknown Object (File)
Mon, Apr 14, 5:01 AM
Unknown Object (File)
Mon, Apr 14, 3:01 AM
Unknown Object (File)
Mon, Apr 14, 1:16 AM
Unknown Object (File)
Mon, Mar 24, 8:50 AM
Unknown Object (File)
Feb 4 2025, 12:02 AM
Unknown Object (File)
Jan 31 2025, 5:10 PM
Unknown Object (File)
Jan 26 2025, 7:53 AM
Subscribers

Details

Summary

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
have where some openssl assembly code apparently confuses the unwinder.

Sponsored by: Klara, Inc.
Sponsored by: Stormshield

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable