]> granicus.if.org Git - strace/commitdiff
tests: replace casts of 0xffffffff00000000ULL with F8ILL_KULONG_MASK
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 16 Feb 2017 16:36:14 +0000 (16:36 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 16 Feb 2017 16:36:14 +0000 (16:36 +0000)
* tests/init_delete_module.h (bogus_zero): Remove.
* tests/delete_module.c (main): Replace bogus_zero and
(kernel_ulong_t) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.
* tests/finit_module.c (main): Replace bogus_zero
with F8ILL_KULONG_MASK.
* tests/init_module.c (main): Likewise.
* tests/pipe2.c (main): Likewise.
* tests/epoll_ctl.c (invoke_syscall): Replace
(unsigned long) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.
* tests/rt_tgsigqueueinfo.c (k_tgsigqueueinfo): Likewise.
* tests/fanotify_init.c (main): Likewise.
* tests/xetpgid.c (main): Likewise.
* tests/xetpriority.c (main): Likewise.
(kernel_ulong_t) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.
* tests/fanotify_mark.c (main): Likewise.
* tests/file_handle.c (main): Likewise.
* tests/kexec_load.c (main): Likewise.
* tests/setfsugid.c (main): Likewise.
* tests/getgroups.c (main): Replace (long) 0xffffffff00000000ULL
with F8ILL_KULONG_MASK.
* tests/setgroups.c (main): Replace (long) 0xffffffff00000000ULL
and (unsigned long) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.

16 files changed:
tests/delete_module.c
tests/epoll_ctl.c
tests/fanotify_init.c
tests/fanotify_mark.c
tests/file_handle.c
tests/finit_module.c
tests/getgroups.c
tests/init_delete_module.h
tests/init_module.c
tests/kexec_load.c
tests/pipe2.c
tests/rt_tgsigqueueinfo.c
tests/setfsugid.c
tests/setgroups.c
tests/xetpgid.c
tests/xetpriority.c

index 5a317603506a6cc504fea400aa444b39e4c92e83..c8492fed2128f397d291eab1d80576d2ed0f8f47 100644 (file)
@@ -48,8 +48,7 @@ main(void)
                unsigned int val_prefix, val_suffix;
        } flags[] = {
                { ARG_STR(0), 0, 0 },
-               { (kernel_ulong_t) 0xffffffff00000000ULL | O_NONBLOCK,
-                       "O_NONBLOCK", 0, 0 },
+               { F8ILL_KULONG_MASK | O_NONBLOCK, "O_NONBLOCK", 0, 0 },
                { (kernel_ulong_t) 0xbadc0dedfacef157ULL & ~(O_NONBLOCK | O_TRUNC),
                        " /* O_??? */", 0xfacef157U & ~(O_NONBLOCK | O_TRUNC), 0},
                { (kernel_ulong_t) (0xfacef157deade71cULL & ~O_NONBLOCK) | O_TRUNC,
@@ -65,7 +64,7 @@ main(void)
        fill_memory_ex(bogus_param1, PARAM1_LEN, PARAM1_BASE, PARAM1_LEN);
        fill_memory_ex(bogus_param2, PARAM2_LEN, PARAM2_BASE, PARAM2_LEN);
 
-       rc = syscall(__NR_delete_module, NULL, bogus_zero);
+       rc = syscall(__NR_delete_module, NULL, F8ILL_KULONG_MASK);
        printf("delete_module(NULL, 0) = %s\n", sprintrc(rc));
 
        rc = syscall(__NR_delete_module, bogus_param1, flags[0].val);
index e666055567d3ecc9d6ae4a6373c7e4336be16d40..ca4a959e27c7ca863e22fd990418a1b6c3424af7 100644 (file)
@@ -11,8 +11,8 @@
 static long
 invoke_syscall(unsigned long epfd, unsigned long op, unsigned long fd, void *ev)
 {
-       op |= (unsigned long) 0xffffffff00000000ULL;
-       return syscall(__NR_epoll_ctl, epfd, op, fd, (unsigned long) ev);
+       return syscall(__NR_epoll_ctl, epfd, F8ILL_KULONG_MASK | op,
+                      fd, (unsigned long) ev);
 }
 
 int
index c14b413186323d3c24bf17a5bc582d3061714a10..b3808d78676fc80276b3f8ec22333933a663f0a2 100644 (file)
@@ -60,7 +60,7 @@ int
 main(void)
 {
        static const struct strval flags[] = {
-               { (kernel_ulong_t) 0xffffffff00000000ULL, "FAN_CLASS_NOTIF" },
+               { F8ILL_KULONG_MASK, "FAN_CLASS_NOTIF" },
                { (kernel_ulong_t) 0xffffffff0000000cULL,
                        "0xc /* FAN_CLASS_??? */" },
                { (kernel_ulong_t) 0xdec0deddefaced04ULL,
@@ -70,7 +70,7 @@ main(void)
                        "FAN_UNLIMITED_QUEUE|FAN_UNLIMITED_MARKS|0xffffffc0" },
        };
        static const struct strval event_f_flags[] = {
-               { (kernel_ulong_t) 0xffffffff00000000ULL, "O_RDONLY" },
+               { F8ILL_KULONG_MASK, "O_RDONLY" },
                { (kernel_ulong_t) 0xdeadbeef80000001ULL,
                        "O_WRONLY|0x80000000" }
        };
index 43f285d33bc408724bbe94f66154235be18ff94c..b78ae3bffc4f9de64ba69bc750c5de151e204a3d 100644 (file)
@@ -90,11 +90,11 @@ main(void)
 
        static const kernel_ulong_t fds[] = {
                (kernel_ulong_t) 0xdeadfeed12345678ULL,
-               (kernel_ulong_t) 0xffffffff00000000ULL,
+               F8ILL_KULONG_MASK,
                (kernel_ulong_t) 0xdeb0d1edffffffffULL,
        };
        static const struct strval flags[] = {
-               { (kernel_ulong_t) 0xffffffff00000000ULL, "0" },
+               { F8ILL_KULONG_MASK, "0" },
                { (kernel_ulong_t) 0xdec0deddefaced00ULL,
                        "0xefaced00 /* FAN_MARK_??? */" },
                { (kernel_ulong_t) 0xda7a105700000040ULL,
index a5ad6c73d74ae0130b1b52c44fc4fdfe1a44ec09..175cae0f914d4604861263300bd06224b177991e 100644 (file)
@@ -187,7 +187,7 @@ main(void)
                (kernel_ulong_t) 0x12345678ffffff9cULL,
        };
        static const struct strval open_flags[] = {
-               { (kernel_ulong_t) 0xffffffff00000000ULL, "O_RDONLY" },
+               { F8ILL_KULONG_MASK, "O_RDONLY" },
                { (kernel_ulong_t) 0xdeadbeef80000001ULL,
                        "O_WRONLY|0x80000000" }
        };
index 3f0178f73d7931eccb3e4539708de6fa677155d6..ad87fc0aef0ce2917eab081c736c8f8b0bfc213c 100644 (file)
@@ -68,7 +68,8 @@ main(void)
        fill_memory_ex(bogus_param1, PARAM1_LEN, PARAM1_BASE, PARAM1_LEN);
        fill_memory_ex(bogus_param2, PARAM2_LEN, PARAM2_BASE, PARAM2_LEN);
 
-       rc = syscall(__NR_finit_module, bogus_zero, NULL, bogus_zero);
+       rc = syscall(__NR_finit_module, F8ILL_KULONG_MASK, NULL,
+                    F8ILL_KULONG_MASK);
        printf("finit_module(0, NULL, 0) = %s\n", sprintrc(rc));
 
        rc = syscall(__NR_finit_module, bogus_fd, bogus_param1, flags[0].val);
index 2617303f19c0731a84dba7236ba6223ffd08dce0..b76dd09eb23519fe65502c0a078054629a511138 100644 (file)
@@ -91,7 +91,7 @@ main(void)
        if (ngroups < 0)
                perror_msg_and_fail(SYSCALL_NAME);
 
-       rc = syscall(SYSCALL_NR, (long) 0xffffffff00000000ULL, 0);
+       rc = syscall(SYSCALL_NR, F8ILL_KULONG_MASK, 0);
        printf("%s(0, NULL) = %ld\n", SYSCALL_NAME, rc);
 
        rc = syscall(SYSCALL_NR, -1U, 0);
@@ -105,7 +105,7 @@ main(void)
        rc = syscall(SYSCALL_NR, ngroups_max, 0);
        printf("%s(%d, NULL) = %s\n", SYSCALL_NAME, ngroups_max, sprintrc(rc));
 
-       rc = syscall(SYSCALL_NR, (long) 0xffffffff00000000ULL | ngroups_max, 0);
+       rc = syscall(SYSCALL_NR, F8ILL_KULONG_MASK | ngroups_max, 0);
        printf("%s(%d, NULL) = %s\n", SYSCALL_NAME, ngroups_max, sprintrc(rc));
 
        /* check how the second argument is decoded */
index db550c33ca70e099c62a5e19efb27dea786177d8..441e4593d512f95536ee58c708093c841a2b357e 100644 (file)
@@ -42,9 +42,6 @@ enum {
        MAX_STRLEN = 32,
 };
 
-static const kernel_ulong_t bogus_zero =
-       (kernel_ulong_t) 0xffffffff00000000ULL;
-
 static void
 print_str(unsigned int base, unsigned int len, bool escape)
 {
index 88ef9ec83418c00b7a523a8d59c2b6d393b52446..ad6e9f39469a82d973ea659c752066f356a4ed8b 100644 (file)
@@ -55,9 +55,9 @@ main(void)
        fill_memory_ex(bogus_param1, PARAM1_LEN, PARAM1_BASE, PARAM1_LEN);
        fill_memory_ex(bogus_param2, PARAM2_LEN, PARAM2_BASE, PARAM2_LEN);
 
-       rc = syscall(__NR_init_module, NULL, bogus_zero, NULL);
+       rc = syscall(__NR_init_module, NULL, F8ILL_KULONG_MASK, NULL);
        printf("init_module(NULL, %llu, NULL) = %s\n",
-              (unsigned long long) bogus_zero, sprintrc(rc));
+              (unsigned long long) F8ILL_KULONG_MASK, sprintrc(rc));
 
        rc = syscall(__NR_init_module, bogus_addr, 0, bogus_param1);
        errstr = sprintrc(rc);
index 330238de050985519b732071d8adbf061351e3ed..6588bfff7342c7952cd8ec5b7b4277c98a1ca387 100644 (file)
@@ -62,8 +62,7 @@ main(void)
        };
 
        static const kernel_ulong_t bogus_zero =
-               sizeof(long) < sizeof(kernel_long_t) ?
-                       (kernel_ulong_t) 0xffffffff00000000ULL : 0;
+               sizeof(long) < sizeof(kernel_long_t) ? F8ILL_KULONG_MASK : 0;
        static const kernel_ulong_t bogus_entry =
                (kernel_ulong_t) 0xdeadca57badda7a1ULL;
        static const kernel_ulong_t bogus_nsegs =
index 375ae74f107e3cb0616e2706f9f549f33f1170a1..3a0e04631599832022577d875c70fe636a26f4f0 100644 (file)
 int
 main(void)
 {
-       static const kernel_ulong_t bogus_zero =
-               (kernel_ulong_t) 0xffffffff00000000ULL;
        int *const fds = tail_alloc(sizeof(*fds) * 2);
        int *const efault = fds + 1;
        long rc;
 
-       rc = syscall(__NR_pipe2, fds, bogus_zero | O_NONBLOCK);
+       rc = syscall(__NR_pipe2, fds, F8ILL_KULONG_MASK | O_NONBLOCK);
        if (rc)
                perror_msg_and_skip("pipe2");
        printf("pipe2([%d, %d], O_NONBLOCK) = 0\n", fds[0], fds[1]);
 
-       rc = syscall(__NR_pipe2, efault, bogus_zero);
+       rc = syscall(__NR_pipe2, efault, F8ILL_KULONG_MASK);
        printf("pipe2(%p, 0) = %s\n", efault, sprintrc(rc));
 
        if (F8ILL_KULONG_SUPPORTED) {
index ec093481261b296531d365f351b3f5d760841177..09ff3212a3456c440cb9842d68390ad1ccf2c919 100644 (file)
@@ -42,9 +42,9 @@ static long
 k_tgsigqueueinfo(const pid_t pid, const int sig, const void *const info)
 {
        return syscall(__NR_rt_tgsigqueueinfo,
-                      (unsigned long) 0xffffffff00000000ULL | pid,
-                      (unsigned long) 0xffffffff00000000ULL | pid,
-                      (unsigned long) 0xffffffff00000000ULL | sig,
+                      F8ILL_KULONG_MASK | pid,
+                      F8ILL_KULONG_MASK | pid,
+                      F8ILL_KULONG_MASK | sig,
                       info);
 }
 
index 79ba34d893558464da384c61a9152bf85e54aba9..615938865a80394947fcd8e3a096149671079d3a 100644 (file)
@@ -47,7 +47,7 @@ main(void)
        const kernel_ulong_t tests[] = {
                ugid,
                0xffff0000U | ugid,
-               (kernel_ulong_t) 0xffffffff00000000ULL | ugid,
+               F8ILL_KULONG_MASK | ugid,
                0xffffU,
                -1U,
                -1L,
index 1ec8333ffc6785683baaedf614e9cc51d72c2989..eef41b6f79806441d286fff6f1487dd8c9975adb 100644 (file)
@@ -75,7 +75,7 @@ main(void)
        long rc = syscall(SYSCALL_NR, 0, 0);
        printf("%s(0, NULL) = %s\n", SYSCALL_NAME, sprintrc(rc));
 
-       rc = syscall(SYSCALL_NR, (long) 0xffffffff00000000ULL, 0);
+       rc = syscall(SYSCALL_NR, F8ILL_KULONG_MASK, 0);
        printf("%s(0, NULL) = %s\n", SYSCALL_NAME, sprintrc(rc));
 
        rc = syscall(SYSCALL_NR, 1, 0);
@@ -164,9 +164,7 @@ main(void)
                printuid(g3[1]);
                printf(", ...]) = %s\n", errstr);
 
-               const unsigned long size =
-                       (unsigned long) 0xffffffff00000000ULL | ngroups_max;
-               rc = syscall(SYSCALL_NR, size, g3);
+               rc = syscall(SYSCALL_NR, F8ILL_KULONG_MASK | ngroups_max, g3);
                errstr = sprintrc(rc);
                printf("%s(%d, [", SYSCALL_NAME, ngroups_max);
                printuid(g3[0]);
index 24e0d7f0bc3fd8196c7b139f82f94b9e8b1dc7ce..4d622e440082274f01d1e957396fdfb1cf62927c 100644 (file)
@@ -39,13 +39,10 @@ int
 main(void)
 {
        const int pid = getpid();
-       long rc = syscall(__NR_getpgid,
-                         (unsigned long) 0xffffffff00000000ULL | pid);
+       long rc = syscall(__NR_getpgid, F8ILL_KULONG_MASK | pid);
        printf("getpgid(%d) = %ld\n", pid, rc);
 
-       rc = syscall(__NR_setpgid,
-                    (unsigned long) 0xffffffff00000000ULL,
-                    (unsigned long) 0xffffffff00000000ULL | pid);
+       rc = syscall(__NR_setpgid, F8ILL_KULONG_MASK, F8ILL_KULONG_MASK | pid);
        printf("setpgid(0, %d) = %ld\n", pid, rc);
 
        puts("+++ exited with 0 +++");
index ed5525988a0a6dc71f69f05a801f6cf5414d1d99..30c59c81f6d729f00fafc1efb2f74fee4a9bf7c0 100644 (file)
@@ -12,12 +12,11 @@ main(void)
 {
        const int pid = getpid();
        long rc = syscall(__NR_getpriority, PRIO_PROCESS,
-                         (unsigned long) 0xffffffff00000000ULL | pid);
+                         F8ILL_KULONG_MASK | pid);
        printf("getpriority(PRIO_PROCESS, %d) = %ld\n", pid, rc);
 
        rc = syscall(__NR_setpriority, PRIO_PROCESS,
-                    (unsigned long) 0xffffffff00000000ULL | pid,
-                    (unsigned long) 0xffffffff00000000ULL);
+                    F8ILL_KULONG_MASK | pid, F8ILL_KULONG_MASK);
        printf("setpriority(PRIO_PROCESS, %d, 0) = %s\n", pid, sprintrc(rc));
 
        puts("+++ exited with 0 +++");