All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Borislav Petkov <bp@suse.de>, Jiri Kosina <jkosina@suse.cz>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org, jroedel@suse.de
Subject: Re: [PATCH] x86: be more helpful with SMEP faults
Date: Tue, 10 Jun 2014 13:24:36 -0700	[thread overview]
Message-ID: <53976984.4030301@zytor.com> (raw)
In-Reply-To: <20140610201823.GA29302@pd.tnic>

On 06/10/2014 01:18 PM, Borislav Petkov wrote:
>>  static void
>>  show_fault_oops(struct pt_regs *regs, unsigned long error_code,
>> @@ -594,6 +596,11 @@ show_fault_oops(struct pt_regs *regs, unsigned long error_code,
>>  
>>  		if (pte && pte_present(*pte) && !pte_exec(*pte))
>>  			printk(nx_warning, from_kuid(&init_user_ns, current_uid()));
>> +		if (pte && pte_present(*pte) && pte_exec(*pte) &&
>> +				(pgd_flags(*pgd) & _PAGE_USER) &&
>> +				static_cpu_has(X86_FEATURE_SMEP) &&
> 
> Btw, we could probably save us this line as CR4 reserved bits should be
> Must-Be-Zero and setting any of those should #GP. And I'm talking about
> pre-SMEP Intel, and AMD machines.
> 
> IOW, if CR4.SMEP is set, it definitely means SMEP is present and
> enabled.
> 
> hpa, that true?
> 

Yes.  Also, the Linux kernel will set or clear X86_FEATURE_SMEP to
match, so the two are redundant.

	-hpa



  reply	other threads:[~2014-06-10 20:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-10 19:08 [PATCH] x86: be more helpful with SMEP faults Jiri Kosina
2014-06-10 20:18 ` Borislav Petkov
2014-06-10 20:24   ` H. Peter Anvin [this message]
2014-06-10 20:49     ` Jiri Kosina
2014-06-12  0:58       ` [tip:x86/mm] x86/smep: Be more informative when signalling an SMEP fault tip-bot for Jiri Kosina

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=53976984.4030301@zytor.com \
    --to=hpa@zytor.com \
    --cc=bp@suse.de \
    --cc=jkosina@suse.cz \
    --cc=jroedel@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.