linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: kdump: update ppos when reading elfcorehdr
@ 2021-03-19 20:50 Pavel Tatashin
  2021-03-19 21:07 ` Tyler Hicks
  2021-03-22 13:19 ` Will Deacon
  0 siblings, 2 replies; 3+ messages in thread
From: Pavel Tatashin @ 2021-03-19 20:50 UTC (permalink / raw)
  To: pasha.tatashin, tyhicks, jmorris, catalin.marinas, will,
	linux-arm-kernel, linux-kernel

The ppos points to a position in the old kernel memory (and in case of
arm64 in the crash kernel since elfcorehdr is passed as a segment). The
function should update the ppos by the amount that was read. This bug is
not exposed by accident, but other platforms update this value properly.
So, fix it in ARM64 version of elfcorehdr_read() as well.

Signed-off-by: Pavel Tatashin <pasha.tatashin@soleen.com>
---
 arch/arm64/kernel/crash_dump.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm64/kernel/crash_dump.c b/arch/arm64/kernel/crash_dump.c
index e6e284265f19..58303a9ec32c 100644
--- a/arch/arm64/kernel/crash_dump.c
+++ b/arch/arm64/kernel/crash_dump.c
@@ -64,5 +64,7 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
 ssize_t elfcorehdr_read(char *buf, size_t count, u64 *ppos)
 {
 	memcpy(buf, phys_to_virt((phys_addr_t)*ppos), count);
+	*ppos += count;
+
 	return count;
 }
-- 
2.25.1


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

* Re: [PATCH] arm64: kdump: update ppos when reading elfcorehdr
  2021-03-19 20:50 [PATCH] arm64: kdump: update ppos when reading elfcorehdr Pavel Tatashin
@ 2021-03-19 21:07 ` Tyler Hicks
  2021-03-22 13:19 ` Will Deacon
  1 sibling, 0 replies; 3+ messages in thread
From: Tyler Hicks @ 2021-03-19 21:07 UTC (permalink / raw)
  To: Pavel Tatashin
  Cc: jmorris, catalin.marinas, will, linux-arm-kernel, linux-kernel

On 2021-03-19 16:50:54, Pavel Tatashin wrote:
> The ppos points to a position in the old kernel memory (and in case of
> arm64 in the crash kernel since elfcorehdr is passed as a segment). The
> function should update the ppos by the amount that was read. This bug is
> not exposed by accident, but other platforms update this value properly.
> So, fix it in ARM64 version of elfcorehdr_read() as well.
> 

Fixes: e62aaeac426a ("arm64: kdump: provide /proc/vmcore file")
Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com>

Tyler

> Signed-off-by: Pavel Tatashin <pasha.tatashin@soleen.com>
> ---
>  arch/arm64/kernel/crash_dump.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/arm64/kernel/crash_dump.c b/arch/arm64/kernel/crash_dump.c
> index e6e284265f19..58303a9ec32c 100644
> --- a/arch/arm64/kernel/crash_dump.c
> +++ b/arch/arm64/kernel/crash_dump.c
> @@ -64,5 +64,7 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
>  ssize_t elfcorehdr_read(char *buf, size_t count, u64 *ppos)
>  {
>  	memcpy(buf, phys_to_virt((phys_addr_t)*ppos), count);
> +	*ppos += count;
> +
>  	return count;
>  }
> -- 
> 2.25.1
> 

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

* Re: [PATCH] arm64: kdump: update ppos when reading elfcorehdr
  2021-03-19 20:50 [PATCH] arm64: kdump: update ppos when reading elfcorehdr Pavel Tatashin
  2021-03-19 21:07 ` Tyler Hicks
@ 2021-03-22 13:19 ` Will Deacon
  1 sibling, 0 replies; 3+ messages in thread
From: Will Deacon @ 2021-03-22 13:19 UTC (permalink / raw)
  To: Pavel Tatashin, linux-kernel, linux-arm-kernel, jmorris,
	catalin.marinas, tyhicks
  Cc: kernel-team, Will Deacon

On Fri, 19 Mar 2021 16:50:54 -0400, Pavel Tatashin wrote:
> The ppos points to a position in the old kernel memory (and in case of
> arm64 in the crash kernel since elfcorehdr is passed as a segment). The
> function should update the ppos by the amount that was read. This bug is
> not exposed by accident, but other platforms update this value properly.
> So, fix it in ARM64 version of elfcorehdr_read() as well.

Applied to arm64 (for-next/fixes), thanks!

[1/1] arm64: kdump: update ppos when reading elfcorehdr
      https://git.kernel.org/arm64/c/141f8202cfa4

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

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

end of thread, other threads:[~2021-03-22 13:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-19 20:50 [PATCH] arm64: kdump: update ppos when reading elfcorehdr Pavel Tatashin
2021-03-19 21:07 ` Tyler Hicks
2021-03-22 13:19 ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).