Skip to content

Commit

Permalink
PR_SET_VMA has been empirically observed to return ENOMEM on kernels …
Browse files Browse the repository at this point in the history
…without CONFIG_ANON_VMA_NAME,
  • Loading branch information
khuey committed Jul 31, 2023
1 parent fcc3b95 commit 1850755
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/test/prctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,13 @@ int main(void) {
test_assert(0 == ret || (-1 == ret && errno == EPERM));

// On a kernel without PR_SET_VMA, this will return EINVAL.
// On a kernel with PR_SET_VMA but without CONFIG_ANON_VMA_NAME,
// it will return ENOMEM.
// On a kernel with it, it should return EBADF, because
// the rr page is not an anonymous mapping.
ssize_t page_size = sysconf(_SC_PAGE_SIZE);
test_assert(-1 == prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, 0x7000000, page_size, "foo") &&
(errno == EINVAL || errno == EBADF));
(errno == EINVAL || errno == EBADF || errno == ENOMEM));

atomic_puts("EXIT-SUCCESS");
return 0;
Expand Down

0 comments on commit 1850755

Please sign in to comment.