mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>
Cc: "peterz@infradead.org" <peterz@infradead.org>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"x86@kernel.org" <x86@kernel.org>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"Lutomirski, Andy" <luto@kernel.org>,
	"Liu, Yujie" <yujie.liu@intel.com>, "bp@alien8.de" <bp@alien8.de>
Subject: Re: [PATCH] x86/mm: Set NX bit when making pages present
Date: Mon, 19 Sep 2022 18:14:48 +0000	[thread overview]
Message-ID: <14fea0e6809b42393388d20f5b62509108a87a71.camel@intel.com> (raw)
In-Reply-To: <20220909152721.1685334-1-dave.hansen@linux.intel.com>

On Fri, 2022-09-09 at 08:27 -0700, Dave Hansen wrote:
> 0day ran across a case triggered by module unloading, but that looks
> to be a generic problem.  It presumably goes like this:
> 
>         1. Load module with direct map, P=1,W=1,NX=1
>         2. Map module executable, set P=1,W=0,NX=0
>         3. Free module, land in vfree()->vm_remove_mappings()
>         4. Set P=0 during alias processing, P=0,W=0,NX=0
>         5. Restore kernel mapping via
> set_direct_map_default_noflush(),
>            set P=1,W=1, resulting in P=1,W=1,NX=0

I don't think this is right. CPA skips NX modification on the alias, so
the earlier module CPA's (1-2) shouldn't have touched NX where
set_direct_map() is operating. So NX *shouldn't* have been cleared in
this case.

Clearly somehow it is though. The original report has this in the log:
Notice: NX (Execute Disable) protection cannot be enabled: non-PAE
kernel!

So probably the W^X checker needs to check this non-PAE case
differently.


  parent reply	other threads:[~2022-09-19 18:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-09 15:27 Dave Hansen
2022-09-16  3:59 ` Yujie Liu
2022-09-19 18:14 ` Edgecombe, Rick P [this message]
2022-09-19 18:30   ` Dave Hansen
2022-09-20  3:12     ` Yujie Liu

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=14fea0e6809b42393388d20f5b62509108a87a71.camel@intel.com \
    --to=rick.p.edgecombe@intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yujie.liu@intel.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 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®