linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* oops with bk kernel as of 2003-05-25T13:00:00-07
@ 2003-05-25 20:27 Ulrich Drepper
  2003-05-25 21:30 ` viro
  0 siblings, 1 reply; 12+ messages in thread
From: Ulrich Drepper @ 2003-05-25 20:27 UTC (permalink / raw)
  To: Linus Torvalds, linux-kernel, Alexander Viro

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I get an oops at startup time:

Unable to handle kernel NULL pointer dereference at virtual address 000003fc
 printing eip:
c0226e77
*pde = 00000000
Oops: 0000 [#1]
CPU:    0
EIP:    0060:[<c0226e77>]    Not tainted
EFLAGS: 00010246
EIP is at kobj_map+0x9b/0x137
eax: cffbdf40   ebx: 00002400   ecx: cffbe6dc   edx: 00000000
esi: 00000001   edi: 00000100   ebp: 00000024   esp: c1297f3c
ds: 007b   es: 007b   ss: 0068
Process swapper (pid: 1, threadinfo=c1296000 task=c1295900)
Stack: 0000001c 000000d0 00000001 cffbdf40 00002400 cffbdf48 cffbe6a0
c0157a4e
       00000000 00002400 00000100 00000000 c01579c8 c01579cd cffbdf40
cffbdf40
       00000001 c01575d1 cffbdf40 00002400 00000100 c0316117 c03cdea4
00000000
Call Trace:
 [<c0157a4e>] cdev_add+0x63/0x65
 [<c01579c8>] exact_match+0x0/0x5
 [<c01579cd>] exact_lock+0x0/0x1e
 [<c01575d1>] register_chrdev+0xc6/0x10f
 [<c039ec53>] init_netlink+0x1f/0x58
 [<c039ec2e>] netlink_proto_init+0x47/0x4d
 [<c0382880>] do_initcalls+0x27/0x93
 [<c012ddc3>] init_workqueues+0xf/0x26
 [<c01050a8>] init+0x4c/0x1a8
 [<c010505c>] init+0x0/0x1a8
 [<c0108a15>] kernel_thread_helper+0x5/0xb



I looked at the code and the problem is that cdev_map == NULL when
cdev_add is called.  cdev_map is initialized in a constructor.  Maybe
the wrong order or a race...

- -- 
- --------------.                        ,-.            444 Castro Street
Ulrich Drepper \    ,-----------------'   \ Mountain View, CA 94041 USA
Red Hat         `--' drepper at redhat.com `---------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+0Scn2ijCOnn/RHQRAnuKAJ0dSiCceWR44y9tBDTV1M6DprpJ7ACeJ2tu
GuQRjOGRP8x7iHi4+TvjxVI=
=ydEX
-----END PGP SIGNATURE-----


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

* Re: oops with bk kernel as of 2003-05-25T13:00:00-07
  2003-05-25 20:27 oops with bk kernel as of 2003-05-25T13:00:00-07 Ulrich Drepper
@ 2003-05-25 21:30 ` viro
  2003-05-25 21:51   ` [PATCH] " viro
  0 siblings, 1 reply; 12+ messages in thread
From: viro @ 2003-05-25 21:30 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Linus Torvalds, linux-kernel, Alexander Viro

On Sun, May 25, 2003 at 01:27:19PM -0700, Ulrich Drepper wrote:
> Call Trace:
>  [<c0157a4e>] cdev_add+0x63/0x65
>  [<c01579c8>] exact_match+0x0/0x5
>  [<c01579cd>] exact_lock+0x0/0x1e
>  [<c01575d1>] register_chrdev+0xc6/0x10f
>  [<c039ec53>] init_netlink+0x1f/0x58
>  [<c039ec2e>] netlink_proto_init+0x47/0x4d
>  [<c0382880>] do_initcalls+0x27/0x93
>  [<c012ddc3>] init_workqueues+0xf/0x26
>  [<c01050a8>] init+0x4c/0x1a8
>  [<c010505c>] init+0x0/0x1a8
>  [<c0108a15>] kernel_thread_helper+0x5/0xb
 
> I looked at the code and the problem is that cdev_map == NULL when
> cdev_add is called.  cdev_map is initialized in a constructor.  Maybe
> the wrong order or a race...

Gack...  We have

subsys_initcall(chrdev_init);
in fs/char_dev.c
and
core_initcall(netlink_proto_init);
in net/netlink/af_netlink.c

Guess which one wins...  What a mess...  How about the following (untested,
but AFAICS should work)

diff -urN linux/fs/char_dev.c linux2/fs/char_dev.c
--- linux/fs/char_dev.c	Sun May 25 08:01:46 2003
+++ linux2/fs/char_dev.c	Sun May 25 17:26:04 2003
@@ -457,11 +457,9 @@
 	return NULL;
 }
 
