Skip to content

Commit 53630a1

Browse files
committed
Merge branch 'for-next/misc' into for-next/core
* for-next/misc: : Miscellaneous patches arm64/kprobe: Optimize the performance of patching single-step slot ARM64: reloc_test: add __init/__exit annotations to module init/exit funcs arm64/mm: fold check for KFENCE into can_set_direct_map() arm64: uaccess: simplify uaccess_mask_ptr() arm64: mte: move register initialization to C arm64: mm: handle ARM64_KERNEL_USES_PMD_MAPS in vmemmap_populate() arm64: dma: Drop cache invalidation from arch_dma_prep_coherent() arm64: support huge vmalloc mappings arm64: spectre: increase parameters that can be used to turn off bhb mitigation individually arm64: run softirqs on the per-CPU IRQ stack arm64: compat: Implement misalignment fixups for multiword loads
2 parents c704cf2 + a0caebb commit 53630a1

File tree

19 files changed

+539
-80
lines changed

19 files changed

+539
-80
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3207,6 +3207,7 @@
32073207
spectre_v2_user=off [X86]
32083208
spec_store_bypass_disable=off [X86,PPC]
32093209
ssbd=force-off [ARM64]
3210+
nospectre_bhb [ARM64]
32103211
l1tf=off [X86]
32113212
mds=off [X86]
32123213
tsx_async_abort=off [X86]
@@ -3613,7 +3614,7 @@
36133614

36143615
nohugeiomap [KNL,X86,PPC,ARM64] Disable kernel huge I/O mappings.
36153616

3616-
nohugevmalloc [PPC] Disable kernel huge vmalloc mappings.
3617+
nohugevmalloc [KNL,X86,PPC,ARM64] Disable kernel huge vmalloc mappings.
36173618

36183619
nosmt [KNL,S390] Disable symmetric multithreading (SMT).
36193620
Equivalent to smt=1.
@@ -3631,6 +3632,10 @@
36313632
vulnerability. System may allow data leaks with this
36323633
option.
36333634

3635+
nospectre_bhb [ARM64] Disable all mitigations for Spectre-BHB (branch
3636+
history injection) vulnerability. System may allow data leaks
3637+
with this option.
3638+
36343639
nospec_store_bypass_disable
36353640
[HW] Disable all mitigations for the Speculative Store Bypass vulnerability
36363641

arch/arm64/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ config ARM64
149149
select HAVE_ARCH_AUDITSYSCALL
150150
select HAVE_ARCH_BITREVERSE
151151
select HAVE_ARCH_COMPILER_H
152+
select HAVE_ARCH_HUGE_VMALLOC
152153
select HAVE_ARCH_HUGE_VMAP
153154
select HAVE_ARCH_JUMP_LABEL
154155
select HAVE_ARCH_JUMP_LABEL_RELATIVE
@@ -230,6 +231,7 @@ config ARM64
230231
select HAVE_ARCH_USERFAULTFD_MINOR if USERFAULTFD
231232
select TRACE_IRQFLAGS_SUPPORT
232233
select TRACE_IRQFLAGS_NMI_SUPPORT
234+
select HAVE_SOFTIRQ_ON_OWN_STACK
233235
help
234236
ARM 64-bit (AArch64) Linux support.
235237

@@ -1575,6 +1577,9 @@ config THUMB2_COMPAT_VDSO
15751577
Compile the compat vDSO with '-mthumb -fomit-frame-pointer' if y,
15761578
otherwise with '-marm'.
15771579

1580+
config COMPAT_ALIGNMENT_FIXUPS
1581+
bool "Fix up misaligned multi-word loads and stores in user space"
1582+
15781583
menuconfig ARMV8_DEPRECATED
15791584
bool "Emulate deprecated/obsolete ARMv8 instructions"
15801585
depends on SYSCTL

arch/arm64/include/asm/exception.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ void do_sysinstr(unsigned long esr, struct pt_regs *regs);
7171
void do_sp_pc_abort(unsigned long addr, unsigned long esr, struct pt_regs *regs);
7272
void bad_el0_sync(struct pt_regs *regs, int reason, unsigned long esr);
7373
void do_cp15instr(unsigned long esr, struct pt_regs *regs);
74+
int do_compat_alignment_fixup(unsigned long addr, struct pt_regs *regs);
7475
void do_el0_svc(struct pt_regs *regs);
7576
void do_el0_svc_compat(struct pt_regs *regs);
7677
void do_el0_fpac(struct pt_regs *regs, unsigned long esr);

arch/arm64/include/asm/mte.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ void mte_sync_tags(pte_t old_pte, pte_t pte);
4242
void mte_copy_page_tags(void *kto, const void *kfrom);
4343
void mte_thread_init_user(void);
4444
void mte_thread_switch(struct task_struct *next);
45+
void mte_cpu_setup(void);
4546
void mte_suspend_enter(void);
47+
void mte_suspend_exit(void);
4648
long set_mte_ctrl(struct task_struct *task, unsigned long arg);
4749
long get_mte_ctrl(struct task_struct *task);
4850
int mte_ptrace_copy_tags(struct task_struct *child, long request,
@@ -72,6 +74,9 @@ static inline void mte_thread_switch(struct task_struct *next)
7274
static inline void mte_suspend_enter(void)
7375
{
7476
}
77+
static inline void mte_suspend_exit(void)
78+
{
79+
}
7580
static inline long set_mte_ctrl(struct task_struct *task, unsigned long arg)
7681
{
7782
return 0;

arch/arm64/include/asm/uaccess.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -203,24 +203,24 @@ static inline void uaccess_enable_privileged(void)
203203
}
204204

205205
/*
206-
* Sanitise a uaccess pointer such that it becomes NULL if above the maximum
207-
* user address. In case the pointer is tagged (has the top byte set), untag
208-
* the pointer before checking.
206+
* Sanitize a uaccess pointer such that it cannot reach any kernel address.
207+
*
208+
* Clearing bit 55 ensures the pointer cannot address any portion of the TTBR1
209+
* address range (i.e. any kernel address), and either the pointer falls within
210+
* the TTBR0 address range or must cause a fault.
209211
*/
210212
#define uaccess_mask_ptr(ptr) (__typeof__(ptr))__uaccess_mask_ptr(ptr)
211213
static inline void __user *__uaccess_mask_ptr(const void __user *ptr)
212214
{
213215
void __user *safe_ptr;
214216

215217
asm volatile(
216-
" bics xzr, %3, %2\n"
217-
" csel %0, %1, xzr, eq\n"
218-
: "=&r" (safe_ptr)
219-
: "r" (ptr), "r" (TASK_SIZE_MAX - 1),
220-
"r" (untagged_addr(ptr))
221-
: "cc");
222-
223-
csdb();
218+
" bic %0, %1, %2\n"
219+
: "=r" (safe_ptr)
220+
: "r" (ptr),
221+
"i" (BIT(55))
222+
);
223+
224224
return safe_ptr;
225225
}
226226

arch/arm64/kernel/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ $(obj)/%.stub.o: $(obj)/%.o FORCE
4545
obj-$(CONFIG_COMPAT) += sys32.o signal32.o \
4646
sys_compat.o
4747
obj-$(CONFIG_COMPAT) += sigreturn32.o
48+
obj-$(CONFIG_COMPAT_ALIGNMENT_FIXUPS) += compat_alignment.o
4849
obj-$(CONFIG_KUSER_HELPERS) += kuser32.o
4950
obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o entry-ftrace.o
5051
obj-$(CONFIG_MODULES) += module.o

0 commit comments

Comments
 (0)