linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* chicken/egg between pipefs and initramfs/hotplug
@ 2004-10-25 18:30 Thayne Harbaugh
  2004-10-26 23:29 ` Andrew Morton
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Thayne Harbaugh @ 2004-10-25 18:30 UTC (permalink / raw)
  To: klibc; +Cc: linux-kernel, linux-hotplug-devel

I have a hotplug setup in initramfs.  Everytime that modprobe is called
I get a kernel oops: NULL pointer dereference:

Unable to handle kernel NULL pointer dereference<1>Unable to handle kernel NULL pointer dereference at virtual address 00000014
 printing eip:
c015db49
*pde = 00000000
Oops: 0000 [#1]
PREEMPT SMP
Modules linked in:
CPU:    3
EIP:    0060:[<c015db49>]    Not tainted
EFLAGS: 00010296   (2.6.8)
EIP is at get_pipe_inode+0x9/0xb2
eax: 00000000   ebx: f74f4780   ecx: 00000000   edx: 00000000
esi: f7575580   edi: 0805cbdc   ebp: f767a000   esp: f767bf3c
ds: 007b   es: 007b   ss: 0068
Process default.hotplug (pid: 184, threadinfo÷67a000 task÷4d9110)
Stack: f74f4780 f74f4780 c015dc24 f74d9110 c0168225 f7963ef0 c0392e80 f74f4780
       ffffffe9 f74f4080 f767bfac 00000ff8 c014ff5f f7963cb0 00000001 00000ff8
       f767bfac c0162d17 00000000 f74f4080 fffffff7 bfffdeec f767bfb0 0805cbdc
Call Trace:
 [<c015dc24>] do_pipe+0x32/0x20e
 [<c0168225>] dput+0x9e/0x2b0
 [<c014ff5f>] vfs_read+0x94/0x103
 [<c0162d17>] do_fcntl+0x18c/0x21f
 [<c010a8ad>] sys_pipe+0x11/0x49
 [<c0103f2f>] syscall_call+0x7/0xb
Code: 8b 40 14 89 04 24 e8 4e d5 00 00 85 c0 89 c3 0f 84 8d 00 00


It appears that linux/init/main.c:init() has a chicken/egg problem.
Apparently modprobe and other programs need a pipe and pipefs isn't
mounted until later on in do_basic_setup()/do_initcalls().  That means
that linux/fs/pipe.c:static struct vfsmount *pipe_mnt;  isn't
initialized and blows up when it's derefernced in
linux/fs/pipe.c:get_pipe_inode().

Has this been discussed before?  Is there something that userspace can
wait on until pipefs is mounted or more of the kernel is initialized?  I
did some searching and I just can't turn up a previous discussion about
this - my apologies if it's already been covered.

-- 
Thayne Harbaugh
Linux Networx



-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* Re: chicken/egg between pipefs and initramfs/hotplug
  2004-10-25 18:30 chicken/egg between pipefs and initramfs/hotplug Thayne Harbaugh
@ 2004-10-26 23:29 ` Andrew Morton
  2004-10-28 14:23   ` Thayne Harbaugh
  2004-10-28  7:23 ` Bob Barry
  2004-10-28  7:42 ` Andrew Morton
  2 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2004-10-26 23:29 UTC (permalink / raw)
  To: tharbaugh; +Cc: klibc, linux-kernel, linux-hotplug-devel

Thayne Harbaugh <tharbaugh@lnxi.com> wrote:
>
> It appears that linux/init/main.c:init() has a chicken/egg problem.
> Apparently modprobe and other programs need a pipe and pipefs isn't
> mounted until later on in do_basic_setup()/do_initcalls().  That means
> that linux/fs/pipe.c:static struct vfsmount *pipe_mnt;  isn't
> initialized and blows up when it's derefernced in
> linux/fs/pipe.c:get_pipe_inode().

That's a bit sad.  Does this fix it?

--- 25/fs/pipe.c~a	Tue Oct 26 16:28:44 2004
+++ 25-akpm/fs/pipe.c	Tue Oct 26 16:28:52 2004
@@ -718,5 +718,5 @@ static void __exit exit_pipe_fs(void)
 	mntput(pipe_mnt);
 }
 
-module_init(init_pipe_fs)
+fs_initcall(init_pipe_fs)
 module_exit(exit_pipe_fs)
_



-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_idU88&alloc_id\x12065&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* Re: chicken/egg between pipefs and initramfs/hotplug
  2004-10-25 18:30 chicken/egg between pipefs and initramfs/hotplug Thayne Harbaugh
  2004-10-26 23:29 ` Andrew Morton
@ 2004-10-28  7:23 ` Bob Barry
  2004-10-28  7:42 ` Andrew Morton
  2 siblings, 0 replies; 5+ messages in thread
From: Bob Barry @ 2004-10-28  7:23 UTC (permalink / raw)
  To: linux-hotplug

Thayne -

