This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] [BZ #18433] Check file access/existence before forking.
- From: Alexander Monakov <amonakov at ispras dot ru>
- To: Szabolcs Nagy <szabolcs dot nagy at arm dot com>
- Cc: Carlos O'Donell <carlos at redhat dot com>, navid Rahimi <rahimi dot nv at gmail dot com>, Phil Blundell <pb at pbcl dot net>, "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>
- Date: Fri, 18 Sep 2015 19:48:53 +0300 (MSK)
- Subject: Re: [PATCH] [BZ #18433] Check file access/existence before forking.
- Authentication-results: sourceware.org; auth=none
- References: <55F19819 dot 3010601 at gmail dot com> <55F19B66 dot 9050001 at arm dot com> <55F19C50 dot 3010502 at gmail dot com> <1441909606 dot 2948 dot 25 dot camel at pbcl dot net> <CAOUBrm2Kjbk3q+QJACYG24=p1dz60JXimxYG3oRRz2ehpocwkQ at mail dot gmail dot com> <55F299F4 dot 6030907 at arm dot com> <55FC235E dot 6030608 at redhat dot com> <55FC27CB dot 6070602 at arm dot com> <alpine dot LNX dot 2 dot 20 dot 1509181813120 dot 15988 at monopod dot intra dot ispras dot ru> <55FC2EA1 dot 7070001 at arm dot com>
> > The same argument applies to setjmp, and the solution in GCC is the
> > same for both: GCC internally recognizes vfork, setjmp, and a few other
> > functions as functions that "return twice".
> >
> > (after all, if it was broken like you describe, one would expect to witness
> > such breakage in practice, for instance with GNU Make prior to 4.0)
> >
>
> that's surprising: setjmp is standard c
> and it is a macro so it cannot be called
> through a function pointer.. this is not
> true for vfork so it's not clear why gcc
> recognizes it.
Because a minor change to GCC (extending setjmp treatment to vfork) is overall
a more acceptable compromise than demanding fixes to every vfork-in-C usage?
(I can see your argument in a way that an abstract C compiler cannot be
required to treat vfork specially, unlike setjmp; but fwiw, not only GCC, but
Clang and cparser also appear to treat vfork similar to setjmp)
Alexander