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] [day] [month] [year] [list]
Date:   Mon, 21 Sep 2020 14:57:53 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Christoph Hellwig' <hch@...radead.org>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "io-uring@...r.kernel.org" <io-uring@...r.kernel.org>,
        Jens Axboe <axboe@...nel.dk>,
        "David S. Miller" <davem@...emloft.net>,
        Al Viro <viro@...iv.linux.org.uk>,
        linux-fsdevel <linux-fsdevel@...r.kernel.org>
Subject: RE: [PATCH 3/9 next] lib/iov_iter: Improved function for importing
 iovec[] from userpace.

From: Christoph Hellwig
> Sent: 21 September 2020 15:11
> 
> On Tue, Sep 15, 2020 at 02:55:17PM +0000, David Laight wrote:
> >
> > import_iovec() has a 'pointer by reference' parameter to pass in the
> > (on-stack) iov[] cache and return the address of a larger copy that
> > the caller must free.
> > This is non-intuitive, faffy to setup, and not that efficient.
> > Instead just pass in the address of the cache and return the address
> > to free (on success) or PTR_ERR() (on error).
> 
> To me it seems pretty sensible, and in fact the conversions to your
> new API seem to add more lines than they remove.

They probably add a line because the two variables get defined on
separate lines.

The problem is the inefficiency of passing the addresses by 'double
reference'.
Although your suggestion of putting the 'address to free' in the
same structure as the cache does resolve that.
It also gets rid of all the PTR_ERR() faffing.
Still probably best to return 0 on success.
Plenty of code was converting the +ve to 0.

I might to a v2 on top of your compat iovec changes - once they
hit Linus's tree.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists