is fork() supported?

Florian Weimer fweimer@redhat.com
Thu Aug 5 08:27:15 GMT 2021


* Andrew Haley via Libffi-discuss:

> On 8/4/21 9:00 PM, DJ Delorie via Libffi-discuss wrote:
>> I don't mean fork/exec (duh) but a fork() and keep going...
>> 
>> Consider a case where a process is using a file-backed mapping for
>> closures; a fork() doesn't isolate that backing between parent/child
>> so there's a chance (for example) the parent could deallocate a
>> closure that the child needs, etc...
>> 
>> I see four options...
>> 
>> 1. Not supported.  Sorry.
>> 
>> 2. Supported only if you have fork-able closure backings (mmap or
>>    maybe ktmpfile, but not file-backed) but this means documenting
>>    that (at least) selinux settings might affect this.  Caveat
>>    Programmer.
>> 
>> 3. Some API that says "I need this" so it can fail in a more useful
>>    way than "segfault".
>> 
>> 4. Fully supported, and we have some work to do to handle fork events.
>
> The bug that will never die.
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1249685
> https://bugzilla.redhat.com/show_bug.cgi?id=531233
> https://bugzilla.redhat.com/show_bug.cgi?id=772657

Well, there are two ways to fix it: Avoid the need for alias mappings by
switching to static trampolines, or create new alias mappings upon fork.
(A third option would be kernel support for private alias mappings.  A
fourth, get some form of explicit JIT support for SELinux.)

Thanks,
Florian



More information about the Libffi-discuss mailing list