aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2008-12-25 07:37:58 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2008-12-25 07:38:07 -0500
commit8f2961c39eacd5d450048d8a3e91675486f3a015 (patch)
tree12dd0a12f2882fa5524f140fd92631ff7c1242fb /arch/s390
parent5439050f9f1aa92381ab9beccbea6ddf0c687c2b (diff)
[S390] audit: get s390 ret_from_fork in sync with other architectures
On s390 we have ret_from_fork jump 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 at sysc_return, which is the common part of post-syscall work. And does not include calling audit_syscall_exit() - that's done in the end of sysc_tracesys path, just before that path jumps to sysc_return. IOW, the child returning from fork()/clone()/vfork() doesn't call audit_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_fork go to the point just past the call of sys_.... 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_exit which is precisely what we need - check the flag, bugger off to sysc_return if not set, otherwise call do_syscall_trace_exit() and bugger off to sysc_return. r9 has just been properly set by ret_from_fork itself, so we are fine. Tested on s390x, seems to work fine. WARNING: it's been about 16 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... [1] that *was* in another country and besides, the box is dead... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/kernel/entry.S2
-rw-r--r--arch/s390/kernel/entry64.S2
2 files changed, 2 insertions, 2 deletions
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 198ea18a534d..c1cfc7e39ec9 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -436,7 +436,7 @@ ret_from_fork:
436 basr %r14,%r1 436 basr %r14,%r1
437 TRACE_IRQS_ON 437 TRACE_IRQS_ON
438 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts 438 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts
439 b BASED(sysc_return) 439 b BASED(sysc_tracenogo)
440 440
441# 441#
442# kernel_execve function needs to deal with pt_regs that is not 442# kernel_execve function needs to deal with pt_regs that is not
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 89c121ae6339..ea90d9a676f8 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -417,7 +417,7 @@ ret_from_fork:
4170: brasl %r14,schedule_tail 4170: brasl %r14,schedule_tail
418 TRACE_IRQS_ON 418 TRACE_IRQS_ON
419 stosm 24(%r15),0x03 # reenable interrupts 419 stosm 24(%r15),0x03 # reenable interrupts
420 j sysc_return 420 j sysc_tracenogo
421 421
422# 422#
423# kernel_execve function needs to deal with pt_regs that is not 423# kernel_execve function needs to deal with pt_regs that is not