linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: Borislav Petkov <bp@amd64.org>
Cc: Rik van Riel <riel@redhat.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	akpm@linux-foundation.org, sjhill@mips.com,
	"H. Peter Anvin" <hpa@linux.intel.com>,
	Rob Herring <rob.herring@calxeda.com>,
	Russell King <rmk+kernel@arm.linux.org.uk>,
	Nicolas Pitre <nico@linaro.org>
Subject: Re: bugs in page colouring code
Date: Thu, 14 Jun 2012 15:31:49 +0100	[thread overview]
Message-ID: <20120614143149.GE12068@linux-mips.org> (raw)
In-Reply-To: <20120614132007.GC25940@aftab.osrc.amd.com>

On Thu, Jun 14, 2012 at 03:20:07PM +0200, Borislav Petkov wrote:

> > However, I expect that on x86 many applications expect
> > MAP_FIXED to just work, and enforcing that would be
> > more trouble than it's worth.
> 
> Right, but if MAP_FIXED mappings succeed, then all processes sharing
> that mapping will have it at the same virtual address, correct? And
> if so, then we don't have the aliasing issue either so MAP_FIXED is a
> don't-care from that perspective.

Once upon a time every real program carried its own malloc around.  I'm
sure many of these malloc implementations rely on MAP_FIXED.

These days the big user of MAP_FIXED is glibc's dynamic loader.  It
doesn't use MAP_FIXED for the first segment, only for all subsequent
segments and the addresses are chosen such this will succeed.  ld(1)
has the necessary knowledge about alignment.

Problem: If you raise the alignment for mappings you want to make damn
sure that any non-broken executable ever created uses sufficient alignment
or bad things may happen.

MIPS used to use a very large alignment in ld linker scripts allowing
for up to 1MB page size.  Then somebody clueless who shall smoulder in
hell reduced it to a very small value, something like 4k or 16k.  When
we went for bigger page size (MIPS allows 64K page size) all binaries
created with the broken linker had to be rebuilt.

So you probably want to do a little dumpster diving in very old binutils
before doing anything that raises alignment of file mappings.

> > >Linus said that without this we are probably breaking old userspace
> > >which can't stomach ASLR so we had to respect such userspace which
> > >clears that flag.
> > 
> > I wonder if that is true, since those userspace programs
> > probably run fine on ARM, MIPS and other architectures...
> 
> Well, I'm too young to know that :) Reportedly, those were some obscure
> old binaries and we added the PF_RANDOMIZE check out of caution, so as
> to not break them, if at all.

See above - ld linker scripts are a big part of why things are working :)
I'm however not aware of any breakage caused by PF_RANDOMIZE.

  Ralf

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

  reply	other threads:[~2012-06-14 14:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-13 19:29 bugs in page colouring code Rik van Riel
2012-06-14  8:42 ` Paul Mundt
2012-06-14 12:56   ` Rik van Riel
2012-06-14 10:36 ` Borislav Petkov
2012-06-14 12:57   ` Rik van Riel
2012-06-14 13:20     ` Borislav Petkov
2012-06-14 14:31       ` Ralf Baechle [this message]
2012-06-14 20:58     ` H. Peter Anvin
2012-06-14 21:03       ` Rik van Riel
2012-06-14 21:13         ` H. Peter Anvin
2012-06-14 21:20           ` Rik van Riel
2012-06-14 13:20 ` Russell King - ARM Linux
2012-06-14 14:27   ` Rik van Riel

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=20120614143149.GE12068@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=akpm@linux-foundation.org \
    --cc=bp@amd64.org \
    --cc=hpa@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nico@linaro.org \
    --cc=riel@redhat.com \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=rob.herring@calxeda.com \
    --cc=sjhill@mips.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 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).