lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 11 May 2020 13:05:22 +0200
From:   Vlastimil Babka <vbabka@...e.cz>
To:     Luis Chamberlain <mcgrof@...nel.org>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Kees Cook <keescook@...omium.org>,
        Iurii Zaikin <yzaikin@...gle.com>,
        linux-kernel@...r.kernel.org, linux-api@...r.kernel.org,
        linux-mm@...ck.org, Ivan Teterevkov <ivan.teterevkov@...anix.com>,
        Michal Hocko <mhocko@...nel.org>,
        David Rientjes <rientjes@...gle.com>,
        Matthew Wilcox <willy@...radead.org>,
        "Eric W . Biederman" <ebiederm@...ssion.com>,
        "Guilherme G . Piccoli" <gpiccoli@...onical.com>,
        Alexey Dobriyan <adobriyan@...il.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Christian Brauner <christian.brauner@...ntu.com>,
        Masami Hiramatsu <mhiramat@...nel.org>
Subject: Re: [PATCH v3 5/5] lib/test_sysctl: support testing of sysctl. boot
 parameter


On 4/27/20 8:39 PM, Luis Chamberlain wrote:
> On Mon, Apr 27, 2020 at 08:04:33PM +0200, Vlastimil Babka wrote:
> Nice, also we could just require
> 
> diff --git a/tools/testing/selftests/sysctl/config b/tools/testing/selftests/sysctl/config
> index 6ca14800d755..34461cc99a2b 100644
> --- a/tools/testing/selftests/sysctl/config
> +++ b/tools/testing/selftests/sysctl/config
> @@ -1 +1,3 @@
>  CONFIG_TEST_SYSCTL=y
> +CONFIG_IKCONFIG=y
> +CONFIG_IKCONFIG_PROC=y
> 
> tools/testing/selftests/firmware/fw_lib.sh then has a kconfig_has()
> which can verify the exact config.

Hmm but it also has a (firmware area specific) fallback for case where
IKCONFIG_PROC doesn't exist. So it's simpler to just keep checking the module
dir, IMHO, as that would be the fallback. 

>> +
>> +	echo -n "Testing if $TARGET is set to 1 ..."
>> +	ORIG=$(cat "${TARGET}")
> 
> This would fail if someone uses this script to test an older kernel, and
> the scripts in selftests are supposed to work with older kernels.

Oh, I didn't know that it's supposed to.

> One
> way to address this would be to just see if the file exists first and
> ignore the test if the $SYSCTL directory exists but the file $TARGET
> does not.
> 
> For now we can just do this:
> 
> if [ ! -d $TARGET ]; then
> 	echo "Skipping test for $TARGET as it is not present ..."
> 	return 0
> fi

OK, just the -d test needs to be fixed :) Andrew can you please apply:

----8<----
>From a999e993a89e521b152bbd4b1466f69e62879c30 Mon Sep 17 00:00:00 2001
From: Vlastimil Babka <vbabka@...e.cz>
Date: Mon, 11 May 2020 12:59:49 +0200
Subject: [PATCH] lib/test_sysctl: support testing of sysctl. boot parameter -
 fix

Skip the new test if boot_int sysctl is not present, otherwise, per Luis,
"This would fail if someone uses this script to test an older kernel, and
the scripts in selftests are supposed to work with older kernels."

Suggested-by: Luis Chamberlain <mcgrof@...nel.org>
Signed-off-by: Vlastimil Babka <vbabka@...e.cz>
---
 tools/testing/selftests/sysctl/sysctl.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/testing/selftests/sysctl/sysctl.sh b/tools/testing/selftests/sysctl/sysctl.sh
index ef6417b8067b..148704f465b5 100755
--- a/tools/testing/selftests/sysctl/sysctl.sh
+++ b/tools/testing/selftests/sysctl/sysctl.sh
@@ -756,6 +756,11 @@ sysctl_test_0006()
 sysctl_test_0007()
 {
 	TARGET="${SYSCTL}/boot_int"
+	if [ ! -f $TARGET ]; then
+		echo "Skipping test for $TARGET as it is not present ..."
+		return 0
+	fi
+
 	if [ -d $DIR ]; then
 		echo "Boot param test only possible sysctl_test is built-in, not module:"
 		cat $TEST_DIR/config >&2
-- 
2.26.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