Re: [PATCH 6/7] setup.c: clean up initrd related code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/19/06, Atsushi Nemoto <anemo@xxxxxxxxxxxxx> wrote:
On Fri, 13 Oct 2006 14:39:05 +0200, Franck Bui-Huu <vagabon.xyz@xxxxxxxxx> wrote:
> +             end = __pa(initrd_end);
> +             initrd_end = (unsigned long)__va(end);
> +             initrd_start = (unsigned long)__va(__pa(initrd_start));

At last I tested whole patchset on 64-bit and see this is not enough.

Thanks for testing. You're right this is not enough since CPHYSADDR()
is not used anymore by __pa(). That shows that usage of __va(__pa(x))
construction to sanitize sign extension was weak since it relied on
__pa() implementation. My own fault...


If I passed 0x000000008XXXXXXX instead of 0xffffffff8XXXXXXX to
initrd_start and initrd_end, the result of __pa() is not what I
wanted.  This is a proposal fix.


I would rather move this fix into initrd start setup function as it
was done by old code. We know that some bootloaders forget sign
extension on 64 bits kernel. But if for example the sign extension is
forgotten by a board specific code, we shouldn't automatically fix the
mistake, but rather fix the board specific code. So I would do instead
of your fix:

--- arch/mips/kernel/setup.c.orig       2006-10-19 11:31:12.000000000 +0900
+++ arch/mips/kernel/setup.c    2006-10-19 13:06:39.000000000 +0900
@@ -199,6 +199,14 @@
                 * 32-bit. We need also to switch from KSEG0 to XKPHYS
                 * addresses now, so the code can now safely use __pa().
                 */
+#ifdef CONFIG_64BIT
+               if (initrd_start < XKPHYS)
+                       panic("initrd start (%08lx) < XKPHYS", initrd_start);
+#endif

--
              Franck


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux