🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #17429

Re: [PATCH] netfilter: nfnetlink_log: fix config error handling, SIT headroom OOB read, and nlmsg rollback

#17429
From: Florian Westphal
Date: Mon, 16 Nov 2026 19:15
40 lines
8470 bytes
Hui Peng <benquike@gmail.com> wrote:
> Fix three issues in net/netfilter/nfnetlink_log.c:
> 
> 1. In __build_packet_message(), subtracting ETH_HLEN from skb_mac_header()
>    for ARPHRD_SIT tunnels can read before skb->head or past
>    skb_tail_pointer(skb), and nla_put_failure returns -1 without calling
>    nlmsg_cancel(inst->skb, nlh). Remove the unsafe ETH_HLEN subtraction,

That made no sense to me.  The entire ARPHRD_SIT check is dead code
nowadays and it will be removed in -next.

But how is it 'unsafe'?  If it moves to before skb->head, no read will
occur.

>    verify hwhdrp + hard_header_len <= skb_tail_pointer(skb), and cancel
>    the partial nlmsg on error.

I don't think its expected to ever fail.  There is a space-remaining
check *before* __build_packet_message() is called.

> 2. In nfulnl_log_packet(), only increment inst->qlen after
>    __build_packet_message() succeeds.

See above.

> 3. In nfulnl_recv_config(), propagate errors from nfulnl_set_mode() and
>    nfulnl_set_nlbufsiz() and destroy the newly created instance if
>    NFULNL_CFG_CMD_BIND was processed in the same message.

Not sure about this.  Could cause existing (working!) userspace
to fail.

> Fixes: 0c36b48b36dc ("netfilter: nfnetlink_log: fix mac address for 6in4 tunnels")

Not really.  Most of these 'fixes' are day-0 bugs.

I suggest we wait for the ARPHRD_SIT removal series to land in nf-next.

Then at least some of the changes here could land as cleanups.
Technical Details
Message-ID: <avtWTqpzelp_PNmv@strlen.de>
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-364673-linux-kernel-netdev=dewy.ru
References: <20260919215241.3471723-1-benquike@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-364673-linux-kernel-netdev=dewy.ru
From: fw@strlen.de (Florian Westphal)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH] netfilter: nfnetlink_log: fix config error handling, SIT
 headroom OOB read, and nlmsg rollback
Date: Mon, 16 Nov 2026 20:15:26 +0100
Organization: Usenet Network
Message-ID: <avtWTqpzelp_PNmv@strlen.de>
References: <20260919215241.3471723-1-benquike@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="2147204"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:llGIrrkNMOSGvIjKkSYuOGh8YjI= sha256:cefLlIH2sh+zdDydmNuyauad7xiSbjkgNVu/BFfvFFw=
	sha1:mHZxtySlNYBU+0zQ+lRAKNgaKpY= sha256:prVauQJZrU4r6eLNzAQV7AIoEkT6hWG8gdenqD2HGVQ=
Content-Disposition: inline
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 4A7A4114D56; Mon, 16 Nov 2026 22:15:58 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.951
X-Spam-Status: No, score=-2.951 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=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-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 JZkWETH5Wzsj;
	Mon, 16 Nov 2026 22:15:54 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-364673-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=strlen.de
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 94BA9114D07; Mon, 16 Nov 2026 22:15:49 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id EEF5F28B8B; Mon, 16 Nov 2026 19:15:44 +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=1794856544;
	b=g9YWudli1JuWZ9JJQFtO4YFANx2bF60fXKy2YG1tLup+qHcqJMw0TDNL/AfiNgQGBzOJ
	 dPA+6wRgqEiOc2vRuz3FJQAqRRQlceLhISl4jWeVXX7MoSyPlQ7uz9/BdL5cY2wPwXH9C
	 ZV9YguxJbRpBqMoCVx8GGidB9pRHb+lXfn2Z8Ud9nPqXEDnhDnZA2rhBKl7DeYUPurYuW
	 nzwB06TkYIIjc3TmE7AzsixeU2e+hG3rHZwe6D4vtne0z9k/EFPPUC+AhoQEn/3fLy6Yh
	 lYQD9HHkVbI/eBVaB4CNebXD04LVWVMNYJvE9hgAW5K8vfdGwpEcjBSVU61EaBfT3dA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794856544;
	h=X-Original-To:Received:DMARC-Filter:Received:Date:From:To:Cc:Subject:
	 Message-ID:References:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Type:Content-Disposition:In-Reply-To;
	bh=dhAoJNe3fPzmWOk2VpDnB6M/c9lvh0UdAslgSx4rl4o=;
	b=DPJhyo+/nXQaoUbGfcxy+14T7wkB0oOfuYDwSjowGwNocJBotTdwQZkrxWWQJnkL0mbY
	 +oGfIfsfQ56eWg1OcD7une5l9JyB2qqcHExDHdDMv1DymyUqceOJJWlqGs5p+Z3C5v2P6
	 V4vLjmVQV23bNio7kOIWLsWf+WnIKr56Pmlse/P00O24SAqnJddjnd1bIYhlsYC3KU8Q3
	 5EhCqS5OA3kGCyRFXfmZIoGc/U9G/EQzP5hJxD+nDvJ4nDej4kLieLqkVPYOcY6BZQwnM
	 eEBZIpfT3I/LfgDXaIz7JiIPcVW7+e27701EtnJa19ggt1bsFmf8rKwhroMBwszwLaw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dmarc=none header.from=strlen.de;
	spf=pass smtp.mailfrom=strlen.de;
	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 8E56C606A32A;
	Mon, 16 Nov 2026 19:15:44 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.216.245.30
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794856538;
	b=iBiUbzpZ5UE9cDbQus+zePwlp43Alj9BFDCaEUqQ158omlNRvk0HIPADG1NO+e+qemY+
	 5KF3CMDWjs4KDPBNflneIroo1yW2HWkasv/vfUiQZeEFEqkLZYAE7WQaeesLYHsBTyId7
	 iCKmDOkWnwOqgixrlt/JyMPRMrRT/ZxZAzsTQeGIn69asp6F8igLhz8gWCigNrP2bD4Rf
	 eRPHOlA9gWywKoIAJxyI8pI/OZWj2pxAl7Nsw9LQ6Sp+SJNX+bVHkfMRaeDgNlowB0TyF
	 CoUIkJCq2lH3kszpDKMnC8YjZ+obIx4PySgDckcMdQWKsA/fcnAIKU1RsGzHUrh3j8g==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794856538;
	h=DMARC-Filter:Received:Date:From:To:Cc:Subject:Message-ID:References:
	 MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=dhAoJNe3fPzmWOk2VpDnB6M/c9lvh0UdAslgSx4rl4o=;
	b=mzn/4un8BtNYaR7A7fTlIDgo/FJImRxuQrZtoWBDsWuz7PHIh/GuQ7j778gHkpM3ZvKJ
	 cmPuiMM6gjRSId2iJWVhAfp4XvNBqp8+1N/Vljn35Cbm4lahYZ2yOw3Rhv72a7R2/5bCe
	 tfoVV3W7WggCdd/2DM9BgKMWihO/pSMEZiwsE6m+xKyQV42XAbcsrvJOBudE5Dx5pr6wV
	 I9HZjIetP05r+xbV0E9AZgl8olf1rwYJOagYqmmFLQOBGF0PSDFwXa8G7mtfXmtLCpUbE
	 QmY+eRVA1G6NRBmGSdqOQjQw0Av+M3rnArCBDkLeh9D3TjhdeszkaBgN6xoXikFaadg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=strlen.de;
	spf=pass smtp.mailfrom=strlen.de;
	arc=none smtp.remote-ip=91.216.245.30
X-Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [91.216.245.30])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 006B5606A31C;
	Mon, 16 Nov 2026 19:15:37 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 006B5606A31C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=strlen.de
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=strlen.de
X-Received: by Chamillionaire.breakpoint.cc (Postfix, from userid 1003)
	id 1769360D56; Mon, 16 Nov 2026 20:15:30 +0100 (CET)
X-Cc: pablo@netfilter.org, phil@nwl.cc, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
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: <20260919215241.3471723-1-benquike@gmail.com>