Patchwork [20/40] trace syscalls: Considder compat_syscall_nr when verifying syscall_nr

login
register
mail settings
Submitter Ian Munsie
Date June 23, 2010, 10:03 a.m.
Message ID <1277287401-28571-21-git-send-email-imunsie@au1.ibm.com>
Download mbox | patch
Permalink /patch/56646/
State Not Applicable
Headers show

Comments

Ian Munsie - June 23, 2010, 10:03 a.m.
From: Ian Munsie <imunsie@au1.ibm.com>

With the new compat syscall tracing, either syscall_nr or
compat_syscall_nr may be set, so test both before assuming that the
initialisation failed.

Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
---
 kernel/trace/trace_syscalls.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

Patch

diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
index 9010405..264441e 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -441,10 +441,12 @@  void unreg_event_syscall_exit(struct ftrace_event_call *call)
 int init_syscall_trace(struct ftrace_event_call *call)
 {
 	int id;
-	int num;
+	int num, compat_num;
 
 	num = ((struct syscall_metadata *)call->data)->syscall_nr;
-	if (num < 0 || num >= NR_syscalls) {
+	compat_num = ((struct syscall_metadata *)call->data)->compat_syscall_nr;
+	if ((       num < 0 ||        num >= NR_syscalls) &&
+	    (compat_num < 0 || compat_num >= NR_syscalls)) {
 		pr_debug("syscall %s metadata not mapped, disabling ftrace event\n",
 				((struct syscall_metadata *)call->data)->name);
 		return -ENOSYS;