The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Steve Grubb <sgrubb@redhat.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Ricardo Robaina <rrobaina@redhat.com>,
	audit@vger.kernel.org, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, paul@paul-moore.com, eparis@redhat.com,
	edumazet@google.com, pabeni@redhat.com, horms@kernel.org
Subject: Re: [PATCH v2] netlink, audit: prevent false ENOBUFS on timeout expiry
Date: Wed, 10 Jun 2026 12:26:27 -0400	[thread overview]
Message-ID: <3707933.dWV9SEqChM@x2> (raw)
In-Reply-To: <20260609143558.49d96656@kernel.org>

Hello,

On Tuesday, June 9, 2026 5:35:58 PM Eastern Daylight Time Jakub Kicinski 
wrote:
> On Tue, 09 Jun 2026 13:40:23 -0400 Steve Grubb wrote:
> > > > You're right, it is. I see how this flag would fix the pathological
> > > > behavior that was reported. But as I have looked at this suggestion,
> > > > there seems to be one wrinkle. User space should not need to know
> > > > that
> > > > the audit code in the kernel has this retry mechanism.
> > > 
> > > It's not about the retry mechanism, at least in my mind - I read
> > > your reply as "user space should not know that there was congestion".
> > > Why?
> > 
> > In the audit case, it is not useful. I know there can be an endless
> > supply and there's not much that can be done except dequeueing what's
> > next.
> > 
> > > It's not very useful, I get that, but user space can just clear
> > > the congestion signal and keep going.
> > 
> > How? The recvfrom man page doesn't even discuss ENOBUFS. Which is one of
> > the strongest arguments for a kernel side patch. The fact that there is
> > exists a socket option to declare that you do not want ENOBUFS on
> > netlink sockets is esoteric knowledge. The netlink(7) man page does
> > cover the flag. But even where it discusses ENOBUFS, it does not mention
> > that this is preventable by setting a socket option. I do appreciate
> > this being pointed out. But getting from the recvfrom man page to a
> > solution is not obvious.
> 
> socket errors are generally "consumed" when they are returned.
> The user space should see one ENOBUF 

It does. The man page is unhelpful.

> and then once the rcvbuf is drained completely the CONGESTION bit should
> also get auto cleared. This is my mental model how Netlink works, LMK if
> you're seeing different behavior, my memory is faulty...

Well, yes that is normal for other netlink subsystems. And it looks like 
we're not missing any magic cure. However, that congestion bit is what really 
causes a major headache for the audit system because it has it's own retry 
scaffolding. Auditd ack's each message so that the kernel side advances. In 
any event, I patched auditd to set NETLINK_NO_ENOBUFS. It's not the solution 
I hoped for, but if I understand what this does, it should solve our problem 
for auditd.

Thanks,
-Steve
 
> > > > It seems like the audit subsystem should set the flag on auditd's
> > > > socket at registration time in auditd_set(). The kernel is the right
> > > > place for this because it's the kernel that manages the retry/ hold
> > > > queues and sets the sk_sndtimeo that triggers the overrun path -
> > > > auditd has no knowledge of these internals.
> > > 
> > > We have to carry this code somewhere, either in user space or in
> > > the kernel. I'd prefer not to carry it in the kernel.
> > 
> > I can put this in the audit daemon. But whoever else writes a similar app
> > will have to independently discover the same solution when faced with the
> > pathologically bad behavior. A kernel side fix would have made it easier
> > for future app developers to be successful.





      reply	other threads:[~2026-06-10 16:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-13 17:24 [PATCH v2] netlink, audit: prevent false ENOBUFS on timeout expiry Ricardo Robaina
2026-05-18 11:03 ` Simon Horman
2026-05-27 19:26   ` Ricardo Robaina
2026-05-19  0:35 ` Jakub Kicinski
2026-05-26 20:53   ` Paul Moore
2026-05-27 19:34     ` Ricardo Robaina
2026-05-27 19:29   ` Ricardo Robaina
2026-05-27 22:29     ` Jakub Kicinski
2026-05-28 22:40       ` Steve Grubb
2026-05-28 23:29         ` Jakub Kicinski
2026-06-09 17:40           ` Steve Grubb
2026-06-09 21:35             ` Jakub Kicinski
2026-06-10 16:26               ` Steve Grubb [this message]

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=3707933.dWV9SEqChM@x2 \
    --to=sgrubb@redhat.com \
    --cc=audit@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=eparis@redhat.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=paul@paul-moore.com \
    --cc=rrobaina@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