* [PATCH] initrd: Fix virtual/physical mix-up in overwrite test
@ 2007-12-16 10:51 Geert Uytterhoeven
2007-12-17 4:14 ` Roman Zippel
2007-12-18 11:01 ` Andrew Morton
0 siblings, 2 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2007-12-16 10:51 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-arch, Linux Kernel Development, Linux/m68k
On recent kernels, I get the following error when using an initrd:
| initrd overwritten (0x00b78000 < 0x07668000) - disabling it.
My Amiga 4000 has 12 MiB of RAM at physical address 0x07400000 (virtual
0x00000000).
The initrd is located at the end of RAM: 0x00b78000 - 0x00c00000 (virtual).
The overwrite test compares the (virtual) initrd location to the (physical)
first available memory location, which fails.
This patch converts initrd_start to a page frame number, so it can be safely
compared with min_low_pfn.
Before the introduction of discontiguous memory support on m68k
(12d810c1b8c2b913d48e629e2b5c01d105029839), min_low_pfn was just left
untouched by the m68k-specific code (zero, I guess), and everything worked
fine.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
On several platforms, initrd_below_start_ok is set to 1:
| arch/mips/kernel/setup.c: initrd_below_start_ok = 1;
| arch/parisc/mm/init.c: initrd_below_start_ok = 1;
| arch/powerpc/kernel/prom.c: initrd_below_start_ok = 1;
| arch/ppc/platforms/hdpu.c: initrd_below_start_ok = 1;
| arch/xtensa/kernel/setup.c: initrd_below_start_ok = 1;
Some of these may be workarounds for this bug. Please check.
init/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/init/main.c
+++ b/init/main.c
@@ -598,9 +598,9 @@ asmlinkage void __init start_kernel(void
#ifdef CONFIG_BLK_DEV_INITRD
if (initrd_start && !initrd_below_start_ok &&
- initrd_start < min_low_pfn << PAGE_SHIFT) {
+ virt_to_pfn(initrd_start) < min_low_pfn) {
printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - "
- "disabling it.\n",initrd_start,min_low_pfn << PAGE_SHIFT);
+ "disabling it.\n", virt_to_pfn(initrd_start), min_low_pfn);
initrd_start = 0;
}
#endif
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] initrd: Fix virtual/physical mix-up in overwrite test 2007-12-16 10:51 [PATCH] initrd: Fix virtual/physical mix-up in overwrite test Geert Uytterhoeven @ 2007-12-17 4:14 ` Roman Zippel 2007-12-18 11:01 ` Andrew Morton 1 sibling, 0 replies; 10+ messages in thread From: Roman Zippel @ 2007-12-17 4:14 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Andrew Morton, linux-arch, Linux Kernel Development, Linux/m68k Hi, On Sunday 16 December 2007, Geert Uytterhoeven wrote: > --- a/init/main.c > +++ b/init/main.c > @@ -598,9 +598,9 @@ asmlinkage void __init start_kernel(void > > #ifdef CONFIG_BLK_DEV_INITRD > if (initrd_start && !initrd_below_start_ok && > - initrd_start < min_low_pfn << PAGE_SHIFT) { > + virt_to_pfn(initrd_start) < min_low_pfn) { > printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - " > - "disabling it.\n",initrd_start,min_low_pfn << PAGE_SHIFT); > + "disabling it.\n", virt_to_pfn(initrd_start), min_low_pfn); > initrd_start = 0; > } > #endif BTW this is some really old code, so another option might be to remove this check completely as the same check is already done via bootmem. bye, Roman ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] initrd: Fix virtual/physical mix-up in overwrite test 2007-12-16 10:51 [PATCH] initrd: Fix virtual/physical mix-up in overwrite test Geert Uytterhoeven 2007-12-17 4:14 ` Roman Zippel @ 2007-12-18 11:01 ` Andrew Morton 2007-12-18 19:52 ` Geert Uytterhoeven 1 sibling, 1 reply; 10+ messages in thread From: Andrew Morton @ 2007-12-18 11:01 UTC (permalink / raw) To: Geert Uytterhoeven; +Cc: linux-arch, Linux Kernel Development, Linux/m68k On Sun, 16 Dec 2007 11:51:00 +0100 (CET) Geert Uytterhoeven <geert@linux-m68k.org> wrote: > On recent kernels, I get the following error when using an initrd: > > | initrd overwritten (0x00b78000 < 0x07668000) - disabling it. > > My Amiga 4000 has 12 MiB of RAM at physical address 0x07400000 (virtual > 0x00000000). > The initrd is located at the end of RAM: 0x00b78000 - 0x00c00000 (virtual). > The overwrite test compares the (virtual) initrd location to the (physical) > first available memory location, which fails. > > This patch converts initrd_start to a page frame number, so it can be safely > compared with min_low_pfn. > > Before the introduction of discontiguous memory support on m68k > (12d810c1b8c2b913d48e629e2b5c01d105029839), min_low_pfn was just left > untouched by the m68k-specific code (zero, I guess), and everything worked > fine. breaks x86. init/main.c: In function 'start_kernel': init/main.c:601: error: implicit declaration of function 'virt_to_pfn' init/main.c:603: warning: format '%08lx' expects type 'long unsigned int', but argument 2 has type 'int' ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] initrd: Fix virtual/physical mix-up in overwrite test 2007-12-18 11:01 ` Andrew Morton @ 2007-12-18 19:52 ` Geert Uytterhoeven 2007-12-18 20:31 ` Andrew Morton 0 siblings, 1 reply; 10+ messages in thread From: Geert Uytterhoeven @ 2007-12-18 19:52 UTC (permalink / raw) To: Andrew Morton; +Cc: linux-arch, Linux Kernel Development, Linux/m68k On Tue, 18 Dec 2007, Andrew Morton wrote: > On Sun, 16 Dec 2007 11:51:00 +0100 (CET) Geert Uytterhoeven <geert@linux-m68k.org> wrote: > > On recent kernels, I get the following error when using an initrd: > > > > | initrd overwritten (0x00b78000 < 0x07668000) - disabling it. > > > > My Amiga 4000 has 12 MiB of RAM at physical address 0x07400000 (virtual > > 0x00000000). > > The initrd is located at the end of RAM: 0x00b78000 - 0x00c00000 (virtual). > > The overwrite test compares the (virtual) initrd location to the (physical) > > first available memory location, which fails. > > > > This patch converts initrd_start to a page frame number, so it can be safely > > compared with min_low_pfn. > > > > Before the introduction of discontiguous memory support on m68k > > (12d810c1b8c2b913d48e629e2b5c01d105029839), min_low_pfn was just left > > untouched by the m68k-specific code (zero, I guess), and everything worked > > fine. > > breaks x86. > > init/main.c: In function 'start_kernel': > init/main.c:601: error: implicit declaration of function 'virt_to_pfn' > init/main.c:603: warning: format '%08lx' expects type 'long unsigned int', but argument 2 has type 'int' Interestingly, virt_to_pfn() exists on a few architectures only :-( So what's the correct portable construct to use instead? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] initrd: Fix virtual/physical mix-up in overwrite test 2007-12-18 19:52 ` Geert Uytterhoeven @ 2007-12-18 20:31 ` Andrew Morton 2007-12-23 10:43 ` Geert Uytterhoeven 0 siblings, 1 reply; 10+ messages in thread From: Andrew Morton @ 2007-12-18 20:31 UTC (permalink / raw) To: Geert Uytterhoeven; +Cc: linux-arch, Linux Kernel Development, Linux/m68k On Tue, 18 Dec 2007 20:52:07 +0100 (CET) Geert Uytterhoeven <geert@linux-m68k.org> wrote: > On Tue, 18 Dec 2007, Andrew Morton wrote: > > On Sun, 16 Dec 2007 11:51:00 +0100 (CET) Geert Uytterhoeven <geert@linux-m68k.org> wrote: > > > On recent kernels, I get the following error when using an initrd: > > > > > > | initrd overwritten (0x00b78000 < 0x07668000) - disabling it. > > > > > > My Amiga 4000 has 12 MiB of RAM at physical address 0x07400000 (virtual > > > 0x00000000). > > > The initrd is located at the end of RAM: 0x00b78000 - 0x00c00000 (virtual). > > > The overwrite test compares the (virtual) initrd location to the (physical) > > > first available memory location, which fails. > > > > > > This patch converts initrd_start to a page frame number, so it can be safely > > > compared with min_low_pfn. > > > > > > Before the introduction of discontiguous memory support on m68k > > > (12d810c1b8c2b913d48e629e2b5c01d105029839), min_low_pfn was just left > > > untouched by the m68k-specific code (zero, I guess), and everything worked > > > fine. > > > > breaks x86. > > > > init/main.c: In function 'start_kernel': > > init/main.c:601: error: implicit declaration of function 'virt_to_pfn' > > init/main.c:603: warning: format '%08lx' expects type 'long unsigned int', but argument 2 has type 'int' > > Interestingly, virt_to_pfn() exists on a few architectures only :-( > > So what's the correct portable construct to use instead? > I guess page_to_pfn(virt_to_page(addr))? ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] initrd: Fix virtual/physical mix-up in overwrite test 2007-12-18 20:31 ` Andrew Morton @ 2007-12-23 10:43 ` Geert Uytterhoeven 2008-06-15 14:07 ` Geert Uytterhoeven 0 siblings, 1 reply; 10+ messages in thread From: Geert Uytterhoeven @ 2007-12-23 10:43 UTC (permalink / raw) To: Andrew Morton; +Cc: linux-arch, Linux Kernel Development, Linux/m68k On Tue, 18 Dec 2007, Andrew Morton wrote: > On Tue, 18 Dec 2007 20:52:07 +0100 (CET) Geert Uytterhoeven <geert@linux-m68k.org> wrote: > > On Tue, 18 Dec 2007, Andrew Morton wrote: > > > On Sun, 16 Dec 2007 11:51:00 +0100 (CET) Geert Uytterhoeven <geert@linux-m68k.org> wrote: > > > > On recent kernels, I get the following error when using an initrd: > > > > > > > > | initrd overwritten (0x00b78000 < 0x07668000) - disabling it. > > > > > > > > My Amiga 4000 has 12 MiB of RAM at physical address 0x07400000 (virtual > > > > 0x00000000). > > > > The initrd is located at the end of RAM: 0x00b78000 - 0x00c00000 (virtual). > > > > The overwrite test compares the (virtual) initrd location to the (physical) > > > > first available memory location, which fails. > > > > > > > > This patch converts initrd_start to a page frame number, so it can be safely > > > > compared with min_low_pfn. > > > > > > > > Before the introduction of discontiguous memory support on m68k > > > > (12d810c1b8c2b913d48e629e2b5c01d105029839), min_low_pfn was just left > > > > untouched by the m68k-specific code (zero, I guess), and everything worked > > > > fine. > > > > > > breaks x86. > > > > > > init/main.c: In function 'start_kernel': > > > init/main.c:601: error: implicit declaration of function 'virt_to_pfn' > > > init/main.c:603: warning: format '%08lx' expects type 'long unsigned int', but argument 2 has type 'int' > > > > Interestingly, virt_to_pfn() exists on a few architectures only :-( > > > > So what's the correct portable construct to use instead? > > > > I guess page_to_pfn(virt_to_page(addr))? New version below. Tested on Amiga. Compile-tested on ia32 (i386_defconfig) and pp64 (ps3_defconfig). Subject: initrd: Fix virtual/physical mix-up in overwrite test From: Geert Uytterhoeven <geert@linux-m68k.org> On recent kernels, I get the following error when using an initrd: | initrd overwritten (0x00b78000 < 0x07668000) - disabling it. My Amiga 4000 has 12 MiB of RAM at physical address 0x07400000 (virtual 0x00000000). The initrd is located at the end of RAM: 0x00b78000 - 0x00c00000 (virtual). The overwrite test compares the (virtual) initrd location to the (physical) first available memory location, which fails. This patch converts initrd_start to a page frame number, so it can be safely compared with min_low_pfn. Before the introduction of discontiguous memory support on m68k (12d810c1b8c2b913d48e629e2b5c01d105029839), min_low_pfn was just left untouched by the m68k-specific code (zero, I guess), and everything worked fine. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> --- On several platforms, initrd_below_start_ok is set to 1: | arch/mips/kernel/setup.c: initrd_below_start_ok = 1; | arch/parisc/mm/init.c: initrd_below_start_ok = 1; | arch/powerpc/kernel/prom.c: initrd_below_start_ok = 1; | arch/ppc/platforms/hdpu.c: initrd_below_start_ok = 1; | arch/xtensa/kernel/setup.c: initrd_below_start_ok = 1; Some of these may be workarounds for this bug. Please check. init/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/init/main.c +++ b/init/main.c @@ -598,9 +598,10 @@ asmlinkage void __init start_kernel(void #ifdef CONFIG_BLK_DEV_INITRD if (initrd_start && !initrd_below_start_ok && - initrd_start < min_low_pfn << PAGE_SHIFT) { + page_to_pfn(virt_to_page(initrd_start)) < min_low_pfn) { printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - " - "disabling it.\n",initrd_start,min_low_pfn << PAGE_SHIFT); + "disabling it.\n", + page_to_pfn(virt_to_page(initrd_start)), min_low_pfn); initrd_start = 0; } #endif Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] initrd: Fix virtual/physical mix-up in overwrite test 2007-12-23 10:43 ` Geert Uytterhoeven @ 2008-06-15 14:07 ` Geert Uytterhoeven 2008-06-16 1:11 ` Andrew Morton 0 siblings, 1 reply; 10+ messages in thread From: Geert Uytterhoeven @ 2008-06-15 14:07 UTC (permalink / raw) To: Andrew Morton; +Cc: linux-arch, Linux Kernel Development, Linux/m68k On Sun, 23 Dec 2007, Geert Uytterhoeven wrote: > New version below. Tested on Amiga. Compile-tested on ia32 (i386_defconfig) and > pp64 (ps3_defconfig). Ping? > Subject: initrd: Fix virtual/physical mix-up in overwrite test > > From: Geert Uytterhoeven <geert@linux-m68k.org> > > On recent kernels, I get the following error when using an initrd: > > | initrd overwritten (0x00b78000 < 0x07668000) - disabling it. > > My Amiga 4000 has 12 MiB of RAM at physical address 0x07400000 (virtual > 0x00000000). > The initrd is located at the end of RAM: 0x00b78000 - 0x00c00000 (virtual). > The overwrite test compares the (virtual) initrd location to the (physical) > first available memory location, which fails. > > This patch converts initrd_start to a page frame number, so it can be safely > compared with min_low_pfn. > > Before the introduction of discontiguous memory support on m68k > (12d810c1b8c2b913d48e629e2b5c01d105029839), min_low_pfn was just left > untouched by the m68k-specific code (zero, I guess), and everything worked > fine. > > Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> > --- > On several platforms, initrd_below_start_ok is set to 1: > > | arch/mips/kernel/setup.c: initrd_below_start_ok = 1; > | arch/parisc/mm/init.c: initrd_below_start_ok = 1; > | arch/powerpc/kernel/prom.c: initrd_below_start_ok = 1; > | arch/ppc/platforms/hdpu.c: initrd_below_start_ok = 1; > | arch/xtensa/kernel/setup.c: initrd_below_start_ok = 1; > > Some of these may be workarounds for this bug. Please check. > > init/main.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > --- a/init/main.c > +++ b/init/main.c > @@ -598,9 +598,10 @@ asmlinkage void __init start_kernel(void > > #ifdef CONFIG_BLK_DEV_INITRD > if (initrd_start && !initrd_below_start_ok && > - initrd_start < min_low_pfn << PAGE_SHIFT) { > + page_to_pfn(virt_to_page(initrd_start)) < min_low_pfn) { > printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - " > - "disabling it.\n",initrd_start,min_low_pfn << PAGE_SHIFT); > + "disabling it.\n", > + page_to_pfn(virt_to_page(initrd_start)), min_low_pfn); > initrd_start = 0; > } > #endif Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] initrd: Fix virtual/physical mix-up in overwrite test 2008-06-15 14:07 ` Geert Uytterhoeven @ 2008-06-16 1:11 ` Andrew Morton 2008-06-16 6:20 ` Geert Uytterhoeven 0 siblings, 1 reply; 10+ messages in thread From: Andrew Morton @ 2008-06-16 1:11 UTC (permalink / raw) To: Geert Uytterhoeven; +Cc: linux-arch, Linux Kernel Development, Linux/m68k On Sun, 15 Jun 2008 16:07:45 +0200 (CEST) Geert Uytterhoeven <geert@linux-m68k.org> wrote: > On Sun, 23 Dec 2007, Geert Uytterhoeven wrote: > > New version below. Tested on Amiga. Compile-tested on ia32 (i386_defconfig) and > > pp64 (ps3_defconfig). > > Ping? You appear to have a six month RTT ;) If this was not a mistaken email and if you have something which needs to be in 2.6.26 then please send it to Linus directly - I'm hiding from you guys for a week. Thanks. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] initrd: Fix virtual/physical mix-up in overwrite test 2008-06-16 1:11 ` Andrew Morton @ 2008-06-16 6:20 ` Geert Uytterhoeven 2008-06-16 7:04 ` Geert Uytterhoeven 0 siblings, 1 reply; 10+ messages in thread From: Geert Uytterhoeven @ 2008-06-16 6:20 UTC (permalink / raw) To: Andrew Morton; +Cc: linux-arch, Linux Kernel Development, Linux/m68k On Sun, 15 Jun 2008, Andrew Morton wrote: > On Sun, 15 Jun 2008 16:07:45 +0200 (CEST) Geert Uytterhoeven <geert@linux-m68k.org> wrote: > > On Sun, 23 Dec 2007, Geert Uytterhoeven wrote: > > > New version below. Tested on Amiga. Compile-tested on ia32 (i386_defconfig) and > > > pp64 (ps3_defconfig). > > > > Ping? > > You appear to have a six month RTT ;) > > If this was not a mistaken email and if you have something which needs > to be in 2.6.26 then please send it to Linus directly - I'm hiding from > you guys for a week. `need' is a strong word. I prefer to have it receive some testing on other platforms. I don't want to risk breaking something this late in the 2.6.26 cycle... Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] initrd: Fix virtual/physical mix-up in overwrite test 2008-06-16 6:20 ` Geert Uytterhoeven @ 2008-06-16 7:04 ` Geert Uytterhoeven 0 siblings, 0 replies; 10+ messages in thread From: Geert Uytterhoeven @ 2008-06-16 7:04 UTC (permalink / raw) To: Andrew Morton; +Cc: linux-arch, Linux Kernel Development, Linux/m68k On Mon, 16 Jun 2008, Geert Uytterhoeven wrote: > On Sun, 15 Jun 2008, Andrew Morton wrote: > > On Sun, 15 Jun 2008 16:07:45 +0200 (CEST) Geert Uytterhoeven <geert@linux-m68k.org> wrote: > > > On Sun, 23 Dec 2007, Geert Uytterhoeven wrote: > > > > New version below. Tested on Amiga. Compile-tested on ia32 (i386_defconfig) and > > > > pp64 (ps3_defconfig). > > > > > > Ping? > > > > You appear to have a six month RTT ;) > > > > If this was not a mistaken email and if you have something which needs > > to be in 2.6.26 then please send it to Linus directly - I'm hiding from > > you guys for a week. > > `need' is a strong word. I prefer to have it receive some testing on > other platforms. I don't want to risk breaking something this late in > the 2.6.26 cycle... And I didn't hear anything from the people who may have workarounds for this bug: | arch/mips/kernel/setup.c: initrd_below_start_ok = 1; | arch/parisc/mm/init.c: initrd_below_start_ok = 1; | arch/powerpc/kernel/prom.c: initrd_below_start_ok = 1; | arch/ppc/platforms/hdpu.c: initrd_below_start_ok = 1; | arch/xtensa/kernel/setup.c: initrd_below_start_ok = 1; Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2008-06-16 7:05 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-12-16 10:51 [PATCH] initrd: Fix virtual/physical mix-up in overwrite test Geert Uytterhoeven 2007-12-17 4:14 ` Roman Zippel 2007-12-18 11:01 ` Andrew Morton 2007-12-18 19:52 ` Geert Uytterhoeven 2007-12-18 20:31 ` Andrew Morton 2007-12-23 10:43 ` Geert Uytterhoeven 2008-06-15 14:07 ` Geert Uytterhoeven 2008-06-16 1:11 ` Andrew Morton 2008-06-16 6:20 ` Geert Uytterhoeven 2008-06-16 7:04 ` Geert Uytterhoeven
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox