diff options
Diffstat (limited to 'pkg/sentry/platform/kvm')
-rw-r--r-- | pkg/sentry/platform/kvm/bluepill.go | 9 | ||||
-rw-r--r-- | pkg/sentry/platform/kvm/machine.go | 12 |
2 files changed, 14 insertions, 7 deletions
diff --git a/pkg/sentry/platform/kvm/bluepill.go b/pkg/sentry/platform/kvm/bluepill.go index d98ec8377..f24f1c662 100644 --- a/pkg/sentry/platform/kvm/bluepill.go +++ b/pkg/sentry/platform/kvm/bluepill.go @@ -49,7 +49,7 @@ var ( // //go:nosplit func dieHandler(c *vCPU) { - throw(c.dieMessage) + throw(c.dieState.message) } // die is called to set the vCPU up to panic. @@ -59,17 +59,16 @@ func dieHandler(c *vCPU) { //go:nosplit func (c *vCPU) die(context *arch.SignalContext64, msg string) { // Save the death message, which will be thrown. - c.dieMessage = msg + c.dieState.message = msg // Reload all registers to have an accurate stack trace when we return // to host mode. This means that the stack should be unwound correctly. - var guestRegs userRegs - if errno := c.getUserRegisters(&guestRegs); errno != 0 { + if errno := c.getUserRegisters(&c.dieState.guestRegs); errno != 0 { throw(msg) } // Setup the trampoline. - dieArchSetup(c, context, &guestRegs) + dieArchSetup(c, context, &c.dieState.guestRegs) } func init() { diff --git a/pkg/sentry/platform/kvm/machine.go b/pkg/sentry/platform/kvm/machine.go index deead1b5f..b8b3c9a4a 100644 --- a/pkg/sentry/platform/kvm/machine.go +++ b/pkg/sentry/platform/kvm/machine.go @@ -121,8 +121,16 @@ type vCPU struct { // vCPUArchState is the architecture-specific state. vCPUArchState - // dieMessage is thrown from die. - dieMessage string + dieState dieState +} + +type dieState struct { + // message is thrown from die. + message string + + // guestRegs is used to store register state during vCPU.die() to prevent + // allocation inside nosplit function. + guestRegs userRegs } // newVCPU creates a returns a new vCPU. |