All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Sanitise F_SETSIG argument to avoid SIGINT
@ 2013-06-19  9:02 Michael Ellerman
  2013-06-19 15:11 ` Dave Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Ellerman @ 2013-06-19  9:02 UTC (permalink / raw)
  To: trinity

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Sanitise F_SETSIG argument to avoid SIGINT
  2013-06-19  9:02 [PATCH] Sanitise F_SETSIG argument to avoid SIGINT Michael Ellerman
@ 2013-06-19 15:11 ` Dave Jones
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Jones @ 2013-06-19 15:11 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: trinity

On Wed, Jun 19, 2013 at 07:02:58PM +1000, Michael Ellerman wrote:
 > 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.

excellent, thanks for tracking that down. 

this and the other two patches applied and pushed out.

	Dave

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-19 15:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-19  9:02 [PATCH] Sanitise F_SETSIG argument to avoid SIGINT Michael Ellerman
2013-06-19 15:11 ` Dave Jones

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.