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 CC7F6EEB58C for ; Thu, 12 Sep 2024 10:54:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5B55D6B0083; Thu, 12 Sep 2024 06:54:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 53F1E6B0085; Thu, 12 Sep 2024 06:54:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3B7626B0088; Thu, 12 Sep 2024 06:54:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 1A67B6B0083 for ; Thu, 12 Sep 2024 06:54:06 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 8BEDEA9AA1 for ; Thu, 12 Sep 2024 10:54:05 +0000 (UTC) X-FDA: 82555776450.02.623B175 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf22.hostedemail.com (Postfix) with ESMTP id B2A72C0007 for ; Thu, 12 Sep 2024 10:54:03 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of cmarinas@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cmarinas@kernel.org; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1726138338; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Tcu3WzYhkhRIl8zoELqQRKUTsUk2UOjbt0o1Dc4AHjY=; b=GoJWABXWxzjj04i3gCvm6Oqk0D78esyIjdc09sydexN2GO6uFSi3iRnR3gCUKdlxZ2ZA5l UROyUATh2e7B+iXKmGxpTNrq+kMJkcJcCpO0wnfIsrq5Gv6W2cjZYKplwha3AGM8GhX3S+ 9NglOB7JX4nWHEuamdpcgRsF7fHdOAQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1726138338; a=rsa-sha256; cv=none; b=xoehRVuQISqOuD8waMW7c9AroVu22CHTmJqVwq2ZZ9sh7hKxUycAFE2f/y3kB1dl0diUNH y57dVoCyz5lG7iFX4YrhYSVcelPNCebPb7IifMSJdQBp+Mr7wSHTxpWKHhYSblMU/CqdBs yTZucwRosU2KcDCWe01AAz7j84dvsYM= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of cmarinas@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cmarinas@kernel.org; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 8DC035C5AA4; Thu, 12 Sep 2024 10:53:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67C3EC4CEC3; Thu, 12 Sep 2024 10:53:51 +0000 (UTC) Date: Thu, 12 Sep 2024 11:53:49 +0100 From: Catalin Marinas To: Charlie Jenkins Cc: "Liam R. Howlett" , Arnd Bergmann , guoren , Richard Henderson , Ivan Kokshaysky , Matt Turner , Vineet Gupta , Russell King , Huacai Chen , WANG Xuerui , Thomas Bogendoerfer , "James E . J . Bottomley" , Helge Deller , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Alexander Gordeev , Gerald Schaefer , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Sven Schnelle , Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz , "David S . Miller" , Andreas Larsson , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , Muchun Song , Andrew Morton , Vlastimil Babka , Lorenzo Stoakes , shuah , Christoph Hellwig , Michal Hocko , "Kirill A. Shutemov" , Chris Torek , Linux-Arch , linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, "linux-csky@vger.kernel.org" , loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-abi-devel@lists.sourceforge.net Subject: Re: [PATCH RFC v3 1/2] mm: Add personality flag to limit address to 47 bits Message-ID: References: <20240905-patches-below_hint_mmap-v3-0-3cd5564efbbb@rivosinc.com> <20240905-patches-below_hint_mmap-v3-1-3cd5564efbbb@rivosinc.com> <9fc4746b-8e9d-4a75-b966-e0906187e6b7@app.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: B2A72C0007 X-Stat-Signature: 9kjbhbt99x8ybjzofck8j8hhapefgt3c X-HE-Tag: 1726138443-140761 X-HE-Meta: U2FsdGVkX1+6bEGb+8ukbq/zY+neK+sKPrNiSRE74xJ889iSzFq7WHGp3jlmmEMjJiYV1UGV6wH7eN6QRSD2GEViYfb9jzk2Iz3QuzCwOpIBwKHYi1WR5FAXvYg9SOqsnSt+Qm8QYNPzUmbw+Wa3BpMVR6Hm1998MN/2qn8cbXyza/QHYU32rlmEJ43zMnnkIE9RwJ071iqaPogx7OL4Hxkv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a5B92Ic6VXBMs/Yg62UOsHZzPsVu7qd/slOoMCxqIemxmzMFMEv4vg0Mz7RlntXDFMwY6TrqCvVqG39eksbri5y+uXRHrwyguEdHV5XP+1VZ5C/sW/k+rZkxVB4ZoEodRaDeAftXN7ghhPt8dfg8om/bPswoZfyaREWcjgo4= 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: List-Subscribe: List-Unsubscribe: On Wed, Sep 11, 2024 at 11:18:12PM -0700, Charlie Jenkins wrote: > Opting-in to the higher address space is reasonable. However, it is not > my preference, because the purpose of this flag is to ensure that > allocations do not exceed 47-bits, so it is a clearer ABI to have the > applications that want this guarantee to be the ones setting the flag, > rather than the applications that want the higher bits setting the flag. Yes, this would be ideal. Unfortunately those applications don't know they need to set a flag in order to work. A slightly better option is to leave the default 47-bit at the kernel ABI level and have the libc/dynamic loader issue the prctl(). You can control the default with environment variables if needed. We do something similar in glibc for arm64 MTE. When MTE is enabled, the top byte of an allocated pointer contains the tag that must not be corrupted. We left the decision to the C library via the glibc.mem.tagging tunable (Android has something similar via the app manifest). An app can change the default if it wants but if you run with old glibc or no environment variable to say otherwise, the default would be safe. Distros can set the environment to be the maximum range by default if they know the apps included have been upgraded and tested. -- Catalin