mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander Gordeev <agordeev@linux.ibm.com>
To: "Mike Rapoport (Microsoft)" <rppt@kernel.org>
Cc: Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Subject: Re: [PATCH] s390/kdump: write protect the crash kernel memory by its virtual address
Date: Thu, 26 Nov 2026 12:51:17 +0100	[thread overview]
Message-ID: <a666d0dd-905c-4099-8a00-3c656370f986-agordeev@linux.ibm.com> (raw)
In-Reply-To: <20261117-fixes-s390-v1-1-2d9d04ca0072@kernel.org>

On Tue, Nov 17, 2026 at 04:01:04PM +0200, Mike Rapoport (Microsoft) wrote:
> crash_protect_pages() passes crashk_res.start to set_memory_ro() and
> set_memory_rw(). That is a physical address. Since the identity mapping
> may start above zero, it is not the address of the crash kernel memory
> in the kernel page tables.
> 
> With CONFIG_RANDOMIZE_IDENTITY_BASE the page table walk finds no mapping
> at that address and fails. The error is ignored, and the crash kernel
> memory stays writable after "kexec -p" loads it.
> 
> Use the identity mapping address of the crash kernel memory.
> 
> Fixes: c98d2ecae08f ("s390/mm: Uncouple physical vs virtual address spaces")
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> ---
> I found this while working on a generic implementation of the set_memory
> APIs. Only build tested.
> ---
>  arch/s390/kernel/machine_kexec.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_kexec.c
> index baeb3dcfc1c8..20ea3018462f 100644
> --- a/arch/s390/kernel/machine_kexec.c
> +++ b/arch/s390/kernel/machine_kexec.c
> @@ -151,15 +151,16 @@ void crash_free_reserved_phys_range(unsigned long begin, unsigned long end)
>  
>  static void crash_protect_pages(int protect)
>  {
> -	unsigned long size;
> +	unsigned long addr, size;
>  
>  	if (!crashk_res.end)
>  		return;
> +	addr = (unsigned long)__va(crashk_res.start);
>  	size = resource_size(&crashk_res);
>  	if (protect)
> -		set_memory_ro(crashk_res.start, size >> PAGE_SHIFT);
> +		set_memory_ro(addr, size >> PAGE_SHIFT);
>  	else
> -		set_memory_rw(crashk_res.start, size >> PAGE_SHIFT);
> +		set_memory_rw(addr, size >> PAGE_SHIFT);
>  }
>  
>  void arch_kexec_protect_crashkres(void)
> 
...
> Sincerely yours,
> Mike.

Applied, thanks!

      parent reply	other threads:[~2026-11-26 11:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 14:01 Mike Rapoport (Microsoft)
2026-11-17 15:31 ` Heiko Carstens
2026-11-26 11:51 ` Alexander Gordeev [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a666d0dd-905c-4099-8a00-3c656370f986-agordeev@linux.ibm.com \
    --to=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=rppt@kernel.org \
    --cc=svens@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®