aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-10-13 20:28:16 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-13 20:28:16 -0400
commit2fd7476de999124bbf6830aa59ac092c882280fe (patch)
tree81522f679ccdf38067e03102d2b64e44fc777204 /arch/x86
parentba1a96fc7ddcaf0c8d4a6752f6a70f080bc307ac (diff)
parent4ea48a01bb1a99f4185b77cd90cf962730336cc4 (diff)
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Ingo Molnar: "Misc smaller fixes that missed the v3.17 cycle" * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/build: Add arch/x86/purgatory/ make generated files to gitignore x86: Fix section conflict for numachip x86: Reject x32 executables if x32 ABI not supported x86_64, entry: Filter RFLAGS.NT on entry from userspace x86, boot, kaslr: Fix nuisance warning on 32-bit builds
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/.gitignore2
-rw-r--r--arch/x86/boot/compressed/aslr.c2
-rw-r--r--arch/x86/ia32/ia32entry.S18
-rw-r--r--arch/x86/include/asm/elf.h5
-rw-r--r--arch/x86/kernel/apic/apic_numachip.c2
-rw-r--r--arch/x86/kernel/cpu/common.c2
6 files changed, 25 insertions, 6 deletions
diff --git a/arch/x86/.gitignore b/arch/x86/.gitignore
index 7cab8c08e6d1..aff152c87cf4 100644
--- a/arch/x86/.gitignore
+++ b/arch/x86/.gitignore
@@ -1,4 +1,6 @@
1boot/compressed/vmlinux 1boot/compressed/vmlinux
2tools/test_get_len 2tools/test_get_len
3tools/insn_sanity 3tools/insn_sanity
4purgatory/kexec-purgatory.c
5purgatory/purgatory.ro
4 6
diff --git a/arch/x86/boot/compressed/aslr.c b/arch/x86/boot/compressed/aslr.c
index 7c68808edeb7..bb1376381985 100644
--- a/arch/x86/boot/compressed/aslr.c
+++ b/arch/x86/boot/compressed/aslr.c
@@ -194,7 +194,7 @@ static bool mem_avoid_overlap(struct mem_vector *img)
194 while (ptr) { 194 while (ptr) {
195 struct mem_vector avoid; 195 struct mem_vector avoid;
196 196
197 avoid.start = (u64)ptr; 197 avoid.start = (unsigned long)ptr;
198 avoid.size = sizeof(*ptr) + ptr->len; 198 avoid.size = sizeof(*ptr) + ptr->len;
199 199
200 if (mem_overlaps(img, &avoid)) 200 if (mem_overlaps(img, &avoid))
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index 4299eb05023c..711de084ab57 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -151,6 +151,16 @@ ENTRY(ia32_sysenter_target)
1511: movl (%rbp),%ebp 1511: movl (%rbp),%ebp
152 _ASM_EXTABLE(1b,ia32_badarg) 152 _ASM_EXTABLE(1b,ia32_badarg)
153 ASM_CLAC 153 ASM_CLAC
154
155 /*
156 * Sysenter doesn't filter flags, so we need to clear NT
157 * ourselves. To save a few cycles, we can check whether
158 * NT was set instead of doing an unconditional popfq.
159 */
160 testl $X86_EFLAGS_NT,EFLAGS(%rsp) /* saved EFLAGS match cpu */
161 jnz sysenter_fix_flags
162sysenter_flags_fixed:
163
154 orl $TS_COMPAT,TI_status+THREAD_INFO(%rsp,RIP-ARGOFFSET) 164 orl $TS_COMPAT,TI_status+THREAD_INFO(%rsp,RIP-ARGOFFSET)
155 testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET) 165 testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
156 CFI_REMEMBER_STATE 166 CFI_REMEMBER_STATE
@@ -184,6 +194,8 @@ sysexit_from_sys_call:
184 TRACE_IRQS_ON 194 TRACE_IRQS_ON
185 ENABLE_INTERRUPTS_SYSEXIT32 195 ENABLE_INTERRUPTS_SYSEXIT32
186 196
197 CFI_RESTORE_STATE
198
187#ifdef CONFIG_AUDITSYSCALL 199#ifdef CONFIG_AUDITSYSCALL
188 .macro auditsys_entry_common 200 .macro auditsys_entry_common
189 movl %esi,%r9d /* 6th arg: 4th syscall arg */ 201 movl %esi,%r9d /* 6th arg: 4th syscall arg */
@@ -226,7 +238,6 @@ sysexit_from_sys_call:
226 .endm 238 .endm
227 239
228sysenter_auditsys: 240sysenter_auditsys:
229 CFI_RESTORE_STATE
230 auditsys_entry_common 241 auditsys_entry_common
231 movl %ebp,%r9d /* reload 6th syscall arg */ 242 movl %ebp,%r9d /* reload 6th syscall arg */
232 jmp sysenter_dispatch 243 jmp sysenter_dispatch
@@ -235,6 +246,11 @@ sysexit_audit:
235 auditsys_exit sysexit_from_sys_call 246 auditsys_exit sysexit_from_sys_call
236#endif 247#endif
237 248
249sysenter_fix_flags:
250 pushq_cfi $(X86_EFLAGS_IF|X86_EFLAGS_FIXED)
251 popfq_cfi
252 jmp sysenter_flags_fixed
253
238sysenter_tracesys: 254sysenter_tracesys:
239#ifdef CONFIG_AUDITSYSCALL 255#ifdef CONFIG_AUDITSYSCALL
240 testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET) 256 testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
index 1a055c81d864..ca3347a9dab5 100644
--- a/arch/x86/include/asm/elf.h
+++ b/arch/x86/include/asm/elf.h
@@ -160,8 +160,9 @@ do { \
160#define elf_check_arch(x) \ 160#define elf_check_arch(x) \
161 ((x)->e_machine == EM_X86_64) 161 ((x)->e_machine == EM_X86_64)
162 162
163#define compat_elf_check_arch(x) \ 163#define compat_elf_check_arch(x) \
164 (elf_check_arch_ia32(x) || (x)->e_machine == EM_X86_64) 164 (elf_check_arch_ia32(x) || \
165 (IS_ENABLED(CONFIG_X86_X32_ABI) && (x)->e_machine == EM_X86_64))
165 166
166#if __USER32_DS != __USER_DS 167#if __USER32_DS != __USER_DS
167# error "The following code assumes __USER32_DS == __USER_DS" 168# error "The following code assumes __USER32_DS == __USER_DS"
diff --git a/arch/x86/kernel/apic/apic_numachip.c b/arch/x86/kernel/apic/apic_numachip.c
index ae915391ebec..4128b5fcb559 100644
--- a/arch/x86/kernel/apic/apic_numachip.c
+++ b/arch/x86/kernel/apic/apic_numachip.c
@@ -32,7 +32,7 @@
32 32
33static int numachip_system __read_mostly; 33static int numachip_system __read_mostly;
34 34
35static const struct apic apic_numachip __read_mostly; 35static const struct apic apic_numachip;
36 36
37static unsigned int get_apic_id(unsigned long x) 37static unsigned int get_apic_id(unsigned long x)
38{ 38{
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index ef58886ba61c..700f958652f8 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1184,7 +1184,7 @@ void syscall_init(void)
1184 /* Flags to clear on syscall */ 1184 /* Flags to clear on syscall */
1185 wrmsrl(MSR_SYSCALL_MASK, 1185 wrmsrl(MSR_SYSCALL_MASK,
1186 X86_EFLAGS_TF|X86_EFLAGS_DF|X86_EFLAGS_IF| 1186 X86_EFLAGS_TF|X86_EFLAGS_DF|X86_EFLAGS_IF|
1187 X86_EFLAGS_IOPL|X86_EFLAGS_AC); 1187 X86_EFLAGS_IOPL|X86_EFLAGS_AC|X86_EFLAGS_NT);
1188} 1188}
1189 1189
1190/* 1190/*