[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <76cd8347-a8d0-3b56-a202-17ba2a73503d@linuxfoundation.org>
Date: Thu, 21 Apr 2022 13:31:56 -0600
From: Shuah Khan <skhan@...uxfoundation.org>
To: Sidhartha Kumar <sidhartha.kumar@...cle.com>, shuah@...nel.org,
akpm@...ux-foundation.org
Cc: linux-mm@...ck.org, linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org,
Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH v2 2/4] selftest/vm: verify remap destination address in
mremap_test
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@...cle.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@...uxfoundation.org>
Andrew, please let me know if you would like me to take this
through kselftest tree.
Powered by blists - more mailing lists