🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #13504

Re: [PATCH] selinux: don't label bridged packets in selinux_ip_forward()

#13504
From: Paul Moore
Date: Mon, 09 Nov 2026 23:56
49 lines
13602 bytes
On Oct 16, 2026 Joas Antonio dos Santos <joasantonio108@gmail.com> wrote:
> 
> With br_netfilter and bridge-nf-call-ip{,6}tables enabled, bridged IP
> packets go through the NF_INET_FORWARD hook, where selinux_ip_forward()
> calls selinux_netlbl_skbuff_setsid() and NetLabel may add or remove a
> CIPSO or CALIPSO option.  cipso_v4_skbuff_setattr(),
> calipso_skbuff_setattr() and calipso_skbuff_delattr() move the IP
> header and reset the network header, but the Ethernet header stays
> where it was; when the bridge pushes it back in front of the packet it
> picks up stale bytes and the frame goes out with a garbage destination
> MAC and EtherType.
> 
> Labeling a bridged packet based on its IP addresses is not what we want
> here anyway, so leave bridged packets alone.  Add a stub of
> nf_bridge_info_exists() for CONFIG_BRIDGE_NETFILTER=n.
> 
> Tested with QEMU, two veths enslaved to a bridge with br_netfilter in
> the middle, SELinux and a NetLabel DOI 16 configuration, 5 UDP packets
> per case:
> 
>   case                                        before        after
>   CALIPSO packet, unlabeled destination       MAC garbage   5/5
>   unlabeled IPv6, CALIPSO destination         MAC garbage   5/5
>   unlabeled IPv4, CIPSO destination           MAC garbage   5/5
> 
> Routed packets are still labeled (an unlabeled packet forwarded towards
> a CALIPSO destination gets the option, 5/5).
> 
> Fixes: 948bf85c1bc9 ("netlabel: Add functionality to set the security attributes of a packet")
> Link: https://lore.kernel.org/netdev/CAHC9VhS+bdL_YnLQtd0sPmKKfy9BvS-LWV_6EhAuu4qfUFe_mw@mail.gmail.com/
> Suggested-by: Paul Moore <paul@paul-moore.com>
> Signed-off-by: Joas Antonio dos Santos <joasantonio108@gmail.com>
> Assisted-by: Claude:claude-opus-5-5
> Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
> ---
>  include/linux/netfilter_bridge.h |  5 +++++
>  security/selinux/hooks.c         | 13 ++++++++-----
>  2 files changed, 13 insertions(+), 5 deletions(-)

This looks good to me, thanks for all the work you put into this!  It's
been several weeks with no objections from the netdev folks about the
nf_bridge_info_exists() dummy function so I'm going to assume they are
okay with that; if that's not the case, please speak up soon :)

Merged into selinux/dev.

--
paul-moore.com
Technical Details
Message-ID: <a8542108f56e8cac5c6e65977ee01ffd@paul-moore.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-359695-linux-kernel-netdev=dewy.ru
References: <179216146138.25460.7866279004288174372@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-359695-linux-kernel-netdev=dewy.ru
From: paul@paul-moore.com (Paul Moore)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH] selinux: don't label bridged packets in  selinux_ip_forward()
Date: Mon, 09 Nov 2026 18:56:04 -0500
Organization: Usenet Network
Message-ID: <a8542108f56e8cac5c6e65977ee01ffd@paul-moore.com>
References: <179216146138.25460.7866279004288174372@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="478394"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:9Q6zuNY82KtGAcNHritUmar9tyM= sha256:UNWOj2K8YnKqg7Y2XFKYkIOqiLBvUi67vL4WccV+aSE=
	sha1:5Q7eVlOr1cg1IWzO2lnkAOf4cJ4= sha256:00LW3TrrY/EKfsgCib7xXjZ7bMEz0ZO4JIFPeZCEOF0=
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 3DC21113992; Tue, 10 Nov 2026 02:56:41 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	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=paul-moore.com
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 P6NeRNKkAoRm;
	Tue, 10 Nov 2026 02:56:33 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-359695-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=paul-moore.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 30A30113975; Tue, 10 Nov 2026 02:56:23 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id DC1BC2642B; Mon,  9 Nov 2026 23:56:08 +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=1794268568;
	b=KOn9EbsCeDgJXfQ659AscKGRk6HeJ1zp2+MFzwMX4wmcfgQPTDwcb8rEa8O7tZuMKZVx
	 cVka7PEvtOi2RkQXit7ZgR+u/VlaV0VPfr4QtfjuAundXv6RfSJTsjO17z1+t/YMwSvtI
	 tIAQPxOA1OQaynUV0/Vc0kYiqjiis/JPx51WRc6m2NeI3JTaPQsZOVFyB9Vh98EHq9zfd
	 cO2KcVftey3A8TT2faVGtWs8zKzKmgWla+AqDN7gOd4TdIP2ojCJjaxtuGxzl5379BKwk
	 h/1KpVrmY8jCKMnoAaOMO4sTHOY56W3NdE8A/IKlBX+cV6gX+ifaKSHwGWeaWhreEDQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794268568;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
	 X-Gm-Gg:X-Received:Received:Date:Message-ID:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Type:Content-Transfer-Encoding:
	 X-Mailer:From:To:Cc:Subject:References:In-Reply-To;
	bh=nlqOFSAQ9H7dnLsW36/WDhDu5EY2v33GDHCwxLLecp0=;
	b=Y/qnlGpg3/NJJigqD9o0cdcG2z9kyzWNVxQ2hUV/F0n8g3z+8Evf3nV7Mo5gg9TcWx6B
	 dqkg1X2Y8LjvS4Rs07Ms5HX644lDZvuz7+Sm22PTuMqAUnIpkhiQNrFX7QjAOwchb3YsI
	 YT+90jlqPHopeL6bo8y18cLJg4nOfkEeTEfudr+E2uIbHIHYdVR2SBo7YTYf3yW2PYiK1
	 J8wYyWvjGnNh2Gbojd6iNwloOZvRbaQPvYtvUvi9Cf1XLZLZfJGKNoLxU/6n82eLkBaHw
	 nL/JNaFF0m6ExSR4ZkXEOgVi333FgzL23UWSPMTUDD4IaY5V8Td8SbqkTmDo5myVM4Q==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=paul-moore.com header.i=@paul-moore.com header.a=rsa-sha256 header.s=google header.b="X71+CO/U";
	dmarc=pass header.from=paul-moore.com;
	spf=pass smtp.mailfrom=paul-moore.com;
	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 10486606A33F;
	Mon,  9 Nov 2026 23:56:08 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=paul-moore.com header.i=@paul-moore.com header.a=rsa-sha256 header.s=google header.b=X71+CO/U
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.219.50
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794268567;
	b=MgsUx9SEtjrc0UN6ifsDEUsBEVzF5vISxrfd9bO2ROINexaVDCUnkFQ32HFPKuI4j2uS
	 1uZ07tJ2VTT0HZ9xSXXrM+p2iGSc/EuI2NVbq4jO3iEKn/a7clj0UqTaTdoRiStY84IeG
	 OLBV4EFynsC0eD6IUx/AY0Kdcs4vE0kxwAnwakqubQfa/sCoJZiSZgJugSd471RER961s
	 BCbvExixoBYuOmhK5I3MvgJL2zZe5sNYUF3Ux2cQk0mN3K1fCyPXUn0ShQgQ2vv1zuJJ4
	 JYI6tm4NNJpdqgszxEQkDbqSsKIlcOITjnDkKQr3LtNHXb3q8NmUDOT3j/vnCNwpbZQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794268567;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
	 Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:
	 X-Mailer:From:To:Cc:Subject:References:In-Reply-To;
	bh=nlqOFSAQ9H7dnLsW36/WDhDu5EY2v33GDHCwxLLecp0=;
	b=b6fyQpw7zYGCGXDP7CStmzVnoYvq9DVYGsums8QFb61p1P1qp32QcfoWx8C8kZOA3W0J
	 Wagb701vabmEeGmcxA+U7B93i/1nVe4zYYtSgdG+TCk/ApjQ9vGRAxbTe1lRiwfV5N/07
	 qsV0kCqxUbWpm47Yu4oBrpY2JBBmRR7NWQ6tiTNURU4yR9BgQeU9bO5sGmzvWDHbxCTWs
	 pyjFV7jOBdGI0YIksw35sy5/ApwCSngadCQcrNyl4JnStUL40foEleAWsiftqi17cHROu
	 YlXPfiunE2Vv+YWzbf51nLsytlyhGNhHHdlO+0Ayc+KjrhOhfBLgvSbYle+fWNl5Wrw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=paul-moore.com;
	spf=pass smtp.mailfrom=paul-moore.com;
	dkim=pass header.d=paul-moore.com header.i=@paul-moore.com header.a=rsa-sha256 header.s=google header.b="X71+CO/U";
	arc=none smtp.remote-ip=209.85.219.50
