From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2722 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] Add support for mkostemp, mkstemps and mkostemps Date: Sat, 2 Feb 2013 23:22:33 +0100 Message-ID: <20130202222233.GN6181@port70.net> References: <1359830731-24717-1-git-send-email-basile@opensource.dyc.edu> <20130202201429.GL6181@port70.net> <510D7953.50308@opensource.dyc.edu> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1359843763 14705 80.91.229.3 (2 Feb 2013 22:22:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 2 Feb 2013 22:22:43 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2723-gllmg-musl=m.gmane.org@lists.openwall.com Sat Feb 02 23:23:04 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1U1lUF-000676-Ce for gllmg-musl@plane.gmane.org; Sat, 02 Feb 2013 23:23:03 +0100 Original-Received: (qmail 3425 invoked by uid 550); 2 Feb 2013 22:22:45 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 3417 invoked from network); 2 Feb 2013 22:22:45 -0000 Content-Disposition: inline In-Reply-To: <510D7953.50308@opensource.dyc.edu> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:2722 Archived-At: * Anthony G. Basile [2013-02-02 15:38:43 -0500]: > 2. This is from uclibc. Clearly, static is critical here, but still > they never initialize a value of 'value' on first entry into the > function, so that memory is dirty to start. Mine is worse, but I > wonder if this is still a bug there. > > static void brain_damaged_fillrand(unsigned char *buf, unsigned int len) > { > ... > static uint64_t value; > gettimeofday(&tv, NULL); > value += ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec ^ getpid(); > ... static variables are always initialized to 0 they use static so every call to that function uses some entropy from the previous call (in multithreaded code it may not work that way) > 3. I retested your address approach. I like it but it only maps to > upper and lower case letters, no numbers which uclibc and glibc do. yes i used 6*5 bit for the names, which makes sense: r is 32bits usually (ie. that code can generate 2^30 different names) uclibc/glibc can generate 62^6 names (about 2^36) which is a bit more but by not much > clock_gettime(CLOCK_REALTIME, &ts); > r = ts.tv_nsec*65537 ^ (uintptr_t)&ts / 16 + (uintptr_t)template; > for (i=0; i<6; i++, r>>=5) > template[i] = 'A'+(r&15)+(r&16)*2; >