[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKf6xptBEksXYaPg55fEHAvPLuCkW+h4iWerofxzu1GdLcrPBg@mail.gmail.com>
Date: Wed, 10 Apr 2024 18:44:19 -0400
From: Jason Andryuk <jandryuk@...il.com>
To: Juergen Gross <jgross@...e.com>
Cc: linux-kernel@...r.kernel.org, x86@...nel.org,
xen-devel@...ts.xenproject.org, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, "H. Peter Anvin" <hpa@...or.com>,
Andy Lutomirski <luto@...nel.org>, Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH] x86/pat: fix W^X violation false-positives when running
as Xen PV guest
Hi Juergen,
On Tue, Apr 9, 2024 at 5:47 AM Juergen Gross <jgross@...e.com> wrote:
>
> When running as Xen PV guest in some cases W^X violation WARN()s have
> been observed. Those WARN()s are produced by verify_rwx(), which looks
> into the PTE to verify that writable kernel pages have the NX bit set
> in order to avoid code modifications of the kernel by rogue code.
>
> As the NX bits of all levels of translation entries are or-ed and the
> RW bits of all levels are and-ed, looking just into the PTE isn't enough
> for the decision that a writable page is executable, too. When running
> as a Xen PV guest, kernel initialization will set the NX bit in PMD
> entries of the initial page tables covering the .data segment.
I think this is a more accurate description of what I investigated:
"When running as a Xen PV guest, the direct map PMDs and kernel high
map PMDs share the same set of PTEs. Kernel initialization will set
the NX bit in the direct map PMD entries, and not the shared PTEs."
The WARN()s I saw were with direct map addresses.
Thanks,
Jason
Powered by blists - more mailing lists