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

Side by Side 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, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <fcntl.h> 8 #include <fcntl.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <linux/net.h> 10 #include <linux/net.h>
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 sandbox->Cond(0, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL, 204 sandbox->Cond(0, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL,
205 SYS_SHUTDOWN, ErrorCode(ErrorCode::ERR_ALLOWED), 205 SYS_SHUTDOWN, ErrorCode(ErrorCode::ERR_ALLOWED),
206 sandbox->Cond(0, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL, 206 sandbox->Cond(0, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL,
207 SYS_SENDMSG, ErrorCode(ErrorCode::ERR_ALLOWED), 207 SYS_SENDMSG, ErrorCode(ErrorCode::ERR_ALLOWED),
208 sandbox->Cond(0, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL, 208 sandbox->Cond(0, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL,
209 SYS_RECVMSG, ErrorCode(ErrorCode::ERR_ALLOWED), 209 SYS_RECVMSG, ErrorCode(ErrorCode::ERR_ALLOWED),
210 ErrorCode(EPERM))))))))); 210 ErrorCode(EPERM)))))))));
211 } 211 }
212 #endif 212 #endif
213 213
214 ErrorCode RestrictKillTarget(pid_t target_pid, SandboxBPF* sandbox, int sysno) {
215 switch (sysno) {
216 case __NR_kill:
217 case __NR_tgkill:
218 return sandbox->Cond(0, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL,
219 target_pid,
220 ErrorCode(ErrorCode::ERR_ALLOWED),
221 sandbox->Trap(SIGSYSKillFailure, NULL));
222 case __NR_tkill:
223 return sandbox->Trap(SIGSYSKillFailure, NULL);
224 default:
225 NOTREACHED();
226 return sandbox->Trap(CrashSIGSYS_Handler, NULL);
227 }
228 }
229
214 } // namespace sandbox. 230 } // namespace sandbox.
OLDNEW
« 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