Commit 87ebc45d authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull arm64 fixes from Catalin Marinas:

 - Ensure that the compiler and linker versions are aligned so that ld
   doesn't complain about not understanding a .note.gnu.property section
   (emitted when pointer authentication is enabled).

 - Force -mbranch-protection=none when the feature is not enabled, in
   case a compiler may choose a different default value.

 - Remove CONFIG_DEBUG_ALIGN_RODATA. It was never in defconfig and
   rarely enabled.

 - Fix checking 16-bit Thumb-2 instructions checking mask in the
   emulation of the SETEND instruction (it could match the bottom half
   of a 32-bit Thumb-2 instruction).

* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
  arm64: armv8_deprecated: Fix undef_hook mask for thumb setend
  arm64: remove CONFIG_DEBUG_ALIGN_RODATA feature
  arm64: Always force a branch protection mode when the compiler has one
  arm64: Kconfig: ptrauth: Add binutils version check to fix mismatch
  init/kconfig: Add LD_VERSION Kconfig
parents e4da01d8 fc226601
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -1502,7 +1502,10 @@ config ARM64_PTR_AUTH
	default y
	default y
	depends on !KVM || ARM64_VHE
	depends on !KVM || ARM64_VHE
	depends on (CC_HAS_SIGN_RETURN_ADDRESS || CC_HAS_BRANCH_PROT_PAC_RET) && AS_HAS_PAC
	depends on (CC_HAS_SIGN_RETURN_ADDRESS || CC_HAS_BRANCH_PROT_PAC_RET) && AS_HAS_PAC
	depends on CC_IS_GCC || (CC_IS_CLANG && AS_HAS_CFI_NEGATE_RA_STATE)
	# GCC 9.1 and later inserts a .note.gnu.property section note for PAC
	# which is only understood by binutils starting with version 2.33.1.
	depends on !CC_IS_GCC || GCC_VERSION < 90100 || LD_VERSION >= 233010000
	depends on !CC_IS_CLANG || AS_HAS_CFI_NEGATE_RA_STATE
	depends on (!FUNCTION_GRAPH_TRACER || DYNAMIC_FTRACE_WITH_REGS)
	depends on (!FUNCTION_GRAPH_TRACER || DYNAMIC_FTRACE_WITH_REGS)
	help
	help
	  Pointer authentication (part of the ARMv8.3 Extensions) provides
	  Pointer authentication (part of the ARMv8.3 Extensions) provides
+0 −13
Original line number Original line Diff line number Diff line
@@ -52,19 +52,6 @@ config DEBUG_WX


	  If in doubt, say "Y".
	  If in doubt, say "Y".


config DEBUG_ALIGN_RODATA
	depends on STRICT_KERNEL_RWX
	bool "Align linker sections up to SECTION_SIZE"
	help
	  If this option is enabled, sections that may potentially be marked as
	  read only or non-executable will be aligned up to the section size of
	  the kernel. This prevents sections from being split into pages and
	  avoids a potential TLB penalty. The downside is an increase in
	  alignment and potentially wasted space. Turn on this option if
	  performance is more important than memory pressure.

	  If in doubt, say N.

config DEBUG_EFI
config DEBUG_EFI
	depends on EFI && DEBUG_INFO
	depends on EFI && DEBUG_INFO
	bool "UEFI debugging"
	bool "UEFI debugging"
+6 −1
Original line number Original line Diff line number Diff line
@@ -65,6 +65,10 @@ stack_protector_prepare: prepare0
					include/generated/asm-offsets.h))
					include/generated/asm-offsets.h))
endif
endif


# Ensure that if the compiler supports branch protection we default it
# off, this will be overridden if we are using branch protection.
branch-prot-flags-y += $(call cc-option,-mbranch-protection=none)

ifeq ($(CONFIG_ARM64_PTR_AUTH),y)
ifeq ($(CONFIG_ARM64_PTR_AUTH),y)
branch-prot-flags-$(CONFIG_CC_HAS_SIGN_RETURN_ADDRESS) := -msign-return-address=all
branch-prot-flags-$(CONFIG_CC_HAS_SIGN_RETURN_ADDRESS) := -msign-return-address=all
branch-prot-flags-$(CONFIG_CC_HAS_BRANCH_PROT_PAC_RET) := -mbranch-protection=pac-ret+leaf
branch-prot-flags-$(CONFIG_CC_HAS_BRANCH_PROT_PAC_RET) := -mbranch-protection=pac-ret+leaf
@@ -73,9 +77,10 @@ branch-prot-flags-$(CONFIG_CC_HAS_BRANCH_PROT_PAC_RET) := -mbranch-protection=pa
# we pass it only to the assembler. This option is utilized only in case of non
# we pass it only to the assembler. This option is utilized only in case of non
# integrated assemblers.
# integrated assemblers.
branch-prot-flags-$(CONFIG_AS_HAS_PAC) += -Wa,-march=armv8.3-a
branch-prot-flags-$(CONFIG_AS_HAS_PAC) += -Wa,-march=armv8.3-a
KBUILD_CFLAGS += $(branch-prot-flags-y)
endif
endif


KBUILD_CFLAGS += $(branch-prot-flags-y)

ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
KBUILD_CPPFLAGS	+= -mbig-endian
KBUILD_CPPFLAGS	+= -mbig-endian
CHECKFLAGS	+= -D__AARCH64EB__
CHECKFLAGS	+= -D__AARCH64EB__
+1 −11
Original line number Original line Diff line number Diff line
@@ -120,22 +120,12 @@


/*
/*
 * Alignment of kernel segments (e.g. .text, .data).
 * Alignment of kernel segments (e.g. .text, .data).
 */
 *
#if defined(CONFIG_DEBUG_ALIGN_RODATA)
/*
 *  4 KB granule:   1 level 2 entry
 * 16 KB granule: 128 level 3 entries, with contiguous bit
 * 64 KB granule:  32 level 3 entries, with contiguous bit
 */
#define SEGMENT_ALIGN		SZ_2M
#else
/*
 *  4 KB granule:  16 level 3 entries, with contiguous bit
 *  4 KB granule:  16 level 3 entries, with contiguous bit
 * 16 KB granule:   4 level 3 entries, without contiguous bit
 * 16 KB granule:   4 level 3 entries, without contiguous bit
 * 64 KB granule:   1 level 3 entry
 * 64 KB granule:   1 level 3 entry
 */
 */
#define SEGMENT_ALIGN		SZ_64K
#define SEGMENT_ALIGN		SZ_64K
#endif


/*
/*
 * Memory types available.
 * Memory types available.
+1 −1
Original line number Original line Diff line number Diff line
@@ -601,7 +601,7 @@ static struct undef_hook setend_hooks[] = {
	},
	},
	{
	{
		/* Thumb mode */
		/* Thumb mode */
		.instr_mask	= 0x0000fff7,
		.instr_mask	= 0xfffffff7,
		.instr_val	= 0x0000b650,
		.instr_val	= 0x0000b650,
		.pstate_mask	= (PSR_AA32_T_BIT | PSR_AA32_MODE_MASK),
		.pstate_mask	= (PSR_AA32_T_BIT | PSR_AA32_MODE_MASK),
		.pstate_val	= (PSR_AA32_T_BIT | PSR_AA32_MODE_USR),
		.pstate_val	= (PSR_AA32_T_BIT | PSR_AA32_MODE_USR),
Loading