All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Emelyanov <xemul@parallels.com>
To: David Herrmann <dh.herrmann@gmail.com>
Cc: "Cyrill Gorcunov" <gorcunov@gmail.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	"Hugh Dickins" <hughd@google.com>,
	"Alexander Viro" <viro@zeniv.linux.org.uk>,
	"Karol Lewandowski" <k.lewandowsk@samsung.com>,
	"Kay Sievers" <kay@vrfy.org>, "Daniel Mack" <zonque@gmail.com>,
	"Lennart Poettering" <lennart@poettering.net>,
	"Kristian Høgsberg" <krh@bitplanet.net>,
	"John Stultz" <john.stultz@linaro.org>,
	"Greg Kroah-Hartman" <greg@kroah.com>,
	"Tejun Heo" <tj@kernel.org>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	"Ryan Lortie" <desrt@desrt.ca>,
	"Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
Subject: Re: [PATCH 3/6] shm: add memfd_create() syscall
Date: Thu, 20 Mar 2014 15:50:30 +0400	[thread overview]
Message-ID: <532AD606.40406@parallels.com> (raw)
In-Reply-To: <CANq1E4SLp5Smxf3VbjT0hq0UrWWDf0RxudbQTA1G=sW1ecQk-g@mail.gmail.com>

On 03/20/2014 03:29 PM, David Herrmann wrote:
> Hi
> 
> On Thu, Mar 20, 2014 at 10:01 AM, Pavel Emelyanov <xemul@parallels.com> wrote:
>> On 03/20/2014 12:47 PM, Cyrill Gorcunov wrote:
>>> If I'm not mistaken in something obvious, this looks similar to /proc/pid/map_files
>>> feature, Pavel?
>>
>> It is, but the map_files will work "in the opposite direction" :) In the memfd
>> case one first gets an FD, then mmap()s it; in the /proc/pis/map_files case one
>> should first mmap() a region, then open it via /proc/self/map_files.
>>
>> But I don't know whether this matters.
> 
> Yes, you can replace memfd_create() so far with:
>   p = mmap(NULL, size, ..., MAP_ANON | MAP_SHARED, -1, 0);
>   sprintf(path, "/proc/self/map_files/%lx-%lx", p, p + size);
>   fd = open(path, O_RDWR);
> 
> However, map_files is only enabled with CONFIG_CHECKPOINT_RESTORE, the
> /proc/pid/map_files/ directory is root-only (at least I get EPERM if
> non-root),

Yes. But this is something we'd also like to have fixed :) Having two
parties willing the same makes it easier for the patch to get accepted.

> it doesn't provide the "name" argument which is very handy
> for debugging,

What if we make mmap's shmem_zero_setup() generate a meaningful name,
would it solve the debugging issue?

> it doesn't explicitly support sealing (it requires MAP_ANON to be backed 
> by shmem)

Can you elaborate on this? The fd generated by sys_memfd() will be
shmem-backed, so will be the file opened via map_files link for the
MAP_ANON | MAP_SHARED mapping. So what are the problems to make it
support sealing?

> and it's a very weird API for something this simple.

:)

Thanks,
Pavel

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Pavel Emelyanov <xemul@parallels.com>
To: David Herrmann <dh.herrmann@gmail.com>
Cc: "Cyrill Gorcunov" <gorcunov@gmail.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	"Hugh Dickins" <hughd@google.com>,
	"Alexander Viro" <viro@zeniv.linux.org.uk>,
	"Karol Lewandowski" <k.lewandowsk@samsung.com>,
	"Kay Sievers" <kay@vrfy.org>, "Daniel Mack" <zonque@gmail.com>,
	"Lennart Poettering" <lennart@poettering.net>,
	"Kristian Høgsberg" <krh@bitplanet.net>,
	"John Stultz" <john.stultz@linaro.org>,
	"Greg Kroah-Hartman" <greg@kroah.com>,
	"Tejun Heo" <tj@kernel.org>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	"Ryan Lortie" <desrt@desrt.ca>,
	"Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
Subject: Re: [PATCH 3/6] shm: add memfd_create() syscall
Date: Thu, 20 Mar 2014 15:50:30 +0400	[thread overview]
Message-ID: <532AD606.40406@parallels.com> (raw)
In-Reply-To: <CANq1E4SLp5Smxf3VbjT0hq0UrWWDf0RxudbQTA1G=sW1ecQk-g@mail.gmail.com>

