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

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

Issue 258073008: Linux sandbox: restrict *kill to the current process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: One nit disappeared :) Created 6 years, 8 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/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 9b417ce221f8ba18225eebf108ffc4890ac417eb..e0e1ddca59dd3a8be9282256b02fa99f1d0ccb6e 100644
--- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
@@ -211,4 +211,20 @@ ErrorCode RestrictSocketcallCommand(SandboxBPF* sandbox) {
}
#endif
+ErrorCode RestrictKillTarget(pid_t target_pid, SandboxBPF* sandbox, int sysno) {
+ switch (sysno) {
+ case __NR_kill:
+ case __NR_tgkill:
+ return sandbox->Cond(0, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL,
+ target_pid,
+ ErrorCode(ErrorCode::ERR_ALLOWED),
+ sandbox->Trap(SIGSYSKillFailure, NULL));
+ case __NR_tkill:
+ return sandbox->Trap(SIGSYSKillFailure, NULL);
+ default:
+ NOTREACHED();
+ return sandbox->Trap(CrashSIGSYS_Handler, NULL);
+ }
+}
+
} // namespace sandbox.
« no previous file with comments | « sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h ('k') | sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698