3 /* these constants are the same as in <linux/capability.h> */
8 #include "xlat/cap_mask0.h"
10 /* these constants are CAP_TO_INDEX'ed constants from <linux/capability.h> */
15 #include "xlat/cap_mask1.h"
17 /* these constants are the same as in <linux/capability.h> */
19 _LINUX_CAPABILITY_VERSION_1 = 0x19980330,
20 _LINUX_CAPABILITY_VERSION_2 = 0x20071026,
21 _LINUX_CAPABILITY_VERSION_3 = 0x20080522
24 #include "xlat/cap_version.h"
26 typedef struct user_cap_header_struct {
31 typedef struct user_cap_data_struct {
37 static cap_user_header_t
38 get_cap_header(struct tcb *tcp, unsigned long addr)
40 static struct user_cap_header_struct header;
42 if (!addr || !verbose(tcp))
45 if (umove(tcp, addr, &header) < 0)
52 print_cap_header(struct tcb *tcp, unsigned long addr, cap_user_header_t h)
60 tprintf("%#lx", addr);
65 printxval(cap_version, h->version,
66 "_LINUX_CAPABILITY_VERSION_???");
67 tprintf(", %d}", h->pid);
71 print_cap_bits(const uint32_t lo, const uint32_t hi)
74 printflags(cap_mask0, lo, "CAP_???");
79 printflags(cap_mask1, hi, "CAP_???");
84 print_cap_data(struct tcb *tcp, unsigned long addr, const cap_user_header_t h)
86 struct user_cap_data_struct data[2];
94 if (!h || !verbose(tcp) ||
95 (exiting(tcp) && syserror(tcp))) {
96 tprintf("%#lx", addr);
100 if (_LINUX_CAPABILITY_VERSION_2 == h->version ||
101 _LINUX_CAPABILITY_VERSION_3 == h->version)
106 if (umoven(tcp, addr, len * sizeof(data[0]), data) < 0) {
107 tprintf("%#lx", addr);
112 print_cap_bits(data[0].effective, len > 1 ? data[1].effective : 0);
114 print_cap_bits(data[0].permitted, len > 1 ? data[1].permitted : 0);
116 print_cap_bits(data[0].inheritable, len > 1 ? data[1].inheritable : 0);
125 h = get_cap_header(tcp, tcp->u_arg[0]);
126 print_cap_header(tcp, tcp->u_arg[0], h);
129 h = syserror(tcp) ? NULL : get_cap_header(tcp, tcp->u_arg[0]);
130 print_cap_data(tcp, tcp->u_arg[1], h);
138 cap_user_header_t h = get_cap_header(tcp, tcp->u_arg[0]);
139 print_cap_header(tcp, tcp->u_arg[0], h);
141 print_cap_data(tcp, tcp->u_arg[1], h);