🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #19648

Re: [PATCH ipsec] xfrm: account XFRMA_MARK in xfrm_sa_len()

#19648
From: Steffen Klassert
Date: Fri, 20 Nov 2026 06:44
29 lines
10642 bytes
On Tue, Nov 10, 2026 at 08:46:23PM +0900, Yasuaki Torimaru wrote:
> xfrm_notify_sa() sizes its netlink message with xfrm_sa_len(), while
> copy_to_user_state_extra() appends XFRMA_MARK whenever the state carries
> a mark.  xfrm_sa_len() does not count that attribute.  Only the
> XFRM_MSG_DELSA path adds it to the length separately, so for a marked
> state the XFRM_MSG_NEWSA and XFRM_MSG_UPDSA messages are sized short by
> nla_total_size(sizeof(struct xfrm_mark)), 12 bytes.  The other length
> calculations in this file already account for the mark; xfrm_sa_len() is
> the only one that does not.
> 
> Instrumenting xfrm_notify_sa() on an x86-64 KASAN build under qemu to
> print the accounted length while adding a marked state confirms the gap:
> accounting the mark raises the computed length by exactly 12 bytes
> (348 -> 360), matching nla_total_size(sizeof(struct xfrm_mark)).
> 
> Whether the shortfall is reached depends on the skb allocation, which is
> rounded up: xfrm_notify_sa() fails with -EMSGSIZE only when that slack is
> exhausted.  km_state_notify() discards the return value, so such a
> failure would be silent.  This was not reproduced.
> 
> Count the mark in xfrm_sa_len() for every event and drop the now
> redundant addition in the DELSA path.  The message content is unchanged;
> only the computed length changes.
> 
> Fixes: 6f26b61e177e ("xfrm: Allow user space config of SAD mark")
> Signed-off-by: Yasuaki Torimaru <yasuakitorimaru@gmail.com>

Applied, thanks a lot!
Technical Details
Message-ID: <av_sNleLx4XJ_bLf@gauss4>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367713-linux-kernel-netdev=dewy.ru
References: <20261110114623.2659197-1-yasuakitorimaru@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367713-linux-kernel-netdev=dewy.ru
From: steffen.klassert@secunet.com (Steffen Klassert)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH ipsec] xfrm: account XFRMA_MARK in xfrm_sa_len()
Date: Fri, 20 Nov 2026 07:44:06 +0100
Organization: Usenet Network
Message-ID: <av_sNleLx4XJ_bLf@gauss4>
References: <20261110114623.2659197-1-yasuakitorimaru@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Injection-Info: usenet.network;
	logging-data="3085136"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:TeVaZBcxqdUumhxcb6yKzTqUMQc= sha256:AElQiJ7JzLDRnHvVVeQ1eHN8J+ZjmAilTzJ2RQLkKkU=
	sha1:49VZlBY+a/qUX3XpoBP3ALEv2ww= sha256:FiBl02/OtLNiB+mVUVBMp/j3ltiQjSZoWLhMoNBbBzo=
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 315411158D0; Fri, 20 Nov 2026 09:44:26 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.151
X-Spam-Status: No, score=-3.151 tagged_above=-9999 required=6.31
	tests=[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=secunet.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 z4WaETvphyDF;
	Fri, 20 Nov 2026 09:44:23 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-367713-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=secunet.com
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 3F9BE1158A8; Fri, 20 Nov 2026 09:44:15 +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 9BF1B688BF2; Fri, 20 Nov 2026 06:44:14 +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=1795157051;
	b=AZHKM9i6sWoBCQ4TGN0TDKE5QAHzZ6iM6Kohsa5XbDLImJoAxbpB6AhurwHmTmNU63U1
	 EhuaAxZ1w/aVCxkLe6z8c6G8wBGsbxCAA5WcAc0X6UOfoaTNEQdwrZsN5C6FlvRi8LjhR
	 /DXOVJw0BmX1R37ApJwNs2C5qQGMy0f5R9ZqnhgWc/Ecq/r/83eGG+tJfddb/T+EZSkSv
	 iw4IPozTpd2cCv9zheMq2I191vu/o2t76t37ckpqLGCNm1878bb+xeLMwyVfP/ZqKVaoJ
	 QYc0g6GQDNTAgKwT5C61PZSLfmqlT6iLrrQT7RV1AJS8PDgIc/0RPc4g2KKy7DaVFTA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795157051;
	h=X-Original-To:Received:DMARC-Filter:Received:X-Virus-Scanned:
	 Received:Received:DKIM-Filter:DKIM-Signature:Received: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:
	 X-ClientProxiedBy;
	bh=G53tqhQIxeiofQNabLLaQPq51Je0rYooi94QwrJ7XUI=;
	b=NP1iE2r03BQKMYQi19eLKy4iCvO6X+t20SzgQhJznPs8flOYJGfptzMPKsC0U5ONiHsF
	 9/9orIWfruCQY/RcN9qRJThMjiJJzoTlRKlRsl3E3X45EfimdJ56+p8ogIJukTKe4E4ht
	 LoTp/q5z1w6eNHgbmqqPrOEBsRT1+GK+plr6lQibyUid5Icsgy+i8CXDKmpLSPB8Y5cCX
	 ztE3EGuh6E0tNSqbQjUawLkDyHl3R4Y/mAfVxCE1/uuV0Pz5Fv9ScNAeaIVTK+Mg2jJ4D
	 iL+16Zki1jrcTTEnN73ofYg7F/8YmIBAEoLsQDNdtIOi+vHU/bNaoerppOy+rd2MJTA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=secunet.com header.i=@secunet.com header.a=rsa-sha256 header.s=202301 header.b=YwomIApa;
	dmarc=pass header.from=secunet.com;
	spf=pass smtp.mailfrom=secunet.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 B698E606A333;
	Fri, 20 Nov 2026 06:44:11 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=secunet.com header.i=@secunet.com header.a=rsa-sha256 header.s=202301 header.b=YwomIApa
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=62.96.220.36
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795157050;
	b=cMcXOiB/zP1YSFGM+lUYg41WAaXFesXQKJ/M0FjBRTZb6QMus9yRBtCuSuWNiZF2G4uv
	 Xt/a0l3IesnP5XgGTD6evCzQnhhzw+Iyz9k60JQnR+TJ6L6cdNhrK/ZT7jczPu8KmOtf2
	 HrGQ961oVnF+pz9Yd+bbL0eo8OL3YCDaNB1DyVrW1vlHiW6wAoyH2jzLchMMrfReoZHnj
	 942RKaizNsIk0uNKEQ+u0/yyht4Mn2FQXaeUN9We7lAkQQNEWso3Ls5Pb1B4DPunBwgfk
	 h/nGmPXwQRgiWFbfe9aMNbyZ0xRDGjH3GhVGGMbYkbK69hPT+3x1OOXjTCPJWjBJvYA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795157050;
	h=DMARC-Filter:Received:X-Virus-Scanned:Received:Received:DKIM-Filter:
	 DKIM-Signature:Received:Received:Date:From:To:CC:Subject:Message-ID:
	 References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:
	 X-ClientProxiedBy;
	bh=G53tqhQIxeiofQNabLLaQPq51Je0rYooi94QwrJ7XUI=;
	b=HGzKHhF+KZAupzdh9Mh4gvTnYb2+ADFlCEVen1jgs8exeyqEk1plGwwsepHD88eQpHg4
	 CYyggL1xDdUaexv9LDWmel3K56/svIz+q+URKLy8Hh91WOP0KkDb1U2vrGciLEZEhgixK
	 41JPGq8VeSn8x0ZCs4v3RNfREl71uuWR3UP2+7tM4OWbU5pNC+Foj1K7PsRMwvUGPZpjL
	 DcRQ3NInUT4a0M/jOUCUby74/TJqkmuw4pdvu7g+eswndJcBZe69aI5aJygNMhAgZVxmy
	 RmWVIg4zJqRmtdjSRxwidA54ZVhOSyn2NTRWky4whmt/qmVgcOfK6s0yKsUZ6o/frIw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=secunet.com;
	spf=pass smtp.mailfrom=secunet.com;
	dkim=pass header.d=secunet.com header.i=@secunet.com header.a=rsa-sha256 header.s=202301 header.b=YwomIApa;
	arc=none smtp.remote-ip=62.96.220.36
X-Received: from mx1.secunet.com (mx1.secunet.com [62.96.220.36])
	(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D407606A325;
	Fri, 20 Nov 2026 06:44:10 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4D407606A325
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=secunet.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=secunet.com
X-Received: from localhost (localhost [127.0.0.1])
	by mx1.secunet.com (Postfix) with ESMTP id 95F04207AC;
	Fri, 20 Nov 2026 07:44:08 +0100 (CET)
X-Virus-Scanned: by secunet
X-Received: from mx1.secunet.com ([127.0.0.1])
 by localhost (mx1.secunet.com [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id a_03Sc66ltkQ; Fri, 20 Nov 2026 07:44:08 +0100 (CET)
X-Received: from EXCH-01.secunet.de (rl1.secunet.de [10.32.0.231])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by mx1.secunet.com (Postfix) with ESMTPS id 14A092069C;
	Fri, 20 Nov 2026 07:44:08 +0100 (CET)
X-DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.secunet.com 14A092069C
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secunet.com;
	s=202301; t=1795157048;
	bh=G53tqhQIxeiofQNabLLaQPq51Je0rYooi94QwrJ7XUI=;
	h=Date:From:To:CC:Subject:References:In-Reply-To:From;
	b=YwomIApawY8xKxvlKsb+sS4CbYDMXjqqDIqrrj2G2HC3aVVhs8tUg2eBJSkTCEnCf
	 sLtStd51078rZ4hEbKf9ksQGNC5UBDb6f8TFzEFe9b4AN8NY30GncbIqs5xzyOXjo3
	 O6A8eT920nxnPwfGuR/+dvwcjF0ulnuqiQ7PVxEv5OjbSypBm74UJKWW62gz5BRaCh
	 XRJSqXJqSs143Evq1yaAFjG//Nnsxkh53vCf75b3yhGHz9kt01aKjXMpUAwohU7fCD
	 liRmpp6+uuc1riQvPiiRiQih67Au4l+DU5uLdflUDXuTBTdnQ3ng+dCKk++CaeWGwp
	 FSSPbzONQ0j8g==
X-Received: from gauss4 (10.182.7.102) by EXCH-01.secunet.de (10.32.0.171) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.49; Fri, 20 Nov
 2026 07:44:06 +0100
X-Received: (nullmailer pid 1662546 invoked by uid 1000);
	Fri, 20 Nov 2026 06:44:06 -0000
X-CC: <herbert@gondor.apana.org.au>, <davem@davemloft.net>,
	<edumazet@kernel.org>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<horms@kernel.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: <20261110114623.2659197-1-yasuakitorimaru@gmail.com>
X-ClientProxiedBy: EXCH-01.secunet.de (10.32.0.171) To EXCH-01.secunet.de
 (10.32.0.171)