x86: Stop MCEs and NMIs during code patching
When a machine check or NMI occurs while multiple byte code is patched the CPU could theoretically see an inconsistent instruction and crash. Prevent this by temporarily disabling MCEs and returning early in the NMI handler. Based on discussion with Mathieu Desnoyers. Cc: Mathieu Desnoyers <compudj@krystal.dyndns.org> Cc: Jeremy Fitzhardinge <jeremy@goop.org> Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
19d36ccdc3
commit
8f4e956b31
@@ -5,3 +5,7 @@ extern void mcheck_init(struct cpuinfo_x86 *c);
|
||||
#endif
|
||||
|
||||
extern int mce_disabled;
|
||||
|
||||
extern void stop_mce(void);
|
||||
extern void restart_mce(void);
|
||||
|
||||
|
||||
@@ -57,5 +57,7 @@ unsigned lapic_adjust_nmi_hz(unsigned hz);
|
||||
int lapic_watchdog_ok(void);
|
||||
void disable_lapic_nmi_watchdog(void);
|
||||
void enable_lapic_nmi_watchdog(void);
|
||||
void stop_nmi(void);
|
||||
void restart_nmi(void);
|
||||
|
||||
#endif /* ASM_NMI_H */
|
||||
|
||||
@@ -107,6 +107,9 @@ extern void do_machine_check(struct pt_regs *, long);
|
||||
|
||||
extern int mce_notify_user(void);
|
||||
|
||||
extern void stop_mce(void);
|
||||
extern void restart_mce(void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -88,5 +88,7 @@ unsigned lapic_adjust_nmi_hz(unsigned hz);
|
||||
int lapic_watchdog_ok(void);
|
||||
void disable_lapic_nmi_watchdog(void);
|
||||
void enable_lapic_nmi_watchdog(void);
|
||||
void stop_nmi(void);
|
||||
void restart_nmi(void);
|
||||
|
||||
#endif /* ASM_NMI_H */
|
||||
|
||||
Reference in New Issue
Block a user