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 'powerpc-5.12-6' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux

Pull powerpc fixes from Michael Ellerman:
"Some some more powerpc fixes for 5.12:

- Fix an oops triggered by ptrace when CONFIG_PPC_FPU_REGS=n

- Fix an oops on sigreturn when the VDSO is unmapped on 32-bit

- Fix vdso_wrapper.o not being rebuilt everytime vdso.so is rebuilt

Thanks to Christophe Leroy"

* tag 'powerpc-5.12-6' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
powerpc/vdso: Make sure vdso_wrapper.o is rebuilt everytime vdso.so is rebuilt
powerpc/signal32: Fix Oops on sigreturn with unmapped VDSO
powerpc/ptrace: Don't return error when getting/setting FP regs without CONFIG_PPC_FPU_REGS

+32 -30
+4
arch/powerpc/kernel/Makefile
··· 191 191 targets += prom_init_check 192 192 193 193 clean-files := vmlinux.lds 194 + 195 + # Force dependency (incbin is bad) 196 + $(obj)/vdso32_wrapper.o : $(obj)/vdso32/vdso32.so.dbg 197 + $(obj)/vdso64_wrapper.o : $(obj)/vdso64/vdso64.so.dbg
+2 -2
arch/powerpc/kernel/ptrace/Makefile
··· 6 6 CFLAGS_ptrace-view.o += -DUTS_MACHINE='"$(UTS_MACHINE)"' 7 7 8 8 obj-y += ptrace.o ptrace-view.o 9 - obj-$(CONFIG_PPC_FPU_REGS) += ptrace-fpu.o 9 + obj-y += ptrace-fpu.o 10 10 obj-$(CONFIG_COMPAT) += ptrace32.o 11 11 obj-$(CONFIG_VSX) += ptrace-vsx.o 12 12 ifneq ($(CONFIG_VSX),y) 13 - obj-$(CONFIG_PPC_FPU_REGS) += ptrace-novsx.o 13 + obj-y += ptrace-novsx.o 14 14 endif 15 15 obj-$(CONFIG_ALTIVEC) += ptrace-altivec.o 16 16 obj-$(CONFIG_SPE) += ptrace-spe.o
-14
arch/powerpc/kernel/ptrace/ptrace-decl.h
··· 165 165 extern const struct user_regset_view user_ppc_native_view; 166 166 167 167 /* ptrace-fpu */ 168 - #ifdef CONFIG_PPC_FPU_REGS 169 168 int ptrace_get_fpr(struct task_struct *child, int index, unsigned long *data); 170 169 int ptrace_put_fpr(struct task_struct *child, int index, unsigned long data); 171 - #else 172 - static inline int 173 - ptrace_get_fpr(struct task_struct *child, int index, unsigned long *data) 174 - { 175 - return -EIO; 176 - } 177 - 178 - static inline int 179 - ptrace_put_fpr(struct task_struct *child, int index, unsigned long data) 180 - { 181 - return -EIO; 182 - } 183 - #endif 184 170 185 171 /* ptrace-(no)adv */ 186 172 void ppc_gethwdinfo(struct ppc_debug_info *dbginfo);
+10
arch/powerpc/kernel/ptrace/ptrace-fpu.c
··· 8 8 9 9 int ptrace_get_fpr(struct task_struct *child, int index, unsigned long *data) 10 10 { 11 + #ifdef CONFIG_PPC_FPU_REGS 11 12 unsigned int fpidx = index - PT_FPR0; 13 + #endif 12 14 13 15 if (index > PT_FPSCR) 14 16 return -EIO; 15 17 18 + #ifdef CONFIG_PPC_FPU_REGS 16 19 flush_fp_to_thread(child); 17 20 if (fpidx < (PT_FPSCR - PT_FPR0)) 18 21 memcpy(data, &child->thread.TS_FPR(fpidx), sizeof(long)); 19 22 else 20 23 *data = child->thread.fp_state.fpscr; 24 + #else 25 + *data = 0; 26 + #endif 21 27 22 28 return 0; 23 29 } 24 30 25 31 int ptrace_put_fpr(struct task_struct *child, int index, unsigned long data) 26 32 { 33 + #ifdef CONFIG_PPC_FPU_REGS 27 34 unsigned int fpidx = index - PT_FPR0; 35 + #endif 28 36 29 37 if (index > PT_FPSCR) 30 38 return -EIO; 31 39 40 + #ifdef CONFIG_PPC_FPU_REGS 32 41 flush_fp_to_thread(child); 33 42 if (fpidx < (PT_FPSCR - PT_FPR0)) 34 43 memcpy(&child->thread.TS_FPR(fpidx), &data, sizeof(long)); 35 44 else 36 45 child->thread.fp_state.fpscr = data; 46 + #endif 37 47 38 48 return 0; 39 49 }
+8
arch/powerpc/kernel/ptrace/ptrace-novsx.c
··· 21 21 int fpr_get(struct task_struct *target, const struct user_regset *regset, 22 22 struct membuf to) 23 23 { 24 + #ifdef CONFIG_PPC_FPU_REGS 24 25 BUILD_BUG_ON(offsetof(struct thread_fp_state, fpscr) != 25 26 offsetof(struct thread_fp_state, fpr[32])); 26 27 27 28 flush_fp_to_thread(target); 28 29 29 30 return membuf_write(&to, &target->thread.fp_state, 33 * sizeof(u64)); 31 + #else 32 + return membuf_write(&to, &empty_zero_page, 33 * sizeof(u64)); 33 + #endif 30 34 } 31 35 32 36 /* ··· 50 46 unsigned int pos, unsigned int count, 51 47 const void *kbuf, const void __user *ubuf) 52 48 { 49 + #ifdef CONFIG_PPC_FPU_REGS 53 50 BUILD_BUG_ON(offsetof(struct thread_fp_state, fpscr) != 54 51 offsetof(struct thread_fp_state, fpr[32])); 55 52 ··· 58 53 59 54 return user_regset_copyin(&pos, &count, &kbuf, &ubuf, 60 55 &target->thread.fp_state, 0, -1); 56 + #else 57 + return 0; 58 + #endif 61 59 }
-2
arch/powerpc/kernel/ptrace/ptrace-view.c
··· 522 522 .size = sizeof(long), .align = sizeof(long), 523 523 .regset_get = gpr_get, .set = gpr_set 524 524 }, 525 - #ifdef CONFIG_PPC_FPU_REGS 526 525 [REGSET_FPR] = { 527 526 .core_note_type = NT_PRFPREG, .n = ELF_NFPREG, 528 527 .size = sizeof(double), .align = sizeof(double), 529 528 .regset_get = fpr_get, .set = fpr_set 530 529 }, 531 - #endif 532 530 #ifdef CONFIG_ALTIVEC 533 531 [REGSET_VMX] = { 534 532 .core_note_type = NT_PPC_VMX, .n = 34,
+8 -12
arch/powerpc/kernel/signal_32.c
··· 775 775 else 776 776 prepare_save_user_regs(1); 777 777 778 - if (!user_write_access_begin(frame, sizeof(*frame))) 778 + if (!user_access_begin(frame, sizeof(*frame))) 779 779 goto badframe; 780 780 781 781 /* Put the siginfo & fill in most of the ucontext */ ··· 809 809 unsafe_put_user(PPC_INST_ADDI + __NR_rt_sigreturn, &mctx->mc_pad[0], 810 810 failed); 811 811 unsafe_put_user(PPC_INST_SC, &mctx->mc_pad[1], failed); 812 + asm("dcbst %y0; sync; icbi %y0; sync" :: "Z" (mctx->mc_pad[0])); 812 813 } 813 814 unsafe_put_sigset_t(&frame->uc.uc_sigmask, oldset, failed); 814 815 815 - user_write_access_end(); 816 + user_access_end(); 816 817 817 818 if (copy_siginfo_to_user(&frame->info, &ksig->info)) 818 819 goto badframe; 819 - 820 - if (tramp == (unsigned long)mctx->mc_pad) 821 - flush_icache_range(tramp, tramp + 2 * sizeof(unsigned long)); 822 820 823 821 regs->link = tramp; 824 822 ··· 842 844 return 0; 843 845 844 846 failed: 845 - user_write_access_end(); 847 + user_access_end(); 846 848 847 849 badframe: 848 850 signal_fault(tsk, regs, "handle_rt_signal32", frame); ··· 877 879 else 878 880 prepare_save_user_regs(1); 879 881 880 - if (!user_write_access_begin(frame, sizeof(*frame))) 882 + if (!user_access_begin(frame, sizeof(*frame))) 881 883 goto badframe; 882 884 sc = (struct sigcontext __user *) &frame->sctx; 883 885 ··· 906 908 /* Set up the sigreturn trampoline: li r0,sigret; sc */ 907 909 unsafe_put_user(PPC_INST_ADDI + __NR_sigreturn, &mctx->mc_pad[0], failed); 908 910 unsafe_put_user(PPC_INST_SC, &mctx->mc_pad[1], failed); 911 + asm("dcbst %y0; sync; icbi %y0; sync" :: "Z" (mctx->mc_pad[0])); 909 912 } 910 - user_write_access_end(); 911 - 912 - if (tramp == (unsigned long)mctx->mc_pad) 913 - flush_icache_range(tramp, tramp + 2 * sizeof(unsigned long)); 913 + user_access_end(); 914 914 915 915 regs->link = tramp; 916 916 ··· 931 935 return 0; 932 936 933 937 failed: 934 - user_write_access_end(); 938 + user_access_end(); 935 939 936 940 badframe: 937 941 signal_fault(tsk, regs, "handle_signal32", frame);