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, Mar 9, 7:52 PM
Unknown Object (File)
Mon, Mar 9, 7:52 PM
Unknown Object (File)
Mon, Mar 9, 7:52 PM
Unknown Object (File)
Sun, Mar 8, 9:34 PM
Unknown Object (File)
Sat, Mar 7, 9:21 PM
Unknown Object (File)
Feb 7 2026, 10:31 PM
Unknown Object (File)
Jan 31 2026, 2:08 AM
Unknown Object (File)
Jan 16 2026, 11:25 PM
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 Skipped
Unit
Tests Skipped
Build Status
Buildable 52867
Build 49758: arc lint + arc unit