Commit Graph

7 Commits (b6fbe7bd5da6548323030ced25582d90c7a99cc7)

Author SHA1 Message Date
Felix Fietkau 3848e6a246 kernel: crashlog: Avoid out-of-bounds write
vsnprintf returns the number of chars that would have been written, not
the actual number of chars written. This can lead to crashlog_buf->len
being too big which in turn can lead to get_maxlen() returning negative
numbers. The length argument of kmsg_dump_get_buffer will be casted to
a size_t which makes a negative input a big positive number allowing
kmsg_dump_get_buffer to write out of bounds.

Fix this by using vscnprintf which returns the actually written number
of chars.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>

SVN-Revision: 37820
11 years ago
Gabor Juhos d158dfc607 linux/3.3: disable crashlog on PPC
It causes NULL pointer dereference:

[    0.638235] __ioremap(): phys addr 0x7f00000 is RAM lr c025d61c
[    0.644090] Unable to handle kernel paging request for data at address 0x00000000
[    0.651533] Faulting instruction address: 0xc025d620
[    0.656483] Oops: Kernel access of bad area, sig: 11 [#1]
[    0.661856] P1010 RDB
[    0.664113] Modules linked in:
[    0.667152] NIP: c025d620 LR: c025d61c CTR: c000dc38
[    0.672101] REGS: c7831ef0 TRAP: 0300   Not tainted  (3.3.8)
[    0.677740] MSR: 00029000 <CE,EE,ME>  CR: 42022082  XER: 20000000
[    0.683817] DEAR: 00000000, ESR: 00000000
[    0.687811] TASK = c782c000[1] 'swapper' THREAD: c7830000
[    0.693017] GPR00: a1ee0000 c7831fa0 c782c000 00000000 0000214c ffffffff c7831ea6 0001ffff
[    0.701350] GPR08: c03697cc c035fba0 c03697cc c0360000 42022022 00000000 00000000 00000000
[    0.709682] GPR16: c0000a00 00000014 3fffffff 00ffa000 00000015 07fc42bc c0360000 00000000
[    0.718015] GPR24: 00000000 00000000 00001680 c0360000 00000000 c025d5e8 c0390000 c038b824
[    0.726535] NIP [c025d620] crashlog_init_fs+0x38/0xd8
[    0.731560] LR [c025d61c] crashlog_init_fs+0x34/0xd8
[    0.736503] Call Trace:
[    0.738939] [c7831fa0] [c025d61c] crashlog_init_fs+0x34/0xd8 (unreliable)
[    0.745712] [c7831fb0] [c0001e98] do_one_initcall+0xd4/0x198
[    0.751357] [c7831fe0] [c02537f4] kernel_init+0x9c/0x120
[    0.756647] [c7831ff0] [c000c2dc] kernel_thread+0x4c/0x68
[    0.762022] Instruction dump:
[    0.764975] 3860fff4 bfc10008 3fc0c039 90010014 3bfeb824 801f0004 2f800000 41be00a0
[    0.772699] 7c030378 38804000 4bdb38cd 3c00a1ee <81630000> 6000dead 7c691b78 907eb824

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 35435
12 years ago
Florian Fainelli 8ad0b56ba5 do not build crashlog on sparc too
This is crashing the kernel in crashlog_init_fs(), until fixed, disable it
for SPARC too.

Signed-off-by: Florian Fainelli <florian@openwrt.org>

SVN-Revision: 34213
12 years ago
Gabor Juhos b942309f4f generic: use __meminit annotation for crashlog_init_memblock
Fixes this section mismatch warning:
WARNING: vmlinux.o(.meminit.text+0xb14): Section mismatch in reference
from the function memblock_insert_region() to the function
.init.text:crashlog_init_memblock()
The function __meminit memblock_insert_region() references
a function __init crashlog_init_memblock().
If crashlog_init_memblock is only used by memblock_insert_region then
annotate crashlog_init_memblock with a matching annotation.

Also, remove the __init annotations from 'include/linux/crashlog.h'

SVN-Revision: 33137
12 years ago
Florian Fainelli c0561a42e7 disable crashlog on ARM platforms for the moment
It is currently badly broken on ARM, until fixed, disable it

SVN-Revision: 32926
12 years ago
Felix Fietkau b59bc92c6e crashlog: fix dependency, add memblock support
SVN-Revision: 32787
12 years ago
Jonas Gorski eca9950f63 kernel: add preliminary support for linux 3.3
Based on 3.3-rc2

SVN-Revision: 29986
13 years ago