From: Richard Guy Briggs <rgb@redhat.com>
To: Paul Moore <paul@paul-moore.com>
Cc: Linux-Audit Mailing List <linux-audit@lists.linux-audit.osci.io>,
LKML <linux-kernel@vger.kernel.org>,
linux-fsdevel@vger.kernel.org,
Linux Kernel Audit Mailing List <audit@vger.kernel.org>,
Eric Paris <eparis@parisplace.org>,
Steve Grubb <sgrubb@redhat.com>, Jan Kara <jack@suse.cz>,
Amir Goldstein <amir73il@gmail.com>
Subject: Re: [PATCH v1 1/2] audit: record fanotify event regardless of presence of rules
Date: Wed, 6 Aug 2025 17:04:03 -0400 [thread overview]
Message-ID: <aJPDQ+xdHol4tLzI@madcap2.tricolour.ca> (raw)
In-Reply-To: <CAHC9VhTO-bdwzfSeDvJcV19PPfqXn_HM1PUfHe5Z6fPmmsypqA@mail.gmail.com>
On 2025-05-29 20:01, Paul Moore wrote:
> On Tue, May 27, 2025 at 9:10 AM Richard Guy Briggs <rgb@redhat.com> wrote:
> > On 2025-04-11 14:14, Paul Moore wrote:
> > > On Mar 5, 2025 Richard Guy Briggs <rgb@redhat.com> wrote:
> > > >
> > > > When no audit rules are in place, fanotify event results are
> > > > unconditionally dropped due to an explicit check for the existence of
> > > > any audit rules. Given this is a report from another security
> > > > sub-system, allow it to be recorded regardless of the existence of any
> > > > audit rules.
> > > >
> > > > To test, install and run the fapolicyd daemon with default config. Then
> > > > as an unprivileged user, create and run a very simple binary that should
> > > > be denied. Then check for an event with
> > > > ausearch -m FANOTIFY -ts recent
> > > >
> > > > Link: https://issues.redhat.com/browse/RHEL-1367
> > > > Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
> > > > Acked-by: Jan Kara <jack@suse.cz>
> > > > ---
> > > > include/linux/audit.h | 8 +-------
> > > > kernel/auditsc.c | 2 +-
> > > > 2 files changed, 2 insertions(+), 8 deletions(-)
> > > >
> > > > diff --git a/include/linux/audit.h b/include/linux/audit.h
> > > > index 0050ef288ab3..d0c6f23503a1 100644
> > > > --- a/include/linux/audit.h
> > > > +++ b/include/linux/audit.h
> > > > @@ -418,7 +418,7 @@ extern void __audit_log_capset(const struct cred *new, const struct cred *old);
> > > > extern void __audit_mmap_fd(int fd, int flags);
> > > > extern void __audit_openat2_how(struct open_how *how);
> > > > extern void __audit_log_kern_module(char *name);
> > > > -extern void __audit_fanotify(u32 response, struct fanotify_response_info_audit_rule *friar);
> > > > +extern void audit_fanotify(u32 response, struct fanotify_response_info_audit_rule *friar);
> > > > extern void __audit_tk_injoffset(struct timespec64 offset);
> > > > extern void __audit_ntp_log(const struct audit_ntp_data *ad);
> > > > extern void __audit_log_nfcfg(const char *name, u8 af, unsigned int nentries,
> > > > @@ -525,12 +525,6 @@ static inline void audit_log_kern_module(char *name)
> > > > __audit_log_kern_module(name);
> > > > }
> > > >
> > > > -static inline void audit_fanotify(u32 response, struct fanotify_response_info_audit_rule *friar)
> > > > -{
> > > > - if (!audit_dummy_context())
> > > > - __audit_fanotify(response, friar);
> > > > -}
> > >
> > > It seems like we should at least have an audit_enabled() check, yes?
> > > We've had people complain about audit events being generated when audit
> > > is disabled, any while we don't currently have such a check in place
> > > here, I believe the dummy context check is doing that for us.
> > >
> > > static inline void audit_fanotify(...)
> > > {
> > > if (!audit_enabled)
> > > return;
> > > __audit_fanotify(...);
> > > }
> >
> > That would be consistent with other security events messages. I was
> > going through the selinux code to see what it does and I am missing it
> > if selinux checks with audit_enabled(). Are selinux messages somehow
> > exempt from audit_enabled()?
>
> There are likely a number of callers in the kernel that don't have
> audit_enabled() checks, some are probably bugs, others probably
> intentional; I wouldn't worry too much about what one subsystem does
> when deciding what to do for another. In the case of fanotify, I
> suspect the right thing to do is add an audit_enabled() check since it
> is already doing an audit_dummy_context() check. To be clear, there
> may be some cases where we do an audit_dummy_context() check and doing
> an audit_enabled() check would be wrong, but I don't believe that is
> the case with fanotify.
I totally dropped the ball on this. I had it respun, tested and
documented, ready to go May 28th and had a note that I'd sent it
complete with Message-ID and I find no evidence it was ever sent.
Re-based, re-tested, sending.
> paul-moore.com
- RGB
--
Richard Guy Briggs <rgb@redhat.com>
Sr. S/W Engineer, Kernel Security, Base Operating Systems
Remote, Ottawa, Red Hat Canada
Upstream IRC: SunRaycer
Voice: +1.613.860 2354 SMS: +1.613.518.6570
next prev parent reply other threads:[~2025-08-06 21:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-05 21:33 [PATCH v1 0/2] override audit silence norule for fs cases Richard Guy Briggs
2025-03-05 21:33 ` [PATCH v1 1/2] audit: record fanotify event regardless of presence of rules Richard Guy Briggs
2025-03-06 15:06 ` Jan Kara
2025-03-07 1:12 ` Richard Guy Briggs
2025-03-07 14:52 ` Jan Kara
2025-03-07 19:19 ` Richard Guy Briggs
2025-03-10 12:50 ` Jan Kara
2025-04-11 18:14 ` Paul Moore
2025-05-27 13:09 ` Richard Guy Briggs
2025-05-30 0:01 ` Paul Moore
2025-08-06 21:04 ` Richard Guy Briggs [this message]
2025-03-05 21:33 ` [PATCH v1 2/2] audit: record AUDIT_ANOM_* events " Richard Guy Briggs
2025-04-11 18:14 ` Paul Moore
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aJPDQ+xdHol4tLzI@madcap2.tricolour.ca \
--to=rgb@redhat.com \
--cc=amir73il@gmail.com \
--cc=audit@vger.kernel.org \
--cc=eparis@parisplace.org \
--cc=jack@suse.cz \
--cc=linux-audit@lists.linux-audit.osci.io \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paul@paul-moore.com \
--cc=sgrubb@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®