Re: [PATCH v2 1/7] powerpc: properly negate error in syscall_set_return_value()

Michael Ellerman
2025-01-25T12:18:10Z

Alexey Gladkov <legion@kernel.org> writes:
>
...
> I'm not a powerpc expert but shouldn't be used regs->gpr[3] via a
> regs_return_value() in system_call_exception() ?

Yes I agree.

> notrace long system_call_exception(struct pt_regs *regs, unsigned long r0)
> {
> ...
> r0 = do_syscall_trace_enter(regs);
> if (unlikely(r0 >= NR_syscalls))
> return regs->gpr[3];

This is the case where we're expecting the r3 value to be a negative
error code, to match the in-kernel semantics. But after this change it
would be a positive error value. It is probably harmless with the
current code structure, but that's just luck.

cheers