2 * Check decoding of prctl operations without arguments and return code parsing:
3 * PR_GET_KEEPCAPS, PR_GET_SECCOMP, PR_GET_TIMERSLACK, PR_GET_TIMING,
4 * PR_TASK_PERF_EVENTS_DISABLE, and PR_TASK_PERF_EVENTS_ENABLE.
6 * Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com>
7 * Copyright (c) 2016-2018 The strace developers.
10 * SPDX-License-Identifier: GPL-2.0-or-later
14 #include <asm/unistd.h>
16 #if defined __NR_prctl
20 # include <linux/prctl.h>
25 static const kernel_ulong_t bogus_op_bits =
26 (kernel_ulong_t) 0xbadc0ded00000000ULL;
27 static const kernel_ulong_t bogus_arg =
28 (kernel_ulong_t) 0xfacefeeddeadbeefULL;
33 { 7, "PR_GET_KEEPCAPS" },
34 { 13, "PR_GET_TIMING" },
35 { 21, "PR_GET_SECCOMP" },
36 { 30, "PR_GET_TIMERSLACK" },
37 { 31, "PR_TASK_PERF_EVENTS_DISABLE" },
38 { 32, "PR_TASK_PERF_EVENTS_ENABLE" },
41 TAIL_ALLOC_OBJECT_CONST_PTR(unsigned int, ptr);
44 for (i = 0; i < ARRAY_SIZE(options); i++) {
45 long rc = syscall(__NR_prctl, options[i].val | bogus_op_bits,
47 printf("prctl(%s) = %s\n", options[i].str, sprintrc(rc));
50 puts("+++ exited with 0 +++");
56 SKIP_MAIN_UNDEFINED("__NR_prctl")