On 03/20/2014 03:29 PM, David Herrmann wrote:
> Hi
> 
> On Thu, Mar 20, 2014 at 10:01 AM, Pavel Emelyanov <xemul@parallels.com> wrote:
>> On 03/20/2014 12:47 PM, Cyrill Gorcunov wrote:
>>> If I'm not mistaken in something obvious, this looks similar to /proc/pid/map_files
>>> feature, Pavel?
>>
>> It is, but the map_files will work "in the opposite direction" :) In the memfd
>> case one first gets an FD, then mmap()s it; in the /proc/pis/map_files case one
>> should first mmap() a region, then open it via /proc/self/map_files.
>>
>> But I don't know whether this matters.
> 
> Yes, you can replace memfd_create() so far with:
>   p = mmap(NULL, size, ..., MAP_ANON | MAP_SHARED, -1, 0);
>   sprintf(path, "/proc/self/map_files/%lx-%lx", p, p + size);
>   fd = open(path, O_RDWR);
> 
> However, map_files is only enabled with CONFIG_CHECKPOINT_RESTORE, the
> /proc/pid/map_files/ directory is root-only (at least I get EPERM if
> non-root),

Yes. But this is something we'd also like to have fixed :) Having two
parties willing the same makes it easier for the patch to get accepted.

> it doesn't provide the "name" argument which is very handy
> for debugging,

What if we make mmap's shmem_zero_setup() generate a meaningful name,
would it solve the debugging issue?

> it doesn't explicitly support sealing (it requires MAP_ANON to be backed 
> by shmem)

Can you elaborate on this? The fd generated by sys_memfd() will be
shmem-backed, so will be the file opened via map_files link for the
MAP_ANON | MAP_SHARED mapping. So what are the problems to make it
support sealing?

> and it's a very weird API for something this simple.

:)

Thanks,
Pavel

  reply	other threads:[~2014-03-20 11:50 UTC|newest]

