tests: remove manual creation of memory mapping holes
We used to call tail_alloc(1) to create memory mapping holes around regular tail_alloc allocations. This is no longer needed since regular tail_alloc allocations create additional memory mapping holes. * tests/clock_adjtime.c (main): Remove creation of memory mapping holes using tail_alloc(1). * tests/futimesat.c (main): Likewise. * tests/get_mempolicy.c (print_nodes, main): Likewise. * tests/getgroups.c (main): Likewise. * tests/getresugid.c (main): Likewise. * tests/ioctl_uffdio.c (main): Likewise. * tests/ioctl_v4l2.c (main): Likewise. * tests/move_pages.c (main): Likewise. * tests/net-icmp_filter.c (main): Likewise. * tests/ptrace.c (test_peeksiginfo, main): Likewise. * tests/pwritev.c (main): Likewise. * tests/set_mempolicy.c (print_nodes): Likewise. * tests/setgroups.c (main): Likewise. * tests/umovestr3.c (main): Likewise. * tests/utimes.c (main): Likewise. * tests/xattr.c (main): Likewise.
This commit is contained in:
parent
0f303f99c6
commit
62a35fa572
@ -44,7 +44,6 @@ main(void)
|
||||
rc, errno2name());
|
||||
|
||||
void *efault = tail_alloc(1);
|
||||
(void) tail_alloc(1);
|
||||
|
||||
rc = syscall(__NR_clock_adjtime, CLOCK_REALTIME, efault);
|
||||
printf("clock_adjtime(CLOCK_REALTIME, %p) = %ld %s (%m)\n",
|
||||
|
@ -56,7 +56,6 @@ main(void)
|
||||
sample, rc, errno2name());
|
||||
|
||||
struct timeval *const ts = tail_alloc(sizeof(*ts) * 2);
|
||||
(void) tail_alloc(1);
|
||||
dirfd = (unsigned long) 0xdeadbeefffffffff;
|
||||
|
||||
rc = syscall(__NR_futimesat, dirfd, 0, ts + 1);
|
||||
|
@ -47,7 +47,6 @@ print_nodes(unsigned long maxnode)
|
||||
{
|
||||
unsigned long *const nodemask =
|
||||
tail_alloc(sizeof(*nodemask) * NLONGS(maxnode));
|
||||
(void) tail_alloc(1);
|
||||
|
||||
if (syscall(__NR_get_mempolicy, 0, nodemask, maxnode, 0, 0)) {
|
||||
printf("get_mempolicy(NULL, %p, %lu, NULL, 0) = -1 %s (%m)\n",
|
||||
@ -92,9 +91,7 @@ main(void)
|
||||
"MPOL_F_NODE|MPOL_F_ADDR",
|
||||
flags & ~3, rc, errno2name());
|
||||
|
||||
(void) tail_alloc(1);
|
||||
mode = tail_alloc(sizeof(*mode));
|
||||
(void) tail_alloc(1);
|
||||
|
||||
rc = syscall(__NR_get_mempolicy, mode, 0, 0, 0, 0);
|
||||
printf("get_mempolicy([");
|
||||
|
@ -125,7 +125,6 @@ main(void)
|
||||
tail_alloc(ngroups ? sizeof(*g1) * ngroups : 1);
|
||||
GID_TYPE *const g2 = tail_alloc(sizeof(*g2) * (ngroups + 1));
|
||||
void *efault = g2 + ngroups + 1;
|
||||
(void) tail_alloc(1);
|
||||
|
||||
get_groups(ngroups, g1);
|
||||
get_groups(ngroups + 1, g1);
|
||||
|
@ -37,7 +37,6 @@ main(void)
|
||||
unsigned UGID_TYPE *const r = tail_alloc(sizeof(*r));
|
||||
unsigned UGID_TYPE *const e = tail_alloc(sizeof(*e));
|
||||
unsigned UGID_TYPE *const s = tail_alloc(sizeof(*s));
|
||||
(void) tail_alloc(1);
|
||||
|
||||
if (syscall(SYSCALL_NR, r, e, s))
|
||||
perror_msg_and_fail(SYSCALL_NAME);
|
||||
|
@ -54,7 +54,6 @@ main(void)
|
||||
perror_msg_and_skip("userfaultfd");
|
||||
|
||||
/* ---- API ---- */
|
||||
(void) tail_alloc(1);
|
||||
struct uffdio_api *api_struct = tail_alloc(sizeof(*api_struct));
|
||||
|
||||
/* With a bad fd */
|
||||
@ -96,7 +95,6 @@ main(void)
|
||||
*(char *)area1 = 42;
|
||||
|
||||
/* ---- REGISTER ---- */
|
||||
(void) tail_alloc(1);
|
||||
struct uffdio_register *register_struct =
|
||||
tail_alloc(sizeof(*register_struct));
|
||||
memset(register_struct, 0, sizeof(*register_struct));
|
||||
@ -129,7 +127,6 @@ main(void)
|
||||
* userfaultfd will cause us to stall.
|
||||
*/
|
||||
/* ---- COPY ---- */
|
||||
(void) tail_alloc(1);
|
||||
struct uffdio_copy *copy_struct = tail_alloc(sizeof(*copy_struct));
|
||||
|
||||
memset(copy_struct, 0, sizeof(*copy_struct));
|
||||
@ -151,7 +148,6 @@ main(void)
|
||||
fd, area2, area1, pagesize, pagesize, rc);
|
||||
|
||||
/* ---- ZEROPAGE ---- */
|
||||
(void) tail_alloc(1);
|
||||
struct uffdio_zeropage *zero_struct = tail_alloc(sizeof(*zero_struct));
|
||||
madvise(area2, pagesize, MADV_DONTNEED);
|
||||
|
||||
@ -173,7 +169,6 @@ main(void)
|
||||
fd, area2, pagesize, pagesize, rc);
|
||||
|
||||
/* ---- WAKE ---- */
|
||||
(void) tail_alloc(1);
|
||||
struct uffdio_range *range_struct = tail_alloc(sizeof(*range_struct));
|
||||
memset(range_struct, 0, sizeof(*range_struct));
|
||||
|
||||
|
@ -47,11 +47,8 @@ init_magic(void *addr, const unsigned int size)
|
||||
int
|
||||
main(void )
|
||||
{
|
||||
(void) tail_alloc(1);
|
||||
const unsigned int size = get_page_size();
|
||||
(void) tail_alloc(1);
|
||||
void *const page = tail_alloc(size);
|
||||
(void) tail_alloc(1);
|
||||
init_magic(page, size);
|
||||
|
||||
const union u_pixel_format {
|
||||
|
@ -199,14 +199,12 @@ main(void)
|
||||
const unsigned long pid =
|
||||
(unsigned long) 0xfacefeed00000000 | getpid();
|
||||
unsigned long count = 1;
|
||||
(void) tail_alloc(1);
|
||||
const unsigned page_size = get_page_size();
|
||||
const void *const page = tail_alloc(page_size);
|
||||
const void *const efault = page + page_size;
|
||||
const void **pages = tail_alloc(sizeof(*pages));
|
||||
int *nodes = tail_alloc(sizeof(*nodes));
|
||||
int *status = tail_alloc(sizeof(*status));
|
||||
(void) tail_alloc(1);
|
||||
|
||||
print_stat_pages(pid, 0, pages, status);
|
||||
print_move_pages(pid, 0, 0, pages, nodes, status);
|
||||
|
@ -43,7 +43,6 @@ main(void)
|
||||
printf("setsockopt(-1, SOL_RAW, ICMP_FILTER, NULL, 0) = -1 %s (%m)\n",
|
||||
errno2name());
|
||||
|
||||
(void) tail_alloc(1);
|
||||
socklen_t *const plen = tail_alloc(sizeof(*plen));
|
||||
void *const efault = plen + 1;
|
||||
struct icmp_filter *const f = tail_alloc(sizeof(*f));
|
||||
|
@ -59,7 +59,6 @@ test_peeksiginfo(unsigned long pid, const unsigned long bad_request)
|
||||
unsigned long long off;
|
||||
unsigned int flags, nr;
|
||||
} *const psi = tail_alloc(sizeof(*psi));
|
||||
(void) tail_alloc(1);
|
||||
|
||||
psi->off = 0xdeadbeeffacefeed;
|
||||
psi->flags = 1;
|
||||
@ -100,7 +99,6 @@ test_peeksiginfo(unsigned long pid, const unsigned long bad_request)
|
||||
const unsigned int nsigs = 4;
|
||||
const uid_t uid = geteuid();
|
||||
siginfo_t *sigs = tail_alloc(sizeof(*sigs) * nsigs);
|
||||
(void) tail_alloc(1);
|
||||
|
||||
psi->off = 0;
|
||||
psi->flags = 0;
|
||||
@ -188,10 +186,8 @@ main(void)
|
||||
if (!sigset_size)
|
||||
perror_msg_and_fail("rt_sigprocmask");
|
||||
|
||||
(void) tail_alloc(1);
|
||||
void *const k_set = tail_alloc(sigset_size);
|
||||
siginfo_t *const sip = tail_alloc(sizeof(*sip));
|
||||
(void) tail_alloc(1);
|
||||
|
||||
long rc = do_ptrace(bad_request, pid, 0, 0);
|
||||
printf("ptrace(%#lx /* PTRACE_??? */, %u, NULL, NULL) = %ld %s (%m)\n",
|
||||
|
@ -95,7 +95,6 @@ main(void)
|
||||
iov[i].iov_base = &buf[i];
|
||||
iov[i].iov_len = LEN - i;
|
||||
}
|
||||
tail_alloc(1);
|
||||
|
||||
const off_t offset = 0xdefaceddeadbeefLL;
|
||||
long rc;
|
||||
|
@ -56,7 +56,6 @@ print_nodes(const unsigned long maxnode, unsigned int offset)
|
||||
unsigned long *const nodemask =
|
||||
tail_alloc(size ? size : (offset ? 1 : 0));
|
||||
memset(nodemask, 0, size);
|
||||
(void) tail_alloc(1);
|
||||
|
||||
long rc = syscall(__NR_set_mempolicy, 0, nodemask, maxnode);
|
||||
int saved_errno = errno;
|
||||
|
@ -88,7 +88,6 @@ main(void)
|
||||
const GID_TYPE *const g1 = tail_alloc(sizeof(*g1));
|
||||
GID_TYPE *const g2 = tail_alloc(sizeof(*g2) * 2);
|
||||
GID_TYPE *const g3 = tail_alloc(sizeof(*g3) * 3);
|
||||
(void) tail_alloc(1);
|
||||
|
||||
if (syscall(SYSCALL_NR, 0, g1 + 1))
|
||||
printf("%s(0, []) = -1 %s (%m)\n",
|
||||
|
@ -33,12 +33,9 @@
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
(void) tail_alloc(1);
|
||||
const unsigned int size = PATH_MAX - 1;
|
||||
const char *p = tail_alloc(size);
|
||||
const char *const efault = p + size;
|
||||
(void) tail_alloc(1);
|
||||
(void) tail_alloc(1);
|
||||
|
||||
for (; p <= efault; ++p) {
|
||||
int rc = chdir(p);
|
||||
|
@ -55,7 +55,6 @@ main(void)
|
||||
sample, rc, errno2name());
|
||||
|
||||
struct timeval *const ts = tail_alloc(sizeof(*ts) * 2);
|
||||
(void) tail_alloc(1);
|
||||
|
||||
rc = syscall(__NR_utimes, 0, ts + 1);
|
||||
printf("utimes(NULL, %p) = %ld %s (%m)\n",
|
||||
|
@ -44,12 +44,10 @@ main(void)
|
||||
static const char c_value[] = "foo\0bar";
|
||||
static const char q_value[] = "foo\\0bar";
|
||||
|
||||
tail_alloc(1);
|
||||
const char *const z_value = tail_memdup(c_value, sizeof(c_value));
|
||||
char *const efault = tail_alloc(1) + 1;
|
||||
const char *const value = tail_memdup(c_value, sizeof(c_value) - 1);
|
||||
char *const big = tail_alloc(XATTR_SIZE_MAX + 1);
|
||||
tail_alloc(1);
|
||||
|
||||
assert(fsetxattr(-1, 0, 0, 0, XATTR_CREATE) == -1);
|
||||
printf("fsetxattr(-1, NULL, NULL, 0, XATTR_CREATE) = -1 %s (%m)\n",
|
||||
|
Loading…
Reference in New Issue
Block a user