]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
When handling an exception from the attempt from loading the faulting
authorkib <kib@FreeBSD.org>
Mon, 27 May 2013 18:26:08 +0000 (18:26 +0000)
committerkib <kib@FreeBSD.org>
Mon, 27 May 2013 18:26:08 +0000 (18:26 +0000)
commitda32b7c3140b4a6f5caaf4183cd6f8520d99c7d2
tree1fc7ffbce7fb0f831544b4ffa6752510f35c860f
parente7b0a63c190c7ecb475b09f41387a75952540f49
When handling an exception from the attempt from loading the faulting
context on return from the trap handler, re-enable the interrupts on
i386 and amd64.  The trap return path have to disable interrupts since
the sequence of loading the machine state is not atomic.  The trap()
function which transfers the control to the special handler would
enable the interrupt, but an iret loads the previous eflags with PSL_I
clear.  Then, the special handler calls trap() on its own, which now
sees the original eflags with PSL_I set and does not enable
interrupts.

The end result is that signal delivery and process exiting code could
be executed with interrupts disabled, which is generally wrong and
triggers several assertions.

For amd64, the interrupts are enabled conditionally based on PSL_I in
the eflags of the outer frame, as it is already done for
doreti_iret_fault.  For i386, the interrupts are enabled
unconditionally, the ast loop could have opened a window with
interrupts enabled just before the iret anyway.

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
sys/amd64/amd64/exception.S
sys/i386/i386/exception.s