linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 2.5.68-bk1 crash in devfs_remove() for defpts files
@ 2003-04-21 17:49 Pavel Roskin
  2003-04-21 17:55 ` Christoph Hellwig
  0 siblings, 1 reply; 21+ messages in thread
From: Pavel Roskin @ 2003-04-21 17:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: hch

Hello!

I'm experiencing reproducible oopses with 2.5.68-bk1 when a pseudoterminal
is unregistered (e.g. when ssh or mc exits):

Unable to handle kernel NULL pointer dereference at virtual address
0000001c
 printing eip:
c0195a9d
*pde = 00000000
Oops: 0000 [#2]
CPU:    0
EIP:    0060:[<c0195a9d>]    Not tainted
EFLAGS: 00010282
EIP is at devfs_remove+0x15d/0x210
eax: 0000000c   ebx: 00000000   ecx: c02fd230   edx: 00006286
esi: c62b9d5c   edi: 00000001   ebp: c62b9da4   esp: c62b9d4c
ds: 007b   es: 007b   ss: 0068
Process sshd (pid: 697, threadinfo=c62b8000 task=c6271380)
Stack: c02bd04e 00000000 000006e8 c02adc3c 2f737470 c1190031 c62b9d94 c0172af4
       c62b9d78 c11a27e8 00000001 00000031 00000286 c6439924 00000001 c615f000
       c61f5d48 c6439924 c62b9da4 c0172c6f c615f000 c6439924 c62b9db8 c01e8b29
Call Trace:
 [<c0172af4>] get_node+0x64/0x80
 [<c0172c6f>] devpts_pty_kill+0x3f/0x56
 [<c01e8b29>] pty_close+0xe9/0x150
 [<c01e3cd0>] release_dev+0x750/0x790
 [<c025a2cd>] sock_destroy_inode+0x1d/0x30
 [<c025a2cd>] sock_destroy_inode+0x1d/0x30
 [<c015c036>] destroy_inode+0x36/0x60
 [<c015d016>] iput+0x56/0x80
 [<c01e40e1>] tty_release+0x11/0x20

It turns out that the "de" variable in devfs_remove() (file
fs/devfs/base.c) is NULL.

I have devfs mounted on /dev and devpts on /dev/pts:

# mount
/dev/hda2 on / type ext3 (rw)
none on /proc type proc (rw)
usbdevfs on /proc/bus/usb type usbdevfs (rw)
devfs on /dev type devfs (rw)
/dev/hda1 on /boot type ext3 (rw)
none on /dev/pts type devpts (rw)
none on /sys type sysfs (rw)
none on /dev/shm type tmpfs (rw)

I don't understand why unregistering an entry on devpts results in calling
devfs_remove().  These are different filesystems after all.  This patch
helps, but it probably shouldn't be applied unless it turns out to be
correct.

============================
--- linux.orig/fs/devfs/base.c
+++ linux/fs/devfs/base.c
@@ -1757,6 +1757,8 @@ void devfs_remove(const char *fmt, ...)
 	if (n < 64 && buf[0]) {
 		devfs_handle_t de = _devfs_find_entry(NULL, buf, 0);

+		if (!de)
+			return;
 		write_lock(&de->parent->u.dir.lock);
 		_devfs_unregister(de->parent, de);
 		devfs_put(de);
============================

By the way, I wonder why devfs_put(de) is called twice in a row in
devfs_remove().

-- 
Regards,
Pavel Roskin

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

* Re: [PATCH] 2.5.68-bk1 crash in devfs_remove() for defpts files
  2003-04-21 17:49 [PATCH] 2.5.68-bk1 crash in devfs_remove() for defpts files Pavel Roskin
@ 2003-04-21 17:55 ` Christoph Hellwig
  2003-04-21 17:58   ` Christoph Hellwig
  0 siblings, 1 reply; 21+ messages in thread
From: Christoph Hellwig @ 2003-04-21 17:55 UTC (permalink / raw)
  To: Pavel Roskin; +Cc: linux-kernel, hch

On Mon, Apr 21, 2003 at 01:49:18PM -0400, Pavel Roskin wrote:
> This patch
> helps, but it probably shouldn't be applied unless it turns out to be
> correct.

Right, the patch only hides the bug.

> By the way, I wonder why devfs_put(de) is called twice in a row in
> devfs_remove().

Once for the temporary reference we got from _devfs_find_entry,
the second time to actually make it go away.

Could you please try this patch?

--- 1.11/drivers/char/pty.c	Mon Mar 31 03:16:19 2003
+++ edited/drivers/char/pty.c	Mon Apr 21 18:32:46 2003
@@ -459,6 +459,7 @@
 		pts_driver[i].name_base = i*NR_PTYS;
 		pts_driver[i].num = ptm_driver[i].num;
 		pts_driver[i].other = &ptm_driver[i];
+		ptm_driver[i].flags |= TTY_DRIVER_NO_DEVFS;
 		pts_driver[i].table = pts_table[i];
 		pts_driver[i].termios = pts_termios[i];
 		pts_driver[i].termios_locked = pts_termios_locked[i];

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

* Re: [PATCH] 2.5.68-bk1 crash in devfs_remove() for defpts files
  2003-04-21 17:55 ` Christoph Hellwig
