[LTP] [PATCH 1/1] mmap20: Fix invalid address
Jan Stancek
jstancek@redhat.com
Wed Apr 5 10:09:16 CEST 2023
On Tue, Apr 4, 2023 at 1:29 PM Petr Vorel <pvorel@suse.cz> wrote:
>
> 1 << 7 (0x80) is defined as MAP_LOCKED on ppc64le and mips.
> Use 1 << 9 (0x200), which looks to be unused on all archs.
>
> Fixes: 2764e9e6a ("mmap20: New test for mmap() with MAP_SHARED_VALIDATE")
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
Should work. Alternative is we don't map a file, and then add MAP_SYNC to flags,
which looking at LEGACY_MAP_MASK should also give us -EOPNOTSUPP.
I'd go with the patch, we can tweak it later if someone has better idea:
Acked-by: Jan Stancek <jstancek@redhat.com>
> ---
> NOTE: (1 << 10) would work as well.
>
> testcases/kernel/syscalls/mmap/mmap20.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/testcases/kernel/syscalls/mmap/mmap20.c b/testcases/kernel/syscalls/mmap/mmap20.c
> index c346df5d1..5269179e5 100644
> --- a/testcases/kernel/syscalls/mmap/mmap20.c
> +++ b/testcases/kernel/syscalls/mmap/mmap20.c
> @@ -20,7 +20,7 @@
>
> #define TEST_FILE "file_to_mmap"
> #define TEST_FILE_SIZE 1024
> -#define INVALID_FLAG (1 << 7)
> +#define INVALID_FLAG (1 << 9)
>
> static int fd = -1;
> static void *addr;
> --
> 2.40.0
>
More information about the ltp
mailing list