From patchwork Fri Feb 28 05:14:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 25500 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f72.google.com (mail-pa0-f72.google.com [209.85.220.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 29D522055D for ; Fri, 28 Feb 2014 05:16:28 +0000 (UTC) Received: by mail-pa0-f72.google.com with SMTP id bj1sf343438pad.11 for ; Thu, 27 Feb 2014 21:16:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=5rblcsPJRkxRESDuE/StxiXJ5InbusUVuwyD8aHg3zU=; b=IQhKKKR+0VcQ2D3VmAt5yzhXdBk5eqRDqf/mbgrKu1MgV87fumjqXVQ3YeLPfy8eNp 6HqVeJA9/FhZVUHfqPyyrJHCIq8JVZE1qBb2OiE/sgPvciy1oi0FHOiJfi82FfmOSj0X WMQbIbd1YX0IhI3g4yp8TRzodLqOlAFVaWxK2TgE7ZFbIdMvyX9EIK0FNFLv3+N8sXOy 46IO7rD0UFso/O9uXqXJE/oNL7RtUn8qbitsR1F9JGQ04ONAR0zKuR0txcXcUMcF9lQj fTmG1hOrRlRoTr3RkJPh1RKy8MmvnX5DEGU3T07kdHedR5p8XEYJAuP4zAFs6FcV4WXo Ghhg== X-Gm-Message-State: ALoCoQnyjHDPeDF0Zgje5lHBIuXYqNOlxOpJ5hZTlxj/Xm9i0IlVwBVwngLb0U4mEnRdgzlmFVEh X-Received: by 10.68.196.195 with SMTP id io3mr398942pbc.7.1393564587331; Thu, 27 Feb 2014 21:16:27 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.89.70 with SMTP id u64ls953657qgd.86.gmail; Thu, 27 Feb 2014 21:16:27 -0800 (PST) X-Received: by 10.220.98.204 with SMTP id r12mr823101vcn.48.1393564587168; Thu, 27 Feb 2014 21:16:27 -0800 (PST) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id be7si1143249vcb.110.2014.02.27.21.16.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 27 Feb 2014 21:16:27 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.169; Received: by mail-ve0-f169.google.com with SMTP id pa12so248665veb.0 for ; Thu, 27 Feb 2014 21:16:27 -0800 (PST) X-Received: by 10.221.66.73 with SMTP id xp9mr763979vcb.27.1393564587074; Thu, 27 Feb 2014 21:16:27 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.130.193 with SMTP id u1csp28774vcs; Thu, 27 Feb 2014 21:16:26 -0800 (PST) X-Received: by 10.68.226.70 with SMTP id rq6mr1117284pbc.107.1393564585983; Thu, 27 Feb 2014 21:16:25 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xn1si599693pbc.248.2014.02.27.21.16.25; Thu, 27 Feb 2014 21:16:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751371AbaB1FQM (ORCPT + 26 others); Fri, 28 Feb 2014 00:16:12 -0500 Received: from mail-pd0-f175.google.com ([209.85.192.175]:44849 "EHLO mail-pd0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751123AbaB1FQJ (ORCPT ); Fri, 28 Feb 2014 00:16:09 -0500 Received: by mail-pd0-f175.google.com with SMTP id x10so257917pdj.34 for ; Thu, 27 Feb 2014 21:16:09 -0800 (PST) X-Received: by 10.68.170.66 with SMTP id ak2mr1160916pbc.5.1393564569182; Thu, 27 Feb 2014 21:16:09 -0800 (PST) Received: from localhost.localdomain (KD182249084248.au-net.ne.jp. [182.249.84.248]) by mx.google.com with ESMTPSA id y9sm4507579pas.10.2014.02.27.21.16.03 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 27 Feb 2014 21:16:08 -0800 (PST) From: AKASHI Takahiro To: will.deacon@arm.com Cc: viro@zeniv.linux.org.uk, eparis@redhat.com, rgb@redhat.com, catalin.marinas@arm.com, dsaxena@linaro.org, arndb@arndb.de, linux-arm-kernel@lists.infradead.org, linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, linux-audit@redhat.com, AKASHI Takahiro Subject: [PATCH v3 1/2] arm64: make a single hook to syscall_trace() for all syscall features Date: Fri, 28 Feb 2014 14:14:24 +0900 Message-Id: <1393564465-3862-2-git-send-email-takahiro.akashi@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1393564465-3862-1-git-send-email-takahiro.akashi@linaro.org> References: <1393319683-2707-1-git-send-email-takahiro.akashi@linaro.org> <1393564465-3862-1-git-send-email-takahiro.akashi@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: takahiro.akashi@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Currently syscall_trace() is called only for ptrace. With additional TIF_xx flags defined, it is now called in all the cases of audit, ftrace and seccomp in addition to ptrace. Acked-by: Richard Guy Briggs Signed-off-by: AKASHI Takahiro --- arch/arm64/include/asm/thread_info.h | 13 +++++++++++++ arch/arm64/kernel/entry.S | 5 +++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h index 720e70b..0a8b2a9 100644 --- a/arch/arm64/include/asm/thread_info.h +++ b/arch/arm64/include/asm/thread_info.h @@ -91,6 +91,9 @@ static inline struct thread_info *current_thread_info(void) /* * thread information flags: * TIF_SYSCALL_TRACE - syscall trace active + * TIF_SYSCALL_TRACEPOINT - syscall tracepoint for ftrace + * TIF_SYSCALL_AUDIT - syscall auditing + * TIF_SECOMP - syscall secure computing * TIF_SIGPENDING - signal pending * TIF_NEED_RESCHED - rescheduling necessary * TIF_NOTIFY_RESUME - callback before returning to user @@ -101,6 +104,9 @@ static inline struct thread_info *current_thread_info(void) #define TIF_NEED_RESCHED 1 #define TIF_NOTIFY_RESUME 2 /* callback before returning to user */ #define TIF_SYSCALL_TRACE 8 +#define TIF_SYSCALL_AUDIT 9 +#define TIF_SYSCALL_TRACEPOINT 10 +#define TIF_SECCOMP 11 #define TIF_POLLING_NRFLAG 16 #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ #define TIF_FREEZE 19 @@ -112,10 +118,17 @@ static inline struct thread_info *current_thread_info(void) #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) +#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) +#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) +#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) +#define _TIF_SECCOMP (1 << TIF_SECCOMP) #define _TIF_32BIT (1 << TIF_32BIT) #define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \ _TIF_NOTIFY_RESUME) +#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \ + _TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP) + #endif /* __KERNEL__ */ #endif /* __ASM_THREAD_INFO_H */ diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 0d7b789..6d613cd 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -630,8 +630,9 @@ el0_svc_naked: // compat entry point enable_irq get_thread_info tsk - ldr x16, [tsk, #TI_FLAGS] // check for syscall tracing - tbnz x16, #TIF_SYSCALL_TRACE, __sys_trace // are we tracing syscalls? + ldr x16, [tsk, #TI_FLAGS] // check for syscall hooks + tst x16, #_TIF_SYSCALL_WORK + b.ne __sys_trace adr lr, ret_fast_syscall // return address cmp scno, sc_nr // check upper syscall limit b.hs ni_sys