DragonFly BSD
DragonFly commits List (threaded) for 2012-07
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

git: kernel: Implement O_CLOEXEC


From: Francois Tigeot <ftigeot@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 31 Jul 2012 00:26:43 -0700 (PDT)

commit 6e4ea98e8a4f403762582bd657180d3bd3636505
Author: François Tigeot <ftigeot@wolfpond.org>
Date:   Mon Jul 30 22:39:46 2012 +0200

    kernel: Implement O_CLOEXEC
    
    * Using fcntl(2) just after open(2) is not enough to avoid race conditions
      in programs doing fork+exec sequences. Child processes may be created
      before fcntl() is run and inherit the parent's file descriptors.
    
    * In some circonstances this behavior may even create security issues.
    
    * O_CLOEXEC can be used to atomically set the close-on-exec flag for new
      file descriptors, avoiding the whole mess in the first place.
    
    * Fixes issue #2356
    
    Inspired-from: NetBSD

Summary of changes:
 lib/libc/sys/open.2     |   18 +++++++++++++++---
 sys/kern/vfs_syscalls.c |   12 ++++++++----
 sys/sys/fcntl.h         |    3 +++
 3 files changed, 26 insertions(+), 7 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/6e4ea98e8a4f403762582bd657180d3bd3636505


-- 
DragonFly BSD source repository



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]