Skip to contentSkip to conversation

Only print debug message when failed to serach for kernel symbol from /proc/kallsyms

PATCH In review Baoquan He 5 participants 7 messages Mar 3, 2017 – Mar 10, 2017

Subsystems (2)
lore
Share & tools
lore

Baoquan He

author
#0 lore raw

PATCH v3 1/1 Only print debug message when failed to serach for kernel symbol from /proc/kallsyms

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(-)
kexec/arch/i386/crashdump-x86.c +1 -1
index 88aeee3..c4cf201 100644
@@ -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;
 }
 
Signature · 7 lines
2.5.5


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Reviewed-by on v3 1/1
#1 lore raw
Quoted 10 lines · 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.

Quoted 10 lines
---
 kexec/arch/i386/crashdump-x86.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kexec/arch/i386/crashdump-x86.c +0 -0
index 88aeee3..c4cf201 100644

kexec/arch/i386/crashdump-x86.c static unsigned long long get_kernel_sym(const char *symbol) · line 133

Quoted 8 lines
kexec/arch/i386/crashdump-x86.c +1 -1
@@ -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;
 }
 

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Acked-by on v3 1/1
#2 lore raw
In reply to Baoquan He
Quoted 30 lines · 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(-)
kexec/arch/i386/crashdump-x86.c +1 -1
index 88aeee3..c4cf201 100644
@@ -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;
 }
 
Signature · 1 line
2.5.5

It looks reasonable to me:

Thanks
Dave

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#3 lore raw

Inline…

Quoted 5 lines · Dave Young
Quoted 2 lines · 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

Quoted 31 lines
Quoted 28 lines

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(-)
kexec/arch/i386/crashdump-x86.c +1 -1
index 88aeee3..c4cf201 100644
@@ -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;
 }
 
Signature · 1 line
2.5.5

It looks reasonable to me:

Quoted 4 lines

Thanks
Dave

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

author
#4 lore raw
Quoted 10 lines · Philip Prindeville

Inline…

Quoted 5 lines · Dave Young
Quoted 2 lines · 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!

Quoted 40 lines

-Philip

Quoted 35 lines
Quoted 28 lines

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(-)
kexec/arch/i386/crashdump-x86.c +1 -1
index 88aeee3..c4cf201 100644
@@ -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;
 }
 
Signature · 1 line
2.5.5

It looks reasonable to me:

Thanks
Dave

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#5 lore raw
Quoted 6 lines · Baoquan He
Quoted 5 lines · Philip Prindeville

Inline…

Quoted 2 lines · Dave Young
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines · Baoquan He
Quoted 2 lines

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.

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

author
#6 lore raw
Quoted 8 lines · Simon Horman
Quoted 7 lines · Baoquan He
Quoted 6 lines · Philip Prindeville

Inline…

Quoted 3 lines · Dave Young

On 03/03/17 at 11:52am, Baoquan He wrote:

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

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!

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec