Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1874321imm; Tue, 22 May 2018 10:42:10 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrNwTvdNYrXXSRjL3qTBoY4y9PbPyvoAwtAyGwkGnApNu7oWgprbTIbhKwc1sLh0tRJgUNZ X-Received: by 2002:a17:902:1004:: with SMTP id b4-v6mr25236054pla.82.1527010930545; Tue, 22 May 2018 10:42:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527010930; cv=none; d=google.com; s=arc-20160816; b=Ey/iNWnxPqhj83KN2g45ogfzNW/4YhMkRxbwey2EUVfQg/WFl/25Ek2E2ZoSltqfKY QyFCECDuH434wlhv64qtLjlVWbmuHgwVazCEvZxDvQUfj8LTocKECCp3Wck1/ak0OIWW KxoS2KtgWIdD5b5+ky7lKpRpVZ1zOTMxFxEXVb2BxeiLgglyL6sX6bwNCh6S+reECkvy INxyi4uCcKn99gWsWOqAiZaWX5v6Q2r41uss1+le5nUTi0ZKNPFJSD/iKmfiAg4u+EC+ ZDwtNqtfaZvmCER9AnJNkghEhEhGiv/f/EPp7pN4YkD8jSiC+vo33hitrypwWKBtr34K phAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfert-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=q5J8OgRCqrZCCkQbHcW112CTH8f4b5K5m7wjAIy1djY=; b=Z6uZPTbZrvXg1TW3/He8aAeV7oeu2y9nwDzVp6WwYO09v8YxLPbltdC8t8+TZo/OhO VBjgXzU0Xg0J8yTwxGKtJZOohUZZ2tKU8m1HQjsNhPcErcSxwqRmlBZKQxmEghI6kxyQ K6uKOD+8okAcSIGH+WkykXcNa/7RgGGItbXbJ7AMwuqnJw8plXdU6mLxwROjvabpmnOb uzfrdgio2vIbDslE/0SrWRHYD89xHPhM2NidRpyDfcqfsBRgVkySECBZbXs3Xt2UoMzb fxoDE1eivz4P1KkeY5Ss2WXZiBBbntohp25URFYmNeM0Wr9ch0UIeNlOc1gO1AODUYwV B6Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PjcjwHPw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 64-v6si269981plk.33.2018.05.22.10.41.55; Tue, 22 May 2018 10:42:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PjcjwHPw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751512AbeEVRli (ORCPT + 99 others); Tue, 22 May 2018 13:41:38 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:32970 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751279AbeEVRlh (ORCPT ); Tue, 22 May 2018 13:41:37 -0400 Received: by mail-wm0-f67.google.com with SMTP id x12-v6so17644252wmc.0 for ; Tue, 22 May 2018 10:41:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfert-encoding; bh=q5J8OgRCqrZCCkQbHcW112CTH8f4b5K5m7wjAIy1djY=; b=PjcjwHPwza9UKlZ/H+SYB5iWuRUB/IPSjNSaUtyrTrFH5v1o0ZIANkSIZ3p/QSsOJG 2FlErDuK5m8cnc/tbYVg6IQ+cWFOBBJJ3yD9PCxtIAiGFfC9jXB03dWeNo0X3gvgc+ys RFpjDTAl/AXL7ofTd6s5Ycf6bNjRTxR4DDwAI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfert-encoding; bh=q5J8OgRCqrZCCkQbHcW112CTH8f4b5K5m7wjAIy1djY=; b=WKXGl5tWKE/o+o4jMB9QlNpMOKtEqm5IeTspwEBp1yxFrFeF7A1Fo7R5qMZ1zHzB/x rwTkUuspTy5ra+drWMvnKgtpXuxLIcpl5VT0x1x+P+8bomDwGUQRKhubyfr8wdqn5iXj PH7mSqFuvS1/gw8gTRFEnS4AFr1RWqtSVPVIIms7xw2Xgjt8Tw/7CGtuijH1RDxm03Dm phBb6v2vycbMZJ+9vKnAVcZC22OOTA6kmL1q6maQn5XmfflKkKDotrquIqJZxnaA9k8e 2gQTQSPtvSwpmM2jKftpGeNaM6RvGTWA+01kZUhdgnvJzkzDUG5YZxFTLEbjOL2dOfYC h6rg== X-Gm-Message-State: ALKqPweXUC4mTa4De338S0/tQ+woD2CfPe/kujCkItHryfsvWSqniatn B+LhbM0PqoV7C88P5oSEnD/SZU48Pp0= X-Received: by 2002:a1c:b884:: with SMTP id i126-v6mr1834512wmf.30.1527010896193; Tue, 22 May 2018 10:41:36 -0700 (PDT) Received: from localhost.localdomain (aig34-1-88-167-228-121.fbx.proxad.net. [88.167.228.121]) by smtp.gmail.com with ESMTPSA id v15-v6sm373342wmf.47.2018.05.22.10.41.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 10:41:35 -0700 (PDT) From: Thierry Escande To: "Tobin C . Harding" , Rasmus Villemoes Cc: linux-kernel@vger.kernel.org Subject: [PATCH] lib/test_printf.c: call wait_for_random_bytes() before plain %p tests Date: Tue, 22 May 2018 19:41:14 +0200 Message-Id: <20180522174114.9197-1-thierry.escande@linaro.org> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset = "utf-8" Content-Transfert-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the test_printf module is loaded before the crng is initialized, the plain 'p' tests will fail because the printed address will not be hashed and the buffer will contain '(ptrval)' instead. This patch adds a call to wait_for_random_bytes() before plain 'p' tests to make sure the crng is initialized. Signed-off-by: Thierry Escande --- lib/test_printf.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/test_printf.c b/lib/test_printf.c index 71ebfa43ad05..839be9385a8a 100644 --- a/lib/test_printf.c +++ b/lib/test_printf.c @@ -260,6 +260,13 @@ plain(void) { int err; + /* + * Make sure crng is ready. Otherwise we get "(ptrval)" instead + * of a hashed address when printing '%p' in plain_hash() and + * plain_format(). + */ + wait_for_random_bytes(); + err = plain_hash(); if (err) { pr_warn("plain 'p' does not appear to be hashed\n"); -- 2.14.1