svn commit: r319493 - head/usr.bin/truss
John Baldwin
jhb at FreeBSD.org
Fri Jun 2 13:33:52 UTC 2017
Author: jhb
Date: Fri Jun 2 13:33:50 2017
New Revision: 319493
URL: https://svnweb.freebsd.org/changeset/base/319493
Log:
Decode the arguments passed to __cap_rights_get() and cap_rights_limit().
Submitted by: tobik
Modified:
head/usr.bin/truss/syscall.h
head/usr.bin/truss/syscalls.c
Modified: head/usr.bin/truss/syscall.h
==============================================================================
--- head/usr.bin/truss/syscall.h Fri Jun 2 09:54:41 2017 (r319492)
+++ head/usr.bin/truss/syscall.h Fri Jun 2 13:33:50 2017 (r319493)
@@ -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, LongHe
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,
Modified: head/usr.bin/truss/syscalls.c
==============================================================================
--- head/usr.bin/truss/syscalls.c Fri Jun 2 09:54:41 2017 (r319492)
+++ head/usr.bin/truss/syscalls.c Fri Jun 2 13:33:50 2017 (r319493)
@@ -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
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);
More information about the svn-src-all
mailing list