Article View: linux.kernel.netdev
Article #5444Re: [PATCH bpf-next 7/8] selftests/bpf: Test forbidden bpf_ksock_sendto() LSM attach
From: bot+bpf-ci
Date: Tue, 20 Oct 2026 10:52
Date: Tue, 20 Oct 2026 10:52
101 lines
11846 bytes
11846 bytes
--===============8834276171442868486==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
> selftests/bpf: Test forbidden bpf_ksock_sendto() LSM attach
TL;DR:
- Selftest calls bpf_ksock_sendto() without a prototype until a later patch,
so the test may not build or run here (bisectability)
- Double blank line nit
> diff --git a/tools/testing/selftests/bpf/progs/ksock_lsm_verifier.c b/tools/testing/selftests/bpf/progs/ksock_lsm_verifier.c
> --- a/tools/testing/selftests/bpf/progs/ksock_lsm_verifier.c
> +++ b/tools/testing/selftests/bpf/progs/ksock_lsm_verifier.c
> @@ -33,7 +33,26 @@ int BPF_PROG(socket_sendmsg_ksock_send, struct socket *sock, struct msghdr *msg,
> }
>
> SEC("lsm.s/socket_sendmsg")
> -__description("bpf_ksock operations other than send are allowed from socket_sendmsg LSM hook")
> +__description("bpf_ksock_sendto is rejected from socket_sendmsg LSM hook")
> +__failure __msg("calling kernel function bpf_ksock_sendto is not allowed")
> +int BPF_PROG(socket_sendmsg_ksock_sendto, struct socket *sock,
> + struct msghdr *msg, int size, int ret)
> +{
> + struct bpf_ksock *ks;
> +
> + ks = ksock_ctx_get();
> + if (!ks)
> + return ret;
> +
> + bpf_ksock_sendto(ks, send_data, sizeof(send_data), NULL, 0);
Is there a BPF-side prototype for bpf_ksock_sendto() at this point in the
series?
ksock_common.h declares bpf_ksock_create(), bpf_ksock_connect(),
bpf_ksock_acquire(), bpf_ksock_release() and bpf_ksock_send() with __ksym,
and this patch only touches progs/ksock_lsm_verifier.c, so nothing declares
bpf_ksock_sendto(). vmlinux.h carries types only, not function prototypes.
With a recent clang this should be a call to an undeclared function, which
is an error. With an older clang the call would be emitted as an undefined
external symbol without __ksym/BTF information, and libbpf would fail to
open or load the object.
Either way ksock_lsm_verifier.bpf.o, and therefore RUN_TESTS(ksock_lsm_verifier)
in prog_tests/ksock.c, would not build or run at this commit, which breaks
bisectability.
The declaration is only added by the later patch "selftests/bpf: Test ksock
sendto()" (65327a57ba55), which adds this to ksock_common.h:
int bpf_ksock_sendto(struct bpf_ksock *ks, const void *data, u32 data__sz,
const union bpf_ksock_addr *addr__nullable,
u32 addr__sz) __ksym;
Could that declaration move into this patch, or this patch be reordered after
that one?
> + bpf_ksock_release(ks);
> +
> + return ret;
> +}
> +
> +
This isn't a bug, but there are two consecutive blank lines here after
socket_sendmsg_ksock_sendto(), while the other programs in this file are
separated by a single blank line (checkpatch --strict reports "Please don't
use multiple blank lines"). Could one of them be dropped?
> +SEC("lsm.s/socket_sendmsg")
> +__description("bpf_ksock acquire and release are allowed from socket_sendmsg LSM hook")
> __success
> int BPF_PROG(socket_sendmsg_ksock_allowed, struct socket *sock,
> struct msghdr *msg, int size, int ret)
[ ... ]
> @@ -103,6 +122,7 @@ int BPF_PROG(socket_connect_ksock_allowed, struct socket *sock,
> return ret;
>
> bpf_ksock_send(ks, send_data, sizeof(send_data));
> + bpf_ksock_sendto(ks, send_data, sizeof(send_data), NULL, 0);
This call to bpf_ksock_sendto() has the same missing-prototype problem
described above.
> bpf_ksock_release(ks);
>
> return ret;
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/39408886865
--===============8834276171442868486==--
Technical Details
Message-ID:
<0f730af064fbd00f1b18405237995d4e78b3672fb4ee14eeaa26784aad4b9228@mail.kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-349223-linux-kernel-netdev=dewy.ruReferences:
<20261020102512.518479-8-mahe.tardy@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-349223-linux-kernel-netdev=dewy.ru From: bot+bpf-ci@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH bpf-next 7/8] selftests/bpf: Test forbidden bpf_ksock_sendto() LSM attach Date: Tue, 20 Oct 2026 10:52:16 +0000 (UTC) Organization: Usenet Network Message-ID: <0f730af064fbd00f1b18405237995d4e78b3672fb4ee14eeaa26784aad4b9228@mail.kernel.org> References: <20261020102512.518479-8-mahe.tardy@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8834276171442868486==" Injection-Info: usenet.network; logging-data="3837128"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:peQgE1uMYfYjeUM2V1h7zIGMnD8= sha256:cvyh224JM/0QktFLeaPozp0onwYkaj/X3Er4etLnwNs= sha1:TyII9nxWYYszW4Tz26sumjspgdc= sha256:roExHlMkkiafReu20MW3DwX+/ZH/IxdGEgx5wIAgc0o= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id F382A110CAE; Tue, 20 Oct 2026 14:00:25 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.829 X-Spam-Status: No, score=-3.829 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.329, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pw-L5kbKv7v2; Tue, 20 Oct 2026 14:00:22 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-349223-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id BB4DB110C7C; Tue, 20 Oct 2026 14:00:14 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id C9064618E44; Tue, 20 Oct 2026 10:53:32 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1792493548; b=0HVxwJrT6vZ3jQlJ1Dsmlt1BosBwLY9iDlkor0/g+yeURb27ZxCqdtrR+d8KX4vapbac JECMrWe2P8Z2oH1VKQ9SRtoDRN+OVOw+vOM4uhMjHcxZYmYWtyyZTlUdhB+T6tSWip5se 5D1xAyNQWeg7FmewI7fSrBTV0RMcMpa3Wt9g2BVSlJKqqyVk8R671AAJnCFExRtmdJHp1 6VP9IomYORBpqSQlpUQ5gudMLIfl/0gGr77HXEAv9wbLfdMWYknI2wXLFdZSw7CTIg8Ef 2HpwNrmPhnqvbM7iOODrYxhrcOQOL7TTpsqrFRMp67XLf14Oo1tn8tLMzqKUAZGz6/g== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792493548; h=X-Original-To:Received:Received:DKIM-Signature:Content-Type: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:Message-Id: In-Reply-To:References:Subject:From:To:Cc:Date; bh=KeMzwCuL1HDw5ZoSQ8kH1JqNJ7FZsCuEkwC13MbO6B4=; b=MBURJr6sZOiN6ad8swp38jgiZgMc/44i0ouXIHPTgo8A3YeF+luN203UrDPv2HnX0T9d /QZBDVBBlfpM3akMM2E5wkgDUDj7rnrooUof+oEw2Ft7rKtJMkUelbLz4kdFBITSxSzQQ I5bM17MldZU2DIAZXSNj6T9wJ0QQtRga3yiTj7dn9ZSH7o3Easq03FbahhfnrDSxBXc9s TPyzc2ZAXcw+MiM6pTkMihXPrmtV3F7nAbwk0ckJTVKZvy7dyceoG4p+MnPeLWlfvetzM YetAwuzuOZD2ScmEilKKKdl62JJu4wjZiGhUy7buZTlrr91kgw5Li2Wx+0Gspcp5/Pg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="oLjiM/83"; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C841260A5BC7; Tue, 20 Oct 2026 10:52:28 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=oLjiM/83 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792493538; b=dOIQvSHUDgItjESnaJcaSN9Uuvd50E9ACbPMG26/EqoeYok6zufLTHbH7TQu/xgfBulk GH5qIG2DpCZwtn1sPEUlqXMWjn8s/yC3zESxjX9Fy129Zs86PLuvOrAuJt6qOXQHJeWZ5 RHa1AE2MkT72ASY9GugFncR/VZCbtj49ml5oWF5Gjozfo1HoqcfPFtVrzdUMUrX2Y1nBo 9VTDHp++mGs5Hx6BB8uGTKSKwVlpjRd6lQeaJ8Vxk5MJHx/5xPWgHxLOcQZ/ammqLqc46 pRlVXzOpCRRQw/ccLNFo+pHrJ91vOQbWffNv0GZmWicabNa2NIRbfK9n0dBTEmkxsgA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792493538; h=Received:DKIM-Signature:Content-Type:MIME-Version:Message-Id: In-Reply-To:References:Subject:From:To:Cc:Date; bh=KeMzwCuL1HDw5ZoSQ8kH1JqNJ7FZsCuEkwC13MbO6B4=; b=5jKtyOLS8++WJss4EUi+wqCajK+JOjRDJ+36bBP+2Bh9CaPP4h997i287Smkop9sawQ2 B12bWhtB3zH1De8dsAr2Xbv4APwSeel4+Ei4gSmdY/wYfAINR21I3CeGlkuGv+I7P9tVX 1vebGXeJFicFZl0zUwr9aWd0KAba9P5uZnVnoJz8e6RZmm4adnf9IakmKJPKNU5wQmhIP ijkvvdC7yiZKWHI08Xsun635qhDVZfb1zLD3wmrJLqqQpoMBk2JybfGvcHPwh79PLiLL3 C7Kr+Ut86heYHWpdZY5X6RoQM0ru4pq5Hu6M+gg0GxEddi5qAk8GSmEjy7vSprJMkqQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="oLjiM/83"; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A5291606A334; Tue, 20 Oct 2026 10:52:17 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0C551F000C4; Tue, 20 Oct 2026 10:52:16 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792493537; bh=KeMzwCuL1HDw5ZoSQ8kH1JqNJ7FZsCuEkwC13MbO6B4=; h=In-Reply-To:References:Subject:From:To:Cc:Date; b=oLjiM/8378oQWHbeHHTvZqBrVku6NYdSv6ACiM0nkE95m9N7pdRzorVAF1nvrwpY/ cuzZvFVfJcWgFQEQi4ssFTeAGCNhkmBAUP28kaRV0MWrWzM/CyKbu+dVqqqSQe85QD uWfOT0/Qm85g1vDwvsULBoy8uu2TUZx4AOboJ+QEJ1APMFNoPAbMEzRV1OGMiHTNjU Ya0Z1OZv32beiesjuBXdZNXe3GNe2PUPoAAu5dLqylH4awPxJC7htt/e5m7mviex7h Ov9YytY+CdrZ0mDC2c5J1U1QSYqxX7zyI7Wy5ebV0qQSOtoct6foZI1TkOCQ58WNcV 65FU7ZcLKo4Tg== X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261020102512.518479-8-mahe.tardy@gmail.com> X-Cc: andrii@kernel.org,ast@kernel.org,daniel@iogearbox.net,davem@davemloft.net,willemb@google.com,eddyz87@gmail.com,edumazet@google.com,john.fastabend@gmail.com,kuba@kernel.org,horms@kernel.org,liamwisehart@meta.com,martin.lau@linux.dev,pabeni@redhat.com,song@kernel.org,netdev@vger.kernel.org,sdf.kernel@gmail.com,yonghong.song@linux.dev,jolsa@kernel.org,kuniyu@google.com,memxor@gmail.com,emil@etsalapatis.com,almagui@kernel.org,mahe.tardy@gmail.com,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mason@kernel.org,ihor.solodrai@linux.dev