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
F159321618: D41210.id125252.diff
Fri, Jun 12, 8:53 PM
Unknown Object (File)
Wed, Jun 10, 5:43 AM
Unknown Object (File)
Sun, Jun 7, 10:57 AM
Unknown Object (File)
Sat, May 16, 4:03 AM
Unknown Object (File)
May 2 2026, 10:12 AM
Unknown Object (File)
Apr 26 2026, 1:58 AM
Unknown Object (File)
Apr 20 2026, 8:53 PM
Unknown Object (File)
Apr 18 2026, 5:34 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 52867
Build 49758: arc lint + arc unit