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

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

Issue 598203004: Linux sandbox: Restrict sched_* syscalls on the GPU and ppapi processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename to policy_pid, add SANDBOX_EXPORT. Created 6 years, 3 months 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/baseline_policy.cc
diff --git a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
index aa347de39f4a53a6d7caf19612ababb653eb53ac..b1546228812bec13de206b4474daf0c6f533df5f 100644
--- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
+++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
@@ -234,16 +234,15 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
// Unfortunately C++03 doesn't allow delegated constructors.
// Call other constructor when C++11 lands.
-BaselinePolicy::BaselinePolicy()
- : fs_denied_errno_(EPERM), current_pid_(syscall(__NR_getpid)) {}
+BaselinePolicy::BaselinePolicy() : BaselinePolicy(EPERM) {}
BaselinePolicy::BaselinePolicy(int fs_denied_errno)
- : fs_denied_errno_(fs_denied_errno), current_pid_(syscall(__NR_getpid)) {}
+ : fs_denied_errno_(fs_denied_errno), policy_pid_(syscall(__NR_getpid)) {}
BaselinePolicy::~BaselinePolicy() {
// Make sure that this policy is created, used and destroyed by a single
// process.
- DCHECK_EQ(syscall(__NR_getpid), current_pid_);
+ DCHECK_EQ(syscall(__NR_getpid), policy_pid_);
}
ResultExpr BaselinePolicy::EvaluateSyscall(int sysno) const {
@@ -251,9 +250,9 @@ ResultExpr BaselinePolicy::EvaluateSyscall(int sysno) const {
DCHECK(SandboxBPF::IsValidSyscallNumber(sysno));
// Make sure that this policy is used in the creating process.
if (1 == sysno) {
- DCHECK_EQ(syscall(__NR_getpid), current_pid_);
+ DCHECK_EQ(syscall(__NR_getpid), policy_pid_);
}
- return EvaluateSyscallImpl(fs_denied_errno_, current_pid_, sysno);
+ return EvaluateSyscallImpl(fs_denied_errno_, policy_pid_, sysno);
}
ResultExpr BaselinePolicy::InvalidSyscall() const {

Powered by Google App Engine
This is Rietveld 408576698