linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* kallsyms gate page patch breaks module lookups
@ 2005-01-10 11:13 Anton Blanchard
  2005-01-10 13:44 ` Keith Owens
  0 siblings, 1 reply; 3+ messages in thread
From: Anton Blanchard @ 2005-01-10 11:13 UTC (permalink / raw)
  To: kaos, akpm; +Cc: linux-kernel


Hi Keith,

Your recent patch looks to break module kallsyms lookups. On ppc64
current -bk shows this in an oops:

Oops: Exception in kernel mode, sig: 5 [#1]
...
NIP [d000000000036028] __bss_stop+0xfffffffff84f368/0x340
LR [d000000000036024] __bss_stop+0xfffffffff84f364/0x340
Call Trace:
[c00000000231fd10] [d000000000036024] __bss_stop+0xfffffffff84f364/0x340 (unreliable)
[c00000000231fd90] [c000000000078750] .sys_init_module+0x2fc/0x4d8
[c00000000231fe30] [c00000000000d500] syscall_exit+0x0/0x18

Backing out the patch below, things work as expected:

Oops: Exception in kernel mode, sig: 5 [#1]
...
NIP [d000000000036028] .myinit+0x28/0x44 [mod]
LR [d000000000036024] .myinit+0x24/0x44 [mod]
Call Trace:
[c000000002313d10] [d000000000036024] .myinit+0x24/0x44 [mod] (unreliable)
[c000000002313d90] [c000000000078750] .sys_init_module+0x2fc/0x4d8
[c000000002313e30] [c00000000000d500] syscall_exit+0x0/0x18

It looks like if CONFIG_KALLSYMS_ALL is set then we never look up module
addresses.

Anton

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/12/28 22:16:26+01:00 kaos@ocs.com.au 
#   kallsyms: gate page is part of the kernel, honour CONFIG_KALLSYMS_ALL
#   
#   * Treat the gate page as part of the kernel, to improve kernel backtraces.
#   
#   * Honour CONFIG_KALLSYMS_ALL, all symbols are valid, not just text.
#   
#   Signed-off-by: Keith Owens <kaos@ocs.com.au>
#   Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
# 
# kernel/kallsyms.c
#   2004/11/28 04:42:24+01:00 kaos@ocs.com.au +11 -4
#   kallsyms: gate page is part of the kernel, honour CONFIG_KALLSYMS_ALL
# 
diff -Nru a/kernel/kallsyms.c b/kernel/kallsyms.c
--- a/kernel/kallsyms.c	2005-01-10 22:01:10 +11:00
+++ b/kernel/kallsyms.c	2005-01-10 22:01:10 +11:00
@@ -18,6 +18,13 @@
 #include <linux/fs.h>
 #include <linux/err.h>
 #include <linux/proc_fs.h>
+#include <linux/mm.h>
+
+#ifdef CONFIG_KALLSYMS_ALL
+#define all_var 1
+#else
+#define all_var 0
+#endif
 
 /* These will be re-linked against their real values during the second link stage */
 extern unsigned long kallsyms_addresses[] __attribute__((weak));
@@ -30,7 +37,7 @@
 extern unsigned long kallsyms_markers[] __attribute__((weak));
 
 /* Defined by the linker script. */
-extern char _stext[], _etext[], _sinittext[], _einittext[];
+extern char _stext[], _etext[], _sinittext[], _einittext[], _end[];
 
 static inline int is_kernel_inittext(unsigned long addr)
 {
@@ -44,7 +51,7 @@
 {
 	if (addr >= (unsigned long)_stext && addr <= (unsigned long)_etext)
 		return 1;
-	return 0;
+	return in_gate_area_no_task(addr);
 }
 
 /* expand a compressed symbol data into the resulting uncompressed string,
@@ -147,7 +154,7 @@
 	namebuf[KSYM_NAME_LEN] = 0;
 	namebuf[0] = 0;
 
-	if (is_kernel_text(addr) || is_kernel_inittext(addr)) {
+	if (all_var || is_kernel_text(addr) || is_kernel_inittext(addr)) {
 		unsigned long symbol_end=0;
 
 		/* do a binary search on the sorted kallsyms_addresses array */
@@ -181,7 +188,7 @@
 			if (is_kernel_inittext(addr))
 				symbol_end = (unsigned long)_einittext;
 			else
-				symbol_end = (unsigned long)_etext;
+				symbol_end = all_var ? (unsigned long)_end : (unsigned long)_etext;
 		}
 
 		*symbolsize = symbol_end - kallsyms_addresses[low];

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: kallsyms gate page patch breaks module lookups
  2005-01-10 11:13 kallsyms gate page patch breaks module lookups Anton Blanchard
@ 2005-01-10 13:44 ` Keith Owens
  2005-01-10 16:33   ` Sam Ravnborg
  0 siblings, 1 reply; 3+ messages in thread
From: Keith Owens @ 2005-01-10 13:44 UTC (permalink / raw)
  To: Anton Blanchard; +Cc: akpm, linux-kernel, sam

On Mon, 10 Jan 2005 22:13:37 +1100, 
Anton Blanchard <anton@samba.org> wrote:
>Your recent patch looks to break module kallsyms lookups....
>It looks like if CONFIG_KALLSYMS_ALL is set then we never look up module
>addresses.

Separate lookups for kernel and modules when CONFIG_KALLSYMS_ALL=y.

Signed-off-by: Keith Owens <kaos@ocs.com.au>

Index: 2.6.10-bk13/kernel/kallsyms.c
===================================================================
--- 2.6.10-bk13.orig/kernel/kallsyms.c	2005-01-11 00:42:19.600615731 +1100
+++ 2.6.10-bk13/kernel/kallsyms.c	2005-01-11 00:42:41.520243100 +1100
@@ -53,6 +53,13 @@ static inline int is_kernel_text(unsigne
 	return in_gate_area_no_task(addr);
 }
 
+static inline int is_kernel(unsigned long addr)
+{
+	if (addr >= (unsigned long)_stext && addr <= (unsigned long)_end)
+		return 1;
+	return in_gate_area_no_task(addr);
+}
+
 /* expand a compressed symbol data into the resulting uncompressed string,
    given the offset to where the symbol is in the compressed stream */
 static unsigned int kallsyms_expand_symbol(unsigned int off, char *result)
@@ -153,7 +160,8 @@ const char *kallsyms_lookup(unsigned lon
 	namebuf[KSYM_NAME_LEN] = 0;
 	namebuf[0] = 0;
 
-	if (all_var || is_kernel_text(addr) || is_kernel_inittext(addr)) {
+	if ((all_var && is_kernel(addr)) ||
+	    (!all_var && (is_kernel_text(addr) || is_kernel_inittext(addr)))) {
 		unsigned long symbol_end=0;
 
 		/* do a binary search on the sorted kallsyms_addresses array */


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: kallsyms gate page patch breaks module lookups
  2005-01-10 13:44 ` Keith Owens
@ 2005-01-10 16:33   ` Sam Ravnborg
  0 siblings, 0 replies; 3+ messages in thread
From: Sam Ravnborg @ 2005-01-10 16:33 UTC (permalink / raw)
  To: Keith Owens; +Cc: Anton Blanchard, akpm, linux-kernel, sam

On Tue, Jan 11, 2005 at 12:44:29AM +1100, Keith Owens wrote:
> On Mon, 10 Jan 2005 22:13:37 +1100, 
> Anton Blanchard <anton@samba.org> wrote:
> >Your recent patch looks to break module kallsyms lookups....
> >It looks like if CONFIG_KALLSYMS_ALL is set then we never look up module
> >addresses.
> 
> Separate lookups for kernel and modules when CONFIG_KALLSYMS_ALL=y.

Applied

	Sam

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-01-10 16:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-10 11:13 kallsyms gate page patch breaks module lookups Anton Blanchard
2005-01-10 13:44 ` Keith Owens
2005-01-10 16:33   ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).