X-Received: from mail-qv1-f50.google.com (mail-qv1-f50.google.com [209.85.219.50])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id B95FE606A31C
	for <netdev@vger.kernel.org>; Mon,  9 Nov 2026 23:56:06 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B95FE606A31C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=paul-moore.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=paul-moore.com
X-Received: by mail-qv1-f50.google.com with SMTP id 6a1803df08f44-91eed03da8bso8745636d6.2
        for <netdev@vger.kernel.org>; Mon, 09 Nov 2026 15:56:06 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=paul-moore.com; s=google; t=1794268566; x=1794873366; darn=vger.kernel.org;
        h=in-reply-to:references:subject:cc:to:from:content-transfer-encoding
         :content-type:mime-version:message-id:date:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=nlqOFSAQ9H7dnLsW36/WDhDu5EY2v33GDHCwxLLecp0=;
        b=X71+CO/UAe8HAQkMdGHqP0bP6m6tjZ6XRSvDGuH1my8Ndb0JVf4fQ2URnECDJrvpfA
         reKuJ2eBA/ZA2j7txXFsYAdmaRpa6qkNvDNPxaLog7FCBEDlTaKbSnQ9UVGdO5JOfnyc
         /dHaEM73uSGSetbd1gS5r7XZ2u/f9Le+jynSfHCCXbp2cqabapOEpkqV/c3bbvevlgAo
         ePjYjVDuPAEaWKuxgVhrlYAptLVu2F5XEXgUw3CmOoJzKQ8oEtB92JEcN+VDfO85PwZc
         uJYKEDM8M5o2cGcIGKTD5o/lbtSWk+JWgklHsllKWcTPCfiBY5B3FGCYZqQojx0u1b/s
         hF4g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1794268566; x=1794873366;
        h=in-reply-to:references:subject:cc:to:from:content-transfer-encoding
         :content-type:mime-version:message-id:date:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=nlqOFSAQ9H7dnLsW36/WDhDu5EY2v33GDHCwxLLecp0=;
        b=10ajsNd8vu4YYKRvxysmABrtQbnn37z9xdJRmvjwJ/IhuvM7U2PTYq9TDlWGGfwMHb
         16gU84NMrDxv9A6PsasOJRSZQzlz+0L1NBg/ra6Xpfq7vz3H9XJCjqkwUmMRI7R1/W8f
         35ymSSGQZr2C05QTb05qJxfZsxUXK4uObvu3T1DXcsauHgRpnE0iMFMI29Ar1JDcgOJs
         mr09RzZ/e5EvUyZGxf9oXFo1USdL1EsYIS+1jgm29tgXSHNGl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OQ=
X-Received: by 2002:a05:6214:54c8:b0:91b:5d39:e13c with SMTP id 6a1803df08f44-91eef8650e9mr21004816d6.49.1794268565495;
        Mon, 09 Nov 2026 15:56:05 -0800 (PST)
X-Received: from localhost (pool-71-126-255-178.bstnma.fios.verizon.net. [71.126.255.178])
        by smtp.gmail.com with ESMTPSA id 6a1803df08f44-91ef04ae351sm7869386d6.12.2026.11.09.15.56.04
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Mon, 09 Nov 2026 15:56:04 -0800 (PST)
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-Mailer: pstg-pwork:20261109_1829/pstg-lib:20261109_1442/pstg-pwork:20261109_1829
X-Cc: Ondrej Mosnacek <omosnacek@gmail.com>, Paolo Abeni <pabeni@redhat.com>, Pablo Neira Ayuso <pablo@netfilter.org>, Florian Westphal <fw@strlen.de>, Phil Sutter <phil@nwl.cc>, selinux@vger.kernel.org, linux-security-module@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org
X-In-Reply-To: <179216146138.25460.7866279004288174372@gmail.com>