From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 475B2308F1A for ; Wed, 18 Mar 2026 17:34:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773855264; cv=none; b=GnGalv9aw3CLGfQ6n4HQqEfvVvGzjrev2Cfy7yLzI07G0BQN5NNSPbLGnywwfrDA96cSd00JzFSBSb47AewiYPz3KkdwhkWn2+PQNLiK7GPUyMY2k3z00ZcY5NmMey3zI7GAdpe5HqaTVYKXuDtbn2N2MOlx9gAhHw+x2s3KZS0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773855264; c=relaxed/simple; bh=FZxvRu+85EWsxqRmuAs5TjqTbVp8lAzOjEKZsLeBTXM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sO2asl2KZF+LkKEILakAQZeHspHTaqiEJ+j5VHVeRCS22SL3+sFQTdN97O6HQVBBC8/CmBPVezm0OPpwpjKAr8S1YeLB+AoY6k0L7DjcVB2WY9TBt0Ves3RsEqflD/uIDY37xjaUVz1wlyyCjALlGPL6DxJOrNEwh31tpZA1tGE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=cloudflare.com; spf=pass smtp.mailfrom=cloudflare.com; dkim=pass (2048-bit key) header.d=cloudflare.com header.i=@cloudflare.com header.b=ZIQ8Y8q2; arc=none smtp.client-ip=209.85.210.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=cloudflare.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cloudflare.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cloudflare.com header.i=@cloudflare.com header.b="ZIQ8Y8q2" Received: by mail-ot1-f45.google.com with SMTP id 46e09a7af769-7d73ccee442so107586a34.1 for ; Wed, 18 Mar 2026 10:34:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudflare.com; s=google09082023; t=1773855261; x=1774460061; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=eWeEa0ZafBH05FmgYmVQzG8J+24xX/BkM77vv1zD8SU=; b=ZIQ8Y8q2up0WQADu+jzFDuMldHGgfqAA3c3j4H3T5Lcxfe4ftsyHELNmFik8FV8e8z w1PLCvdfsEBJkEn9+5kO8ZW+eXOSQZD5rk6PLm+FEZYiu/nCEUpj2T/jmT60Dg/g1CIs CrYOXi04XdvU2IBMEMVyxYjZNz1IMc6tE+G7rfzA6axZlhdnQWS6kgAp1mWQOmY+56i3 80Fmpv18cqRt8rAfjsHpSReittFy2zgwKQl8goe6sbUWMxzRopoUWXbESr+9XoJlvnJG vgjo5oNJbpCubomqywdW8+KH14/Vri90Kw7Qu1EqhcZzuIKvEjXPcjOKGJ95WXD2AJvn bXhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773855261; x=1774460061; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eWeEa0ZafBH05FmgYmVQzG8J+24xX/BkM77vv1zD8SU=; b=j01nqI76MbPTMrFXqcNEilkwpbMEhh+BtuXTnC+dHOGeuz4z7AjJCORd7vUbxe9cqT pTbNTqnK7MztnzzZU+m6KDkG5vV3EWKo7iTxQLH/VBL6hB/rQEkSlUzLw1j5+NY4moT3 dyFlCIwJ0qIu8VsWvmW980nRclCafrN89PK/lHhJLEsqWA2GPNF5Qy4wKHj3cWLuuhDj HiU5taTgAZyRgI2+DvvAN/ugJUDgdjbrBDTwFvb8SJz9T3TRwnv3huf4sZWBJUom1VE8 YcjGBKoGm01BSzkLlSI4CvOEMaz/bYMwZs5wbu+ONMcVGd3x+OpGOGW/xRvl7wPIb5vj fIwg== X-Forwarded-Encrypted: i=1; AJvYcCVuhUKAZDWJ0xARs/1kSpeQknq/weJs0ceRWXOeZQkz7G8p5SfMQD7wSw5kviQzE1/JQxWzBHbMeL5OeYU=@vger.kernel.org X-Gm-Message-State: AOJu0Yx5vu3Cd6QHUqYVOYebCvPBb4YwWVkMs2s/vsLCrMhD3sCjFjhD Y1X8g9qK9MaPvdCiTx2zcZYhyFPmDfNfxx+UXMe9qg8402462v8QTr9M1AzqR4yHcSQ= X-Gm-Gg: ATEYQzxvYl7IPYnVir95snxlqV+24Fm01p0Vy8jJ2Cn+Su6sLwIyy9xJgEkEIEZU3RP LfoMb5VkiAHxI58vpWEIXG2foUsEahWHTAMzF1Iel03ux/MjdOwn7mXFgVpKck3IVv/apInRYui x0uX/9uJozsctgFIWme5MoqOWxXh3OTY09+fILhKr+rptlYncjRl7BAfX0DYbD/u3G9pLr6jhva 6ztC/KdwVVG279I2oZe8xu1ojbe+kfYWq/j0ZZEpASIUa7+qkHjnFoMUDuh1QbG/bZEzO/XlgBX 8VNAQH2W42fudvqxVkgttHX762m6SyUHh0IyfEiwQnt320INZ9f8ip7wlO9UCz+scvStFdnlgxB oMLfsJO75POCz8w90R/pARpM3C2CSZ77knXlbBEOFSOA0i3nw60bcjw9c55tAHbu9ONs/R5CkpO vMtLSm X-Received: by 2002:a05:6830:64c8:b0:7d7:4d85:eb05 with SMTP id 46e09a7af769-7d7ca775284mr2522284a34.22.1773855260727; Wed, 18 Mar 2026 10:34:20 -0700 (PDT) Received: from CMGLRV3 ([2a09:bac5:947d:1b37::2b6:4e]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7d7c9950ef9sm2751073a34.2.2026.03.18.10.34.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2026 10:34:20 -0700 (PDT) Date: Wed, 18 Mar 2026 12:34:17 -0500 From: Frederick Lawler To: Kumar Kartikeya Dwivedi Cc: Paul Moore , James Morris , "Serge E. Hallyn" , Eric Paris , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shuah Khan , =?iso-8859-1?Q?Micka=EBl_Sala=FCn?= , =?iso-8859-1?Q?G=FCnther?= Noack , linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, audit@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, kernel-team@cloudflare.com Subject: Re: [PATCH RFC bpf-next 0/4] audit: Expose audit subsystem to BPF LSM programs via BPF kfuncs Message-ID: References: <20260311-bpf-auditd-send-message-v1-0-10a62db5c92f@cloudflare.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Hi Kumar, On Tue, Mar 17, 2026 at 03:43:36AM +0100, Kumar Kartikeya Dwivedi wrote: > On Wed, 11 Mar 2026 at 22:31, Frederick Lawler wrote: > > 3. All bpf_audit_log_*() functions are destructive > > > > The audit subsystem allows for AUDIT_FAIL_PANIC to be set when the > > subsystem can detect that missing events. Further, some call paths may > > invoke a BUG_ON(). Therefore all the functions are marked destructive. > > I think the first part makes sense (i.e., the policy simply configured > the system to panic on failure). > However, in the second case, if the program is somehow able to trigger > BUG_ON() relied upon for internal invariants, it would be considered > broken. > I tried grepping through and didn't find anything that would cause > this, hence the whole thing about BUG_ON() in the cover letter only > adds to confusion. > Please drop it or describe cases which you were concerned about. > bpf_audit_log_cause() -> audit_log_untrustedstring() -> audit_log_n_untrustedstring() -> audit_log_n_hex() Was the primary call chain I was referring to, and yes this relies on internal invariant of the SKB existing. I can remove from cover. > > > > 4. Functions are callable once per bpf_audit_context > > > > The rationale for this was to prevent abuse. Logs with repeated fields > > are not helpful, and may not be handled by user space audit coherently. > > > > This rationale feels weak. What abuse are we talking about? > The LSM program is already written by a trusted entity. > I learned through off-list discussions that there's "undocumented" or "unspoken" rules of log formatting and how auditd expects logs. Without knowing exactly what these rules are, I can't provide any stronger arguments other than to reduce duplication of fields in messages, or exclude wrappers that supply unverified data. WRT to unverified data, the socket wrappers accepting a netinf int. In that case, the variable is at least verified via lookup to report the interface in which it belongs. I left out wrapping LSM_AUDIT_DATA_ANONINODE due to the passing of arbitrary string, LSM_AUDIT_DATA_IPC arbitrary int. Others like for infiniband, lockdown, nlmsgtype, were left out due to specificity, and not general purpose usage. Some of the rationale behind this is _not_ trusting BPF LSM authors as much due to BPF LSM flexibility and accommodating user space audit. Best, Fred