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: <YpDhIDacnktXvMpS@zeniv-ca.linux.org.uk>
Date:   Fri, 27 May 2022 14:33:04 +0000
From:   Al Viro <viro@...iv.linux.org.uk>
To:     David Howells <dhowells@...hat.com>
Cc:     Steve French <smfrench@...il.com>,
        Shyam Prasad N <nspmangalore@...il.com>,
        Rohith Surabattula <rohiths.msft@...il.com>,
        Jeff Layton <jlayton@...nel.org>, linux-cifs@...r.kernel.org,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 2/9] iov_iter: Add a general purpose iteration function

On Fri, May 27, 2022 at 11:44:09AM +0100, David Howells wrote:
> Add a function, iov_iter_scan(), to iterate over the buffers described by
> an I/O iterator, kmapping and passing each contiguous chunk the supplied
> scanner function in turn, up to the requested amount of data or until the
> scanner function returns an error.
> 
> This can be used, for example, to hash all the data in an iterator by
> having the scanner function call the appropriate crypto update function.

> +ssize_t iov_iter_scan(struct iov_iter *i, size_t bytes,
> +		      ssize_t (*scanner)(struct iov_iter *i, const void *p,
> +					 size_t len, size_t off, void *priv),
> +		      void *priv)
> +{
> +	ssize_t ret = 0, scanned = 0;
> +
> +	if (!bytes)
> +		return 0;
> +	if (iter_is_iovec(i))
> +		might_fault();
> +
> +	iterate_and_advance(
> +		i, bytes, base, len, off, ({
> +				ret = scanner(i, base, len, off, priv);
> +				if (ret < 0)
> +					break;
> +				scanned += ret;
> +			}), ({
> +				ret = scanner(i, base, len, off, priv);
> +				if (ret < 0)
> +					break;
> +				scanned += ret;
> +			})
> +	);
> +	return ret < 0 ? ret : scanned;
> +}

Have you even tried to run sparse on that?  How could that possibly work?
You are feeding the same callback both userland and kernel pointers;
that makes no sense.

NAK.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