All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sadump: Fix failure of reading __per_cpu_load memory
@ 2020-05-21  7:15 saito.kazuya
  2020-05-21 21:32 ` HAGIO KAZUHITO(萩尾 一仁)
  2020-05-22  2:22 ` d.hatayama
  0 siblings, 2 replies; 3+ messages in thread
From: saito.kazuya @ 2020-05-21  7:15 UTC (permalink / raw)
  To: 'kexec@lists.infradead.org'

Creating vmcore from sadump by makedumpfile fails with the following
error messages since kernel-4.19 with PTI (Page Table Isolation)
enabled:

  __vtop4_x86_64: Can't get a valid pte.
  readmem: Can't convert a virtual address(ffffffffb2986000) to physical address.
  readmem: type_addr: 0, addr:ffffffffb2986000, size:8
  per_cpu_init: Can't read __per_cpu_load memory.

This is caused by the following patch:
https://github.com/torvalds/linux/commit/c40a56a7818cfe735fc93a69e1875f8bba834483

The above patch clears _PAGE_PRESENT bit of __per_cpu_load memory, so
__vtop4_x86_64 fails to convert the virtual address of the
__per_cpu_load.

To fix this issue, this patch changes sanity check of per_cpu_ptr()
to use address of the __per_cpu_load instead of data of the memory.

Signed-off-by: Kazuya Saito <saito.kazuya@fujitsu.com>
Signed-off-by: Kiyotaka Nakamura <kiyo@fujitsu.com>
---
 sadump_info.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sadump_info.c b/sadump_info.c
index 46867ce..72a077b 100644
--- a/sadump_info.c
+++ b/sadump_info.c
@@ -1732,11 +1732,11 @@ per_cpu_init(void)
 		return FALSE;
 	}
 
