Skip to content

Commit be67d60

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: "The last regression fixes for 4.8 final: - Two patches addressing the fallout of the CR4 optimizations which caused CR4-less machines to fail. - Fix the VDSO build on big endian machines - Take care of FPU initialization if no CPUID is available otherwise task struct size ends up being zero - Fix up context tracking in case load_gs_index fails" * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/entry/64: Fix context tracking state warning when load_gs_index fails x86/boot: Initialize FPU and X86_FEATURE_ALWAYS even if we don't have CPUID x86/vdso: Fix building on big endian host x86/boot: Fix another __read_cr4() case on 486 x86/init: Fix cr4_init_shadow() on CR4-less machines
2 parents 66188fb + 2fa5f04 commit be67d60

File tree

5 files changed

+16
-19
lines changed

5 files changed

+16
-19
lines changed

arch/x86/entry/entry_64.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,6 @@ ENTRY(error_entry)
10021002
testb $3, CS+8(%rsp)
10031003
jz .Lerror_kernelspace
10041004

1005-
.Lerror_entry_from_usermode_swapgs:
10061005
/*
10071006
* We entered from user mode or we're pretending to have entered
10081007
* from user mode due to an IRET fault.
@@ -1045,7 +1044,8 @@ ENTRY(error_entry)
10451044
* gsbase and proceed. We'll fix up the exception and land in
10461045
* .Lgs_change's error handler with kernel gsbase.
10471046
*/
1048-
jmp .Lerror_entry_from_usermode_swapgs
1047+
SWAPGS
1048+
jmp .Lerror_entry_done
10491049

10501050
.Lbstep_iret:
10511051
/* Fix truncated RIP */

arch/x86/entry/vdso/vdso2c.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
2222

2323
ELF(Phdr) *pt = (ELF(Phdr) *)(raw_addr + GET_LE(&hdr->e_phoff));
2424

25-
if (hdr->e_type != ET_DYN)
25+
if (GET_LE(&hdr->e_type) != ET_DYN)
2626
fail("input is not a shared object\n");
2727

2828
/* Walk the segment table. */

arch/x86/include/asm/tlbflush.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ DECLARE_PER_CPU_SHARED_ALIGNED(struct tlb_state, cpu_tlbstate);
8181
/* Initialize cr4 shadow for this CPU. */
8282
static inline void cr4_init_shadow(void)
8383
{
84-
this_cpu_write(cpu_tlbstate.cr4, __read_cr4());
84+
this_cpu_write(cpu_tlbstate.cr4, __read_cr4_safe());
8585
}
8686

8787
/* Set in this cpu's CR4. */

arch/x86/kernel/cpu/common.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -804,21 +804,20 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
804804
identify_cpu_without_cpuid(c);
805805

806806
/* cyrix could have cpuid enabled via c_identify()*/
807-
if (!have_cpuid_p())
808-
return;
807+
if (have_cpuid_p()) {
808+
cpu_detect(c);
809+
get_cpu_vendor(c);
810+
get_cpu_cap(c);
809811

810-
cpu_detect(c);
811-
get_cpu_vendor(c);
812-
get_cpu_cap(c);
813-
814-
if (this_cpu->c_early_init)
815-
this_cpu->c_early_init(c);
812+
if (this_cpu->c_early_init)
813+
this_cpu->c_early_init(c);
816814

817-
c->cpu_index = 0;
818-
filter_cpuid_features(c, false);
815+
c->cpu_index = 0;
816+
filter_cpuid_features(c, false);
819817

820-
if (this_cpu->c_bsp_init)
821-
this_cpu->c_bsp_init(c);
818+
if (this_cpu->c_bsp_init)
819+
this_cpu->c_bsp_init(c);
820+
}
822821

823822
setup_force_cpu_cap(X86_FEATURE_ALWAYS);
824823
fpu__init_system(c);

arch/x86/kernel/setup.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,9 +1137,7 @@ void __init setup_arch(char **cmdline_p)
11371137
* auditing all the early-boot CR4 manipulation would be needed to
11381138
* rule it out.
11391139
*/
1140-
if (boot_cpu_data.cpuid_level >= 0)
1141-
/* A CPU has %cr4 if and only if it has CPUID. */
1142-
mmu_cr4_features = __read_cr4();
1140+
mmu_cr4_features = __read_cr4_safe();
11431141

11441142
memblock_set_current_limit(get_max_mapped());
11451143

0 commit comments

Comments
 (0)