From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B18553857818; Wed, 9 Sep 2020 09:37:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B18553857818 From: "jakub at redhat dot com" To: glibc-bugs@sourceware.org Subject: [Bug libc/15813] Multiple issues in __gen_tempname Date: Wed, 09 Sep 2020 09:37:51 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: jakub at redhat dot com X-Bugzilla-Status: REOPENED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: adhemerval.zanella at linaro dot org X-Bugzilla-Target-Milestone: 2.31 X-Bugzilla-Flags: security? X-Bugzilla-Changed-Fields: bug_status resolution cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: glibc-bugs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-bugs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Sep 2020 09:37:51 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D15813 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED |--- CC| |jakub at redhat dot com --- Comment #6 from Jakub Jelinek --- (In reply to cvs-commit@gcc.gnu.org from comment #4) > The master branch has been updated by Adhemerval Zanella > : >=20 > https://sourceware.org/git/gitweb.cgi?p=3Dglibc.git; > h=3De1df30fbc2e2167a982c0e77a7ebee28f4dd0800 >=20 > commit e1df30fbc2e2167a982c0e77a7ebee28f4dd0800 > Author: Adhemerval Zanella > Date: Thu Jul 25 11:22:17 2019 -0300 >=20 > Get new entropy on each attempt __gen_tempname (BZ #15813) >=20=20=20=20=20 > This is missing bit for fully fix BZ#15813 (the other two were fixed > by 359653aaacad463). >=20=20=20=20=20 > Checked on x86_64-linux-gnu. >=20=20=20=20=20 > [BZ #15813] > sysdeps/posix/tempname.c (__gen_tempname): get entrypy on each > attempt. This change is completely broken. As random_bits is defined as: static inline uint32_t random_bits (void) { struct __timespec64 tv; __clock_gettime64 (CLOCK_MONOTONIC, &tv); /* Shuffle the lower bits to minimize the clock bias. */ uint32_t ret =3D tv.tv_nsec ^ tv.tv_sec; ret ^=3D (ret << 24) | (ret >> 8); return ret; } on a fast machine instead of making sure that in the loop the value is even more random it makes sure that each attempt uses the exact same value, whic= h it knows from the earlier attempt that it exists already. So, either it needs to ensure the entropy source is not imprecise time base= d, or it needs e.g. add to the initial value in each iteration rather than use= the same value. --=20 You are receiving this mail because: You are on the CC list for the bug.=