[Crash-utility] [PATCH v3 0/3] Improve kaslr_offset detection

HAGIO KAZUHITO(萩尾 一仁) k-hagio-ab at nec.com
Thu Nov 5 04:55:57 UTC 2020


-----Original Message-----
> v3 addressed all comments from Daisuke. Changes:
> Patch #1: new patch. Generalizing the idea of trying all CPUs
> Patch #2: new patch. 5 level paging support. Verified.
> Patch #3:
>  - 5 level paging support
>  - make this method default

Hi Alexey,

The following warnings are emitted with this patchset.

$ make clean ; make warn
...
cc -c -g -DX86_64 -DLZO -DSNAPPY -DGDB_7_6  kaslr_helper.c -Wall -O2 -Wstrict-prototypes -Wmissing-prototypes -fstack-protector -Wformat-security 
kaslr_helper.c: In function ‘find_kernel_start’:
kaslr_helper.c:406:6: warning: unused variable ‘i’ [-Wunused-variable]
  406 |  int i, pgd_idx, p4d_idx, pud_idx, pmd_idx, pte_idx;
      |      ^
kaslr_helper.c: At top level:
kaslr_helper.c:503:1: warning: no previous prototype for ‘calc_kaslr_offset_from_page_tables’ [-Wmissing-prototypes]
  503 | calc_kaslr_offset_from_page_tables(uint64_t pgd, ulong *kaslr_offset,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kaslr_helper.c:572:1: warning: no previous prototype for ‘calc_kaslr_offset_from_idt’ [-Wmissing-prototypes]
  572 | calc_kaslr_offset_from_idt(uint64_t idtr, uint64_t pgd, ulong *kaslr_offset, ulong *phys_base)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from kaslr_helper.c:22:
kaslr_helper.c: In function ‘calc_kaslr_offset_from_page_tables.part.0’:
defs.h:3546:32: warning: ‘pgd_pte’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 3546 | #define IS_LAST_P4D_READ(p4d) ((ulong)(p4d) == machdep->machspec->last_p4d_read)
      |                                ^
kaslr_helper.c:407:11: note: ‘pgd_pte’ was declared here
  407 |  uint64_t pgd_pte, pud_pte, pmd_pte, pte;
      |           ^~~~~~~

Otherwise, the patchset looks good to me and tested ok with some qemu dumps.

Thanks,
Kazu

> 
> Alexey Makhalov (3):
>   calc_kaslr_offset: try all CPUs
>   calc_kaslr_offset: 5-level paging support
>   kaslr: get offset by walking page tree
> 
>  defs.h         |   8 +-
>  diskdump.c     |   6 +
>  kaslr_helper.c | 434 ++++++++++++++++++++++++++++++++++++++++++---------------
>  netdump.c      |   6 +
>  sadump.c       |  37 +----
>  symbols.c      |   5 +-
>  vmware_vmss.c  |  15 +-
>  7 files changed, 359 insertions(+), 152 deletions(-)
> 
> --
> 2.11.0
> 
> --
> Crash-utility mailing list
> Crash-utility at redhat.com
> https://www.redhat.com/mailman/listinfo/crash-utility





More information about the Crash-utility mailing list