diff options
author | Kevin Krakauer <krakauer@google.com> | 2020-04-17 15:31:51 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-04-17 15:33:05 -0700 |
commit | e838290e671c9d72dbaa3aba13bf0c35f1147de4 (patch) | |
tree | b99612b463da2f05a5454417d4d3c98e048096a5 /pkg | |
parent | 486759a37d61b770019a81af00e0e733c655b3a8 (diff) |
prlimit: don't check credentials on self
prlimit was erroneously comparing UIDs and GIDs when getting/setting a process'
own limits. From the manpage:
To set or get the resources of a process other than itself, the caller must have
the CAP_SYS_RESOURCE capability, or the real, effective, and saved set user IDs
of the target process must match the real user ID of the caller and the real,
effective, and saved set group IDs of the target process must match the real
group ID of the caller.
PiperOrigin-RevId: 307127266
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/sentry/syscalls/linux/sys_rlimit.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/sentry/syscalls/linux/sys_rlimit.go b/pkg/sentry/syscalls/linux/sys_rlimit.go index e08c333d6..d5d5b6959 100644 --- a/pkg/sentry/syscalls/linux/sys_rlimit.go +++ b/pkg/sentry/syscalls/linux/sys_rlimit.go @@ -197,7 +197,7 @@ func Prlimit64(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Sys // saved set user IDs of the target process must match the real user ID of // the caller and the real, effective, and saved set group IDs of the // target process must match the real group ID of the caller." - if !t.HasCapabilityIn(linux.CAP_SYS_RESOURCE, t.PIDNamespace().UserNamespace()) { + if ot != t && !t.HasCapabilityIn(linux.CAP_SYS_RESOURCE, t.PIDNamespace().UserNamespace()) { cred, tcred := t.Credentials(), ot.Credentials() if cred.RealKUID != tcred.RealKUID || cred.RealKUID != tcred.EffectiveKUID || |