Skip to content

Commit 4b696dc

Browse files
committed
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Thomas Gleixner: "This update contains: - Hopefully the last ASM CLAC fixups - A fix for the Quark family related to the IMR lock which makes kexec work again - A off-by-one fix in the MPX code. Ironic, isn't it? - A fix for X86_PAE which addresses once more an unsigned long vs phys_addr_t hickup" * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/mpx: Fix off-by-one comparison with nr_registers x86/mm: Fix slow_virt_to_phys() for X86_PAE again x86/entry/compat: Add missing CLAC to entry_INT80_32 x86/entry/32: Add an ASM_CLAC to entry_SYSENTER_32 x86/platform/intel/quark: Change the kernel's IMR lock bit to false
2 parents 76c03f0 + 9bf148c commit 4b696dc

File tree

5 files changed

+15
-7
lines changed

5 files changed

+15
-7
lines changed

arch/x86/entry/entry_32.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ sysenter_past_esp:
294294
pushl $__USER_DS /* pt_regs->ss */
295295
pushl %ebp /* pt_regs->sp (stashed in bp) */
296296
pushfl /* pt_regs->flags (except IF = 0) */
297+
ASM_CLAC /* Clear AC after saving FLAGS */
297298
orl $X86_EFLAGS_IF, (%esp) /* Fix IF */
298299
pushl $__USER_CS /* pt_regs->cs */
299300
pushl $0 /* pt_regs->ip = 0 (placeholder) */

arch/x86/entry/entry_64_compat.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ ENTRY(entry_INT80_compat)
261261
* Interrupts are off on entry.
262262
*/
263263
PARAVIRT_ADJUST_EXCEPTION_FRAME
264+
ASM_CLAC /* Do this early to minimize exposure */
264265
SWAPGS
265266

266267
/*

arch/x86/mm/mpx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ static int get_reg_offset(struct insn *insn, struct pt_regs *regs,
123123
break;
124124
}
125125

126-
if (regno > nr_registers) {
126+
if (regno >= nr_registers) {
127127
WARN_ONCE(1, "decoded an instruction with an invalid register");
128128
return -EINVAL;
129129
}

arch/x86/mm/pageattr.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,24 +419,30 @@ pmd_t *lookup_pmd_address(unsigned long address)
419419
phys_addr_t slow_virt_to_phys(void *__virt_addr)
420420
{
421421
unsigned long virt_addr = (unsigned long)__virt_addr;
422-
unsigned long phys_addr, offset;
422+
phys_addr_t phys_addr;
423+
unsigned long offset;
423424
enum pg_level level;
424425
pte_t *pte;
425426

426427
pte = lookup_address(virt_addr, &level);
427428
BUG_ON(!pte);
428429

430+
/*
431+
* pXX_pfn() returns unsigned long, which must be cast to phys_addr_t
432+
* before being left-shifted PAGE_SHIFT bits -- this trick is to
433+
* make 32-PAE kernel work correctly.
434+
*/
429435
switch (level) {
430436
case PG_LEVEL_1G:
431-
phys_addr = pud_pfn(*(pud_t *)pte) << PAGE_SHIFT;
437+
phys_addr = (phys_addr_t)pud_pfn(*(pud_t *)pte) << PAGE_SHIFT;
432438
offset = virt_addr & ~PUD_PAGE_MASK;
433439
break;
434440
case PG_LEVEL_2M:
435-
phys_addr = pmd_pfn(*(pmd_t *)pte) << PAGE_SHIFT;
441+
phys_addr = (phys_addr_t)pmd_pfn(*(pmd_t *)pte) << PAGE_SHIFT;
436442
offset = virt_addr & ~PMD_PAGE_MASK;
437443
break;
438444
default:
439-
phys_addr = pte_pfn(*pte) << PAGE_SHIFT;
445+
phys_addr = (phys_addr_t)pte_pfn(*pte) << PAGE_SHIFT;
440446
offset = virt_addr & ~PAGE_MASK;
441447
}
442448

arch/x86/platform/intel-quark/imr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,14 +592,14 @@ static void __init imr_fixup_memmap(struct imr_device *idev)
592592
end = (unsigned long)__end_rodata - 1;
593593

594594
/*
595-
* Setup a locked IMR around the physical extent of the kernel
595+
* Setup an unlocked IMR around the physical extent of the kernel
596596
* from the beginning of the .text secton to the end of the
597597
* .rodata section as one physically contiguous block.
598598
*
599599
* We don't round up @size since it is already PAGE_SIZE aligned.
600600
* See vmlinux.lds.S for details.
601601
*/
602-
ret = imr_add_range(base, size, IMR_CPU, IMR_CPU, true);
602+
ret = imr_add_range(base, size, IMR_CPU, IMR_CPU, false);
603603
if (ret < 0) {
604604
pr_err("unable to setup IMR for kernel: %zu KiB (%lx - %lx)\n",
605605
size / 1024, start, end);

0 commit comments

Comments
 (0)