mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Fix "-c dbg" build break
Remove allocation from vCPU.die() to save stack space. Closes #131 PiperOrigin-RevId: 236238102 Change-Id: Iafca27a1a3a472d4cb11dcda9a2060e585139d11
This commit is contained in:
committed by
Shentubot
parent
3851705a73
commit
3b44377eda
+7
-2
@@ -71,11 +71,13 @@ BAZEL_BUILD_RBE_FLAGS=(
|
||||
####################
|
||||
|
||||
build_everything() {
|
||||
FLAVOR="${1}"
|
||||
|
||||
cd ${WORKSPACE_DIR}
|
||||
bazel \
|
||||
"${BAZEL_RBE_FLAGS[@]}" \
|
||||
build \
|
||||
"${BAZEL_BUILD_RBE_FLAGS[@]}" \
|
||||
-c "${FLAVOR}" "${BAZEL_BUILD_RBE_FLAGS[@]}" \
|
||||
"${BUILD_PACKAGES[@]}"
|
||||
}
|
||||
|
||||
@@ -217,7 +219,7 @@ main() {
|
||||
trap finish EXIT
|
||||
|
||||
# Build and run the simple tests.
|
||||
build_everything
|
||||
build_everything opt
|
||||
run_simple_tests
|
||||
|
||||
# So far so good. Install more deps and run the integration tests.
|
||||
@@ -228,6 +230,9 @@ main() {
|
||||
|
||||
run_syscall_tests
|
||||
|
||||
# Build other flavors too.
|
||||
build_everything dbg
|
||||
|
||||
# No need to call "finish" here, it will happen at exit.
|
||||
}
|
||||
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user