On Tue, Jun 11, 2024 at 12:46 PM Tao Liu <ltao@redhat.com> wrote:
Hi Lianbo,

The patch looks good to me, tested OK, so ack.


Applied:
https://github.com/crash-utility/crash/commit/6752571d8d782d07537a258a1ec8919ebd1308ad

Thanks
Lianbo
 
Thanks,
Tao Liu

On Wed, Jun 5, 2024 at 6:05 PM Lianbo Jiang <lijiang@redhat.com> wrote:
>
> Kernel commit 223b5e57d0d5 ("mm/execmem, arch: convert remaining
> overrides of module_alloc to execmem") makes crash session loading
> failure as below:
>
>   # ./crash -s
>   crash: seek error: kernel virtual address: ffffffff826bb418  type: "page_offset_base"
>
> For X86 64 architecture, currently crash will search for symbol
> "module_load_offset" to determine if the KASLR is enabled, and go
> into the relevant code block. But the symbols "module_load_offset"
> has been removed since Linux v6.10-rc1, which caused the current
> failure.
>
> And this issue can occur with live debugging and core dump file
> debugging.
>
> Let's check the symbol "kaslr_regions" instead of "module_load_offset"
> to fix it.
>
> Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
> ---
>  symbols.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/symbols.c b/symbols.c
> index b7627a83587a..1cdf21d86d69 100644
> --- a/symbols.c
> +++ b/symbols.c
> @@ -619,9 +619,9 @@ 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"
> - *  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.
> + *  or "kaslr_regions" 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.
>   */
>  static void
>  kaslr_init(void)
> @@ -646,7 +646,8 @@ kaslr_init(void)
>                 st->_stext_vmlinux = UNINITIALIZED;
>
>         if (ACTIVE() &&   /* Linux 3.15 */
> -           (symbol_value_from_proc_kallsyms("module_load_offset") != BADVAL)) {
> +           ((symbol_value_from_proc_kallsyms("kaslr_regions") != BADVAL) ||
> +           (symbol_value_from_proc_kallsyms("module_load_offset") != BADVAL))) {
>                 kt->flags2 |= (RELOC_AUTO|KASLR);
>                 st->_stext_vmlinux = UNINITIALIZED;
>         }
> @@ -14247,7 +14248,9 @@ numeric_forward(const void *P_x, const void *P_y)
>                         st->_stext_vmlinux = valueof(y);
>         }
>         if (kt->flags2 & KASLR_CHECK) {
> -               if (STREQ(x->name, "module_load_offset") ||
> +               if (STREQ(x->name, "kaslr_regions") ||
> +                   STREQ(y->name, "kaslr_regions") ||
> +                   STREQ(x->name, "module_load_offset") ||
>                     STREQ(y->name, "module_load_offset")) {
>                         kt->flags2 &= ~KASLR_CHECK;
>                         kt->flags2 |= (RELOC_AUTO|KASLR);
> --
> 2.45.1
> --
> Crash-utility mailing list -- devel@lists.crash-utility.osci.io
> To unsubscribe send an email to devel-leave@lists.crash-utility.osci.io
> https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
> Contribution Guidelines: https://github.com/crash-utility/crash/wiki