Skip to content

Commit 87ebc45

Browse files
committed
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
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
2 parents e4da01d + fc22660 commit 87ebc45

File tree

7 files changed

+19
-32
lines changed

7 files changed

+19
-32
lines changed

arch/arm64/Kconfig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1502,7 +1502,10 @@ config ARM64_PTR_AUTH
15021502
default y
15031503
depends on !KVM || ARM64_VHE
15041504
depends on (CC_HAS_SIGN_RETURN_ADDRESS || CC_HAS_BRANCH_PROT_PAC_RET) && AS_HAS_PAC
1505-
depends on CC_IS_GCC || (CC_IS_CLANG && AS_HAS_CFI_NEGATE_RA_STATE)
1505+
# GCC 9.1 and later inserts a .note.gnu.property section note for PAC
1506+
# which is only understood by binutils starting with version 2.33.1.
1507+
depends on !CC_IS_GCC || GCC_VERSION < 90100 || LD_VERSION >= 233010000
1508+
depends on !CC_IS_CLANG || AS_HAS_CFI_NEGATE_RA_STATE
15061509
depends on (!FUNCTION_GRAPH_TRACER || DYNAMIC_FTRACE_WITH_REGS)
15071510
help
15081511
Pointer authentication (part of the ARMv8.3 Extensions) provides

arch/arm64/Kconfig.debug

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,6 @@ config DEBUG_WX
5252

5353
If in doubt, say "Y".
5454

55-
config DEBUG_ALIGN_RODATA
56-
depends on STRICT_KERNEL_RWX
57-
bool "Align linker sections up to SECTION_SIZE"
58-
help
59-
If this option is enabled, sections that may potentially be marked as
60-
read only or non-executable will be aligned up to the section size of
61-
the kernel. This prevents sections from being split into pages and
62-
avoids a potential TLB penalty. The downside is an increase in
63-
alignment and potentially wasted space. Turn on this option if
64-
performance is more important than memory pressure.
65-
66-
If in doubt, say N.
67-
6855
config DEBUG_EFI
6956
depends on EFI && DEBUG_INFO
7057
bool "UEFI debugging"

arch/arm64/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ stack_protector_prepare: prepare0
6565
include/generated/asm-offsets.h))
6666
endif
6767

68+
# Ensure that if the compiler supports branch protection we default it
69+
# off, this will be overridden if we are using branch protection.
70+
branch-prot-flags-y += $(call cc-option,-mbranch-protection=none)
71+
6872
ifeq ($(CONFIG_ARM64_PTR_AUTH),y)
6973
branch-prot-flags-$(CONFIG_CC_HAS_SIGN_RETURN_ADDRESS) := -msign-return-address=all
7074
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
7377
# we pass it only to the assembler. This option is utilized only in case of non
7478
# integrated assemblers.
7579
branch-prot-flags-$(CONFIG_AS_HAS_PAC) += -Wa,-march=armv8.3-a
76-
KBUILD_CFLAGS += $(branch-prot-flags-y)
7780
endif
7881

82+
KBUILD_CFLAGS += $(branch-prot-flags-y)
83+
7984
ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
8085
KBUILD_CPPFLAGS += -mbig-endian
8186
CHECKFLAGS += -D__AARCH64EB__

arch/arm64/include/asm/memory.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -120,22 +120,12 @@
120120

121121
/*
122122
* Alignment of kernel segments (e.g. .text, .data).
123-
*/
124-
#if defined(CONFIG_DEBUG_ALIGN_RODATA)
125-
/*
126-
* 4 KB granule: 1 level 2 entry
127-
* 16 KB granule: 128 level 3 entries, with contiguous bit
128-
* 64 KB granule: 32 level 3 entries, with contiguous bit
129-
*/
130-
#define SEGMENT_ALIGN SZ_2M
131-
#else
132-
/*
123+
*
133124
* 4 KB granule: 16 level 3 entries, with contiguous bit
134125
* 16 KB granule: 4 level 3 entries, without contiguous bit
135126
* 64 KB granule: 1 level 3 entry
136127
*/
137128
#define SEGMENT_ALIGN SZ_64K
138-
#endif
139129

140130
/*
141131
* Memory types available.

arch/arm64/kernel/armv8_deprecated.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ static struct undef_hook setend_hooks[] = {
601601
},
602602
{
603603
/* Thumb mode */
604-
.instr_mask = 0x0000fff7,
604+
.instr_mask = 0xfffffff7,
605605
.instr_val = 0x0000b650,
606606
.pstate_mask = (PSR_AA32_T_BIT | PSR_AA32_MODE_MASK),
607607
.pstate_val = (PSR_AA32_T_BIT | PSR_AA32_MODE_USR),

drivers/firmware/efi/libstub/arm64-stub.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,12 @@ efi_status_t handle_kernel_image(unsigned long *image_addr,
7575

7676
if (IS_ENABLED(CONFIG_RANDOMIZE_BASE) && phys_seed != 0) {
7777
/*
78-
* If CONFIG_DEBUG_ALIGN_RODATA is not set, produce a
79-
* displacement in the interval [0, MIN_KIMG_ALIGN) that
80-
* doesn't violate this kernel's de-facto alignment
78+
* Produce a displacement in the interval [0, MIN_KIMG_ALIGN)
79+
* that doesn't violate this kernel's de-facto alignment
8180
* constraints.
8281
*/
8382
u32 mask = (MIN_KIMG_ALIGN - 1) & ~(EFI_KIMG_ALIGN - 1);
84-
u32 offset = !IS_ENABLED(CONFIG_DEBUG_ALIGN_RODATA) ?
85-
(phys_seed >> 32) & mask : TEXT_OFFSET;
83+
u32 offset = (phys_seed >> 32) & mask;
8684

8785
/*
8886
* With CONFIG_RANDOMIZE_TEXT_OFFSET=y, TEXT_OFFSET may not

init/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ config GCC_VERSION
1616
default $(shell,$(srctree)/scripts/gcc-version.sh $(CC)) if CC_IS_GCC
1717
default 0
1818

19+
config LD_VERSION
20+
int
21+
default $(shell,$(LD) --version | $(srctree)/scripts/ld-version.sh)
22+
1923
config CC_IS_CLANG
2024
def_bool $(success,$(CC) --version | head -n 1 | grep -q clang)
2125

0 commit comments

Comments
 (0)