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

Ian Munsie imunsie at au1.ibm.com
Wed Jun 23 20:03:01 EST 2010


From: Ian Munsie <imunsie at 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 at au1.ibm.com>
---
 kernel/trace/trace_syscalls.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

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;
-- 
1.7.1



More information about the Linuxppc-dev mailing list