linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Andrey Konovalov <andreyknvl@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Will Deacon <will.deacon@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Kees Cook <keescook@chromium.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>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Eric Dumazet <edumazet@google.com>,
	"David S. Miller" <davem@davemloft.net>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Peter Zijlstra <peterz@infradead.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Jens Wiklander <jens.wiklander@linaro.org>,
	Alex Williamson <alex.williamson@redhat.com>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Linux Memory Management List <linux-mm@kvack.org>,
	linux-arch <linux-arch@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>,
	Ruben Ayrapetyan <Ruben.Ayrapetyan@arm.com>,
	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 v13 04/20] mm, arm64: untag user pointers passed to memory syscalls
Date: Fri, 26 Apr 2019 15:17:42 +0100	[thread overview]
Message-ID: <20190426141742.GB54863@arrakis.emea.arm.com> (raw)
In-Reply-To: <CAAeHK+xe-zWn8WpCxUxBB2tXL8oiLkshkPi1J3Ly87mACaA4-A@mail.gmail.com>

On Tue, Apr 02, 2019 at 02:47:34PM +0200, Andrey Konovalov wrote:
> On Fri, Mar 29, 2019 at 11:30 AM Catalin Marinas
> <catalin.marinas@arm.com> wrote:
> > On Thu, Mar 28, 2019 at 02:19:34PM -0400, Steven Rostedt wrote:
> > > On Thu, 28 Mar 2019 19:10:07 +0100
> > > Andrey Konovalov <andreyknvl@google.com> wrote:
> > >
> > > > > > Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
> > > > > > ---
> > > > > >  ipc/shm.c      | 2 ++
> > > > > >  mm/madvise.c   | 2 ++
> > > > > >  mm/mempolicy.c | 5 +++++
> > > > > >  mm/migrate.c   | 1 +
> > > > > >  mm/mincore.c   | 2 ++
> > > > > >  mm/mlock.c     | 5 +++++
> > > > > >  mm/mmap.c      | 7 +++++++
> > > > > >  mm/mprotect.c  | 1 +
> > > > > >  mm/mremap.c    | 2 ++
> > > > > >  mm/msync.c     | 2 ++
> > > > > >  10 files changed, 29 insertions(+)
> > > > >
> > > > > I wonder whether it's better to keep these as wrappers in the arm64
> > > > > code.
> > > >
> > > > I don't think I understand what you propose, could you elaborate?
> > >
> > > I believe Catalin is saying that instead of placing things like:
> > >
> > > @@ -1593,6 +1593,7 @@ SYSCALL_DEFINE3(shmat, int, shmid, char __user *, shmaddr, int, shmflg)
> > >       unsigned long ret;
> > >       long err;
> > >
> > > +     shmaddr = untagged_addr(shmaddr);
> > >
> > > To instead have the shmaddr set to the untagged_addr() before calling
> > > the system call, and passing the untagged addr to the system call, as
> > > that goes through the arm64 architecture specific code first.
> >
> > Indeed. For example, we already have a SYSCALL_DEFINE6(mmap, ...) in
> > arch/arm64/kernel/sys.c, just add the untagging there. We could do
> > something similar for the other syscalls. I don't mind doing this in the
> > generic code but if it's only needed for arm64, I'd rather keep the
> > generic changes to a minimum.
> 
> Do I understand correctly, that I'll need to add ksys_ wrappers for
> each of the memory syscalls, and then redefine them in
> arch/arm64/kernel/sys.c with arm64_ prefix, like it is done for the
> personality syscall right now? This will require generic changes as
> well.

Yes. My aim is to keep the number of untagged_addr() calls in the
generic code to a minimum (rather than just keeping the generic code
changes small).

-- 
Catalin


  parent reply	other threads:[~2019-04-26 14:17 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-20 14:51 [PATCH v13 00/20] arm64: untag user pointers passed to the kernel Andrey Konovalov
2019-03-20 14:51 ` [PATCH v13 01/20] uaccess: add untagged_addr definition for other arches Andrey Konovalov
2019-03-20 14:51 ` [PATCH v13 02/20] arm64: untag user pointers in access_ok and __uaccess_mask_ptr Andrey Konovalov
2019-03-20 14:51 ` [PATCH v13 03/20] lib, arm64: untag user pointers in strn*_user Andrey Konovalov
2019-03-20 14:51 ` [PATCH v13 04/20] mm, arm64: untag user pointers passed to memory syscalls Andrey Konovalov
2019-03-22 11:43   ` Catalin Marinas
2019-03-28 18:10     ` Andrey Konovalov
2019-03-28 18:19       ` Steven Rostedt
2019-03-29 10:30         ` Catalin Marinas
2019-04-02 12:47           ` Andrey Konovalov
2019-04-11 16:40             ` Andrey Konovalov
2019-04-26 14:17             ` Catalin Marinas [this message]
2019-04-29 14:22               ` Andrey Konovalov
2019-03-20 14:51 ` [PATCH v13 05/20] mm, arm64: untag user pointers in mm/gup.c Andrey Konovalov
2019-03-20 14:51 ` [PATCH v13 06/20] mm, arm64: untag user pointers in get_vaddr_frames Andrey Konovalov
2019-03-20 14:51 ` [PATCH v13 07/20] fs, arm64: untag user pointers in copy_mount_options Andrey Konovalov
2019-03-20 14:51 ` [PATCH v13 08/20] fs, arm64: untag user pointers in fs/userfaultfd.c Andrey Konovalov
2019-03-20 14:51 ` [PATCH v13 09/20] net, arm64: untag user pointers in tcp_zerocopy_receive Andrey Konovalov
2019-03-22 12:04   ` Catalin Marinas
2019-03-25 13:54     ` Kevin Brodsky
2019-04-01 16:04       ` Andrey Konovalov
2019-03-20 14:51 ` [PATCH v13 10/20] kernel, arm64: untag user pointers in prctl_set_mm* Andrey Konovalov
2019-03-21 17:52   ` Kevin Brodsky
2019-03-22 15:41   ` Catalin Marinas
2019-04-01 16:44     ` Andrey Konovalov
2019-04-11 16:40       ` Andrey Konovalov
2019-04-26 14:50       ` Catalin Marinas
2019-04-29 14:23         ` Andrey Konovalov
2019-05-01 14:43           ` Vincenzo Frascino
2019-03-20 14:51 ` [PATCH v13 11/20] tracing, arm64: untag user pointers in seq_print_user_ip Andrey Konovalov
2019-03-22 15:45   ` Catalin Marinas
2019-04-01 15:38     ` Andrey Konovalov
2019-03-20 14:51 ` [PATCH v13 12/20] uprobes, arm64: untag user pointers in find_active_uprobe Andrey Konovalov
2019-03-22 15:46   ` Catalin Marinas
2019-03-20 14:51 ` [PATCH v13 13/20] bpf, arm64: untag user pointers in stack_map_get_build_id_offset Andrey Konovalov
2019-03-22 15:52   ` Catalin Marinas
2019-04-01 16:00     ` Andrey Konovalov
2019-03-20 14:51 ` [PATCH v13 14/20] drm/amdgpu, arm64: untag user pointers in amdgpu_ttm_tt_get_user_pages Andrey Konovalov
2019-03-22 15:59   ` Catalin Marinas
2019-03-25 14:02     ` Kevin Brodsky
2019-03-25 22:21   ` Kuehling, Felix
2019-04-02 14:37     ` Andrey Konovalov
2019-04-02 17:52       ` Kuehling, Felix
2019-03-20 14:51 ` [PATCH v13 15/20] drm/radeon, arm64: untag user pointers in radeon_ttm_tt_pin_userptr Andrey Konovalov
2019-03-22 16:00   ` Catalin Marinas
2019-04-02 14:17     ` Andrey Konovalov
2019-03-20 14:51 ` [PATCH v13 16/20] IB/mlx4, arm64: untag user pointers in mlx4_get_umem_mr Andrey Konovalov
2019-04-29 18:09   ` Leon Romanovsky
2019-04-30 11:16     ` Catalin Marinas
2019-04-30 12:03       ` Leon Romanovsky
2019-05-02 18:44       ` Jason Gunthorpe
2019-05-03 16:28         ` Catalin Marinas
2019-05-03 23:52           ` Jason Gunthorpe
2019-03-20 14:51 ` [PATCH v13 17/20] media/v4l2-core, arm64: untag user pointers in videobuf_dma_contig_user_get Andrey Konovalov
2019-03-22 16:07   ` Catalin Marinas
2019-03-25 14:08     ` Kevin Brodsky
2019-04-01 16:13       ` Andrey Konovalov
2019-03-20 14:51 ` [PATCH v13 18/20] tee/optee, arm64: untag user pointers in check_mem_type Andrey Konovalov
2019-03-22 16:22   ` Catalin Marinas
2019-04-01 16:31     ` Andrey Konovalov
2019-03-20 14:51 ` [PATCH v13 19/20] vfio/type1, arm64: untag user pointers in vaddr_get_pfn Andrey Konovalov
2019-03-20 14:51 ` [PATCH v13 20/20] selftests, arm64: add a selftest for passing tagged pointers to kernel Andrey Konovalov

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=20190426141742.GB54863@arrakis.emea.arm.com \
    --to=catalin.marinas@arm.com \
    --cc=Dave.Martin@arm.com \
    --cc=Lee.Smith@arm.com \
    --cc=Ramana.Radhakrishnan@arm.com \
    --cc=Ruben.Ayrapetyan@arm.com \
    --cc=Szabolcs.Nagy@arm.com \
    --cc=acme@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=alex.williamson@redhat.com \
    --cc=andreyknvl@google.com \
    --cc=ast@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dvyukov@google.com \
    --cc=edumazet@google.com \
    --cc=eugenis@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jens.wiklander@linaro.org \
    --cc=kcc@google.com \
    --cc=keescook@chromium.org \
    --cc=kevin.brodsky@arm.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luc.vanoostenryck@gmail.com \
    --cc=mark.rutland@arm.com \
    --cc=mchehab@kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.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).