public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* emergency or init=/bin/sh mode and terminal signals
@ 2006-06-18 21:23 Samuel Thibault
  2006-06-18 21:33 ` Willy Tarreau
                   ` (3 more replies)
  0 siblings, 4 replies; 30+ messages in thread
From: Samuel Thibault @ 2006-06-18 21:23 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 578 bytes --]

Hi,

There's a long-standing issue in init=/bin/sh mode: pressing control-C
doesn't send a SIGINT to programs running on the console. The incurred
typical pitfall is if one runs ping without a -c option... no way to
stop it!

This is because no session is set up by the kernel, and shells don't
start sessions on their own, so that no session (hence no controlling
tty) is set up.

The attached patch sets such session and controlling tty up, which fixes
the issue. The unfortunate effect is that init might be killed if one
presses control-C very fast after its start.

Samuel

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 460 bytes --]

--- linux-2.6.17-orig/init/main.c	2006-06-18 19:22:40.000000000 +0200
+++ linux-2.6.17-perso/init/main.c	2006-06-18 23:00:00.000000000 +0200
@@ -703,9 +703,13 @@
 	system_state = SYSTEM_RUNNING;
 	numa_default_policy();
 
+	sys_setsid();
+
 	if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
 		printk(KERN_WARNING "Warning: unable to open an initial console.\n");
 
+	sys_ioctl(0, TIOCSCTTY, 1);
+
 	(void) sys_dup(0);
 	(void) sys_dup(0);
 

^ permalink raw reply	[flat|nested] 30+ messages in thread
* Re: emergency or init=/bin/sh mode and terminal signals
@ 2006-06-19  3:47 Albert Cahalan
  2006-06-19  8:57 ` Samuel Thibault
  0 siblings, 1 reply; 30+ messages in thread
From: Albert Cahalan @ 2006-06-19  3:47 UTC (permalink / raw)
  To: linux-kernel, samuel.thibault

Samuel Thibault writes:

> The attached patch sets such session and controlling tty up, which fixes
> the issue. The unfortunate effect is that init might be killed if one
> presses control-C very fast after its start.

Doesn't the kernel protect process 1 from any signal
that it does not have a handler for?

I think there is no problem.

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

end of thread, other threads:[~2006-07-01 14:59 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-18 21:23 emergency or init=/bin/sh mode and terminal signals Samuel Thibault
2006-06-18 21:33 ` Willy Tarreau
2006-06-19 22:03   ` Samuel Thibault
2006-06-20 11:15     ` linux-os (Dick Johnson)
2006-06-18 22:39 ` Wakko Warner
2006-06-18 22:40   ` Samuel Thibault
2006-06-18 22:44     ` Willy Tarreau
2006-06-18 22:48       ` Samuel Thibault
2006-06-19  3:59         ` Willy Tarreau
2006-06-19  7:59           ` Samuel Thibault
2006-06-18 22:52     ` Wakko Warner
2006-06-18 23:25       ` Joshua Hudson
2006-06-19 11:37 ` linux-os (Dick Johnson)
2006-06-19 11:46   ` Samuel Thibault
2006-06-19 12:05     ` linux-os (Dick Johnson)
2006-06-19 22:06       ` Samuel Thibault
2006-06-21 11:53     ` linux-os (Dick Johnson)
2006-06-21 11:57       ` Samuel Thibault
2006-06-19 22:09   ` Samuel Thibault
2006-06-20  0:02     ` David Luyer
2006-06-20  4:28       ` Willy Tarreau
2006-06-20  5:03         ` Valdis.Kletnieks
2006-06-20  8:04       ` Samuel Thibault
2006-07-01 14:57         ` Matthias Andree
2006-06-20 11:26     ` linux-os (Dick Johnson)
2006-06-20 11:32       ` Samuel Thibault
2006-06-19 12:08 ` Jan Engelhardt
2006-06-19 15:47   ` Samuel Thibault
  -- strict thread matches above, loose matches on Subject: below --
2006-06-19  3:47 Albert Cahalan
2006-06-19  8:57 ` Samuel Thibault

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox