[Crash-utility] [PATCH] X86 64: fix the method for determining whether to enable kalsr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Li XingYang <1127955419@xxxxxx>

The recently commit 6752571d8d78 fixed the issue where linux kernel with
223b5e57d0d5 ("mm/execmem, arch: convert remaining overrides of module_alloc to execmem")
could not load crash, but it did not work in the following two situations:
1: Kernel enables KASAN
2: The kernel set CONFIG_RANDOMIZE_BASE but not set CONFIG_RANDOMIZE_MEMORY

crash: seek error: kernel virtual address: ffffffff826bb418  type: "page_offset_base"

In both cases, kaslr_regions will not be exported in /proc/kallsyms,
but kaslr_get_random_long will still be exported in /proc/kallsyms.
So use kaslr_get_random_long instead of kaslr_degions
Determine whether to enable kalsr

Signed-off-by: Li XingYang <1127955419@xxxxxx>
Signed-off-by: Zach Wade <zachwade.k@xxxxxxxxx>
---
 symbols.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/symbols.c b/symbols.c
index 69a1fbb..02359a4 100644
--- a/symbols.c
+++ b/symbols.c
@@ -619,7 +619,7 @@ strip_symbol_end(const char *name, char *buf)
  *  or in /proc/kallsyms on a live system.
  *
  *  Setting KASLR_CHECK will trigger a search for "module_load_offset"
- *  or "kaslr_regions" during the initial symbol sort operation, and
+ *  or "kaslr_get_random_long" during the initial symbol sort operation, and
  *  if found, will set (RELOC_AUTO|KASLR).  On live systems, the search
  *  is done here by checking /proc/kallsyms.
  */
@@ -646,7 +646,7 @@ kaslr_init(void)
 		st->_stext_vmlinux = UNINITIALIZED;
 
 	if (ACTIVE() &&   /* Linux 3.15 */
-	    ((symbol_value_from_proc_kallsyms("kaslr_regions") != BADVAL) ||
+	    ((symbol_value_from_proc_kallsyms("kaslr_get_random_long") != BADVAL) ||
 	    (symbol_value_from_proc_kallsyms("module_load_offset") != BADVAL))) {
 		kt->flags2 |= (RELOC_AUTO|KASLR);
 		st->_stext_vmlinux = UNINITIALIZED;
@@ -14253,8 +14253,8 @@ numeric_forward(const void *P_x, const void *P_y)
 			st->_stext_vmlinux = valueof(y);
 	}
 	if (kt->flags2 & KASLR_CHECK) {
-		if (STREQ(x->name, "kaslr_regions") ||
-		    STREQ(y->name, "kaslr_regions") ||
+		if (STREQ(x->name, "kaslr_get_random_long") ||
+		    STREQ(y->name, "kaslr_get_random_long") ||
 		    STREQ(x->name, "module_load_offset") ||
 		    STREQ(y->name, "module_load_offset")) {
 			kt->flags2 &= ~KASLR_CHECK;
-- 
2.46.1
--
Crash-utility mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxxxxxx
https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
Contribution Guidelines: https://github.com/crash-utility/crash/wiki




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux