aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2017-03-18 18:10:02 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2017-03-18 18:10:02 +0000
commitbed418c8bd95178e376251453a136b6dfcbe23e9 (patch)
treef7b30939944d50ac9c4249a9a01bd1d381ec752b /usr.bin
parent26c048c814d5d2b92d77c35856d91e32ccaee30d (diff)
downloadsrc-bed418c8bd95178e376251453a136b6dfcbe23e9.tar.gz
src-bed418c8bd95178e376251453a136b6dfcbe23e9.zip
Decode the arguments passed to cap_fcntls_get() and cap_fcntls_limit().
Notes
Notes: svn path=/head/; revision=315496
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/truss/syscall.h1
-rw-r--r--usr.bin/truss/syscalls.c30
2 files changed, 31 insertions, 0 deletions
diff --git a/usr.bin/truss/syscall.h b/usr.bin/truss/syscall.h
index 90b0e8aa94cd..70526de671b6 100644
--- a/usr.bin/truss/syscall.h
+++ b/usr.bin/truss/syscall.h
@@ -45,6 +45,7 @@ enum Argtype { None = 1, Hex, Octal, Int, UInt, LongHex, Name, Ptr, Stat, Ioctl,
Pathconf, Rforkflags, ExitStatus, Waitoptions, Idtype, Procctl,
LinuxSockArgs, Umtxop, Atfd, Atflags, Timespec2, Accessmode, Long,
Sysarch, ExecArgs, ExecEnv, PipeFds, QuadHex, Utrace, IntArray, Pipe2,
+ CapFcntlRights,
CloudABIAdvice, CloudABIClockID, ClouduABIFDSFlags,
CloudABIFDStat, CloudABIFileStat, CloudABIFileType,
diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c
index 55e998dbe639..2881b1e4ac0d 100644
--- a/usr.bin/truss/syscalls.c
+++ b/usr.bin/truss/syscalls.c
@@ -92,6 +92,10 @@ static struct syscall decoded_syscalls[] = {
{ Int, 3 } } },
{ .name = "break", .ret_type = 1, .nargs = 1,
.args = { { Ptr, 0 } } },
+ { .name = "cap_fcntls_get", .ret_type = 1, .nargs = 2,
+ .args = { { Int, 0 }, { CapFcntlRights | OUT, 1 } } },
+ { .name = "cap_fcntls_limit", .ret_type = 1, .nargs = 2,
+ .args = { { Int, 0 }, { CapFcntlRights, 1 } } },
{ .name = "chdir", .ret_type = 1, .nargs = 1,
.args = { { Name, 0 } } },
{ .name = "chflags", .ret_type = 1, .nargs = 2,
@@ -791,6 +795,18 @@ print_mask_arg(bool (*decoder)(FILE *, int, int *), FILE *fp, int value)
fprintf(fp, "|0x%x", rem);
}
+static void
+print_mask_arg32(bool (*decoder)(FILE *, uint32_t, uint32_t *), FILE *fp,
+ uint32_t value)
+{
+ uint32_t rem;
+
+ if (!decoder(fp, value, &rem))
+ fprintf(fp, "0x%x", rem);
+ else if (rem != 0)
+ fprintf(fp, "|0x%x", rem);
+}
+
#ifndef __LP64__
/*
* Add argument padding to subsequent system calls afater a Quad
@@ -1832,6 +1848,20 @@ print_arg(struct syscall_args *sc, unsigned long *args, long *retval,
case Pipe2:
print_mask_arg(sysdecode_pipe2_flags, fp, args[sc->offset]);
break;
+ case CapFcntlRights: {
+ uint32_t rights;
+
+ if (sc->type & OUT) {
+ if (get_struct(pid, (void *)args[sc->offset], &rights,
+ sizeof(rights)) == -1) {
+ fprintf(fp, "0x%lx", args[sc->offset]);
+ break;
+ }
+ } else
+ rights = args[sc->offset];
+ print_mask_arg32(sysdecode_cap_fcntlrights, fp, rights);
+ break;
+ }
case CloudABIAdvice:
fputs(xlookup(cloudabi_advice, args[sc->offset]), fp);