[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKbZUD0JuEwfd2VnY_Kbv2Mr0g0KN2T2mYCLhPuS8j6PhbCNiQ@mail.gmail.com>
Date: Wed, 7 Aug 2024 22:20:44 +0100
From: Pedro Falcato <pedro.falcato@...il.com>
To: Jeff Xu <jeffxu@...gle.com>
Cc: jeffxu@...omium.org, akpm@...ux-foundation.org, willy@...radead.org,
torvalds@...ux-foundation.org, Liam.Howlett@...cle.com,
linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org,
linux-mm@...ck.org, dave.hansen@...el.com, linux-hardening@...r.kernel.org,
lorenzo.stoakes@...cle.com, mpe@...erman.id.au, oliver.sang@...el.com,
vbabka@...e.cz
Subject: Re: [PATCH v1] selftest mm/mseal: fix test_seal_mremap_move_dontunmap_anyaddr
On Wed, Aug 7, 2024 at 7:03 PM Jeff Xu <jeffxu@...gle.com> wrote:
<snip>
>
> test_seal_mremap_move_dontunmap use 0 as new_addr, 0 indicates
> allocating a new memory.
> test_seal_mremap_move_dontunmap_anyaddr uses any arbitrary address as
> a new address.
No, MREMAP_DONTUNMAP uses the address you pass as a hint, aka you're
just testing get_unmapped_area, not any mseal capability.
There's no forced moving here.
>
> > You also don't know if 0xdead0000 is a valid page (hexagon for
> > instance seems to support 256KiB and 1MiB pages, so does ppc32, and
> > this is not something that should be hardcoded).
> >
> usually hardcode value is not good practice, but the point of this
> test is to show
> mremap can really relocate the mapping to an arbitrary address.
That's what test_seal_mremap_move_dontunmap does, no?
>
> Do you have any suggestions here ? I can think of two options to choose from:
>
> 1> use 0xd0000000
> 2> allocate a memory then free it, reuse the ptr.
Personally I'd prefer 2, if you really want to keep the test. It's
also a strategy used elsewhere (e.g mremap_dontunmap.c).
FWIW I don't have the mental strength to bikeshed over this any more,
so please do what you think is best!
--
Pedro
Powered by blists - more mailing lists