On Wed, Nov 18, 2026 at 02:07:02PM +0100, Renzo Davoli wrote:
> On Wed, Nov 18, 2026 at 12:42:32PM +0100, Michal Suchánek wrote:
> > from a user point of view it is not clear to me why this would be done
> > at the seccomp event when seccomp is not used.
>  
> Hi Michal,
>  
> thank you for the review.
>  
> You are right, and the cover letter does not explain it (only patch 2
> does, briefly). The series is limited to the PTRACE_EVENT_SECCOMP stop
> because that is the only stop where a syscall can currently be skipped
> with a preset return value in an architecture independent way: the
> tracer's request goes through the same path as SECCOMP_RET_ERRNO,
> which every architecture already handles.
> 
> At the syscall entry stop this depends on the architecture's entry
> code. On some architectures (e.g. MIPS) the entry path overwrites the
> return value with -ENOSYS when the syscall is skipped, so the value set
> by the tracer is lost. A tracer that does not otherwise use seccomp
> has to install a SECCOMP_RET_TRACE filter to use this feature.
> 
> > On s390 the removal of such architecture-specific flag is proposed here:
> > [...]
> > While that shows a way to address this problem not all affected
> > architectures implement it.
> 
> Thanks for the pointer. With 05c033db7e9a ("entry, treewide: Make
> syscall_enter_from_user_mode[_work]() indicate syscall execution") and
> Heiko's s390 fix, the architectures using the generic entry code
> preset -ENOSYS and leave the return value alone when the syscall is
> skipped, so skipping at the entry stop could be supported there. As
> in patch 1, a per-task flag checked right after the ptrace entry
> report could be used, so that it does not depend on the syscall
> number.

As I understand it the new s390 code resolves the problem by storing the
syscall number outside of the registers. Then the return value can be
set directly. It does not depend on using the generic entry but on the
architecture adding storage for the syscall number in struct pt_regs,
and implementing the code to determine where to get/set the syscall
value depending on the syscall stage.

However, it seems that extending struct pt_regs breaks userspace ABI
(probably because kernel refuses to transfer partial pt_regs to/fom
userspace) which makes it unclear how the int_code that is used by this
new code could be added to the s390 struct pt_regs in the first place.

Thanks

Michal

Reply via email to