<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <pre class="moz-quote-pre" wrap="">Hi Paul,

I have done some tests on my system, usecases include the abnormal scenario,
our CI usecases, and audit-testsuite usecases, everything is OK.
</pre>
    <div class="moz-cite-prefix">
      <pre>Thanks for your work.

Gaosheng.
</pre>
    </div>
    <div class="moz-cite-prefix">在 2022/1/21 0:50, Paul Moore 写道:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAHC9VhQiWiB3yHi0f4QGu+6tuTDvEQ8sHbjp-7XHy-hYpBRSDQ@mail.gmail.com">
      <pre class="moz-quote-pre" wrap="">On Thu, Jan 20, 2022 at 11:47 AM Paul Moore <a class="moz-txt-link-rfc2396E" href="mailto:paul@paul-moore.com"><paul@paul-moore.com></a> wrote:
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">
When an admin enables audit at early boot via the "audit=1" kernel
command line the audit queue behavior is slightly different; the
audit subsystem goes to greater lengths to avoid dropping records,
which unfortunately can result in problems when the audit daemon is
forcibly stopped for an extended period of time.

This patch makes a number of changes designed to improve the audit
queuing behavior so that leaving the audit daemon in a stopped state
for an extended period does not cause a significant impact to the
system.

- kauditd_send_queue() is now limited to looping through the
  passed queue only once per call.  This not only prevents the
  function from looping indefinitely when records are returned
  to the current queue, it also allows any recovery handling in
  kauditd_thread() to take place when kauditd_send_queue()
  returns.

- Transient netlink send errors seen as -EAGAIN now cause the
  record to be returned to the retry queue instead of going to
  the hold queue.  The intention of the hold queue is to store,
  perhaps for an extended period of time, the events which led
  up to the audit daemon going offline.  The retry queue remains
  a temporary queue intended to protect against transient issues
  between the kernel and the audit daemon.

- The retry queue is now limited by the audit_backlog_limit
  setting, the same as the other queues.  This allows admins
  to bound the size of all of the audit queues on the system.

- kauditd_rehold_skb() now returns records to the end of the
  hold queue to ensure ordering is preserved in the face of
  recent changes to kauditd_send_queue().

Cc: <a class="moz-txt-link-abbreviated" href="mailto:stable@vger.kernel.org">stable@vger.kernel.org</a>
Fixes: 5b52330bbfe63 ("audit: fix auditd/kernel connection state tracking")
Fixes: f4b3ee3c85551 ("audit: improve robustness of the audit queue handling")
Reported-by: Gaosheng Cui <a class="moz-txt-link-rfc2396E" href="mailto:cuigaosheng1@huawei.com"><cuigaosheng1@huawei.com></a>
Signed-off-by: Paul Moore <a class="moz-txt-link-rfc2396E" href="mailto:paul@paul-moore.com"><paul@paul-moore.com></a>

--
v2:
- incorporated feedback from Gaosheng Cui
- promoted to proper patch
v1:
- initial RFC
---
 kernel/audit.c |   62 +++++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 43 insertions(+), 19 deletions(-)
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
Hi Gaosheng Cui,

Everything tests okay on my system, but if you have the ability to
test this patch in your environment to verify that it fixes the
problem you are seeing, it would be greatly appreciated.

Thanks.

--
paul moore
paul-moore.com
.
</pre>
    </blockquote>
  </body>
</html>