public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: <kyle-jk.liao@mediatek.com>
Cc: Oliver Upton <oupton@kernel.org>, Joey Gouly <joey.gouly@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Zenghui Yu <yuzenghui@huawei.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Quentin Perret <qperret@google.com>,
	Vincent Donnefort <vdonnefort@google.com>,
	<linux-arm-kernel@lists.infradead.org>, <kvmarm@lists.linux.dev>,
	<linux-kernel@vger.kernel.org>,
	<linux-mediatek@lists.infradead.org>, <wsd_upstream@mediatek.com>,
	<rock.yeh@mediatek.com>, <hungwen.chien@mediatek.com>
Subject: Re: [PATCH] KVM: arm64: Allow module-owned pages in host stage-2 range adjustment
Date: Mon, 09 Feb 2026 09:22:07 +0000	[thread overview]
Message-ID: <86y0l2b7b4.wl-maz@kernel.org> (raw)
In-Reply-To: <20260209032421.1278325-1-kyle-jk.liao@mediatek.com>

On Mon, 09 Feb 2026 03:24:13 +0000,
<kyle-jk.liao@mediatek.com> wrote:
> 
> From: "kyle-jk.liao" <kyle-jk.liao@mediatek.com>
> 
> The host_stage2_adjust_range() function triggers a WARN_ON when
> encountering pages marked as both PKVM_NOPAGE and PKVM_MODULE_OWNED_PAGE.
> This occurs when load_unaligned_zeropad() accesses memory that crosses
> page boundaries, where one of the pages is module-owned.
> 
> Extend the check to accept pages with the PKVM_MODULE_OWNED_PAGE flag
> in addition to PKVM_NOPAGE, preventing spurious warnings during normal
> module memory access patterns.
> 
> Signed-off-by: kyle-jk.liao <kyle-jk.liao@mediatek.com>
> ---
>  arch/arm64/kvm/hyp/nvhe/mem_protect.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/kvm/hyp/nvhe/mem_protect.c b/arch/arm64/kvm/hyp/nvhe/mem_protect.c
> index 49db32f3ddf7..baaabf4b5112 100644
> --- a/arch/arm64/kvm/hyp/nvhe/mem_protect.c
> +++ b/arch/arm64/kvm/hyp/nvhe/mem_protect.c
> @@ -495,6 +495,7 @@ static int host_stage2_adjust_range(u64 addr, struct kvm_mem_range *range)
>  	u64 granule;
>  	s8 level;
>  	int ret;
> +	enum pkvm_page_state state;
>  
>  	hyp_assert_lock_held(&host_mmu.lock);
>  	ret = kvm_pgtable_get_leaf(&host_mmu.pgt, addr, &pte, &level);
> @@ -505,8 +506,9 @@ static int host_stage2_adjust_range(u64 addr, struct kvm_mem_range *range)
>  		return -EAGAIN;
>  
>  	if (pte) {
> +		state = get_host_state(hyp_phys_to_page(addr));
>  		WARN_ON(addr_is_memory(addr) &&
> -			get_host_state(hyp_phys_to_page(addr)) != PKVM_NOPAGE);
> +			(state != PKVM_NOPAGE && state != (PKVM_NOPAGE | PKVM_MODULE_OWNED_PAGE)));
>  		return -EPERM;
>  	}
>  

None of that exists upstream.

	M.

-- 
Without deviation from the norm, progress is not possible.

  reply	other threads:[~2026-02-09  9:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-09  3:24 [PATCH] KVM: arm64: Allow module-owned pages in host stage-2 range adjustment kyle-jk.liao
2026-02-09  9:22 ` Marc Zyngier [this message]
2026-02-09 17:35 ` kernel test robot
2026-02-09 22:44 ` kernel test robot

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=86y0l2b7b4.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=catalin.marinas@arm.com \
    --cc=hungwen.chien@mediatek.com \
    --cc=joey.gouly@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=kyle-jk.liao@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=oupton@kernel.org \
    --cc=qperret@google.com \
    --cc=rock.yeh@mediatek.com \
    --cc=suzuki.poulose@arm.com \
    --cc=vdonnefort@google.com \
    --cc=will@kernel.org \
    --cc=wsd_upstream@mediatek.com \
    --cc=yuzenghui@huawei.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