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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B828DC433F5 for ; Tue, 19 Apr 2022 17:46:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mKO2cNwIF5yMzYRhJZ3MHgyLvTwWY3btYnZXawziRXw=; b=mN6PMCkXuIVANw 0U0eZuNUHrchyfonZ88m16e+qY7fk90/sa+ce3f8YACgOuJLD7Cs7FQNeXj36LBBl3lfWUevKKAzy 74V5tMqYh9k5JMYg8wi2aN9yWODkBuqW77U4U7hH7jSNH11xrQ818bhmVTNOashT4nDUwWhuuquuz A4J8MKYj6vp+0cyVVzKI7NZEzIusSUpL2n0bqqyfWJnttNeZ0lysXeYh8Aa0HvYXKwbxvtwiEifCW MAnMagMAFg0XSOQGuTy/zcia8di2z6C2igVeosiONMu7mnsMJ8cKCscuF54BsIfAg3ahLdmJdYyQj qkZeLSyohPhiJIn16GGw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngrul-005QUx-Cw; Tue, 19 Apr 2022 17:45:24 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngrqv-005OyK-3I for linux-arm-kernel@lists.infradead.org; Tue, 19 Apr 2022 17:41:29 +0000 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-Disposition: inline In-Reply-To: <63e716ee-ad77-c087-20a7-4fda06ec1f68@csgroup.eu> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220419_104125_479004_05C515A3 X-CRM114-Status: GOOD ( 32.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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: > > = > >> 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 hint > >> 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 default > >> 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 default > >> as some user-space had hard assumptions about this. > >> > >> It's a slight ABI change if you do this for hugetlb_get_unmapped_area() > >> but I doubt anyone would notice. It's more likely that the current > >> behaviour would cause issues, so I'd rather have them consistent. > > = > > I'm struggling to understand the need for a -stable backport from the > > above text. > > = > > Could we please get a simple statement of the end-user visible effects > > of the shortcoming? Target audience is -stable tree maintainers, and > > people who we've never heard of who will be wondering whether they shou= ld > > add this to their organization's older kernel. > = > Catalin, can you help answering this question ? It was your = > recommendation to tag this patch for stable in = > https://patchwork.ozlabs.org/project/linuxppc-dev/patch/db238c1ca2d46e33c= 57328f8d450f2563e92f8c2.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). -- = Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel