Comment 4 for bug 329489

Revision history for this message
Domas Mituzas (domas-mituzas) wrote : Re: frequent fcntl()s leak memory in apparmor

testcase:
#include <fcntl.h>
#include <stdio.h>

main() {

int fd = open("/tmp/.lockfile", O_RDWR|O_CREAT);
unlink("/tmp/.lockfile");

fork();
fork();
fork();
fork();

while(1) {
 struct flock lock;
 lock.l_type=F_WRLCK;
 lock.l_start=0;
 lock.l_whence=SEEK_END;
 lock.l_len=0;
 fcntl(fd,F_SETLKW,&lock);
 lock.l_type=F_UNLCK;
 fcntl(fd,F_SETLKW,&lock);
}

}

Profile:
# Last Modified: Fri Dec 5 13:59:51 2008
#include <tunables/global>
/usr/local/sbin/domasaatest flags=(audit) {
  #include <abstractions/base>
  #include <abstractions/mysql>
  #include <abstractions/nameservice>

  capability kill,
  capability net_bind_service,
  capability setgid,
  capability setuid,

  # Major libs
  /lib/ld-*.so mr,
  /lib/libc-*.so mr,
  /lib/libpthread-*.so mr,
  /lib/librt-*.so mr,

  /tmp/* rwk,

}