public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
* Double free of initramfs
@ 2005-03-16 18:49 Ralf Baechle
  2005-03-22  2:21 ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: Ralf Baechle @ 2005-03-16 18:49 UTC (permalink / raw)
  To: linux-arch

In all linker scripts we currently have something like this:

  __init_begin = .;
 ...
   . = ALIGN(4096);
  __initramfs_start = .;
  .init.ramfs : { *(.init.ramfs) }
  __initramfs_end = .;
  ...
  __init_end = .;

It seems all 25 linker scripts in the current bk tree are suffering from
this.  Which mean with CONFIG_BLK_DEV_INITRD enabled first free_initrd_mem
may be called to free the initram disk and just a little later
free_initmem will try to free the entire range again, so either the
linker scripts would need fixing or free_initrd_mem has become obsolete.

  Ralf

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

* Re: Double free of initramfs
  2005-03-16 18:49 Double free of initramfs Ralf Baechle
@ 2005-03-22  2:21 ` Andrew Morton
  2005-03-22 22:10   ` Adrian Bunk
  2005-03-22 22:41   ` Ralf Baechle
  0 siblings, 2 replies; 7+ messages in thread
From: Andrew Morton @ 2005-03-22  2:21 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-arch, Adrian Bunk

Ralf Baechle <ralf@linux-mips.org> wrote:
>
> In all linker scripts we currently have something like this:
> 
>   __init_begin = .;
>  ...
>    . = ALIGN(4096);
>   __initramfs_start = .;
>   .init.ramfs : { *(.init.ramfs) }
>   __initramfs_end = .;
>   ...
>   __init_end = .;
> 
> It seems all 25 linker scripts in the current bk tree are suffering from
> this.  Which mean with CONFIG_BLK_DEV_INITRD enabled first free_initrd_mem
> may be called to free the initram disk and just a little later
> free_initmem will try to free the entire range again, so either the
> linker scripts would need fixing or free_initrd_mem has become obsolete.
> 

Hard call.  I'd be 51% inclined to change the linker scripts so that the
freeing of the initram disk happens explicitly, rather than having it
magically hidden inside the main initmem segment.

Any objections from anyone?

(cc'ed Adrian, who might be interested in raising a patch ;))

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

* Re: Double free of initramfs
  2005-03-22  2:21 ` Andrew Morton
@ 2005-03-22 22:10   ` Adrian Bunk
  2005-03-22 22:41   ` Ralf Baechle
  1 sibling, 0 replies; 7+ messages in thread
From: Adrian Bunk @ 2005-03-22 22:10 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Ralf Baechle, linux-arch

On Mon, Mar 21, 2005 at 06:21:46PM -0800, Andrew Morton wrote:
>...
> (cc'ed Adrian, who might be interested in raising a patch ;))

When did I get the MAINTAINERS entry
  DOES ALL DUMB JOBS
?  ;-)


If you two agree it's the correct solution I can prepare a patch.


cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

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

* Re: Double free of initramfs
  2005-03-22  2:21 ` Andrew Morton
  2005-03-22 22:10   ` Adrian Bunk
@ 2005-03-22 22:41   ` Ralf Baechle
  2005-03-22 22:57     ` Sam Ravnborg
  1 sibling, 1 reply; 7+ messages in thread
From: Ralf Baechle @ 2005-03-22 22:41 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-arch, Adrian Bunk

On Mon, Mar 21, 2005 at 06:21:46PM -0800, Andrew Morton wrote:

> > It seems all 25 linker scripts in the current bk tree are suffering from
> > this.  Which mean with CONFIG_BLK_DEV_INITRD enabled first free_initrd_mem
> > may be called to free the initram disk and just a little later
> > free_initmem will try to free the entire range again, so either the
> > linker scripts would need fixing or free_initrd_mem has become obsolete.
> > 
> 
> Hard call.  I'd be 51% inclined to change the linker scripts so that the
> freeing of the initram disk happens explicitly, rather than having it
> magically hidden inside the main initmem segment.
> 
> Any objections from anyone?
> 
> (cc'ed Adrian, who might be interested in raising a patch ;))

I've cooked that already.  Let me check if I can dig it up from here - I'm
supposed to be on vacation ;-)

  Ralf

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

