Commit d5f744f9 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'x86-entry-2020-03-30' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 entry code updates from Thomas Gleixner:

 - Convert the 32bit syscalls to be pt_regs based which removes the
   requirement to push all 6 potential arguments onto the stack and
   consolidates the interface with the 64bit variant

 - The first small portion of the exception and syscall related entry
   code consolidation which aims to address the recently discovered
   issues vs. RCU, int3, NMI and some other exceptions which can
   interrupt any context. The bulk of the changes is still work in
   progress and aimed for 5.8.

 - A few lockdep namespace cleanups which have been applied into this
   branch to keep the prerequisites for the ongoing work confined.

* tag 'x86-entry-2020-03-30' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (35 commits)
  x86/entry: Fix build error x86 with !CONFIG_POSIX_TIMERS
  lockdep: Rename trace_{hard,soft}{irq_context,irqs_enabled}()
  lockdep: Rename trace_softirqs_{on,off}()
  lockdep: Rename trace_hardirq_{enter,exit}()
  x86/entry: Rename ___preempt_schedule
  x86: Remove unneeded includes
  x86/entry: Drop asmlinkage from syscalls
  x86/entry/32: Enable pt_regs based syscalls
  x86/entry/32: Use IA32-specific wrappers for syscalls taking 64-bit arguments
  x86/entry/32: Rename 32-bit specific syscalls
  x86/entry/32: Clean up syscall_32.tbl
  x86/entry: Remove ABI prefixes from functions in syscall tables
  x86/entry/64: Add __SYSCALL_COMMON()
  x86/entry: Remove syscall qualifier support
  x86/entry/64: Remove ptregs qualifier from syscall table
  x86/entry: Move max syscall number calculation to syscallhdr.sh
  x86/entry/64: Split X32 syscall table into its own file
  x86/entry/64: Move sys_ni_syscall stub to common.c
  x86/entry/64: Use syscall wrappers for x32_rt_sigreturn
  x86/entry: Refactor SYS_NI macros
  ...
parents dbb381b6 290a4474
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ config X86_64
	select MODULES_USE_ELF_RELA
	select NEED_DMA_MAP_STATE
	select SWIOTLB
	select ARCH_HAS_SYSCALL_WRAPPER

config FORCE_DYNAMIC_FTRACE
	def_bool y
@@ -79,6 +78,7 @@ config X86
	select ARCH_HAS_STRICT_KERNEL_RWX
	select ARCH_HAS_STRICT_MODULE_RWX
	select ARCH_HAS_SYNC_CORE_BEFORE_USERMODE
	select ARCH_HAS_SYSCALL_WRAPPER
	select ARCH_HAS_UBSAN_SANITIZE_ALL
	select ARCH_HAVE_NMI_SAFE_CMPXCHG
	select ARCH_MIGHT_HAVE_ACPI_PDC		if ACPI
+1 −0
Original line number Diff line number Diff line
@@ -14,4 +14,5 @@ obj-y += vdso/
obj-y				+= vsyscall/

obj-$(CONFIG_IA32_EMULATION)	+= entry_64_compat.o syscall_32.o
obj-$(CONFIG_X86_X32_ABI)	+= syscall_x32.o
+5 −13
Original line number Diff line number Diff line
@@ -333,20 +333,7 @@ static __always_inline void do_syscall_32_irqs_on(struct pt_regs *regs)

	if (likely(nr < IA32_NR_syscalls)) {
		nr = array_index_nospec(nr, IA32_NR_syscalls);
#ifdef CONFIG_IA32_EMULATION
		regs->ax = ia32_sys_call_table[nr](regs);
#else
		/*
		 * It's possible that a 32-bit syscall implementation
		 * takes a 64-bit parameter but nonetheless assumes that
		 * the high bits are zero.  Make sure we zero-extend all
		 * of the args.
		 */
		regs->ax = ia32_sys_call_table[nr](
			(unsigned int)regs->bx, (unsigned int)regs->cx,
			(unsigned int)regs->dx, (unsigned int)regs->si,
			(unsigned int)regs->di, (unsigned int)regs->bp);
#endif /* CONFIG_IA32_EMULATION */
	}

	syscall_return_slowpath(regs);
@@ -438,3 +425,8 @@ __visible long do_fast_syscall_32(struct pt_regs *regs)
#endif
}
#endif

SYSCALL_DEFINE0(ni_syscall)
{
	return -ENOSYS;
}
+9 −14
Original line number Diff line number Diff line
@@ -1088,10 +1088,10 @@ SYM_FUNC_START(entry_INT80_32)
	STACKLEAK_ERASE

restore_all:
	TRACE_IRQS_IRET
	TRACE_IRQS_ON
	SWITCH_TO_ENTRY_STACK
	CHECK_AND_APPLY_ESPFIX
.Lrestore_nocheck:

	/* Switch back to user CR3 */
	SWITCH_TO_USER_CR3 scratch_reg=%eax

@@ -1290,7 +1290,7 @@ SYM_CODE_END(simd_coprocessor_error)

SYM_CODE_START(device_not_available)
	ASM_CLAC
	pushl	$-1				# mark this as an int
	pushl	$0
	pushl	$do_device_not_available
	jmp	common_exception
SYM_CODE_END(device_not_available)
@@ -1365,7 +1365,7 @@ SYM_CODE_END(divide_error)
SYM_CODE_START(machine_check)
	ASM_CLAC
	pushl	$0
	pushl	machine_check_vector
	pushl	$do_mce
	jmp	common_exception
SYM_CODE_END(machine_check)
#endif
@@ -1531,7 +1531,7 @@ SYM_CODE_START(debug)
	 * Entry from sysenter is now handled in common_exception
	 */
	ASM_CLAC
	pushl	$-1				# mark this as an int
	pushl	$0
	pushl	$do_debug
	jmp	common_exception
SYM_CODE_END(debug)
@@ -1682,18 +1682,13 @@ SYM_CODE_END(nmi)

SYM_CODE_START(int3)
	ASM_CLAC
	pushl	$-1				# mark this as an int

	SAVE_ALL switch_stacks=1
	ENCODE_FRAME_POINTER
	TRACE_IRQS_OFF
	xorl	%edx, %edx			# zero error code
	movl	%esp, %eax			# pt_regs pointer
	call	do_int3
	jmp	ret_from_exception
	pushl	$0
	pushl	$do_int3
	jmp	common_exception
SYM_CODE_END(int3)

SYM_CODE_START(general_protection)
	ASM_CLAC
	pushl	$do_general_protection
	jmp	common_exception
SYM_CODE_END(general_protection)
+2 −2
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@ SYM_INNER_LABEL(entry_SYSCALL_64_after_hwframe, SYM_L_GLOBAL)
	movq	%rsp, %rsi
	call	do_syscall_64		/* returns with IRQs disabled */

	TRACE_IRQS_IRETQ		/* we're about to change IF */
	TRACE_IRQS_ON			/* return enables interrupts */

	/*
	 * Try to use SYSRET instead of IRET if we're returning to
@@ -619,7 +619,7 @@ ret_from_intr:
.Lretint_user:
	mov	%rsp,%rdi
	call	prepare_exit_to_usermode
	TRACE_IRQS_IRETQ
	TRACE_IRQS_ON

SYM_INNER_LABEL(swapgs_restore_regs_and_return_to_usermode, SYM_L_GLOBAL)
#ifdef CONFIG_DEBUG_ENTRY
Loading