From patchwork Tue Oct 11 10:42:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcin Nowakowski X-Patchwork-Id: 9370459 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 60B266048F for ; Tue, 11 Oct 2016 10:43:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BD8B29C80 for ; Tue, 11 Oct 2016 10:43:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4046D29C88; Tue, 11 Oct 2016 10:43:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67B0D29C80 for ; Tue, 11 Oct 2016 10:43:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753191AbcJKKnT (ORCPT ); Tue, 11 Oct 2016 06:43:19 -0400 Received: from mailapp02.imgtec.com ([217.156.133.132]:23799 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751966AbcJKKnR (ORCPT ); Tue, 11 Oct 2016 06:43:17 -0400 Received: from HHMAIL03.hh.imgtec.org (unknown [10.44.0.21]) by Forcepoint Email with ESMTPS id B0A00F95686DE; Tue, 11 Oct 2016 11:43:12 +0100 (IST) Received: from HHMAIL01.hh.imgtec.org (10.100.10.19) by HHMAIL03.hh.imgtec.org (10.44.0.21) with Microsoft SMTP Server (TLS) id 14.3.294.0; Tue, 11 Oct 2016 11:43:15 +0100 Received: from WR-NOWAKOWSKI.kl.imgtec.org (10.80.2.5) by HHMAIL01.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server (TLS) id 14.3.294.0; Tue, 11 Oct 2016 11:43:14 +0100 From: Marcin Nowakowski To: CC: , , , Marcin Nowakowski , Ingo Molnar , "James E.J. Bottomley" , "Helge Deller" , Subject: [PATCH v3 11/11] parisc/tracing: fix compat syscall handling Date: Tue, 11 Oct 2016 12:42:56 +0200 Message-ID: <1476182576-15247-12-git-send-email-marcin.nowakowski@imgtec.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1476182576-15247-1-git-send-email-marcin.nowakowski@imgtec.com> References: <1476182576-15247-1-git-send-email-marcin.nowakowski@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [10.80.2.5] Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add missing arch code - arch_trace_is_compat_syscall and arch_syscall_addr Signed-off-by: Marcin Nowakowski Cc: Steven Rostedt Cc: Ingo Molnar Cc: "James E.J. Bottomley" Cc: Helge Deller Cc: linux-parisc@vger.kernel.org --- arch/parisc/include/asm/ftrace.h | 10 ++++++++++ arch/parisc/kernel/Makefile | 1 + arch/parisc/kernel/ftrace.c | 15 +++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/arch/parisc/include/asm/ftrace.h b/arch/parisc/include/asm/ftrace.h index d635c6b..0b54385 100644 --- a/arch/parisc/include/asm/ftrace.h +++ b/arch/parisc/include/asm/ftrace.h @@ -12,6 +12,16 @@ extern unsigned long return_address(unsigned int); #define ftrace_return_address(n) return_address(n) +#if defined(CONFIG_FTRACE_SYSCALLS) && defined(CONFIG_COMPAT) +#include + +#define ARCH_COMPAT_SYSCALL_NUMBERS_OVERLAP 1 +static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs) +{ + return in_compat_syscall(); +} +#endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_COMPAT */ + #endif /* __ASSEMBLY__ */ #endif /* _ASM_PARISC_FTRACE_H */ diff --git a/arch/parisc/kernel/Makefile b/arch/parisc/kernel/Makefile index 69a1118..7d1fd39 100644 --- a/arch/parisc/kernel/Makefile +++ b/arch/parisc/kernel/Makefile @@ -31,3 +31,4 @@ obj64-$(CONFIG_AUDIT) += compat_audit.o obj-$(CONFIG_64BIT) += perf.o perf_asm.o $(obj64-y) obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o +obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o diff --git a/arch/parisc/kernel/ftrace.c b/arch/parisc/kernel/ftrace.c index 5a5506a..41db7ca 100644 --- a/arch/parisc/kernel/ftrace.c +++ b/arch/parisc/kernel/ftrace.c @@ -56,6 +56,7 @@ static void __hot prepare_ftrace_return(unsigned long *parent, } #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ +#ifdef CONFIG_FUNCTION_TRACER void notrace __hot ftrace_function_trampoline(unsigned long parent, unsigned long self_addr, unsigned long org_sp_gr3) @@ -85,4 +86,18 @@ void notrace __hot ftrace_function_trampoline(unsigned long parent, } #endif } +#endif /* CONFIG_FUNCTION_TRACER */ +#if (defined CONFIG_FTRACE_SYSCALLS) && (defined CONFIG_64BIT) +extern const unsigned int sys_call_table64[]; +unsigned long __init arch_syscall_addr(int nr, bool compat) +{ +#ifdef CONFIG_COMPAT + if (compat) + return (unsigned long)sys_call_table[nr]; +#endif /* CONFIG_COMPAT */ + + return (unsigned long)sys_call_table64[nr]; +} + +#endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_64BIT */