public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen@intel.com>
To: Sean Christopherson <seanjc@google.com>,
	Peter Zijlstra <peterz@infradead.org>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org, keescook@chromium.org
Subject: Re: [PATCH] x86/mm: Refuse W^X violations
Date: Thu, 25 Aug 2022 10:38:23 -0700	[thread overview]
Message-ID: <2f862d0f-e851-0de3-a789-991448ed8b68@intel.com> (raw)
In-Reply-To: <Yweu1dvkJ8aV+C+T@google.com>

On 8/25/22 10:18, Sean Christopherson wrote:
>> +/*
>> + * Validate and enforce strict W^X semantics.
>> + */
>> +static inline pgprot_t verify_rwx(pgprot_t old, pgprot_t new, unsigned long start,
>> +				  unsigned long pfn, unsigned long npg)
>> +{
>> +	unsigned long end;
>> +
> I think this needs
> 
> 	if (!(__supported_pte_mask & _PAGE_NX))
> 		return new;
> 
> to play nice with non-PAE 32-bit kernels.

Good catch.  Nit: I'd probably write this up as:
	
	if (!cpu_feature_enabled(X86_FEATURE_NX))
		return new;

That gets us our fancy static branches and is a bit easier on the eyes.
 I checked and don't see a way for __supported_pte_mask to have _PAGE_NX
clear when X86_FEATURE_NX==1.

  reply	other threads:[~2022-08-25 17:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-25 12:23 [PATCH] x86/mm: Refuse W^X violations Peter Zijlstra
2022-08-25 17:18 ` Sean Christopherson
2022-08-25 17:38   ` Dave Hansen [this message]
2022-08-25 18:16 ` Kees Cook
2022-08-25 19:42   ` 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=2f862d0f-e851-0de3-a789-991448ed8b68@intel.com \
    --to=dave.hansen@intel.com \
    --cc=keescook@chromium.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=seanjc@google.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