linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josh Triplett <josh@joshtriplett.org>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Palmer Dabbelt <palmer@dabbelt.com>,
	arnd@arndb.de, dhowells@redhat.com, viro@zeniv.linux.org.uk,
	ast@plumgrid.com, aishchuk@linux.vnet.ibm.com,
	aarcange@redhat.com, akpm@linux-foundation.org, luto@kernel.org,
	acme@kernel.org, bhe@redhat.com, 3chas3@gmail.com,
	chris@zankel.net, dave@sr71.net, dyoung@redhat.com,
	drysdale@google.com, davem@davemloft.net, ebiederm@xmission.com,
	geoff@infradead.org, gregkh@linuxfoundation.org, hpa@zytor.com,
	mingo@kernel.org, iulia.manda21@gmail.com, plagnioj@jcrosoft.com,
	jikos@kernel.org, kexec@lists.infradead.org,
	linux-api@vger.kernel.org, linux-arch@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-xtensa@linux-xtensa.org, mathieu.desnoyers@efficios.com,
	jcmvbkbc@gmail.com, paulmck@linux.vnet.ibm.com,
	a.p.zijlstra@chello.nl, tglx@linutronix.de,
	tomi.valkeinen@ti.com, vgoyal@redhat.com, x86@kernel.org
Subject: Re: [PATCH 04/13] Always expose MAP_UNINITIALIZED to userspace
Date: Mon, 14 Sep 2015 22:19:19 -0700	[thread overview]
Message-ID: <20150915051919.GB4091@x> (raw)
In-Reply-To: <20150915002358.GA12618@node.dhcp.inet.fi>

On Tue, Sep 15, 2015 at 03:23:58AM +0300, Kirill A. Shutemov wrote:
> On Mon, Sep 14, 2015 at 03:50:38PM -0700, Palmer Dabbelt wrote:
> > This used to be hidden behind CONFIG_MMAP_ALLOW_UNINITIALIZED, so
> > userspace wouldn't actually ever see it be non-zero.  While I could
> > have kept hiding it, the man pages seem to indicate that
> > MAP_UNINITIALIZED should be visible:
> > 
> >   mmap(2)
> >   MAP_UNINITIALIZED (since Linux 2.6.33)
> >     Don't clear anonymous pages.  This flag is intended to improve
> >     performance on embedded devices.  This flag is honored only if the
> >     kernel was configured with the CONFIG_MMAP_ALLOW_UNINITIALIZED
> >     option.  Because of the security implications, that option is
> >     normally enabled only on embedded devices (i.e., devices where one
> >     has complete control of the contents of user memory).
> > 
> > and since the only time it shows up in my /usr/include is in this
> > header I believe this should have been visible to userspace (as
> > non-zero, which wouldn't do anything when or'd into the flags) all
> > along.
> 
> Are you sure about "wouldn't do anything"?
> Suspiciously, 0x4000000 is also (1 << MAP_HUGE_SHIFT). I'm not sure if any
> architecture has order-1 huge pages, but still looks like we have conflict
> here.
> 
> I think it's harmful to expose non-zero MAP_UNINITIALIZED to system which
> potentially can handle multiple users. Or non-trivial user space in
> general.

The flag should always exist.  If it was defined to conflict with
something else, that's a serious ABI problem.  But the flag
should always exist, even if the kernel ends up ignoring it.

> Should we leave it at least under '#ifndef CONFIG_MMU'? I don't think it's
> possible to have single ABI for MMU and MMU-less systems anyway. And we
> can avoid conflict with MAP_HUGE_SHIFT this way.

No; even if you have an MMU (which is useful for things like fork()), a
system without user separation (for instance, without CONFIG_MULTIUSER)
can reasonably use MAP_UNINITIALIZED.

> P.S. MAP_UNINITIALIZED itself looks very broken to me. I probably need dig
> mailing list on why it was allowed.

That's what the config option *and* explicit flag are for; there are
more than enough warnings about the implications.

- Josh Triplett

  parent reply	other threads:[~2015-09-15  5:19 UTC|newest]

Thread overview: 93+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2644177.lVCYzIBfPW@wuerfel>
2015-09-09 21:08 ` [PATCH] Remove #ifdef CONFIG_64BIT from all asm-generic/fcntl.h Palmer Dabbelt
2015-09-09 21:08   ` [PATCH 01/13] " Palmer Dabbelt
2015-09-09 21:08   ` [PATCH 02/13] Always expose __SYSCALL(... fork ...) Palmer Dabbelt
2015-09-09 21:08   ` [PATCH 03/13] Hide COMPAT_ATM_ADDPARTY behind #ifdef __KERNEL__ Palmer Dabbelt
2015-09-09 21:08   ` [PATCH 04/13] Always expose MAP_UNINITIALIZED to userspace Palmer Dabbelt
2015-09-09 21:08   ` [PATCH 05/13] Hide some of "struct elf_prstatus" behind #ifdef __KERNEL__ Palmer Dabbelt
2015-09-09 21:08   ` [PATCH 06/13] Hide ep_take_care_of_epollwakeup() " Palmer Dabbelt
2015-09-09 21:08   ` [PATCH 07/13] Make FB_BACKLIGHT_{LEVELS,MAX} always visible Palmer Dabbelt
2015-09-09 21:08   ` [PATCH 08/13] Hide MAX_SHARED_LIBS behind #ifdef __KERNEL__ Palmer Dabbelt
2015-09-09 21:08   ` [PATCH 09/13] Hide bp_type_idx " Palmer Dabbelt
2015-09-09 21:08   ` [PATCH 10/13] Hide USE_WCACHING " Palmer Dabbelt
2015-09-09 21:08   ` [PATCH 11/13] Hide MAX_RAW_MINORS " Palmer Dabbelt
2015-09-09 21:08   ` [PATCH 12/13] Hide AT_VECTOR_SIZE_ARCH " Palmer Dabbelt
2015-09-09 21:08   ` [PATCH 13/13] Re-enable and clean up "check_config()" in headers_check.pl Palmer Dabbelt
2015-09-10 11:11   ` [PATCH 09/13] Hide bp_type_idx behind #ifdef __KERNEL__ David Howells
2015-09-10 11:12   ` [PATCH 10/13] Hide USE_WCACHING " David Howells
2015-09-10 11:13   ` [PATCH 11/13] Hide MAX_RAW_MINORS " David Howells
2015-09-10 11:14   ` [PATCH 12/13] Hide AT_VECTOR_SIZE_ARCH " David Howells
2015-09-14 22:50   ` [PATCH v3] Remove #ifdef CONFIG_* from all userspace headers Palmer Dabbelt
2015-09-14 22:50     ` [PATCH 01/13] Remove #ifdef CONFIG_64BIT from all asm-generic/fcntl.h Palmer Dabbelt
2015-09-14 22:50     ` [PATCH 02/13] Use sys_ni.c instead of #ifdef to disable fork on CONFIG_NOMMU Palmer Dabbelt
2015-09-14 22:50     ` [PATCH 03/13] Move COMPAT_ATM_ADDPARTY to net/atm/svc.c Palmer Dabbelt
2015-09-14 22:50     ` [PATCH 04/13] Always expose MAP_UNINITIALIZED to userspace Palmer Dabbelt
2015-09-15  0:23       ` Kirill A. Shutemov
2015-09-15  0:52         ` Palmer Dabbelt
2015-09-15  5:19         ` Josh Triplett [this message]
2015-09-15  9:42           ` Kirill A. Shutemov
2015-09-15 14:07             ` Josh Triplett
2015-09-17 10:13             ` David Howells
2015-09-14 22:50     ` [PATCH 05/13] Split FDPIC "struct elf_prstatus" to "struct elf_fdpic_prstatus" Palmer Dabbelt
2015-09-14 22:50     ` [PATCH 06/13] Move ep_take_care_of_epollwakeup() to fs/eventpoll.c Palmer Dabbelt
2015-09-14 22:50     ` [PATCH 07/13] Make FB_BACKLIGHT_{LEVELS,MAX} always visible Palmer Dabbelt
2015-09-14 22:50     ` [PATCH 08/13] Move MAX_SHARED_LIBS to fs/binfmt_flat.c Palmer Dabbelt
2015-09-14 22:50     ` [PATCH 09/13] Move bp_type_idx to kernel/event/hw_breakpoint.c Palmer Dabbelt
2015-09-15  8:06       ` Peter Zijlstra
2015-09-15 18:40         ` Palmer Dabbelt
2015-09-15 19:39           ` Peter Zijlstra
2015-09-17  3:56             ` Palmer Dabbelt
2015-09-15 21:15         ` Arnd Bergmann
2015-09-24 12:15           ` Frederic Weisbecker
2015-09-17 10:28         ` David Howells
2015-09-14 22:50     ` [PATCH 10/13] Move USE_WCACHING to drivers/block/pktcdvd.c Palmer Dabbelt
2015-09-14 22:50     ` [PATCH 11/13] Always define MAX_RAW_MINORS as 65535 in userspace Palmer Dabbelt
2015-09-15 20:42       ` H. Peter Anvin
2015-09-17  3:08         ` Palmer Dabbelt
2015-09-14 22:50     ` [PATCH 12/13] Remove AT_VECTOR_SIZE_ARCH on x86 Palmer Dabbelt
2015-09-14 22:50     ` [PATCH 13/13] Re-enable and clean up "check_config()" in headers_check.pl Palmer Dabbelt
2015-09-17  9:57     ` [PATCH 03/13] Move COMPAT_ATM_ADDPARTY to net/atm/svc.c David Howells
2015-09-17 20:53       ` Palmer Dabbelt
2015-09-17 10:17     ` [PATCH 05/13] Split FDPIC "struct elf_prstatus" to "struct elf_fdpic_prstatus" David Howells
2015-11-03 19:46     ` [PATCH v4] Remove #ifdef CONFIG_* from all userspace headers Palmer Dabbelt
2015-11-03 19:46       ` [PATCH 01/13] Remove #ifdef CONFIG_64BIT from all asm-generic/fcntl.h Palmer Dabbelt
2015-11-03 19:46       ` [PATCH 02/13] Use sys_ni.c instead of #ifdef to disable fork on CONFIG_NOMMU Palmer Dabbelt
2015-11-03 19:46       ` [PATCH 03/13] Move COMPAT_ATM_ADDPARTY to net/atm/svc.c Palmer Dabbelt
2015-11-03 19:46       ` [PATCH 04/13] Always expose MAP_UNINITIALIZED to userspace Palmer Dabbelt
2015-11-03 19:46       ` [PATCH 05/13] Split FDPIC "struct elf_prstatus" to "struct elf_fdpic_prstatus" Palmer Dabbelt
2015-11-03 19:46       ` [PATCH 06/13] Move ep_take_care_of_epollwakeup() to fs/eventpoll.c Palmer Dabbelt
2015-11-03 19:46       ` [PATCH 07/13] Make FB_BACKLIGHT_{LEVELS,MAX} always visible Palmer Dabbelt
2015-11-03 19:46       ` [PATCH 08/13] Move MAX_SHARED_LIBS to fs/binfmt_flat.c Palmer Dabbelt
2015-11-03 19:46       ` [PATCH 09/13] Move bp_type_idx to kernel/event/hw_breakpoint.c Palmer Dabbelt
2015-11-03 21:28         ` kbuild test robot
2015-11-03 21:29         ` kbuild test robot
2015-11-04 11:41         ` Peter Zijlstra
2015-11-04 12:21           ` Peter Zijlstra
2015-11-07  6:44             ` Palmer Dabbelt
2015-11-03 19:46       ` [PATCH 10/13] Move USE_WCACHING to drivers/block/pktcdvd.c Palmer Dabbelt
2015-11-03 19:46       ` [PATCH 11/13] Always define MAX_RAW_MINORS as 2**20 in userspace Palmer Dabbelt
2015-11-03 20:11         ` kbuild test robot
2015-11-03 19:46       ` [PATCH 12/13] Remove AT_VECTOR_SIZE_ARCH on x86 Palmer Dabbelt
2015-11-03 19:46       ` [PATCH 13/13] Re-enable and clean up "check_config()" in headers_check.pl Palmer Dabbelt
2015-11-03 20:25         ` kbuild test robot
2015-11-03 20:26         ` kbuild test robot
2015-11-10  1:30       ` [PATCH v5] Remove #ifdef CONFIG_* from all userspace headers Palmer Dabbelt
2015-11-10  1:30         ` [PATCH 01/14] Remove #ifdef CONFIG_64BIT from all asm-generic/fcntl.h Palmer Dabbelt
2015-11-10  1:30         ` [PATCH 02/14] Use sys_ni.c instead of #ifdef to disable fork on CONFIG_NOMMU Palmer Dabbelt
2015-11-10  1:31         ` [PATCH 03/14] Move COMPAT_ATM_ADDPARTY to net/atm/svc.c Palmer Dabbelt
2023-02-10 14:55           ` Thomas Huth
2023-02-10 15:10             ` Arnd Bergmann
2015-11-10  1:31         ` [PATCH 04/14] Always expose MAP_UNINITIALIZED to userspace Palmer Dabbelt
2015-11-10  1:31         ` [PATCH 05/14] Split FDPIC "struct elf_prstatus" to "struct elf_fdpic_prstatus" Palmer Dabbelt
2015-11-10  1:31         ` [PATCH 06/14] Move ep_take_care_of_epollwakeup() to fs/eventpoll.c Palmer Dabbelt
2023-02-10 14:45           ` Thomas Huth
2015-11-10  1:31         ` [PATCH 07/14] Make FB_BACKLIGHT_{LEVELS,MAX} always visible Palmer Dabbelt
2015-11-10  1:31         ` [PATCH 08/14] Move MAX_SHARED_LIBS to fs/binfmt_flat.c Palmer Dabbelt
2015-11-10  1:31         ` [PATCH 09/14] Move bp_type_idx to include/linux/hw_breakpoint.h Palmer Dabbelt
2015-11-10  1:31         ` [PATCH 10/14] Move USE_WCACHING to drivers/block/pktcdvd.c Palmer Dabbelt
2015-11-10  1:31         ` [PATCH 11/14] Always define MAX_RAW_MINORS as 2**20 in userspace Palmer Dabbelt
2015-11-10  1:31         ` [PATCH 12/14] Remove AT_VECTOR_SIZE_ARCH on x86 Palmer Dabbelt
2015-11-10  1:31         ` [PATCH 13/14] Hide CONFIG_PHY_RAM_BASE_ADDRESS from userspace Palmer Dabbelt
2015-11-10  1:31         ` [PATCH 14/14] Re-enable and clean up "check_config()" in headers_check.pl Palmer Dabbelt
2015-09-10 11:15 ` [PATCH] Remove #ifdef CONFIG_64BIT from all asm-generic/fcntl.h David Howells
2015-09-10 11:18 ` David Howells
2015-09-14 22:50   ` Palmer Dabbelt

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=20150915051919.GB4091@x \
    --to=josh@joshtriplett.org \
    --cc=3chas3@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=aarcange@redhat.com \
    --cc=acme@kernel.org \
    --cc=aishchuk@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=ast@plumgrid.com \
    --cc=bhe@redhat.com \
    --cc=chris@zankel.net \
    --cc=dave@sr71.net \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=drysdale@google.com \
    --cc=dyoung@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=geoff@infradead.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=iulia.manda21@gmail.com \
    --cc=jcmvbkbc@gmail.com \
    --cc=jikos@kernel.org \
    --cc=kexec@lists.infradead.org \
    --cc=kirill@shutemov.name \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xtensa@linux-xtensa.org \
    --cc=luto@kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@kernel.org \
    --cc=palmer@dabbelt.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=plagnioj@jcrosoft.com \
    --cc=tglx@linutronix.de \
    --cc=tomi.valkeinen@ti.com \
    --cc=vgoyal@redhat.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=x86@kernel.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;
as well as URLs for NNTP newsgroup(s).