From: Vaibhav Nagarnaik <vnagarnaik@google.com>
To: Steven Rostedt <rostedt@goodmis.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>
Cc: David Sharp <dhsharp@google.com>,
Justin Teravest <teravest@google.com>,
Laurent Chavey <chavey@google.com>,
x86@kernel.org, linux-kernel@vger.kernel.org,
Vaibhav Nagarnaik <vnagarnaik@google.com>
Subject: [PATCH 5/6] trace: raw_syscalls: Mark compat syscalls in the MSB of the syscall number
Date: Mon, 26 Mar 2012 11:39:27 -0700 [thread overview]
Message-ID: <1332787168-20457-6-git-send-email-vnagarnaik@google.com> (raw)
In-Reply-To: <1332787168-20457-1-git-send-email-vnagarnaik@google.com>
From: David Sharp <dhsharp@google.com>
The compat syscalls are undifferentiable from standard syscalls, making
correct interpretation of 'id' impossible on systems where compat tasks
are running. Set the MSB of 'id' if the traced syscall is compat, and
output this bit in the print format.
Signed-off-by: Vaibhav Nagarnaik <vnagarnaik@google.com>
---
include/trace/events/syscalls.h | 23 ++++++++++++++++++-----
1 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/include/trace/events/syscalls.h b/include/trace/events/syscalls.h
index aeaa536..4f42fdc 100644
--- a/include/trace/events/syscalls.h
+++ b/include/trace/events/syscalls.h
@@ -6,10 +6,13 @@
#define _TRACE_EVENTS_SYSCALLS_H
#include <linux/tracepoint.h>
+#include <linux/compat.h>
#include <asm/ptrace.h>
#include <asm/syscall.h>
+#define COMPAT_MASK (~0UL>>1)
+#define COMPAT_BIT ~(~0UL>>1)
TRACE_EVENT(sys_enter,
@@ -23,14 +26,19 @@ TRACE_EVENT(sys_enter,
),
TP_fast_assign(
+#ifdef CONFIG_COMPAT
+ if (is_compat_task())
+ id |= COMPAT_BIT;
+#endif
__entry->id = id;
syscall_get_arguments(current, regs, 0, 6, __entry->args);
),
- TP_printk("NR %ld (%lx, %lx, %lx, %lx, %lx, %lx)",
- __entry->id,
+ TP_printk("NR %ld (%lx, %lx, %lx, %lx, %lx, %lx) isCompat: %d",
+ __entry->id & COMPAT_MASK,
__entry->args[0], __entry->args[1], __entry->args[2],
- __entry->args[3], __entry->args[4], __entry->args[5])
+ __entry->args[3], __entry->args[4], __entry->args[5],
+ !!(__entry->id & COMPAT_BIT))
);
TRACE_EVENT_FLAGS(sys_enter, TRACE_EVENT_FL_CAP_ANY)
@@ -48,11 +56,16 @@ TRACE_EVENT(sys_exit,
TP_fast_assign(
__entry->id = syscall_get_nr(current, regs);
+#ifdef CONFIG_COMPAT
+ if (is_compat_task())
+ __entry->id |= COMPAT_BIT;
+#endif
__entry->ret = ret;
),
- TP_printk("NR %ld = %ld",
- __entry->id, __entry->ret)
+ TP_printk("NR %ld = %ld isCompat: %d",
+ __entry->id & COMPAT_MASK, __entry->ret,
+ !!(__entry->id & COMPAT_BIT))
);
TRACE_EVENT_FLAGS(sys_exit, TRACE_EVENT_FL_CAP_ANY)
--
1.7.7.3
next prev parent reply other threads:[~2012-03-26 18:40 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-26 18:39 [PATCH 0/6] Enhance and speed up syscall tracing Vaibhav Nagarnaik
2012-03-26 18:39 ` [PATCH 1/6] trace: syscalls.h - cleanup and simplify SYSCALL_METADATA() Vaibhav Nagarnaik
2012-03-26 18:39 ` [PATCH 2/6] trace: add support for 32 bit compat syscalls on x86_64 Vaibhav Nagarnaik
2012-03-27 4:49 ` H. Peter Anvin
2012-03-28 21:10 ` Vaibhav Nagarnaik
2012-03-28 21:11 ` Vaibhav Nagarnaik
2012-03-28 23:00 ` Vaibhav Nagarnaik
2012-03-26 18:39 ` [PATCH 3/6] trace: Refactor ftrace syscall macros to make them more readable Vaibhav Nagarnaik
2012-03-26 18:39 ` [PATCH 4/6] trace: trace syscall in its handler not from ptrace handler Vaibhav Nagarnaik
2012-03-27 5:00 ` H. Peter Anvin
2012-03-28 18:23 ` Vaibhav Nagarnaik
2012-03-29 2:43 ` H. Peter Anvin
2012-03-29 2:59 ` Steven Rostedt
2012-03-29 3:15 ` H. Peter Anvin
2012-03-29 3:02 ` Vaibhav Nagarnaik
2012-03-29 3:16 ` H. Peter Anvin
2012-03-29 6:20 ` Ingo Molnar
2012-03-29 19:02 ` Vaibhav Nagarnaik
2012-03-29 19:12 ` H. Peter Anvin
2012-03-29 19:43 ` Vaibhav Nagarnaik
2012-03-29 20:06 ` H. Peter Anvin
2012-03-29 22:40 ` David Sharp
2012-03-29 22:44 ` H. Peter Anvin
2012-03-30 12:06 ` Frederic Weisbecker
2012-03-30 11:57 ` Frederic Weisbecker
2012-03-29 22:44 ` David Sharp
2012-03-29 22:48 ` H. Peter Anvin
2012-03-26 18:39 ` Vaibhav Nagarnaik [this message]
2012-03-26 18:39 ` [PATCH 6/6] trace: get rid of the enabled_*_syscalls bitmaps Vaibhav Nagarnaik
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=1332787168-20457-6-git-send-email-vnagarnaik@google.com \
--to=vnagarnaik@google.com \
--cc=chavey@google.com \
--cc=dhsharp@google.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=teravest@google.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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
all inboxes | Powered by JetHome®