Skip to content

Commit

Permalink
Bug 1320085 - Allow the getrlimit-equivalent subset of prlimit64. r=tedd
Browse files Browse the repository at this point in the history
This applies only to content processes, where we already allow getrlimit
(but not setrlimit).  The rule added here does not allow using prlimit64
to set any resource limits or interact with any other process.

MozReview-Commit-ID: nMry3t6QPj

--HG--
extra : rebase_source : ecf792077a672ab1f2c5edf9fbeb915a0d8dd30e
  • Loading branch information
jld authored and gk-tpo committed Sep 22, 2017
1 parent 4a18488 commit c49eeeb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions security/sandbox/linux/SandboxFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,18 @@ class ContentSandboxPolicy : public SandboxPolicyCommon {
CASES_FOR_getresgid:
return Allow();

case __NR_prlimit64: {
// Allow only the getrlimit() use case. (glibc seems to use
// only pid 0 to indicate the current process; pid == getpid()
// is equivalent and could also be allowed if needed.)
Arg<pid_t> pid(0);
// This is really a const struct ::rlimit*, but Arg<> doesn't
// work with pointers, only integer types.
Arg<uintptr_t> new_limit(2);
return If(AllOf(pid == 0, new_limit == 0), Allow())
.Else(InvalidSyscall());
}

case __NR_umask:
case __NR_kill:
case __NR_wait4:
Expand Down

0 comments on commit c49eeeb

Please sign in to comment.