linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] check shm mount succeeded in shmem_file_setup
  2002-07-20  4:19     ` Rusty Russell
@ 2002-07-11  5:48       ` Jeff Dike
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Dike @ 2002-07-11  5:48 UTC (permalink / raw)
  To: Rusty Russell; +Cc: linux-kernel

rusty@rustcorp.com.au said:
> Same argument applies to lots of subsystems, but I'd suggest a policy:
> we should be failing the boot rather than coming partially up and
> trying to deal with failures that shouldn't happen. 

OK, I can buy that.

			Jeff


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

* Re: [PATCH] check shm mount succeeded in shmem_file_setup
       [not found] <200207190354.WAA05241@ccure.karaya.com>
@ 2002-07-19  7:53 ` Rusty Russell
  2002-07-19 15:02   ` Jeff Dike
  0 siblings, 1 reply; 4+ messages in thread
From: Rusty Russell @ 2002-07-19  7:53 UTC (permalink / raw)
  To: Jeff Dike; +Cc: linux-kernel

In message <200207190354.WAA05241@ccure.karaya.com> you write:
> The kern_mount(&tmpfs_fs_type) in init_shmem_fs can fail, leaving shm_mnt
> NULL.  A subsequent shmget will enter shmem_file_setup, which will blindly
> dereference shm_mnt.  EIO was my best guess as to the appropriate errno.

I think the bug is checking the return value at all.  This code cannot
be a module (at least without significant furthur work), despite the
fact that someone nicely wrote an exitfunction for it.

And if the initialization fails at boot, we're screwed anyway.

> --- orig/mm/shmem.c     Mon Feb 25 12:50:45 2002
> +++ um/mm/shmem.c       Thu Jul 18 22:16:11 2002
> @@ -1455,6 +1455,9 @@
>         if (!vm_enough_memory((size) >> PAGE_CACHE_SHIFT))
>                 return ERR_PTR(-ENOMEM);
>  
> +       if(shm_mnt == NULL)
> +               return ERR_PTR(-EIO);
> +
>         this.name = name;
>         this.len = strlen(name);
>         this.hash = 0; /* will go */

Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

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

* Re: [PATCH] check shm mount succeeded in shmem_file_setup
  2002-07-19  7:53 ` [PATCH] check shm mount succeeded in shmem_file_setup Rusty Russell
@ 2002-07-19 15:02   ` Jeff Dike
  2002-07-20  4:19     ` Rusty Russell
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Dike @ 2002-07-19 15:02 UTC (permalink / raw)
  To: Rusty Russell; +Cc: linux-kernel

rusty@rustcorp.com.au said:
> And if the initialization fails at boot, we're screwed anyway. 

Why?  If it fails, it still boots fine until something tries using shared
memory.  With UML and my Debian fs, that's Apache, which is the last thing
before the gettys run.

				Jeff


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

* Re: [PATCH] check shm mount succeeded in shmem_file_setup
  2002-07-19 15:02   ` Jeff Dike
@ 2002-07-20  4:19     ` Rusty Russell
  2002-07-11  5:48       ` Jeff Dike
  0 siblings, 1 reply; 4+ messages in thread
From: Rusty Russell @ 2002-07-20  4:19 UTC (permalink / raw)
  To: Jeff Dike; +Cc: linux-kernel

In message <200207191502.KAA02022@ccure.karaya.com> you write:
> rusty@rustcorp.com.au said:
> > And if the initialization fails at boot, we're screwed anyway. 
> 
> Why?  If it fails, it still boots fine until something tries using shared
> memory.  With UML and my Debian fs, that's Apache, which is the last thing
> before the gettys run.

Same argument applies to lots of subsystems, but I'd suggest a policy:
we should be failing the boot rather than coming partially up and
trying to deal with failures that shouldn't happen.

Unfortunately, we don't check init returns at boot, because we
*expect* device driver initialization to fail for builtin device
drivers who have found no device.  It'd be nice to standardize on
-ENODEV for these failures, so we *could* handle these failures
easily, and discourage the current sloppiness.

Cheers,
Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

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

end of thread, other threads:[~2002-07-21 14:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <200207190354.WAA05241@ccure.karaya.com>
2002-07-19  7:53 ` [PATCH] check shm mount succeeded in shmem_file_setup Rusty Russell
2002-07-19 15:02   ` Jeff Dike
2002-07-20  4:19     ` Rusty Russell
2002-07-11  5:48       ` Jeff Dike

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