From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 90636 invoked by alias); 8 Nov 2016 20:11:53 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 90620 invoked by uid 89); 8 Nov 2016 20:11:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.7 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=pid_t, forkc, vdso, getpid X-HELO: albireo.enyo.de From: Florian Weimer To: Adhemerval Zanella Cc: libc-alpha@sourceware.org Subject: Re: [PATCH] Remove cached PID/TID in clone References: <1476387924-4509-1-git-send-email-adhemerval.zanella@linaro.org> Date: Tue, 08 Nov 2016 20:11:00 -0000 In-Reply-To: (Adhemerval Zanella's message of "Tue, 8 Nov 2016 17:58:38 -0200") Message-ID: <878tstu3yc.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2016-11/txt/msg00283.txt.bz2 * Adhemerval Zanella: >> It's a hotspot for incorrect/broken fork detection. > > If you mean the assert on fork.c, I review the code and it seems > unnecessary to remove the assert on child creation: No, something else entirely. OpenSSL mixes the current PID into the randomness pool, in an attempt to make sure that the streams generated by parent and child are different: pid_t curr_pid =3D getpid(); =E2=80=A6 if (curr_pid) { /* just in the first iteration to save time= */ if (!MD_Update(m, (unsigned char *)&curr_pid, sizeof curr_pid)) goto err; curr_pid =3D 0; } This happens at every invocation of RAND_bytes. It may show up in profiles if all the other system calls (time, gettimeofday etc.) are handled by the vDSO. But I suggest that this shouldn't block your change. It's just something we should be aware of. If the kernel provides a more efficient way to get the PID, we can change glibc to use it. More comments about your revised patch tomorrow.