[PATCH v2 1/7] powerpc: properly negate error in syscall_set_return_value()
Dmitry V. Levin
ldv at strace.io
Fri Jan 24 09:35:34 AEDT 2025
On Thu, Jan 23, 2025 at 11:07:21PM +0100, Christophe Leroy wrote:
[...]
> To add a bit more to the confusion, a task can be flagged with
> TIF_NOERROR by calling force_successful_syscall_return(), in which case
> even if gpr[3] contains a negative between -MAX_ERRNO and -1 the syscall
> will be handled as successfull hence CCR[SO] won't be set. But it seems
> this is not handled by syscall_set_return_value(). So what will happen
> with time() when approaching year 2036 for instance ?
syscall_set_return_value() takes both "int error" and "long val"
arguments. It doesn't and shouldn't take TIF_NOERROR into account.
With my patch applied, when it's called by PTRACE_SET_SYSCALL_INFO
from do_syscall_trace_leave(), it will properly update gpr[3] and ccr
regardless of TIF_NOERROR. If tracer wants to set an error status for
a syscall that cannot return an error, it's up to the tracer to face the
consequences. Tracers can do it now via PTRACE_SETREGS* anyway.
--
ldv
More information about the Linuxppc-dev
mailing list