linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
To: Rich Felker <dalias@aerifal.cx>
Cc: Christoph Hellwig <hch@infradead.org>,
	Colin Cross <ccross@google.com>,
	lkml <linux-kernel@vger.kernel.org>,
	Linux-MM <linux-mm@kvack.org>,
	Android Kernel Team <kernel-team@android.com>,
	John Stultz <john.stultz@linaro.org>,
	libc-alpha <libc-alpha@sourceware.org>
Subject: Re: RFC: named anonymous vmas
Date: Sat, 3 Aug 2013 19:54:38 -0400	[thread overview]
Message-ID: <CAHGf_=pY=ap-T3R0bK4675THvGikzH1KpMbEz3==_EwPBkebRQ@mail.gmail.com> (raw)
In-Reply-To: <20130801083608.GJ221@brightrain.aerifal.cx>

On Thu, Aug 1, 2013 at 4:36 AM, Rich Felker <dalias@aerifal.cx> wrote:
> On Thu, Aug 01, 2013 at 01:29:51AM -0700, Christoph Hellwig wrote:
>> Btw, FreeBSD has an extension to shm_open to create unnamed but fd
>> passable segments.  From their man page:
>>
>>     As a FreeBSD extension, the constant SHM_ANON may be used for the path
>>     argument to shm_open().  In this case, an anonymous, unnamed shared
>>     memory object is created.  Since the object has no name, it cannot be
>>     removed via a subsequent call to shm_unlink().  Instead, the shared
>>     memory object will be garbage collected when the last reference to the
>>     shared memory object is removed.  The shared memory object may be shared
>>     with other processes by sharing the file descriptor via fork(2) or
>>     sendmsg(2).  Attempting to open an anonymous shared memory object with
>>     O_RDONLY will fail with EINVAL. All other flags are ignored.
>>
>> To me this sounds like the best way to expose this functionality to the
>> user.  Implementing it is another question as shm_open sits in libc,
>> we could either take it and shm_unlink to the kernel, or use O_TMPFILE
>> on tmpfs as the backend.
>
> I'm not sure what the purpose is. shm_open with a long random filename
> and O_EXCL|O_CREAT, followed immediately by shm_unlink, is just as
> good except in the case where you have a malicious user killing the
> process in between these two operations.

Practically, filename length is restricted by NAME_MAX(255bytes). Several
people don't think it is enough long length. The point is, race free API.

--
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>

  parent reply	other threads:[~2013-08-03 23:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-21 23:42 Colin Cross
2013-06-22  5:12 ` Kyungmin Park
2013-06-22  5:20   ` Colin Cross
2013-06-22 10:31 ` Christoph Hellwig
2013-06-22 17:30   ` Colin Cross
2013-06-22 19:47     ` Alex Elsayed
2013-06-24 11:48       ` Christoph Hellwig
2013-06-24 17:26         ` Colin Cross
2013-06-24 23:45           ` John Stultz
2013-06-26 18:53           ` Alex Elsayed
2013-07-14  0:57         ` Sam Ben
2013-08-01  8:29     ` Christoph Hellwig
2013-08-01  8:36       ` Rich Felker
2013-08-02 15:11         ` Christoph Hellwig
2013-08-03 23:54         ` KOSAKI Motohiro [this message]
2013-07-14  0:27 ` Sam Ben

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='CAHGf_=pY=ap-T3R0bK4675THvGikzH1KpMbEz3==_EwPBkebRQ@mail.gmail.com' \
    --to=kosaki.motohiro@gmail.com \
    --cc=ccross@google.com \
    --cc=dalias@aerifal.cx \
    --cc=hch@infradead.org \
    --cc=john.stultz@linaro.org \
    --cc=kernel-team@android.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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