Date: Sat, 29 Aug 2015 21:27:42 +0200 From: Jilles Tjoelker <jilles@stack.nl> To: Konstantin Belousov <kostikbel@gmail.com> Cc: Michiel Boland <boland37@xs4all.nl>, Mark Martinec <Mark.Martinec+freebsd@ijs.si>, freebsd-stable@freebsd.org Subject: Re: Latest stable (r287104) bash leaves zombies on exit Message-ID: <20150829192742.GA48807@stack.nl> In-Reply-To: <20150829134130.GC2072@kib.kiev.ua> References: <63a84f64baf8768a551fc6464e8e9526@mailbox.ijs.si> <20150827162602.GJ2072@kib.kiev.ua> <55DF5C95.90502@xs4all.nl> <20150827201644.GO2072@kib.kiev.ua> <55DFFADB.2080003@xs4all.nl> <20150828100118.GR2072@kib.kiev.ua> <55E083CA.2050705@xs4all.nl> <20150828161847.GX2072@kib.kiev.ua> <20150829130138.GA41321@stack.nl> <20150829134130.GC2072@kib.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Aug 29, 2015 at 04:41:30PM +0300, Konstantin Belousov wrote: > On Sat, Aug 29, 2015 at 03:01:38PM +0200, Jilles Tjoelker wrote: > > Looks good to me, except that I think a vforked child (in system() and > > posix_spawn*()) should use the system calls and not libthr's wrappers. > > This reduces the probability of weird things happening between vfork and > > exec, and also avoids an unexpected error when > > posix_spawnattr_setsigdefault()'s mask contains SIGTHR. > Thank you for the review, I agree with the note about vfork. Updated > patch is below. Also, I removed the PIC_PROLOGUE from the i386 setjmp, > it has no use after the plt calls are removed. > [snip] > diff --git a/lib/libc/gen/posix_spawn.c b/lib/libc/gen/posix_spawn.c > index e3124b2..673c760 100644 > --- a/lib/libc/gen/posix_spawn.c > +++ b/lib/libc/gen/posix_spawn.c > @@ -118,15 +118,18 @@ process_spawnattr(const posix_spawnattr_t sa) > return (errno); > } > > - /* Set signal masks/defaults */ > + /* > + * Set signal masks/defaults. > + * Use unwrapped syscall, libthr is in undefined state after vfork(). > + */ > if (sa->sa_flags & POSIX_SPAWN_SETSIGMASK) { > - _sigprocmask(SIG_SETMASK, &sa->sa_sigmask, NULL); > + __libc_sigprocmask(SIG_SETMASK, &sa->sa_sigmask, NULL); > } > > if (sa->sa_flags & POSIX_SPAWN_SETSIGDEF) { > for (i = 1; i <= _SIG_MAXSIG; i++) { > if (sigismember(&sa->sa_sigdefault, i)) > - if (_sigaction(i, &sigact, NULL) != 0) > + if (__libc_sigaction(i, &sigact, NULL) != 0) > return (errno); > } > } Hmm, the comments say direct syscalls are being used, but in fact libthr's interposer is called. The change to system() does correctly use __sys_sigprocmask(). -- Jilles Tjoelker
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150829192742.GA48807>