-static int __init chrdev_init(void)
+void __init cdev_init(void)
 {
 	subsystem_register(&cdev_subsys);
 	kset_register(&kset_dynamic);
 	cdev_map = kobj_map_init(base_probe, &cdev_subsys);
-	return 0;
 }
-subsys_initcall(chrdev_init);
diff -urN linux/fs/dcache.c linux2/fs/dcache.c
--- linux/fs/dcache.c	Sat May 24 18:49:58 2003
+++ linux2/fs/dcache.c	Sun May 25 17:25:40 2003
@@ -1606,6 +1606,7 @@
 EXPORT_SYMBOL(d_genocide);
 
 extern void bdev_cache_init(void);
+extern void cdev_init(void);
 
 void __init vfs_caches_init(unsigned long mempages)
 {
@@ -1626,4 +1627,5 @@
 	files_init(mempages); 
 	mnt_init(mempages);
 	bdev_cache_init();
+	cdev_init();
 }

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

* [PATCH] Re: oops with bk kernel as of 2003-05-25T13:00:00-07
  2003-05-25 21:30 ` viro
@ 2003-05-25 21:51   ` viro
  2003-05-25 22:07     ` netlink init order viro
  0 siblings, 1 reply; 12+ messages in thread
From: viro @ 2003-05-25 21:51 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Ulrich Drepper, linux-kernel, AlexanderOD Viro

On Sun, May 25, 2003 at 10:30:40PM +0100, viro@parcelfarce.linux.theplanet.co.uk wrote:

> Guess which one wins...  What a mess...  How about the following (untested,
> but AFAICS should work)

[snip]

or, to make it compile, the following:

diff -urN linux/fs/char_dev.c linux2/fs/char_dev.c
--- linux/fs/char_dev.c	Sun May 25 08:01:46 2003
+++ linux2/fs/char_dev.c	Sun May 25 17:26:04 2003
@@ -457,11 +457,9 @@
 	return NULL;
 }
 
-static int __init chrdev_init(void)
+void __init chrdev_init(void)
 {
 	subsystem_register(&cdev_subsys);
 	kset_register(&kset_dynamic);
 	cdev_map = kobj_map_init(base_probe, &cdev_subsys);
-	return 0;
 }
-subsys_initcall(chrdev_init);
diff -urN linux/fs/dcache.c linux2/fs/dcache.c
--- linux/fs/dcache.c	Sat May 24 18:49:58 2003
+++ linux2/fs/dcache.c	Sun May 25 17:25:40 2003
@@ -1606,6 +1606,7 @@
 EXPORT_SYMBOL(d_genocide);
 
 extern void bdev_cache_init(void);
+extern void chrdev_init(void);
 
 void __init vfs_caches_init(unsigned long mempages)
 {
@@ -1626,4 +1627,5 @@
 	files_init(mempages); 
 	mnt_init(mempages);
 	bdev_cache_init();
+	chrdev_init();
 }


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

* netlink init order
  2003-05-25 21:51   ` [PATCH] " viro
@ 2003-05-25 22:07     ` viro
  2003-05-25 22:12       ` Linus Torvalds
  0 siblings, 1 reply; 12+ messages in thread
From: viro @ 2003-05-25 22:07 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Alan Cox, linux-kernel

BTW, is there any reason why init_netlink_dev() is not a module_init()?

We have
int init_module(void)
{
        printk(KERN_INFO "Network Kernel/User communications module 0.04\n");
        return init_netlink();
}

void cleanup_module(void)
{
        int i;

        for (i = 0; i < ARRAY_SIZE(entries); i++)
                devfs_remove("netlink/%s", entries[i].name);
        for (i = 0; i < 16; i++)
                devfs_remove("netlink/tap%d", i);
        devfs_remove("netlink");
        unregister_chrdev(NETLINK_MAJOR, "netlink");
}

in netlink_dev.c and

#ifdef CONFIG_NETLINK_DEV
        init_netlink();
#endif
        return 0;
}

in the end of netlink_proto_init(), which is core_initcall.

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

* Re: netlink init order
  2003-05-25 22:07     ` netlink init order viro
@ 2003-05-25 22:12       ` Linus Torvalds
  2003-05-25 22:20         ` viro
  2003-05-26  2:07         ` David S. Miller
  0 siblings, 2 replies; 12+ messages in thread
From: Linus Torvalds @ 2003-05-25 22:12 UTC (permalink / raw)
  To: viro; +Cc: Alan Cox, linux-kernel, David S. Miller


