2 * Check decoding of pkey_alloc syscall.
4 * Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com>
5 * Copyright (c) 2016-2019 The strace developers.
8 * SPDX-License-Identifier: GPL-2.0-or-later
14 #ifdef __NR_pkey_alloc
22 static const kernel_ulong_t flags[] = {
24 (kernel_ulong_t) 0xbadc0ded00000000ULL,
25 (kernel_ulong_t) 0xffff0000eeee1111ULL,
26 (kernel_ulong_t) 0x123456789abcdef0ULL,
32 { (kernel_ulong_t) 0xbadc0ded00000002ULL,
33 sizeof(kernel_ulong_t) > sizeof(int) ?
34 "PKEY_DISABLE_WRITE|0xbadc0ded00000000" :
35 "PKEY_DISABLE_WRITE" },
36 { 0xdec0ded, "PKEY_DISABLE_ACCESS|PKEY_DISABLE_EXECUTE|"
38 { 0x7, "PKEY_DISABLE_ACCESS|PKEY_DISABLE_WRITE|"
39 "PKEY_DISABLE_EXECUTE" },
41 { 0xbadc0de8, "0xbadc0de8 /* PKEY_??? */" },
48 for (i = 0; i < ARRAY_SIZE(flags); i++) {
49 for (j = 0; j < ARRAY_SIZE(rights); j++) {
50 rc = syscall(__NR_pkey_alloc, flags[i], rights[j].val);
51 printf("pkey_alloc(%#llx, %s) = %s\n",
52 (unsigned long long) flags[i], rights[j].str,
57 puts("+++ exited with 0 +++");
64 SKIP_MAIN_UNDEFINED("__NR_pkey_alloc");