From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: Barry Song <baohua@kernel.org>,
Hongru Zhang <zhanghongru06@gmail.com>,
akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, surenb@google.com,
david@kernel.org, liam@infradead.org, mhocko@suse.com,
rppt@kernel.org, shakeel.butt@linux.dev, vbabka@kernel.org,
zhaonanzhe@xiaomi.com, linux@armlinux.org.uk,
catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com,
linux-arm-kernel@lists.infradead.org, chenhuacai@kernel.org,
kernel@xen0n.name, loongarch@lists.linux.dev,
maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com,
chleroy@kernel.org, linuxppc-dev@lists.ozlabs.org,
pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu,
alex@ghiti.fr, linux-riscv@lists.infradead.org,
agordeev@linux.ibm.com, gerald.schaefer@linux.ibm.com,
hca@linux.ibm.com, gor@linux.ibm.com, borntraeger@linux.ibm.com,
svens@linux.ibm.com, linux-s390@vger.kernel.org,
dave.hansen@linux.intel.com, luto@kernel.org,
peterz@infradead.org, tglx@kernel.org, mingo@redhat.com,
bp@alien8.de, x86@kernel.org, hpa@zytor.com,
Hongru Zhang <zhanghongru@xiaomi.com>
Subject: Re: [PATCH v6] mm: retry page faults once under the per-VMA lock
Date: Tue, 27 Oct 2026 16:29:21 +0000 [thread overview]
Message-ID: <auDRAEofBdqZy36y@gremlin> (raw)
In-Reply-To: <auDGPs8jzC-90-_y@gremlin>
On Tue, Oct 27, 2026 at 04:26:39PM +0000, Lorenzo Stoakes (ARM) wrote:
>
> Thread A (Parent) | Thread B (Parent) | Thread C (Parent)
> ---------------------------|-------------------------|----------------------
> < Fork > | | < has TLB entry >
> copy_present_ptes() | < no TLB entry > |
> wrprotect parent page X | |
> -> 2 mappings, refs | *ptr = x |
> | < Page fault > |
> | do_wp_page() |
> | < shared, so CoW > |
> | wp_page_copy() |
> | copy X -> new pg N |
> | | *ptr = x;
> | | [ OOPS! stale TLB,
> | | lands in X not N ]
> | ptep_clear_flush() |
> | < TLB flush > |
> | parent PTE -> N |
> | [ X now child-only ]|
> | | ASSERT(*ptr == x);
> flush_tlb_mm(oldmm) | | // fails! N lacks x
> < far too late > | |
>
Sigh, I drew this entirely manually, then had the LLM overlords 'correct' it,
but it also made it less clear :).
Thread C ends up writing to what-becomes-the-child-page X, whereas the parent
ends up with page N after CoW.
So a thread in the parent writes to a page of ordinary memory and then it
disappears under them, and the child ends up with corruption in their page.
--
Cheers, Lorenzo
WARNING: multiple messages have this Message-ID (diff)
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: Barry Song <baohua@kernel.org>,
Hongru Zhang <zhanghongru06@gmail.com>,
akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, surenb@google.com,
david@kernel.org, liam@infradead.org, mhocko@suse.com,
rppt@kernel.org, shakeel.butt@linux.dev, vbabka@kernel.org,
zhaonanzhe@xiaomi.com, linux@armlinux.org.uk,
catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com,
linux-arm-kernel@lists.infradead.org, chenhuacai@kernel.org,
kernel@xen0n.name, loongarch@lists.linux.dev,
maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com,
chleroy@kernel.org, linuxppc-dev@lists.ozlabs.org,
pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu,
alex@ghiti.fr, linux-riscv@lists.infradead.org,
agordeev@linux.ibm.com, gerald.schaefer@linux.ibm.com,
hca@linux.ibm.com, gor@linux.ibm.com, borntraeger@linux.ibm.com,
svens@linux.ibm.com, linux-s390@vger.kernel.org,
dave.hansen@linux.intel.com, luto@kernel.org,
peterz@infradead.org, tglx@kernel.org, mingo@redhat.com,
bp@alien8.de, x86@kernel.org, hpa@zytor.com,
Hongru Zhang <zhanghongru@xiaomi.com>
Subject: Re: [PATCH v6] mm: retry page faults once under the per-VMA lock
Date: Tue, 27 Oct 2026 16:29:21 +0000 [thread overview]
Message-ID: <auDRAEofBdqZy36y@gremlin> (raw)
In-Reply-To: <auDGPs8jzC-90-_y@gremlin>
On Tue, Oct 27, 2026 at 04:26:39PM +0000, Lorenzo Stoakes (ARM) wrote:
>
> Thread A (Parent) | Thread B (Parent) | Thread C (Parent)
> ---------------------------|-------------------------|----------------------
> < Fork > | | < has TLB entry >
> copy_present_ptes() | < no TLB entry > |
> wrprotect parent page X | |
> -> 2 mappings, refs | *ptr = x |
> | < Page fault > |
> | do_wp_page() |
> | < shared, so CoW > |
> | wp_page_copy() |
> | copy X -> new pg N |
> | | *ptr = x;
> | | [ OOPS! stale TLB,
> | | lands in X not N ]
> | ptep_clear_flush() |
> | < TLB flush > |
> | parent PTE -> N |
> | [ X now child-only ]|
> | | ASSERT(*ptr == x);
> flush_tlb_mm(oldmm) | | // fails! N lacks x
> < far too late > | |
>
Sigh, I drew this entirely manually, then had the LLM overlords 'correct' it,
but it also made it less clear :).
Thread C ends up writing to what-becomes-the-child-page X, whereas the parent
ends up with page N after CoW.
So a thread in the parent writes to a page of ordinary memory and then it
disappears under them, and the child ends up with corruption in their page.
--
Cheers, Lorenzo
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2026-10-27 16:29 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 2:56 [PATCH v6] mm: retry page faults once under the per-VMA lock Hongru Zhang
2026-09-11 2:56 ` Hongru Zhang
2026-09-11 3:07 ` sashiko-bot
2026-09-15 13:05 ` Xueyuan Chen
2026-09-15 13:05 ` Xueyuan Chen
2026-09-21 17:54 ` Lorenzo Stoakes (ARM)
2026-09-21 17:54 ` Lorenzo Stoakes (ARM)
2026-09-21 18:57 ` Matthew Wilcox
2026-09-21 18:57 ` Matthew Wilcox
2026-09-22 8:55 ` Lorenzo Stoakes (ARM)
2026-09-22 8:55 ` Lorenzo Stoakes (ARM)
2026-09-27 22:55 ` Matthew Wilcox
2026-09-27 22:55 ` Matthew Wilcox
2026-09-28 2:48 ` Barry Song
2026-09-28 2:48 ` Barry Song
2026-10-01 21:12 ` Matthew Wilcox
2026-10-01 21:12 ` Matthew Wilcox
2026-10-02 13:12 ` Lorenzo Stoakes (ARM)
2026-10-02 13:12 ` Lorenzo Stoakes (ARM)
2026-10-19 20:53 ` Matthew Wilcox
2026-10-19 20:53 ` Matthew Wilcox
2026-10-27 2:39 ` Suren Baghdasaryan
2026-10-27 2:39 ` Suren Baghdasaryan
2026-10-27 2:57 ` Suren Baghdasaryan
2026-10-27 2:57 ` Suren Baghdasaryan
2026-10-27 16:26 ` Lorenzo Stoakes (ARM)
2026-10-27 16:26 ` Lorenzo Stoakes (ARM)
2026-10-27 16:29 ` Lorenzo Stoakes (ARM) [this message]
2026-10-27 16:29 ` Lorenzo Stoakes (ARM)
2026-10-02 19:30 ` Barry Song
2026-10-02 19:30 ` Barry Song
2026-09-23 9:53 ` Hongru Zhang
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=auDRAEofBdqZy36y@gremlin \
--to=ljs@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=baohua@kernel.org \
--cc=borntraeger@linux.ibm.com \
--cc=bp@alien8.de \
--cc=catalin.marinas@arm.com \
--cc=chenhuacai@kernel.org \
--cc=chleroy@kernel.org \
--cc=dave.hansen@linux.intel.com \
--cc=david@kernel.org \
--cc=gerald.schaefer@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=hpa@zytor.com \
--cc=kernel@xen0n.name \
--cc=liam@infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=loongarch@lists.linux.dev \
--cc=luto@kernel.org \
--cc=maddy@linux.ibm.com \
--cc=mark.rutland@arm.com \
--cc=mhocko@suse.com \
--cc=mingo@redhat.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=palmer@dabbelt.com \
--cc=peterz@infradead.org \
--cc=pjw@kernel.org \
--cc=rppt@kernel.org \
--cc=shakeel.butt@linux.dev \
--cc=surenb@google.com \
--cc=svens@linux.ibm.com \
--cc=tglx@kernel.org \
--cc=vbabka@kernel.org \
--cc=will@kernel.org \
--cc=willy@infradead.org \
--cc=x86@kernel.org \
--cc=zhanghongru06@gmail.com \
--cc=zhanghongru@xiaomi.com \
--cc=zhaonanzhe@xiaomi.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.