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: <Pine.LNX.4.44L0.1612141100280.2114-100000@iolanthe.rowland.org>
Date:   Wed, 14 Dec 2016 11:13:11 -0500 (EST)
From:   Alan Stern <stern@...land.harvard.edu>
To:     Michal Hocko <mhocko@...nel.org>
cc:     Andrey Konovalov <andreyknvl@...gle.com>,
        Felipe Balbi <balbi@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Al Viro <viro@...iv.linux.org.uk>,
        Marek Szyprowski <m.szyprowski@...sung.com>,
        Deepa Dinamani <deepa.kernel@...il.com>,
        Mathieu Laurendeau <mat.lau@...oste.net>,
        Bin Liu <b-liu@...com>, USB list <linux-usb@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        syzkaller <syzkaller@...glegroups.com>,
        Dmitry Vyukov <dvyukov@...gle.com>,
        Kostya Serebryany <kcc@...gle.com>,
        Cristopher Lameter <cl@...ux.com>
Subject: Re: usb/gadget: warning in ep_write_iter/__alloc_pages_nodemask

On Wed, 14 Dec 2016, Michal Hocko wrote:

> On Tue 13-12-16 08:33:34, Alan Stern wrote:
> > On Tue, 13 Dec 2016, Michal Hocko wrote:
> > 
> > > > > That being said, what ep_write_iter does sounds quite stupit. It just
> > > > > allocates a large continuous buffer which seems to be under user
> > > > > control...  Aka no good! It should do that per pages or something like
> > > > > that. Something worth fixing
> > > > 
> > > > It's not important enough to make the driver do all this work.  If
> > > > users want to send large amounts of data, they can send it a page at a
> > > > time (or something like that).
> > > 
> > > Is it really necessary to allocate the full iov_iter_count? Why cannot
> > > we process the from buffer one page at a time?
> > 
> > We could (although one page is really too small -- USB 3.1 can transfer
> > 800 KB per ms so we ought to handle at least 128 KB at a time).
> 
> Is there any problem to submit larger transfers without having the
> buffer physically contiguous?

Async I/O would be rather awkward; it would have to use a work queue
routine.  But it could be done.

And we would still end up allocating the same total space (more
actually, because we would need to store the scatter-gather table too).  
It just wouldn't be contiguous.

> > But
> > turn the argument around: If the user wants to transfer that much data,
> > why can't he _submit_ it one page at a time?
> 
> Not sure I understand.
>  
> > > > If you really want to prevent the driver from attempting to allocate a
> > > > large buffer, all that's needed is an upper limit on the total size.  
> > > > For example, 64 KB.
> > > 
> > > Well, my point was that it is not really hard to imagine to deplete
> > > larger contiguous memory blocks (say PAGE_ALLOC_COSTLY_ORDER). Those are
> > > still causing the OOM killer and chances are that a controlled flood of
> > > these requests could completely DoS the system.
> > 
> > Putting a limit on the total size of a single transfer would prevent 
> > this.
> 
> Dunno, putting a limit to the user visible interface sounds wrong to me.

In practice, I think the data transfer sizes tend to be not very large.  
But I could be wrong about that.

Alan Stern

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