All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Ellerman <michael@ellerman.id.au>
To: trinity@vger.kernel.org
Subject: [PATCH] Sanitise F_SETSIG argument to avoid SIGINT
Date: Wed, 19 Jun 2013 19:02:58 +1000	[thread overview]
Message-ID: <1371632578-24654-1-git-send-email-michael@ellerman.id.au> (raw)

It's possible to send ourselves a SIGINT using F_SETSIG. This is then
interpreted as a Ctrl-c from the user and trinity quits.

Avoid SIGINT, instead use 0, which switches back to the default
behaviour of sending SIGIO.
---
 syscalls/fcntl.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/syscalls/fcntl.c b/syscalls/fcntl.c
index 5d651af..e13735d 100644
--- a/syscalls/fcntl.c
+++ b/syscalls/fcntl.c
@@ -18,6 +18,7 @@
  */
 
 #include <fcntl.h>
+#include <signal.h>
 #include "random.h"
 #include "sanitise.h"
 #include "shm.h"
@@ -90,6 +91,8 @@ void sanitise_fcntl(int childno)
 
 	case F_SETSIG:
 		shm->a3[childno] = (unsigned long) rand32();
+		if (shm->a3[childno] == SIGINT)
+			shm->a3[childno] = 0; /* restore default (SIGIO) */
 		break;
 
 	case F_NOTIFY:
-- 
1.7.10.4

             reply	other threads:[~2013-06-19  9:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-19  9:02 Michael Ellerman [this message]
2013-06-19 15:11 ` [PATCH] Sanitise F_SETSIG argument to avoid SIGINT Dave Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1371632578-24654-1-git-send-email-michael@ellerman.id.au \
    --to=michael@ellerman.id.au \
    --cc=trinity@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.