Page MenuHomeFreeBSD

amd64: Avoid enabling interrupts when handling kernel mode prot faults
ClosedPublic

Authored by markj on May 31 2021, 4:19 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jan 15, 11:20 PM
Unknown Object (File)
Thu, Jan 8, 1:15 PM
Unknown Object (File)
Mon, Jan 5, 4:31 PM
Unknown Object (File)
Jan 5 2026, 1:40 AM
Unknown Object (File)
Dec 31 2025, 1:26 PM
Unknown Object (File)
Nov 21 2025, 7:22 AM
Unknown Object (File)
Nov 20 2025, 6:21 AM
Unknown Object (File)
Nov 14 2025, 5:04 AM
Subscribers

Details

Summary

When PTI is enabled, we may have been on the trampoline stack when iret
faults. So, we have to switch back to the regular stack before
re-entering trap().

trap() has the somewhat strange behaviour of re-enabling interrupts when
handling certain kernel-mode execeptions. In particular, it was doing
this for exceptions raised during execution of iret. When switching
away from the trampoline stack, however, the thread must not be migrated
to a different CPU. Fix the problem by simply leaving interrupts
disabled during the window.

Reported by: syzkaller

Diff Detail

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