mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
KSYM_SYMBOL_LEN fixes
Miles Lane tailing /sys files hit a BUG which Pekka Enberg has tracked
to my 966c8c12dc sprint_symbol(): use
less stack exposing a bug in slub's list_locations() -
kallsyms_lookup() writes a 0 to namebuf[KSYM_NAME_LEN-1], but that was
beyond the end of page provided.
The 100 slop which list_locations() allows at end of page looks roughly
enough for all the other stuff it might print after the symbol before
it checks again: break out KSYM_SYMBOL_LEN earlier than before.
Latencytop and ftrace and are using KSYM_NAME_LEN buffers where they
need KSYM_SYMBOL_LEN buffers, and vmallocinfo a 2*KSYM_NAME_LEN buffer
where it wants a KSYM_SYMBOL_LEN buffer: fix those before anyone copies
them.
[[email protected]: ftrace.h needs module.h]
Signed-off-by: Hugh Dickins <[email protected]>
Cc: Christoph Lameter <[email protected]>
Cc Miles Lane <[email protected]>
Acked-by: Pekka Enberg <[email protected]>
Acked-by: Steven Rostedt <[email protected]>
Acked-by: Frederic Weisbecker <[email protected]>
Cc: Rusty Russell <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
6ee5a399d6
commit
9c24624727
5 changed files with 6 additions and 5 deletions
|
|
@ -3597,7 +3597,7 @@ static int list_locations(struct kmem_cache *s, char *buf,
|
|||
for (i = 0; i < t.count; i++) {
|
||||
struct location *l = &t.loc[i];
|
||||
|
||||
if (len > PAGE_SIZE - 100)
|
||||
if (len > PAGE_SIZE - KSYM_SYMBOL_LEN - 100)
|
||||
break;
|
||||
len += sprintf(buf + len, "%7ld ", l->count);
|
||||
|
||||
|
|
|
|||
|
|
@ -1717,7 +1717,7 @@ static int s_show(struct seq_file *m, void *p)
|
|||
v->addr, v->addr + v->size, v->size);
|
||||
|
||||
if (v->caller) {
|
||||
char buff[2 * KSYM_NAME_LEN];
|
||||
char buff[KSYM_SYMBOL_LEN];
|
||||
|
||||
seq_putc(m, ' ');
|
||||
sprint_symbol(buff, (unsigned long)v->caller);
|
||||
|
|
|
|||
Loading…
Reference in a new issue