Skip to content

Commit e60329c

Browse files
committed
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 fixes from Will Deacon: "A larger-than-usual batch of arm64 fixes for -rc3. The bulk of the fixes are dealing with a bunch of issues with the build system from the compat vDSO, which unfortunately led to some significant Makefile rework to manage the horrible combinations of toolchains that we can end up needing to drive simultaneously. We came close to disabling the thing entirely, but Vincenzo was quick to spin up some patches and I ended up picking up most of the bits that were left [*]. Future work will look at disentangling the header files properly. Other than that, we have some important fixes all over, including one papering over the miscompilation fallout from forcing CONFIG_OPTIMIZE_INLINING=y, which I'm still unhappy about. Harumph. We've still got a couple of open issues, so I'm expecting to have some more fixes later this cycle. Summary: - Numerous fixes to the compat vDSO build system, especially when combining gcc and clang - Fix parsing of PAR_EL1 in spurious kernel fault detection - Partial workaround for Neoverse-N1 erratum #1542419 - Fix IRQ priority masking on entry from compat syscalls - Fix advertisment of FRINT HWCAP to userspace - Attempt to workaround inlining breakage with '__always_inline' - Fix accidental freeing of parent SVE state on fork() error path - Add some missing NULL pointer checks in instruction emulation init - Some formatting and comment fixes" [*] Will's final fixes were Reviewed-by: Vincenzo Frascino <[email protected]> Tested-by: Vincenzo Frascino <[email protected]> but they were already in linux-next by then and he didn't rebase just to add those. * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: (21 commits) arm64: armv8_deprecated: Checking return value for memory allocation arm64: Kconfig: Make CONFIG_COMPAT_VDSO a proper Kconfig option arm64: vdso32: Rename COMPATCC to CC_COMPAT arm64: vdso32: Pass '--target' option to clang via VDSO_CAFLAGS arm64: vdso32: Don't use KBUILD_CPPFLAGS unconditionally arm64: vdso32: Move definition of COMPATCC into vdso32/Makefile arm64: Default to building compat vDSO with clang when CONFIG_CC_IS_CLANG lib: vdso: Remove CROSS_COMPILE_COMPAT_VDSO arm64: vdso32: Remove jump label config option in Makefile arm64: vdso32: Detect binutils support for dmb ishld arm64: vdso: Remove stale files from old assembly implementation arm64: vdso32: Fix broken compat vDSO build warnings arm64: mm: fix spurious fault detection arm64: ftrace: Ensure synchronisation in PLT setup for Neoverse-N1 #1542419 arm64: Fix incorrect irqflag restore for priority masking for compat arm64: mm: avoid virt_to_phys(init_mm.pgd) arm64: cpufeature: Effectively expose FRINT capability to userspace arm64: Mark functions using explicit register variables as '__always_inline' docs: arm64: Fix indentation and doc formatting arm64/sve: Fix wrong free for task->thread.sve_state ...
2 parents e3280b5 + 3e7c93b commit e60329c

File tree

16 files changed

+98
-104
lines changed

16 files changed

+98
-104
lines changed

Documentation/arm64/memory.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,18 @@ return virtual addresses to userspace from a 48-bit range.
154154

155155
Software can "opt-in" to receiving VAs from a 52-bit space by
156156
specifying an mmap hint parameter that is larger than 48-bit.
157+
157158
For example:
158-
maybe_high_address = mmap(~0UL, size, prot, flags,...);
159+
160+
.. code-block:: c
161+
162+
maybe_high_address = mmap(~0UL, size, prot, flags,...);
159163
160164
It is also possible to build a debug kernel that returns addresses
161165
from a 52-bit space by enabling the following kernel config options:
166+
167+
.. code-block:: sh
168+
162169
CONFIG_EXPERT=y && CONFIG_ARM64_FORCE_52BIT=y
163170
164171
Note that this option is only intended for debugging applications

arch/arm64/Kconfig

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ config ARM64
110110
select GENERIC_STRNLEN_USER
111111
select GENERIC_TIME_VSYSCALL
112112
select GENERIC_GETTIMEOFDAY
113-
select GENERIC_COMPAT_VDSO if (!CPU_BIG_ENDIAN && COMPAT)
114113
select HANDLE_DOMAIN_IRQ
115114
select HARDIRQS_SW_RESEND
116115
select HAVE_PCI
@@ -1159,7 +1158,7 @@ menuconfig COMPAT
11591158
if COMPAT
11601159

11611160
config KUSER_HELPERS
1162-
bool "Enable kuser helpers page for 32 bit applications"
1161+
bool "Enable kuser helpers page for 32-bit applications"
11631162
default y
11641163
help
11651164
Warning: disabling this option may break 32-bit user programs.
@@ -1185,6 +1184,18 @@ config KUSER_HELPERS
11851184
Say N here only if you are absolutely certain that you do not
11861185
need these helpers; otherwise, the safe option is to say Y.
11871186

1187+
config COMPAT_VDSO
1188+
bool "Enable vDSO for 32-bit applications"
1189+
depends on !CPU_BIG_ENDIAN && "$(CROSS_COMPILE_COMPAT)" != ""
1190+
select GENERIC_COMPAT_VDSO
1191+
default y
1192+
help
1193+
Place in the process address space of 32-bit applications an
1194+
ELF shared object providing fast implementations of gettimeofday
1195+
and clock_gettime.
1196+
1197+
You must have a 32-bit build of glibc 2.22 or later for programs
1198+
to seamlessly take advantage of this.
11881199

11891200
menuconfig ARMV8_DEPRECATED
11901201
bool "Emulate deprecated/obsolete ARMv8 instructions"

arch/arm64/Makefile

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,6 @@ $(warning Detected assembler with broken .inst; disassembly will be unreliable)
5353
endif
5454
endif
5555

56-
ifeq ($(CONFIG_GENERIC_COMPAT_VDSO), y)
57-
CROSS_COMPILE_COMPAT ?= $(CONFIG_CROSS_COMPILE_COMPAT_VDSO:"%"=%)
58-
59-
ifeq ($(CONFIG_CC_IS_CLANG), y)
60-
$(warning CROSS_COMPILE_COMPAT is clang, the compat vDSO will not be built)
61-
else ifeq ($(strip $(CROSS_COMPILE_COMPAT)),)
62-
$(warning CROSS_COMPILE_COMPAT not defined or empty, the compat vDSO will not be built)
63-
else ifeq ($(shell which $(CROSS_COMPILE_COMPAT)gcc 2> /dev/null),)
64-
$(error $(CROSS_COMPILE_COMPAT)gcc not found, check CROSS_COMPILE_COMPAT)
65-
else
66-
export CROSS_COMPILE_COMPAT
67-
export CONFIG_COMPAT_VDSO := y
68-
compat_vdso := -DCONFIG_COMPAT_VDSO=1
69-
endif
70-
endif
71-
7256
KBUILD_CFLAGS += -mgeneral-regs-only $(lseinstr) $(brokengasinst) \
7357
$(compat_vdso) $(cc_has_k_constraint)
7458
KBUILD_CFLAGS += -fno-asynchronous-unwind-tables

arch/arm64/include/asm/atomic_lse.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,8 @@ static inline s64 __lse_atomic64_dec_if_positive(atomic64_t *v)
321321
}
322322

323323
#define __CMPXCHG_CASE(w, sfx, name, sz, mb, cl...) \
324-
static inline u##sz __lse__cmpxchg_case_##name##sz(volatile void *ptr, \
324+
static __always_inline u##sz \
325+
__lse__cmpxchg_case_##name##sz(volatile void *ptr, \
325326
u##sz old, \
326327
u##sz new) \
327328
{ \
@@ -362,7 +363,8 @@ __CMPXCHG_CASE(x, , mb_, 64, al, "memory")
362363
#undef __CMPXCHG_CASE
363364

364365
#define __CMPXCHG_DBL(name, mb, cl...) \
365-
static inline long __lse__cmpxchg_double##name(unsigned long old1, \
366+
static __always_inline long \
367+
__lse__cmpxchg_double##name(unsigned long old1, \
366368
unsigned long old2, \
367369
unsigned long new1, \
368370
unsigned long new2, \

arch/arm64/include/asm/vdso/compat_barrier.h

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

2121
#define dmb(option) __asm__ __volatile__ ("dmb " #option : : : "memory")
2222

23-
#if __LINUX_ARM_ARCH__ >= 8
23+
#if __LINUX_ARM_ARCH__ >= 8 && defined(CONFIG_AS_DMB_ISHLD)
2424
#define aarch32_smp_mb() dmb(ish)
2525
#define aarch32_smp_rmb() dmb(ishld)
2626
#define aarch32_smp_wmb() dmb(ishst)

arch/arm64/include/asm/vdso_datapage.h

Lines changed: 0 additions & 33 deletions
This file was deleted.

arch/arm64/kernel/armv8_deprecated.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ static void __init register_insn_emulation(struct insn_emulation_ops *ops)
174174
struct insn_emulation *insn;
175175

176176
insn = kzalloc(sizeof(*insn), GFP_KERNEL);
177+
if (!insn)
178+
return;
179+
177180
insn->ops = ops;
178181
insn->min = INSN_UNDEF;
179182

@@ -233,6 +236,8 @@ static void __init register_insn_emulation_sysctl(void)
233236

234237
insns_sysctl = kcalloc(nr_insn_emulated + 1, sizeof(*sysctl),
235238
GFP_KERNEL);
239+
if (!insns_sysctl)
240+
return;
236241

237242
raw_spin_lock_irqsave(&insn_emulation_lock, flags);
238243
list_for_each_entry(insn, &insn_emulation, node) {

arch/arm64/kernel/cpu_errata.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ static void install_bp_hardening_cb(bp_hardening_cb_t fn,
128128
int cpu, slot = -1;
129129

130130
/*
131-
* enable_smccc_arch_workaround_1() passes NULL for the hyp_vecs
132-
* start/end if we're a guest. Skip the hyp-vectors work.
131+
* detect_harden_bp_fw() passes NULL for the hyp_vecs start/end if
132+
* we're a guest. Skip the hyp-vectors work.
133133
*/
134134
if (!hyp_vecs_start) {
135135
__this_cpu_write(bp_hardening_data.fn, fn);

arch/arm64/kernel/cpufeature.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ static const struct arm64_ftr_bits ftr_id_aa64isar0[] = {
136136

137137
static const struct arm64_ftr_bits ftr_id_aa64isar1[] = {
138138
ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ISAR1_SB_SHIFT, 4, 0),
139+
ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ISAR1_FRINTTS_SHIFT, 4, 0),
139140
ARM64_FTR_BITS(FTR_VISIBLE_IF_IS_ENABLED(CONFIG_ARM64_PTR_AUTH),
140141
FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ISAR1_GPI_SHIFT, 4, 0),
141142
ARM64_FTR_BITS(FTR_VISIBLE_IF_IS_ENABLED(CONFIG_ARM64_PTR_AUTH),

arch/arm64/kernel/entry.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,7 @@ el0_sync_compat:
775775
b.ge el0_dbg
776776
b el0_inv
777777
el0_svc_compat:
778+
gic_prio_kentry_setup tmp=x1
778779
mov x0, sp
779780
bl el0_svc_compat_handler
780781
b ret_to_user

0 commit comments

Comments
 (0)