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 31267C433EF for ; Tue, 19 Apr 2022 17:41:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A359C6B0072; Tue, 19 Apr 2022 13:41:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9E4896B0073; Tue, 19 Apr 2022 13:41:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8AD5A6B0075; Tue, 19 Apr 2022 13:41:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0053.hostedemail.com [216.40.44.53]) by kanga.kvack.org (Postfix) with ESMTP id 7E94A6B0072 for ; Tue, 19 Apr 2022 13:41:25 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 309E51831B6B5 for ; Tue, 19 Apr 2022 17:41:25 +0000 (UTC) X-FDA: 79374345330.30.BC2709E Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf25.hostedemail.com (Postfix) with ESMTP id BCD5BA0015 for ; Tue, 19 Apr 2022 17:41:22 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C218CB818F2; Tue, 19 Apr 2022 17:41:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF189C385AB; Tue, 19 Apr 2022 17:41:19 +0000 (UTC) Date: Tue, 19 Apr 2022 18:41:16 +0100 From: Catalin Marinas To: Christophe Leroy Cc: Andrew Morton , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , Steve Capper , Will Deacon , "stable@vger.kernel.org" , Linux ARM Subject: Re: [PATCH v10] mm, hugetlbfs: Allow for "high" userspace addresses Message-ID: References: <20220415150929.a62cbad83c22d6304560f626@linux-foundation.org> <63e716ee-ad77-c087-20a7-4fda06ec1f68@csgroup.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <63e716ee-ad77-c087-20a7-4fda06ec1f68@csgroup.eu> X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: BCD5BA0015 X-Rspam-User: Authentication-Results: imf25.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none); spf=pass (imf25.hostedemail.com: domain of cmarinas@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=cmarinas@kernel.org X-Stat-Signature: msfaaecgbn1fqhqsx8c5x59pbuuo6pnd X-HE-Tag: 1650390082-827731 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: On Sat, Apr 16, 2022 at 06:26:42AM +0000, Christophe Leroy wrote: > Le 16/04/2022 =E0 00:09, Andrew Morton a =E9crit=A0: > > On Fri, 15 Apr 2022 16:45:13 +0200 Christophe Leroy wrote: > >=20 > >> This is a fix for commit f6795053dac8 ("mm: mmap: Allow for "high" > >> userspace addresses") for hugetlb. > >> > >> This patch adds support for "high" userspace addresses that are > >> optionally supported on the system and have to be requested via a hi= nt > >> mechanism ("high" addr parameter to mmap). > >> > >> Architectures such as powerpc and x86 achieve this by making changes= to > >> their architectural versions of hugetlb_get_unmapped_area() function= . > >> However, arm64 uses the generic version of that function. > >> > >> So take into account arch_get_mmap_base() and arch_get_mmap_end() in > >> hugetlb_get_unmapped_area(). To allow that, move those two macros > >> out of mm/mmap.c into include/linux/sched/mm.h > >> > >> If these macros are not defined in architectural code then they defa= ult > >> to (TASK_SIZE) and (base) so should not introduce any behavioural > >> changes to architectures that do not define them. > >> > >> For the time being, only ARM64 is affected by this change. > >> > >> >From Catalin (ARM64): > >> We should have fixed hugetlb_get_unmapped_area() as well when we > >> added support for 52-bit VA. The reason for commit f6795053dac8 was = to > >> prevent normal mmap() from returning addresses above 48-bit by defau= lt > >> as some user-space had hard assumptions about this. > >> > >> It's a slight ABI change if you do this for hugetlb_get_unmapped_are= a() > >> but I doubt anyone would notice. It's more likely that the current > >> behaviour would cause issues, so I'd rather have them consistent. > >=20 > > I'm struggling to understand the need for a -stable backport from the > > above text. > >=20 > > Could we please get a simple statement of the end-user visible effect= s > > of the shortcoming? Target audience is -stable tree maintainers, and > > people who we've never heard of who will be wondering whether they sh= ould > > add this to their organization's older kernel. >=20 > Catalin, can you help answering this question ? It was your=20 > recommendation to tag this patch for stable in=20 > https://patchwork.ozlabs.org/project/linuxppc-dev/patch/db238c1ca2d46e3= 3c57328f8d450f2563e92f8c2.1639736449.git.christophe.leroy@csgroup.eu/ My reasoning was that we should have made hugetlb_get_unmapped_area() consistent with arch_get_unmapped_area() since commit f6795053dac8 ("mm: mmap: Allow for "high" userspace addresses"). Basically when arm64 gained support for 52-bit addresses we did not want user-space calling mmap() to suddenly get such high addresses, otherwise we could have inadvertently broken some programs (similar behaviour to x86 here). Hence we added commit f6795053dac8. But we missed hugetlbfs which could still get such high mmap() addresses. So in theory that's a potential regression that should have bee addressed at the same time as commit f6795053dac8 (and before arm64 enabled 52-bit addresses). --=20 Catalin