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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CE9EC433F5 for ; Thu, 9 Dec 2021 10:16:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A78256B0071; Thu, 9 Dec 2021 05:16:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A28036B0073; Thu, 9 Dec 2021 05:16:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 916806B0074; Thu, 9 Dec 2021 05:16:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0094.hostedemail.com [216.40.44.94]) by kanga.kvack.org (Postfix) with ESMTP id 814776B0071 for ; Thu, 9 Dec 2021 05:16:00 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 48D2718591E1D for ; Thu, 9 Dec 2021 10:15:50 +0000 (UTC) X-FDA: 78897849660.19.05ACD65 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by imf14.hostedemail.com (Postfix) with ESMTP id DD5B7100003 for ; Thu, 9 Dec 2021 10:15:48 +0000 (UTC) Received: by mail-pf1-f173.google.com with SMTP id k64so4959934pfd.11 for ; Thu, 09 Dec 2021 02:15:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=uTtDFl4ylvWzOUxVw5Eo9EBEL+buH4qtkFmI+A3VVv0=; b=NQ9+kg5KOv5dp8pVp2G3I8lUbNXVG0gGlaVKBRUDptLxHDT3j6LoR5hi005x1rifX+ uA6bfveQG0dx3f3Pz+tdXHOtl8NoklpAuoTEXZUr+NSdbKoqLQlXdLMULNoJ0k9Rq6ZK SSEUIuBrDVN8GOsU/W4YMnlWzJypWUzwT+skDvkedX8UYzrYQHgnOiqAMWnKd0cRvd41 LM6mLgEdHygyZ72GDyz21c7VxxOdNMpIHcsRXabxpb4b5XhinlJaD+deOAZAo8o4HKKs KW2NnFS0VCtV+d/d3qC19MUMo6+woIuBgTEGVoOt7F/LCFRfUQLYO+GyaCpWHXIB2qEu Gbtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=uTtDFl4ylvWzOUxVw5Eo9EBEL+buH4qtkFmI+A3VVv0=; b=ESFi9dUcNdwM9qzTcywPIyTne7SweCRkVEzltO/Tl3f4RqHGn6mogaTHPcvWmppFc7 kcO+YzXv/hRdjTn3HoNgvF9XeYn+0KNfOMqDUlD1jqPSNVFnNKLAJlPDLIy5NycErG+O eWqJjmDX7nNNQSudRHlxHPOqbm1nQJKcJ1ARErOl8+0aGTcZ5YNyu13cEGD5GrrA2zof oC9lhOtgDjKPaZ1Idcn72Qr6vVPuUf1FQSpJlYNZ7yDx7az08blD5GVTdzLGTJHOup5H 3+sFGl5gWgAuyXzPo6fljY73bivStyzl8aphnts+x4PsBpeNsZe6cOtiNvak1rMy47it KViQ== X-Gm-Message-State: AOAM532nCvFqb80xEJcCnCs5a9nYyeqdFkfAEy6mbAB25KTLy/ugLV3r 01rDleZ98sHn/KyKA23xS/o= X-Google-Smtp-Source: ABdhPJwjI9kxYeG3xjcWudWWgMKJYeADbcpgkvYJNmVIASIiiFf9HmZhYN59I+Cd0HwMP0j9lYkm/w== X-Received: by 2002:a63:69c6:: with SMTP id e189mr32529626pgc.237.1639044949008; Thu, 09 Dec 2021 02:15:49 -0800 (PST) Received: from localhost (203-219-139-206.static.tpgi.com.au. [203.219.139.206]) by smtp.gmail.com with ESMTPSA id n6sm6227193pfa.28.2021.12.09.02.15.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Dec 2021 02:15:48 -0800 (PST) Date: Thu, 09 Dec 2021 20:15:42 +1000 From: Nicholas Piggin Subject: Re: [PATCH v4 09/10] powerpc/mm: Convert to default topdown mmap layout To: "alex@ghiti.fr" , Benjamin Herrenschmidt , Christophe Leroy , Michael Ellerman , Paul Mackerras Cc: "akpm@linux-foundation.org" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "linuxppc-dev@lists.ozlabs.org" References: In-Reply-To: MIME-Version: 1.0 Message-Id: <1639044621.jeow25j0pr.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Stat-Signature: 8yoc15gtkai87ecjoaurkwxmf58ibqqo Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=NQ9+kg5K; spf=pass (imf14.hostedemail.com: domain of npiggin@gmail.com designates 209.85.210.173 as permitted sender) smtp.mailfrom=npiggin@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: DD5B7100003 X-HE-Tag: 1639044948-63783 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: Excerpts from Christophe Leroy's message of December 9, 2021 3:18 am: > Select CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT and > remove arch/powerpc/mm/mmap.c >=20 > This change provides standard randomisation of mmaps. >=20 > See commit 8b8addf891de ("x86/mm/32: Enable full randomization on i386 > and X86_32") for all the benefits of mmap randomisation. The justification seems pretty reasonable. >=20 > Comparison between powerpc implementation and the generic one: > - mmap_is_legacy() is identical. > - arch_mmap_rnd() does exactly the same allthough it's written > slightly differently. > - MIN_GAP and MAX_GAP are identical. > - mmap_base() does the same but uses STACK_RND_MASK which provides > the same values as stack_maxrandom_size(). > - arch_pick_mmap_layout() is almost identical. The only difference > is that it also adds the random factor to mm->mmap_base in legacy mode. >=20 > That last point is what provides the standard randomisation of mmaps. Thanks for describing it. Could you add random_factor to mmap_base for the legacy path for powerpc as a 2-line change that adds the legacy randomisation. And then this bigger patch would be closer to a no-op. Thanks, Nick