Skip to contentSkip to conversation

MIPS: OCTEON: Don't clobber bootloader data structures.

PATCH Applied David Daney 2 participants 2 messages Jun 12, 2013 – Jun 13, 2013 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: OCTEON: Don't clobber bootloader data structures.

From: David Daney <[email protected]>

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.

---

This should probably go into 3.10

 arch/mips/cavium-octeon/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/cavium-octeon/setup.c +1 -1
index 01b1b3f..1e1e18c 100644
@@ -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;
Signature · 1 line
1.7.11.7
Applied
#1 lore raw
Quoted 8 lines · David Daney

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.

Quoted 4 lines

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.

Thanks, applied. Will send to Linus with the next pull request.

Ralf