Patch "selftests/memfd: clean up mapping in mfd_fail_write" has been added to the 4.9-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    selftests/memfd: clean up mapping in mfd_fail_write

to the 4.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     selftests-memfd-clean-up-mapping-in-mfd_fail_write.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit c51354c4a2866467dcc3bceb3dfb04958614475a
Author: Mike Kravetz <mike.kravetz@xxxxxxxxxx>
Date:   Fri Feb 25 19:11:26 2022 -0800

    selftests/memfd: clean up mapping in mfd_fail_write
    
    [ Upstream commit fda153c89af344d21df281009a9d046cf587ea0f ]
    
    Running the memfd script ./run_hugetlbfs_test.sh will often end in error
    as follows:
    
        memfd-hugetlb: CREATE
        memfd-hugetlb: BASIC
        memfd-hugetlb: SEAL-WRITE
        memfd-hugetlb: SEAL-FUTURE-WRITE
        memfd-hugetlb: SEAL-SHRINK
        fallocate(ALLOC) failed: No space left on device
        ./run_hugetlbfs_test.sh: line 60: 166855 Aborted                 (core dumped) ./memfd_test hugetlbfs
        opening: ./mnt/memfd
        fuse: DONE
    
    If no hugetlb pages have been preallocated, run_hugetlbfs_test.sh will
    allocate 'just enough' pages to run the test.  In the SEAL-FUTURE-WRITE
    test the mfd_fail_write routine maps the file, but does not unmap.  As a
    result, two hugetlb pages remain reserved for the mapping.  When the
    fallocate call in the SEAL-SHRINK test attempts allocate all hugetlb
    pages, it is short by the two reserved pages.
    
    Fix by making sure to unmap in mfd_fail_write.
    
    Link: https://lkml.kernel.org/r/20220219004340.56478-1-mike.kravetz@xxxxxxxxxx
    Signed-off-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx>
    Cc: Joel Fernandes <joel@xxxxxxxxxxxxxxxxx>
    Cc: Shuah Khan <shuah@xxxxxxxxxx>
    Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/testing/selftests/memfd/memfd_test.c b/tools/testing/selftests/memfd/memfd_test.c
index 26546892cd54..faab09215c88 100644
--- a/tools/testing/selftests/memfd/memfd_test.c
+++ b/tools/testing/selftests/memfd/memfd_test.c
@@ -373,6 +373,7 @@ static void mfd_fail_write(int fd)
 			printf("mmap()+mprotect() didn't fail as expected\n");
 			abort();
 		}
+		munmap(p, mfd_def_size);
 	}
 
 	/* verify PUNCH_HOLE fails */



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux