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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Fri, 13 Dec 2019 08:31:21 +0100
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Shuah Khan <skhan@...uxfoundation.org>
Cc:     shuah@...nel.org, mcgrof@...nel.org, scott.branden@...adcom.com,
        tiwai@...e.de, linux-kselftest@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] selftests: firmware: Fix it to do root uid check and skip

On Thu, Dec 12, 2019 at 06:56:06PM -0700, Shuah Khan wrote:
> firmware attempts to load test modules that require root access
> and fail. Fix it to check for root uid and exit with skip code
> instead.
> 
> Before this fix:
> 
> selftests: firmware: fw_run_tests.sh
> modprobe: ERROR: could not insert 'test_firmware': Operation not permitted
> You must have the following enabled in your kernel:
> CONFIG_TEST_FIRMWARE=y
> CONFIG_FW_LOADER=y
> CONFIG_FW_LOADER_USER_HELPER=y
> CONFIG_IKCONFIG=y
> CONFIG_IKCONFIG_PROC=y
> not ok 1 selftests: firmware: fw_run_tests.sh # SKIP
> 
> With this fix:
> 
> selftests: firmware: fw_run_tests.sh
> skip all tests: must be run as root
> not ok 1 selftests: firmware: fw_run_tests.sh # SKIP
> 
> Signed-off-by: Shuah Khan <skhan@...uxfoundation.org>
> ---
>  tools/testing/selftests/firmware/fw_lib.sh | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/tools/testing/selftests/firmware/fw_lib.sh b/tools/testing/selftests/firmware/fw_lib.sh
> index b879305a766d..5b8c0fedee76 100755
> --- a/tools/testing/selftests/firmware/fw_lib.sh
> +++ b/tools/testing/selftests/firmware/fw_lib.sh
> @@ -34,6 +34,12 @@ test_modprobe()
>  
>  check_mods()
>  {
> +	local uid=$(id -u)
> +	if [ $uid -ne 0 ]; then
> +		echo "skip all tests: must be run as root" >&2
> +		exit $ksft_skip
> +	fi
> +
>  	trap "test_modprobe" EXIT
>  	if [ ! -d $DIR ]; then
>  		modprobe test_firmware
> -- 
> 2.20.1
> 

Reviwed-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