@ 2003-04-21 17:58   ` Christoph Hellwig
  2003-04-21 18:53     ` Pavel Roskin
  0 siblings, 1 reply; 21+ messages in thread
From: Christoph Hellwig @ 2003-04-21 17:58 UTC (permalink / raw)
  To: Pavel Roskin, linux-kernel

On Mon, Apr 21, 2003 at 07:55:55PM +0200, Christoph Hellwig wrote:
> Could you please try this patch?

Better this one :)  Sorry.

--- 1.11/drivers/char/pty.c	Mon Mar 31 03:16:19 2003
+++ edited/drivers/char/pty.c	Mon Apr 21 18:37:00 2003
@@ -448,17 +448,14 @@
 			init_waitqueue_head(&ptm_state[i][j].open_wait);
 		
 		pts_driver[i] = pty_slave_driver;
-#ifdef CONFIG_DEVFS_FS
-		pts_driver[i].name = "pts/%d";
-#else
 		pts_driver[i].name = "pts";
-#endif
 		pts_driver[i].proc_entry = 0;
 		pts_driver[i].major = UNIX98_PTY_SLAVE_MAJOR+i;
 		pts_driver[i].minor_start = 0;
 		pts_driver[i].name_base = i*NR_PTYS;
 		pts_driver[i].num = ptm_driver[i].num;
 		pts_driver[i].other = &ptm_driver[i];
+		pts_driver[i].flags |= TTY_DRIVER_NO_DEVFS;
 		pts_driver[i].table = pts_table[i];
 		pts_driver[i].termios = pts_termios[i];
 		pts_driver[i].termios_locked = pts_termios_locked[i];

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

* Re: [PATCH] 2.5.68-bk1 crash in devfs_remove() for defpts files
  2003-04-21 17:58   ` Christoph Hellwig
@ 2003-04-21 18:53     ` Pavel Roskin
  2003-04-21 19:00       ` Christoph Hellwig
  0 siblings, 1 reply; 21+ messages in thread
From: Pavel Roskin @ 2003-04-21 18:53 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-kernel

On Mon, 21 Apr 2003, Christoph Hellwig wrote:

> On Mon, Apr 21, 2003 at 07:55:55PM +0200, Christoph Hellwig wrote:
> > Could you please try this patch?
>
> Better this one :)  Sorry.

No, it doesn't help, although the stack trace is different this time:

Unable to handle kernel NULL pointer dereference at virtual address
0000001c
 printing eip:
c019599a
*pde = 00000000
Oops: 0000 [#1]
CPU:    0
EIP:    0060:[<c019599a>]    Not tainted
EFLAGS: 00010286
EIP is at devfs_remove+0x5a/0x80
eax: 00000000   ebx: 00000000   ecx: 00000002   edx: 00000000
esi: c139e568   edi: 00000000   ebp: c6c69ecc   esp: c6c69e78
ds: 007b   es: 007b   ss: 0068
Process sshd (pid: 660, threadinfo=c6c68000 task=c691a100)
Stack: 00000000 c6c69e88 00000000 c6c69ed8 00737470 c68f41e8 c68f41e8 c6c69ea4
       c015d016 c68f41e8 00000246 c6c69ebc c015aa53 c6503f4c c6470000 c6503f4c
       c139e568 c6c69ecc c0172c6f c6503f4c c6470000 c6c69ee0 c01e8999 c02cec81
Call Trace:
 [<c015d016>] iput+0x56/0x80
 [<c015aa53>] dput+0xc3/0x150
 [<c0172c6f>] devpts_pty_kill+0x3f/0x56
 [<c01e8999>] pty_close+0xe9/0x150
 [<c01e3b40>] release_dev+0x750/0x790
 [<c0152e55>] __user_walk+0x55/0x60
 [<c014e74e>] vfs_stat+0x1e/0x60
 [<c01e3f51>] tty_release+0x11/0x20
 [<c01474ca>] __fput+0xca/0xe0
 [<c0145d9b>] filp_close+0x4b/0x80
 [<c0145e21>] sys_close+0x51/0x60
 [<c01092ff>] syscall_call+0x7/0xb

Code: 8b 40 1c 89 5c 24 04 89 04 24 e8 07 fc ff ff 89 1c 24 e8 3f


I understand from "virtual address 0000001c" that devfs is still called,
and de is still NULL.

-- 
Regards,
Pavel Roskin

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

* Re: [PATCH] 2.5.68-bk1 crash in devfs_remove() for defpts files
  2003-04-21 18:53     ` Pavel Roskin
@ 2003-04-21 19:00       ` Christoph Hellwig
  2003-04-21 19:44         ` Pavel Roskin
  0 siblings, 1 reply; 21+ messages in thread
From: Christoph Hellwig @ 2003-04-21 19:00 UTC (permalink / raw)
  To: Pavel Roskin; +Cc: linux-kernel

On Mon, Apr 21, 2003 at 02:53:54PM -0400, Pavel Roskin wrote:
> On Mon, 21 Apr 2003, Christoph Hellwig wrote:
> 
> > On Mon, Apr 21, 2003 at 07:55:55PM +0200, Christoph Hellwig wrote:
> > > Could you please try this patch?
> >
> > Better this one :)  Sorry.
> 
> No, it doesn't help, although the stack trace is different this time:

Hmm.  Can you please apply the following patch in addition and
see what the printk I added sais?


--- 1.87/fs/devfs/base.c	Mon Apr 21 10:43:52 2003
+++ edited/fs/devfs/base.c	Mon Apr 21 19:36:20 2003
@@ -1754,6 +1803,12 @@
 	n = vsnprintf(buf, 64, fmt, args);
 	if (n < 64 && buf[0]) {
 		devfs_handle_t de = _devfs_find_entry(NULL, buf, 0);
+
+		if (!de) {
+			printk(KERN_WARNING "%s: no entry for %s!\n",
+					__FUNCTION__, buf);
+			return;
+		}
 
 		write_lock(&de->parent->u.dir.lock);
 		_devfs_unregister(de->parent, de);

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

* Re: [PATCH] 2.5.68-bk1 crash in devfs_remove() for defpts files
  2003-04-21 19:00       ` Christoph Hellwig
@ 2003-04-21 19:44         ` Pavel Roskin
  2003-04-21 19:56           ` Christoph Hellwig
  0 siblings, 1 reply; 21+ messages in thread
From: Pavel Roskin @ 2003-04-21 19:44 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-kernel

On Mon, 21 Apr 2003, Christoph Hellwig wrote:

> On Mon, Apr 21, 2003 at 02:53:54PM -0400, Pavel Roskin wrote:
> > On Mon, 21 Apr 2003, Christoph Hellwig wrote:
> >
> > > On Mon, Apr 21, 2003 at 07:55:55PM +0200, Christoph Hellwig wrote:
> > > > Could you please try this patch?
> > >
> > > Better this one :)  Sorry.
> >
> > No, it doesn't help, although the stack trace is different this time:
>
> Hmm.  Can you please apply the following patch in addition and
> see what the printk I added sais?

Following is happening.  The system boots, /dev/pts is a directory (I can
see it by logging on the serial console).  devpts is mounted on /dev/pts.

I log in by ssh.  It works.  /dev/pts/0 appears.  I log out.  /dev/pts
directory disappears!

I log in by ssh again.  I get this message on the console:

devfs_remove: no entry for pts!

ssh hangs.  I can recreate /dev/pts by mkdir, umount it and mount it
again.  Then ssh works again, but again only once.  /dev/pts disappears on
logout.

-- 
Regards,
Pavel Roskin

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

* Re: [PATCH] 2.5.68-bk1 crash in devfs_remove() for defpts files
  2003-04-21 19:44         ` Pavel Roskin
@ 2003-04-21 19:56           ` Christoph Hellwig
  2003-04-21 20:35             ` Pavel Roskin
  0 siblings, 1 reply; 21+ messages in thread
From: Christoph Hellwig @ 2003-04-21 19:56 UTC (permalink / raw)
  To: Pavel Roskin; +Cc: linux-kernel

On Mon, Apr 21, 2003 at 03:44:07PM -0400, Pavel Roskin wrote:
> Following is happening.  The system boots, /dev/pts is a directory (I can
> see it by logging on the serial console).  devpts is mounted on /dev/pts.
> 
> I log in by ssh.  It works.  /dev/pts/0 appears.  I log out.  /dev/pts
> directory disappears!
> 
> I log in by ssh again.  I get this message on the console:
> 
> devfs_remove: no entry for pts!
> 
> ssh hangs.  I can recreate /dev/pts by mkdir, umount it and mount it
> again.  Then ssh works again, but again only once.  /dev/pts disappears on
> logout.

Oh, I see now.  There's a longstanding bug in the handling of
TTY_DRIVER_NO_DEVFS that got exposed by this.

Please try this patch additionally:


--- 1.78/drivers/char/tty_io.c	Sat Apr 19 19:24:04 2003
+++ edited/drivers/char/tty_io.c	Mon Apr 21 20:33:35 2003
@@ -2139,12 +2139,14 @@
  */
 void tty_register_device(struct tty_driver *driver, unsigned minor)
 {
-	tty_register_devfs(driver, minor);
+	if (!(driver->flags & TTY_DRIVER_NO_DEVFS))
+		tty_register_devfs(driver, minor);
 }
 
 void tty_unregister_device(struct tty_driver *driver, unsigned minor)
 {
-	tty_unregister_devfs(driver, minor);
+	if (!(driver->flags & TTY_DRIVER_NO_DEVFS))
+		tty_unregister_devfs(driver, minor);
 }
 
 EXPORT_SYMBOL(tty_register_device);
@@ -2173,10 +2175,8 @@
 	
 	list_add(&driver->tty_drivers, &tty_drivers);
 	
-	if ( !(driver->flags & TTY_DRIVER_NO_DEVFS) ) {
-		for(i = 0; i < driver->num; i++)
-		    tty_register_device(driver, driver->minor_start + i);
-	}
+	for (i = 0; i < driver->num; i++)
+		tty_register_device(driver, driver->minor_start + i);
 	proc_tty_register_driver(driver);
 	return error;
 }

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

* Re: [PATCH] 2.5.68-bk1 crash in devfs_remove() for defpts files
  2003-04-21 19:56           ` Christoph Hellwig
@ 2003-04-21 20:35             ` Pavel Roskin
  2003-04-21 20:44               ` Grzegorz Jaskiewicz
  2003-04-21 20:57               ` Christoph Hellwig
  0 siblings, 2 replies; 21+ messages in thread
From: Pavel Roskin @ 2003-04-21 20:35 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-kernel

> Oh, I see now.  There's a longstanding bug in the handling of
> TTY_DRIVER_NO_DEVFS that got exposed by this.
>
> Please try this patch additionally:

Applied.  Now I can log in by ssh and there are no problems with
pseudoterminals.  However, all local terminals are gone:

INIT: Id "1" respawning too fast: disabled for 5 minutes
INIT: Id "2" respawning too fast: disabled for 5 minutes
INIT: Id "3" respawning too fast: disabled for 5 minutes
INIT: Id "5" respawning too fast: disabled for 5 minutes
INIT: Id "4" respawning too fast: disabled for 5 minutes
INIT: Id "6" respawning too fast: disabled for 5 minutes
INIT: Id "S0" respawning too fast: disabled for 5 minutes
INIT: no more processes left in this runlevel

The only entry under /dev/vc is /dev/vc/0.  /dev/tts is missing.

-- 
Regards,
Pavel Roskin

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

* Re: [PATCH] 2.5.68-bk1 crash in devfs_remove() for defpts files
  2003-04-21 20:35             ` Pavel Roskin
@ 2003-04-21 20:44               ` Grzegorz Jaskiewicz
  2003-04-21 20:56                 ` Pavel Roskin
  2003-04-24  7:39                 ` Martin Schlemmer
  2003-04-21 20:57               ` Christoph Hellwig
  1 sibling, 2 replies; 21+ messages in thread
From: Grzegorz Jaskiewicz @ 2003-04-21 20:44 UTC (permalink / raw)
  To: Pavel Roskin; +Cc: lkml

On Mon, 2003-04-21 at 21:35, Pavel Roskin wrote:
> > Oh, I see now.  There's a longstanding bug in the handling of
> > TTY_DRIVER_NO_DEVFS that got exposed by this.
> >
> > Please try this patch additionally:
> 
> Applied.  Now I can log in by ssh and there are no problems with
> pseudoterminals.  However, all local terminals are gone:
> 
> INIT: Id "1" respawning too fast: disabled for 5 minutes
> INIT: Id "2" respawning too fast: disabled for 5 minutes
> INIT: Id "3" respawning too fast: disabled for 5 minutes
> INIT: Id "5" respawning too fast: disabled for 5 minutes
> INIT: Id "4" respawning too fast: disabled for 5 minutes
> INIT: Id "6" respawning too fast: disabled for 5 minutes
> INIT: Id "S0" respawning too fast: disabled for 5 minutes
> INIT: no more processes left in this runlevel
> 
you must mount devpts in /dev/pts
and change inittab :
[snip]
# Note that on most Debian systems tty7 is used by the X Window System,
# so if you want to add more getty's go ahead but skip tty7 if you run
X.
#
1:2345:respawn:/sbin/getty 38400 /dev/vc/1
2:23:respawn:/sbin/getty 38400 /dev/vc/2
3:23:respawn:/sbin/getty 38400 /dev/vc/3
4:23:respawn:/sbin/getty 38400 /dev/vc/4
5:23:respawn:/sbin/getty 38400 /dev/vc/5
6:23:respawn:/sbin/getty 38400 /dev/vc/6
[snip]

to use devfs only, it is funny but fe to open /dev/sound/* you need to
be root, or chmod it manually before use. (i've got seperate
/etc/init.d/chdevfsmod file to do that)

> The only entry under /dev/vc is /dev/vc/0.  /dev/tts is missing.
-- 
Grzegorz Jaskiewicz <gj@pointblue.com.pl>
K4 labs


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

* Re: [PATCH] 2.5.68-bk1 crash in devfs_remove() for defpts files
  2003-04-21 20:44               ` Grzegorz Jaskiewicz
@ 2003-04-21 20:56                 ` Pavel Roskin
  2003-04-24  7:39                 ` Martin Schlemmer
  1 sibling, 0 replies; 21+ messages in thread
From: Pavel Roskin @ 2003-04-21 20:56 UTC (permalink / raw)
  To: Grzegorz Jaskiewicz; +Cc: lkml

On Mon, 21 Apr 2003, Grzegorz Jaskiewicz wrote:

> you must mount devpts in /dev/pts

It is mounted, in case if you missed the beginning of the discussion.

> and change inittab :
> [snip]
> # Note that on most Debian systems tty7 is used by the X Window System,
> # so if you want to add more getty's go ahead but skip tty7 if you run
> X.
> #
> 1:2345:respawn:/sbin/getty 38400 /dev/vc/1

But I don't have /dev/vc/1 because ...

> > The only entry under /dev/vc is /dev/vc/0.  /dev/tts is missing.

This was caused by Christoph's patch he posted in this thread.  I'm not
familiar with internals of devfs and character devices.  I'm just trying
to help Christoph to come to the right solution.

-- 
Regards,
Pavel Roskin

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

* Re: [PATCH] 2.5.68-bk1 crash in devfs_remove() for defpts files
  2003-04-21 20:35             ` Pavel Roskin
  2003-04-21 20:44               ` Grzegorz Jaskiewicz
@ 2003-04-21 20:57               ` Christoph Hellwig
  2003-04-21 21:15                 ` Pavel Roskin
  1 sibling, 1 reply; 21+ messages in thread
From: Christoph Hellwig @ 2003-04-21 20:57 UTC (permalink / raw)
  To: Pavel Roskin; +Cc: Christoph Hellwig, linux-kernel

On Mon, Apr 21, 2003 at 04:35:21PM -0400, Pavel Roskin wrote:
> > Oh, I see now.  There's a longstanding bug in the handling of
> > TTY_DRIVER_NO_DEVFS that got exposed by this.
> >
> > Please try this patch additionally:
> 
> Applied.  Now I can log in by ssh and there are no problems with
> pseudoterminals.  However, all local terminals are gone:

The devfs <-> tty interaction are going to drive me nuts.

TTY_DRIVER_NO_DEVFS actually means don't call tty_register_device
in tty_register_driver, not don't register with devfs.

Updated patch (replaces the last one):


--- 1.78/drivers/char/tty_io.c	Sat Apr 19 19:24:04 2003
+++ edited/drivers/char/tty_io.c	Mon Apr 21 21:28:01 2003
@@ -2173,9 +2173,9 @@
 	
 	list_add(&driver->tty_drivers, &tty_drivers);
 	
-	if ( !(driver->flags & TTY_DRIVER_NO_DEVFS) ) {
-		for(i = 0; i < driver->num; i++)
-		    tty_register_device(driver, driver->minor_start + i);
+	if (!(driver->flags & TTY_DRIVER_NO_DEVFS)) {
+		for (i = 0; i < driver->num; i++)
+			tty_register_device(driver, driver->minor_start + i);
 	}
 	proc_tty_register_driver(driver);
 	return error;
@@ -2215,7 +2215,8 @@
 			driver->termios_locked[i] = NULL;
 			kfree(tp);
 		}
-		tty_unregister_device(driver, driver->minor_start + i);
+		if (!(driver->flags & TTY_DRIVER_NO_DEVFS))
+			tty_unregister_device(driver, driver->minor_start + i);
 	}
 	proc_tty_unregister_driver(driver);
 	return 0;

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

* Re: [PATCH] 2.5.68-bk1 crash in devfs_remove() for defpts files
  2003-04-21 20:57               ` Christoph Hellwig
@ 2003-04-21 21:15                 ` Pavel Roskin
  2003-04-21 21:23                   ` Christoph Hellwig
  0 siblings, 1 reply; 21+ messages in thread
From: Pavel Roskin @ 2003-04-21 21:15 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-kernel

On Mon, 21 Apr 2003, Christoph Hellwig wrote:
>
> The devfs <-> tty interaction are going to drive me nuts.
>
> TTY_DRIVER_NO_DEVFS actually means don't call tty_register_device
> in tty_register_driver, not don't register with devfs.
>
> Updated patch (replaces the last one):

The old story again.  /dev/pts disappears when /dev/pts/0 is unregistered.
"devfs_remove: no entry for pts!" appears on the next attempt to login by
ssh.

/dev/vc and /dev/tts are OK.

-- 
Regards,
Pavel Roskin

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

* Re: [PATCH] 2.5.68-bk1 crash in devfs_remove() for defpts files
  2003-04-21 21:15                 ` Pavel Roskin
@ 2003-04-21 21:23                   ` Christoph Hellwig
  2003-04-21 21:45                     ` Pavel Roskin
  0 siblings, 1 reply; 21+ messages in thread
From: Christoph Hellwig @ 2003-04-21 21:23 UTC (permalink / raw)
  To: Pavel Roskin; +Cc: Christoph Hellwig, linux-kernel

On Mon, Apr 21, 2003 at 05:15:39PM -0400, Pavel Roskin wrote:
> On Mon, 21 Apr 2003, Christoph Hellwig wrote:
> >
> > The devfs <-> tty interaction are going to drive me nuts.
> >
> > TTY_DRIVER_NO_DEVFS actually means don't call tty_register_device
> > in tty_register_driver, not don't register with devfs.
> >
> > Updated patch (replaces the last one):
> 
> The old story again.  /dev/pts disappears when /dev/pts/0 is unregistered.
> "devfs_remove: no entry for pts!" appears on the next attempt to login by
> ssh.

And you are sure you have the following line in pty.c:

	pts_driver[i].flags |= TTY_DRIVER_NO_DEVFS;

?

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

* Re: [PATCH] 2.5.68-bk1 crash in devfs_remove() for defpts files
  2003-04-21 21:23                   ` Christoph Hellwig
@ 2003-04-21 21:45                     ` Pavel Roskin
  2003-04-21 22:25                       ` Christoph Hellwig
  0 siblings, 1 reply; 21+ messages in thread
From: Pavel Roskin @ 2003-04-21 21:45 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-kernel

[-- Attachment #1: Type: TEXT/PLAIN, Size: 385 bytes --]

On Mon, 21 Apr 2003, Christoph Hellwig wrote:

> And you are sure you have the following line in pty.c:
>
> 	pts_driver[i].flags |= TTY_DRIVER_NO_DEVFS;

Yes, it's in drivers/char/pty.c, line 458.

The complete diff between the clean source and my current tree is
attached.

I have forced another rebuild, but the problem with disappearing /dev/pts
persists.

-- 
Regards,
Pavel Roskin

[-- Attachment #2: Type: TEXT/PLAIN, Size: 2973 bytes --]

--- linux.orig/drivers/char/pty.c
+++ linux/drivers/char/pty.c
@@ -448,17 +448,14 @@ int __init pty_init(void)
 			init_waitqueue_head(&ptm_state[i][j].open_wait);
 		
 		pts_driver[i] = pty_slave_driver;
-#ifdef CONFIG_DEVFS_FS
-		pts_driver[i].name = "pts/%d";
-#else
 		pts_driver[i].name = "pts";
-#endif
 		pts_driver[i].proc_entry = 0;
 		pts_driver[i].major = UNIX98_PTY_SLAVE_MAJOR+i;
 		pts_driver[i].minor_start = 0;
 		pts_driver[i].name_base = i*NR_PTYS;
 		pts_driver[i].num = ptm_driver[i].num;
 		pts_driver[i].other = &ptm_driver[i];
+		pts_driver[i].flags |= TTY_DRIVER_NO_DEVFS;
 		pts_driver[i].table = pts_table[i];
 		pts_driver[i].termios = pts_termios[i];
 		pts_driver[i].termios_locked = pts_termios_locked[i];
--- linux.orig/drivers/char/tty_io.c
+++ linux/drivers/char/tty_io.c
@@ -2173,9 +2173,9 @@ int tty_register_driver(struct tty_drive
 	
 	list_add(&driver->tty_drivers, &tty_drivers);
 	
-	if ( !(driver->flags & TTY_DRIVER_NO_DEVFS) ) {
-		for(i = 0; i < driver->num; i++)
-		    tty_register_device(driver, driver->minor_start + i);
+	if (!(driver->flags & TTY_DRIVER_NO_DEVFS)) {
+		for (i = 0; i < driver->num; i++)
+			tty_register_device(driver, driver->minor_start + i);
 	}
 	proc_tty_register_driver(driver);
 	return error;
@@ -2215,7 +2215,8 @@ int tty_unregister_driver(struct tty_dri
 			driver->termios_locked[i] = NULL;
 			kfree(tp);
 		}
-		tty_unregister_device(driver, driver->minor_start + i);
+		if (!(driver->flags & TTY_DRIVER_NO_DEVFS))
+			tty_unregister_device(driver, driver->minor_start + i);
 	}
 	proc_tty_unregister_driver(driver);
 	return 0;
--- linux.orig/drivers/pcmcia/rsrc_mgr.c
+++ linux/drivers/pcmcia/rsrc_mgr.c
@@ -499,14 +499,16 @@ void validate_mem(socket_info_t *s)
 
 void validate_mem(socket_info_t *s)
 {
-    resource_map_t *m;
+    resource_map_t *m, *n;
     static int done = 0;
     
     if (probe_mem && done++ == 0) {
 	down(&rsrc_sem);
-	for (m = mem_db.next; m != &mem_db; m = m->next)
+	for (m = mem_db.next; m != &mem_db; m = n) {
+	    n = m->next;
 	    if (do_mem_probe(m->base, m->num, s))
 		break;
+	}
 	up(&rsrc_sem);
     }
 }
--- linux.orig/fs/devfs/base.c
+++ linux/fs/devfs/base.c
@@ -1757,6 +1757,12 @@ void devfs_remove(const char *fmt, ...)
 	if (n < 64 && buf[0]) {
 		devfs_handle_t de = _devfs_find_entry(NULL, buf, 0);
 
+		if (!de) {
+			printk(KERN_WARNING "%s: no entry for %s!\n",
+					__FUNCTION__, buf);
+			return;
+		}
+
 		write_lock(&de->parent->u.dir.lock);
 		_devfs_unregister(de->parent, de);
 		devfs_put(de);
--- linux.orig/fs/partitions/devfs.c
+++ linux/fs/partitions/devfs.c
@@ -81,7 +81,7 @@ void devfs_add_partitioned(struct gendis
 {
 	char dirname[64], symlink[16];
 
-	if (disk->devfs_name[0] != '\0')
+	if (disk->devfs_name[0] == '\0')
 		sprintf(disk->devfs_name, "%s/disc%d", disk->disk_name,
 				disk->first_minor >> disk->minor_shift);
 

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

* Re: [PATCH] 2.5.68-bk1 crash in devfs_remove() for defpts files
  2003-04-21 21:45                     ` Pavel Roskin
@ 2003-04-21 22:25                       ` Christoph Hellwig
  2003-04-21 22:37                         ` Pavel Roskin
  0 siblings, 1 reply; 21+ messages in thread
From: Christoph Hellwig @ 2003-04-21 22:25 UTC (permalink / raw)
  To: Pavel Roskin; +Cc: Christoph Hellwig, linux-kernel

On Mon, Apr 21, 2003 at 05:45:19PM -0400, Pavel Roskin wrote:
> On Mon, 21 Apr 2003, Christoph Hellwig wrote:
> 
> > And you are sure you have the following line in pty.c:
> >
> > 	pts_driver[i].flags |= TTY_DRIVER_NO_DEVFS;
> 
> Yes, it's in drivers/char/pty.c, line 458.
> 
> The complete diff between the clean source and my current tree is
> attached.
> 
> I have forced another rebuild, but the problem with disappearing /dev/pts
> persists.

This one ontop should really fix it...

(fingers crossed..)


--- 1.11/drivers/char/pty.c	Mon Mar 31 03:16:19 2003
+++ edited/drivers/char/pty.c	Mon Apr 21 23:02:55 2003
@@ -95,7 +95,6 @@
 			}
 		}
 #endif
-		tty_unregister_device (&tty->link->driver, minor(tty->device));
 		tty_vhangup(tty->link);
 	}
 }

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

* Re: [PATCH] 2.5.68-bk1 crash in devfs_remove() for defpts files
  2003-04-21 22:25                       ` Christoph Hellwig
@ 2003-04-21 22:37                         ` Pavel Roskin
  0 siblings, 0 replies; 21+ messages in thread
From: Pavel Roskin @ 2003-04-21 22:37 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-kernel

On Tue, 22 Apr 2003, Christoph Hellwig wrote:

> This one ontop should really fix it...
>
> (fingers crossed..)

Yes!  /dev/pts is OK.  /dev/vc is OK.  /dev/tts is OK.

Thank you very much!

-- 
Regards,
Pavel Roskin

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

* Re: [PATCH] 2.5.68-bk1 crash in devfs_remove() for defpts files
  2003-04-21 20:44               ` Grzegorz Jaskiewicz
  2003-04-21 20:56                 ` Pavel Roskin
@ 2003-04-24  7:39                 ` Martin Schlemmer
  2003-04-24  7:57                   ` Grzegorz Jaskiewicz
  1 sibling, 1 reply; 21+ messages in thread
From: Martin Schlemmer @ 2003-04-24  7:39 UTC (permalink / raw)
  To: Grzegorz Jaskiewicz; +Cc: Pavel Roskin, lkml

On Mon, 2003-04-21 at 22:44, Grzegorz Jaskiewicz wrote:

