Discussion:
[PATCH v3] Only print debug message when failed to serach for kernel symbol from /proc/kallsyms
Baoquan He
2017-03-03 03:52:15 UTC
Permalink
Kernel symbol page_offset_base could be unavailable when mm KASLR code is
not compiled in kernel. It's unappropriate to print out error message
when failed to search for page_offset_base from /proc/kallsyms. Seems now
there is not a way to find out if mm KASLR is compiled in or not. An
alternative approach is only printing out debug message in get_kernel_sym
if failed to search a expected kernel symbol.

Do it in this patch, a simple fix.

Signed-off-by: Baoquan He <***@redhat.com>
---
kexec/arch/i386/crashdump-x86.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
index 88aeee3..c4cf201 100644
--- a/kexec/arch/i386/crashdump-x86.c
+++ b/kexec/arch/i386/crashdump-x86.c
@@ -127,7 +127,7 @@ static unsigned long long get_kernel_sym(const char *symbol)
}
}

- fprintf(stderr, "Cannot get kernel %s symbol address\n", symbol);
+ dbgprintf("Cannot get kernel %s symbol address\n", symbol);
return 0;
}
--
2.5.5
Pratyush Anand
2017-03-03 04:05:02 UTC
Permalink
Post by Baoquan He
Kernel symbol page_offset_base could be unavailable when mm KASLR code is
not compiled in kernel. It's unappropriate to print out error message
when failed to search for page_offset_base from /proc/kallsyms. Seems now
there is not a way to find out if mm KASLR is compiled in or not. An
alternative approach is only printing out debug message in get_kernel_sym
if failed to search a expected kernel symbol.
Do it in this patch, a simple fix.
Yes, a particular symbol can be kernel version dependent and may not be
available in all the kernel version.
Post by Baoquan He
---
kexec/arch/i386/crashdump-x86.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
index 88aeee3..c4cf201 100644
--- a/kexec/arch/i386/crashdump-x86.c
+++ b/kexec/arch/i386/crashdump-x86.c
@@ -127,7 +127,7 @@ static unsigned long long get_kernel_sym(const char *symbol)
}
}
- fprintf(stderr, "Cannot get kernel %s symbol address\n", symbol);
+ dbgprintf("Cannot get kernel %s symbol address\n", symbol);
return 0;
}
Dave Young
2017-03-06 01:46:45 UTC
Permalink
Post by Baoquan He
Kernel symbol page_offset_base could be unavailable when mm KASLR code is
not compiled in kernel. It's unappropriate to print out error message
when failed to search for page_offset_base from /proc/kallsyms. Seems now
there is not a way to find out if mm KASLR is compiled in or not. An
alternative approach is only printing out debug message in get_kernel_sym
if failed to search a expected kernel symbol.
Do it in this patch, a simple fix.
---
kexec/arch/i386/crashdump-x86.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
index 88aeee3..c4cf201 100644
--- a/kexec/arch/i386/crashdump-x86.c
+++ b/kexec/arch/i386/crashdump-x86.c
@@ -127,7 +127,7 @@ static unsigned long long get_kernel_sym(const char *symbol)
}
}
- fprintf(stderr, "Cannot get kernel %s symbol address\n", symbol);
+ dbgprintf("Cannot get kernel %s symbol address\n", symbol);
return 0;
}
--
2.5.5
It looks reasonable to me:

Acked-by: Dave Young <***@redhat.com>

Thanks
Dave
Philip Prindeville
2017-03-09 04:13:35 UTC
Permalink
Inline…
Post by Dave Young
Post by Baoquan He
Kernel symbol page_offset_base could be unavailable when mm KASLR code is
not compiled in kernel. It's unappropriate to print out error message
I subscribed to the list the day after this patch went out… Anyway, change to “inappropriate”.

-Philip
Post by Dave Young
Post by Baoquan He
when failed to search for page_offset_base from /proc/kallsyms. Seems now
there is not a way to find out if mm KASLR is compiled in or not. An
alternative approach is only printing out debug message in get_kernel_sym
if failed to search a expected kernel symbol.
Do it in this patch, a simple fix.
---
kexec/arch/i386/crashdump-x86.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
index 88aeee3..c4cf201 100644
--- a/kexec/arch/i386/crashdump-x86.c
+++ b/kexec/arch/i386/crashdump-x86.c
@@ -127,7 +127,7 @@ static unsigned long long get_kernel_sym(const char *symbol)
}
}
- fprintf(stderr, "Cannot get kernel %s symbol address\n", symbol);
+ dbgprintf("Cannot get kernel %s symbol address\n", symbol);
return 0;
}
--
2.5.5
Thanks
Dave
Baoquan He
2017-03-09 07:29:45 UTC
Permalink
Post by Philip Prindeville
Inline…
Post by Dave Young
Post by Baoquan He
Kernel symbol page_offset_base could be unavailable when mm KASLR code is
not compiled in kernel. It's unappropriate to print out error message
I subscribed to the list the day after this patch went out… Anyway, change to “inappropriate”.
Indeed, not sure if Simon want a repost.

Thanks, nice catch!
Post by Philip Prindeville
-Philip
Post by Dave Young
Post by Baoquan He
when failed to search for page_offset_base from /proc/kallsyms. Seems now
there is not a way to find out if mm KASLR is compiled in or not. An
alternative approach is only printing out debug message in get_kernel_sym
if failed to search a expected kernel symbol.
Do it in this patch, a simple fix.
---
kexec/arch/i386/crashdump-x86.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
index 88aeee3..c4cf201 100644
--- a/kexec/arch/i386/crashdump-x86.c
+++ b/kexec/arch/i386/crashdump-x86.c
@@ -127,7 +127,7 @@ static unsigned long long get_kernel_sym(const char *symbol)
}
}
- fprintf(stderr, "Cannot get kernel %s symbol address\n", symbol);
+ dbgprintf("Cannot get kernel %s symbol address\n", symbol);
return 0;
}
--
2.5.5
Thanks
Dave
Simon Horman
2017-03-10 09:14:50 UTC
Permalink
Post by Baoquan He
Post by Philip Prindeville
Inline…
Post by Baoquan He
Kernel symbol page_offset_base could be unavailable when mm KASLR code is
not compiled in kernel. It's unappropriate to print out error message
I subscribed to the list the day after this patch went out… Anyway, change to “inappropriate”.
Indeed, not sure if Simon want a repost.
No need, I have fixed up the change log and applied the patch.
Baoquan He
2017-03-10 09:23:26 UTC
Permalink
Post by Simon Horman
Post by Baoquan He
Post by Philip Prindeville
Inline…
Post by Baoquan He
Kernel symbol page_offset_base could be unavailable when mm KASLR code is
not compiled in kernel. It's unappropriate to print out error message
I subscribed to the list the day after this patch went out… Anyway, change to “inappropriate”.
Indeed, not sure if Simon want a repost.
No need, I have fixed up the change log and applied the patch.
Thanks, Simon!

Loading...