| 1 |
/* COVERAGE: capget capset */ |
| 2 |
|
| 3 |
#define _GNU_SOURCE |
| 4 |
#include <unistd.h> |
| 5 |
#include <sys/syscall.h> |
| 6 |
|
| 7 |
#include <sys/types.h> |
| 8 |
#include <unistd.h> |
| 9 |
|
| 10 |
#include <linux/capability.h> |
| 11 |
|
| 12 |
#define capget(x,y) syscall(__NR_capget,x,y) |
| 13 |
#define capset(x,y) syscall(__NR_capset,x,y) |
| 14 |
|
| 15 |
static struct __user_cap_header_struct header; |
| 16 |
static struct __user_cap_data_struct data; |
| 17 |
|
| 18 |
int main() |
| 19 |
{ |
| 20 |
header.version = _LINUX_CAPABILITY_VERSION; |
| 21 |
header.pid = getpid(); |
| 22 |
capget(&header, &data); |
| 23 |
//staptest// capget (XXXX, XXXX) = 0 |
| 24 |
|
| 25 |
capset(&header, &data); |
| 26 |
//staptest// capset (XXXX, XXXX) = 0 |
| 27 |
|
| 28 |
capget((cap_user_header_t)-1, 0); |
| 29 |
#ifdef __s390__ |
| 30 |
//staptest// capget (0x[7]?[f]+, 0x0) = NNNN (EFAULT) |
| 31 |
#else |
| 32 |
//staptest// capget (0x[f]+, 0x0) = NNNN (EFAULT) |
| 33 |
#endif |
| 34 |
|
| 35 |
capget(0, (cap_user_data_t)-1); |
| 36 |
#ifdef __s390__ |
| 37 |
//staptest// capget (0x0, 0x[7]?[f]+) = NNNN (EFAULT) |
| 38 |
#else |
| 39 |
//staptest// capget (0x0, 0x[f]+) = NNNN (EFAULT) |
| 40 |
#endif |
| 41 |
|
| 42 |
capset((cap_user_header_t)-1, 0); |
| 43 |
#ifdef __s390__ |
| 44 |
//staptest// capset (0x[7]?[f]+, 0x0) = NNNN (EFAULT) |
| 45 |
#else |
| 46 |
//staptest// capset (0x[f]+, 0x0) = NNNN (EFAULT) |
| 47 |
#endif |
| 48 |
|
| 49 |
capset(0, (cap_user_data_t)-1); |
| 50 |
#ifdef __s390__ |
| 51 |
//staptest// capset (0x0, 0x[7]?[f]+) = NNNN (EFAULT) |
| 52 |
#else |
| 53 |
//staptest// capset (0x0, 0x[f]+) = NNNN (EFAULT) |
| 54 |
#endif |
| 55 |
|
| 56 |
return 0; |
| 57 |
} |