Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp685552pxu; Thu, 3 Dec 2020 10:04:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJyNI3Kp9EQGgSiHj8Kevc+grMX8gWFe7UPSPGJYEsWC6tkZ8G/lSp1CBRK7SNPB2GBk+It+ X-Received: by 2002:aa7:cc8f:: with SMTP id p15mr3906172edt.240.1607018646686; Thu, 03 Dec 2020 10:04:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607018646; cv=none; d=google.com; s=arc-20160816; b=KZt6O5quIGRxXXrvAyX78xh48vLsR1/IpCVQxaZGbInuQb7V8Aj6/3K24TxsxWq9UK g3BybSOKZpvWLtlwEodG3iKLwKr7M23Anuor9ZLFaN7I/RJ3vJr02q0pozKgyEiYhXlH kYp0S73YCgRUFytBFcipq1kKlpn637nXhhOezO756Xy8yLblRlxG3e2Ne3NcHwS8FEIp BJqdUuAf168KG8hRK2qfcyrmJMZCIK5OWg2wzKLSxk1qDG0L7Nj7vU01PCb9p0q8Gx07 G0ypTn2ehc0r+TrC22+PI1lwpEgPNypxo8mgfhcD/0jflLxwD8F1cC1dbrZSkjgTl4Gj mlzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=v0fH8XZPcBILHBvdRGB4xJ6ySGXdUUUfSXTYA6BIYHw=; b=zIEyc5Cvybjzu5vYA4yV358zKKSq1BE1Br6s8wFo9bd4lsM4G+aIwiOrS6/CUlP+DU kQtzgiBRFkKsigqbSN1t/jRsFrSbcpemAopwUip4hBuV8aVDqnxgfDlxiyzQDInBRuYe kEiLw/PTZQgKMCAV57LVSKdAhrNMg0DyAGldeIRAf9pJB9iCpsE/TABRoQN424rtaIxS M6w2v3NOTbwdEB3pUMQTnkqXzWeqgbwvO0drn8l8qrSB8R6wWvf2Nht340h2cEv524RY +hg9ph5XOfgcSIS1lJw4fdMHGUTVxHZq4MPLGd6QLZunvn6VSKYZkyEh3L1WxNeIbhtY C86g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=k0eFW5pe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y25si1468689ejb.595.2020.12.03.10.03.41; Thu, 03 Dec 2020 10:04:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=k0eFW5pe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731347AbgLCSA5 (ORCPT + 99 others); Thu, 3 Dec 2020 13:00:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727114AbgLCSA5 (ORCPT ); Thu, 3 Dec 2020 13:00:57 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDC0BC061A4E; Thu, 3 Dec 2020 10:00:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=v0fH8XZPcBILHBvdRGB4xJ6ySGXdUUUfSXTYA6BIYHw=; b=k0eFW5peSYZQ+XNv/IBrFFIAE/ Z9NeOHb1oP3UjOgoP7cv/xLz8ZEAuFxQUGHhWHU2fLVFrY8WXO36eX3sgloBPmUCay5x2+N2jk3lM mVaFu8t1AQRymvOtoPxSaimEJjJEk0V07XfjDbveoWenkVeoYeNowDoOZemFoiazroyTJWqH2+GIn rDLuQvt+xoYbywyauXqx61nReQJvLQSHqItfpx2IpykqemvMOhfZRjg50AlW0GnLG6+QrxpOX4e2z dTbPUEmjCIO8OsKRN44RKRWoBOcqdJ/536YitsM7xqniXabqivyTUYezUrGKIFN13/mqew2v4E03F L4jem1VA==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kkstl-0003N8-To; Thu, 03 Dec 2020 18:00:10 +0000 Date: Thu, 3 Dec 2020 18:00:09 +0000 From: Matthew Wilcox To: Andy Lutomirski Cc: Florian Weimer , Topi Miettinen , linux-hardening@vger.kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Jann Horn , Kees Cook , Mike Rapoport , Linux API Subject: Re: [PATCH v5] mm: Optional full ASLR for mmap(), mremap(), vdso and stack Message-ID: <20201203180009.GJ11935@casper.infradead.org> References: <871rg6yf1i.fsf@oldenburg2.str.redhat.com> <1CB9B4D1-1E32-42DC-A4E9-6E53C85365BF@amacapital.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1CB9B4D1-1E32-42DC-A4E9-6E53C85365BF@amacapital.net> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 03, 2020 at 09:42:54AM -0800, Andy Lutomirski wrote: > I suspect that something much more clever could be done in which the heap is divided up into a few independently randomized sections and heap pages are randomized within the sections might do much better. There should certainly be a lot of room for something between what we have now and a fully randomized scheme. > > It might also be worth looking at what other OSes do. How about dividing the address space up into 1GB sections (or, rather, PUD_SIZE sections), allocating from each one until it's 50% full, then choose another one? Sufficiently large allocations would ignore this division and just look for any space. I'm thinking something like the slab allocator (so the 1GB chunk would go back into the allocatable list when >50% of it was empty). That might strike a happy medium between full randomisation and efficient use of page tables / leaving large chunks of address space free for large mmaps.