On Sun, 25 May 2003 viro@parcelfarce.linux.theplanet.co.uk wrote:
>
> BTW, is there any reason why init_netlink_dev() is not a module_init()?

Probably not. I don't know if the thing even makes sense without a user 
space, which definitely implies that it shouldn't be a "core" initcall.

Even more true as it seems to depend on other core subsystems already 
being initialized.

Davem? Who uses this thing?

		Linus


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

* Re: netlink init order
  2003-05-25 22:12       ` Linus Torvalds
@ 2003-05-25 22:20         ` viro
  2003-05-26  2:07         ` David S. Miller
  1 sibling, 0 replies; 12+ messages in thread
From: viro @ 2003-05-25 22:20 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Alan Cox, linux-kernel, David S. Miller

On Sun, May 25, 2003 at 03:12:28PM -0700, Linus Torvalds wrote:
> 
> On Sun, 25 May 2003 viro@parcelfarce.linux.theplanet.co.uk wrote:
> >
> > BTW, is there any reason why init_netlink_dev() is not a module_init()?

Grr... init_netlink(), that is.

> Probably not. I don't know if the thing even makes sense without a user 
> space, which definitely implies that it shouldn't be a "core" initcall.
> 
> Even more true as it seems to depend on other core subsystems already 
> being initialized.
> 
> Davem? Who uses this thing?

After looking at the code in question, I _really_ doubt that other initcalls
might rely on it.  It does
	* register character device
	* create a /dev/netlink (on devfs) and a bunch of entries there.

That's it.  Unless we have some initcall code that cares to mount devfs
and open files on it (or does such mknod on rootfs and opens the result)...

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

* Re: netlink init order
  2003-05-25 22:12       ` Linus Torvalds
  2003-05-25 22:20         ` viro
@ 2003-05-26  2:07         ` David S. Miller
  2003-05-26  2:22           ` Linus Torvalds
  1 sibling, 1 reply; 12+ messages in thread
From: David S. Miller @ 2003-05-26  2:07 UTC (permalink / raw)
  To: torvalds; +Cc: viro, alan, linux-kernel

   From: Linus Torvalds <torvalds@transmeta.com>
   Date: Sun, 25 May 2003 15:12:28 -0700 (PDT)
   
   Davem? Who uses this thing?
   
[ was away past 2 days, sorry... ]

I doubt any users of netlink "devices" exist in nature anymore.
I remember in 2.2.x we marked it as deprecated. :-)
   
That being said, you should be able to safely use module_init() there.

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

* Re: netlink init order
  2003-05-26  2:07         ` David S. Miller
@ 2003-05-26  2:22           ` Linus Torvalds
  2003-05-26  2:25             ` David S. Miller
  2003-05-26  2:50             ` viro
  0 siblings, 2 replies; 12+ messages in thread
From: Linus Torvalds @ 2003-05-26  2:22 UTC (permalink / raw)
  To: David S. Miller; +Cc: viro, alan, linux-kernel


On Sun, 25 May 2003, David S. Miller wrote:
>    
> That being said, you should be able to safely use module_init() there.

Mind testing (and pushing back if ok) something like this, then?

		Linus

---

===== include/linux/netlink.h 1.10 vs edited =====
--- 1.10/include/linux/netlink.h	Sun Apr  6 06:03:54 2003
+++ edited/include/linux/netlink.h	Sun May 25 19:20:21 2003
@@ -108,7 +108,6 @@
 extern int netlink_attach(int unit, int (*function)(int,struct sk_buff *skb));
 extern void netlink_detach(int unit);
 extern int netlink_post(int unit, struct sk_buff *skb);
-extern int init_netlink(void);
 extern struct sock *netlink_kernel_create(int unit, void (*input)(struct sock *sk, int len));
 extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
 extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock);
===== net/netlink/af_netlink.c 1.24 vs edited =====
--- 1.24/net/netlink/af_netlink.c	Wed May 14 19:19:15 2003
+++ edited/net/netlink/af_netlink.c	Sun May 25 19:12:23 2003
@@ -1070,9 +1070,6 @@
 #endif
 	/* The netlink device handler may be needed early. */ 
 	rtnetlink_init();
-#ifdef CONFIG_NETLINK_DEV
-	init_netlink();
-#endif
 	return 0;
 }
 
===== net/netlink/netlink_dev.c 1.17 vs edited =====
--- 1.17/net/netlink/netlink_dev.c	Tue May 20 19:39:24 2003
+++ edited/net/netlink/netlink_dev.c	Sun May 25 19:14:21 2003
@@ -220,7 +220,7 @@
 	},
 };
 
-int __init init_netlink(void)
+static int __init init_netlink(void)
 {
 	int i;
 
@@ -245,17 +245,7 @@
 	return 0;
 }
 
-#ifdef MODULE
-
-MODULE_LICENSE("GPL");
-
-int init_module(void)
-{
-	printk(KERN_INFO "Network Kernel/User communications module 0.04\n");
-	return init_netlink();
-}
-
-void cleanup_module(void)
+static void __exit cleanup_netlink(void)
 {
 	int i;
 
@@ -267,4 +257,6 @@
 	unregister_chrdev(NETLINK_MAJOR, "netlink");
 }
 
-#endif
+MODULE_LICENSE("GPL");
+__initcall(init_netlink);
+__exitcall(cleanup_netlink);


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

* Re: netlink init order
  2003-05-26  2:22           ` Linus Torvalds
@ 2003-05-26  2:25             ` David S. Miller
  2003-05-26  2:50             ` viro
  1 sibling, 0 replies; 12+ messages in thread
From: David S. Miller @ 2003-05-26  2:25 UTC (permalink / raw)
  To: torvalds; +Cc: viro, alan, linux-kernel

   From: Linus Torvalds <torvalds@transmeta.com>
   Date: Sun, 25 May 2003 19:22:56 -0700 (PDT)

   
   On Sun, 25 May 2003, David S. Miller wrote:
   >    
   > That being said, you should be able to safely use module_init() there.
   
   Mind testing (and pushing back if ok) something like this, then?
   
I will, except I'll use module_init() and module_exit() instead
of __initcall and __exitcall.

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

* Re: netlink init order
  2003-05-26  2:22           ` Linus Torvalds
  2003-05-26  2:25             ` David S. Miller
@ 2003-05-26  2:50             ` viro
  2003-05-26  2:55               ` David S. Miller
  1 sibling, 1 reply; 12+ messages in thread
From: viro @ 2003-05-26  2:50 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: David S. Miller, alan, linux-kernel

On Sun, May 25, 2003 at 07:22:56PM -0700, Linus Torvalds wrote:

> +__initcall(init_netlink);
> +__exitcall(cleanup_netlink);

Err...  That should be

+module_init(init_netlink)
+module_exit(cleanup_netlink)

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

* Re: netlink init order
  2003-05-26  2:50             ` viro
@ 2003-05-26  2:55               ` David S. Miller
  2003-05-26  4:37                 ` viro
  0 siblings, 1 reply; 12+ messages in thread
From: David S. Miller @ 2003-05-26  2:55 UTC (permalink / raw)
  To: viro; +Cc: torvalds, alan, linux-kernel

   From: viro@parcelfarce.linux.theplanet.co.uk
   Date: Mon, 26 May 2003 03:50:16 +0100

   Err...  That should be
   
   +module_init(init_netlink)
   +module_exit(cleanup_netlink)
   
That's exactly what I said.

Al, are you able to read any of my emails?  I sent you one last week
with a patch for fs/proc/task_mmu.c warnings on 64-bit and it
aparently went to the bit bucket... maybe all my mails aren't
making it your way :(


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

* Re: netlink init order
  2003-05-26  2:55               ` David S. Miller
@ 2003-05-26  4:37                 ` viro
  0 siblings, 0 replies; 12+ messages in thread
From: viro @ 2003-05-26  4:37 UTC (permalink / raw)
  To: David S. Miller; +Cc: torvalds, alan, linux-kernel

On Sun, May 25, 2003 at 07:55:41PM -0700, David S. Miller wrote:
>    From: viro@parcelfarce.linux.theplanet.co.uk
>    Date: Mon, 26 May 2003 03:50:16 +0100
> 
>    Err...  That should be
>    
>    +module_init(init_netlink)
>    +module_exit(cleanup_netlink)
>    
> That's exactly what I said.

Yeah - I saw your mail right after I'd sent reply.
 
> Al, are you able to read any of my emails?  I sent you one last week
> with a patch for fs/proc/task_mmu.c warnings on 64-bit and it
> aparently went to the bit bucket...

Looks like that one had ;-/  Resend it, OK?

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

end of thread, other threads:[~2003-05-26  4:24 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-25 20:27 oops with bk kernel as of 2003-05-25T13:00:00-07 Ulrich Drepper
2003-05-25 21:30 ` viro
2003-05-25 21:51   ` [PATCH] " viro
2003-05-25 22:07     ` netlink init order viro
2003-05-25 22:12       ` Linus Torvalds
2003-05-25 22:20         ` viro
2003-05-26  2:07         ` David S. Miller
2003-05-26  2:22           ` Linus Torvalds
2003-05-26  2:25             ` David S. Miller
2003-05-26  2:50             ` viro
2003-05-26  2:55               ` David S. Miller
2003-05-26  4:37                 ` viro

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).