Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Thomas Gleixner:
"Two bugfixes from Andy addressing at least some of the subtle NMI
related wreckage which has been reported by Sasha Levin"

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/nmi/64: Fix a paravirt stack-clobbering bug in the NMI code
x86/paravirt: Replace the paravirt nop with a bona fide empty function

+27 -5
+15 -1
arch/x86/entry/entry_64.S
··· 1128 1128 1129 1129 /* Runs on exception stack */ 1130 1130 ENTRY(nmi) 1131 + /* 1132 + * Fix up the exception frame if we're on Xen. 1133 + * PARAVIRT_ADJUST_EXCEPTION_FRAME is guaranteed to push at most 1134 + * one value to the stack on native, so it may clobber the rdx 1135 + * scratch slot, but it won't clobber any of the important 1136 + * slots past it. 1137 + * 1138 + * Xen is a different story, because the Xen frame itself overlaps 1139 + * the "NMI executing" variable. 1140 + */ 1131 1141 PARAVIRT_ADJUST_EXCEPTION_FRAME 1142 + 1132 1143 /* 1133 1144 * We allow breakpoints in NMIs. If a breakpoint occurs, then 1134 1145 * the iretq it performs will take us out of NMI context. ··· 1190 1179 * we don't want to enable interrupts, because then we'll end 1191 1180 * up in an awkward situation in which IRQs are on but NMIs 1192 1181 * are off. 1182 + * 1183 + * We also must not push anything to the stack before switching 1184 + * stacks lest we corrupt the "NMI executing" variable. 1193 1185 */ 1194 1186 1195 - SWAPGS 1187 + SWAPGS_UNSAFE_STACK 1196 1188 cld 1197 1189 movq %rsp, %rdx 1198 1190 movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp
+12 -4
arch/x86/kernel/paravirt.c
··· 41 41 #include <asm/timer.h> 42 42 #include <asm/special_insns.h> 43 43 44 - /* nop stub */ 45 - void _paravirt_nop(void) 46 - { 47 - } 44 + /* 45 + * nop stub, which must not clobber anything *including the stack* to 46 + * avoid confusing the entry prologues. 47 + */ 48 + extern void _paravirt_nop(void); 49 + asm (".pushsection .entry.text, \"ax\"\n" 50 + ".global _paravirt_nop\n" 51 + "_paravirt_nop:\n\t" 52 + "ret\n\t" 53 + ".size _paravirt_nop, . - _paravirt_nop\n\t" 54 + ".type _paravirt_nop, @function\n\t" 55 + ".popsection"); 48 56 49 57 /* identity function, which can be inlined */ 50 58 u32 _paravirt_ident_32(u32 x)