Re: [PATCH v2 2/4] selftest/vm: verify remap destination address in mremap_test

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

 



On 4/20/22 3:57 PM, Sidhartha Kumar wrote:
Because mremap does not have a MAP_FIXED_NOREPLACE flag, it can destroy
existing mappings. This causes a segfault when regions such as text are
remapped and the permissions are changed.

Verify the requested mremap destination address does not overlap any
existing mappings by using mmap's MAP_FIXED_NOREPLACE flag. Keep
incrementing the destination address until a valid mapping is found or
fail the current test once the max address is reached.

Signed-off-by: Sidhartha Kumar <sidhartha.kumar@xxxxxxxxxx>
---
v2:
-rename remap_region_valid() to is_remap_region_valid().
-change return value of is_remap_region_valid() to bool.
-take out overflow check from is_remap_region_valid() to
  inside caller.
-fail just the current test on overflow rather than existing
  the program
-fix alignment of mmap calls
-change "can't" to "couldn't" in error message
-increment mremap destination address by dest_alignment
  rather than src_alignment

Thank you.

Reviewed-by: Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx>

Andrew, please let me know if you would like me to take this
through kselftest tree.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux