From patchwork Sat Sep 29 16:11:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2/2] signal: sigsegv protection on do_sigprocmask Date: Sat, 29 Sep 2012 06:11:26 -0000 From: Alex Barcelo X-Patchwork-Id: 188035 Message-Id: <1348935086-11336-3-git-send-email-abarcelo@ac.upc.edu> To: Cc: Riku Voipio , Alex Barcelo The sigsegv protection is done by forcing the catch (needed in qemu-user) and then taking it off from the return mask (well, adding it in fact) --- linux-user/signal.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/linux-user/signal.c b/linux-user/signal.c index b8b8268..8764f57 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -5468,7 +5468,14 @@ long do_rt_sigreturn(CPUArchState *env) */ int do_sigprocmask(int how, const sigset_t *set, sigset_t *oldset) { - return sigprocmask(how, set, oldset); + int ret; + sigset_t temp = *set; + if (set) { + sigdelset(&temp, SIGSEGV); + } + ret = sigprocmask(how, &temp, oldset); + sigaddset(oldset, SIGSEGV); + return ret; } void process_pending_signals(CPUArchState *cpu_env)