This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH] abort: Only flush file-based stdio streams before termination
On 08/21/2017 09:23 AM, Andreas Schwab wrote:
> On Aug 17 2017, Florian Weimer <email@example.com> wrote:
>> In your opinion, should we remove the flushing altogether?
> Yes. abort must be thread-safe, and there is no way to do flushing
> without locking.
In the current implementation, yes.
Carlos, do you still think we must continue to flush on abort?
I'm concerned that the current is state (the abort mechanism can be
abused for code execution) is desired by no one, and a squabble over the
ideal behavior of a from-scratch stdio prevents us from applying
incremental improvements to the code we have today.
>> We still have a similar problem during regular process termination, though.
> _IO_cleanup must do locking as well, of course.
That means that a process cannot terminate if flockfile on a stream has
been called without a matching funlockfile. I don't think this is
permitted by POSIX, and wouldn't be a desirable implementation, either.
In a hypothetical, from-scratch stdio implementation, it should be
possible to implement flush-once without locking, but it requires
careful ordering of buffer pointer updates (or two locks instead of one).