Skip to content

Commit 094dd52

Browse files
avagingvisor-bot
authored andcommitted
kernel: handle MemoryManager().Activate() errors
Report panic just like Task.Active. Otherwise, it can report misleading errors like: "panic: trying to use inactive address space?" PiperOrigin-RevId: 791013732
1 parent 63cd8cc commit 094dd52

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pkg/sentry/kernel/task_exec.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,10 @@ import (
7474
"gvisor.dev/gvisor/pkg/log"
7575
"gvisor.dev/gvisor/pkg/sentry/mm"
7676
"gvisor.dev/gvisor/pkg/sentry/seccheck"
77-
pb "gvisor.dev/gvisor/pkg/sentry/seccheck/points/points_go_proto"
7877
"gvisor.dev/gvisor/pkg/sentry/vfs"
7978
"gvisor.dev/gvisor/pkg/usermem"
79+
80+
pb "gvisor.dev/gvisor/pkg/sentry/seccheck/points/points_go_proto"
8081
)
8182

8283
// execStop is a TaskStop that a task sets on itself when it wants to execve
@@ -261,7 +262,9 @@ func (r *runSyscallAfterExecStop) execute(t *Task) taskRunState {
261262
t.unstopVforkParent()
262263
t.p.FullStateChanged()
263264
// NOTE(b/30316266): All locks must be dropped prior to calling Activate.
264-
t.MemoryManager().Activate(t)
265+
if err := t.MemoryManager().Activate(t); err != nil {
266+
panic("unable to activate mm: " + err.Error())
267+
}
265268

266269
t.ptraceExec(oldTID)
267270
return (*runSyscallExit)(nil)

0 commit comments

Comments
 (0)