NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-m68k/50386: O2-level optimization of gcc 4.8.4/4.8.5 broken on m68k



The following reply was made to PR port-m68k/50386; it has been noted by GNATS.

From: Rin Okuyama <okuyama%flex.phys.tohoku.ac.jp@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: port-m68k/50386: O2-level optimization of gcc 4.8.4/4.8.5 broken
 on m68k
Date: Sat, 7 Nov 2015 17:04:40 +0900

 I've found that arc4random.o is broken with -O2 flag. A child process of
 xterm(1) becomes a zombie through following scenario.
 
 xterm(1) creates a temporary directory by mkdtemp(3), which calls
 arc4random_uniform(3) internally. As arc4random.o is broken, the caller
 receives a bogus file name. You can confirm this by looking at /var/tmp
 or $TMPDIR after killing xterm(1).
 
 Moreover, arc4random_uniform(3) registers fork handlers by
 pthread_atfork(3). A child process of xterm(1), therefore, calls the
 broken handler to become a zombie.
 
 I've confirmed this scenario with the use of gdb(1). Actually, xterm(1)
 works fine with libc built with the attached patch, by that only
 arc4random.c is compiled with -O1 flag.
 
 At this moment, I've not understood conditions by which arc4random*(3)
 becomes strange. For example, mktemp(1) seems to work fine even with
 broken libc. However, at least, xterm(1) never works with it.
 
 --- src/lib/libc/gen/Makefile.inc.orig	2015-11-07 15:15:29.000000000 +0900
 +++ src/lib/libc/gen/Makefile.inc	2015-11-07 15:25:18.000000000 +0900
 @@ -199,3 +199,8 @@
  	${TOOL_AWK} -f ${.ALLSRC} > ${.TARGET}
  
  CLEANFILES+= errlist.c
 +
 +.if ${MACHINE_ARCH} == "m68k"
 +# XXX work around a gcc 4.8.x bug
 +COPTS.arc4random.c=	-O1
 +.endif
 


Home | Main Index | Thread Index | Old Index