diff options
author | John Baldwin <jhb@FreeBSD.org> | 2017-06-02 13:33:50 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2017-06-02 13:33:50 +0000 |
commit | 7136a1d97aa22e7d0e50bbfb67013b1b96a3e7f1 (patch) | |
tree | df85e487832e8a6e0e7d18ddabbba14e5669cea5 /usr.bin | |
parent | c74415ed3b84cad5e0f42dc6c7a4c64026fa8cfd (diff) | |
download | src-test2-7136a1d97aa22e7d0e50bbfb67013b1b96a3e7f1.tar.gz src-test2-7136a1d97aa22e7d0e50bbfb67013b1b96a3e7f1.zip |
Notes
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/truss/syscall.h | 3 | ||||
-rw-r--r-- | usr.bin/truss/syscalls.c | 17 |
2 files changed, 19 insertions, 1 deletions
diff --git a/usr.bin/truss/syscall.h b/usr.bin/truss/syscall.h index 46bef46b2308..f0b39b468bbf 100644 --- a/usr.bin/truss/syscall.h +++ b/usr.bin/truss/syscall.h @@ -28,6 +28,7 @@ * Kevent -- a pointer to an array of struct kevents. Prints all elements. * Pathconf -- the 2nd argument of pathconf(). * Utrace -- utrace(2) buffer. + * CapRights -- a pointer to a cap_rights_t. Prints all set capabilities. * * In addition, the pointer types (String, Ptr) may have OUT masked in -- * this means that the data is set on *return* from the system call -- or @@ -47,7 +48,7 @@ enum Argtype { None = 1, Hex, Octal, Int, UInt, LongHex, Name, Ptr, Stat, Ioctl, Sysarch, ExecArgs, ExecEnv, PipeFds, QuadHex, Utrace, IntArray, Pipe2, CapFcntlRights, Fadvice, FileFlags, Flockop, Getfsstatmode, Kldsymcmd, Kldunloadflags, Sizet, Madvice, Socklent, Sockprotocol, Sockoptlevel, - Sockoptname, Msgflags, + Sockoptname, Msgflags, CapRights, CloudABIAdvice, CloudABIClockID, ClouduABIFDSFlags, CloudABIFDStat, CloudABIFileStat, CloudABIFileType, diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c index 1bf1e88ed8ad..f8c1943125ec 100644 --- a/usr.bin/truss/syscalls.c +++ b/usr.bin/truss/syscalls.c @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); * arguments. */ +#include <sys/capsicum.h> #include <sys/types.h> #include <sys/event.h> #include <sys/ioccom.h> @@ -76,6 +77,8 @@ __FBSDID("$FreeBSD$"); */ static struct syscall decoded_syscalls[] = { /* Native ABI */ + { .name = "__cap_rights_get", .ret_type = 1, .nargs = 3, + .args = { { Int, 0 }, { Int, 1 }, { CapRights | OUT, 2 } } }, { .name = "__getcwd", .ret_type = 1, .nargs = 2, .args = { { Name | OUT, 0 }, { Int, 1 } } }, { .name = "_umtx_op", .ret_type = 1, .nargs = 5, @@ -96,6 +99,8 @@ static struct syscall decoded_syscalls[] = { .args = { { Int, 0 }, { CapFcntlRights | OUT, 1 } } }, { .name = "cap_fcntls_limit", .ret_type = 1, .nargs = 2, .args = { { Int, 0 }, { CapFcntlRights, 1 } } }, + { .name = "cap_rights_limit", .ret_type = 1, .nargs = 2, + .args = { { Int, 0 }, { CapRights, 1 } } }, { .name = "chdir", .ret_type = 1, .nargs = 1, .args = { { Name, 0 } } }, { .name = "chflags", .ret_type = 1, .nargs = 2, @@ -1976,6 +1981,18 @@ print_arg(struct syscall_args *sc, unsigned long *args, long *retval, case Msgflags: print_mask_arg(sysdecode_msg_flags, fp, args[sc->offset]); break; + case CapRights: { + cap_rights_t rights; + + if (get_struct(pid, (void *)args[sc->offset], &rights, + sizeof(rights)) != -1) { + fputs("{ ", fp); + sysdecode_cap_rights(fp, &rights); + fputs(" }", fp); + } else + fprintf(fp, "0x%lx", args[sc->offset]); + break; + } case CloudABIAdvice: fputs(xlookup(cloudabi_advice, args[sc->offset]), fp); |