x86 fixes
Subsystems (4)
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: f4b4aae1828855db761bf998ce37d3062b1d6446 x86/headers/uapi: Fix __BITS_PER_LONG value for x32 builds
Fixes all around the map: W+X kernel mapping fix, WCHAN fixes, two build failure fixes for corner case configs, x32 header fix and a speling fix.
Thanks,
Ingo
------------------>
Andrey Ryabinin (1):
x86, efi, kasan: Fix build failure on !KASAN && KMEMCHECK=y kernels
Ben Hutchings (1):
x86/headers/uapi: Fix __BITS_PER_LONG value for x32 builds
Kristen Carlson Accardi (1):
x86/cpufeatures: Correct spelling of the HWP_NOTIFY flag
Lee, Chun-Yi (1):
x86/kexec: Fix kexec crash in syscall kexec_file_load()
Stephen Smalley (1):
x86/mm: Set NX on gap between __ex_table and rodata
Thomas Gleixner (2):
x86/process: Add proper bound checks in 64bit get_wchan() x86/process: Unify 32bit and 64bit implementations of get_wchan()
Vitaly Kuznetsov (1):
x86/hyperv: Fix the build in the !CONFIG_KEXEC_CORE case
arch/x86/include/asm/cpufeature.h | 2 +- arch/x86/include/asm/efi.h | 2 ++ arch/x86/include/uapi/asm/bitsperlong.h | 2 +- arch/x86/kernel/cpu/mshyperv.c | 12 ++++--- arch/x86/kernel/cpu/scattered.c | 2 +- arch/x86/kernel/crash.c | 7 ++--- arch/x86/kernel/process.c | 55 +++++++++++++++++++++++++++++++++ arch/x86/kernel/process_32.c | 28 ----------------- arch/x86/kernel/process_64.c | 24 -------------- arch/x86/mm/init_64.c | 2 +- 10 files changed, 71 insertions(+), 65 deletions(-)
arch/x86/include/asm/cpufeature.h +1 -1
@@ -193,7 +193,7 @@#define X86_FEATURE_HW_PSTATE ( 7*32+ 8)/* AMD HW-PState */ #define X86_FEATURE_PROC_FEEDBACK ( 7*32+ 9)/* AMD ProcFeedbackInterface */ #define X86_FEATURE_HWP ( 7*32+ 10)/* "hwp" Intel HWP */ -#define X86_FEATURE_HWP_NOITFY ( 7*32+ 11)/* Intel HWP_NOTIFY */ +#define X86_FEATURE_HWP_NOTIFY ( 7*32+ 11)/* Intel HWP_NOTIFY */ #define X86_FEATURE_HWP_ACT_WINDOW ( 7*32+ 12)/* Intel HWP_ACT_WINDOW */ #define X86_FEATURE_HWP_EPP ( 7*32+13)/* Intel HWP_EPP */ #define X86_FEATURE_HWP_PKG_REQ ( 7*32+14)/* Intel HWP_PKG_REQ */
arch/x86/include/asm/efi.h +2 -0
@@ -86,6 +86,7 @@ extern u64 asmlinkage efi_call(void *fp, ...);extern void __iomem *__init efi_ioremap (unsigned long addr,unsigned long size,u32 type,u64 attribute); +#ifdef CONFIG_KASAN /* * CONFIG_KASAN may redefine memset to __memset. __memset function is present * only in kernel binary. Since the EFI stub linked into a separate binary it
@@ -95,6 +96,7 @@ extern void __iomem *__init efi_ioremap(unsigned long addr, unsigned long size,#undef memcpy#undef memset#undef memmove +#endif #endif /* CONFIG_X86_32 */
arch/x86/include/uapi/asm/bitsperlong.h +1 -1
@@ -1,7 +1,7 @@#ifndef __ASM_X86_BITSPERLONG_H#define __ASM_X86_BITSPERLONG_H -#ifdef __x86_64__ +#if defined(__x86_64__) && !defined(__ILP32__)# define __BITS_PER_LONG 64#else # define __BITS_PER_LONG 32
arch/x86/kernel/cpu/mshyperv.c +7 -5
@@ -34,11 +34,10 @@struct ms_hyperv_info ms_hyperv;EXPORT_SYMBOL_GPL (ms_hyperv); -static void (*hv_kexec_handler)(void ); -static void (*hv_crash_handler)(struct pt_regs *regs); -#if IS_ENABLED (CONFIG_HYPERV )static void (*vmbus_handler)(void ); +static void (*hv_kexec_handler)(void ); +static void (*hv_crash_handler)(struct pt_regs *regs);void hyperv_vector_handler (struct pt_regs *regs) {
@@ -96,8 +95,8 @@ void hv_remove_crash_handler(void) hv_crash_handler =NULL ; }EXPORT_SYMBOL_GPL (hv_remove_crash_handler); -#endif +#ifdef CONFIG_KEXEC_CORE static void hv_machine_shutdown (void ) {if (kexec_in_progress && hv_kexec_handler)
@@ -111,7 +110,8 @@ static void hv_machine_crash_shutdown(struct pt_regs *regs)hv_crash_handler (regs);native_machine_crash_shutdown (regs); } - +#endif /* CONFIG_KEXEC_CORE */ +#endif /* CONFIG_HYPERV */ static uint32_t __init ms_hyperv_platform (void ) {
@@ -186,8 +186,10 @@ static void __init ms_hyperv_init_platform(void) no_timer_check =1 ;#endif +#if IS_ENABLED (CONFIG_HYPERV ) && defined(CONFIG_KEXEC_CORE ) machine_ops.shutdown = hv_machine_shutdown; machine_ops.crash_shutdown = hv_machine_crash_shutdown; +#endif mark_tsc_unstable ("running on Hyper-V" ); }
arch/x86/kernel/cpu/scattered.c +1 -1
@@ -37,7 +37,7 @@ void init_scattered_cpuid_features(struct cpuinfo_x86 *c) { X86_FEATURE_PLN, CR_EAX, 4, 0x00000006, 0 }, { X86_FEATURE_PTS, CR_EAX, 6, 0x00000006, 0 }, { X86_FEATURE_HWP, CR_EAX, 7, 0x00000006, 0 }, - { X86_FEATURE_HWP_NOITFY, CR_EAX, 8, 0x00000006, 0 }, + { X86_FEATURE_HWP_NOTIFY, CR_EAX, 8, 0x00000006, 0 }, { X86_FEATURE_HWP_ACT_WINDOW, CR_EAX, 9, 0x00000006, 0 }, { X86_FEATURE_HWP_EPP, CR_EAX,10, 0x00000006, 0 }, { X86_FEATURE_HWP_PKG_REQ, CR_EAX,11, 0x00000006, 0 },
arch/x86/kernel/crash.c +3 -4
@@ -185,10 +185,9 @@ void native_machine_crash_shutdown(struct pt_regs *regs) }#ifdef CONFIG_KEXEC_FILE -static int get_nr_ram_ranges_callback (unsigned long start_pfn, -unsigned long nr_pfn,void *arg) +static int get_nr_ram_ranges_callback (u64 start,u64 end,void *arg) { -int *nr_ranges = arg; +unsigned int *nr_ranges = arg; (*nr_ranges)++;return 0 ;
@@ -214,7 +213,7 @@ static void fill_up_crash_elf_data(struct crash_elf_data *ced, ced->image = image; -walk_system_ram_range (0 ,-1 , &nr_ranges, +walk_system_ram_res (0 ,-1 , &nr_ranges, get_nr_ram_ranges_callback); ced->max_nr_ranges = nr_ranges;
arch/x86/kernel/process.c +55 -0
58 lines not on this page · raw message
arch/x86/kernel/process_32.c +0 -28
@@ -324,31 +324,3 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)return prev_p; } - -#define top_esp (THREAD_SIZE - sizeof(unsigned long)) -#define top_ebp (THREAD_SIZE - 2*sizeof(unsigned long)) - -unsigned long get_wchan (struct task_struct *p) -{ -unsigned long bp, sp, ip; -unsigned long stack_page; -int count =0 ; -if (!p || p == current || p->state ==TASK_RUNNING ) -return 0 ; - stack_page = (unsigned long )task_stack_page (p); - sp = p->thread.sp; -if (!stack_page || sp < stack_page || sp > top_esp+stack_page) -return 0 ; -/* include/asm-i386/system.h:switch_to() pushes bp last. */ - bp = *(unsigned long *) sp; -do { -if (bp < stack_page || bp > top_ebp+stack_page) -return 0 ; - ip = *(unsigned long *) (bp+4 ); -if (!in_sched_functions (ip)) -return ip; - bp = *(unsigned long *) bp; - }while (count++ <16 ); -return 0 ; -} -
arch/x86/kernel/process_64.c +0 -24
@@ -499,30 +499,6 @@ void set_personality_ia32(bool x32) }EXPORT_SYMBOL_GPL (set_personality_ia32); -unsigned long get_wchan (struct task_struct *p) -{ -unsigned long stack; -u64 fp, ip; -int count =0 ; - -if (!p || p == current || p->state ==TASK_RUNNING ) -return 0 ; - stack = (unsigned long )task_stack_page (p); -if (p->thread.sp < stack || p->thread.sp >= stack+THREAD_SIZE ) -return 0 ; - fp = *(u64 *)(p->thread.sp); -do { -if (fp < (unsigned long )stack || - fp >= (unsigned long )stack+THREAD_SIZE ) -return 0 ; - ip = *(u64 *)(fp+8 ); -if (!in_sched_functions (ip)) -return ip; - fp = *(u64 *)fp; - }while (count++ <16 ); -return 0 ; -} -long do_arch_prctl (struct task_struct *task,int code,unsigned long addr) {int ret =0 ;
arch/x86/mm/init_64.c +1 -1
@@ -1132,7 +1132,7 @@ void mark_rodata_ro(void)* has been zapped already via cleanup_highmem(). */ all_end =roundup ((unsigned long )_brk_end,PMD_SIZE ); -set_memory_nx (rodata_start, (all_end - rodata_start) >>PAGE_SHIFT ); +set_memory_nx (text_end, (all_end - text_end) >>PAGE_SHIFT );rodata_test ();
Quoted 10 lines · Ingo Molnar
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: f4b4aae1828855db761bf998ce37d3062b1d6446 x86/headers/uapi: Fix __BITS_PER_LONG value for x32 buildsFixes all around the map: W+X kernel mapping fix, WCHAN fixes, two build failure fixes for corner case configs, x32 header fix and a speling fix.
Sorry, please don't pull this tree: Thomas tells me that the two WCHAN fixes trigger some sort of badness in Sasha's testing:
Quoted 3 lines
Thomas Gleixner (2):
x86/process: Add proper bound checks in 64bitget_wchan()x86/process: Unify 32bit and 64bit implementations ofget_wchan()
I don't know any details yet.
Thanks,
Ingo
Quoted 9 lines · Ingo Molnar
Quoted 8 lines
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: f4b4aae1828855db761bf998ce37d3062b1d6446 x86/headers/uapi: Fix __BITS_PER_LONG value for x32 buildsFixes all around the map: W+X kernel mapping fix, WCHAN fixes, two build failure fixes for corner case configs, x32 header fix and a speling fix.
Quoted 8 lines
Sorry, please don't pull this tree: Thomas tells me that the two WCHAN fixes trigger some sort of badness in Sasha's testing:
Quoted 3 lines
Thomas Gleixner (2):
x86/process: Add proper bound checks in 64bitget_wchan()x86/process: Unify 32bit and 64bit implementations ofget_wchan()I don't know any details yet.
Andrey Ryabinin explained it here:
http://marc.info/?l=linux-kernel&m=144387188203639&w=2
So it's a false positive and the patches are good to go.
I rechecked as well another five times that the bound check is correct.
Thanks,
tglx