[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFwXKPUoZ3R4ey03L6ksXCmGLNS=16aQ7gRO1=VXCMZx-A@mail.gmail.com>
Date: Fri, 3 Feb 2017 11:28:48 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Al Viro <viro@...iv.linux.org.uk>,
Steve Capper <steve.capper@...aro.org>,
Catalin Marinas <catalin.marinas@....com>,
Hugh Dickins <hughd@...gle.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>
Cc: Jeff Layton <jlayton@...hat.com>,
Christoph Hellwig <hch@...radead.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux NFS Mailing List <linux-nfs@...r.kernel.org>,
ceph-devel <ceph-devel@...r.kernel.org>,
lustre-devel@...ts.lustre.org,
V9FS Developers <v9fs-developer@...ts.sourceforge.net>,
Jan Kara <jack@...e.cz>,
Chris Wilson <chris@...is-wilson.co.uk>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Subject: Re: [PATCH v3 0/2] iov_iter: allow iov_iter_get_pages_alloc to
allocate more pages per call
On Fri, Feb 3, 2017 at 11:08 AM, Al Viro <viro@...iv.linux.org.uk> wrote:
>
> On x86 it does. I don't see anything equivalent in mm/gup.c one, and the
> only kinda-sorta similar thing (access_ok() in __get_user_pages_fast()
> there) is vulnerable to e.g. access via kernel_write().
Yeah, access_ok() is bogus. It needs to just check against TASK_SIZE
or whatever.
> doesn't look promising - access_ok() is never sufficient. Something like
> _PAGE_USER tests in x86 one solves that problem, but if anything similar
> works for HAVE_GENERIC_RCU_GUP I don't see it. Thus the question re
> what am I missing here...
Ok, I definitely agree that it looks like __get_user_pages_fast() just
needs to get rid of the access_ok() and replace it with a proper check
for the user address space range.
Looks like arm[64] and powerpc.are the current users. Adding in some
people involved with the original submission a few years ago.
I do note that the x86 __get_user_pages_fast() thing looks dodgy too.
In particular, we do it right in the *real* get_user_pages_fast(), see
commit 7f8189068726 ("x86: don't use 'access_ok()' as a range check in
get_user_pages_fast()"). But then the same bug was re-introduced when
the "irq safe" version was merged. As well as in the GENERIC_RCU_GUP
version.
Gaah. Apparently PeterZ copied the old buggy version before the fix
when he added __get_user_pages_fast() in commit 465a454f254e ("x86,
mm: Add __get_user_pages_fast()").
I guess it could be considered a merge error (both happened during the
2.6.31 merge window).
Linus
Powered by blists - more mailing lists