[LTP] [PATCH] syscalls/process_madvise01: fix smaps scan and min_swap_avail

Andrea Cervesato andrea.cervesato@suse.com
Thu Oct 19 10:58:19 CEST 2023


Hi!

On 10/19/23 10:51, Jan Stancek wrote:
> smaps matching can prematurely end, because the comparison to "VmFlags"
> string is not exact. So depending on address on line, it can break
> before it finds Swap line. This makes the test fail on recent aarch64
> kernels.
>
> min_swap_avail per documentation is in MB not KB.
>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> ---
>   testcases/kernel/syscalls/process_madvise/process_madvise.h   | 2 +-
>   testcases/kernel/syscalls/process_madvise/process_madvise01.c | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/process_madvise/process_madvise.h b/testcases/kernel/syscalls/process_madvise/process_madvise.h
> index c4570e5309de..5b227ada099e 100644
> --- a/testcases/kernel/syscalls/process_madvise/process_madvise.h
> +++ b/testcases/kernel/syscalls/process_madvise/process_madvise.h
> @@ -54,7 +54,7 @@ static inline void read_address_mapping(unsigned long address, struct addr_mappi
>   		if (!found)
>   			continue;
>   
> -		if (found && strcmp(line, "VmFlags") >= 0)
> +		if (found && strncmp(line, "VmFlags", 7) == 0)
>   			break;
>   
>   		if (sscanf(line, "%31[^:]: %d", label, &value) > 0) {
> diff --git a/testcases/kernel/syscalls/process_madvise/process_madvise01.c b/testcases/kernel/syscalls/process_madvise/process_madvise01.c
> index 322b4cf60353..0fd3c1ef4f80 100644
> --- a/testcases/kernel/syscalls/process_madvise/process_madvise01.c
> +++ b/testcases/kernel/syscalls/process_madvise/process_madvise01.c
> @@ -123,7 +123,7 @@ static struct tst_test test = {
>   	.min_kver = "5.10",
>   	.needs_checkpoints = 1,
>   	.needs_root = 1,
> -	.min_swap_avail = MEM_CHILD / TST_KB,
> +	.min_swap_avail = MEM_CHILD / TST_MB,
>   	.needs_kconfigs = (const char *[]) {
>   		"CONFIG_SWAP=y",
>   		NULL

Thanks for fixing this.

Andrea Cervesato



More information about the ltp mailing list