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 'mips-fixes_6.14_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux

Pull MIPS fixes from Thomas Bogendoerfer:
"Fix for o32 ptrace/get_syscall_info"

* tag 'mips-fixes_6.14_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux:
MIPS: fix mips_get_syscall_arg() for o32
MIPS: Export syscall stack arguments properly for remote use

+20 -30
+2 -2
arch/mips/include/asm/ptrace.h
··· 27 27 */ 28 28 struct pt_regs { 29 29 #ifdef CONFIG_32BIT 30 - /* Pad bytes for argument save space on the stack. */ 31 - unsigned long pad0[8]; 30 + /* Saved syscall stack arguments; entries 0-3 unused. */ 31 + unsigned long args[8]; 32 32 #endif 33 33 34 34 /* Saved main processor registers. */
+8 -24
arch/mips/include/asm/syscall.h
··· 57 57 static inline void mips_get_syscall_arg(unsigned long *arg, 58 58 struct task_struct *task, struct pt_regs *regs, unsigned int n) 59 59 { 60 - unsigned long usp __maybe_unused = regs->regs[29]; 61 - 60 + #ifdef CONFIG_32BIT 62 61 switch (n) { 63 62 case 0: case 1: case 2: case 3: 64 63 *arg = regs->regs[4 + n]; 65 - 66 64 return; 67 - 68 - #ifdef CONFIG_32BIT 69 65 case 4: case 5: case 6: case 7: 70 - get_user(*arg, (int *)usp + n); 66 + *arg = regs->args[n]; 71 67 return; 72 - #endif 73 - 74 - #ifdef CONFIG_64BIT 75 - case 4: case 5: case 6: case 7: 76 - #ifdef CONFIG_MIPS32_O32 77 - if (test_tsk_thread_flag(task, TIF_32BIT_REGS)) 78 - get_user(*arg, (int *)usp + n); 79 - else 80 - #endif 81 - *arg = regs->regs[4 + n]; 82 - 83 - return; 84 - #endif 85 - 86 - default: 87 - BUG(); 88 68 } 89 - 90 - unreachable(); 69 + #else 70 + *arg = regs->regs[4 + n]; 71 + if ((IS_ENABLED(CONFIG_MIPS32_O32) && 72 + test_tsk_thread_flag(task, TIF_32BIT_REGS))) 73 + *arg = (unsigned int)*arg; 74 + #endif 91 75 } 92 76 93 77 static inline long syscall_get_error(struct task_struct *task,
+6
arch/mips/kernel/asm-offsets.c
··· 27 27 void output_ptreg_defines(void) 28 28 { 29 29 COMMENT("MIPS pt_regs offsets."); 30 + #ifdef CONFIG_32BIT 31 + OFFSET(PT_ARG4, pt_regs, args[4]); 32 + OFFSET(PT_ARG5, pt_regs, args[5]); 33 + OFFSET(PT_ARG6, pt_regs, args[6]); 34 + OFFSET(PT_ARG7, pt_regs, args[7]); 35 + #endif 30 36 OFFSET(PT_R0, pt_regs, regs[0]); 31 37 OFFSET(PT_R1, pt_regs, regs[1]); 32 38 OFFSET(PT_R2, pt_regs, regs[2]);
+4 -4
arch/mips/kernel/scall32-o32.S
··· 64 64 load_a7: user_lw(t8, 28(t0)) # argument #8 from usp 65 65 loads_done: 66 66 67 - sw t5, 16(sp) # argument #5 to ksp 68 - sw t6, 20(sp) # argument #6 to ksp 69 - sw t7, 24(sp) # argument #7 to ksp 70 - sw t8, 28(sp) # argument #8 to ksp 67 + sw t5, PT_ARG4(sp) # argument #5 to ksp 68 + sw t6, PT_ARG5(sp) # argument #6 to ksp 69 + sw t7, PT_ARG6(sp) # argument #7 to ksp 70 + sw t8, PT_ARG7(sp) # argument #8 to ksp 71 71 .set pop 72 72 73 73 .section __ex_table,"a"