* [PATCH 1/3] kbuild: Increase kallsyms max symbol length @ 2013-08-11 0:55 Andi Kleen 2013-08-11 0:55 ` [PATCH 2/3] Kbuild: Handle longer symbols in kallsyms.c Andi Kleen 2013-08-11 0:55 ` [PATCH 3/3] kprobes: Use KSYM_NAME_LEN to size identifier buffers Andi Kleen 0 siblings, 2 replies; 4+ messages in thread From: Andi Kleen @ 2013-08-11 0:55 UTC (permalink / raw) To: linux-kernel; +Cc: mmarek, linux-kbuild, Joe Mario, Andi Kleen From: Joe Mario <jmario@redhat.com> [AK: This seems like a ticking time bomb even without LTO, so should be merged now. It causes very weird problems. Thanks to Joe for tracking them down.] With the added postfixes that LTO adds for local symbols, the longest name in the kernel overflows the namebuf[KSYM_NAME_LEN] array by two bytes. That name is: __pci_fixup_resumePCI_VENDOR_ID_SERVERWORKSPCI_DEVICE_ID_SERVERWORKS_HT1000SBquirk_disable_broadcom_boot_interrupt.1488004.672802 Double the max symbol name length. Signed-off-by: Andi Kleen <ak@linux.intel.com> --- include/linux/kallsyms.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h index 6883e19..711a50f 100644 --- a/include/linux/kallsyms.h +++ b/include/linux/kallsyms.h @@ -9,7 +9,7 @@ #include <linux/kernel.h> #include <linux/stddef.h> -#define KSYM_NAME_LEN 128 +#define KSYM_NAME_LEN 256 #define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \ 2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1) -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] Kbuild: Handle longer symbols in kallsyms.c 2013-08-11 0:55 [PATCH 1/3] kbuild: Increase kallsyms max symbol length Andi Kleen @ 2013-08-11 0:55 ` Andi Kleen 2013-08-11 0:55 ` [PATCH 3/3] kprobes: Use KSYM_NAME_LEN to size identifier buffers Andi Kleen 1 sibling, 0 replies; 4+ messages in thread From: Andi Kleen @ 2013-08-11 0:55 UTC (permalink / raw) To: linux-kernel; +Cc: mmarek, linux-kbuild, Andi Kleen From: Andi Kleen <ak@linux.intel.com> Also warn for too long symbols Signed-off-by: Andi Kleen <ak@linux.intel.com> --- scripts/kallsyms.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 6940f00..e5af4c5 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -27,7 +27,7 @@ #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) #endif -#define KSYM_NAME_LEN 128 +#define KSYM_NAME_LEN 256 struct sym_entry { unsigned long long addr; @@ -118,6 +118,12 @@ static int read_symbol(FILE *in, struct sym_entry *s) fprintf(stderr, "Read error or end of file.\n"); return -1; } + if (strlen(str) > KSYM_NAME_LEN) { + fprintf(stderr, "Symbol %s too long for kallsyms.\n" + "Please increae KSYM_NAME_LEN both in kernel and kallsyms.c", + str); + return -1; + } sym = str; /* skip prefix char */ -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] kprobes: Use KSYM_NAME_LEN to size identifier buffers 2013-08-11 0:55 [PATCH 1/3] kbuild: Increase kallsyms max symbol length Andi Kleen 2013-08-11 0:55 ` [PATCH 2/3] Kbuild: Handle longer symbols in kallsyms.c Andi Kleen @ 2013-08-11 0:55 ` Andi Kleen 2013-08-12 4:31 ` Ananth N Mavinakayanahalli 1 sibling, 1 reply; 4+ messages in thread From: Andi Kleen @ 2013-08-11 0:55 UTC (permalink / raw) To: linux-kernel; +Cc: mmarek, linux-kbuild, Joe Mario, ananth, Andi Kleen From: Joe Mario <jmario@redhat.com> Use KSYM_NAME_LEN to size identifier buffers, so that it can be easier increased. Cc: ananth@in.ibm.com Signed-off-by: Joe Mario <jmario@redhat.com> Signed-off-by: Andi Kleen <ak@linux.intel.com> --- kernel/kprobes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 6e33498..e174daf 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -2083,7 +2083,7 @@ static int __init init_kprobes(void) { int i, err = 0; unsigned long offset = 0, size = 0; - char *modname, namebuf[128]; + char *modname, namebuf[KSYM_NAME_LEN]; const char *symbol_name; void *addr; struct kprobe_blackpoint *kb; @@ -2209,7 +2209,7 @@ static int __kprobes show_kprobe_addr(struct seq_file *pi, void *v) const char *sym = NULL; unsigned int i = *(loff_t *) v; unsigned long offset = 0; - char *modname, namebuf[128]; + char *modname, namebuf[KSYM_NAME_LEN]; head = &kprobe_table[i]; preempt_disable(); -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 3/3] kprobes: Use KSYM_NAME_LEN to size identifier buffers 2013-08-11 0:55 ` [PATCH 3/3] kprobes: Use KSYM_NAME_LEN to size identifier buffers Andi Kleen @ 2013-08-12 4:31 ` Ananth N Mavinakayanahalli 0 siblings, 0 replies; 4+ messages in thread From: Ananth N Mavinakayanahalli @ 2013-08-12 4:31 UTC (permalink / raw) To: Andi Kleen; +Cc: linux-kernel, mmarek, linux-kbuild, Joe Mario, Andi Kleen On Sat, Aug 10, 2013 at 05:55:33PM -0700, Andi Kleen wrote: > From: Joe Mario <jmario@redhat.com> > > Use KSYM_NAME_LEN to size identifier buffers, so that it can > be easier increased. > > Cc: ananth@in.ibm.com > Signed-off-by: Joe Mario <jmario@redhat.com> > Signed-off-by: Andi Kleen <ak@linux.intel.com> Acked-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> > --- > kernel/kprobes.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/kprobes.c b/kernel/kprobes.c > index 6e33498..e174daf 100644 > --- a/kernel/kprobes.c > +++ b/kernel/kprobes.c > @@ -2083,7 +2083,7 @@ static int __init init_kprobes(void) > { > int i, err = 0; > unsigned long offset = 0, size = 0; > - char *modname, namebuf[128]; > + char *modname, namebuf[KSYM_NAME_LEN]; > const char *symbol_name; > void *addr; > struct kprobe_blackpoint *kb; > @@ -2209,7 +2209,7 @@ static int __kprobes show_kprobe_addr(struct seq_file *pi, void *v) > const char *sym = NULL; > unsigned int i = *(loff_t *) v; > unsigned long offset = 0; > - char *modname, namebuf[128]; > + char *modname, namebuf[KSYM_NAME_LEN]; > > head = &kprobe_table[i]; > preempt_disable(); > -- > 1.8.3.1 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-08-12 4:32 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-08-11 0:55 [PATCH 1/3] kbuild: Increase kallsyms max symbol length Andi Kleen 2013-08-11 0:55 ` [PATCH 2/3] Kbuild: Handle longer symbols in kallsyms.c Andi Kleen 2013-08-11 0:55 ` [PATCH 3/3] kprobes: Use KSYM_NAME_LEN to size identifier buffers Andi Kleen 2013-08-12 4:31 ` Ananth N Mavinakayanahalli
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox