| Index: sandbox/linux/seccomp-bpf/sandbox_bpf_unittest.cc
|
| diff --git a/sandbox/linux/seccomp-bpf/sandbox_bpf_unittest.cc b/sandbox/linux/seccomp-bpf/sandbox_bpf_unittest.cc
|
| index ce54f875cc5d8a0dd96c13dca898c421d7bd5397..41711391e7b57b84198a9e8e159d8480d74e3ac1 100644
|
| --- a/sandbox/linux/seccomp-bpf/sandbox_bpf_unittest.cc
|
| +++ b/sandbox/linux/seccomp-bpf/sandbox_bpf_unittest.cc
|
| @@ -66,7 +66,7 @@ void StartSandboxOrDie(Sandbox::EvaluateSyscall evaluator) {
|
| void RunInSandbox(Sandbox::EvaluateSyscall evaluator,
|
| void (*SandboxedCode)()) {
|
| // TODO(jln): Implement IsEqual for ErrorCode
|
| - // IsEqual(evaluator(__NR_exit_group), Sandbox::SB_ALLOWED) <<
|
| + // IsEqual(evaluator(__NR_exit_group), ErrorCode::ERR_ALLOWED) <<
|
| // "You need to always allow exit_group() in your test policy";
|
| StartSandboxOrDie(evaluator);
|
| // TODO(jln): find a way to use the testing framework inside
|
| @@ -92,7 +92,7 @@ void TryPolicyInProcess(Sandbox::EvaluateSyscall evaluator,
|
|
|
| // A simple blacklist test
|
|
|
| -Sandbox::ErrorCode BlacklistNanosleepPolicy(int sysno) {
|
| +ErrorCode BlacklistNanosleepPolicy(int sysno) {
|
| if (sysno < static_cast<int>(MIN_SYSCALL) ||
|
| sysno > static_cast<int>(MAX_SYSCALL)) {
|
| // FIXME: we should really not have to do that in a trivial policy
|
| @@ -102,7 +102,7 @@ Sandbox::ErrorCode BlacklistNanosleepPolicy(int sysno) {
|
| case __NR_nanosleep:
|
| return EACCES;
|
| default:
|
| - return Sandbox::SB_ALLOWED;
|
| + return ErrorCode::ERR_ALLOWED;
|
| }
|
| }
|
|
|
| @@ -121,11 +121,11 @@ TEST(SandboxBpf, ApplyBasicBlacklistPolicy) {
|
|
|
| // Now do a simple whitelist test
|
|
|
| -Sandbox::ErrorCode WhitelistGetpidPolicy(int sysno) {
|
| +ErrorCode WhitelistGetpidPolicy(int sysno) {
|
| switch (sysno) {
|
| case __NR_getpid:
|
| case __NR_exit_group:
|
| - return Sandbox::SB_ALLOWED;
|
| + return ErrorCode::ERR_ALLOWED;
|
| default:
|
| return ENOMEM;
|
| }
|
| @@ -161,7 +161,7 @@ intptr_t EnomemHandler(const struct arch_seccomp_data& args, void *aux) {
|
| return -ENOMEM;
|
| }
|
|
|
| -Sandbox::ErrorCode BlacklistNanosleepPolicySigsys(int sysno) {
|
| +ErrorCode BlacklistNanosleepPolicySigsys(int sysno) {
|
| if (sysno < static_cast<int>(MIN_SYSCALL) ||
|
| sysno > static_cast<int>(MAX_SYSCALL)) {
|
| // FIXME: we should really not have to do that in a trivial policy
|
| @@ -169,10 +169,10 @@ Sandbox::ErrorCode BlacklistNanosleepPolicySigsys(int sysno) {
|
| }
|
| switch (sysno) {
|
| case __NR_nanosleep:
|
| - return Sandbox::ErrorCode(EnomemHandler,
|
| + return Sandbox::Trap(EnomemHandler,
|
| static_cast<void *>(&BlacklistNanosleepPolicySigsysAuxData));
|
| default:
|
| - return Sandbox::SB_ALLOWED;
|
| + return ErrorCode::ERR_ALLOWED;
|
| }
|
| }
|
|
|
| @@ -213,7 +213,7 @@ int SysnoToRandomErrno(int sysno) {
|
| return ((sysno & ~3) >> 2) % 29 + 1;
|
| }
|
|
|
| -Sandbox::ErrorCode SyntheticPolicy(int sysno) {
|
| +ErrorCode SyntheticPolicy(int sysno) {
|
| if (sysno < static_cast<int>(MIN_SYSCALL) ||
|
| sysno > static_cast<int>(MAX_SYSCALL)) {
|
| // FIXME: we should really not have to do that in a trivial policy.
|
| @@ -221,7 +221,7 @@ Sandbox::ErrorCode SyntheticPolicy(int sysno) {
|
| }
|
| if (sysno == __NR_exit_group) {
|
| // exit_group() is special, we really need it to work.
|
| - return Sandbox::SB_ALLOWED;
|
| + return ErrorCode::ERR_ALLOWED;
|
| } else {
|
| return SysnoToRandomErrno(sysno);
|
| }
|
|
|