Hi Mikhail,

Your patch is queued for crash-7.2.8:

  
https://github.com/crash-utility/crash/commit/6664cb3f4ea2eac1b6d482e541b56d7792a4be04

Note that I made the s390x_lc_kaslr check gated upon a successful return from 
readmem(),
just for the highly unlikely case of a failed read.

Thanks,
  Dave


----- Original Message -----
> If the kernel crashes before vmcoreinfo initialization, there is
> no way to extract KASLR offset for such early s390 dumps. With a new s390
> kernel patch, the KASLR offset will be stored in the lowcore memory during
> early boot and then overwritten after vmcoreinfo is initialized.
> This patch allows crash to identify the KASLR offset stored in the lowcore
> memory for s390 dumps.
> 
> Signed-off-by: Mikhail Zaslonko <[email protected]>
> ---
>  s390x.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/s390x.c b/s390x.c
> index 4a1a466..5e28ea4 100644
> --- a/s390x.c
> +++ b/s390x.c
> @@ -46,6 +46,8 @@
>  
>  #define S390X_PSW_MASK_PSTATE        0x0001000000000000UL
>  
> +#define S390X_LC_VMCORE_INFO 0xe0c
> +
>  /*
>   * Flags for Region and Segment table entries.
>   */
> @@ -460,6 +462,8 @@ static void s390x_check_live(void)
>  void
>  s390x_init(int when)
>  {
> +     ulong s390x_lc_kaslr;
> +
>       switch (when)
>       {
>       case SETUP_ENV:
> @@ -486,6 +490,23 @@ s390x_init(int when)
>               machdep->verify_paddr = generic_verify_paddr;
>               machdep->get_kvaddr_ranges = s390x_get_kvaddr_ranges;
>               machdep->ptrs_per_pgd = PTRS_PER_PGD;
> +             if (DUMPFILE() && !(kt->flags & RELOC_SET)) {
> +                     /* Read the value from well-known lowcore location*/
> +                     readmem(S390X_LC_VMCORE_INFO, PHYSADDR, &s390x_lc_kaslr,
> +                             sizeof(s390x_lc_kaslr), "s390x_lc_kaslr",
> +                             QUIET|RETURN_ON_ERROR);
> +                     /* Check for explicit kaslr offset flag */
> +                     if (s390x_lc_kaslr & 0x1UL) {
> +                             /* Drop the last bit to get an offset value */
> +                             s390x_lc_kaslr &= ~(0x1UL);
> +                             /* Make sure the offset is aligned by 0x1000 */
> +                             if (s390x_lc_kaslr && !(s390x_lc_kaslr & 
> 0xfff)) {
> +                                     kt->relocate = s390x_lc_kaslr * (-1);
> +                                     kt->flags |= RELOC_SET;
> +                                     kt->flags2 |= KASLR;
> +                             }
> +                     }
> +             }
>               break;
>  
>       case PRE_GDB:
> --
> 2.17.1
> 
> 

--
Crash-utility mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/crash-utility

Reply via email to