From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D406C4361A for ; Thu, 3 Dec 2020 18:00:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BA82120754 for ; Thu, 3 Dec 2020 18:00:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BA82120754 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 158308D0007; Thu, 3 Dec 2020 13:00:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1078F8D0005; Thu, 3 Dec 2020 13:00:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 043DD8D0007; Thu, 3 Dec 2020 13:00:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0048.hostedemail.com [216.40.44.48]) by kanga.kvack.org (Postfix) with ESMTP id E26608D0005 for ; Thu, 3 Dec 2020 13:00:18 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 54B803637 for ; Thu, 3 Dec 2020 18:00:18 +0000 (UTC) X-FDA: 77552735316.17.game01_140ec9e273bd Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id 27698180D0180 for ; Thu, 3 Dec 2020 18:00:18 +0000 (UTC) X-HE-Tag: game01_140ec9e273bd X-Filterd-Recvd-Size: 2897 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf37.hostedemail.com (Postfix) with ESMTP for ; Thu, 3 Dec 2020 18:00:17 +0000 (UTC) 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> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.