Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756019Ab2FNOcg (ORCPT ); Thu, 14 Jun 2012 10:32:36 -0400 Received: from h9.dl5rb.org.uk ([81.2.74.9]:35142 "EHLO h5.dl5rb.org.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753972Ab2FNOce (ORCPT ); Thu, 14 Jun 2012 10:32:34 -0400 Date: Thu, 14 Jun 2012 15:31:49 +0100 From: Ralf Baechle To: Borislav Petkov Cc: Rik van Riel , linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, sjhill@mips.com, "H. Peter Anvin" , Rob Herring , Russell King , Nicolas Pitre Subject: Re: bugs in page colouring code Message-ID: <20120614143149.GE12068@linux-mips.org> References: <20120613152936.363396d5@cuia.bos.redhat.com> <20120614103627.GA25940@aftab.osrc.amd.com> <4FD9DFCE.1070609@redhat.com> <20120614132007.GC25940@aftab.osrc.amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120614132007.GC25940@aftab.osrc.amd.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2364 Lines: 52 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 from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/