> you wrote:
> > It appears that linux/init/main.c:init() has a chicken/egg problem...
> Andrew Morton replied:
> That's a bit sad.  Does this fix it?
> 
> --- 25/fs/pipe.c~a      Tue Oct 26 16:28:44 2004
> +++ 25-akpm/fs/pipe.c   Tue Oct 26 16:28:52 2004
> @@ -718,5 +718,5 @@ static void __exit exit_pipe_fs(void)
>         mntput(pipe_mnt);
>  }
>  
> -module_init(init_pipe_fs)
> +fs_initcall(init_pipe_fs)
>  module_exit(exit_pipe_fs)
> _
> 

Did that patch work for you?  I tried it (on vanilla 2.6.10-rc1 with simple
"make bzImage"), but compilation failed:
  CC      fs/pipe.o
fs/pipe.c:722: parse error before "static"
make[1]: *** [fs/pipe.o] Error 1
make: *** [fs] Error 2

Thanks,

Bob Barry


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_idU88&alloc_id\x12065&opÌk
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* Re: chicken/egg between pipefs and initramfs/hotplug
  2004-10-25 18:30 chicken/egg between pipefs and initramfs/hotplug Thayne Harbaugh
  2004-10-26 23:29 ` Andrew Morton
  2004-10-28  7:23 ` Bob Barry
@ 2004-10-28  7:42 ` Andrew Morton
  2 siblings, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2004-10-28  7:42 UTC (permalink / raw)
  To: linux-hotplug

Bob Barry <bobb@absamail.co.za> wrote:
>
> > you wrote:
>  > > It appears that linux/init/main.c:init() has a chicken/egg problem...
>  > Andrew Morton replied:
>  > That's a bit sad.  Does this fix it?
>  > 
>  > --- 25/fs/pipe.c~a      Tue Oct 26 16:28:44 2004
>  > +++ 25-akpm/fs/pipe.c   Tue Oct 26 16:28:52 2004
>  > @@ -718,5 +718,5 @@ static void __exit exit_pipe_fs(void)
>  >         mntput(pipe_mnt);
>  >  }
>  >  
>  > -module_init(init_pipe_fs)
>  > +fs_initcall(init_pipe_fs)
>  >  module_exit(exit_pipe_fs)
>  > _
>  > 
> 
>  Did that patch work for you?

No, the macros we use in there are borked.  Try this:

--- 25/fs/pipe.c~convert-pipefs-to-fs_initcall	2004-10-26 20:06:05.293263776 -0700
+++ 25-akpm/fs/pipe.c	2004-10-26 20:13:52.998161824 -0700
@@ -718,5 +718,5 @@ static void __exit exit_pipe_fs(void)
 	mntput(pipe_mnt);
 }
 
-module_init(init_pipe_fs)
-module_exit(exit_pipe_fs)
+fs_initcall(init_pipe_fs);
+module_exit(exit_pipe_fs);
_



-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_idU88&alloc_id\x12065&opÌk
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* Re: chicken/egg between pipefs and initramfs/hotplug
  2004-10-26 23:29 ` Andrew Morton
@ 2004-10-28 14:23   ` Thayne Harbaugh
  0 siblings, 0 replies; 5+ messages in thread
From: Thayne Harbaugh @ 2004-10-28 14:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: klibc, linux-kernel, linux-hotplug-devel

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

Sorry to take so long to reply.

On Tue, 2004-10-26 at 16:29 -0700, Andrew Morton wrote:
> Thayne Harbaugh <tharbaugh@lnxi.com> wrote:
> >
> > It appears that linux/init/main.c:init() has a chicken/egg problem.
> > Apparently modprobe and other programs need a pipe and pipefs isn't
> > mounted until later on in do_basic_setup()/do_initcalls().  That means
> > that linux/fs/pipe.c:static struct vfsmount *pipe_mnt;  isn't
> > initialized and blows up when it's derefernced in
> > linux/fs/pipe.c:get_pipe_inode().
> 
> That's a bit sad.  Does this fix it?
> 
> --- 25/fs/pipe.c~a	Tue Oct 26 16:28:44 2004
> +++ 25-akpm/fs/pipe.c	Tue Oct 26 16:28:52 2004
> @@ -718,5 +718,5 @@ static void __exit exit_pipe_fs(void)
>  	mntput(pipe_mnt);
>  }
>  
> -module_init(init_pipe_fs)
> +fs_initcall(init_pipe_fs)
>  module_exit(exit_pipe_fs)
> _

Works great, other than the omitted ';' for the fs_initcall():

--- fs/pipe.c.orig      2004-10-28 08:59:47.383192448 -0600
+++ fs/pipe.c   2004-10-28 08:57:07.746460920 -0600
@@ -718,5 +718,5 @@
        mntput(pipe_mnt);
 }

-module_init(init_pipe_fs)
+fs_initcall(init_pipe_fs);
 module_exit(exit_pipe_fs)

Thanks.

-- 
Thayne Harbaugh
Linux Networx

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

end of thread, other threads:[~2004-10-28 14:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-25 18:30 chicken/egg between pipefs and initramfs/hotplug Thayne Harbaugh
2004-10-26 23:29 ` Andrew Morton
2004-10-28 14:23   ` Thayne Harbaugh
2004-10-28  7:23 ` Bob Barry
2004-10-28  7:42 ` Andrew Morton

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