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  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:   Wed, 16 Dec 2020 04:33:23 +0000
From:   Al Viro <viro@...iv.linux.org.uk>
To:     Siddhesh Poyarekar <siddhesh@...plt.org>
Cc:     linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
        Florian Weimer <fweimer@...hat.com>
Subject: Re: [PATCH v2] proc: Escape more characters in /proc/mounts output

On Tue, Dec 15, 2020 at 06:23:18PM +0530, Siddhesh Poyarekar wrote:

> +static char *copy_mount_devname(const void __user *data)
> +{
> +	char *p;
> +	long length;
> +
> +	if (data == NULL)
> +		return NULL;
> +
> +	length = strnlen_user(data, PATH_MAX);
> +
> +	if (!length)
> +		return ERR_PTR(-EFAULT);
> +
> +	if (length > PATH_MAX)
> +		return ERR_PTR(-EINVAL);
> +
> +	/* Ignore blank strings */
> +	if (length == 1)
> +		return NULL;
> +
> +	p = memdup_user(data, length);

Once more, with feeling: why bother?  What's wrong
with using the damn strndup_user() and then doing
whatever checks you want with the data already
copied, living in normal kernel memory, with all
string functions applicable, etc.?

Powered by blists - more mailing lists