From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steve Grubb Subject: Re: Checking for audit_enabled in the kernel Date: Tue, 14 Nov 2006 14:01:48 -0500 Message-ID: <200611141401.48925.sgrubb@redhat.com> References: <455A0157.9060100@hp.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <455A0157.9060100@hp.com> Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-audit-bounces@redhat.com Errors-To: linux-audit-bounces@redhat.com To: linux-audit@redhat.com List-Id: linux-audit@redhat.com On Tuesday 14 November 2006 12:48, Paul Moore wrote: > I'm trying to find a way to quickly determine if auditing is enabled and it > looks like the only real way to do that is to declare audit_enabled as an > extern and check the variable directly. Is there some interface for this > that I am missing? A good example of how to do this is in audit.h: static inline int audit_ipc_obj(struct kern_ipc_perm *ipcp) { if (unlikely(!audit_dummy_context())) return __audit_ipc_obj(ipcp); return 0; } __audit_ipc_obj is the real function that does the actual work. The audit_dummy_context() function uses current, so it may not be suitable to use on events that come from netlink. In that case, we'd need a new function that takes a task struct. -Steve