Thread overview: 123+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-19 19:06 [PATCH 0/6] File Sealing & memfd_create() David Herrmann
2014-03-19 19:06 ` David Herrmann
2014-03-19 19:06 ` David Herrmann
2014-03-19 19:06 ` David Herrmann
2014-03-19 19:06 ` [PATCH 1/6] fs: fix i_writecount on shmem and friends David Herrmann
2014-03-19 19:06   ` David Herrmann
2014-03-19 19:06   ` David Herrmann
2014-03-19 19:06   ` David Herrmann
2014-03-19 19:06 ` [PATCH 2/6] shm: add sealing API David Herrmann
2014-03-19 19:06   ` David Herrmann
2014-03-19 19:06   ` David Herrmann
2014-03-19 19:06   ` David Herrmann
2014-03-19 19:06 ` [PATCH 3/6] shm: add memfd_create() syscall David Herrmann
2014-03-19 19:06   ` David Herrmann
2014-03-19 19:06   ` David Herrmann
2014-03-19 19:06   ` David Herrmann
2014-03-20  8:47   ` Cyrill Gorcunov
2014-03-20  8:47     ` Cyrill Gorcunov
2014-03-20  9:01     ` Pavel Emelyanov
2014-03-20  9:01       ` Pavel Emelyanov
2014-03-20 11:29       ` David Herrmann
2014-03-20 11:29         ` David Herrmann
2014-03-20 11:29         ` David Herrmann
2014-03-20 11:29         ` David Herrmann
2014-03-20 11:50         ` Pavel Emelyanov [this message]
2014-03-20 11:50           ` Pavel Emelyanov
2014-03-20 19:22   ` John Stultz
2014-03-20 19:22     ` John Stultz
2014-04-02 13:38   ` Konstantin Khlebnikov
2014-04-02 13:38     ` Konstantin Khlebnikov
2014-04-02 14:18     ` David Herrmann
2014-04-02 14:18       ` David Herrmann
2014-04-02 14:52       ` Konstantin Khlebnikov
2014-04-02 14:52         ` Konstantin Khlebnikov
2014-04-02 14:52         ` Konstantin Khlebnikov
2014-04-10 19:07     ` Andy Lutomirski
2014-04-10 19:07       ` Andy Lutomirski
2014-03-19 19:06 ` [PATCH 4/6] selftests: add memfd_create() + sealing tests David Herrmann
2014-03-19 19:06   ` David Herrmann
2014-03-19 19:06 ` [PATCH man-pages 5/6] fcntl.2: document SHMEM_SET/GET_SEALS commands David Herrmann
2014-03-19 19:06   ` David Herrmann
2014-03-19 19:06   ` David Herrmann
2014-03-19 19:06   ` David Herrmann
2014-03-19 19:06 ` [PATCH man-pages 6/6] memfd_create.2: add memfd_create() man-page David Herrmann
2014-03-19 19:06   ` David Herrmann
2014-03-19 19:06   ` David Herrmann
2014-03-19 19:06   ` David Herrmann
2014-03-20  2:55 ` [PATCH 0/6] File Sealing & memfd_create() Greg Kroah-Hartman
2014-03-20  2:55   ` Greg Kroah-Hartman
2014-03-20  2:55   ` Greg Kroah-Hartman
2014-03-20  2:55   ` Greg Kroah-Hartman
2014-03-20  3:49 ` Linus Torvalds
2014-03-20  3:49   ` Linus Torvalds
2014-03-20  8:07   ` David Herrmann
2014-03-20  8:07     ` David Herrmann
2014-03-20  8:07     ` David Herrmann
2014-03-20  8:07     ` David Herrmann
2014-03-20 14:41     ` One Thousand Gnomes
2014-03-20 14:41       ` One Thousand Gnomes
2014-03-20 14:41       ` One Thousand Gnomes
2014-03-20 15:12       ` David Herrmann
2014-03-20 15:12         ` David Herrmann
2014-03-20 15:12         ` David Herrmann
2014-03-20 15:12         ` David Herrmann
2014-03-20 15:26         ` One Thousand Gnomes
2014-03-20 15:26           ` One Thousand Gnomes
2014-03-20 15:26           ` One Thousand Gnomes
2014-03-20 15:32 ` tytso
2014-03-20 15:32   ` tytso
2014-03-20 15:39   ` One Thousand Gnomes
2014-03-20 15:48   ` David Herrmann
2014-03-20 15:48     ` David Herrmann
2014-03-20 16:38     ` tytso
2014-03-20 16:38       ` tytso
2014-04-10 19:14       ` Andy Lutomirski
2014-04-10 19:14         ` Andy Lutomirski
2014-04-10 20:32         ` Theodore Ts'o
2014-04-10 20:32           ` Theodore Ts'o
2014-04-10 20:37           ` Andy Lutomirski
2014-04-10 20:37             ` Andy Lutomirski
2014-04-10 20:49             ` David Herrmann
2014-04-10 20:49               ` David Herrmann
2014-04-10 21:16               ` Andy Lutomirski
2014-04-10 21:16                 ` Andy Lutomirski
2014-04-10 22:57                 ` David Herrmann
2014-04-10 22:57                   ` David Herrmann
2014-04-10 22:57                   ` David Herrmann
2014-04-10 22:57                   ` David Herrmann
2014-04-10 23:05                   ` Andy Lutomirski
2014-04-10 23:05                     ` Andy Lutomirski
2014-04-10 23:16                     ` David Herrmann
2014-04-10 23:16                       ` David Herrmann
2014-04-10 23:32                       ` Andy Lutomirski
2014-04-10 23:32                         ` Andy Lutomirski
2014-04-20 15:03             ` Pavel Machek
2014-04-20 15:03               ` Pavel Machek
2014-06-17  9:48             ` Florian Weimer
2014-06-17  9:48               ` Florian Weimer
2014-06-17  9:48               ` Florian Weimer
2014-06-17  9:48               ` Florian Weimer
2014-06-17 16:21               ` Andy Lutomirski
2014-04-10 14:45   ` Colin Walters
2014-04-10 14:45     ` Colin Walters
2014-04-10 19:15     ` Andy Lutomirski
2014-04-10 19:15       ` Andy Lutomirski
2014-04-10 19:45       ` Colin Walters
2014-04-10 19:45         ` Colin Walters
2014-04-11  6:09         ` Alex Elsayed
2014-04-11  6:09           ` Alex Elsayed
2014-04-08 13:00 ` Florian Weimer
2014-04-08 13:00   ` Florian Weimer
2014-04-09 21:31   ` David Herrmann
2014-04-09 21:31     ` David Herrmann
2014-04-22  9:10     ` Florian Weimer
2014-04-22  9:10       ` Florian Weimer
2014-04-22 11:55       ` David Herrmann
2014-04-22 11:55         ` David Herrmann
2014-04-22 12:44         ` Florian Weimer
2014-04-22 12:44           ` Florian Weimer
2014-04-22 12:55           ` David Herrmann
2014-04-22 12:55             ` David Herrmann
2014-04-10 19:17   ` Andy Lutomirski
2014-04-10 19:17     ` Andy Lutomirski

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=532AD606.40406@parallels.com \
    --to=xemul@parallels.com \
    --cc=akpm@linux-foundation.org \
    --cc=desrt@desrt.ca \
    --cc=dh.herrmann@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gorcunov@gmail.com \
    --cc=greg@kroah.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=john.stultz@linaro.org \
    --cc=k.lewandowsk@samsung.com \
    --cc=kay@vrfy.org \
    --cc=krh@bitplanet.net \
    --cc=lennart@poettering.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mtk.manpages@gmail.com \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=zonque@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.