This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] [BZ #18433] Check file access/existence before forking.


On 09/18/2015 11:03 AM, Szabolcs Nagy wrote:
> On 18/09/15 15:44, Carlos O'Donell wrote:
>> Note that it is possible to use vfork in certain conditions,
>> and we do in glibc. So one should not entirely dismiss vfork,
>> but that's slightly off topic.
> 
> are you sure?
> 
> i think all use of vfork is invalid c: the compiler can
> spill registers on the stack then in the child clobber
> them, then after vfork returns in the parent the
> clobbered registers are restored breaking the expectations
> of the compiler. (this can break independently of how
> the c code around vfork looks like).
> 
> i think you have to know the compiler internals or use
> some language extension to make it valid.

The only way I know to make it safe is to create a thread
to handle the vfork state changes, thus you're running
on a distinct stack.

See: http://red.ht/1NI34eT

Cheers,
Carlos.
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]