From patchwork Mon Jun 4 11:37:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Escande X-Patchwork-Id: 137627 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1395994lji; Mon, 4 Jun 2018 04:37:20 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJfOX0p1E8zh9xSCQPaXIdBdh2YwnIhbB5/pERSoeYk/redLl2qV2pELMeN3ZpCi5RjLMox X-Received: by 2002:a17:902:b588:: with SMTP id a8-v6mr21105199pls.308.1528112240016; Mon, 04 Jun 2018 04:37:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528112240; cv=none; d=google.com; s=arc-20160816; b=UDSat4ByCJXBYtuhtvYPiUyg7dIy9I3gAaiY5oytPh0botWU08n5966p8gcGyDM223 Fc3fiEVoBINdjOMcJ1Fsi/IisuM3bVPcmEvZL6AY+1CLkb+l7r3wpSkPHZ8JwNR0zVMG GgUjjeUrfpM65oby3os0eXuQGavlE74/5eq0nh4QCB4TgmvP03aK1rMLWSoqyDtD1tbq ng42GTMCgEYe2nUOHhgzNAXhYdQi6KeB4JZ82ttdRkyl1aDZsW4gyP0PV4QAQB+AbDN5 3zsnEXECzx5guWjQpH9Mya2p9pnnQdmm2PhacrWH/iXO8hraZiuRS7+guat+zNiilyCg oF6g== 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=+q1BN5jZsK5WD8MUn005XbYY/U4efa+o60xifL0bS1Q=; b=k/W8wKtcQ8zVqERmRe5rKOiaTTO9IuMy7uRy5vM/iiXGTj/7sG9TUwLdUOVs0sFfOv Fc4MzPCSOSDEiQtEqftf1lzhR6nTH55MygI5kx8twYCOaPnx/TnJZGmh3Ec1WJp4CMFf ptyYkkI7xjwxtrMrPFRCg1hB+F6XbEOCJX9A622+ErW7SkmdCCPzGPPgbjeJ8SlflzLN 8rfeE1ZHtMR5s1vqSJtfJGwHMr+5jfUG8PnTqy7mIo1KErXA2WkWGmXKJHW8Bjv+X2cy 6eRzykvUl0smfpRYzhlK2vDdHNVBNm+Cr9/9WjrBj1c3fou/oSl7nb51KE2fF+8/w11q v1Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ggNzyAje; 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 n68-v6si6072646pfb.152.2018.06.04.04.37.19; Mon, 04 Jun 2018 04:37:20 -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=ggNzyAje; 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 S1752242AbeFDLhR (ORCPT + 30 others); Mon, 4 Jun 2018 07:37:17 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36125 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751418AbeFDLhQ (ORCPT ); Mon, 4 Jun 2018 07:37:16 -0400 Received: by mail-wm0-f68.google.com with SMTP id v131-v6so14197218wma.1 for ; Mon, 04 Jun 2018 04:37:16 -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=+q1BN5jZsK5WD8MUn005XbYY/U4efa+o60xifL0bS1Q=; b=ggNzyAjeRl3Rr4HkQjmejmVPzmoBeNt+chUO5FJ/JovOqk5BZfQICVV2oTJQ9lxb3L efPyI7c9+wqQSOpcFegKCLB0OjyatjJnQTT1OA1rT0P1jjCpZZuSbkc/1iNDfaWPPJ6I 7nQL2nIK1O4PlyjH2K4Q8yD8DEM7CsT1lXkL8= 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=+q1BN5jZsK5WD8MUn005XbYY/U4efa+o60xifL0bS1Q=; b=TaDCrpf/ljWowr5B2eC3TScEDKR4ie2KVbTnA6Qc06ABEKEdsUiiUiPdqKn9jhJezL 9i8wmzDoX65HQPkv6xVwXTQNAMAyMvrO8VeBmYpDeOeMqyj+TRt9Jq+E5GRA0xm8lAKk yeXNoULtuqvmX8UPSi00TzkqzzJcERGaWwTvxx2gJtlimOldju+NV1AYdciRy+XT23gK 6thsxtBw9b31497qHZYp5cBkHJ92rvu8z+LuYf2+/W92gSs/Emgqm1umAYZ1/pWJoycA autt8ff02nZXxKPHLvQtfonlvhQhzbVcoiuBnFMYvRnI+vk4/AJmWzpJbrV9+1LotqyO EENQ== X-Gm-Message-State: APt69E1jZRCUPjJIL3o4AVjmr7ZW5Gdv7r17MXBTbDcgSQYvLN6GI1TK VpLVTrWNhxHgh9Eac3lO44J2gHCyOk0= X-Received: by 2002:a1c:d2cb:: with SMTP id j194-v6mr1425802wmg.129.1528112235550; Mon, 04 Jun 2018 04:37:15 -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 g16-v6sm13959983wro.86.2018.06.04.04.37.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jun 2018 04:37:14 -0700 (PDT) From: Thierry Escande To: Andrew Morton , David Miller Cc: Rasmus Villemoes , "Tobin C . Harding" , linux-kernel@vger.kernel.org Subject: [PATCH RESEND] lib/test_printf.c: call wait_for_random_bytes() before plain %p tests Date: Mon, 4 Jun 2018 13:37:08 +0200 Message-Id: <20180604113708.11554-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 Acked-by: Tobin C. Harding --- lib/test_printf.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.14.1 Reported-by: Steven Rostedt (VMware) Signed-off-by: Petr Mladek 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");