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]
Message-Id: <20220624202921.80867-1-sj@kernel.org>
Date:   Fri, 24 Jun 2022 20:29:21 +0000
From:   SeongJae Park <sj@...nel.org>
To:     Gautam <gautammenghani201@...il.com>
Cc:     sj@...nel.org, shuah@...nel.org, damon@...ts.linux.dev,
        linux-mm@...ck.org, linux-kselftest@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kselftests/damon: add support for checking secureboot status

Hi Gautam,


On Sat, 25 Jun 2022 01:22:39 +0530 Gautam <gautammenghani201@...il.com> wrote:

> The kernel is in lockdown mode when secureboot is enabled and hence
> debugfs cannot be used. But the error printed after running tests does
> not indicate this currently:
> 
> >TAP version 13
> >1..6
> ># selftests: damon: debugfs_attrs.sh
> ># cat: /sys/kernel/debug/damon/monitor_on: Operation not permitted
> ># _debugfs_common.sh: line 48: [: =: unary operator expected
> ># cat: /sys/kernel/debug/damon/attrs: Operation not permitted
> ># _debugfs_common.sh: line 11: /sys/kernel/debug/damon/attrs: Operation 
> > not permitted
> ># writing 1 2 3 4 5 to /sys/kernel/debug/damon/attrs doesn't return 0
> ># expected because: valid input
> ># _debugfs_common.sh: line 16: /sys/kernel/debug/damon/attrs: Operation 
> > not permitted
> >not ok 1 selftests: damon: debugfs_attrs.sh # exit=1
> 
> 
> After adding the check for secureboot, the output is as follows:
> 
> >TAP version 13
> >1..6
> ># selftests: damon: debugfs_attrs.sh
> ># debugfs cannot work with secureboot enabled
> >not ok 1 selftests: damon: debugfs_attrs.sh # exit=1
> 
> 
> Signed-off-by: Gautam <gautammenghani201@...il.com>
> ---
>  tools/testing/selftests/damon/_chk_dependency.sh | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>  mode change 100644 => 100755 tools/testing/selftests/damon/_chk_dependency.sh
> 
> diff --git a/tools/testing/selftests/damon/_chk_dependency.sh b/tools/testing/selftests/damon/_chk_dependency.sh
> old mode 100644
> new mode 100755
> index 0189db81550b..6e45c1fe230e
> --- a/tools/testing/selftests/damon/_chk_dependency.sh
> +++ b/tools/testing/selftests/damon/_chk_dependency.sh
> @@ -26,3 +26,13 @@ do
>  		exit 1
>  	fi
>  done
> +
> +secureboot_error="Operation not permitted"
> +for f in attrs target_ids monitor_on
> +do
> +	status=$( cat "$DBGFS/$f" 2>&1 )
> +	if [ "${status#*$secureboot_error}" != "$status" ]; then
> +		echo "debugfs cannot work with secureboot enabled"

I think the check makes sense, but I think there could be more reasons for the
read error other than secure boot.  How about making the error mesage more
clear for the error case and our guess?  E.g., "permission for reading
$DBGFS/$f denied; maybe secureboot enabled?"

> +		exit 1

This is not a test failure but we are just skipping the test as running the
test here makes no sense.  Hence I think '$ksft_skip' could be a better return
code.


Thanks,
SJ

> +	fi
> +done
> -- 
> 2.36.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