linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Peter Collingbourne <pcc@google.com>
Cc: andreyknvl@gmail.com,
	"Qun-wei Lin (林群崴)" <Qun-wei.Lin@mediatek.com>,
	"Guangye Yang (杨光业)" <guangye.yang@mediatek.com>,
	linux-mm@kvack.org,
	"Chinwen Chang (張錦文)" <chinwen.chang@mediatek.com>,
	kasan-dev@googlegroups.com, ryabinin.a.a@gmail.com,
	linux-arm-kernel@lists.infradead.org, vincenzo.frascino@arm.com,
	will@kernel.org, eugenis@google.com, stable@vger.kernel.org
Subject: Re: [PATCH] arm64: Also reset KASAN tag if page is not PG_mte_tagged
Date: Fri, 28 Apr 2023 17:57:15 +0100	[thread overview]
Message-ID: <ZEv66/xJQK1eNRpF@arm.com> (raw)
In-Reply-To: <20230420210945.2313627-1-pcc@google.com>

On Thu, Apr 20, 2023 at 02:09:45PM -0700, Peter Collingbourne wrote:
> Consider the following sequence of events:
> 
> 1) A page in a PROT_READ|PROT_WRITE VMA is faulted.
> 2) Page migration allocates a page with the KASAN allocator,
>    causing it to receive a non-match-all tag, and uses it
>    to replace the page faulted in 1.
> 3) The program uses mprotect() to enable PROT_MTE on the page faulted in 1.
> 
> As a result of step 3, we are left with a non-match-all tag for a page
> with tags accessible to userspace, which can lead to the same kind of
> tag check faults that commit e74a68468062 ("arm64: Reset KASAN tag in
> copy_highpage with HW tags only") intended to fix.
> 
> The general invariant that we have for pages in a VMA with VM_MTE_ALLOWED
> is that they cannot have a non-match-all tag. As a result of step 2, the
> invariant is broken. This means that the fix in the referenced commit
> was incomplete and we also need to reset the tag for pages without
> PG_mte_tagged.
> 
> Fixes: e5b8d9218951 ("arm64: mte: reset the page tag in page->flags")
> Cc: <stable@vger.kernel.org> # 5.15
> Link: https://linux-review.googlesource.com/id/I7409cdd41acbcb215c2a7417c1e50d37b875beff
> Signed-off-by: Peter Collingbourne <pcc@google.com>

Sorry, forgot to reply:

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>


  parent reply	other threads:[~2023-04-28 16:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-20 21:09 Peter Collingbourne
2023-04-21 12:24 ` Catalin Marinas
2023-04-21 17:20   ` Peter Collingbourne
2023-04-28 14:18     ` Peter Collingbourne
2023-04-28 16:57 ` Catalin Marinas [this message]
2023-05-16 15:14 ` Will Deacon

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=ZEv66/xJQK1eNRpF@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=Qun-wei.Lin@mediatek.com \
    --cc=andreyknvl@gmail.com \
    --cc=chinwen.chang@mediatek.com \
    --cc=eugenis@google.com \
    --cc=guangye.yang@mediatek.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mm@kvack.org \
    --cc=pcc@google.com \
    --cc=ryabinin.a.a@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=vincenzo.frascino@arm.com \
    --cc=will@kernel.org \
    /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