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]
Date:   Mon, 12 Dec 2016 16:12:16 -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 Mon, 12 Dec 2016, Michal Hocko wrote:

> On Mon 12-12-16 21:32:35, Andrey Konovalov wrote:
> > On Mon, Dec 12, 2016 at 9:31 PM, Andrey Konovalov <andreyknvl@...gle.com> wrote:
> > > Hi!
> > >
> > > While running the syzkaller fuzzer I've got the following error report.
> > >
> > > The issue is that the len argument is not checked for being too big.
> 
> Well, the value is checked in kmalloc_slab. There is a discrepancy
> though. While the page allocator enforces order < MAX_ORDER, slab
> allocators enforce size <= KMALLOC_MAX_SIZE and
> 
> KMALLOC_MAX_SIZE is 1UL << (MAX_ORDER + PAGE_SHIFT) for SLUB which is
> what I expect you have or 1UL << (MAX_ORDER + PAGE_SHIFT - 1) for SLAB
> on most archs.  This means that KMALLOC_MAX_SIZE might be MAX_ORDER for
> SLUB which would explain your warning.
> 
> Let's CC Christoph, this is nothing really new, but I suspect that SLUB
> should change the maximum size to something like SLAB does.
> 
> 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).

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.

Alan Stern

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