mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Walmsley <pjw@kernel.org>
To: Paul Walmsley <pjw@kernel.org>
Cc: Vivian Wang <wangruikang@iscas.ac.cn>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	 Alexandre Ghiti <alex@ghiti.fr>,
	linux-riscv@lists.infradead.org,  linux-kernel@vger.kernel.org,
	Yaxing Guo <guoyaxing@bosc.ac.cn>,
	 "David Hildenbrand (Arm)" <david@kernel.org>
Subject: Re: [PATCH] riscv: mm: Fix concurrency in mark_new_valid_map()
Date: Wed, 29 Jul 2026 12:46:07 -0600 (MDT)	[thread overview]
Message-ID: <5de7e75a-c86c-18e0-b9f4-4d7ff56fe4bd@kernel.org> (raw)
In-Reply-To: <38dad5db-e298-fe26-2189-3a67ed156a4a@kernel.org>

Hi Vivian,

On Thu, 9 Jul 2026, Paul Walmsley wrote:

> On Mon, 29 Jun 2026, Vivian Wang wrote:
> 
> > Turns out, the concurrency concerns [1] were justified - BOSC reported a
> > spurious fault in KFENCE that still triggers despite previous fixes,
> > which KFENCE reports as a false-positive.
> > 
> > Fix the concurrency problems in mark_new_valid_map():
> > 
> > - Add smp_wmb() before filling the bitmap, to make sure page table
> >   writes are "received".
> 
> Probably this expression should be clarified.  I guess the intent here is 
> to ensure that the page table write is visible by other cores either 
> before or simultaneously with the bitmap fill?  And the purpose of that is 
> to avoid a situation where another core could execute an sfence.vma before 
> the PTE write is observable by the other core?  If so, we should probably 
> write something like this out in the commit message.
> 
> I wonder if there's still a window where spurious faults could be observed 
> by kfence.  If another core "B" faults (due to its local TLB caching an 
> invalid PTE) after the PTE write is observable by B, but before the bitmap 
> write is observable by B, core B won't sfence.vma.  If this possibility 
> still exists, we should probably document it.  It might be possible to 
> narrow that window further with a smp_mb() after the bitmap fill, but 
> unclear that it's worth trying unless more spurious faults are seen.
>   
> ...
> 
> Also, now that we're adding an smp_wmb(), we should probably expand the 
> preemption-disabled section in kfence_protect_page() to cover the entire 
> function, to eliminate any risk that the PTE writes execute on a separate 
> CPU from the smp_wmb().

Are you planning to update this one?


- Paul

  reply	other threads:[~2026-07-29 18:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-29  9:25 Vivian Wang
2026-07-10  0:59 ` Paul Walmsley
2026-07-29 18:46   ` Paul Walmsley [this message]
2026-07-29 19:08     ` Vivian Wang
2026-08-19  4:49   ` Vivian Wang

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=5de7e75a-c86c-18e0-b9f4-4d7ff56fe4bd@kernel.org \
    --to=pjw@kernel.org \
    --cc=alex@ghiti.fr \
    --cc=david@kernel.org \
    --cc=guoyaxing@bosc.ac.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=wangruikang@iscas.ac.cn \
    /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®