Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757260Ab3IORR1 (ORCPT ); Sun, 15 Sep 2013 13:17:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25509 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757231Ab3IORRZ (ORCPT ); Sun, 15 Sep 2013 13:17:25 -0400 Date: Sun, 15 Sep 2013 19:11:09 +0200 From: Oleg Nesterov To: Andrew Morton Cc: Eric Paris , Kees Cook , Richard Guy Briggs , Steve Grubb , Zach Levis , linux-audit@redhat.com, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/1] audit_alloc: clear TIF_SYSCALL_AUDIT if !audit_context Message-ID: <20130915171109.GA15418@redhat.com> References: <20130915171038.GA15410@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130915171038.GA15410@redhat.com> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1249 Lines: 40 If audit_filter_task() nacks the new thread it makes sense to clear TIF_SYSCALL_AUDIT which can be copied from parent by dup_task_struct(). A wrong TIF_SYSCALL_AUDIT is not really bad but it triggers the "slow" audit paths in entry.S to ensure the task can not miss audit_syscall_*() calls, this is pointless if the task has no ->audit_context. Signed-off-by: Oleg Nesterov Acked-by: Steve Grubb --- kernel/auditsc.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 9845cb3..95293ab 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c @@ -943,8 +943,10 @@ int audit_alloc(struct task_struct *tsk) return 0; /* Return if not auditing. */ state = audit_filter_task(tsk, &key); - if (state == AUDIT_DISABLED) + if (state == AUDIT_DISABLED) { + clear_tsk_thread_flag(tsk, TIF_SYSCALL_AUDIT); return 0; + } if (!(context = audit_alloc_context(state))) { kfree(key); -- 1.5.5.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/