diff options
| -rw-r--r-- | meta-oe/recipes-kernel/crash/crash.inc | 1 | ||||
| -rw-r--r-- | meta-oe/recipes-kernel/crash/crash/0001-symbol-fix-S-cannot-work-with-kaslr-detection.patch | 89 |
2 files changed, 90 insertions, 0 deletions
diff --git a/meta-oe/recipes-kernel/crash/crash.inc b/meta-oe/recipes-kernel/crash/crash.inc index 04318b1505..c8c8518394 100644 --- a/meta-oe/recipes-kernel/crash/crash.inc +++ b/meta-oe/recipes-kernel/crash/crash.inc | |||
| @@ -22,6 +22,7 @@ SRC_URI = "git://github.com/crash-utility/${BPN}.git;branch=master;protocol=http | |||
| 22 | file://0001-cross_add_configure_option.patch \ | 22 | file://0001-cross_add_configure_option.patch \ |
| 23 | file://donnot-extract-gdb-during-do-compile.patch \ | 23 | file://donnot-extract-gdb-during-do-compile.patch \ |
| 24 | file://gdb_build_jobs_and_not_write_crash_target.patch \ | 24 | file://gdb_build_jobs_and_not_write_crash_target.patch \ |
| 25 | file://0001-symbol-fix-S-cannot-work-with-kaslr-detection.patch \ | ||
| 25 | " | 26 | " |
| 26 | SRCREV = "a6832f608cb5d473739cf33bbf84ab1df8d98fd5" | 27 | SRCREV = "a6832f608cb5d473739cf33bbf84ab1df8d98fd5" |
| 27 | 28 | ||
diff --git a/meta-oe/recipes-kernel/crash/crash/0001-symbol-fix-S-cannot-work-with-kaslr-detection.patch b/meta-oe/recipes-kernel/crash/crash/0001-symbol-fix-S-cannot-work-with-kaslr-detection.patch new file mode 100644 index 0000000000..47182f8b6c --- /dev/null +++ b/meta-oe/recipes-kernel/crash/crash/0001-symbol-fix-S-cannot-work-with-kaslr-detection.patch | |||
| @@ -0,0 +1,89 @@ | |||
| 1 | From 329bd56da28fc1b5b53a60ca2172643d2090435d Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Tao Liu <ltao@redhat.com> | ||
| 3 | Date: Fri, 13 Dec 2024 08:36:03 +0000 | ||
| 4 | Subject: [PATCH] symbol: fix -S cannot work with kaslr detection | ||
| 5 | |||
| 6 | When kernel enabled the CONFIG_RANDOMIZE_BASE, crash needs to add "kaslr=auto" | ||
| 7 | in crash command line to tell crash to decode the random address. | ||
| 8 | But when with "-S" in command line, crash would bypass the kaslr option | ||
| 9 | that cause symbol from kernel image is mismatch with ram on a live system. | ||
| 10 | |||
| 11 | The fix is provided by Tao Liu <ltao@redhat.com> from crash-utility upstream, | ||
| 12 | and not merged to crash master yet. | ||
| 13 | |||
| 14 | Upstream-Status: Pending | ||
| 15 | [https://lists.crash-utility.osci.io/archives/list/devel@lists.crash-utility.osci.io/thread/5OXNYPPU6GLLQKCWH7WBNBJXLNZ4EBZD/] | ||
| 16 | |||
| 17 | Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com> | ||
| 18 | --- | ||
| 19 | symbols.c | 18 ++++++++++-------- | ||
| 20 | 1 file changed, 10 insertions(+), 8 deletions(-) | ||
| 21 | |||
| 22 | diff --git a/symbols.c b/symbols.c | ||
| 23 | index a3cd0f3..6062d21 100644 | ||
| 24 | --- a/symbols.c | ||
| 25 | +++ b/symbols.c | ||
| 26 | @@ -25,7 +25,7 @@ | ||
| 27 | |||
| 28 | static void store_symbols(bfd *, int, void *, long, unsigned int); | ||
| 29 | static void store_sysmap_symbols(void); | ||
| 30 | -static ulong relocate(ulong, char *, int); | ||
| 31 | +static ulong relocate(ulong, char *, int *); | ||
| 32 | static int relocate_force(ulong, char *); | ||
| 33 | static void kaslr_init(void); | ||
| 34 | static void strip_module_symbol_end(char *s); | ||
| 35 | @@ -230,6 +230,7 @@ symtab_init(void) | ||
| 36 | DEBUGINFO_ERROR_MESSAGE1 : | ||
| 37 | DEBUGINFO_ERROR_MESSAGE2); | ||
| 38 | } | ||
| 39 | + kt->flags |= RELOC_FORCE; | ||
| 40 | store_sysmap_symbols(); | ||
| 41 | return; | ||
| 42 | } else if (LKCD_KERNTYPES()) | ||
| 43 | @@ -817,7 +818,7 @@ store_symbols(bfd *abfd, int dynamic, void *minisyms, long symcount, | ||
| 44 | syminfo.type)) { | ||
| 45 | if (kt->flags & (RELOC_SET|RELOC_FORCE)) | ||
| 46 | sp->value = relocate(syminfo.value, | ||
| 47 | - (char *)syminfo.name, !(first++)); | ||
| 48 | + (char *)syminfo.name, &first); | ||
| 49 | else | ||
| 50 | sp->value = syminfo.value; | ||
| 51 | sp->type = syminfo.type; | ||
| 52 | @@ -893,9 +894,9 @@ store_sysmap_symbols(void) | ||
| 53 | |||
| 54 | if (machdep->verify_symbol(name, syment.value, | ||
| 55 | syment.type)) { | ||
| 56 | - if (kt->flags & RELOC_SET) | ||
| 57 | + if (kt->flags & (RELOC_SET|RELOC_FORCE)) | ||
| 58 | sp->value = relocate(syment.value, | ||
| 59 | - syment.name, !(first++)); | ||
| 60 | + syment.name, &first); | ||
| 61 | else | ||
| 62 | sp->value = syment.value; | ||
| 63 | sp->type = syment.type; | ||
| 64 | @@ -924,7 +925,7 @@ store_sysmap_symbols(void) | ||
| 65 | * are not as loaded into the kernel (not unity-mapped). | ||
| 66 | */ | ||
| 67 | static ulong | ||
| 68 | -relocate(ulong symval, char *symname, int first_symbol) | ||
| 69 | +relocate(ulong symval, char *symname, int *first_symbol) | ||
| 70 | { | ||
| 71 | if (XEN_HYPER_MODE()) { | ||
| 72 | kt->flags &= ~(RELOC_SET|RELOC_FORCE); | ||
| 73 | @@ -937,9 +938,10 @@ relocate(ulong symval, char *symname, int first_symbol) | ||
| 74 | break; | ||
| 75 | |||
| 76 | case RELOC_FORCE: | ||
| 77 | - if (first_symbol && !relocate_force(symval, symname)) | ||
| 78 | - kt->flags &= ~RELOC_FORCE; | ||
| 79 | - break; | ||
| 80 | + if (!(*first_symbol) && relocate_force(symval, symname)) { | ||
| 81 | + *first_symbol += 1; | ||
| 82 | + } | ||
| 83 | + return symval - kt->relocate; | ||
| 84 | } | ||
| 85 | |||
| 86 | if (machine_type("X86_64")) { | ||
| 87 | -- | ||
| 88 | 2.35.5 | ||
| 89 | |||
