public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Guenter Roeck <linux@roeck-us.net>
Cc: linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org,
	x86@kernel.org
Subject: Re: [tip: x86/urgent] x86/mm: Fix pti_clone_entry_text() for i386
Date: Tue, 6 Aug 2024 10:50:50 +0200	[thread overview]
Message-ID: <20240806085050.GQ37996@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <e541b49b-9cc2-47bb-b283-2de70ae3a359@roeck-us.net>

On Mon, Aug 05, 2024 at 09:52:06PM -0700, Guenter Roeck wrote:
> Hi Peter,
> 
> On Thu, Aug 01, 2024 at 10:55:31AM -0000, tip-bot2 for Peter Zijlstra wrote:
> > The following commit has been merged into the x86/urgent branch of tip:
> > 
> > Commit-ID:     49947e7aedfea2573bada0c95b85f6c2363bef9f
> > Gitweb:        https://git.kernel.org/tip/49947e7aedfea2573bada0c95b85f6c2363bef9f
> > Author:        Peter Zijlstra <peterz@infradead.org>
> > AuthorDate:    Thu, 01 Aug 2024 12:42:25 +02:00
> > Committer:     Peter Zijlstra <peterz@infradead.org>
> > CommitterDate: Thu, 01 Aug 2024 12:48:23 +02:00
> > 
> > x86/mm: Fix pti_clone_entry_text() for i386
> > 
> > While x86_64 has PMD aligned text sections, i386 does not have this
> > luxery. Notably ALIGN_ENTRY_TEXT_END is empty and _etext has PAGE
> > alignment.
> > 
> > This means that text on i386 can be page granular at the tail end,
> > which in turn means that the PTI text clones should consistently
> > account for this.
> > 
> > Make pti_clone_entry_text() consistent with pti_clone_kernel_text().
> > 
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> 
> With this patch in the tree, some of my qemu tests (those with PAE enabled)
> report several WARNING backtraces.
> 
> WARNING: CPU: 0 PID: 1 at arch/x86/mm/pti.c:256 pti_clone_pgtable+0x298/0x2dc
> 
> WARNING: CPU: 0 PID: 1 at arch/x86/mm/pti.c:394 pti_clone_pgtable+0x29a/0x2dc
> 
> The backtraces are repeated multiple times.
> 
> Please see
> 
> https://kerneltests.org/builders/qemu-x86-master/builds/253/steps/qemubuildcommand/logs/stdio
> 
> for complete logs.

Could you try the below patch? If that don't work, could you provide the
.config, I'm assuming that'll work with the bits I grabbed last time.


---
diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c
index bfdf5f45b137..bec53f127c0d 100644
--- a/arch/x86/mm/pti.c
+++ b/arch/x86/mm/pti.c
@@ -634,14 +634,8 @@ void __init pti_init(void)
 	}
 #endif
 
-	pti_clone_user_shared();
-
 	/* Undo all global bits from the init pagetables in head_64.S: */
 	pti_set_kernel_image_nonglobal();
-	/* Replace some of the global bits just for shared entry text: */
-	pti_clone_entry_text();
-	pti_setup_espfix64();
-	pti_setup_vsyscall();
 }
 
 /*
@@ -659,7 +653,12 @@ void pti_finalize(void)
 	 * We need to clone everything (again) that maps parts of the
 	 * kernel image.
 	 */
+	pti_clone_user_shared();
+
 	pti_clone_entry_text();
+	pti_setup_espfix64();
+	pti_setup_vsyscall();
+
 	pti_clone_kernel_text();
 
 	debug_checkwx_user();

  reply	other threads:[~2024-08-06  8:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-01 10:55 [tip: x86/urgent] x86/mm: Fix pti_clone_entry_text() for i386 tip-bot2 for Peter Zijlstra
2024-08-06  4:52 ` Guenter Roeck
2024-08-06  8:50   ` Peter Zijlstra [this message]
2024-08-06 14:25     ` Guenter Roeck
2024-08-06 14:56       ` Peter Zijlstra
2024-08-06 15:05         ` Peter Zijlstra
2024-08-06 15:46           ` Peter Zijlstra
2024-08-06 15:59             ` Peter Zijlstra
2024-08-06 16:42               ` Guenter Roeck
2024-08-06 18:48                 ` Peter Zijlstra
2024-08-06 19:12                   ` Guenter Roeck
2024-08-06 20:16                   ` Guenter Roeck
2024-08-07 13:51                   ` [tip: x86/urgent] x86/mm: Fix PTI for i386 some more tip-bot2 for Thomas Gleixner
  -- strict thread matches above, loose matches on Subject: below --
2024-08-01 13:03 [tip: x86/urgent] x86/mm: Fix pti_clone_entry_text() for i386 tip-bot2 for Peter Zijlstra

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=20240806085050.GQ37996@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --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