Commit 73f25536 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull arm64 fixes from Will Deacon:
 "It's all pretty minor but the main fix is sorting out how we deal with
  return values from 32-bit system calls as audit expects error codes to
  be sign-extended to 64 bits

  Summary:

   - Fix extension/truncation of return values from 32-bit system calls

   - Fix interaction between unwinding and tracing

   - Fix spurious toolchain warning emitted during make

   - Fix Kconfig help text for RANDOMIZE_MODULE_REGION_FULL"

* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
  arm64: stacktrace: avoid tracing arch_stack_walk()
  arm64: stacktrace: fix comment
  arm64: fix the doc of RANDOMIZE_MODULE_REGION_FULL
  arm64: move warning about toolchains to archprepare
  arm64: fix compat syscall return truncation
parents cb407fc8 0c32706d
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -1800,11 +1800,11 @@ config RANDOMIZE_BASE
	  If unsure, say N.

config RANDOMIZE_MODULE_REGION_FULL
	bool "Randomize the module region over a 4 GB range"
	bool "Randomize the module region over a 2 GB range"
	depends on RANDOMIZE_BASE
	default y
	help
	  Randomizes the location of the module region inside a 4 GB window
	  Randomizes the location of the module region inside a 2 GB window
	  covering the core kernel. This way, it is less likely for modules
	  to leak information about the location of core kernel data structures
	  but it does imply that function calls between modules and the core
@@ -1812,7 +1812,10 @@ config RANDOMIZE_MODULE_REGION_FULL

	  When this option is not set, the module region will be randomized over
	  a limited range that contains the [_stext, _etext] interval of the
	  core kernel, so branch relocations are always in range.
	  core kernel, so branch relocations are almost always in range unless
	  ARM64_MODULE_PLTS is enabled and the region is exhausted. In this
	  particular case of region exhaustion, modules might be able to fall
	  back to a larger 2GB area.

config CC_HAVE_STACKPROTECTOR_SYSREG
	def_bool $(cc-option,-mstack-protector-guard=sysreg -mstack-protector-guard-reg=sp_el0 -mstack-protector-guard-offset=0)
+12 −9
Original line number Diff line number Diff line
@@ -21,19 +21,11 @@ LDFLAGS_vmlinux += -shared -Bsymbolic -z notext \
endif

ifeq ($(CONFIG_ARM64_ERRATUM_843419),y)
  ifneq ($(CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419),y)
$(warning ld does not support --fix-cortex-a53-843419; kernel may be susceptible to erratum)
  else
  ifeq ($(CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419),y)
LDFLAGS_vmlinux	+= --fix-cortex-a53-843419
  endif
endif

ifeq ($(CONFIG_ARM64_USE_LSE_ATOMICS), y)
  ifneq ($(CONFIG_ARM64_LSE_ATOMICS), y)
$(warning LSE atomics not supported by binutils)
  endif
endif

cc_has_k_constraint := $(call try-run,echo				\
	'int main(void) {						\
		asm volatile("and w0, w0, %w0" :: "K" (4294967295));	\
@@ -176,6 +168,17 @@ vdso_install:

archprepare:
	$(Q)$(MAKE) $(build)=arch/arm64/tools kapi
ifeq ($(CONFIG_ARM64_ERRATUM_843419),y)
  ifneq ($(CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419),y)
	@echo "warning: ld does not support --fix-cortex-a53-843419; kernel may be susceptible to erratum" >&2
  endif
endif
ifeq ($(CONFIG_ARM64_USE_LSE_ATOMICS),y)
  ifneq ($(CONFIG_ARM64_LSE_ATOMICS),y)
	@echo "warning: LSE atomics not supported by binutils" >&2
  endif
endif


# We use MRPROPER_FILES and CLEAN_FILES now
archclean:
+11 −1
Original line number Diff line number Diff line
@@ -320,7 +320,17 @@ static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)

static inline unsigned long regs_return_value(struct pt_regs *regs)
{
	return regs->regs[0];
	unsigned long val = regs->regs[0];

	/*
	 * Audit currently uses regs_return_value() instead of
	 * syscall_get_return_value(). Apply the same sign-extension here until
	 * audit is updated to use syscall_get_return_value().
	 */
	if (compat_user_mode(regs))
		val = sign_extend64(val, 31);

	return val;
}

static inline void regs_set_return_value(struct pt_regs *regs, unsigned long rc)
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ struct stack_info {
 * accounting information necessary for robust unwinding.
 *
 * @fp:          The fp value in the frame record (or the real fp)
 * @pc:          The fp value in the frame record (or the real lr)
 * @pc:          The lr value in the frame record (or the real lr)
 *
 * @stacks_done: Stacks which have been entirely unwound, for which it is no
 *               longer valid to unwind to.
+10 −9
Original line number Diff line number Diff line
@@ -29,22 +29,23 @@ static inline void syscall_rollback(struct task_struct *task,
	regs->regs[0] = regs->orig_x0;
}


static inline long syscall_get_error(struct task_struct *task,
static inline long syscall_get_return_value(struct task_struct *task,
					    struct pt_regs *regs)
{
	unsigned long error = regs->regs[0];
	unsigned long val = regs->regs[0];

	if (is_compat_thread(task_thread_info(task)))
		error = sign_extend64(error, 31);
		val = sign_extend64(val, 31);

	return IS_ERR_VALUE(error) ? error : 0;
	return val;
}

static inline long syscall_get_return_value(struct task_struct *task,
static inline long syscall_get_error(struct task_struct *task,
				     struct pt_regs *regs)
{
	return regs->regs[0];
	unsigned long error = syscall_get_return_value(task, regs);

	return IS_ERR_VALUE(error) ? error : 0;
}

static inline void syscall_set_return_value(struct task_struct *task,
Loading