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)
Sun, Apr 26, 1:58 AM
Unknown Object (File)
Mon, Apr 20, 8:53 PM
Unknown Object (File)
Sat, Apr 18, 5:34 AM
Unknown Object (File)
Sat, Apr 18, 5:32 AM
Unknown Object (File)
Fri, Apr 17, 7:39 PM
Unknown Object (File)
Fri, Apr 17, 4:42 AM
Unknown Object (File)
Tue, Apr 7, 10:15 AM
Unknown Object (File)
Mar 9 2026, 7:52 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