[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANq1E4SLp5Smxf3VbjT0hq0UrWWDf0RxudbQTA1G=sW1ecQk-g@mail.gmail.com>
Date: Thu, 20 Mar 2014 12:29:54 +0100
From: David Herrmann <dh.herrmann@...il.com>
To: Pavel Emelyanov <xemul@...allels.com>
Cc: Cyrill Gorcunov <gorcunov@...il.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
Hugh Dickins <hughd@...gle.com>,
Alexander Viro <viro@...iv.linux.org.uk>,
Karol Lewandowski <k.lewandowsk@...sung.com>,
Kay Sievers <kay@...y.org>, Daniel Mack <zonque@...il.com>,
Lennart Poettering <lennart@...ttering.net>,
Kristian Høgsberg <krh@...planet.net>,
John Stultz <john.stultz@...aro.org>,
Greg Kroah-Hartman <greg@...ah.com>, Tejun Heo <tj@...nel.org>,
Johannes Weiner <hannes@...xchg.org>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
linux-mm <linux-mm@...ck.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Ryan Lortie <desrt@...rt.ca>,
"Michael Kerrisk (man-pages)" <mtk.manpages@...il.com>
Subject: Re: [PATCH 3/6] shm: add memfd_create() syscall
Hi
On Thu, Mar 20, 2014 at 10:01 AM, Pavel Emelyanov <xemul@...allels.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), it doesn't provide the "name" argument which is very handy
for debugging, it doesn't explicitly support sealing (it requires
MAP_ANON to be backed by shmem) and it's a very weird API for
something this simple.
Thanks
David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists