Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > fc11cd6e1c513a17304da94a5390f3cd > files > 3159

kernel-2.6.18-194.11.1.el5.src.rpm

From: Alexander Viro <aviro@redhat.com>
Date: Tue, 11 Nov 2008 22:17:50 -0500
Subject: [s390] missing bits for audit-fork
Message-id: 20081112031720.GG23037@file.rdu.redhat.com
O-Subject: [bz 461831] missing s390 bits for audit-fork
Bugzilla: 461831
RH-Acked-by: Pete Zaitcev <zaitcev@redhat.com>

	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 and r15 have just been properly set by ret_from_fork itself,
so we are fine.

diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index f7bc855..35a1aa1 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -378,7 +378,7 @@ ret_from_fork:
 	basr    %r14,%r1
 	TRACE_IRQS_ON
         stosm   __SF_EMPTY(%r15),0x03     # reenable interrupts
-	b	BASED(sysc_return)
+	b	BASED(sysc_tracenogo)
 
 #
 # clone, fork, vfork, exec and sigreturn need glue,
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 1dbb84f..082b6cd 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -369,7 +369,7 @@ ret_from_fork:
 0:	brasl   %r14,schedule_tail
 	TRACE_IRQS_ON
         stosm   24(%r15),0x03     # reenable interrupts
-	j	sysc_return
+	j	sysc_tracenogo
 
 #
 # clone, fork, vfork, exec and sigreturn need glue,