linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrey Konovalov <andreyknvl@google.com>
To: Dave Hansen <dave.hansen@intel.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Robin Murphy <robin.murphy@arm.com>,
	Kees Cook <keescook@chromium.org>,
	Kate Stewart <kstewart@linuxfoundation.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@kernel.org>,
	"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
	Shuah Khan <shuah@kernel.org>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>,
	Linux Memory Management List <linux-mm@kvack.org>,
	linux-arch <linux-arch@vger.kernel.org>,
	"open list:KERNEL SELFTEST FRAMEWORK" 
	<linux-kselftest@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Dmitry Vyukov <dvyukov@google.com>,
	Kostya Serebryany <kcc@google.com>,
	Evgeniy Stepanov <eugenis@google.com>,
	Lee Smith <Lee.Smith@arm.com>,
	Ramana Radhakrishnan <Ramana.Radhakrishnan@arm.com>,
	Jacob Bramley <Jacob.Bramley@arm.com>,
	Ruben Ayrapetyan <Ruben.Ayrapetyan@arm.com>,
	Chintan Pandya <cpandya@codeaurora.org>,
	Luc Van Oostenryck <luc.vanoostenryck@gmail.com>,
	Dave Martin <Dave.Martin@arm.com>,
	Kevin Brodsky <kevin.brodsky@arm.com>,
	Szabolcs Nagy <Szabolcs.Nagy@arm.com>
Subject: Re: [PATCH v10 06/12] fs, arm64: untag user pointers in copy_mount_options
Date: Tue, 26 Feb 2019 15:35:40 +0100	[thread overview]
Message-ID: <CAAeHK+wLm7zSUC8dJv3LgdyvpkBN8u_24ene6b91PgM570VWbQ@mail.gmail.com> (raw)
In-Reply-To: <a38275b0-f6cd-20e1-3c48-544846586a16@intel.com>

On Sat, Feb 23, 2019 at 12:03 AM Dave Hansen <dave.hansen@intel.com> wrote:
>
> On 2/22/19 4:53 AM, Andrey Konovalov wrote:
> > --- a/fs/namespace.c
> > +++ b/fs/namespace.c
> > @@ -2730,7 +2730,7 @@ void *copy_mount_options(const void __user * data)
> >        * the remainder of the page.
> >        */
> >       /* copy_from_user cannot cross TASK_SIZE ! */
> > -     size = TASK_SIZE - (unsigned long)data;
> > +     size = TASK_SIZE - (unsigned long)untagged_addr(data);
> >       if (size > PAGE_SIZE)
> >               size = PAGE_SIZE;
>
> I would have thought that copy_from_user() *is* entirely capable of
> detecting and returning an error in the case that its arguments cross
> TASK_SIZE.  It will fail and return an error, but that's what it's
> supposed to do.
>
> I'd question why this code needs to be doing its own checking in the
> first place.  Is there something subtle going on?

The comment above exact_copy_from_user() states:

Some copy_from_user() implementations do not return the exact number of
bytes remaining to copy on a fault.  But copy_mount_options() requires that.
Note that this function differs from copy_from_user() in that it will oops
on bad values of `to', rather than returning a short copy.

  reply	other threads:[~2019-02-26 14:35 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-22 12:53 [PATCH v10 00/12] arm64: untag user pointers passed to the kernel Andrey Konovalov
2019-02-22 12:53 ` [PATCH v10 01/12] uaccess: add untagged_addr definition for other arches Andrey Konovalov
2019-02-22 12:53 ` [PATCH v10 02/12] arm64: untag user pointers in access_ok and __uaccess_mask_ptr Andrey Konovalov
2019-02-22 12:53 ` [PATCH v10 03/12] lib, arm64: untag user pointers in strn*_user Andrey Konovalov
2019-02-22 12:53 ` [PATCH v10 04/12] mm, arm64: untag user pointers passed to memory syscalls Andrey Konovalov
2019-02-22 23:07   ` Dave Hansen
2019-02-26 14:41     ` Andrey Konovalov
2019-02-22 12:53 ` [PATCH v10 05/12] mm, arm64: untag user pointers in mm/gup.c Andrey Konovalov
2019-02-22 12:53 ` [PATCH v10 06/12] fs, arm64: untag user pointers in copy_mount_options Andrey Konovalov
2019-02-22 23:03   ` Dave Hansen
2019-02-26 14:35     ` Andrey Konovalov [this message]
2019-02-22 12:53 ` [PATCH v10 07/12] fs, arm64: untag user pointers in fs/userfaultfd.c Andrey Konovalov
2019-02-22 23:05   ` Dave Hansen
2019-02-26 14:39     ` Andrey Konovalov
2019-03-01 16:59       ` Catalin Marinas
2019-03-01 18:37         ` Dave Hansen
2019-03-05 17:47           ` Andrey Konovalov
2019-02-22 12:53 ` [PATCH v10 08/12] net, arm64: untag user pointers in tcp_zerocopy_receive Andrey Konovalov
2019-02-22 12:53 ` [PATCH v10 09/12] kernel, arm64: untag user pointers in prctl_set_mm* Andrey Konovalov
2019-02-22 12:53 ` [PATCH v10 10/12] tracing, arm64: untag user pointers in seq_print_user_ip Andrey Konovalov
2019-02-22 12:53 ` [PATCH v10 11/12] arm64: update Documentation/arm64/tagged-pointers.txt Andrey Konovalov
2019-02-22 12:53 ` [PATCH v10 12/12] selftests, arm64: add a selftest for passing tagged pointers to kernel Andrey Konovalov
2019-02-22 15:35 ` [PATCH v10 00/12] arm64: untag user pointers passed to the kernel Szabolcs Nagy
2019-02-22 15:40   ` Andrey Konovalov
2019-02-22 16:10     ` Szabolcs Nagy
2019-02-26 17:00       ` Andrey Konovalov
2019-02-22 22:54 ` Dave Hansen
2019-02-26 17:18   ` Andrey Konovalov
2019-02-26 17:35     ` Dave Hansen
2019-02-26 23:17     ` Luc Van Oostenryck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAeHK+wLm7zSUC8dJv3LgdyvpkBN8u_24ene6b91PgM570VWbQ@mail.gmail.com \
    --to=andreyknvl@google.com \
    --cc=Dave.Martin@arm.com \
    --cc=Jacob.Bramley@arm.com \
    --cc=Lee.Smith@arm.com \
    --cc=Ramana.Radhakrishnan@arm.com \
    --cc=Ruben.Ayrapetyan@arm.com \
    --cc=Szabolcs.Nagy@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=cpandya@codeaurora.org \
    --cc=dave.hansen@intel.com \
    --cc=dvyukov@google.com \
    --cc=eugenis@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kcc@google.com \
    --cc=keescook@chromium.org \
    --cc=kevin.brodsky@arm.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luc.vanoostenryck@gmail.com \
    --cc=mark.rutland@arm.com \
    --cc=mingo@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=shuah@kernel.org \
    --cc=vincenzo.frascino@arm.com \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).