From patchwork Wed Apr 30 09:51: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: 29390 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AAC57203F3 for ; Wed, 30 Apr 2014 09:53:08 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id vb8sf7677862obc.7 for ; Wed, 30 Apr 2014 02:53:08 -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=KikJiLS08PwTQmjLD7hIbQt7/7ZOfSLUkNpS/dDq6gs=; b=mF9AnJ5xh4gc4e/pbp1wKEzEKQ9Gux25r9KH+1w4U0XaQHbjLhEkAaPDugsikeNDT+ bkm6rIVR8aqp0u91JG4y2MIkWVRzO58qo9BWkLLOxqngQNcGJeypWSuXEs1FlzchHANf iifAZHyBjEqj6Gl6Ev9ERe7Tf591KExFkZjiLMDfTvkQdfD4vXeO7acQdsvFqy97PqYy gVYmUu9zfq7lQOjx4SrU13kSucJtO0UK0tZSx6wWv6fOG4rjKT3ABS/cuwzJIW+BZIC1 sHnNzglZcz55vrWH1xbubYGfHATLuDYm78w2BXW/WYuGM5ApzHib2guO2LBYC8CQPBi2 zpiA== X-Gm-Message-State: ALoCoQlO+o1sFhGXrsJhqu/U65+8o9zyrm0kGkaWgM5nOKVmZ/0AZ5OaDp1vLOobeUf05mpHWBxv X-Received: by 10.43.163.199 with SMTP id mp7mr1623581icc.6.1398851587766; Wed, 30 Apr 2014 02:53:07 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.26.182 with SMTP id 51ls569054qgv.38.gmail; Wed, 30 Apr 2014 02:53:07 -0700 (PDT) X-Received: by 10.52.175.166 with SMTP id cb6mr2571844vdc.1.1398851587630; Wed, 30 Apr 2014 02:53:07 -0700 (PDT) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id kj3si5188893vdb.204.2014.04.30.02.53.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Apr 2014 02:53:07 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.180; Received: by mail-ve0-f180.google.com with SMTP id jz11so1835076veb.11 for ; Wed, 30 Apr 2014 02:53:07 -0700 (PDT) X-Received: by 10.52.108.164 with SMTP id hl4mr2610056vdb.25.1398851587543; Wed, 30 Apr 2014 02:53:07 -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.221.72 with SMTP id ib8csp265160vcb; Wed, 30 Apr 2014 02:53:07 -0700 (PDT) X-Received: by 10.66.189.106 with SMTP id gh10mr6756488pac.31.1398851586714; Wed, 30 Apr 2014 02:53:06 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ic8si16359354pad.423.2014.04.30.02.53.05 for ; Wed, 30 Apr 2014 02:53:05 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933155AbaD3Jwy (ORCPT + 28 others); Wed, 30 Apr 2014 05:52:54 -0400 Received: from mail-ig0-f175.google.com ([209.85.213.175]:56987 "EHLO mail-ig0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932101AbaD3Jww (ORCPT ); Wed, 30 Apr 2014 05:52:52 -0400 Received: by mail-ig0-f175.google.com with SMTP id h3so7334052igd.2 for ; Wed, 30 Apr 2014 02:52:51 -0700 (PDT) X-Received: by 10.43.145.137 with SMTP id ju9mr2811539icc.36.1398851571187; Wed, 30 Apr 2014 02:52:51 -0700 (PDT) Received: from localhost.localdomain (KD182249095136.au-net.ne.jp. [182.249.95.136]) by mx.google.com with ESMTPSA id s8sm4428691ige.4.2014.04.30.02.52.46 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Apr 2014 02:52:50 -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 v6 1/4] arm64: make a single hook to syscall_trace() for all syscall features Date: Wed, 30 Apr 2014 18:51:29 +0900 Message-Id: <1398851492-16345-2-git-send-email-takahiro.akashi@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1398851492-16345-1-git-send-email-takahiro.akashi@linaro.org> References: <1394861948-28712-1-git-send-email-takahiro.akashi@linaro.org> <1398851492-16345-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: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) 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 Acked-by: Will Deacon 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 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