x86 fixes
Subsystems (3)
Linus,
Please pull the latest x86-urgent-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-urgent-for-linus
# HEAD: 9ab6eb51ef4ad63cb71533d3a4dfb09ea8f69b4c x86/intel/quark: Select COMMON_CLK
Misc fixes: EFI fixes, an Intel Quark fix and an asm fix.
out-of-topic modifications in x86-urgent-for-linus:
-----------------------------------------------------
drivers/firmware/dmi_scan.c # 6d9ff4733172: firmware: dmi_scan: Fix dmi_
# ce204e9a4bd8: firmware: dmi_scan: Fix dmi
drivers/firmware/efi/libstub/efi-stub-helper.c# 7ed620bb343f: efi/libstub: Fix boundary ch
Thanks,
Ingo
------------------>
Andy Lutomirski (1):
x86/asm/entry/64: Remove a bogus 'ret_from_fork' optimization
Andy Shevchenko (1):
x86/intel/quark: Select COMMON_CLK
Ivan Khoronzhuk (2):
firmware: dmi_scan: Fix dmi scan to handle "End of Table" structure
firmware: dmi_scan: Fix dmi_len type
Yinghai Lu (1):
efi/libstub: Fix boundary checking in efi_high_alloc()
arch/x86/Kconfig | 1 + arch/x86/kernel/entry_64.S | 13 ++++++++----- drivers/firmware/dmi_scan.c | 17 +++++++++-------- drivers/firmware/efi/libstub/efi-stub-helper.c | 8 ++++---- 4 files changed, 22 insertions(+), 17 deletions(-)
arch/x86/Kconfig +1 -0
@@ -499,6 +499,7 @@ config X86_INTEL_QUARK depends on X86_IO_APIC select IOSF_MBI select INTEL_IMR + select COMMON_CLK ---help--- Select to include support for Quark X1000 SoC. Say Y here if you have a Quark based system such as the Arduino
arch/x86/kernel/entry_64.S +8 -5
@@ -269,11 +269,14 @@ ENTRY(ret_from_fork) testl $3, CS-ARGOFFSET(%rsp) # from kernel_thread? jz 1f - testl $_TIF_IA32, TI_flags(%rcx) # 32-bit compat task needs IRET - jnz int_ret_from_sys_call - - RESTORE_TOP_OF_STACK %rdi, -ARGOFFSET - jmp ret_from_sys_call # go to the SYSRET fastpath + /* + * By the time we get here, we have no idea whether our pt_regs, + * ti flags, and ti status came from the 64-bit SYSCALL fast path, + * the slow path, or one of the ia32entry paths. + * Use int_ret_from_sys_call to return, since it can safely handle + * all of the above. + */ + jmp int_ret_from_sys_call 1: subq $REST_SKIP, %rsp # leave space for volatiles
drivers/firmware/dmi_scan.c +9 -8
@@ -78,7 +78,7 @@ static const char * __init dmi_string(const struct dmi_header *dm, u8 s)* We have to be cautious here. We have seen BIOSes with DMI pointers * pointing to completely the wrong place for example */ -static void dmi_table (u8 *buf,int len,int num, +static void dmi_table (u8 *buf,u32 len,int num,void (*decode)(const struct dmi_header *,void *),void *private_data) {
@@ -93,12 +93,6 @@ static void dmi_table(u8 *buf, int len, int num,const struct dmi_header *dm = (const struct dmi_header *)data;/* -* 7.45 End-of-Table (Type 127) [SMBIOS reference spec v3.0.0] -*/ -if (dm->type ==DMI_ENTRY_END_OF_TABLE ) -break ; - -/* * We want to know the total length (formatted area and * strings) before decoding to make sure we won't run off the * table in dmi_decode or dmi_string
@@ -108,13 +102,20 @@ static void dmi_table(u8 *buf, int len, int num, data++;if (data - buf < len -1 )decode (dm, private_data); + +/* +* 7.45 End-of-Table (Type 127) [SMBIOS reference spec v3.0.0] +*/ +if (dm->type ==DMI_ENTRY_END_OF_TABLE ) +break ; + data +=2 ; i++; } }static phys_addr_t dmi_base; -static u16 dmi_len; +static u32 dmi_len;static u16 dmi_num; static int __init dmi_walk_early(void (*decode)(const struct dmi_header *,
drivers/firmware/efi/libstub/efi-stub-helper.c +4 -4
@@ -179,12 +179,12 @@ efi_status_t efi_high_alloc(efi_system_table_t *sys_table_arg, start = desc->phys_addr; end = start + desc->num_pages * (1UL <<EFI_PAGE_SHIFT ); -if ((start + size) > end || (start + size) > max) -continue ; - -if (end - size > max) +if (end > max) end = max; +if ((start + size) > end) +continue ; +if (round_down (end - size, align) < start)continue ;
Linus,
Please pull the latest x86-urgent-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-urgent-for-linus
# HEAD: 06c8173eb92bbfc03a0fe8bb64315857d0badd06 x86/fpu/xsaves: Fix improper uses of __ex_table
Misc fixes: EFI fixes, an Intel Quark fix, an asm fix and an FPU handling fix.
out-of-topic modifications in x86-urgent-for-linus:
-----------------------------------------------------
drivers/firmware/dmi_scan.c # 6d9ff4733172: firmware: dmi_scan: Fix dmi_
# ce204e9a4bd8: firmware: dmi_scan: Fix dmi
drivers/firmware/efi/libstub/efi-stub-helper.c# 7ed620bb343f: efi/libstub: Fix boundary ch
Thanks,
Ingo
------------------>
Andy Lutomirski (1):
x86/asm/entry/64: Remove a bogus 'ret_from_fork' optimization
Andy Shevchenko (1):
x86/intel/quark: Select COMMON_CLK
Ivan Khoronzhuk (2):
firmware: dmi_scan: Fix dmi scan to handle "End of Table" structure
firmware: dmi_scan: Fix dmi_len type
Quentin Casasnovas (1):
x86/fpu/xsaves: Fix improper uses of __ex_table
Yinghai Lu (1):
efi/libstub: Fix boundary checking in efi_high_alloc()
arch/x86/Kconfig | 1 + arch/x86/include/asm/xsave.h | 28 ++++++++++---------------- arch/x86/kernel/entry_64.S | 13 +++++++----- drivers/firmware/dmi_scan.c | 17 ++++++++-------- drivers/firmware/efi/libstub/efi-stub-helper.c | 8 ++++---- 5 files changed, 33 insertions(+), 34 deletions(-)
arch/x86/Kconfig +1 -0
@@ -499,6 +499,7 @@ config X86_INTEL_QUARK depends on X86_IO_APIC select IOSF_MBI select INTEL_IMR + select COMMON_CLK ---help--- Select to include support for Quark X1000 SoC. Say Y here if you have a Quark based system such as the Arduino
arch/x86/include/asm/xsave.h +11 -17
@@ -82,18 +82,15 @@ static inline int xsave_state_booting(struct xsave_struct *fx, u64 mask)if (boot_cpu_has (X86_FEATURE_XSAVES )) asmvolatile ("1:" XSAVES "\n\t" "2:\n\t" - : :"D" (fx),"m" (*fx),"a" (lmask),"d" (hmask) + xstate_fault + :"D" (fx),"m" (*fx),"a" (lmask),"d" (hmask) : "memory");else asmvolatile ("1:" XSAVE "\n\t" "2:\n\t" - : :"D" (fx),"m" (*fx),"a" (lmask),"d" (hmask) + xstate_fault + :"D" (fx),"m" (*fx),"a" (lmask),"d" (hmask) : "memory"); - - asm volatile(xstate_fault - : "0" (0) - : "memory"); -return err; }
@@ -112,18 +109,15 @@ static inline int xrstor_state_booting(struct xsave_struct *fx, u64 mask)if (boot_cpu_has (X86_FEATURE_XSAVES )) asmvolatile ("1:" XRSTORS "\n\t" "2:\n\t" - : :"D" (fx),"m" (*fx),"a" (lmask),"d" (hmask) + xstate_fault + :"D" (fx),"m" (*fx),"a" (lmask),"d" (hmask) : "memory");else asmvolatile ("1:" XRSTOR "\n\t" "2:\n\t" - : :"D" (fx),"m" (*fx),"a" (lmask),"d" (hmask) + xstate_fault + :"D" (fx),"m" (*fx),"a" (lmask),"d" (hmask) : "memory"); - - asm volatile(xstate_fault - : "0" (0) - : "memory"); -return err; }
@@ -149,9 +143,9 @@ static inline int xsave_state(struct xsave_struct *fx, u64 mask)*/ alternative_input_2 ("1:" XSAVE , -"1:" XSAVEOPT , +XSAVEOPT ,X86_FEATURE_XSAVEOPT , -"1:" XSAVES , +XSAVES , X86_FEATURE_XSAVES, [fx] "D" (fx), "a" (lmask), "d" (hmask) :"memory" );
@@ -178,7 +172,7 @@ static inline int xrstor_state(struct xsave_struct *fx, u64 mask)*/ alternative_input ("1: " XRSTOR , -"1: " XRSTORS , +XRSTORS ,X86_FEATURE_XSAVES , "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask) : "memory");
arch/x86/kernel/entry_64.S +8 -5
@@ -269,11 +269,14 @@ ENTRY(ret_from_fork) testl $3, CS-ARGOFFSET(%rsp) # from kernel_thread? jz 1f - testl $_TIF_IA32, TI_flags(%rcx) # 32-bit compat task needs IRET - jnz int_ret_from_sys_call - - RESTORE_TOP_OF_STACK %rdi, -ARGOFFSET - jmp ret_from_sys_call # go to the SYSRET fastpath + /* + * By the time we get here, we have no idea whether our pt_regs, + * ti flags, and ti status came from the 64-bit SYSCALL fast path, + * the slow path, or one of the ia32entry paths. + * Use int_ret_from_sys_call to return, since it can safely handle + * all of the above. + */ + jmp int_ret_from_sys_call 1: subq $REST_SKIP, %rsp # leave space for volatiles
drivers/firmware/dmi_scan.c +9 -8
@@ -78,7 +78,7 @@ static const char * __init dmi_string(const struct dmi_header *dm, u8 s)* We have to be cautious here. We have seen BIOSes with DMI pointers * pointing to completely the wrong place for example */ -static void dmi_table (u8 *buf,int len,int num, +static void dmi_table (u8 *buf,u32 len,int num,void (*decode)(const struct dmi_header *,void *),void *private_data) {
@@ -93,12 +93,6 @@ static void dmi_table(u8 *buf, int len, int num,const struct dmi_header *dm = (const struct dmi_header *)data;/* -* 7.45 End-of-Table (Type 127) [SMBIOS reference spec v3.0.0] -*/ -if (dm->type ==DMI_ENTRY_END_OF_TABLE ) -break ; - -/* * We want to know the total length (formatted area and * strings) before decoding to make sure we won't run off the * table in dmi_decode or dmi_string
@@ -108,13 +102,20 @@ static void dmi_table(u8 *buf, int len, int num, data++;if (data - buf < len -1 )decode (dm, private_data); + +/* +* 7.45 End-of-Table (Type 127) [SMBIOS reference spec v3.0.0] +*/ +if (dm->type ==DMI_ENTRY_END_OF_TABLE ) +break ; + data +=2 ; i++; } }static phys_addr_t dmi_base; -static u16 dmi_len; +static u32 dmi_len;static u16 dmi_num; static int __init dmi_walk_early(void (*decode)(const struct dmi_header *,
drivers/firmware/efi/libstub/efi-stub-helper.c +4 -4
@@ -179,12 +179,12 @@ efi_status_t efi_high_alloc(efi_system_table_t *sys_table_arg, start = desc->phys_addr; end = start + desc->num_pages * (1UL <<EFI_PAGE_SHIFT ); -if ((start + size) > end || (start + size) > max) -continue ; - -if (end - size > max) +if (end > max) end = max; +if ((start + size) > end) +continue ; +if (round_down (end - size, align) < start)continue ;