From patchwork Tue May 22 17:41:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Escande X-Patchwork-Id: 136584 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1925639lji; Tue, 22 May 2018 10:41:40 -0700 (PDT) X-Google-Smtp-Source: AB8JxZroPjK9iY/YfUiQUpUPtKEoIC4idibntAKbdv4lXzcMejY7Zyvp+ZWuNm/Ltz/7wIyPSE6c X-Received: by 2002:a62:5754:: with SMTP id l81-v6mr25214309pfb.56.1527010900759; Tue, 22 May 2018 10:41:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527010900; cv=none; d=google.com; s=arc-20160816; b=P8NHn5P1Z1OIO5nU9nR2T79G5Pchs0EAEoXTMRojipABKIw+UYIe4yW6UjyCjhSS1P wupw2osM7uk3pez2Ytl8nWo0YIpRuFIDYY4yKf+DbgVRwtEVRBNwHcy/yQ5W9koRKd7W QGLtevD56wRAP3RCkOAQw++pV2iguFFM3mIyS4NMOxb4VYO7ZjxkO2YVCCE631dch228 iRRxm7j0FsMjX3LnoXCm+oHX5HzQKKcsUeNxtugOxh+1o9C7AdwVUwApGuiGBWPsUV14 xy7ZBnLQb8kRBKcq2ApXURKaodNSFrYxJwSkYGWt+StkXrVA9JelOHkVUsmjECuNITVc EJcA== 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 n3-v6si16569683plp.550.2018.05.22.10.41.40; Tue, 22 May 2018 10:41:40 -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 S1751528AbeEVRli (ORCPT + 30 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-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(+) -- 2.14.1 Acked-by: Tobin C. Harding 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");