Hi, Kazu
Thank you for the comment.
On Wed, Oct 5, 2022 at 5:11 PM HAGIO KAZUHITO(萩尾 一仁) <k-hagio-ab@nec.com> wrote:
Hi Lianbo,

On 2022/10/05 11:22, Lianbo Jiang wrote:
> Currently crash will fail and then exit, if the initialization of
> the emergency stacks information fails. In real customer environments,
> sometimes, a vmcore may be partially damaged, although such vmcores
> are rare. For example:
>
>    # ./crash ../3.10.0-1127.18.2.el7.ppc64le/vmcore ../3.10.0-1127.18.2.el7.ppc64le/vmlinux  -s
>    crash: invalid kernel virtual address: 38  type: "paca->emergency_sp"
>    #
>
> Lets try to keep loading vmcore if such issues happen, so call
> the readmem() with the RETURN_ON_ERROR instead of FAULT_ON_ERROR,
> which allows the crash move on.

Just to confirm, can I have the error messages printed with the patch
for the vmcore?
 
Yes. Crash has the following error messages printed after applying this patch:

# ./crash ../vmcore ../vmlinux -s
crash: invalid kernel virtual address: 38  type: "paca->emergency_sp"
crash: invalid kernel virtual address: 38  type: "paca->emergency_sp"
crash: invalid kernel virtual address: 38  type: "paca->emergency_sp"
crash: invalid kernel virtual address: 38  type: "paca->emergency_sp"
crash: invalid kernel virtual address: fc4  type: "paca->emergency_sp"
crash: invalid kernel virtual address: 38  type: "paca->emergency_sp"
crash: invalid kernel virtual address: 38  type: "paca->emergency_sp"
crash: invalid kernel virtual address: 38  type: "paca->emergency_sp"
crash: invalid kernel virtual address: 38  type: "paca->emergency_sp"
crash: invalid kernel virtual address: 38  type: "paca->emergency_sp"
crash: invalid kernel virtual address: 38  type: "paca->emergency_sp"
crash: invalid kernel virtual address: 38  type: "paca->emergency_sp"
crash: invalid kernel virtual address: 38  type: "paca->emergency_sp"
crash: invalid kernel virtual address: 38  type: "paca->emergency_sp"
crash: invalid kernel virtual address: 38  type: "paca->emergency_sp"
crash: invalid kernel virtual address: 38  type: "paca->emergency_sp"
crash: invalid kernel virtual address: 38  type: "paca->emergency_sp"
crash: invalid kernel virtual address: 38  type: "paca->emergency_sp"
crash: invalid kernel virtual address: 38  type: "paca->emergency_sp"
crash: invalid kernel virtual address: 38  type: "paca->emergency_sp"
crash: invalid kernel virtual address: 1000138  type: "paca->emergency_sp"
crash: invalid kernel virtual address: 100000040  type: "paca->emergency_sp"
... 

Thanks.
Lianbo

Thanks,
Kazu

>
> Reported-by: Dave Wysochanski <dwysocha@redhat.com>
> Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
> ---
>   ppc64.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/ppc64.c b/ppc64.c
> index 4ea1f7c0c6f8..f94b402ec64d 100644
> --- a/ppc64.c
> +++ b/ppc64.c
> @@ -1224,13 +1224,13 @@ ppc64_init_paca_info(void)
>               ulong paca_loc;
>   
>               readmem(symbol_value("paca_ptrs"), KVADDR, &paca_loc, sizeof(void *),
> -                     "paca double pointer", FAULT_ON_ERROR);
> +                     "paca double pointer", RETURN_ON_ERROR);
>               readmem(paca_loc, KVADDR, paca_ptr, sizeof(void *) * kt->cpus,
> -                     "paca pointers", FAULT_ON_ERROR);
> +                     "paca pointers", RETURN_ON_ERROR);
>       } else if (symbol_exists("paca") &&
>                  (get_symbol_type("paca", NULL, NULL) == TYPE_CODE_PTR)) {
>               readmem(symbol_value("paca"), KVADDR, paca_ptr, sizeof(void *) * kt->cpus,
> -                     "paca pointers", FAULT_ON_ERROR);
> +                     "paca pointers", RETURN_ON_ERROR);
>       } else {
>               free(paca_ptr);
>               return;
> @@ -1245,7 +1245,7 @@ ppc64_init_paca_info(void)
>               for (i = 0; i < kt->cpus; i++)
>                       readmem(paca_ptr[i] + offset, KVADDR, &ms->emergency_sp[i],
>                               sizeof(void *), "paca->emergency_sp",
> -                             FAULT_ON_ERROR);
> +                             RETURN_ON_ERROR);
>       }
>   
>       if (MEMBER_EXISTS("paca_struct", "nmi_emergency_sp")) {
> @@ -1256,7 +1256,7 @@ ppc64_init_paca_info(void)
>               for (i = 0; i < kt->cpus; i++)
>                       readmem(paca_ptr[i] + offset, KVADDR, &ms->nmi_emergency_sp[i],
>                               sizeof(void *), "paca->nmi_emergency_sp",
> -                             FAULT_ON_ERROR);
> +                             RETURN_ON_ERROR);
>       }
>   
>       if (MEMBER_EXISTS("paca_struct", "mc_emergency_sp")) {
> @@ -1267,7 +1267,7 @@ ppc64_init_paca_info(void)
>               for (i = 0; i < kt->cpus; i++)
>                       readmem(paca_ptr[i] + offset, KVADDR, &ms->mc_emergency_sp[i],
>                               sizeof(void *), "paca->mc_emergency_sp",
> -                             FAULT_ON_ERROR);
> +                             RETURN_ON_ERROR);
>       }
>   
>       free(paca_ptr);