audit: get s390 ret_from_fork in sync with other
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 27 lines · Al Viro
On s390 we have
ret_from_forkjump not to the "do all work we
normally do on return from syscall" as on x86, ppc, etc., but to the "do all such work except audit". Historical reasons - the codepath triggered when we have AUDIT process flag set is separated from the normall one and they converge atsysc_return, which is the common part of post-syscall work. And does not include callingaudit_syscall_exit()- that's done in the end ofsysc_tracesyspath, just before that path jumps tosysc_return.IOW, the child returning from fork()/clone()/vfork() doesn't
callaudit_syscall_exit()at all, so no matter what we do with its audit context, we are not going to see the audit entry.The fix is simple: have
ret_from_forkgo to the point just past
the call ofsys_.... in the 'we have AUDIT flag set' path. There we have (64bit variant; for 31bit the situation is the same):sysc_tracenogo:tm __TI_flags+7(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT) jz sysc_return la %r2,SP_PTREGS(%r15) # load pt_regs larl %r14,sysc_return # return point is sysc_return jg do_syscall_trace_exitwhich is precisely what we need - check the flag, bugger off to
sysc_returnif not set, otherwise calldo_syscall_trace_exit()and bugger off tosysc_return. r9 has just been properly set byret_from_forkitself, so we are fine.
Quoted 4 lines
Tested on s390x, seems to work fine. WARNING: it's been about16 years since my last contact with 3X0 assembler[1], so additional review would be very welcome. I don't think I've managed to screw it up, but...
Your patch looks fine. I added it to Martin's patch queue.
Thanks!