From patchwork Thu May 28 14:52:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 11576033 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8D27E913 for ; Thu, 28 May 2020 14:52:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6ABFB208DB for ; Thu, 28 May 2020 14:52:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590677532; bh=1cwsza4VkPxnPZPr6rqv9W6jMJ44T2SV2cjU4ztOO2c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=vI8R1lm7S/3GZExaqnI1cvw4W0ml7DRh0VQfZMZex9yWk5EMzOjIJ5p1p210R0+yG jOhaAVmnIPJMY7cuxlKKrA2Y4muv12tZiMvyUiQd+0Ti20S0by3wscDUN8xEexRTPl kdgawBL/KJnCYKHMNJ09tNsZqYEGBVSvpadM5LKk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391310AbgE1OwM (ORCPT ); Thu, 28 May 2020 10:52:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:40408 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391291AbgE1OwL (ORCPT ); Thu, 28 May 2020 10:52:11 -0400 Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 983312075F; Thu, 28 May 2020 14:52:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590677530; bh=1cwsza4VkPxnPZPr6rqv9W6jMJ44T2SV2cjU4ztOO2c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x6wcvMPybdFAQWcmnzUNfQ6HQZDJbJyFsxlcjw9VUd4HQ1NKvhXllAHFgbQiVC/qW JWOHijBEUx7SX/8u+frag7vEBpyQDaoGOKgVT+2cbTRNPLBDOdB02A+WIBOO5na149 7+wJ2AFmUymBaCTKP0nAbVTU0n2j5xzwolfdQjq0= From: Masami Hiramatsu To: Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan , Masami Hiramatsu , "Luis R . Rodriguez" , Chris Wilson , Joonas Lahtinen , Kees Cook , Masami Hiramatsu Subject: [PATCH 1/4] lib: Make prime number generator independently selectable Date: Thu, 28 May 2020 23:52:06 +0900 Message-Id: <159067752610.229397.10253900294111245982.stgit@devnote2> X-Mailer: git-send-email 2.25.1 In-Reply-To: <159067751438.229397.6746886115540895104.stgit@devnote2> References: <159067751438.229397.6746886115540895104.stgit@devnote2> User-Agent: StGit/0.19 MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Make prime number generator independently selectable from kconfig. This allows us to enable CONFIG_PRIME_NUMBERS=m and run the tools/testing/selftests/lib/prime_numbers.sh without other DRM selftest modules. Signed-off-by: Masami Hiramatsu Reviewed-by: Kees Cook Reviewed-by: Luis Chamberlain --- lib/math/Kconfig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/math/Kconfig b/lib/math/Kconfig index 15bd50d92308..f19bc9734fa7 100644 --- a/lib/math/Kconfig +++ b/lib/math/Kconfig @@ -6,7 +6,12 @@ config CORDIC calculations are in fixed point. Module will be called cordic. config PRIME_NUMBERS - tristate + tristate "Simple prime number generator for testing" + help + This option provides a simple prime number generator for test + modules. + + If unsure, say N. config RATIONAL bool From patchwork Thu May 28 14:52:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 11576035 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6B25B13B4 for ; Thu, 28 May 2020 14:52:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 50F772084C for ; Thu, 28 May 2020 14:52:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590677543; bh=FapqSyp7PbMw4eQbsOKi/qDa62bAlW+gr+fJp3y8L4s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=J/ovhAlhMnLvOnLaYGrOXQM7S1wGAY3RH5vKSHBDGvUlLpmJfjNWux6ijV6JVPIig CLY7/uAlIdOIoCDsgMZEwL1cukreHuijnqVpS4AdrStzi7qahw5LSO5ssMNHuNL4Gm HMYtH8WLDccF6cRsls/EPjadlunEiacWcamBN/FY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391291AbgE1OwW (ORCPT ); Thu, 28 May 2020 10:52:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:40534 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391255AbgE1OwV (ORCPT ); Thu, 28 May 2020 10:52:21 -0400 Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C7A442075F; Thu, 28 May 2020 14:52:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590677541; bh=FapqSyp7PbMw4eQbsOKi/qDa62bAlW+gr+fJp3y8L4s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2fE3cRMsr3X8t8DECNVNHLTF3xvPPb93zMo6cCeB04fcJbopDAQ+Z2OaqHdoKhNtl NCqEuAKxcTRTTx1iJXfxA83oMm2osQwXLsp+Zu7atRfaizo+g8UfxlYtZYjd76ryTE LbM63KnuZS72SaqvhhWu00hq9HEG2DPhIiHjynmQ= From: Masami Hiramatsu To: Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan , Masami Hiramatsu , "Luis R . Rodriguez" , Chris Wilson , Joonas Lahtinen , Kees Cook , Masami Hiramatsu Subject: [PATCH 2/4] lib: Make test_sysctl initialized as module Date: Thu, 28 May 2020 23:52:16 +0900 Message-Id: <159067753624.229397.13771427935697541820.stgit@devnote2> X-Mailer: git-send-email 2.25.1 In-Reply-To: <159067751438.229397.6746886115540895104.stgit@devnote2> References: <159067751438.229397.6746886115540895104.stgit@devnote2> User-Agent: StGit/0.19 MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org test_sysctl.c is expected to be used as a module, but since it does not use module_init(), it never be registered as a module and not appeared under /sys/module/. In the result, the selftests/sysctl/sysctl.sh always fails to find the test module and is skipped. This makes test_sysctl.c initialized as a module by module_init() and allow sysctl.sh to find the test module is loaded. Signed-off-by: Masami Hiramatsu Reviewed-by: Luis Chamberlain --- lib/test_sysctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/test_sysctl.c b/lib/test_sysctl.c index 566dad3f4196..ec4d0f03475d 100644 --- a/lib/test_sysctl.c +++ b/lib/test_sysctl.c @@ -149,7 +149,7 @@ static int __init test_sysctl_init(void) } return 0; } -late_initcall(test_sysctl_init); +module_init(test_sysctl_init); static void __exit test_sysctl_exit(void) { From patchwork Thu May 28 14:52:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 11576037 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CF222913 for ; Thu, 28 May 2020 14:52:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B8C54208DB for ; Thu, 28 May 2020 14:52:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590677557; bh=g+GA7748mcRVf5Dk5zP2FrQLRaz81ApMWGtcMSwYyJQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=TnnJs6GGz5hh3Me6yotmlcpvuiOnpoMgR86QZRBqYCMRTI3D+hAGTWEotDXIpxXJ4 aE04xfns6bHa+S36CLov4l1zlumFVrx9tSHv3sNjHl7Yt3Glg0oR6FjVQtzoO/IaeK I19kSo0WWSd2cTX/XD2fs+W+obbM011b81IMyehA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403794AbgE1Owd (ORCPT ); Thu, 28 May 2020 10:52:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:40712 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403790AbgE1Owc (ORCPT ); Thu, 28 May 2020 10:52:32 -0400 Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 57B812075F; Thu, 28 May 2020 14:52:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590677551; bh=g+GA7748mcRVf5Dk5zP2FrQLRaz81ApMWGtcMSwYyJQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mbijsxQErF8YGGSl7V2+spkkU+8N071iLQceo/Fp1by2zKLCqZilbA4vkyS6fG5/L 3cGjdWmje4FxT02kcA53Hqp6eDcIusULKX74Gre6qIOWqNhXu5Xr+mj35/msy9kuEJ KX4SFKN53lOAZsNt7I5juHJDKpjBrNn8DiElg7ys= From: Masami Hiramatsu To: Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan , Masami Hiramatsu , "Luis R . Rodriguez" , Chris Wilson , Joonas Lahtinen , Kees Cook , Masami Hiramatsu Subject: [PATCH 3/4] selftests/sysctl: Fix to load test_sysctl module Date: Thu, 28 May 2020 23:52:26 +0900 Message-Id: <159067754657.229397.15961438722058766667.stgit@devnote2> X-Mailer: git-send-email 2.25.1 In-Reply-To: <159067751438.229397.6746886115540895104.stgit@devnote2> References: <159067751438.229397.6746886115540895104.stgit@devnote2> User-Agent: StGit/0.19 MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Fix to load test_sysctl.ko module correctly. sysctl.sh checks whether the test module is embedded (or loaded already) or not at first, and if not, it returns skip error instead of trying modprobe. Thus, there is no chance to load the test_sysctl test module. Instead, this removes that module embedded check and returns skip error only if it ensures that there is no embedded test module *and* no loadable test module. This also avoid referring config file since that is not installed. Signed-off-by: Masami Hiramatsu Reviewed-by: Kees Cook Reviewed-by: Luis Chamberlain --- tools/testing/selftests/sysctl/sysctl.sh | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/tools/testing/selftests/sysctl/sysctl.sh b/tools/testing/selftests/sysctl/sysctl.sh index 6a970b127c9b..c3459f9f2429 100755 --- a/tools/testing/selftests/sysctl/sysctl.sh +++ b/tools/testing/selftests/sysctl/sysctl.sh @@ -40,16 +40,6 @@ ALL_TESTS="$ALL_TESTS 0004:1:1:uint_0001" ALL_TESTS="$ALL_TESTS 0005:3:1:int_0003" ALL_TESTS="$ALL_TESTS 0006:50:1:bitmap_0001" -test_modprobe() -{ - if [ ! -d $DIR ]; then - echo "$0: $DIR not present" >&2 - echo "You must have the following enabled in your kernel:" >&2 - cat $TEST_DIR/config >&2 - exit $ksft_skip - fi -} - function allow_user_defaults() { if [ -z $DIR ]; then @@ -125,10 +115,12 @@ function load_req_mod() if [ ! -d $DIR ]; then if ! modprobe -q -n $TEST_DRIVER; then echo "$0: module $TEST_DRIVER not found [SKIP]" + echo "You must set CONFIG_TEST_SYSCTL=m in your kernel" >&2 exit $ksft_skip fi modprobe $TEST_DRIVER if [ $? -ne 0 ]; then + echo "$0: modprobe $TEST_DRIVER failed." exit fi fi @@ -929,7 +921,6 @@ test_reqs allow_user_defaults check_production_sysctl_writes_strict load_req_mod -test_modprobe trap "test_finish" EXIT From patchwork Thu May 28 14:52:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 11576039 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7692A913 for ; Thu, 28 May 2020 14:52:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5973820888 for ; Thu, 28 May 2020 14:52:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590677567; bh=czaYCN6eqWR7GuJTWJzQRoAJaa0eRrF2WnNBmRdRUT4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=pHpCJ2qN+OjAbgtoA4BU9Mo+EFmw88cxX35yfI4HFyeMQZkqvxsaP+bwQMpuhqDNC m3Jgmql4xmDyxo5QG6B0ZFp6w7vcx6mNLGFVcv2xIOKC8jiCODfb1Di7Cw9IJQrHns 8hiaOrkWWnoFJSSiH/qgbT4FOdg8JvaFklOnN/2o= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391322AbgE1Owq (ORCPT ); Thu, 28 May 2020 10:52:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:40908 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403790AbgE1Owm (ORCPT ); Thu, 28 May 2020 10:52:42 -0400 Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 61A952075F; Thu, 28 May 2020 14:52:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590677561; bh=czaYCN6eqWR7GuJTWJzQRoAJaa0eRrF2WnNBmRdRUT4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kcklip7nlRYJiaSCAQqnvdJk3dX5xAuRoJWISKrM3l/KvJx4NYK6CCDylh6Ixk6/E VNVQqi4y4iariGF3FywLKVijz/1eMcJIc2uAVquqpnPkmHkoijd+eYz4zJ+9cwkrHH Y4+Pyw6sRxcZENcEkPoOmF2929/8glkEOQ9dzwv4= From: Masami Hiramatsu To: Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan , Masami Hiramatsu , "Luis R . Rodriguez" , Chris Wilson , Joonas Lahtinen , Kees Cook , Masami Hiramatsu Subject: [PATCH 4/4] selftests/sysctl: Make sysctl test driver as a module Date: Thu, 28 May 2020 23:52:37 +0900 Message-Id: <159067755690.229397.12060049846042042480.stgit@devnote2> X-Mailer: git-send-email 2.25.1 In-Reply-To: <159067751438.229397.6746886115540895104.stgit@devnote2> References: <159067751438.229397.6746886115540895104.stgit@devnote2> User-Agent: StGit/0.19 MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Fix config file to require CONFIG_TEST_SYSCTL=m instead of y because this driver introduces a test sysctl interfaces which are normally not used, and only used for the selftest. Signed-off-by: Masami Hiramatsu Reviewed-by: Kees Cook Reviewed-by: Luis Chamberlain --- tools/testing/selftests/sysctl/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/sysctl/config b/tools/testing/selftests/sysctl/config index 6ca14800d755..fc263efd1fad 100644 --- a/tools/testing/selftests/sysctl/config +++ b/tools/testing/selftests/sysctl/config @@ -1 +1 @@ -CONFIG_TEST_SYSCTL=y +CONFIG_TEST_SYSCTL=m