> to use devfs only, it is funny but fe to open /dev/sound/* you need to
> be root, or chmod it manually before use. (i've got seperate
> /etc/init.d/chdevfsmod file to do that)
> 

Add to /etc/devfsd.conf:

-----------------------------
REGISTER        sound/.*     PERMISSIONS root.audio 660
REGISTER        snd/.*       PERMISSIONS root.audio 660
-----------------------------

Or whatever perms you wish ...


Regards,

-- 
Martin Schlemmer



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

* Re: [PATCH] 2.5.68-bk1 crash in devfs_remove() for defpts files
  2003-04-24  7:39                 ` Martin Schlemmer
@ 2003-04-24  7:57                   ` Grzegorz Jaskiewicz
  2003-04-24 11:46                     ` Martin Schlemmer
  0 siblings, 1 reply; 21+ messages in thread
From: Grzegorz Jaskiewicz @ 2003-04-24  7:57 UTC (permalink / raw)
  To: Martin Schlemmer; +Cc: lkml

On Thu, 2003-04-24 at 08:39, Martin Schlemmer wrote:
> On Mon, 2003-04-21 at 22:44, Grzegorz Jaskiewicz wrote:
> 
> > to use devfs only, it is funny but fe to open /dev/sound/* you need to
> > be root, or chmod it manually before use. (i've got seperate
> > /etc/init.d/chdevfsmod file to do that)
> > 
> 
> Add to /etc/devfsd.conf:
> 
> -----------------------------
> REGISTER        sound/.*     PERMISSIONS root.audio 660
> REGISTER        snd/.*       PERMISSIONS root.audio 660
> -----------------------------


Well, if you will read my post - i am trying to use _ONLY_ devfs,
without any demons. Those demons are provided just to keep backward
compatbility (at least this is my opinion) and can be used without them.

i don't like personaly any ideas about udevfs and others. We should get
rid of min/maj nr of each device becouse each single program uses device
by name indeed ! Having just devfs solves many problems and is very good
thing. But, again - without any userspace demons.

Linus was always trying kernel as simple as it is possible, well - imho
devfs is just one step forward to make it even simpler but without
removing any of it functionality.

 

-- 
Grzegorz Jaskiewicz <gj@pointblue.com.pl>
K4 labs


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

* Re: [PATCH] 2.5.68-bk1 crash in devfs_remove() for defpts files
  2003-04-24  7:57                   ` Grzegorz Jaskiewicz
@ 2003-04-24 11:46                     ` Martin Schlemmer
  2003-04-24 12:03                       ` Grzegorz Jaskiewicz
  0 siblings, 1 reply; 21+ messages in thread
From: Martin Schlemmer @ 2003-04-24 11:46 UTC (permalink / raw)
  To: Grzegorz Jaskiewicz; +Cc: lkml

On Thu, 2003-04-24 at 09:57, Grzegorz Jaskiewicz wrote:

> Well, if you will read my post - i am trying to use _ONLY_ devfs,
> without any demons.

Ok, missed that.

> Those demons are provided just to keep backward
> compatbility (at least this is my opinion) and can be used without them.
> 

Well, not really.  Yes, it does support the compat symlinks, etc, but
you can do much more with devfsd than just that.  Setting the
permissions/ownership on node registration, autoloading of modules
if a node is accessed, etc is just a few.

> i don't like personaly any ideas about udevfs and others. We should get
> rid of min/maj nr of each device becouse each single program uses device
> by name indeed ! Having just devfs solves many problems and is very good
> thing. But, again - without any userspace demons.
> 

See above.

> Linus was always trying kernel as simple as it is possible, well - imho
> devfs is just one step forward to make it even simpler but without
> removing any of it functionality.
> 

I guess you could see the management of devfs being done in userspace
(devfsd) as keeping kernel side simple :P


Regards,
 
-- 
Martin Schlemmer



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

* Re: [PATCH] 2.5.68-bk1 crash in devfs_remove() for defpts files
  2003-04-24 11:46                     ` Martin Schlemmer
@ 2003-04-24 12:03                       ` Grzegorz Jaskiewicz
  0 siblings, 0 replies; 21+ messages in thread
From: Grzegorz Jaskiewicz @ 2003-04-24 12:03 UTC (permalink / raw)
  To: Martin Schlemmer; +Cc: Linux Kernel Mailing List

On Thu, 2003-04-24 at 12:46, Martin Schlemmer wrote:
> On Thu, 2003-04-24 at 09:57, Grzegorz Jaskiewicz wrote:
> 
> > Well, if you will read my post - i am trying to use _ONLY_ devfs,
> > without any demons.
> 
> Ok, missed that.
> 
> > Those demons are provided just to keep backward
> > compatbility (at least this is my opinion) and can be used without them.
> > 
> 
> Well, not really.  Yes, it does support the compat symlinks, etc, but
> you can do much more with devfsd than just that.  Setting the
> permissions/ownership on node registration, autoloading of modules
> if a node is accessed, etc is just a few.
Well, we don't need that - all we need is just file with settings cat-ed
to some /proc entry or script that sets up perms on boot/hotplug events.

> 
> > i don't like personaly any ideas about udevfs and others. We should get
> > rid of min/maj nr of each device becouse each single program uses device
> > by name indeed ! Having just devfs solves many problems and is very good
> > thing. But, again - without any userspace demons.
> > 
> 
> See above.
> 
> > Linus was always trying kernel as simple as it is possible, well - imho
> > devfs is just one step forward to make it even simpler but without
> > removing any of it functionality.
> > 
> 
> I guess you could see the management of devfs being done in userspace
> (devfsd) as keeping kernel side simple :P

Well, my point is - why i should install tons of userspace programs while everything can be/should be done internaly - becouse those demons are very close to kernel !
And it is pointles, kernel should be able to do everything required to be fully working by its self - not relay on some userspace shit.  

-- 
Grzegorz Jaskiewicz <gj@pointblue.com.pl>
K4 Labs


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

* Re: [PATCH] 2.5.68-bk1 crash in devfs_remove() for defpts files
@ 2003-04-22 10:12 Chuck Ebbert
  0 siblings, 0 replies; 21+ messages in thread
From: Chuck Ebbert @ 2003-04-22 10:12 UTC (permalink / raw)
  To: linux-kernel

Christoph Hellwig wrote:

.>> I have forced another rebuild, but the problem with disappearing /dev/pts
.>> persists.
.>
.> This one ontop should really fix it...
.>
.> (fingers crossed..)
.>

Is this problem in 2.5.68-vanilla?

If so, would somebody please post a complete patch?


------
 Chuck

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

end of thread, other threads:[~2003-04-24 11:51 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-21 17:49 [PATCH] 2.5.68-bk1 crash in devfs_remove() for defpts files Pavel Roskin
2003-04-21 17:55 ` Christoph Hellwig
2003-04-21 17:58   ` Christoph Hellwig
2003-04-21 18:53     ` Pavel Roskin
2003-04-21 19:00       ` Christoph Hellwig
2003-04-21 19:44         ` Pavel Roskin
2003-04-21 19:56           ` Christoph Hellwig
2003-04-21 20:35             ` Pavel Roskin
2003-04-21 20:44               ` Grzegorz Jaskiewicz
2003-04-21 20:56                 ` Pavel Roskin
2003-04-24  7:39                 ` Martin Schlemmer
2003-04-24  7:57                   ` Grzegorz Jaskiewicz
2003-04-24 11:46                     ` Martin Schlemmer
2003-04-24 12:03                       ` Grzegorz Jaskiewicz
2003-04-21 20:57               ` Christoph Hellwig
2003-04-21 21:15                 ` Pavel Roskin
2003-04-21 21:23                   ` Christoph Hellwig
2003-04-21 21:45                     ` Pavel Roskin
2003-04-21 22:25                       ` Christoph Hellwig
2003-04-21 22:37                         ` Pavel Roskin
2003-04-22 10:12 Chuck Ebbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).