Skip to content

Commit 2fd7476

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 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
2 parents ba1a96f + 4ea48a0 commit 2fd7476

6 files changed

Lines changed: 25 additions & 6 deletions

File tree

‎arch/x86/.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
boot/compressed/vmlinux
22
tools/test_get_len
33
tools/insn_sanity
4+
purgatory/kexec-purgatory.c
5+
purgatory/purgatory.ro
46

‎arch/x86/boot/compressed/aslr.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ static bool mem_avoid_overlap(struct mem_vector *img)
194194
while (ptr) {
195195
struct mem_vector avoid;
196196

197-
avoid.start = (u64)ptr;
197+
avoid.start = (unsigned long)ptr;
198198
avoid.size = sizeof(*ptr) + ptr->len;
199199

200200
if (mem_overlaps(img, &avoid))

‎arch/x86/ia32/ia32entry.S‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,16 @@ ENTRY(ia32_sysenter_target)
151151
1: movl (%rbp),%ebp
152152
_ASM_EXTABLE(1b,ia32_badarg)
153153
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
162+
sysenter_flags_fixed:
163+
154164
orl $TS_COMPAT,TI_status+THREAD_INFO(%rsp,RIP-ARGOFFSET)
155165
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
156166
CFI_REMEMBER_STATE
@@ -184,6 +194,8 @@ sysexit_from_sys_call:
184194
TRACE_IRQS_ON
185195
ENABLE_INTERRUPTS_SYSEXIT32
186196

197+
CFI_RESTORE_STATE
198+
187199
#ifdef CONFIG_AUDITSYSCALL
188200
.macro auditsys_entry_common
189201
movl %esi,%r9d /* 6th arg: 4th syscall arg */
@@ -226,7 +238,6 @@ sysexit_from_sys_call:
226238
.endm
227239

228240
sysenter_auditsys:
229-
CFI_RESTORE_STATE
230241
auditsys_entry_common
231242
movl %ebp,%r9d /* reload 6th syscall arg */
232243
jmp sysenter_dispatch
@@ -235,6 +246,11 @@ sysexit_audit:
235246
auditsys_exit sysexit_from_sys_call
236247
#endif
237248

249+
sysenter_fix_flags:
250+
pushq_cfi $(X86_EFLAGS_IF|X86_EFLAGS_FIXED)
251+
popfq_cfi
252+
jmp sysenter_flags_fixed
253+
238254
sysenter_tracesys:
239255
#ifdef CONFIG_AUDITSYSCALL
240256
testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)

‎arch/x86/include/asm/elf.h‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,9 @@ do { \
160160
#define elf_check_arch(x) \
161161
((x)->e_machine == EM_X86_64)
162162

163-
#define compat_elf_check_arch(x) \
164-
(elf_check_arch_ia32(x) || (x)->e_machine == EM_X86_64)
163+
#define compat_elf_check_arch(x) \
164+
(elf_check_arch_ia32(x) || \
165+
(IS_ENABLED(CONFIG_X86_X32_ABI) && (x)->e_machine == EM_X86_64))
165166

166167
#if __USER32_DS != __USER_DS
167168
# error "The following code assumes __USER32_DS == __USER_DS"

‎arch/x86/kernel/apic/apic_numachip.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
static int numachip_system __read_mostly;
3434

35-
static const struct apic apic_numachip __read_mostly;
35+
static const struct apic apic_numachip;
3636

3737
static unsigned int get_apic_id(unsigned long x)
3838
{

‎arch/x86/kernel/cpu/common.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,7 @@ void syscall_init(void)
11841184
/* Flags to clear on syscall */
11851185
wrmsrl(MSR_SYSCALL_MASK,
11861186
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);
11881188
}
11891189

11901190
/*

0 commit comments

Comments
 (0)