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 Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux