Package: kexec-tools
Version: 1:2.0.4-1
Severity: normal
Tags: patch

Dear Maintainer,

One of those bugs that make me wonder why nobody else came across
them. Severity left to normal although it's a grave functionality bug
but it might be caused by some of the non-Debian components on my
system.

This is a Raspberry Pi, running Debian wheezy in the armel
architecture, on a home-brew 3.10.x vmlinux kernel (the fork provided
by the Raspberry folks), and also a home-brew initrd. Now trying out
an 3.14 vanilla kernel using a DTB I tried kexec from jessie for
the --dtb option, but when using --load I instead got:

    Base address: cffea0 is not page aligned

Digging around in the code revealed initrd_base is simply computed
from the kernel image size without asserting any page alignment. The
patch below fixes this for that specific use case and resulted in
successful reboot using a 3.10 kernel while 3.14 fails, for reasons
that are very likely are outside kexec's domain.

Please review carefully, perhaps with the help of people who have more
understanding of the code than I do. Also other architectures should
be checked whether the same issue exists there, too. At a first
glance it seems they are not affected but I might be wrong.

    Christoph

-- System Information:
Debian Release: jessie/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: armel (armv7l)

Kernel: Linux 3.10.49 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash


diff --git a/kexec/arch/arm/kexec-zImage-arm.c 
b/kexec/arch/arm/kexec-zImage-arm.c
index dd2e06f..c5e78e1 100644
--- a/kexec/arch/arm/kexec-zImage-arm.c
+++ b/kexec/arch/arm/kexec-zImage-arm.c
@@ -343,7 +343,7 @@ int zImage_arm_load(int argc, char **argv, const char *buf, 
off_t len,
        /* assume the maximum kernel compression ratio is 4,
         * and just to be safe, place ramdisk after that
         */
-       initrd_base = base + len * 4;
+       initrd_base = _ALIGN_UP(base + len * 4, getpagesize());
 
        if (use_atags) {
                /*

Attachment: signature.asc
Description: Digital signature

Reply via email to