Decode the arguments passed to cap_fcntls_get() and cap_fcntls_limit().

This commit is contained in:
John Baldwin 2017-03-18 18:10:02 +00:00
parent 26c048c814
commit bed418c8bd
2 changed files with 31 additions and 0 deletions

View File

@ -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,

View File

@ -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);