Re: [patch] avoid inheritance of file descriptors

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

 



I demand that Deti Fliegl may or may not have written...

> Anssi Hannula wrote:
>> Deti Fliegl wrote:
>>> Klaus Schmidinger wrote:
>>>> Doesn't SystemExec() (see tools.c) take care of this?
>>> Yes you are right - it takes care internally but not for plugins like 
>>> dvdswitch etc. In order to fix this problem you could patch every single 
>>> plugin or just set the right file descriptor flag once. I think the 
>>> latter does not cause any interference and should solves some issues.
>> For the record, the latter creates a small race condition: an external
>> program could be launched before FD_CLOEXEC is set on an fd.

> In VDR all file descriptors seem to be allocated at startup. IMHO it is 
> not very likely that a race condition could happen.

>From open(2):

  O_CLOEXEC (Since Linux 2.6.23)
        Enable the close-on-exec  flag  for  the  new  file  descriptor.
        Specifying  this  flag  permits a program to avoid an additional
        fcntl(2) F_SETFD operation to set the  FD_CLOEXEC  flag.   Addi-
        tionally,  use  of  this flag is essential in some multithreaded
        programs since using a separate fcntl(2)  F_SETFD  operation  to
        set  the  FD_CLOEXEC  flag does not suffice to avoid race condi-
        tions where one thread opens a file descriptor at the same  time
        as another thread does a fork(2) plus execve(2).

No use *now*, I know - too many people not yet using a new-enough kernel...

-- 
| Darren Salt    | linux or ds at              | nr. Ashington, | Toon
| RISC OS, Linux | youmustbejoking,demon,co,uk | Northumberland | Army
|   Kill all extremists!

Vote Anarchist.

_______________________________________________
vdr mailing list
vdr@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux