From: Mike Rapoport <rppt@kernel.org>
To: Dave Hansen <dave.hansen@intel.com>
Cc: Nathan Chancellor <nathan@kernel.org>,
Dave Hansen <dave.hansen@linux.intel.com>,
linux-tip-commits@vger.kernel.org,
Juergen Gross <jgross@suse.com>,
"Lorenzo Stoakes (ARM)" <ljs@kernel.org>,
syzbot@syzkaller.appspotmail.com, Atish Patra <atishp@meta.com>,
Nikunj A Dadhania <nikunj@amd.com>,
stable@vger.kernel.org, x86@kernel.org,
linux-kernel@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [tip: x86/urgent] x86/mm/pat: Fix effective RW computation in lookup_address_in_pgd_attr()
Date: Sun, 6 Sep 2026 22:52:34 +0300 [thread overview]
Message-ID: <ap3EgrZJILehwIQK@kernel.org> (raw)
In-Reply-To: <1987b7d6-7aa3-4bcd-9082-f2cdfde7c1e4@intel.com>
On Sun, Sep 06, 2026 at 12:12:54PM -0700, Dave Hansen wrote:
> On 9/6/26 11:12, Nathan Chancellor wrote:
> > On Sun, Sep 06, 2026 at 07:50:26AM -0700, Dave Hansen wrote:
> >> On 9/4/26 21:42, Nathan Chancellor wrote:
> >>> I just bisected the following warning on a couple of my test machines to
> >>> commit 453e78594434 ("x86/mm/pat: Fix effective RW computation in
> >>> lookup_address_in_pgd_attr()") in next-20260904.
> >> ...
> >>> If there is any information I can provide to help debug this, I am happy
> >>> to provide it.
> >>
> >> Well, the thing you bisected to is the patch that fixes the warning. The
> >
> > Hmmm, I don't see a warning prior to this patch though. Do you mean that
> > this patch is just revealing the bad behavior that you mention below?
>
> Yeah, "fixes" was a bad word to use.
>
> The W^X detection has been broken for a while. The patch you bisected to
> fixes the W^X detection. It doesn't actually cause the issue.
>
> >> actual issue comes from:
> >>
> >> if (pages == &its_pages)
> >> set_memory_x((unsigned long)page, 1);
> >>
> >> which its_alloc() does on an execmem allocation. Any chance you could
> >> get the output of:
> >>
> >> /sys/kernel/debug/page_tables/current_kernel
> >>
> >> for the page that page that it's complaining about? I'm curious if this
> >> is temporary or permanent.
> >
> > Sure. For
> >
> > CPA detected W^X violation: 8000000000000123 -> 0000000000000123 range: 0xffffffffc0200000 - 0xffffffffc0200fff PFN 100e00
> >
> > I think it is this line if I understand correctly?
> >
> > 0xffffffffc0200000-0xffffffffc0400000 2M ro PSE GLB x pmd
>
> Yeah, that does seems to show it getting fixed up. Thanks! That means
> that the warning (at least in early boot) is essentially a false
> positive. The problem is that there's module-load-time patching too and
> that is much later and is arguably an actual problem.
>
> Oh, and thinking about it a bit more... This warning came from
> alternatives patching which is too early for normal text_poke(), thus
> the existence of text_poke_early().
But text_poke_early is a memcpy :)
The warning at core text patching is completely spurious because anyway the
entire kernel text is mapped as RWX at that point.
This one should be fixed as with the patch below. As for the modules,
text_poke()ing sounds like the way to move forward and ...
> Anyway, I'm curious what Peter wants to do with this.
... I'm also curious what Peter will suggest :)
diff --git a/arch/x86/mm/pat/set_memory.c b/arch/x86/mm/pat/set_memory.c
index c38faf39ce152..42ea8b4234b82 100644
--- a/arch/x86/mm/pat/set_memory.c
+++ b/arch/x86/mm/pat/set_memory.c
@@ -686,6 +686,10 @@ static inline pgprot_t verify_rwx(pgprot_t old, pgprot_t new, unsigned long star
if (!(__supported_pte_mask & _PAGE_NX))
return new;
+ /* skip verification until kernel text is set to read only */
+ if (!kernel_set_to_readonly)
+ return new;
+
if (!((pgprot_val(old) ^ pgprot_val(new)) & (_PAGE_RW | _PAGE_NX)))
return new;
--
Sincerely yours,
Mike.
next prev parent reply other threads:[~2026-09-06 19:52 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 9:01 [PATCH v2 0/5] x86/mm/pat: CPA fixes Mike Rapoport
2026-08-13 9:01 ` [PATCH v2 1/5] x86/mm/pat: acquire init_mm write lock on collapse to avoid UAF Mike Rapoport
2026-08-31 22:27 ` [tip: x86/urgent] x86/mm/pat: Acquire " tip-bot2 for Lorenzo Stoakes (ARM)
2026-09-01 6:03 ` Jiri Slaby
2026-09-01 7:10 ` Lorenzo Stoakes (ARM)
2026-09-01 23:36 ` Dave Hansen
2026-09-02 6:53 ` Lorenzo Stoakes (ARM)
2026-09-08 9:32 ` Mike Rapoport
2026-09-08 10:12 ` Lorenzo Stoakes (ARM)
2026-09-08 13:58 ` Dave Hansen
2026-09-08 15:14 ` Dave Hansen
2026-09-08 15:17 ` Vlastimil Babka (SUSE)
2026-09-08 19:59 ` Dave Hansen
2026-09-08 23:00 ` Update on CPA fixes, x86/urgent and x86/mm Dave Hansen
2026-09-09 6:40 ` Ingo Molnar
2026-09-09 6:45 ` Ingo Molnar
2026-09-02 18:33 ` [tip: x86/urgent] x86/mm/pat: Acquire init_mm write lock on collapse to avoid UAF tip-bot2 for Lorenzo Stoakes (ARM)
2026-09-08 7:21 ` [tip: x86/mm] " tip-bot2 for Lorenzo Stoakes (ARM)
2026-09-08 22:51 ` [tip: x86/urgent] " tip-bot2 for Lorenzo Stoakes (ARM)
2026-09-09 6:44 ` tip-bot2 for Lorenzo Stoakes (ARM)
2026-08-13 9:01 ` [PATCH v2 2/5] x86/mm/pat: acquire init_mm read lock on attribute change " Mike Rapoport
2026-08-31 22:27 ` [tip: x86/urgent] x86/mm/pat: Acquire " tip-bot2 for Lorenzo Stoakes (ARM)
2026-09-01 6:05 ` Jiri Slaby
2026-09-01 7:20 ` Lorenzo Stoakes (ARM)
2026-09-01 13:46 ` Dave Hansen
2026-09-02 18:33 ` tip-bot2 for Lorenzo Stoakes (ARM)
2026-09-08 7:21 ` [tip: x86/mm] x86/mm/pat: Acquire init_mm read lock on attribute changes " tip-bot2 for Lorenzo Stoakes (ARM)
2026-09-08 22:51 ` [tip: x86/urgent] " tip-bot2 for Lorenzo Stoakes (ARM)
2026-09-09 6:44 ` tip-bot2 for Lorenzo Stoakes (ARM)
2026-08-13 9:01 ` [PATCH v2 3/5] x86/alternative: exclude text poking against change_page_attr() Mike Rapoport
2026-08-25 9:37 ` Jiri Slaby
2026-08-31 22:27 ` [tip: x86/urgent] x86/alternative: Exclude " tip-bot2 for Pedro Falcato
2026-09-01 6:16 ` Jiri Slaby
2026-09-01 7:18 ` Lorenzo Stoakes (ARM)
2026-09-01 7:22 ` Jiri Slaby
2026-09-01 7:24 ` Lorenzo Stoakes (ARM)
2026-09-02 18:33 ` tip-bot2 for Pedro Falcato
2026-09-08 7:21 ` [tip: x86/mm] x86/alternatives: " tip-bot2 for Pedro Falcato
2026-09-08 22:51 ` [tip: x86/urgent] " tip-bot2 for Pedro Falcato
2026-09-09 6:44 ` tip-bot2 for Pedro Falcato
2026-08-13 9:01 ` [PATCH v2 4/5] x86/mm/pat: allocate split page tables as kernel page tables Mike Rapoport
2026-08-31 22:27 ` [tip: x86/urgent] x86/mm/pat: Allocate " tip-bot2 for Lorenzo Stoakes (ARM)
2026-09-02 18:33 ` tip-bot2 for Lorenzo Stoakes (ARM)
2026-09-08 7:21 ` [tip: x86/mm] " tip-bot2 for Lorenzo Stoakes (ARM)
2026-09-08 22:51 ` [tip: x86/urgent] " tip-bot2 for Lorenzo Stoakes (ARM)
2026-09-09 6:44 ` tip-bot2 for Lorenzo Stoakes (ARM)
2026-08-13 9:01 ` [PATCH v2 5/5] x86/mm/pat: fix effective RW computation in lookup_address_in_pgd_attr() Mike Rapoport (Microsoft)
2026-08-13 9:45 ` Lorenzo Stoakes (ARM)
2026-08-31 22:27 ` [tip: x86/urgent] x86/mm/pat: Fix " tip-bot2 for Mike Rapoport (Microsoft)
2026-09-02 18:33 ` tip-bot2 for Mike Rapoport (Microsoft)
2026-09-05 4:42 ` Nathan Chancellor
2026-09-06 14:50 ` Dave Hansen
2026-09-06 18:12 ` Nathan Chancellor
2026-09-06 19:12 ` Dave Hansen
2026-09-06 19:52 ` Mike Rapoport [this message]
2026-09-07 6:46 ` Mike Rapoport
2026-09-07 22:28 ` Nathan Chancellor
2026-09-08 9:29 ` Mike Rapoport
2026-09-08 22:52 ` [tip: x86/mm] " tip-bot2 for Mike Rapoport (Microsoft)
2026-08-13 15:05 ` [PATCH v2 0/5] x86/mm/pat: CPA fixes Nikunj A. Dadhania
2026-08-13 15:07 ` Lorenzo Stoakes (ARM)
2026-08-13 15:23 ` Pedro Falcato
2026-08-13 17:13 ` Andrew Morton
2026-08-25 7:12 ` Atish Patra
2026-08-25 7:31 ` Lorenzo Stoakes (ARM)
2026-08-25 20:05 ` Atish Patra
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=ap3EgrZJILehwIQK@kernel.org \
--to=rppt@kernel.org \
--cc=atishp@meta.com \
--cc=dave.hansen@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=ljs@kernel.org \
--cc=nathan@kernel.org \
--cc=nikunj@amd.com \
--cc=peterz@infradead.org \
--cc=stable@vger.kernel.org \
--cc=syzbot@syzkaller.appspotmail.com \
--cc=x86@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
all inboxes | Powered by JetHome®