Commit 01cd469f authored by jln@chromium.org's avatar jln@chromium.org

Linux sandbox: allow *kill on ASAN

Restricting *kill on ASAN is crashing somehow. Allow *kill on ASAN for
now.

BUG=367986
R=jorgelo@chromium.org, mdempsky@chromium.org

Review URL: https://codereview.chromium.org/261543003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267005 0039d316-1c4b-4281-b951-d872f2087c98
parent 07190030
...@@ -65,6 +65,7 @@ namespace sandbox { ...@@ -65,6 +65,7 @@ namespace sandbox {
ErrorCode RestrictCloneToThreadsAndEPERMFork(SandboxBPF* sandbox) { ErrorCode RestrictCloneToThreadsAndEPERMFork(SandboxBPF* sandbox) {
// Glibc's pthread. // Glibc's pthread.
// TODO(jln): fix this on ASAN.
if (!RunningOnASAN()) { if (!RunningOnASAN()) {
return sandbox->Cond(0, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL, return sandbox->Cond(0, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL,
CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND |
...@@ -212,18 +213,35 @@ ErrorCode RestrictSocketcallCommand(SandboxBPF* sandbox) { ...@@ -212,18 +213,35 @@ ErrorCode RestrictSocketcallCommand(SandboxBPF* sandbox) {
#endif #endif
ErrorCode RestrictKillTarget(pid_t target_pid, SandboxBPF* sandbox, int sysno) { ErrorCode RestrictKillTarget(pid_t target_pid, SandboxBPF* sandbox, int sysno) {
switch (sysno) { if (!RunningOnASAN()) {
case __NR_kill: switch (sysno) {
case __NR_tgkill: case __NR_kill:
return sandbox->Cond(0, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL, case __NR_tgkill:
target_pid, return sandbox->Cond(0,
ErrorCode(ErrorCode::ERR_ALLOWED), ErrorCode::TP_32BIT,
sandbox->Trap(SIGSYSKillFailure, NULL)); ErrorCode::OP_EQUAL,
case __NR_tkill: target_pid,
return sandbox->Trap(SIGSYSKillFailure, NULL); ErrorCode(ErrorCode::ERR_ALLOWED),
default: sandbox->Trap(SIGSYSKillFailure, NULL));
NOTREACHED(); case __NR_tkill:
return sandbox->Trap(CrashSIGSYS_Handler, NULL); return sandbox->Trap(SIGSYSKillFailure, NULL);
default:
NOTREACHED();
return sandbox->Trap(CrashSIGSYS_Handler, NULL);
}
} else {
switch (sysno) {
case __NR_kill:
case __NR_tgkill:
case __NR_tkill:
// On ASAN, fork() is not properly denied. This could lead to the
// strange failures we're observing with this policy on ASAN.
// TODO(jln): fix this.
return ErrorCode(ErrorCode::ERR_ALLOWED);
default:
NOTREACHED();
return sandbox->Trap(CrashSIGSYS_Handler, NULL);
}
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment