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 0D9AAC433EF for ; Mon, 22 Nov 2021 11:47:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8B1746B0071; Mon, 22 Nov 2021 06:47:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 860C26B0072; Mon, 22 Nov 2021 06:47:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7503B6B0073; Mon, 22 Nov 2021 06:47:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0126.hostedemail.com [216.40.44.126]) by kanga.kvack.org (Postfix) with ESMTP id 67A856B0071 for ; Mon, 22 Nov 2021 06:47:26 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 20380184F4E7F for ; Mon, 22 Nov 2021 11:47:16 +0000 (UTC) X-FDA: 78836390472.26.876D2C6 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf22.hostedemail.com (Postfix) with ESMTP id EC5C71988 for ; Mon, 22 Nov 2021 11:47:14 +0000 (UTC) Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4HyQVT4f10z9sSk; Mon, 22 Nov 2021 12:47:13 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YkgrPNJYfsxj; Mon, 22 Nov 2021 12:47:13 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4HyQVT3h2Rz9sSZ; Mon, 22 Nov 2021 12:47:13 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 662C68B774; Mon, 22 Nov 2021 12:47:13 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id fbOL2ToGz7tZ; Mon, 22 Nov 2021 12:47:13 +0100 (CET) Received: from [172.25.230.108] (unknown [172.25.230.108]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 20B3A8B765; Mon, 22 Nov 2021 12:47:13 +0100 (CET) Message-ID: <2dd4a22e-f1a5-683c-2d17-ce726f03f4c5@csgroup.eu> Date: Mon, 22 Nov 2021 12:47:13 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Subject: Re: [PATCH 6/8] mm: Allow arch specific arch_randomize_brk() with CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT Content-Language: fr-FR To: Alex Ghiti , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org References: <325663a5-d9a1-a8b8-7f16-c2985c319864@ghiti.fr> From: Christophe Leroy In-Reply-To: <325663a5-d9a1-a8b8-7f16-c2985c319864@ghiti.fr> Content-Type: text/plain; charset=UTF-8; format=flowed X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: EC5C71988 X-Stat-Signature: ui8z8tbwb9roxg99qoib9ii7j9j6cx9c Authentication-Results: imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=none X-HE-Tag: 1637581634-555100 Content-Transfer-Encoding: quoted-printable 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: Le 22/11/2021 =C3=A0 12:22, Alex Ghiti a =C3=A9crit=C2=A0: > Hi Christophe, >=20 > Le 22/11/2021 =C3=A0 09:48, Christophe Leroy a =C3=A9crit=C2=A0: >> Commit e7142bf5d231 ("arm64, mm: make randomization selected by >> generic topdown mmap layout") introduced a default version of >> arch_randomize_brk() provided when >> CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT is selected. >> >> powerpc could select CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT >> but needs to provide its own arch_randomize_brk(). >> >> In order to allow that, don't make >> CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT select >> CONFIG_ARCH_HAS_ELF_RANDOMIZE. Instead, ensure that >> selecting CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT and >> selecting CONFIG_ARCH_HAS_ELF_RANDOMIZE has the same effect. >=20 > This feels weird to me since if CONFIG_ARCH_HAS_ELF_RANDOMIZE is used=20 > somewhere else at some point, it is not natural to add=20 > CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT: can't we use a __weak=20 > function or a new CONFIG_ARCH_HAS_RANDOMIZE_BRK? Yes I also found things a bit weird. CONFIG_ARCH_HAS_RANDOMIZE_BRK could be an idea but how different would=20 it be from CONFIG_ARCH_HAS_ELF_RANDOMIZE ? In fact I find it weird that=20 CONFIG_ARCH_HAS_ELF_RANDOMIZE is selected by=20 CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT and not by the arch itself. On the other hand CONFIG_ARCH_HAS_ELF_RANDOMIZE also handles=20 arch_mmap_rnd() and here we are talking about arch_randomize_brk() only. In the begining I was thinking about adding a=20 CONFIG_ARCH_WANT_DEFAULT_RANDOMIZE_BRK, but it was meaning adding it to=20 the few other arches selecting CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYO= UT. So I think I will go for the __weak function option. Thanks Christophe