linux-mips
[Top] [All Lists]

[PATCH] MIPS: OCTEON: Don't clobber bootloader data structures.

To: linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: [PATCH] MIPS: OCTEON: Don't clobber bootloader data structures.
From: David Daney <ddaney.cavm@gmail.com>
Date: Wed, 12 Jun 2013 11:28:33 -0700
Cc: David Daney <david.daney@cavium.com>, <stable@vger.kernel.org>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=LLB6xyAynAI6jhZjiOPSgZyPcIc1bfok44u+VmNUfPU=; b=H+c8k9huxFKIYI4LEjItxLRQkhx7IXFrShPPzqxK+jpYV5yT1sjjoh4y8OQ/SW8gqW i4E7U9bMwUrhg187l3uCBJfTuy4x1+SNQ/Id8ulWVaT0epM+ThN6oeDb9CpEGEiD6kTN D9qSE+L8QBYyAiBpd79CxlzPYYalW/3yhYV2eE2vtCk+YRTUueOL/HZHSBZjB19C3vYS nWHTQ/SV0asx/mSnSuRps1ZHq4a2p+b//pwI4czCqpbU+TWsoD23IDOxnoGn/PiXjAZi Ev4nnbbRBqVrjU96wfYWBUacLnybDtB5gwpMBma6hV2tCYJmuZ3Bttnym8UeRvxMLX15 eREA==
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
From: David Daney <david.daney@cavium.com>

Commit abe77f90dc (MIPS: Octeon: Add kexec and kdump support) added a
bootmem region for the kernel image itself.  The problem is that this
is rounded up to a 0x100000 boundary, which is memory that may not be
owned by the kernel.  Depending on the kernel's configuration based
size, this 'extra' memory may contain data passed from the bootloader
to the kernel itself, which if clobbered makes the kernel crash in
various ways.

The fix: Quit rounding the size up, so that we only use memory
assigned to the kernel.

Can be applied to v3.8 and later.

Signed-off-by: David Daney <david.daney@cavium.com>
Cc: <stable@vger.kernel.org>
---

This should probably go into 3.10

 arch/mips/cavium-octeon/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index 01b1b3f..1e1e18c 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -996,7 +996,7 @@ void __init plat_mem_setup(void)
        cvmx_bootmem_unlock();
        /* Add the memory region for the kernel. */
        kernel_start = (unsigned long) _text;
-       kernel_size = ALIGN(_end - _text, 0x100000);
+       kernel_size = _end - _text;
 
        /* Adjust for physical offset. */
        kernel_start &= ~0xffffffff80000000ULL;
-- 
1.7.11.7


<Prev in Thread] Current Thread [Next in Thread>