On Wed, 13 Jan 2016, John Spencer wrote:
> hello libc hackers,
> 
> the following ISO C conforming program is broken on latest OpenBSD:
> 
> #include <stdio.h>
> int close() { puts("XXX"); return 0;}
> int main() { fclose(stdout); return 0;}
> 
> the program is expected to not produce any output, however on OpenBSD it
> prints "XXX".
> this bug affects real-world programs [0].

Yeah, I've been working on this for years and while it's much closer to 
being fixed, my last diff (before my current time crunch) still had 
various issues.


> the attached patch is incomplete, since i cannot find the definition of
> close() in the OpenBSD source tree.

That diff changes the cancellation behavior of fclose().  Even if that 
might be considered okay (it's implementation defined in the standard), 
that _technique_ can't be directly applied to some other syscalls where 
cancellation is required by something wrapping the syscall.

(The syscall stubs are in ASM, c.f. libc/sys/Makefile.inc and libc/arch/*)


Philip Guenther

Reply via email to