Re: [PATCH v2] audit: Send netlink ACK before setting connection in auditd_set
From: Paul Moore
Date: Sun Nov 12 2023 - 22:36:41 EST
On Tue, Nov 7, 2023 at 6:31 PM Paul Moore <paul@xxxxxxxxxxxxxx> wrote:
> On Oct 18, 2023 Paul Moore <paul@xxxxxxxxxxxxxx> wrote:
> >
> > When auditd_set sets the auditd_conn pointer, audit messages can
> > immediately be put on the socket by other kernel threads. If the backlog
> > is large or the rate is high, this can immediately fill the socket
> > buffer. If the audit daemon requested an ACK for this operation, a full
> > socket buffer causes the ACK to get dropped, also setting ENOBUFS on the
> > socket.
> >
> > To avoid this race and ensure ACKs get through, fast-track the ACK in
> > this specific case to ensure it is sent before auditd_conn is set.
> >
> > Signed-off-by: Chris Riches <chris.riches@xxxxxxxxxxx>
> > ---
> >
> > > I'm happier with the bool over the integer type for the @ack variable.
> > > I'd suggest updating the patch and posting it again so we can review
> > > it in full, but we weren't very far off last time so I think it should
> > > be close, if not acceptable on the next revision.
> >
> > Here's the latest iteration of the suggested patch. I've done it via git
> > send-email so it should apply cleanly.
> >
> > kernel/audit.c | 31 ++++++++++++++++++++++++-------
> > 1 file changed, 24 insertions(+), 7 deletions(-)
>
> This looks good to me, thanks for your patience and persistence Chris.
>
> I'm going to merge this into audit/dev-staging now and it will move to
> audit/dev once v6.7-rc1 is released and the merge window closes.
I've now merged this into lsm/dev, thanks again Chris.
--
paul-moore.com