]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
selftests: mm: fix map_hugetlb failure on 64K page size systems
authorNico Pache <npache@redhat.com>
Fri, 19 Jan 2024 13:14:29 +0000 (06:14 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Feb 2024 08:51:29 +0000 (09:51 +0100)
commit8e83cec7396e898c0b67e88f06ca58df43f30bd0
tree98d1a89a63366dc21473da4c5fc9afe41cd5b7f6
parent16a0a9e60a7e7b8e7181ac5ae4fec6bec0056c6c
selftests: mm: fix map_hugetlb failure on 64K page size systems

commit 91b80cc5b39f00399e8e2d17527cad2c7fa535e2 upstream.

On systems with 64k page size and 512M huge page sizes, the allocation and
test succeeds but errors out at the munmap.  As the comment states, munmap
will failure if its not HUGEPAGE aligned.  This is due to the length of
the mapping being 1/2 the size of the hugepage causing the munmap to not
be hugepage aligned.  Fix this by making the mapping length the full
hugepage if the hugepage is larger than the length of the mapping.

Link: https://lkml.kernel.org/r/20240119131429.172448-1-npache@redhat.com
Signed-off-by: Nico Pache <npache@redhat.com>
Cc: Donet Tom <donettom@linux.vnet.ibm.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Christophe Leroy <christophe.leroy@c-s.fr>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/testing/selftests/mm/map_hugetlb.c