[PATCH 3/3] sys_prctl: Handle more constants

Dmitry V. Levin ldv at altlinux.org
Wed Jul 23 21:59:17 UTC 2008


2008-04-19  Dmitry V. Levin <ldv at altlinux.org>

	* process.c (sys_prctl): Decode PR_SET_PDEATHSIG, PR_GET_PDEATHSIG,
	PR_SET_DUMPABLE, PR_GET_DUMPABLE, PR_SET_KEEPCAPS, PR_GET_KEEPCAPS.
	Fix PR_GET_UNALIGN decoder.
---
 strace/process.c |   50 ++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 38 insertions(+), 12 deletions(-)

--- a/strace/process.c
+++ b/strace/process.c
@@ -297,10 +297,24 @@ struct tcb *tcp;
 		case PR_GETNSHARE:
 			break;
 #endif
-#ifdef PR_SET_DEATHSIG
+#ifdef PR_SET_PDEATHSIG
+		case PR_SET_PDEATHSIG:
+			tprintf(", %lu", tcp->u_arg[1]);
+			break;
+#endif
+#ifdef PR_GET_PDEATHSIG
 		case PR_GET_PDEATHSIG:
 			break;
 #endif
+#ifdef PR_SET_DUMPABLE
+		case PR_SET_DUMPABLE:
+			tprintf(", %lu", tcp->u_arg[1]);
+			break;
+#endif
+#ifdef PR_GET_DUMPABLE
+		case PR_GET_DUMPABLE:
+			break;
+#endif
 #ifdef PR_SET_UNALIGN
 		case PR_SET_UNALIGN:
 			tprintf(", %s", unalignctl_string(tcp->u_arg[1]));
@@ -311,6 +325,15 @@ struct tcb *tcp;
 			tprintf(", %#lx", tcp->u_arg[1]);
 			break;
 #endif
+#ifdef PR_SET_KEEPCAPS
+		case PR_SET_KEEPCAPS:
+			tprintf(", %lu", tcp->u_arg[1]);
+			break;
+#endif
+#ifdef PR_GET_KEEPCAPS
+		case PR_GET_KEEPCAPS:
+			break;
+#endif
 		default:
 			for (i = 1; i < tcp->u_nargs; i++)
 				tprintf(", %#lx", tcp->u_arg[i]);
@@ -320,23 +343,26 @@ struct tcb *tcp;
 		switch (tcp->u_arg[0]) {
 #ifdef PR_GET_PDEATHSIG
 		case PR_GET_PDEATHSIG:
-			for (i=1; i<tcp->u_nargs; i++)
-				tprintf(", %#lx", tcp->u_arg[i]);
+			if (umove(tcp, tcp->u_arg[1], &i) < 0)
+				tprintf(", %#lx", tcp->u_arg[1]);
+			else
+				tprintf(", {%u}", i);
 			break;
 #endif
-#ifdef PR_SET_UNALIGN
-		case PR_SET_UNALIGN:
-			break;
+#ifdef PR_GET_DUMPABLE
+		case PR_GET_DUMPABLE:
+			return RVAL_UDECIMAL;
 #endif
 #ifdef PR_GET_UNALIGN
 		case PR_GET_UNALIGN:
-		{
-			int ctl;
-
-			umove(tcp, tcp->u_arg[1], &ctl);
-			tcp->auxstr = unalignctl_string(ctl);
+			if (syserror(tcp) || umove(tcp, tcp->u_arg[1], &i) < 0)
+				break;
+			tcp->auxstr = unalignctl_string(i);
 			return RVAL_STR;
-		}
+#endif
+#ifdef PR_GET_KEEPCAPS
+		case PR_GET_KEEPCAPS:
+			return RVAL_UDECIMAL;
 #endif
 		default:
 			break;

-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20080724/9d25af70/attachment.bin>


More information about the Strace-devel mailing list