From: Masami Hiramatsu <mhiramat@redhat.com>
To: "Luck, Tony" <tony.luck@intel.com>,
Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
ia64 <linux-ia64@vger.kernel.org>,
Roland McGrath <roland@redhat.com>,
David Smith <dsmith@redhat.com>,
systemtap-ml <systemtap@sources.redhat.com>
Subject: [PATCH][BUGFIX] utrace/ia64: Fix syscall_get_set_args_cb() to handle syscalls via syscall()
Date: Wed, 22 Apr 2009 19:14:34 -0400 [thread overview]
Message-ID: <49EFA4DA.9020402@redhat.com> (raw)
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 real 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.)
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Cc: Roland McGrath <roland@redhat.com>
Cc: David Smith <dsmith@redhat.com>
---
arch/ia64/kernel/ptrace.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
Index: 2.6-rc/arch/ia64/kernel/ptrace.c
===================================================================
--- 2.6-rc.orig/arch/ia64/kernel/ptrace.c
+++ 2.6-rc/arch/ia64/kernel/ptrace.c
@@ -2189,6 +2189,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;
@@ -2205,15 +2209,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
next reply other threads:[~2009-04-22 23:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-22 23:14 Masami Hiramatsu [this message]
2009-04-24 2:21 ` [PATCH][BUGFIX] utrace/ia64: Fix syscall_get_set_args_cb() to handle syscalls via syscall() Masami Hiramatsu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49EFA4DA.9020402@redhat.com \
--to=mhiramat@redhat.com \
--cc=anil.s.keshavamurthy@intel.com \
--cc=dsmith@redhat.com \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=roland@redhat.com \
--cc=systemtap@sources.redhat.com \
--cc=tony.luck@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox