This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] posix: Fix improper assert in Linux posix_spawn (BZ#22273)
- From: Florian Weimer <fw at deneb dot enyo dot de>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- Cc: libc-alpha at sourceware dot org
- Date: Thu, 12 Oct 2017 20:49:53 +0200
- Subject: Re: [PATCH] posix: Fix improper assert in Linux posix_spawn (BZ#22273)
- Authentication-results: sourceware.org; auth=none
- References: <1507833562-6945-1-git-send-email-adhemerval.zanella@linaro.org>
* Adhemerval Zanella:
> As suggested by Andreas Schwab, this patch removes the faulty assert
> and also handles any signal that happens before fork and execve as the
> spawn was successful (and thus relaying the handling to the caller to
> figure this out). Different than Florian, I can not see why using
> atomics to set err would help here, essentially the code runs
> sequentially (due CLONE_VFORK) and I think it would not be legal the
> compiler evaluate ec without checking for new_pid result (thus there
> is no need to compiler barrier).
I thought you'd need to guard against reordering in the child. Since
the err member is the only thing that is written and the syscalls in
the child act as compiler barriers (so that the store cannot float to
the beginning of the function), this is not actually an issue here.