[source] kernel: fix crashlog on x86/64

LEDE Commits lede-commits at lists.infradead.org
Mon Aug 15 04:21:06 PDT 2016


jow pushed a commit to source.git, branch master:
https://git.lede-project.org/?p=source.git;a=commitdiff;h=d9345bc5bf8063ce433c0152893f93000fb0ddfb

commit d9345bc5bf8063ce433c0152893f93000fb0ddfb
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Mon Aug 15 12:14:50 2016 +0200

    kernel: fix crashlog on x86/64
    
    The bootmem area reserved for crashlog might be smaller than CRASHLOG_OFFSET
    bytes, leading to an integer underflow when calculating the memory address
    in crashlog_set_addr() which subsequently causes the kernel to crash when
    attempting to vmap() the crashlog pages.
    
    Change the logic to only consider the offset when the size of the used memory
    area is sufficient.
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 target/linux/generic/patches-4.4/930-crashlog.patch | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/target/linux/generic/patches-4.4/930-crashlog.patch b/target/linux/generic/patches-4.4/930-crashlog.patch
index bb97c90..fdc80d7 100644
--- a/target/linux/generic/patches-4.4/930-crashlog.patch
+++ b/target/linux/generic/patches-4.4/930-crashlog.patch
@@ -43,7 +43,7 @@
  
 --- /dev/null
 +++ b/kernel/crashlog.c
-@@ -0,0 +1,209 @@
+@@ -0,0 +1,213 @@
 +/*
 + * Crash information logger
 + * Copyright (C) 2010 Felix Fietkau <nbd at nbd.name>
@@ -117,7 +117,11 @@
 +	if (addr + size > limit)
 +		size = limit - addr;
 +
-+	crashlog_addr = addr + size - CRASHLOG_OFFSET;
++	crashlog_addr = addr;
++
++	if (addr + size > CRASHLOG_OFFSET)
++		crashlog_addr += size - CRASHLOG_OFFSET;
++
 +	return true;
 +}
 +



More information about the lede-commits mailing list