Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Unified Diff: sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc

Issue 2484393004: Linux Sandbox: Whitelist prlimit64 when used as getrlimit (Closed)
Patch Set: Linux Sandbox: Whitelist prlimit64 when used as getrlimit Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
index 43f633ed78e398654441e2c182b1614ce0176360..83b7c8b784f7d210df5dadb0340fd9486539f4a6 100644
--- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
@@ -361,4 +361,12 @@ ResultExpr RestrictGetRandom() {
return If((flags & ~kGoodFlags) == 0, Allow()).Else(CrashSIGSYS());
}
+ResultExpr RestrictPrlimitToGetrlimit(pid_t target_pid) {
+ const Arg<pid_t> pid(0);
+ const Arg<uintptr_t> new_limit(0);
Jorge Lucangeli Obes 2016/11/22 16:06:39 They cannot both be argument index 0, can they? i
Daniel Kurtz 2016/11/23 00:21:14 https://codesearch.chromium.org/chromium/src/sandb
+ // Only allow 'get' operations, and only for the current process
+ return If(AllOf(new_limit == 0, AnyOf(pid == 0, pid == target_pid)), Allow())
+ .Else(Error(EPERM));
+}
+
} // namespace sandbox.

Powered by Google App Engine
This is Rietveld 408576698