From patchwork Thu Jul 25 14:25:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 169720 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp11718735ilk; Thu, 25 Jul 2019 07:26:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqyG0eWrD6+gfILlveMunt16eXDwqvpHwSfRp2PJnIcA823+EPgGtKCsetSDKn4vuZPPZvGd X-Received: by 2002:a17:90a:360c:: with SMTP id s12mr94460000pjb.30.1564064766754; Thu, 25 Jul 2019 07:26:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564064766; cv=none; d=google.com; s=arc-20160816; b=cKbLRNkF3RTkt9NJIqdK7FfoTnckYh7latcCeGeUJAzsFVONJiP6IN/52ASP85Q23Q zxVyqBXxUKIAGIkjrmwYOymoLo+A7l2GYYuqV5uGarqTlvMr+eBX65Zey8Z7t3SgWbZi yJi6SkNfGZvNkhbNNYQH1Cc5Mn71zdYkBi7NMzyKn8udxjEu/MUB8bJYu+ChgLqL7xG5 S1891vH9HVDzgkMs5WCRLFIyrIkOAxH/ntiJ9PtK2rIpu535ubIW9HFVqP5nGAbGkNKI BGKstq5SrnPbYOh2r9RYG6PAs0mIBXBtgMp7JcI1w/mJOxfWC+YOh7TePvtugWDl9oz1 +IbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:to:from:dkim-signature:delivered-to:sender :list-help:list-post:list-archive:list-subscribe:list-unsubscribe :list-id:precedence:mailing-list:dkim-signature:domainkey-signature; bh=3ROUO9mMtVPgBIzFRR3U9NMdNPaA4JZaGyKTe6Dsg7M=; b=wezQ9WTsSZSFBo+xsIpqHpWsPZKcb8aIlO3k6p7cnMAEEz8jnZBJy0/3HkLdyqr5S+ eb6HA+zwcMjHXSyQ1U6ctXa1KnHEdhGshLRZEJvSWxn8td6x5Cd4LGAizTmRTk+JCoky kU98u+QzOnvLxLGjNIsaVuRnNtEcHjbD6K/22Kql/gx1zk3m36UTyBxaVpbAxBwjd0he vrdzpe4hs+b9gAxghiNVSqdEpE2XNjaEibH90n3z1CcDtx9/QYmqugXmV3T5+ACF9A3y iPd3xZ/lSejPDO3VyFj6AIL57wC77ZNY7crdtMWbpZOtNaCI84qo+RrmFp3bjZbPN8Xy wzGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=n6n5ZXO0; dkim=pass header.i=@linaro.org header.s=google header.b="u/HwgfFe"; spf=pass (google.com: domain of libc-alpha-return-103951-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-103951-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id m68si21708558pfb.75.2019.07.25.07.26.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jul 2019 07:26:06 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-103951-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=n6n5ZXO0; dkim=pass header.i=@linaro.org header.s=google header.b="u/HwgfFe"; spf=pass (google.com: domain of libc-alpha-return-103951-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-103951-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; q=dns; s= default; b=fHE0lTVI0jrWfEdY5nyWu9duj+brejDCob2YjsCuajzkOSKwA6PbC zt5ppmnGkpl5CR1XDU5ciPAVpIUppAzNwPcapP/N6f+5odllXHI0QfUZxi6Ewkm0 Cngpt/gxiuQlivQSR3BB0Xa7l/3zB5exLht7FnAG5B24UBClLYSDFs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; s=default; bh=6tZnHpVCzjOsP5tgR/8UruMp6yw=; b=n6n5ZXO0enL+ru8jMMWr1eyiaZkl B56szFozoFaOPk7wl9/keD0aHueWEgtafPABjb4cGsL+TGbewM+7hd2LyjEC2rbc Sc+2T/2Q0Di2ysGgMSrVZhvfZ+RDhFYnVj8RDFV8UzOt/22f8Lu64Ud9yNEUPive hWG6yx1qMNPJits= Received: (qmail 90231 invoked by alias); 25 Jul 2019 14:25:58 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 90222 invoked by uid 89); 25 Jul 2019 14:25:58 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=1867 X-HELO: mail-qk1-f194.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id; bh=3ROUO9mMtVPgBIzFRR3U9NMdNPaA4JZaGyKTe6Dsg7M=; b=u/HwgfFecdhnubWH0/v8b/TxBkacoYzQm0zhGhh8T2kGw4pdsT0uK61CtyKbw9mIKl gYjVzi3GhKQIznK85s1AS9RDtTUjo3tLMQ2oD2yCHcifxbS0IxHLfKLa3km/hGFoLkYN Ib3uGqG8sbSUzW13yc5lwF25wWysTWO6sCbNzsjMgD/s4A1aq+CqhSwFnOY6Xcq4ec7W S7oRkdU9RmdP2SA0J7NvR/FJwYDqenzfulilnO8XLA2MDBkeLtTg8mQgj9D/W5qcRnNU 7QR6cGQ6T3adv6btbEpXVxIwNnBFDa+CLScMNmMH7VfGL3tzY6T6vqhbiaP2itgHMACO 8ZYA== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH] Get new entropy on each attempt __gen_tempname (BZ #15813) Date: Thu, 25 Jul 2019 11:25:50 -0300 Message-Id: <20190725142550.18479-1-adhemerval.zanella@linaro.org> This is missing bit for fully fix BZ#15813 (the other two were fixed by 359653aaacad463). Checked on x86_64-linux-gnu. [BZ #15813] sysdeps/posix/tempname.c (__gen_tempname): get entrypy on each attempt. --- sysdeps/posix/tempname.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) -- 2.17.1 diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c index de346949b2..e930211703 100644 --- a/sysdeps/posix/tempname.c +++ b/sysdeps/posix/tempname.c @@ -186,7 +186,6 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind) { int len; char *XXXXXX; - uint64_t value; unsigned int count; int fd = -1; int save_errno = errno; @@ -218,13 +217,13 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind) /* This is where the Xs start. */ XXXXXX = &tmpl[len - 6 - suffixlen]; - /* Get some more or less random data. */ - RANDOM_BITS (value); - value ^= (uint64_t)__getpid () << 32; - - for (count = 0; count < attempts; value += 7777, ++count) + uint64_t pid = (uint64_t)__getpid () << 32; + for (count = 0; count < attempts; ++count) { - uint64_t v = value; + uint64_t v; + /* Get some more or less random data. */ + RANDOM_BITS (v); + v ^= pid; /* Fill in the random bits. */ XXXXXX[0] = letters[v % 62];