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: <ed9db2a8-194f-3d42-7339-b66970f68552@kernel.org>
Date:   Mon, 16 Sep 2019 07:25:21 -0600
From:   shuah <shuah@...nel.org>
To:     Eugeniu Rosca <roscaeugeniu@...il.com>,
        "George G. Davis" <george_davis@...tor.com>,
        Jerry Hoemann <jerry.hoemann@....com>,
        Colin Ian King <colin.king@...onical.com>,
        linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     Eugeniu Rosca <erosca@...adit-jv.com>, shuah <shuah@...nel.org>
Subject: Re: [PATCH 1/2] selftests: watchdog: Validate optional file argument

On 9/7/19 2:58 AM, Eugeniu Rosca wrote:
> From: "George G. Davis" <george_davis@...tor.com>
> 
> As reported by Eugeniu Rosca, the newly added optional file
> argument does not validate if the file is indeed a watchdog, e.g.:
> 
> ./watchdog-test  -f /dev/zero
> Watchdog Ticking Away!
> 
> Fix it by confirming that the WDIOC_GETSUPPORT ioctl succeeds.
> 
> Reported-by: Eugeniu Rosca <erosca@...adit-jv.com>
> Signed-off-by: George G. Davis <george_davis@...tor.com>
> Signed-off-by: Eugeniu Rosca <erosca@...adit-jv.com>
> ---
> v1: Applied/tested on commit ce54eab71e210f ("kunit: fix failure to build without printk") of
>      https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/log/?h=next
> 
>   tools/testing/selftests/watchdog/watchdog-test.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
> 
> diff --git a/tools/testing/selftests/watchdog/watchdog-test.c b/tools/testing/selftests/watchdog/watchdog-test.c
> index afff120c7be6..6ed822dc2222 100644
> --- a/tools/testing/selftests/watchdog/watchdog-test.c
> +++ b/tools/testing/selftests/watchdog/watchdog-test.c
> @@ -97,6 +97,7 @@ int main(int argc, char *argv[])
>   	int c;
>   	int oneshot = 0;
>   	char *file = "/dev/watchdog";
> +	struct watchdog_info info;
>   
>   	setbuf(stdout, NULL);
>   
> @@ -118,6 +119,16 @@ int main(int argc, char *argv[])
>   		exit(-1);
>   	}
>   
> +	/*
> +	 * Validate that `file` is a watchdog device
> +	 */
> +	ret = ioctl(fd, WDIOC_GETSUPPORT, &info);
> +	if (ret) {
> +		printf("WDIOC_GETSUPPORT error '%s'\n", strerror(errno));
> +		close(fd);
> +		exit(ret);
> +	}
> +
>   	optind = 0;
>   
>   	while ((c = getopt_long(argc, argv, sopts, lopts, NULL)) != -1) {
> 

Thanks for catching this. I will pull this in for second update for
5.4-rc1.

thanks,
-- Shuah

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