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

Side by Side Diff: sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions_unittests.cc

Issue 787803004: Update from https://crrev.com/307664 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase. Created 6 years 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 unified diff | Download patch
« no previous file with comments | « net/url_request/url_request_unittest.cc ('k') | sandbox/linux/services/syscall_wrappers.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h" 5 #include "sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <sched.h> 8 #include <sched.h>
9 #include <sys/resource.h> 9 #include <sys/resource.h>
10 #include <sys/syscall.h> 10 #include <sys/syscall.h>
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 switch (sysno) { 220 switch (sysno) {
221 case __NR_prlimit64: 221 case __NR_prlimit64:
222 return RestrictPrlimit64(getpid()); 222 return RestrictPrlimit64(getpid());
223 default: 223 default:
224 return Allow(); 224 return Allow();
225 } 225 }
226 } 226 }
227 }; 227 };
228 228
229 BPF_TEST_C(ParameterRestrictions, prlimit64_allowed, RestrictPrlimit64Policy) { 229 BPF_TEST_C(ParameterRestrictions, prlimit64_allowed, RestrictPrlimit64Policy) {
230 BPF_ASSERT_EQ(0, syscall(__NR_prlimit64, 0, RLIMIT_AS, NULL, NULL)); 230 BPF_ASSERT_EQ(0, sys_prlimit64(0, RLIMIT_AS, NULL, NULL));
231 BPF_ASSERT_EQ(0, syscall(__NR_prlimit64, getpid(), RLIMIT_AS, NULL, NULL)); 231 BPF_ASSERT_EQ(0, sys_prlimit64(getpid(), RLIMIT_AS, NULL, NULL));
232 } 232 }
233 233
234 BPF_DEATH_TEST_C(ParameterRestrictions, 234 BPF_DEATH_TEST_C(ParameterRestrictions,
235 prlimit64_crash_not_self, 235 prlimit64_crash_not_self,
236 DEATH_SEGV_MESSAGE(sandbox::GetErrorMessageContentForTests()), 236 DEATH_SEGV_MESSAGE(sandbox::GetErrorMessageContentForTests()),
237 RestrictPrlimit64Policy) { 237 RestrictPrlimit64Policy) {
238 const pid_t kInitPID = 1; 238 const pid_t kInitPID = 1;
239 BPF_ASSERT_NE(kInitPID, getpid()); 239 BPF_ASSERT_NE(kInitPID, getpid());
240 syscall(__NR_prlimit64, kInitPID, RLIMIT_AS, NULL, NULL); 240 sys_prlimit64(kInitPID, RLIMIT_AS, NULL, NULL);
241 } 241 }
242 242
243 } // namespace 243 } // namespace
244 244
245 } // namespace sandbox 245 } // namespace sandbox
OLDNEW
« no previous file with comments | « net/url_request/url_request_unittest.cc ('k') | sandbox/linux/services/syscall_wrappers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698