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

Unified Diff: sandbox/linux/seccomp-bpf/die.cc

Issue 1077143002: Introduce sys_sigprocmask and sys_sigaction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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/die.cc
diff --git a/sandbox/linux/seccomp-bpf/die.cc b/sandbox/linux/seccomp-bpf/die.cc
index 777c9d1139298f46d78bb1ef0a97667b48414015..a014e7fbcf7bed796d3132884351ca000b936f57 100644
--- a/sandbox/linux/seccomp-bpf/die.cc
+++ b/sandbox/linux/seccomp-bpf/die.cc
@@ -16,6 +16,8 @@
#include "base/logging.h"
#include "base/posix/eintr_wrapper.h"
#include "sandbox/linux/seccomp-bpf/syscall.h"
+#include "sandbox/linux/services/syscall_wrappers.h"
+#include "sandbox/linux/system_headers/linux_signal.h"
namespace sandbox {
@@ -32,7 +34,11 @@ void Die::ExitGroup() {
// to a defined state; but we have not way to verify whether we actually
// succeeded in doing so. Nonetheless, triggering a fatal signal could help
// us terminate.
- signal(SIGSEGV, SIG_DFL);
+ struct sigaction sa = {};
+ sa.sa_handler = LINUX_SIG_DFL;
+ sa.sa_flags = LINUX_SA_RESTART;
+ sigaddset(&sa.sa_mask, LINUX_SIGSEGV);
mdempsky 2015/04/13 18:55:07 With POSIX sigaction(), SIGSEGV would be masked au
hidehiko 2015/04/14 11:56:40 IIUC, SIGSEGV is masked in the handler invocation
mdempsky 2015/04/17 04:36:22 Sorry, what I meant was: 1. Setting sa_mask is
hidehiko 2015/04/17 06:18:41 Oh, I misunderstood, and now fixed. Thanks!
+ sys_sigaction(LINUX_SIGSEGV, &sa, nullptr);
Syscall::Call(__NR_prctl, PR_SET_DUMPABLE, (void*)0, (void*)0, (void*)0);
if (*(volatile char*)0) {
}

Powered by Google App Engine
This is Rietveld 408576698