From: Nadav Amit <namit@vmware.com>
To: <linux-kernel@vger.kernel.org>, <linux-edac@vger.kernel.org>
Cc: nadav.amit@gmail.com, "Nadav Amit" <namit@vmware.com>,
"Andy Lutomirski" <luto@kernel.org>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>,
"H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, "Tony Luck" <tony.luck@intel.com>,
"Borislav Petkov" <bp@alien8.de>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>
Subject: [PATCH v2 0/2] x86: disable IRQs during CR4 changes
Date: Fri, 24 Nov 2017 19:29:05 -0800 [thread overview]
Message-ID: <20171125032907.2241-1-namit@vmware.com> (raw)
CR4 needs to be updated atomically with its shadow value, as CR4 updates are
performed in read-modify-write fashion which are based on the shadow value. If
CR4 is changed between the read and the write, CR4 might not be updated
correctly.
For this to happen, CR4 needs to be rewritten by an interrupt handler.
[Presumably, writes to CR4 take place while preemption is disabled, although
due to the experience with CR3 - who knows.] CR4.PGD can be updated by an
interrupt handler, but it is restored to its previous value, so it should not
introduce a race. However, it seems that allowing CR4 updates without disabling
IRQs may present a potential future bug.
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: Tony Luck <tony.luck@intel.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Radim Krčmář" <rkrcmar@redhat.com>
v1 -> v2:
- Break into two patches (Andy)
- Rename refactored function to __cr4_set() (Andy)
Nadav Amit (2):
x86: refactor CR4 setting and shadow write
x86: disable IRQs before changing CR4
arch/x86/include/asm/mmu_context.h | 4 ++--
arch/x86/include/asm/tlbflush.h | 40 +++++++++++++++++++++---------------
arch/x86/include/asm/virtext.h | 2 +-
arch/x86/kernel/cpu/common.c | 38 +++++++++++++++++++++++++---------
arch/x86/kernel/cpu/mcheck/mce.c | 5 ++++-
arch/x86/kernel/cpu/mcheck/p5.c | 6 +++++-
arch/x86/kernel/cpu/mcheck/winchip.c | 5 ++++-
arch/x86/kernel/fpu/init.c | 2 +-
arch/x86/kernel/fpu/xstate.c | 4 ++--
arch/x86/kernel/process.c | 20 +++++++++++++-----
arch/x86/kernel/reboot.c | 2 +-
arch/x86/kvm/vmx.c | 13 ++++++++++--
arch/x86/mm/init.c | 6 +++++-
13 files changed, 102 insertions(+), 45 deletions(-)
--
2.14.1
next reply other threads:[~2017-11-25 3:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-25 3:29 Nadav Amit [this message]
2017-11-25 3:29 ` [PATCH v2 1/2] x86: refactor CR4 setting and shadow write Nadav Amit
2017-11-25 12:37 ` [tip:x86/urgent] x86/tlb: Refactor " tip-bot for Nadav Amit
2017-11-25 3:29 ` [PATCH v2 2/2] x86: disable IRQs before changing CR4 Nadav Amit
2017-11-25 10:36 ` Thomas Gleixner
2017-11-25 17:20 ` Nadav Amit
2017-11-25 17:25 ` Thomas Gleixner
2017-11-25 17:31 ` Nadav Amit
2017-11-25 12:38 ` [tip:x86/urgent] x86/tlb: Disable interrupts when " tip-bot for Nadav Amit
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=20171125032907.2241-1-namit@vmware.com \
--to=namit@vmware.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=nadav.amit@gmail.com \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.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