* Re: Double free of initramfs
  2005-03-22 22:41   ` Ralf Baechle
@ 2005-03-22 22:57     ` Sam Ravnborg
  2005-03-22 23:24       ` Sam Ravnborg
  0 siblings, 1 reply; 7+ messages in thread
From: Sam Ravnborg @ 2005-03-22 22:57 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Andrew Morton, linux-arch, Adrian Bunk

On Tue, Mar 22, 2005 at 10:41:17PM +0000, Ralf Baechle wrote:
> On Mon, Mar 21, 2005 at 06:21:46PM -0800, Andrew Morton wrote:
> 
> > > It seems all 25 linker scripts in the current bk tree are suffering from
> > > this.  Which mean with CONFIG_BLK_DEV_INITRD enabled first free_initrd_mem
> > > may be called to free the initram disk and just a little later
> > > free_initmem will try to free the entire range again, so either the
> > > linker scripts would need fixing or free_initrd_mem has become obsolete.
> > > 
> > 
> > Hard call.  I'd be 51% inclined to change the linker scripts so that the
> > freeing of the initram disk happens explicitly, rather than having it
> > magically hidden inside the main initmem segment.
> > 
> > Any objections from anyone?
> > 
> > (cc'ed Adrian, who might be interested in raising a patch ;))
> 
> I've cooked that already.  Let me check if I can dig it up from here - I'm
> supposed to be on vacation ;-)
>    . = ALIGN(4096);
>   __initramfs_start = .;
>   .init.ramfs : { *(.init.ramfs) }
>   __initramfs_end = .;

Hi Ralf.

When you anyway hack on thins in your vacation please
move the definition of initramfs to asm-generic.

	Sam

Something like this:

===== include/asm-generic/vmlinux.lds.h 1.18 vs edited =====
--- 1.18/include/asm-generic/vmlinux.lds.h	2005-03-14 20:55:39 +01:00
+++ edited/include/asm-generic/vmlinux.lds.h	2005-03-22 23:55:17 +01:00
@@ -97,3 +97,12 @@
 		VMLINUX_SYMBOL(__lock_text_start) = .;			\
 		*(.spinlock.text)					\
 		VMLINUX_SYMBOL(__lock_text_end) = .;
+
+/* initramfs area. */
+# define INITRAMFS							\
+	. = ALIGN(4096);						\
+	.init.ramfs : {							\
+		VMLINUX_SYMBOL(__initramfs_start) = .;			\
+		*(.init.ramfs)						\
+		VMLINUX_SYMBOL(__initramfs_end) = .;			\
+	}

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

* RE: Double free of initramfs
@ 2005-03-22 23:07 Luck, Tony
  0 siblings, 0 replies; 7+ messages in thread
From: Luck, Tony @ 2005-03-22 23:07 UTC (permalink / raw)
  To: Sam Ravnborg, Ralf Baechle; +Cc: Andrew Morton, linux-arch, Adrian Bunk

>+
>+/* initramfs area. */
>+# define INITRAMFS		\
>+	. = ALIGN(4096);		\
>+	.init.ramfs : {						

Why the 4096 alignment?  If you need it page aligned (and I can't
see why you would), then bear in mind that not all architectures
use a 4k pagesize.

-Tony

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

* Re: Double free of initramfs
  2005-03-22 22:57     ` Sam Ravnborg
@ 2005-03-22 23:24       ` Sam Ravnborg
  0 siblings, 0 replies; 7+ messages in thread
From: Sam Ravnborg @ 2005-03-22 23:24 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Andrew Morton, linux-arch, Adrian Bunk

On Tue, Mar 22, 2005 at 11:57:25PM +0100, Sam Ravnborg wrote:
> Something like this:
> 
> ===== include/asm-generic/vmlinux.lds.h 1.18 vs edited =====
> --- 1.18/include/asm-generic/vmlinux.lds.h	2005-03-14 20:55:39 +01:00
> +++ edited/include/asm-generic/vmlinux.lds.h	2005-03-22 23:55:17 +01:00
> @@ -97,3 +97,12 @@
>  		VMLINUX_SYMBOL(__lock_text_start) = .;			\
>  		*(.spinlock.text)					\
>  		VMLINUX_SYMBOL(__lock_text_end) = .;
> +
> +/* initramfs area. */
> +# define INITRAMFS							\
> +	. = ALIGN(4096);						\

Based on Tony's very valid comment this should read:
> +	. = ALIGN(PAGE_SIZE);						\
(Assuming the 4096 was a page alingment).

	Sam

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

end of thread, other threads:[~2005-03-22 23:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-16 18:49 Double free of initramfs Ralf Baechle
2005-03-22  2:21 ` Andrew Morton
2005-03-22 22:10   ` Adrian Bunk
2005-03-22 22:41   ` Ralf Baechle
2005-03-22 22:57     ` Sam Ravnborg
2005-03-22 23:24       ` Sam Ravnborg
  -- strict thread matches above, loose matches on Subject: below --
2005-03-22 23:07 Luck, Tony

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox