From patchwork Sat Mar 15 05:39:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 26314 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 CF03A202DD for ; Sat, 15 Mar 2014 05:41:25 +0000 (UTC) Received: by mail-pa0-f72.google.com with SMTP id bj1sf8382738pad.3 for ; Fri, 14 Mar 2014 22:41:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=vyHPIf6Kg84/ri0aHpwKeaKez6PeFZkZ4KZF9Jzvw30=; b=Ufc86R1CYqjpr89/C5KPiGeyU6NGUqjqjUUojW14FHoSejBJkT4UA1AJozc4GdYseO GFnU9bVz0J9pnBUCE4Ua9N2B/okY+VJHhu+WCdeQMQDrHZCq7jE/Sjb1b07u4YIo9kMK BkRtd3BwZxp2D5uhZthnxno4V/iZoiEgKtmOA7ZBrzMIt3U6XXx+SLTiV4vWUA3ndCxg qM6jgZ9YpfdFHeaepgOudSvZxyEZZ+sOOIUGheUUJXWLM59BzbQmfN4nAFBzYWSYiUXJ MwD5F5rg8eFzDviw/ZNAR9WHHBS0CivdDP29AusuBX7YLqhlKp6F7hXR0MDHfjmjoIDX c2LA== X-Gm-Message-State: ALoCoQn7WJEg4fRX7y3SNnF5Dadro7JRRZkcHM3bywkdJO8/jfqXAtjXnKXUifVNEVHkDi9QTh1F X-Received: by 10.68.253.66 with SMTP id zy2mr4788687pbc.1.1394862085118; Fri, 14 Mar 2014 22:41:25 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.100.137 with SMTP id s9ls1003072qge.57.gmail; Fri, 14 Mar 2014 22:41:25 -0700 (PDT) X-Received: by 10.58.229.167 with SMTP id sr7mr9397168vec.7.1394862084999; Fri, 14 Mar 2014 22:41:24 -0700 (PDT) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id cp10si1164691ved.128.2014.03.14.22.41.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 14 Mar 2014 22:41:24 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.181 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.181; Received: by mail-ve0-f181.google.com with SMTP id oy12so3709133veb.12 for ; Fri, 14 Mar 2014 22:41:24 -0700 (PDT) X-Received: by 10.58.220.161 with SMTP id px1mr9886706vec.13.1394862084860; Fri, 14 Mar 2014 22:41:24 -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 i9csp72820vck; Fri, 14 Mar 2014 22:41:24 -0700 (PDT) X-Received: by 10.194.143.40 with SMTP id sb8mr9831747wjb.15.1394862083137; Fri, 14 Mar 2014 22:41:23 -0700 (PDT) Received: from casper.infradead.org (casper.infradead.org. [2001:770:15f::2]) by mx.google.com with ESMTPS id a3si775046wie.22.2014.03.14.22.41.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Mar 2014 22:41:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:770:15f::2 as permitted sender) client-ip=2001:770:15f::2; Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WOhKd-0000nz-Cd; Sat, 15 Mar 2014 05:40:27 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WOhKU-0007x2-VL; Sat, 15 Mar 2014 05:40:18 +0000 Received: from mail-pd0-f174.google.com ([209.85.192.174]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WOhKL-0007vK-Bq for linux-arm-kernel@lists.infradead.org; Sat, 15 Mar 2014 05:40:10 +0000 Received: by mail-pd0-f174.google.com with SMTP id y13so3415310pdi.33 for ; Fri, 14 Mar 2014 22:39:47 -0700 (PDT) X-Received: by 10.68.178.131 with SMTP id cy3mr12940788pbc.146.1394861986293; Fri, 14 Mar 2014 22:39:46 -0700 (PDT) Received: from localhost.localdomain (pdddd29.tkyoac00.ap.so-net.ne.jp. [218.221.221.41]) by mx.google.com with ESMTPSA id iv2sm22280176pbc.19.2014.03.14.22.39.41 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 14 Mar 2014 22:39:45 -0700 (PDT) From: AKASHI Takahiro To: will.deacon@arm.com Subject: [PATCH v5 1/4] arm64: make a single hook to syscall_trace() for all syscall features Date: Sat, 15 Mar 2014 14:39:05 +0900 Message-Id: <1394861948-28712-2-git-send-email-takahiro.akashi@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1394861948-28712-1-git-send-email-takahiro.akashi@linaro.org> References: <1394705491-12343-1-git-send-email-takahiro.akashi@linaro.org> <1394861948-28712-1-git-send-email-takahiro.akashi@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140315_014009_539385_6E681313 X-CRM114-Status: GOOD ( 11.18 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [209.85.192.174 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linaro-kernel@lists.linaro.org, rgb@redhat.com, catalin.marinas@arm.com, arndb@arndb.de, eparis@redhat.com, linux-kernel@vger.kernel.org, AKASHI Takahiro , dsaxena@linaro.org, viro@zeniv.linux.org.uk, linux-audit@redhat.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.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.181 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 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