Skip to content

Commit

Permalink
syscalls/process_madvise01: fix smaps scan and min_swap_avail
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Andrea Cervesato <[email protected]>
  • Loading branch information
jstancek committed Oct 27, 2023
1 parent 35f77e7 commit a3830ba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a3830ba

Please sign in to comment.