linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Will Drewry <wad@chromium.org>
To: Mel Gorman <mel@csn.ul.ie>
Cc: Roland McGrath <mcgrathr@google.com>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Al Viro <viro@zeniv.linux.org.uk>, Eric Paris <eparis@redhat.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Rik van Riel <riel@redhat.com>, Nitin Gupta <ngupta@vflare.org>,
	Hugh Dickins <hughd@google.com>,
	Shaohua Li <shaohua.li@intel.com>,
	linux-mm@kvack.org
Subject: Re: [PATCH] mmap: add sysctl for controlling ~VM_MAYEXEC taint
Date: Tue, 16 Aug 2011 14:50:27 -0500	[thread overview]
Message-ID: <CABqD9hba3PgTQjaWCmqQCgiaPnvdcOPd1VrQio-X-NY__T7HmA@mail.gmail.com> (raw)
In-Reply-To: <20110816194050.GB4484@csn.ul.ie>

On Tue, Aug 16, 2011 at 2:40 PM, Mel Gorman <mel@csn.ul.ie> wrote:
> On Tue, Aug 16, 2011 at 10:07:46AM -0700, Roland McGrath wrote:
>> On Tue, Aug 16, 2011 at 2:33 AM, Mel Gorman <mel@csn.ul.ie> wrote:
>> > Is using shm_open()+mmap instead of open()+mmap() to open a file on
>> > /dev/shm really that difficult?
>> >
>> > int shm_open(const char *name, int oflag, mode_t mode);
>> > int open(const char *pathname, int flags, mode_t mode);
>>
>> I cannot figure out the rationale behind this question at all.
>> Both of these library functions result in the same system call.
>>
>
> They might result in the same system call but one of them creates
> the file under /dev/shm which should not have the same permissions
> problem. The library really appears to want to create a shared
> executable object, using shm_open does not appear that unreasonable
> to me.

If /dev/shm is mounted noexec, the resulting file will have VM_MAYEXEC
stripped.  I don't believe it is capable of doing anything special
that will cause the mmap code path to find a different containing
mountpoint.  If it could, then that would certainly be preferable, but
it would also make this VM_MAYEXEC calculation less effective in the
default case.

thanks!

>> > An ordinary user is not going to know that a segfault from an
>> > application can be fixed with this sysctl. This looks like something
>> > that should be fixed in the library so that it can work on kernels
>> > that do not have the sysctl.
>>
>> I think the expectation is that the administrator or system builder
>> who decides to set the (non-default) noexec mount option will also
>> set the sysctl at the same time.
>>
>
> Which then needs to be copied in each distro wanting to do the same
> thing and is not backwards compatible where as using shm_open is.
>
> --
> Mel Gorman
> SUSE Labs
>

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2011-08-16 19:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-15 20:57 [PATCH] mmap: add sysctl for controlling ~VM_MAYEXEC taint Will Drewry
2011-08-16  9:33 ` Mel Gorman
2011-08-16 17:07   ` Roland McGrath
2011-08-16 19:40     ` Mel Gorman
2011-08-16 19:46       ` Roland McGrath
2011-08-16 19:50       ` Will Drewry [this message]
2011-08-16 19:50         ` Will Drewry
2011-08-17 23:22     ` Valdis.Kletnieks
2011-08-16 21:54 ` Andrew Morton
2011-08-16 22:35   ` Will Drewry

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=CABqD9hba3PgTQjaWCmqQCgiaPnvdcOPd1VrQio-X-NY__T7HmA@mail.gmail.com \
    --to=wad@chromium.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=eparis@redhat.com \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mcgrathr@google.com \
    --cc=mel@csn.ul.ie \
    --cc=mingo@elte.hu \
    --cc=ngupta@vflare.org \
    --cc=riel@redhat.com \
    --cc=shaohua.li@intel.com \
    --cc=viro@zeniv.linux.org.uk \
    /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).