This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][BUGFIX] ia64: fix syscall_get_set_args_cb() to handle arguments correctly


Hi,

Here is the patch which fixes utrace on ia64 issue.
I'll post same fix on the upstream kernel later.

Fix syscall_get_set_args_cb() to decode user-stack correctly in case of
syscall() which allocates locals in user-stack. If locals (cfm.sol) exist
on the stack, we have to skip it for getting systemcall arguments.

And also, fix the number of getting arguments which must be less than
(nr outputs - args->i) instead of nr outputs, because args->i is the
indent number (this means, syscall_get_set_args_cb() get/set arguments
from (i)th to (i+n)th.)

---
 runtime/syscall.h |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

Index: systemtap/runtime/syscall.h
===================================================================
--- systemtap.orig/runtime/syscall.h
+++ systemtap/runtime/syscall.h
@@ -345,6 +345,10 @@ struct syscall_get_set_args {
 	int rw;
 };

+#define CFM_SOF(cfm) ((cfm) & 0x7f)			/* Size of frame */
+#define CFM_SOL(cfm) (((cfm) >> 7) & 0x7f)		/* Size of locals */
+#define CFM_OUT(cfm) (CFM_SOF(cfm) - CFM_SOL(cfm))	/* Size of outputs */
+
 static void syscall_get_set_args_cb(struct unw_frame_info *info, void *data)
 {
 	struct syscall_get_set_args *args = data;
@@ -361,15 +365,18 @@ static void syscall_get_set_args_cb(stru

 	count = 0;
 	if (in_syscall(pt))
-		count = min_t(int, args->n, cfm & 0x7f);
+		/* args->i + args->n must be less equal than nr outputs */
+		count = min_t(int, args->n, CFM_OUT(cfm) - args->i);

 	for (i = 0; i < count; i++) {
+		/* Skips dirties and locals */
 		if (args->rw)
-			*ia64_rse_skip_regs(krbs, ndirty + i + args->i) =
+			*ia64_rse_skip_regs(krbs,
+				ndirty + CFM_SOL(cfm) + args->i + i) =
 				args->args[i];
 		else
 			args->args[i] = *ia64_rse_skip_regs(krbs,
-				ndirty + i + args->i);
+				ndirty + CFM_SOL(cfm) + args->i + i);
 	}

 	if (!args->rw) {

-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division

e-mail: mhiramat@redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]