From patchwork Thu Mar 13 10:11:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 26182 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f197.google.com (mail-ve0-f197.google.com [209.85.128.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5CB57206A0 for ; Thu, 13 Mar 2014 10:13:13 +0000 (UTC) Received: by mail-ve0-f197.google.com with SMTP id pa12sf1861456veb.4 for ; Thu, 13 Mar 2014 03:13:13 -0700 (PDT) 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=hErnEBny/1XD8CCBaXIz2gMHEGclHhKQyP6B5ZUBJug=; b=OZBqvGU+Wj84yvXWveS9svcs91o53ZEdbnRz6nHdnN4iS1WLhR8RbUG9hSJQm7kMGN L07+1lQW7D6wjKp9f+1zhiJSzIsG+p0ws8j7Wk7cABjucWk9fA5te7yWyU4BjQZGUYHB MnixyhGaX4fcpC6/LDANPjOFxHD80+HpI1c2ghyfks+dRbXPlWGzXbvP4ByUEOmp/TaS ut6nCzGd6t9TkWAKtteporDrKiQPmjAVMSRnm1pjXQ93PXc2HJxrsdJ54vyiglPumWDm c5YIqe0iQ3irOO8nZ4lxfypFnmI5Wmg9K44prY8woDiLkTAL0GzsoDc1q2v73O+YyXFx aCmA== X-Gm-Message-State: ALoCoQnz2Lv9ZquozSyS6SXCIj5y8wGvIt8TiTVfg179MWcJbrhESkQ4r1eu9R96XxStjxhEh6M/ X-Received: by 10.236.112.4 with SMTP id x4mr367518yhg.56.1394705592842; Thu, 13 Mar 2014 03:13:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.31.35 with SMTP id e32ls100557qge.4.gmail; Thu, 13 Mar 2014 03:13:12 -0700 (PDT) X-Received: by 10.220.136.6 with SMTP id p6mr703329vct.9.1394705592679; Thu, 13 Mar 2014 03:13:12 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id xj4si628803vec.132.2014.03.13.03.13.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Mar 2014 03:13:12 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id ks9so833440vcb.13 for ; Thu, 13 Mar 2014 03:13:12 -0700 (PDT) X-Received: by 10.220.106.84 with SMTP id w20mr726453vco.18.1394705592586; Thu, 13 Mar 2014 03:13:12 -0700 (PDT) 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.78.9 with SMTP id i9csp355825vck; Thu, 13 Mar 2014 03:13:12 -0700 (PDT) X-Received: by 10.68.237.228 with SMTP id vf4mr1133088pbc.131.1394705591222; Thu, 13 Mar 2014 03:13:11 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bq3si1774476pbd.356.2014.03.13.03.13.10; Thu, 13 Mar 2014 03:13:10 -0700 (PDT) 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 S1753790AbaCMKMy (ORCPT + 26 others); Thu, 13 Mar 2014 06:12:54 -0400 Received: from mail-pb0-f41.google.com ([209.85.160.41]:62809 "EHLO mail-pb0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752829AbaCMKMv (ORCPT ); Thu, 13 Mar 2014 06:12:51 -0400 Received: by mail-pb0-f41.google.com with SMTP id jt11so901817pbb.0 for ; Thu, 13 Mar 2014 03:12:51 -0700 (PDT) X-Received: by 10.68.239.70 with SMTP id vq6mr1227431pbc.152.1394705571031; Thu, 13 Mar 2014 03:12:51 -0700 (PDT) Received: from localhost.localdomain (KD182249091179.au-net.ne.jp. [182.249.91.179]) by mx.google.com with ESMTPSA id fn2sm7487532pab.38.2014.03.13.03.12.46 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Mar 2014 03:12:49 -0700 (PDT) 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 v4 1/3] arm64: make a single hook to syscall_trace() for all syscall features Date: Thu, 13 Mar 2014 19:11:29 +0900 Message-Id: <1394705491-12343-2-git-send-email-takahiro.akashi@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1394705491-12343-1-git-send-email-takahiro.akashi@linaro.org> References: <1393564465-3862-1-git-send-email-takahiro.akashi@linaro.org> <1394705491-12343-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.220.182 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 Acked-by: Will Deacon --- 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 39ac630..f9f2cae 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -631,8 +631,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