diff options
author | Jan Stancek <jstancek@redhat.com> | 2023-10-19 10:48:39 +0200 |
---|---|---|
committer | Edward Liaw <edliaw@google.com> | 2024-01-18 18:20:49 +0000 |
commit | b047a31487766dec7a6601047d7031c8042355d1 (patch) | |
tree | 69bf60c9e24620b7c4ef42613437f1cedf98960f | |
parent | 4ba13b822a557e3638d19167e6a3c71db6234d1f (diff) | |
download | ltp-b047a31487766dec7a6601047d7031c8042355d1.tar.gz |
syscalls/process_madvise01: fix smaps scan and min_swap_avail
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>
Acked-by: Andrea Cervesato <andrea.cervesato@mailbox.org>
(cherry picked from commit a3830bafbe8350be8190d48176321fe79812f4c2)
Bug: 305297408
Test: atest -a vts_ltp_test_x86_64:syscalls.process_madvise01_64bit
Signed-off-by: Edward Liaw <edliaw@google.com>
(cherry picked from https://android-review.googlesource.com/q/commit:f6fbadd71f8357db8254dd2f7913d6ee9c1c73d1)
Change-Id: I85da5f16af8c237fa404437315ed1d1466547c28
Merged-In: I85da5f16af8c237fa404437315ed1d1466547c28
-rw-r--r-- | testcases/kernel/syscalls/process_madvise/process_madvise.h | 2 | ||||
-rw-r--r-- | 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 c4570e530..5b227ada0 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 322b4cf60..0fd3c1ef4 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 |