Fix for o32 ptrace/get_syscall_info
-----BEGIN PGP SIGNATURE----- iQJOBAABCAA4FiEEbt46xwy6kEcDOXoUeZbBVTGwZHAFAmexsT4aHHRzYm9nZW5k QGFscGhhLmZyYW5rZW4uZGUACgkQeZbBVTGwZHAnxRAApYw6GxstHfD83VFsdPwR E3OQlURzGsI8iWp4g/J/e6iC4tUB2pag8RrEYT0kWW2Q9f6LIVgLys3h9mndlM+0 OX1nCTzz4AJ/3bHoXp00ptrdm1MPUuV8lcZGYpB+atig5IjH+4BHeG3Vq1Nr581b y1zy/fIvd47JaJU6S4H30VL+djUXzNUezzNMmcJyO6s790uOMjcvDZgkocfkVVA1 AE1SQ7RDg98GDBn7HaN0SxsWknhZAy0cq00byuRCnqJcnWP+bqUFJzqdhqgiJnG9 PrAiP4XzkThk/I2gBufo/Vtx8UA8x2XCGVqBFlf+8GQIc4IUaM93gU4Y1EBZRViK 3MHFBM8QSA9wl7ZmlfxTQZVGISeIs9jHcL+Ejt3NeJ8tYbDneF5zL0I6uygmGuwI CgK9bN1UDP0MWm+5TyFd3cq0GnxPdhebbK3x/F3pZCfLfjelqanMLrIQIqHqoUUT KrXqOacTeCiFskTliKknipueHBvSXcX+9k8Y+kEWxwQmi1JPxHTYGMDxRVxw1b8S rblwXgY6rK4UeQzY0FGJ1siBOa22lcc3sqRNoq1SIRqUuH8Uq5jSO1frm2YflNWi gGxWwV61c6J4c4o4zCWQe9i6f4ZNokroWkt1Zfwhih/TZzAXQPMKcFArF/Txgz4Z K1E+SEt8fA2BiuKXa1iSqZY= =DHeR -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
b878a1c072
4 changed files with 20 additions and 30 deletions
|
@ -27,8 +27,8 @@
|
|||
*/
|
||||
struct pt_regs {
|
||||
#ifdef CONFIG_32BIT
|
||||
/* Pad bytes for argument save space on the stack. */
|
||||
unsigned long pad0[8];
|
||||
/* Saved syscall stack arguments; entries 0-3 unused. */
|
||||
unsigned long args[8];
|
||||
#endif
|
||||
|
||||
/* Saved main processor registers. */
|
||||
|
|
|
@ -57,37 +57,21 @@ static inline void mips_syscall_update_nr(struct task_struct *task,
|
|||
static inline void mips_get_syscall_arg(unsigned long *arg,
|
||||
struct task_struct *task, struct pt_regs *regs, unsigned int n)
|
||||
{
|
||||
unsigned long usp __maybe_unused = regs->regs[29];
|
||||
|
||||
#ifdef CONFIG_32BIT
|
||||
switch (n) {
|
||||
case 0: case 1: case 2: case 3:
|
||||
*arg = regs->regs[4 + n];
|
||||
|
||||
return;
|
||||
|
||||
#ifdef CONFIG_32BIT
|
||||
case 4: case 5: case 6: case 7:
|
||||
get_user(*arg, (int *)usp + n);
|
||||
*arg = regs->args[n];
|
||||
return;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_64BIT
|
||||
case 4: case 5: case 6: case 7:
|
||||
#ifdef CONFIG_MIPS32_O32
|
||||
if (test_tsk_thread_flag(task, TIF_32BIT_REGS))
|
||||
get_user(*arg, (int *)usp + n);
|
||||
else
|
||||
#endif
|
||||
*arg = regs->regs[4 + n];
|
||||
|
||||
return;
|
||||
#endif
|
||||
|
||||
default:
|
||||
BUG();
|
||||
}
|
||||
|
||||
unreachable();
|
||||
#else
|
||||
*arg = regs->regs[4 + n];
|
||||
if ((IS_ENABLED(CONFIG_MIPS32_O32) &&
|
||||
test_tsk_thread_flag(task, TIF_32BIT_REGS)))
|
||||
*arg = (unsigned int)*arg;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline long syscall_get_error(struct task_struct *task,
|
||||
|
|
|
@ -27,6 +27,12 @@ void output_ptreg_defines(void);
|
|||
void output_ptreg_defines(void)
|
||||
{
|
||||
COMMENT("MIPS pt_regs offsets.");
|
||||
#ifdef CONFIG_32BIT
|
||||
OFFSET(PT_ARG4, pt_regs, args[4]);
|
||||
OFFSET(PT_ARG5, pt_regs, args[5]);
|
||||
OFFSET(PT_ARG6, pt_regs, args[6]);
|
||||
OFFSET(PT_ARG7, pt_regs, args[7]);
|
||||
#endif
|
||||
OFFSET(PT_R0, pt_regs, regs[0]);
|
||||
OFFSET(PT_R1, pt_regs, regs[1]);
|
||||
OFFSET(PT_R2, pt_regs, regs[2]);
|
||||
|
|
|
@ -64,10 +64,10 @@ load_a6: user_lw(t7, 24(t0)) # argument #7 from usp
|
|||
load_a7: user_lw(t8, 28(t0)) # argument #8 from usp
|
||||
loads_done:
|
||||
|
||||
sw t5, 16(sp) # argument #5 to ksp
|
||||
sw t6, 20(sp) # argument #6 to ksp
|
||||
sw t7, 24(sp) # argument #7 to ksp
|
||||
sw t8, 28(sp) # argument #8 to ksp
|
||||
sw t5, PT_ARG4(sp) # argument #5 to ksp
|
||||
sw t6, PT_ARG5(sp) # argument #6 to ksp
|
||||
sw t7, PT_ARG6(sp) # argument #7 to ksp
|
||||
sw t8, PT_ARG7(sp) # argument #8 to ksp
|
||||
.set pop
|
||||
|
||||
.section __ex_table,"a"
|
||||
|
|
Loading…
Add table
Reference in a new issue