lkml.org 
[lkml]   [2022]   [Apr]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 2/4] selftest/vm: verify remap destination address in mremap_test
From
Date
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@oracle.com>
> ---
> 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@linuxfoundation.org>

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

\
 
 \ /
  Last update: 2022-04-21 21:33    [W:0.130 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site