Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'riscv-for-linus-6.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux

Pull RISC-V fixes from Palmer Dabbelt:

- A fix for an __{get,put}_kernel_nofault to avoid an uninitialized
value causing spurious failures

- compat_vdso.so.dbg is now installed to the standard install location

- A fix to avoid initializing PERF_SAMPLE_BRANCH_*-related events, as
they aren't supported and will just later fail

- A fix to make AT_VECTOR_SIZE_ARCH correct now that we're providing
AT_MINSIGSTKSZ

- pgprot_nx() is now implemented, which fixes vmap W^X protection

- A fix for the vector save/restore code, which at least manifests as
corrupted vector state when a signal is taken

- A fix for a race condition in instruction patching

- A fix to avoid leaking the kernel-mode GP to userspace, which is a
kernel pointer leak that can be used to defeat KASLR in various ways

- A handful of smaller fixes to build warnings, an overzealous printk,
and some missing tracing annotations

* tag 'riscv-for-linus-6.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
riscv: process: Fix kernel gp leakage
riscv: Disable preemption when using patch_map()
riscv: Fix warning by declaring arch_cpu_idle() as noinstr
riscv: use KERN_INFO in do_trap
riscv: Fix vector state restore in rt_sigreturn()
riscv: mm: implement pgprot_nx
riscv: compat_vdso: align VDSOAS build log
RISC-V: Update AT_VECTOR_SIZE_ARCH for new AT_MINSIGSTKSZ
riscv: Mark __se_sys_* functions __used
drivers/perf: riscv: Disable PERF_SAMPLE_BRANCH_* while not supported
riscv: compat_vdso: install compat_vdso.so.dbg to /lib/modules/*/vdso/
riscv: hwprobe: do not produce frtace relocation
riscv: Fix spurious errors from __get/put_kernel_nofault
riscv: mm: Fix prototype to avoid discarding const

+38 -20
+1 -1
arch/riscv/Makefile
··· 151 151 endif 152 152 153 153 vdso-install-y += arch/riscv/kernel/vdso/vdso.so.dbg 154 - vdso-install-$(CONFIG_COMPAT) += arch/riscv/kernel/compat_vdso/compat_vdso.so.dbg:../compat_vdso/compat_vdso.so 154 + vdso-install-$(CONFIG_COMPAT) += arch/riscv/kernel/compat_vdso/compat_vdso.so.dbg 155 155 156 156 ifneq ($(CONFIG_XIP_KERNEL),y) 157 157 ifeq ($(CONFIG_RISCV_M_MODE)$(CONFIG_ARCH_CANAAN),yy)
+6
arch/riscv/include/asm/pgtable.h
··· 593 593 return ptep_test_and_clear_young(vma, address, ptep); 594 594 } 595 595 596 + #define pgprot_nx pgprot_nx 597 + static inline pgprot_t pgprot_nx(pgprot_t _prot) 598 + { 599 + return __pgprot(pgprot_val(_prot) & ~_PAGE_EXEC); 600 + } 601 + 596 602 #define pgprot_noncached pgprot_noncached 597 603 static inline pgprot_t pgprot_noncached(pgprot_t _prot) 598 604 {
+2 -1
arch/riscv/include/asm/syscall_wrapper.h
··· 36 36 ulong) \ 37 37 __attribute__((alias(__stringify(___se_##prefix##name)))); \ 38 38 __diag_pop(); \ 39 - static long noinline ___se_##prefix##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \ 39 + static long noinline ___se_##prefix##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \ 40 + __used; \ 40 41 static long ___se_##prefix##name(__MAP(x,__SC_LONG,__VA_ARGS__)) 41 42 42 43 #define SC_RISCV_REGS_TO_ARGS(x, ...) \
+2 -2
arch/riscv/include/asm/uaccess.h
··· 319 319 320 320 #define __get_kernel_nofault(dst, src, type, err_label) \ 321 321 do { \ 322 - long __kr_err; \ 322 + long __kr_err = 0; \ 323 323 \ 324 324 __get_user_nocheck(*((type *)(dst)), (type *)(src), __kr_err); \ 325 325 if (unlikely(__kr_err)) \ ··· 328 328 329 329 #define __put_kernel_nofault(dst, src, type, err_label) \ 330 330 do { \ 331 - long __kr_err; \ 331 + long __kr_err = 0; \ 332 332 \ 333 333 __put_user_nocheck(*((type *)(src)), (type *)(dst), __kr_err); \ 334 334 if (unlikely(__kr_err)) \
+1 -1
arch/riscv/include/uapi/asm/auxvec.h
··· 34 34 #define AT_L3_CACHEGEOMETRY 47 35 35 36 36 /* entries in ARCH_DLINFO */ 37 - #define AT_VECTOR_SIZE_ARCH 9 37 + #define AT_VECTOR_SIZE_ARCH 10 38 38 #define AT_MINSIGSTKSZ 51 39 39 40 40 #endif /* _UAPI_ASM_RISCV_AUXVEC_H */
+1 -1
arch/riscv/kernel/compat_vdso/Makefile
··· 74 74 rm $@.tmp 75 75 76 76 # actual build commands 77 - quiet_cmd_compat_vdsoas = VDSOAS $@ 77 + quiet_cmd_compat_vdsoas = VDSOAS $@ 78 78 cmd_compat_vdsoas = $(COMPAT_CC) $(a_flags) $(COMPAT_CC_FLAGS) -c -o $@ $<
+8
arch/riscv/kernel/patch.c
··· 80 80 */ 81 81 lockdep_assert_held(&text_mutex); 82 82 83 + preempt_disable(); 84 + 83 85 if (across_pages) 84 86 patch_map(addr + PAGE_SIZE, FIX_TEXT_POKE1); 85 87 ··· 93 91 94 92 if (across_pages) 95 93 patch_unmap(FIX_TEXT_POKE1); 94 + 95 + preempt_enable(); 96 96 97 97 return 0; 98 98 } ··· 126 122 if (!riscv_patch_in_stop_machine) 127 123 lockdep_assert_held(&text_mutex); 128 124 125 + preempt_disable(); 126 + 129 127 if (across_pages) 130 128 patch_map(addr + PAGE_SIZE, FIX_TEXT_POKE1); 131 129 ··· 139 133 140 134 if (across_pages) 141 135 patch_unmap(FIX_TEXT_POKE1); 136 + 137 + preempt_enable(); 142 138 143 139 return ret; 144 140 }
+1 -4
arch/riscv/kernel/process.c
··· 27 27 #include <asm/vector.h> 28 28 #include <asm/cpufeature.h> 29 29 30 - register unsigned long gp_in_global __asm__("gp"); 31 - 32 30 #if defined(CONFIG_STACKPROTECTOR) && !defined(CONFIG_STACKPROTECTOR_PER_TASK) 33 31 #include <linux/stackprotector.h> 34 32 unsigned long __stack_chk_guard __read_mostly; ··· 35 37 36 38 extern asmlinkage void ret_from_fork(void); 37 39 38 - void arch_cpu_idle(void) 40 + void noinstr arch_cpu_idle(void) 39 41 { 40 42 cpu_do_idle(); 41 43 } ··· 205 207 if (unlikely(args->fn)) { 206 208 /* Kernel thread */ 207 209 memset(childregs, 0, sizeof(struct pt_regs)); 208 - childregs->gp = gp_in_global; 209 210 /* Supervisor/Machine, irqs on: */ 210 211 childregs->status = SR_PP | SR_PIE; 211 212
+8 -7
arch/riscv/kernel/signal.c
··· 119 119 struct __sc_riscv_v_state __user *state = sc_vec; 120 120 void __user *datap; 121 121 122 + /* 123 + * Mark the vstate as clean prior performing the actual copy, 124 + * to avoid getting the vstate incorrectly clobbered by the 125 + * discarded vector state. 126 + */ 127 + riscv_v_vstate_set_restore(current, regs); 128 + 122 129 /* Copy everything of __sc_riscv_v_state except datap. */ 123 130 err = __copy_from_user(&current->thread.vstate, &state->v_state, 124 131 offsetof(struct __riscv_v_ext_state, datap)); ··· 140 133 * Copy the whole vector content from user space datap. Use 141 134 * copy_from_user to prevent information leak. 142 135 */ 143 - err = copy_from_user(current->thread.vstate.datap, datap, riscv_v_vsize); 144 - if (unlikely(err)) 145 - return err; 146 - 147 - riscv_v_vstate_set_restore(current, regs); 148 - 149 - return err; 136 + return copy_from_user(current->thread.vstate.datap, datap, riscv_v_vsize); 150 137 } 151 138 #else 152 139 #define save_v_state(task, regs) (0)
+1 -1
arch/riscv/kernel/traps.c
··· 122 122 print_vma_addr(KERN_CONT " in ", instruction_pointer(regs)); 123 123 pr_cont("\n"); 124 124 __show_regs(regs); 125 - dump_instr(KERN_EMERG, regs); 125 + dump_instr(KERN_INFO, regs); 126 126 } 127 127 128 128 force_sig_fault(signo, code, (void __user *)addr);
+1
arch/riscv/kernel/vdso/Makefile
··· 37 37 38 38 # Disable -pg to prevent insert call site 39 39 CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) $(CC_FLAGS_SCS) 40 + CFLAGS_REMOVE_hwprobe.o = $(CC_FLAGS_FTRACE) $(CC_FLAGS_SCS) 40 41 41 42 # Disable profiling and instrumentation for VDSO code 42 43 GCOV_PROFILE := n
+2 -2
arch/riscv/mm/tlbflush.c
··· 99 99 local_flush_tlb_range_asid(d->start, d->size, d->stride, d->asid); 100 100 } 101 101 102 - static void __flush_tlb_range(struct cpumask *cmask, unsigned long asid, 102 + static void __flush_tlb_range(const struct cpumask *cmask, unsigned long asid, 103 103 unsigned long start, unsigned long size, 104 104 unsigned long stride) 105 105 { ··· 200 200 201 201 void flush_tlb_kernel_range(unsigned long start, unsigned long end) 202 202 { 203 - __flush_tlb_range((struct cpumask *)cpu_online_mask, FLUSH_TLB_NO_ASID, 203 + __flush_tlb_range(cpu_online_mask, FLUSH_TLB_NO_ASID, 204 204 start, end - start, PAGE_SIZE); 205 205 } 206 206
+4
drivers/perf/riscv_pmu.c
··· 313 313 u64 event_config = 0; 314 314 uint64_t cmask; 315 315 316 + /* driver does not support branch stack sampling */ 317 + if (has_branch_stack(event)) 318 + return -EOPNOTSUPP; 319 + 316 320 hwc->flags = 0; 317 321 mapped_event = rvpmu->event_map(event, &event_config); 318 322 if (mapped_event < 0) {