Skip to content

Commit a7d14a7

Browse files
cblichmanncopybara-github
authored andcommitted
Add PolicyBuilder::AllowKill() convenience function
Allows the `kill`, `tgkill`, and `tkill` syscalls, enabling sandboxees to send signals to other processes or threads. PiperOrigin-RevId: 910613950 Change-Id: I01919b471abcfa360dc93c1f379f99eb91be4f63
1 parent d7fb657 commit a7d14a7

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

sandboxed_api/sandbox2/policybuilder.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,6 +1050,16 @@ PolicyBuilder& PolicyBuilder::AllowHandleSignals() {
10501050
});
10511051
}
10521052

1053+
PolicyBuilder& PolicyBuilder::AllowKill() {
1054+
return AllowSyscalls({
1055+
__NR_kill,
1056+
__NR_tgkill,
1057+
#ifdef __NR_tkill
1058+
__NR_tkill, // Deprecated in favor of tgkill.
1059+
#endif
1060+
});
1061+
}
1062+
10531063
PolicyBuilder& PolicyBuilder::AllowTCGETS() {
10541064
if (allowed_complex_.tcgets) {
10551065
return *this;

sandboxed_api/sandbox2/policybuilder.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,15 @@ class PolicyBuilder final {
549549
// - sigprocmask (on architectures where it exists)
550550
PolicyBuilder& AllowHandleSignals();
551551

552-
// Appends code to allow doing the TCGETS ioctl.
552+
// Appends code to allow sending signals to processes/threads.
553+
//
554+
// Allows these syscalls:
555+
// - kill
556+
// - tgkill
557+
// - tkill (discouraged, but still used by some binaries)
558+
PolicyBuilder& AllowKill();
559+
560+
// Appends code to allow the TCGETS ioctl.
553561
//
554562
// Allows these syscalls:
555563
// - ioctl (when the first argument is TCGETS)

0 commit comments

Comments
 (0)