Skip to content

Commit 88c9162

Browse files
Fix the test case in D88686
Adjusted when to check RSS.
1 parent 9ae95a0 commit 88c9162

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

compiler-rt/test/dfsan/munmap_release_shadow.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,14 @@ int main(int argc, char **argv) {
3232
munmap(p, map_size);
3333
size_t after_munmap = get_rss_kb();
3434

35-
fprintf(stderr, "RSS at start: %td, after mmap: %td, after mumap: %td\n",
36-
before, after_mmap, after_munmap);
35+
p = mmap(NULL, map_size, PROT_READ | PROT_WRITE,
36+
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
37+
dfsan_set_label(label, &val, sizeof(val));
38+
memset(p, val, map_size);
39+
size_t after_mmap2 = get_rss_kb();
40+
41+
fprintf(stderr, "RSS at start: %td, after mmap: %td, after mumap: %td, after mmap2: %td\n",
42+
before, after_mmap, after_munmap, after_mmap2);
3743

3844
// The memory after mmap increases 3 times of map_size because the overhead of
3945
// shadow memory is 2x.
@@ -42,6 +48,7 @@ int main(int argc, char **argv) {
4248
// OS does not release memory to the same level as the start of the program.
4349
// The assert checks the memory after munmap up to a delta.
4450
const size_t delta = 50000;
45-
assert(after_munmap + delta <= after_mmap);
51+
assert(after_mmap2 <= after_mmap + delta);
52+
4653
return 0;
4754
}

0 commit comments

Comments
 (0)