public inbox for linux-audit@redhat.com
 help / color / mirror / Atom feed
* clone flags
@ 2007-07-19 13:24 John D. Ramsdell
  2007-07-19 17:59 ` Eric Paris
  0 siblings, 1 reply; 10+ messages in thread
From: John D. Ramsdell @ 2007-07-19 13:24 UTC (permalink / raw)
  To: linux-audit

I've been carefully comparing output I obtain with autrace with what I
get from strace.  It appears they differ when the clone system call is
invoked from the C library via fork.  In particular, strace reports
flags of CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, while
autrace says the flags are 0.  The flags are in field a2.

John

[ramsdell@goo fork]$ uname -r
2.6.21-1.3228.fc7
[ramsdell@goo fork]$ make fork
cc     fork.c   -o fork
[ramsdell@goo fork]$ strace -o strace.txt ./fork
[ramsdell@goo fork]$ su -
Password: 
[root@goo ~]# cd /home/ramsdell/proj/fork
[root@goo fork]# autrace ./fork
Waiting to execute: ./fork
Cleaning up...
Trace complete. You can locate the records with 'ausearch -i -p 1160'
[root@goo fork]# ausearch -i -p 1160 > autrace.txt
[root@goo fork]# grep clone strace.txt 
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7efb708) = 1122
[root@goo fork]# grep clone autrace.txt 
type=SYSCALL msg=audit(07/19/2007 09:16:02.350:848) : arch=i386 syscall=clone success=yes exit=1161 a0=1200011 a1=0 a2=0 a3=0 items=0 ppid=1158 pid=1160 auid=ramsdell uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=pts2 comm=fork exe=/home/ramsdell/proj/fork/fork subj=user_u:system_r:unconfined_t:s0 key=(null) 
[root@goo fork]# cat fork.c 
#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>

int main(int argc, char **argv)
{
  int status;
  pid_t pid;
  switch (fork()) {
  case -1:
    perror("clone");
    return 1;
  case 0:
    return 0;
  default:
    do {
      pid = wait(&status);
    } while (pid < 0 && errno == EINTR);
    if (WIFEXITED(status))
      return WEXITSTATUS(status);
    else
      return 1;
  }
}
[root@goo fork]# 

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-07-25 11:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-19 13:24 clone flags John D. Ramsdell
2007-07-19 17:59 ` Eric Paris
2007-07-19 18:45   ` John D. Ramsdell
2007-07-19 19:37     ` Eric Paris
2007-07-19 19:42       ` John D. Ramsdell
2007-07-20 11:07       ` John D. Ramsdell
2007-07-23 11:44         ` Clone and fcntl64 flags patch John D. Ramsdell
2007-07-23 13:40           ` John D. Ramsdell
2007-07-24 21:36           ` Steve Grubb
2007-07-25 11:49             ` John D. Ramsdell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox