summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel/task_exec.go
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2019-06-05 13:59:01 -0700
committerShentubot <shentubot@google.com>2019-06-05 14:00:13 -0700
commitd3ed9baac0dc967eaf6d3e3f986cafe60604121a (patch)
tree47121539775297207ba205b60b136c9093d5d393 /pkg/sentry/kernel/task_exec.go
parentcecb71dc37a77d8e4e88cdfada92a37a72c67602 (diff)
Implement dumpability tracking and checks
We don't actually support core dumps, but some applications want to get/set dumpability, which still has an effect in procfs. Lack of support for set-uid binaries or fs creds simplifies things a bit. As-is, processes started via CreateProcess (i.e., init and sentryctl exec) have normal dumpability. I'm a bit torn on whether sentryctl exec tasks should be dumpable, but at least since they have no parent normal UID/GID checks should protect them. PiperOrigin-RevId: 251712714
Diffstat (limited to 'pkg/sentry/kernel/task_exec.go')
-rw-r--r--pkg/sentry/kernel/task_exec.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/sentry/kernel/task_exec.go b/pkg/sentry/kernel/task_exec.go
index 5d1425d5c..35d5cb90c 100644
--- a/pkg/sentry/kernel/task_exec.go
+++ b/pkg/sentry/kernel/task_exec.go
@@ -68,6 +68,7 @@ import (
"gvisor.googlesource.com/gvisor/pkg/abi/linux"
"gvisor.googlesource.com/gvisor/pkg/sentry/arch"
"gvisor.googlesource.com/gvisor/pkg/sentry/fs"
+ "gvisor.googlesource.com/gvisor/pkg/sentry/mm"
"gvisor.googlesource.com/gvisor/pkg/syserror"
)
@@ -198,6 +199,12 @@ func (r *runSyscallAfterExecStop) execute(t *Task) taskRunState {
return flags.CloseOnExec
})
+ // NOTE(b/30815691): We currently do not implement privileged
+ // executables (set-user/group-ID bits and file capabilities). This
+ // allows us to unconditionally enable user dumpability on the new mm.
+ // See fs/exec.c:setup_new_exec.
+ r.tc.MemoryManager.SetDumpability(mm.UserDumpable)
+
// Switch to the new process.
t.MemoryManager().Deactivate()
t.mu.Lock()