From: Arnd Bergmann <arnd@arndb.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: Minchan Kim <minchan@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
Christian Brauner <christian.brauner@ubuntu.com>,
linux-mm <linux-mm@kvack.org>,
Linux API <linux-api@vger.kernel.org>,
Oleksandr Natalenko <oleksandr@redhat.com>,
Suren Baghdasaryan <surenb@google.com>,
Tim Murray <timmurray@google.com>,
Sandeep Patil <sspatil@google.com>,
Sonny Rao <sonnyrao@google.com>,
Brian Geffon <bgeffon@google.com>, Michal Hocko <mhocko@suse.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Shakeel Butt <shakeelb@google.com>,
John Dias <joaodias@google.com>,
Joel Fernandes <joel@joelfernandes.org>,
Jann Horn <jannh@google.com>,
alexander.h.duyck@linux.intel.com,
SeongJae Park <sj38.park@gmail.com>,
David Rientjes <rientjes@google.com>,
Arjun Roy <arjunroy@google.com>, Vlastimil Babka <vbabka@suse.cz>,
Christian Brauner <christian@brauner.io>,
Daniel Colascione <dancol@google.com>,
Kirill Tkhai <ktkhai@virtuozzo.com>,
SeongJae Park <sjpark@amazon.de>,
linux-man <linux-man@vger.kernel.org>
Subject: Re: [PATCH v8 3/4] mm/madvise: introduce process_madvise() syscall: an external memory hinting API
Date: Fri, 28 Aug 2020 22:15:24 +0200 [thread overview]
Message-ID: <CAK8P3a0rWjvSTDO_p7mKDv24OcdnWvMaM+_pHPEDGZGwn5BG=Q@mail.gmail.com> (raw)
In-Reply-To: <ffe549f6-bed5-07f9-43a7-ec8cc12ab59d@kernel.dk>
On Fri, Aug 28, 2020 at 9:27 PM Jens Axboe <axboe@kernel.dk> wrote:
> On 8/28/20 12:24 PM, Jens Axboe wrote:
> >> @@ -1683,8 +1683,13 @@ ssize_t import_iovec(int type, const struct
> >> iovec __user * uvector,
> >> {
> >> ssize_t n;
> >> struct iovec *p;
> >> - n = rw_copy_check_uvector(type, uvector, nr_segs, fast_segs,
> >> - *iov, &p);
> >> +
> >> + if (in_compat_syscall())
> >> + n = compat_rw_copy_check_uvector(type, uvector, nr_segs,
> >> + fast_segs, *iov, &p);
> >> + else
> >> + n = rw_copy_check_uvector(type, uvector, nr_segs,
> >> + fast_segs, *iov, &p);
> >> if (n < 0) {
> >> if (p != *iov)
> >> kfree(p);
> >
> > Doesn't work for the async case, where you want to be holding on to the
> > allocated iovec. But in general I think it's a good helper for the sync
> > case, which is by far the majority.
>
> Nevermind, I'm an idiot for reading this totally wrong.
>
I think you are right about the need to pick the compat vs native
behavior based on req->ctx->compat instead of in_compat_syscall()
inside of io_import_iovec().
That one can probably call a lower-level version and when all other
callers get changed to calling
ssize_t import_iovec(int type, const struct iovec __user * uvector,
unsigned nr_segs, unsigned fast_segs,
struct iovec **iov, struct iov_iter *i)
{
return __import_iovec(type, uvector, nr_segs, fast_segs, iov,
i, in_compat_syscall());
}
Arnd
next prev parent reply other threads:[~2020-08-28 20:15 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-22 19:28 [PATCH v8 0/4] introduce memory hinting API for external process Minchan Kim
2020-06-22 19:28 ` [PATCH v8 1/4] mm/madvise: pass task and mm to do_madvise Minchan Kim
2020-06-24 20:00 ` David Rientjes
2020-06-22 19:28 ` [PATCH v8 2/4] pid: move pidfd_get_pid() to pid.c Minchan Kim
2020-06-24 20:00 ` David Rientjes
2020-06-22 19:28 ` [PATCH v8 3/4] mm/madvise: introduce process_madvise() syscall: an external memory hinting API Minchan Kim
2020-06-24 20:00 ` David Rientjes
2020-06-25 20:38 ` Minchan Kim
2020-08-28 17:40 ` Arnd Bergmann
2020-08-28 18:24 ` Jens Axboe
2020-08-28 18:25 ` Christian Brauner
2020-08-28 19:04 ` Minchan Kim
2020-08-28 19:26 ` Jens Axboe
2020-08-28 20:15 ` Arnd Bergmann [this message]
2020-08-29 7:02 ` Christoph Hellwig
2020-06-22 19:29 ` [PATCH v8 4/4] mm/madvise: check fatal signal pending of target process Minchan Kim
2020-06-24 20:00 ` David Rientjes
2020-06-22 19:36 ` [PATCH v8 0/4] introduce memory hinting API for external process Minchan Kim
2020-06-23 8:59 ` Oleksandr Natalenko
2020-06-23 9:07 ` Oleksandr Natalenko
2020-06-24 1:31 ` Minchan Kim
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='CAK8P3a0rWjvSTDO_p7mKDv24OcdnWvMaM+_pHPEDGZGwn5BG=Q@mail.gmail.com' \
--to=arnd@arndb.de \
--cc=akpm@linux-foundation.org \
--cc=alexander.h.duyck@linux.intel.com \
--cc=arjunroy@google.com \
--cc=axboe@kernel.dk \
--cc=bgeffon@google.com \
--cc=christian.brauner@ubuntu.com \
--cc=christian@brauner.io \
--cc=dancol@google.com \
--cc=hannes@cmpxchg.org \
--cc=jannh@google.com \
--cc=joaodias@google.com \
--cc=joel@joelfernandes.org \
--cc=ktkhai@virtuozzo.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-man@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=minchan@kernel.org \
--cc=oleksandr@redhat.com \
--cc=rientjes@google.com \
--cc=shakeelb@google.com \
--cc=sj38.park@gmail.com \
--cc=sjpark@amazon.de \
--cc=sonnyrao@google.com \
--cc=sspatil@google.com \
--cc=surenb@google.com \
--cc=timmurray@google.com \
--cc=vbabka@suse.cz \
/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).