Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp741210pxu; Sun, 25 Oct 2020 15:43:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYxLFACAblVNlZLJ/+JKKpV7AkFjLcBT9BUCcmibTUImso1AbWja/0RooUSpoEsqbtRvhs X-Received: by 2002:aa7:c5c4:: with SMTP id h4mr13536728eds.379.1603665837416; Sun, 25 Oct 2020 15:43:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603665837; cv=none; d=google.com; s=arc-20160816; b=Oi84mgfUw1IWR2DIjcvu+YsZWw/0pNKDnLl6d2pMjTfX8XnMKwLEzHWJ1TLo58Fs/9 RnoXhxdJQZ15ctnNWKkF9C1VpVjDgm5sby20i20nr2zaOu3vZbmnNo1HqkI2dC3xXLm5 +ZyeeBOaPeVZl/2LPmyENEitqJQQ3GrLdmI9u/cWDpQ2A/HV7KjM7gx25nTRzltsIA1h cQQ/DCzJ0C4NutvFbM3gOIdL3a76tYiPbURf1KJqkk4aEOpac2soVDY8pY9L39bvGTXj oe9s+gQP3DhWIfxeTq3i6EgO7RN0/fSETyeTuxYgC9o2wkQwqwNW+OUkSnHgjPblzBoC gG+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=pU074RtjEkyjZnTLMDzJX6R1Y/207D0sC+J/EOOsTPs=; b=nr7KTGXzIu2cMuDSkhYVQDNZGchUCEXuF9Cgy65/h2rJpx49ON/s9UNxJlHprAx5ip gk6xM3IcOzj/YgPjdxSskQ1J/muphXtwkqN5YbrVYvAIEWOQBLvne44ZBXm+Xd7WlMN4 /D3PPVGdUPbZyf+kfcOFvcs2yP82ZCEFIvv7fqjyzAXYV8zEWGgQjk50XPK7o8FCSike bdlm6+LIwOa6jbmX+lzd0VVygqT7MQtto4R30OifIBmngfebz7MF6zwLmaNi15L3IlU5 dawOToMyAPTY0ezWXTdqNMsWE4NxhEg5tpOVpYbfc8SSLqwR9YMPpIjGytemePRtda/n iouQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=ChazOuCH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w14si5794095edt.78.2020.10.25.15.43.35; Sun, 25 Oct 2020 15:43:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=ChazOuCH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1418984AbgJYVsv (ORCPT + 99 others); Sun, 25 Oct 2020 17:48:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1418968AbgJYVst (ORCPT ); Sun, 25 Oct 2020 17:48:49 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09868C061755 for ; Sun, 25 Oct 2020 14:48:48 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id p9so10666624eji.4 for ; Sun, 25 Oct 2020 14:48:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pU074RtjEkyjZnTLMDzJX6R1Y/207D0sC+J/EOOsTPs=; b=ChazOuCH96T9UctvjyJS1OV4Cai/f9qmCl3cYdHZcpY+pBDXWlm8/YrIv4PALLSIWh wVB2meCNnIhoCJ7n1eIw3t/k0v9SltjOYSosNoa9yNHL+iYjQcy63V0zjaKyZK24UfXc me+KfcjjAQ11X2MgO18S+pxtrwQpYObQQ84tc= 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-transfer-encoding; bh=pU074RtjEkyjZnTLMDzJX6R1Y/207D0sC+J/EOOsTPs=; b=pZ/wGIjO/WZl2HhcgHl/8ljJGKnqQscUZO8n3OodNHYqnbCcVF0sI0EhJRzvmt/vgJ wQT4rTsqkEeAnaoYcwHwMGLn5BHTYzBUWIlJ2jFaC8iEWhq59Wlb3ojbKDRdJTg+jZ42 piVu5P0S4Yd2zIwD35XZ1vuTX36igWfiuC2ipJ9f43uj5961ixTiYfnchUEAFxul+HCz +9VaGmBs5+2o/Rv9/jyfBI3bEy2Ajx7CJGo94JhjP9A76twhmu4BuR0TO+R4QREMmSs1 ydklPYejA14KjIBbUaJCGPcrBwLePyRbIUgSjQuK5z4j0GCqlW9UaBvd+raSq1SDQ5NN /2Uw== X-Gm-Message-State: AOAM53110bnSTlAh50NX+xszVlZPHQAF204ickCFZb9VH7uaVYkh0lFL KA+fZZVJWyexf7u5InnrLON5ug== X-Received: by 2002:a17:906:5e4f:: with SMTP id b15mr13091466eju.353.1603662526661; Sun, 25 Oct 2020 14:48:46 -0700 (PDT) Received: from prevas-ravi.prevas.se (5.186.115.188.cgn.fibianet.dk. [5.186.115.188]) by smtp.gmail.com with ESMTPSA id k18sm4115867eds.93.2020.10.25.14.48.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Oct 2020 14:48:46 -0700 (PDT) From: Rasmus Villemoes To: Shuah Khan , Kees Cook Cc: Petr Mladek , Willy Tarreau , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Arpitha Raghunandan <98.arpi@gmail.com>, Andy Shevchenko , Brendan Higgins , Rasmus Villemoes Subject: [PATCH 0/4] deterministic random testing Date: Sun, 25 Oct 2020 22:48:38 +0100 Message-Id: <20201025214842.5924-1-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a bit of a mixed bag. The background is that I have some sort() and list_sort() rework planned, but as part of that series I want to extend their their test suites somewhat to make sure I don't goof up - and I want to use lots of random list lengths with random contents to increase the chance of somebody eventually hitting "hey, sort() is broken when the length is 3 less than a power of 2 and only the last two elements are out of order". But when such a case is hit, it's vitally important that the developer can reproduce the exact same test case, which means using a deterministic sequence of random numbers. Since Petr noticed [1] the non-determinism in test_printf in connection with Arpitha's work on rewriting it to kunit, this prompted me to use test_printf as a first place to apply that principle, and get the infrastructure in place that will avoid repeating the "module parameter/seed the rnd_state/report the seed used" boilerplate in each module. Shuah, assuming the kselftest_module.h changes are ok, I think it's most natural if you carry these patches, though I'd be happy with any other route as well. [1] https://lore.kernel.org/lkml/20200821113710.GA26290@alley/ Rasmus Villemoes (4): prandom.h: add *_state variant of prandom_u32_max kselftest_module.h: unconditionally expand the KSTM_MODULE_GLOBALS() macro kselftest_module.h: add struct rnd_state and seed parameter lib/test_printf.c: use deterministic sequence of random numbers Documentation/dev-tools/kselftest.rst | 2 -- include/linux/prandom.h | 29 ++++++++++++++++ lib/test_bitmap.c | 3 -- lib/test_printf.c | 13 ++++--- lib/test_strscpy.c | 2 -- tools/testing/selftests/kselftest_module.h | 40 ++++++++++++++++++---- 6 files changed, 72 insertions(+), 17 deletions(-) -- 2.23.0