From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej2-f1.google.com (mail-ej2-f1.google.com [74.125.228.129]) (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 E72882F8E93 for ; Sun, 23 Aug 2026 19:12:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.129 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787512338; cv=none; b=sqHv+JFFiwJZMG2zUZCOmHD5xnblEdMOBX/NLglMhE4ZP1nTs+RjQOGFrRfHjUR9dibnIi3XS4BafCyp3TGxvhSkUBQUW+UN7x6i/LRV3VrVBbJ7UB2LxEf6uDo3UJSDuNAq27bK3meMZq6B/w4ey02V7WQnlEZYYe/Kx9cdilA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787512338; c=relaxed/simple; bh=bCZO65107Zw67SaivJ+auwgRTrcxaY7YXiKV7VzHv6I=; h=Mime-Version:Content-Type:Date:Message-Id:From:To:Cc:Subject: References:In-Reply-To; b=bCkT/w0RNmh1OLH/OXh3YHDQ8mY6w8gEJXxWr2pK7sushK4yQiCGjkZRTMws5axKmSTUGklugTciyJTl7r5kw0eubURlCw779vZ4Y9YS8J78k8B09kEFJMFMDzb5d10TuRbwoRECqyH+KwzIUfRhRwa0IG4RPmnV7un4OObahdQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=d7WsQq8o; arc=none smtp.client-ip=74.125.228.129 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="d7WsQq8o" Received: by mail-ej2-f1.google.com with SMTP id a640c23a62f3a-c15de09d5c4so178043966b.1 for ; Sun, 23 Aug 2026 12:12:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787512334; x=1788117134; darn=vger.kernel.org; h=in-reply-to:references:subject:cc:to:from:message-id:date :content-type:content-transfer-encoding:mime-version:from:to:cc :subject:date:message-id:reply-to:content-type; bh=bCZO65107Zw67SaivJ+auwgRTrcxaY7YXiKV7VzHv6I=; b=d7WsQq8okdU+iCcPHihGMFp/2AutGXHQO83L5ezqBkq78I2xvTwKeydq+WSy4QT++G z11c8irE0djh/i4UJaL4WR3/FmiRJvQ26z+tNdKv06teuwIodSCzd+TpEd8FHrBIECQ0 de93q7al+TVABQ6xwGrK5vGo6pF68FuXqBdHPtJqSmK+tUc4kDxpfzDetzp4TWVq/C1m HyVwoulewIIkn5uaCaM2Tq5FtP8t5XOOJOoLJ+tvNgTyUo/J3gZ6K2kxOTJ1hs/3zERe suuF9Zz3psdRqDCU0MSykMYsKJiMcO1hlG1z7vVUJsROUkGCppBOyKMu7MyAq0RgMWff ZFFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787512334; x=1788117134; h=in-reply-to:references:subject:cc:to:from:message-id:date :content-type:content-transfer-encoding:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=bCZO65107Zw67SaivJ+auwgRTrcxaY7YXiKV7VzHv6I=; b=Lj8DnX0of6e8QXWCo5Ua8pxuy4DAkIZPR6BcZc8IeAsYtEjB4icGX7jjVclaBaa5M3 3p9TtOeJzzKwchbPH5yRxODODBIPjB/PUYHNDyTteXPzgYXNDh//BEgZBGA3UUHnqq8K mShVMFZxlsbwTigjXJzUD+nDixM99Y5zkarsdkdtjYoanbbSe4IYhKm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21:3c4e:cb8e with SMTP id a640c23a62f3a-c246a654f43mr1785408866b.12.1787512333931; Sun, 23 Aug 2026 12:12:13 -0700 (PDT) Received: from localhost (nat-icclus-192-26-29-3.epfl.ch. [192.26.29.3]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c24962bd8fasm1270648766b.28.2026.08.23.12.12.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 23 Aug 2026 12:12:13 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Sun, 23 Aug 2026 21:12:12 +0200 Message-Id: From: "Kumar Kartikeya Dwivedi" To: =?utf-8?q?J=C3=A9r=C3=A9my_Jean?= , , Cc: , , , , , Subject: Re: [PATCH] netfilter: bpf: disallow conntrack kfuncs for token programs X-Mailer: aerc 0.21.0 References: <20260822210945.1003967-2-Jeremy.Jean@oss.cyber.gouv.fr> In-Reply-To: <20260822210945.1003967-2-Jeremy.Jean@oss.cyber.gouv.fr> On Sat Aug 22, 2026 at 11:09 PM CEST, J=C3=A9r=C3=A9my Jean wrote: > BPF tokens delegate BPF and network-admin capability checks to the token > owning user namespace. Conntrack kfuncs nevertheless accept a network > namespace ID relative to the program context without checking whether the > token has authority over the resolved namespace. > > An XDP program attached to a veth in a child network namespace can use > the peer namespace ID for init_net. bpf_xdp_ct_alloc() then allocates an > entry in init_net, bpf_ct_insert_entry() publishes it, and the lookup and > mutation kfuncs can subsequently access that host state. > > The verifier retains the token in prog->aux, but it cannot determine the > runtime namespace selected through bpf_ct_opts. Conservatively reject the > conntrack kfunc set for token-loaded programs. The kfunc interface is > explicitly unstable, and ordinary token-authorized XDP programs remain > available. > > Fixes: caf8f28e036c ("bpf: Add BPF token support to BPF_PROG_LOAD command= ") > Assisted-by: Codex:gpt-5 > Signed-off-by: J=C3=A9r=C3=A9my Jean So your solution is to just begin rejecting its use? Proper scoping and containerization of programs is a bigger project that needs more thought. It needs to be addressed properly across the API surface, we probably have several other helpers/kfuncs that have similar ns-unaware behavior. If we went on to simply reject each case programs using BPF tokens would basically become useless. pw-bot: cr > [...]