-	if (!readmem(VADDR, SYMBOL(__per_cpu_load), &si->__per_cpu_load,
-		     sizeof(unsigned long))) {
-		ERRMSG("Can't read __per_cpu_load memory.\n");
+	if (SYMBOL(__per_cpu_load) == NOT_FOUND_SYMBOL) {
+		ERRMSG("Can't find __per_cpu_load symbol.\n");
 		return FALSE;
 	}
+	si->__per_cpu_load = SYMBOL(__per_cpu_load);
 
 	DEBUG_MSG("sadump: __per_cpu_load: %#lx\n", si->__per_cpu_load);
 	DEBUG_MSG("sadump: __per_cpu_offset: LENGTH: %ld\n",
-- 
2.12.3


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] sadump: Fix failure of reading __per_cpu_load memory
  2020-05-21  7:15 [PATCH] sadump: Fix failure of reading __per_cpu_load memory saito.kazuya
@ 2020-05-21 21:32 ` HAGIO KAZUHITO(萩尾 一仁)
  2020-05-22  2:22 ` d.hatayama
  1 sibling, 0 replies; 3+ messages in thread
From: HAGIO KAZUHITO(萩尾 一仁) @ 2020-05-21 21:32 UTC (permalink / raw)
  To: saito.kazuya, 'kexec@lists.infradead.org'

> -----Original Message-----
> Creating vmcore from sadump by makedumpfile fails with the following
> error messages since kernel-4.19 with PTI (Page Table Isolation)
> enabled:
> 
>   __vtop4_x86_64: Can't get a valid pte.
>   readmem: Can't convert a virtual address(ffffffffb2986000) to physical address.
>   readmem: type_addr: 0, addr:ffffffffb2986000, size:8
>   per_cpu_init: Can't read __per_cpu_load memory.
> 
> This is caused by the following patch:
> https://github.com/torvalds/linux/commit/c40a56a7818cfe735fc93a69e1875f8bba834483
> 
> The above patch clears _PAGE_PRESENT bit of __per_cpu_load memory, so
> __vtop4_x86_64 fails to convert the virtual address of the
> __per_cpu_load.
> 
> To fix this issue, this patch changes sanity check of per_cpu_ptr()
> to use address of the __per_cpu_load instead of data of the memory.
> 
> Signed-off-by: Kazuya Saito <saito.kazuya@fujitsu.com>
> Signed-off-by: Kiyotaka Nakamura <kiyo@fujitsu.com>
> ---
>  sadump_info.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/sadump_info.c b/sadump_info.c
> index 46867ce..72a077b 100644
> --- a/sadump_info.c
> +++ b/sadump_info.c
> @@ -1732,11 +1732,11 @@ per_cpu_init(void)
>  		return FALSE;
>  	}
> 
> -	if (!readmem(VADDR, SYMBOL(__per_cpu_load), &si->__per_cpu_load,
> -		     sizeof(unsigned long))) {
> -		ERRMSG("Can't read __per_cpu_load memory.\n");
> +	if (SYMBOL(__per_cpu_load) == NOT_FOUND_SYMBOL) {
> +		ERRMSG("Can't find __per_cpu_load symbol.\n");
>  		return FALSE;
>  	}
> +	si->__per_cpu_load = SYMBOL(__per_cpu_load);
> 
>  	DEBUG_MSG("sadump: __per_cpu_load: %#lx\n", si->__per_cpu_load);
>  	DEBUG_MSG("sadump: __per_cpu_offset: LENGTH: %ld\n",
> --
> 2.12.3
> 

Hi,

The patch looks good to me, applied.
https://github.com/makedumpfile/makedumpfile/commit/c9e078531efaffbe6f780221d40bdac21a84855b

Thanks,
Kazu


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] sadump: Fix failure of reading __per_cpu_load memory
  2020-05-21  7:15 [PATCH] sadump: Fix failure of reading __per_cpu_load memory saito.kazuya
  2020-05-21 21:32 ` HAGIO KAZUHITO(萩尾 一仁)
@ 2020-05-22  2:22 ` d.hatayama
  1 sibling, 0 replies; 3+ messages in thread
From: d.hatayama @ 2020-05-22  2:22 UTC (permalink / raw)
  To: saito.kazuya, 'kexec@lists.infradead.org'

Saito-san,

Thanks for your patch.

I think it better to remove __per_cpu_load code, which is unnecessary.

________________________________________
差出人: kexec <kexec-bounces@lists.infradead.org> が saito.kazuya@fujitsu.com <saito.kazuya@fujitsu.com> の代理で送信
送信日時: 2020年5月21日 16:15
宛先: 'kexec@lists.infradead.org'
件名: [PATCH] sadump: Fix failure of reading __per_cpu_load memory

Creating vmcore from sadump by makedumpfile fails with the following
error messages since kernel-4.19 with PTI (Page Table Isolation)
enabled:

  __vtop4_x86_64: Can't get a valid pte.
  readmem: Can't convert a virtual address(ffffffffb2986000) to physical address.
  readmem: type_addr: 0, addr:ffffffffb2986000, size:8
  per_cpu_init: Can't read __per_cpu_load memory.

This is caused by the following patch:
https://github.com/torvalds/linux/commit/c40a56a7818cfe735fc93a69e1875f8bba834483

The above patch clears _PAGE_PRESENT bit of __per_cpu_load memory, so
__vtop4_x86_64 fails to convert the virtual address of the
__per_cpu_load.

To fix this issue, this patch changes sanity check of per_cpu_ptr()
to use address of the __per_cpu_load instead of data of the memory.

Signed-off-by: Kazuya Saito <saito.kazuya@fujitsu.com>
Signed-off-by: Kiyotaka Nakamura <kiyo@fujitsu.com>
---
 sadump_info.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sadump_info.c b/sadump_info.c
index 46867ce..72a077b 100644
--- a/sadump_info.c
+++ b/sadump_info.c
@@ -1732,11 +1732,11 @@ per_cpu_init(void)
                return FALSE;
        }

-       if (!readmem(VADDR, SYMBOL(__per_cpu_load), &si->__per_cpu_load,
-                    sizeof(unsigned long))) {
-               ERRMSG("Can't read __per_cpu_load memory.\n");
+       if (SYMBOL(__per_cpu_load) == NOT_FOUND_SYMBOL) {
+               ERRMSG("Can't find __per_cpu_load symbol.\n");
                return FALSE;
        }
+       si->__per_cpu_load = SYMBOL(__per_cpu_load);

        DEBUG_MSG("sadump: __per_cpu_load: %#lx\n", si->__per_cpu_load);
        DEBUG_MSG("sadump: __per_cpu_offset: LENGTH: %ld\n",
--
2.12.3


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-22  2:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-21  7:15 [PATCH] sadump: Fix failure of reading __per_cpu_load memory saito.kazuya
2020-05-21 21:32 ` HAGIO KAZUHITO(萩尾 一仁)
2020-05-22  2:22 ` d.hatayama

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.