mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
kvm: handle a case when a bounce interrupt is triggred in gr0
We disable interrupts in gr0, but go-runtime can resume a routine that has been suspend in hr3. In this case, it restores eflags with the IF flag. PiperOrigin-RevId: 472826101
This commit is contained in:
@@ -128,10 +128,11 @@ func (c *vCPU) KernelSyscall() {
|
||||
func (c *vCPU) KernelException(vector ring0.Vector) {
|
||||
regs := c.Registers()
|
||||
if vector == ring0.Vector(bounce) {
|
||||
// These should not interrupt kernel execution; point the Rip
|
||||
// to zero to ensure that we get a reasonable panic when we
|
||||
// attempt to return and a full stack trace.
|
||||
regs.Rip = 0
|
||||
// This go-routine was saved in hr3 and resumed in gr0 with the
|
||||
// userspace flags. Let's adjust flags and skip the interrupt.
|
||||
regs.Eflags &^= uint64(ring0.KernelFlagsClear)
|
||||
regs.Eflags |= ring0.KernelFlagsSet
|
||||
return
|
||||
}
|
||||
// See above.
|
||||
ring0.HaltAndWriteFSBase(regs) // escapes: no, reload host segment.
|
||||
|
||||
@@ -221,7 +221,6 @@ func bluepillHandler(context unsafe.Pointer) {
|
||||
c.die(bluepillArchContext(context), "entry failed")
|
||||
return
|
||||
default:
|
||||
printHex([]byte("exitReason="), uint64(c.runData.exitReason))
|
||||
bluepillArchHandleExit(c, context)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user