From patchwork Tue Feb 25 09:18:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 25250 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f198.google.com (mail-ve0-f198.google.com [209.85.128.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 92DA120558 for ; Tue, 25 Feb 2014 09:20:10 +0000 (UTC) Received: by mail-ve0-f198.google.com with SMTP id oy12sf181116veb.9 for ; Tue, 25 Feb 2014 01:20:10 -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=Hwh3LhFLDE6qwR/9ATxOu2KuLcfuTH8wg62eocNcB3s=; b=dDHccEwbmJmUjooFv2PGER6mIx1ydLn7cDywbz9BYFn0DXnEjLPFhsxicoWJZCg/ot 8jvTwcShbd8S6y1eROmHUQR6VhcTP52xXFiMoKT/Jce3g3Dk1iF37enUk3AFpd81Ec+N 2KCHmcD2kBH5WKHgG4B7GUIll3ilA8Xu7mcyhfk8dA5dSrGlS0AQiHmwL1/5K+ryWjmq EiLo0h5U899XnBEaJ7RGsyr5S3hYlpOQBOsyLmpzVnKHgW3EByTPcuwNyHJZllUlGVin Ua8aUlBp3az8Gv4lnKFeiP4q8g3+n4FC4iVCqvHE1Tiy2Kxsyu4WX7v71gbjYxoXhy1t /PfQ== X-Gm-Message-State: ALoCoQmRXQ+JRvAmhZyqvIcn9pURzW1sYX8NInA1wylRSZiNi+qKzzmD554b5dY0yDNW0pSYxziy X-Received: by 10.58.37.72 with SMTP id w8mr120066vej.29.1393320010372; Tue, 25 Feb 2014 01:20:10 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.30.201 with SMTP id d67ls2306170qgd.62.gmail; Tue, 25 Feb 2014 01:20:10 -0800 (PST) X-Received: by 10.52.237.167 with SMTP id vd7mr137799vdc.54.1393320010119; Tue, 25 Feb 2014 01:20:10 -0800 (PST) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id a5si6670992vez.6.2014.02.25.01.20.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Feb 2014 01:20:10 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.178 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.178; Received: by mail-vc0-f178.google.com with SMTP id ik5so6974229vcb.9 for ; Tue, 25 Feb 2014 01:20:10 -0800 (PST) X-Received: by 10.58.200.229 with SMTP id jv5mr148713vec.15.1393320010033; Tue, 25 Feb 2014 01:20:10 -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.174.196 with SMTP id u4csp123697vcz; Tue, 25 Feb 2014 01:20:09 -0800 (PST) X-Received: by 10.66.159.132 with SMTP id xc4mr461343pab.27.1393320008646; Tue, 25 Feb 2014 01:20:08 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id wl10si19870519pab.172.2014.02.25.01.20.07; Tue, 25 Feb 2014 01:20:07 -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 S1752826AbaBYJT7 (ORCPT + 26 others); Tue, 25 Feb 2014 04:19:59 -0500 Received: from mail-pa0-f43.google.com ([209.85.220.43]:65478 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752215AbaBYJTz (ORCPT ); Tue, 25 Feb 2014 04:19:55 -0500 Received: by mail-pa0-f43.google.com with SMTP id rd3so7842284pab.2 for ; Tue, 25 Feb 2014 01:19:55 -0800 (PST) X-Received: by 10.67.4.169 with SMTP id cf9mr442232pad.45.1393319989005; Tue, 25 Feb 2014 01:19:49 -0800 (PST) Received: from localhost.localdomain (KD182249093189.au-net.ne.jp. [182.249.93.189]) by mx.google.com with ESMTPSA id ix2sm8351685pbc.45.2014.02.25.01.19.44 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Feb 2014 01:19:47 -0800 (PST) From: AKASHI Takahiro To: viro@zeniv.linux.org.uk, eparis@redhat.com, rgb@redhat.com, catalin.marinas@arm.com, will.deacon@arm.com Cc: 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 v5 3/3] arm64: audit: Add audit hook in ptrace/syscall_trace Date: Tue, 25 Feb 2014 18:18:54 +0900 Message-Id: <1393319934-2810-4-git-send-email-takahiro.akashi@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1393319934-2810-1-git-send-email-takahiro.akashi@linaro.org> References: <1391767803-5350-1-git-send-email-takahiro.akashi@linaro.org> <1393319934-2810-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.178 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: , This patch adds auditing functions on entry to or exit from every system call invocation. Signed-off-by: AKASHI Takahiro Acked-by: Richard Guy Briggs --- arch/arm64/kernel/ptrace.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index c70133e..d4ce70e 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c @@ -19,6 +19,7 @@ * along with this program. If not, see . */ +#include #include #include #include @@ -38,6 +39,7 @@ #include #include #include +#include #include #include @@ -1062,6 +1064,9 @@ asmlinkage int syscall_trace(int dir, struct pt_regs *regs) { unsigned long saved_reg; + if (dir && test_thread_flag(TIF_SYSCALL_AUDIT)) + audit_syscall_exit(regs); + if (test_thread_flag(TIF_SYSCALL_TRACE)) { if (is_compat_task()) { /* AArch32 uses ip (r12) for scratch */ @@ -1087,5 +1092,11 @@ asmlinkage int syscall_trace(int dir, struct pt_regs *regs) regs->regs[7] = saved_reg; } + if (!dir && test_thread_flag(TIF_SYSCALL_AUDIT)) + audit_syscall_entry(syscall_get_arch(current, regs), + (int)regs->syscallno, + regs->orig_x0, regs->regs[1], + regs->regs[2], regs->regs[3]); + return regs->syscallno; }