On Tue, Sep 24, 2024 at 11:42 AM <devel-request@lists.crash-utility.osci.io> wrote:
Date: Tue, 24 Sep 2024 11:32:47 +1200
From: Tao Liu <ltao@redhat.com>
Subject: [Crash-utility] Re: [PATCH] X86 64: fix the method for
        determining whether to enable kalsr
To: 1127955419@qq.com
Cc: devel@lists.crash-utility.osci.io, Zach Wade
        <zachwade.k@gmail.com>
Message-ID:
        <CAO7dBbWEmV29R-KJeoJ6=Nq0u3EBa6ua-qyOAA20h4pE9q+THA@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"

Hi XingYang,

On Sun, Sep 22, 2024 at 5:16 AM <1127955419@qq.com> wrote:
>
> From: Li XingYang <1127955419@qq.com>
>
> 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"
>

Thanks for the fix, looking good to me, ack.

 
Applied:
https://github.com/crash-utility/crash/commit/7b5c8bca7d05b72b252756ff9023f342ddf87b31

Thanks
Lianbo
 
Thanks,
Tao Liu

> 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@qq.com>
> Signed-off-by: Zach Wade <zachwade.k@gmail.com>
> ---
>  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
>