[prev in list] [next in list] [prev in thread] [next in thread] 

List:       dragonfly-commits
Subject:    git: kernel: Implement O_CLOEXEC
From:       Francois Tigeot <ftigeot () crater ! dragonflybsd ! org>
Date:       2012-07-31 7:26:43
Message-ID: 201207310726.q6V7Qhv0043619 () crater ! dragonflybsd ! org
[Download RAW message or body]


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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic