oops with bk kernel as of 2003-05-25T13:00:00-07
Subsystems (2)
-----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/0xbI 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-----
Quoted 13 lines · Ulrich Drepper
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
Quoted 3 lines
I looked at the code and the problem is that
cdev_map== NULL whencdev_addis called.cdev_mapis initialized in a constructor. Maybe the wrong order or a race...
Gack... We have
subsys_initcall(chrdev_init);
in fs/char_dev.c
andcore_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)
fs/char_dev.c +1 -3
@@ -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);
fs/dcache.c +2 -0
@@ -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 (); }
Quoted 2 lines · On Sun, May 25, 2003 at 10:30:40PM +0100…
Guess which one wins... What a mess... How about the following (untested, but AFAICS should work)
[snip]
or, to make it compile, the following:
fs/char_dev.c +1 -3
@@ -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);
fs/dcache.c +2 -0
@@ -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 (); }
netlink init order
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.
Re: netlink init order
Quoted 2 lines · On Sun, 25 May 2003 [email protected] wrote:
BTW, is there any reason why
init_netlink_dev()is not amodule_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
Re: netlink init order
Quoted 4 lines · Linus Torvalds
Quoted 2 lines · On Sun, 25 May 2003 [email protected] wrote:
BTW, is there any reason why
init_netlink_dev()is not amodule_init()?
Grr... init_netlink(), that is.
Quoted 7 lines
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)...
Re: netlink init order
In reply to Linus Torvalds From: Linus Torvalds <[email protected]>
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.
Re: netlink init order
Quoted 2 lines · David S. Miller
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 =====
include/linux/netlink.h +0 -1
@@ -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 =====
net/netlink/af_netlink.c +0 -3
@@ -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 =====
net/netlink/netlink_dev.c +5 -13
@@ -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);
Re: netlink init order
From: Linus Torvalds <[email protected]>
Date: Sun, 25 May 2003 19:22:56 -0700 (PDT)
Quoted 2 lines · David S. Miller
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.
Re: netlink init order
In reply to Linus Torvaldsnet/netlink/netlink_dev.c line 262
Quoted 2 lines · Linus Torvalds
net/netlink/netlink_dev.c +2
-0+__initcall (init_netlink); +__exitcall (cleanup_netlink);
Err... That should be
+module_init(init_netlink)
+module_exit(cleanup_netlink)
Re: netlink init order
From: [email protected]
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 :(
Re: netlink init order
Quoted 9 lines · David S. Miller
From: [email protected]
Date: Mon, 26 May 2003 03:50:16 +0100Err... 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.
Quoted 3 lines
Al, are you able to read any of my emails? I sent you one last week with a patch for
fs/proc/task_mmu.cwarnings on 64-bit and it aparently went to the bit bucket...
Looks like that one had ;-/ Resend it, OK?