[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Yl70PJEfThn84awn@arm.com>
Date: Tue, 19 Apr 2022 18:41:16 +0100
From: Catalin Marinas <catalin.marinas@....com>
To: Christophe Leroy <christophe.leroy@...roup.eu>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
Steve Capper <steve.capper@....com>,
Will Deacon <will.deacon@....com>,
"stable@...r.kernel.org" <stable@...r.kernel.org>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v10] mm, hugetlbfs: Allow for "high" userspace addresses
On Sat, Apr 16, 2022 at 06:26:42AM +0000, Christophe Leroy wrote:
> Le 16/04/2022 à 00:09, Andrew Morton a écrit :
> > On Fri, 15 Apr 2022 16:45:13 +0200 Christophe Leroy <christophe.leroy@...roup.eu> 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 should
> > 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/db238c1ca2d46e33c57328f8d450f2563e92f8c2.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
Powered by blists - more mailing lists