linux-audit.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Rinat Gadelshin <rgadelsh@gmail.com>
To: Paul Moore <paul@paul-moore.com>
Cc: audit@vger.kernel.org, linux-audit@redhat.com
Subject: Re: Can AUDIT_LIST_RULES causes kthreadd-spam?
Date: Thu, 4 May 2023 01:12:20 +0300	[thread overview]
Message-ID: <e5713a91-37b0-d32f-a0d2-eb668122c9e4@gmail.com> (raw)
In-Reply-To: <CAHC9VhTXHLS7bsDJ8-dSp4dQSQRcKRLiTMRYJOJVCY11G5D85A@mail.gmail.com>

On 04.05.2023 00:27, Paul Moore wrote:
> On Wed, May 3, 2023 at 5:14 PM Rinat Gadelshin <rgadelsh@gmail.com> wrote:
>> Hello there =)
>>
>> My name is Rinat.
>> I'm a newbie here (at Linux kernel developer community).
>>
>> My current job is to work with audit subsystem on different
>> versions of Linux (and different kernel versions from 3.10 to the latest)
>> with and without auditd.
>>
>> My program works behalf of root account and uses netlink
>> (unicast or multicast depends of  the kernel's version)
>> to communicate with audit subsystem of the kernel.
>>
>> If actual audit rule list has been changed
>> then my program should restore the configured audit rule list.
>>
>> To do it the program periodically (with 60 seconds interval)
>> requests the actual rule list be sending AUDIT_LIST_RULES.
>>
>> All rules are receiving perfectly.
>>
>> But I've noticed that there are many (2K+ for 5 minutes test)
>> kthreadd process have been spawned after that request
>> (I've stubbed the poll code and compare logs).
> Hi Rinat,
>
> First, a quick note that audit discussions involving the upstream
> Linux Kernel have moved to the audit@vger.kernel.org list (CC'd),
> please direct future emails there.
>
> Can you be more specific about the kernel threads you are seeing, are
> you seeing multiple "kauditd" threads?
>
> % ps -fC kauditd
> UID          PID    PPID  C STIME TTY          TIME CMD
> root          89       2  0 Apr28 ?        00:00:00 [kauditd]
>
>> Please, can you point me, what can I do to avoid this kthreadd-spam.
>>
>> Thank you.
>>
>> Best regards
>> Rinath
Hi Paul,

Thank you for your quick answer.
I swear to copy my future questions about audit subsystem to 
audit@vger.kernel.org =)

My logs don't provide lot of info about nature of the kthreadds.
(I hadn't written the log system).

I have something like this:

...pid: 2, uniquePid: 000082d800000002, fileName: kthreadd, lcFileName: 
kthreadd, name: kthreadd, commandLine: Skipped, lcCommandLine: Skipped, 
sessionId: 0, isRemote: 0, syscallName: fork, uid: 4294967295, gid: 
4294967295, euid: 4294967295, egid: 4294967295, logonSessionUid: -1, 
logonSessionUsername: Skipped, logonSessionRemoteHost: , exeOwnerUid: 0, 
exeOwnerGid: 0, exeMode: 0, exeInode: 0, exeCapsVersion: , 
exeCapsRootId: , exeCapsEffective: , exeCapsPermitted: , 
exeCapsInheritable: , dstPid: 106574, dstTid: 0, dstUniquePid: 
000083b10001a04e, requestId: 2684354949, startTime: 01d97d1fb24aa38e, 
hash: 00000000000000000000000000000000, cwd: , flags: 00000011, 
processState: 3, int: 0, type: 00000000..

And such events occurred 1208 times when AUDIT_LIST_RULES is sending.
The test has lasted 2 minutes.

The same test in which the request was disabled produced only 122 such 
records.

It was the only difference between the tests.

As I can see it was a fork syscall of kthreadd.

Are there any debug options for the kernel that I can set, rebuild the 
kernel, re-run the test and clarify the situation?

--
Linux-audit mailing list
Linux-audit@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-audit

  reply	other threads:[~2023-05-03 22:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-03 21:14 Can AUDIT_LIST_RULES causes kthreadd-spam? Rinat Gadelshin
2023-05-03 21:27 ` Paul Moore
2023-05-03 22:12   ` Rinat Gadelshin [this message]
2023-05-04  2:50     ` Tetsuo Handa
2023-05-04 18:40       ` Paul Moore
2023-05-04 22:53         ` Tetsuo Handa
2023-05-05 22:12           ` Rinat Gadelshin
2023-05-06  6:50             ` Tetsuo Handa
2023-05-10 12:12               ` Rinat Gadelshin
2023-05-10 13:30                 ` Tetsuo Handa
2023-05-10 13:48                   ` Steve Grubb
2023-05-24 10:38                   ` Rinat Gadelshin
2023-05-24 10:48                     ` Tetsuo Handa

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=e5713a91-37b0-d32f-a0d2-eb668122c9e4@gmail.com \
    --to=rgadelsh@gmail.com \
    --cc=audit@vger.kernel.org \
    --cc=linux-audit@redhat.com \
    --cc=paul@paul-moore.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;
as well as URLs for NNTP newsgroup(s).