From c61eb3dce2a87f8220c64404e9c2309f877da455 Mon Sep 17 00:00:00 2001 From: John Hughes Date: Fri, 17 May 2002 11:37:50 +0000 Subject: [PATCH] handle svr4 procpriv call --- ChangeLog | 5 ++ process.c | 138 +++++++++++++++++++++++++++++++++++++++++++++++++ svr4/dummy.h | 1 - svr4/syscall.h | 1 + 4 files changed, 144 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 61a9faa3..6dfa9a97 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2002-05-17 John Hughes + + * process.c, svr4/dummy.h, svr4/syscall.h: decode arguments + to procpriv syscall. + 2002-05-01 Wichert Akkerman * configure.in, defs.h, process.c, sock.c, syscall.c, util.c: merge diff --git a/process.c b/process.c index afc8f4b9..ea8b15c9 100644 --- a/process.c +++ b/process.c @@ -1107,6 +1107,144 @@ struct tcb *tcp; return 0; } +#if UNIXWARE >= 2 + +#include + + +static struct xlat procpriv_cmds [] = { + { SETPRV, "SETPRV" }, + { CLRPRV, "CLRPRV" }, + { PUTPRV, "PUTPRV" }, + { GETPRV, "GETPRV" }, + { CNTPRV, "CNTPRV" }, + { 0, NULL }, +}; + + +static struct xlat procpriv_priv [] = { + { P_OWNER, "P_OWNER" }, + { P_AUDIT, "P_AUDIT" }, + { P_COMPAT, "P_COMPAT" }, + { P_DACREAD, "P_DACREAD" }, + { P_DACWRITE, "P_DACWRITE" }, + { P_DEV, "P_DEV" }, + { P_FILESYS, "P_FILESYS" }, + { P_MACREAD, "P_MACREAD" }, + { P_MACWRITE, "P_MACWRITE" }, + { P_MOUNT, "P_MOUNT" }, + { P_MULTIDIR, "P_MULTIDIR" }, + { P_SETPLEVEL, "P_SETPLEVEL" }, + { P_SETSPRIV, "P_SETSPRIV" }, + { P_SETUID, "P_SETUID" }, + { P_SYSOPS, "P_SYSOPS" }, + { P_SETUPRIV, "P_SETUPRIV" }, + { P_DRIVER, "P_DRIVER" }, + { P_RTIME, "P_RTIME" }, + { P_MACUPGRADE, "P_MACUPGRADE" }, + { P_FSYSRANGE, "P_FSYSRANGE" }, + { P_SETFLEVEL, "P_SETFLEVEL" }, + { P_AUDITWR, "P_AUDITWR" }, + { P_TSHAR, "P_TSHAR" }, + { P_PLOCK, "P_PLOCK" }, + { P_CORE, "P_CORE" }, + { P_LOADMOD, "P_LOADMOD" }, + { P_BIND, "P_BIND" }, + { P_ALLPRIVS, "P_ALLPRIVS" }, + { 0, NULL }, +}; + + +static struct xlat procpriv_type [] = { + { PS_FIX, "PS_FIX" }, + { PS_INH, "PS_INH" }, + { PS_MAX, "PS_MAX" }, + { PS_WKG, "PS_WKG" }, + { 0, NULL }, +}; + + +static void +printpriv(tcp, addr, len, opt) +struct tcb *tcp; +long addr; +int len; +struct xlat *opt; +{ + priv_t buf [128]; + int max = verbose (tcp) ? sizeof buf / sizeof buf [0] : 10; + int dots = len > max; + int i; + + if (len > max) len = max; + + if (len <= 0 || + umoven (tcp, addr, len * sizeof buf[0], (char *) buf) < 0) + { + tprintf ("%#lx", addr); + return; + } + + tprintf ("["); + + for (i = 0; i < len; ++i) { + char *t, *p; + + if (i) tprintf (", "); + + if ((t = xlookup (procpriv_type, buf [i] & PS_TYPE)) && + (p = xlookup (procpriv_priv, buf [i] & ~PS_TYPE))) + { + tprintf ("%s|%s", t, p); + } + else { + tprintf ("%#lx", buf [i]); + } + } + + if (dots) tprintf (" ..."); + + tprintf ("]"); +} + + +int +sys_procpriv(tcp) +struct tcb *tcp; +{ + if (entering(tcp)) { + printxval(procpriv_cmds, tcp->u_arg[0], "???PRV"); + switch (tcp->u_arg[0]) { + case CNTPRV: + tprintf(", %#lx, %ld", tcp->u_arg[1], tcp->u_arg[2]); + break; + + case GETPRV: + break; + + default: + tprintf (", "); + printpriv (tcp, tcp->u_arg[1], tcp->u_arg[2]); + tprintf (", %ld", tcp->u_arg[2]); + } + } + else if (tcp->u_arg[0] == GETPRV) { + if (syserror (tcp)) { + tprintf(", %#lx, %ld", tcp->u_arg[1], tcp->u_arg[2]); + } + else { + tprintf (", "); + printpriv (tcp, tcp->u_arg[1], tcp->u_rval); + tprintf (", %ld", tcp->u_arg[2]); + } + } + + return 0; +} + +#endif + + void fake_execve(tcp, program, argv, envp) struct tcb *tcp; diff --git a/svr4/dummy.h b/svr4/dummy.h index d1a5e542..da7166d2 100644 --- a/svr4/dummy.h +++ b/svr4/dummy.h @@ -143,7 +143,6 @@ #define sys_keyctl printargs #define sys_secsys printargs #define sys_filepriv printargs -#define sys_procpriv printargs #define sys_devstat printargs #define sys_fdevstat printargs #define sys_flvlfile printargs diff --git a/svr4/syscall.h b/svr4/syscall.h index b06f3052..e0fba086 100644 --- a/svr4/syscall.h +++ b/svr4/syscall.h @@ -309,6 +309,7 @@ extern int sys_sigwait(); extern int sys_truncate(); extern int sys_ftruncate(); extern int sys_getksym (); +extern int sys_procpriv(); #endif #if UNIXWARE >= 7 extern int sys_lseek64 ();