From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: [PATCH 4.10 070/111] audit: fix auditd/kernel connection state tracking Date: Tue, 20 Feb 2018 15:06:40 +0100 Message-ID: <20180220140640.GE25201@hirez.programming.kicks-ass.net> References: <20170328122915.640228468@linuxfoundation.org> <20170328122918.597715642@linuxfoundation.org> <20180220123757.GE25314@hirez.programming.kicks-ass.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1F7D25EDE5 for ; Tue, 20 Feb 2018 14:06:49 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 125AF1752DC for ; Tue, 20 Feb 2018 14:06:49 +0000 (UTC) Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-audit-bounces@redhat.com Errors-To: linux-audit-bounces@redhat.com To: Paul Moore Cc: Dmitry Vyukov , Greg Kroah-Hartman , linux-audit@redhat.com, linux-kernel@vger.kernel.org, stable@vger.kernel.org List-Id: linux-audit@redhat.com On Tue, Feb 20, 2018 at 08:25:21AM -0500, Paul Moore wrote: > On Tue, Feb 20, 2018 at 7:37 AM, Peter Zijlstra wrote: > > On Tue, Mar 28, 2017 at 02:30:56PM +0200, Greg Kroah-Hartman wrote: > >> 4.10-stable review patch. If anyone has any objections, please let me know. > > > >> + if (!(auditd_test_task(current) || > >> + (current == __mutex_owner(&audit_cmd_mutex)))) { > >> + long stime = audit_backlog_wait_time; > > > > Since I cannot find the original email on lkml, NAK on this. > > __mutex_owner() is not a general purpose helper function. > > Since this code also exists in the current kernel, I need to ask what > recommended alternatives exist for determining the mutex owner? > > I imagine we could track the mutex owner separately in the audit > subsystem, but I'd much prefer to leverage an existing mechanism if > possible. It's not at all clear to me what that code does, I just stumbled upon __mutex_owner() outside of the mutex code itself and went WTF. The comment (aside from having the most horribly style) is wrong too, because it claims it will not block when we hold that lock, while, afaict, it will in fact do just that. Maybe if you could explain how that code is supposed to work and why it doesn't know if it holds a lock I could make a suggestion...