From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2D2EBC77B7C for ; Wed, 10 May 2023 13:48:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683726517; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=48hb6rB/xU6WwqJ1aQkKIr5beGWn5OdjG4gp0PaXr0M=; b=OC/sh66Esu9CzSI9EZ4Va16iXPvK2mpwCgp0mnQOCotnb0U2ILoCqJb+OhdSduSDHj5la+ //7w56qWxabPgA0P82ubRMoqF4n0njrJaaBVQWTj0+ae26erhCMRbXtRsXgMtC6SGxrxgi oYvPQnrEBiANnMrop3Rz9eC4V3I4lqo= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-648-vPhzeG50NF2AnA1c6AQYPw-1; Wed, 10 May 2023 09:48:33 -0400 X-MC-Unique: vPhzeG50NF2AnA1c6AQYPw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C197184AF38; Wed, 10 May 2023 13:48:31 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3254B40C2077; Wed, 10 May 2023 13:48:31 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D128E19452C6; Wed, 10 May 2023 13:48:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 29B621946A45 for ; Wed, 10 May 2023 13:48:28 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id E2E184078907; Wed, 10 May 2023 13:48:27 +0000 (UTC) Received: from x2.localnet (unknown [10.22.17.96]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8B3874078908; Wed, 10 May 2023 13:48:27 +0000 (UTC) From: Steve Grubb To: Rinat Gadelshin , Paul Moore , linux-audit@redhat.com Subject: Re: Can AUDIT_LIST_RULES causes kthreadd-spam? Date: Wed, 10 May 2023 09:48:26 -0400 Message-ID: <12214633.O9o76ZdvQC@x2> Organization: Red Hat In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-BeenThere: linux-audit@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Audit Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: audit@vger.kernel.org, linux-audit@redhat.com Errors-To: linux-audit-bounces@redhat.com Sender: "Linux-audit" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Wednesday, May 10, 2023 9:30:19 AM EDT Tetsuo Handa wrote: > On 2023/05/10 21:12, Rinat Gadelshin wrote: > >> Please try to find who is calling audit_send_reply_thread for many > >> times. > > > > I've rebuilt the kernel with 'dump stack()'. > > Oops, I thought dump_stack() shows pid and comm name, but > it is dump_stack_print_info() that shows pid and comm name. > > > As far as I can see, it's the exit of `sendto` syscall. > > It seems that the kernel just creates a new kthreadd for each sendto > > syscall. But I think that I'm wrong and just missing something. > > Yes, sendto() on netlink socket calls netlink_sendmsg(). > For some reason, audit_send_reply() is called for many times. > audit_send_reply() is called by audit_receive_msg() for the following > types. > > AUDIT_GET > AUDIT_SIGNAL_INFO > AUDIT_TTY_GET > AUDIT_GET_FEATURE The audit userspace always adds NLM_F_ACK to any netlink communication to make sure it did not get discarded before it arrived. It has done this since before I started working on audit code. -Steve > Would you re-caputure with > > - dump_stack(); > + pr_info("%s %s:%d type=%d\n", __func__, current->comm, current->pid, > type); > > ? > > Regardless of the result of re-caputure, it seems there is no switch that > can prevent audit_send_reply() from calling > kthread_run(audit_send_reply_thread). > > But since kthreadd runs with PID=2 and PPID=0, you might be able to use > PID=2 and/or PPID=0 in your rules in order to let kernel audit subsystem > ignore kthreadd. (I can't test because I haven't found how to reproduce > audit_receive_msg() in my environment...) > > # cat /proc/2/status > Name: kthreadd > Umask: 0000 > State: S (sleeping) > Tgid: 2 > Ngid: 0 > Pid: 2 > PPid: 0 > > -- > Linux-audit mailing list > Linux-audit@redhat.com > https://listman.redhat.com/mailman/listinfo/linux-audit -- Linux-audit mailing list Linux-audit@redhat.com https://listman.redhat.com/mailman/listinfo/linux-audit