🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #9515

[PATCH 03/14] xfrm: zero-initialise km_event in the replay-notify path

#9515
From: Steffen Klassert
Date: Mon, 02 Nov 2026 10:04
63 lines
11765 bytes
From: Shubham Antil <shubham@octane.security>

xfrm_replay_notify(), xfrm_replay_notify_bmp() and
xfrm_replay_notify_esn() declare a struct km_event on the stack and
initialise only its .event and .data.aevent fields, leaving .seq and
.portid uninitialised. build_aevent() then builds the XFRM_MSG_NEWAE
message with those fields:

  nlmsg_put(skb, c->portid, c->seq, ...)

so the netlink header of a replay event carries uninitialised stack
values rather than defined ones. This was confirmed at runtime rather
than by inspection alone: the .seq and .portid carried in that header
hold values that nothing in the replay path assigns.

The request-driven paths set these header fields from the requester
(xfrm_get_ae() / xfrm_new_ae()); only the kernel-originated replay path
leaves them unset. Zero-initialise the event so the header fields are 0,
the correct value for a kernel-originated notification.

Fixes: f8cd54884e67 ("[IPSEC]: Sync series - core changes")
Reported-by: Giovanni Vignone <gio@octane.security>
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Shubham Antil <shubham@octane.security>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
 net/xfrm/xfrm_replay.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/xfrm/xfrm_replay.c b/net/xfrm/xfrm_replay.c
index dbdf8a39dffe..9394953247ab 100644
--- a/net/xfrm/xfrm_replay.c
+++ b/net/xfrm/xfrm_replay.c
@@ -40,7 +40,7 @@ static void xfrm_replay_notify_esn(struct xfrm_state *x, int event);
 
 void xfrm_replay_notify(struct xfrm_state *x, int event)
 {
-	struct km_event c;
+	struct km_event c = {};
 	/* we send notify messages in case
 	 *  1. we updated on of the sequence numbers, and the seqno difference
 	 *     is at least x->replay_maxdiff, in this case we also update the
@@ -304,7 +304,7 @@ static void xfrm_replay_advance_bmp(struct xfrm_state *x, __be32 net_seq)
 
 static void xfrm_replay_notify_bmp(struct xfrm_state *x, int event)
 {
-	struct km_event c;
+	struct km_event c = {};
 	struct xfrm_replay_state_esn *replay_esn = x->replay_esn;
 	struct xfrm_replay_state_esn *preplay_esn = x->preplay_esn;
 
@@ -356,7 +356,7 @@ static void xfrm_replay_notify_bmp(struct xfrm_state *x, int event)
 static void xfrm_replay_notify_esn(struct xfrm_state *x, int event)
 {
 	u32 seq_diff, oseq_diff;
-	struct km_event c;
+	struct km_event c = {};
 	struct xfrm_replay_state_esn *replay_esn = x->replay_esn;
 	struct xfrm_replay_state_esn *preplay_esn = x->preplay_esn;
 
-- 
2.53.0
Technical Details
Message-ID: <20261102100451.2505200-4-steffen.klassert@secunet.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-354522-linux-kernel-netdev=dewy.ru
References: <20261102100451.2505200-1-steffen.klassert@secunet.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-354522-linux-kernel-netdev=dewy.ru
From: steffen.klassert@secunet.com (Steffen Klassert)
Newsgroups: linux.kernel.netdev
Subject: [PATCH 03/14] xfrm: zero-initialise km_event in the replay-notify path
Date: Mon, 2 Nov 2026 10:04:01 +0000
Organization: Usenet Network
Message-ID: <20261102100451.2505200-4-steffen.klassert@secunet.com>
References: <20261102100451.2505200-1-steffen.klassert@secunet.com>
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2877406"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:WYO43N7w9rfC7ZbSEXwsBQOuBGQ= sha256:UV3dhBW0DV30pPVMmvPORcdX3kAAJYQy2vYGsTvwJEo=
	sha1:5VhFL218XGGw9Zl3GclFWaVG9RE= sha256:TPosswcWzKdGlWJLKmGto+gu8TznYu9M8Q+wxhYQC5Q=
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 5353D112451; Mon,  2 Nov 2026 11:06:07 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.149
X-Spam-Status: No, score=-3.149 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.25, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
	URIBL_BLOCKED=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 mQLxeZtSmqTd;
	Mon,  2 Nov 2026 11:06:04 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-354522-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 D18D9112423; Mon,  2 Nov 2026 11:05:56 +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 8B7926062A6; Mon,  2 Nov 2026 08:05:13 +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=1793606704;
	b=NWKGgXTTw8r2HRW0bz/ZffdcSoAr5SrO05FBOtQ99wOS/u2hn+xIEMhn+n9g+4yuZowY
	 iNV9Ts1zAWk1ztt78ixtAR2zAFbGihNalKE43y+NRJncHJLY0fBA8hoa8kMo6qleCjfBv
	 UL8NTnBB1jrz90K0QbRoVLaSXaCarO5D6FlfB1uL/2/ec18CZovXLX9O2TCwhvLLS7MFf
	 2rvvb+Y7T7vTCJPLTTBzed9LE/TxonQ4C2Bc6jbutiqvGnKl5WbBMKi6lbFts3SRHWhkd
	 clEtA6LuzqhUSB+OAEc1vL/ssHQTOBLTV0ddRbH1eWzdnz7GojoPqfdC0Ling3TOnJg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793606704;
	h=X-Original-To:Received:DMARC-Filter:Received:X-Virus-Scanned:
	 Received:Received:DKIM-Filter:DKIM-Signature:Received:Received:From:
	 To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding:Content-Type:X-ClientProxiedBy;
	bh=RN0KtHePRWJJDIJqcoSp9L1s2pTtBDmwuk/8VGE9Y7A=;
	b=JgJqvWmK0SP99RpEECxO+oBUEdCkL+f3V8gXhgv/EN4oNntib4OUF2VZCtg/ZkuUfem9
	 tH2XpRsqDLDrQrEdRxV6X9S/+k1OziMwBQC8EwPLjL5xybIEUrjXcx8pt+la4Tqu1xT8v
	 DaNqwwovjTRPr/AwDjLsAB1Ce82Jx1qWuHRd5spT6I7eolebdbugr9OQGl0P/J2VQgiSP
	 G/gha7qBVBuoIvpoIZ2rM//B6i6uDU3qrV4+CnHgJE0/Hery70cszqWL7t6EdSfdFmpYz
	 /70oxgds1YJcaaVoCKGnx363rgUeG6g8MAfbz2hQbgxIit4iXBUkBml10DfEpyUUKtg==
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=PiVMWyyB;
	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 3CF9E606A335;
	Mon,  2 Nov 2026 08:05:01 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=secunet.com header.i=@secunet.com header.a=rsa-sha256 header.s=202301 header.b=PiVMWyyB
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=1793606695;
	b=UIRdXgSPvdvFaeAg/TR7djnNfKshResM2P9Z6HRAfnR0P3jji8uzPbI+xQ9SaXZpYdAT
	 3bjtSgbebmetPWzm7y5l4sQCihzp/I/UROfFGuCQyXyKOQ/5Rn/1y9eeClOR1CX3Fmgtv
	 RfAXBLgcT5ouL2921S1wGaeDn7eTaZEGtFovX9VSSNsn0mMdSHJ5+eZRHfxDGDaS9Pb2h
	 0sa2H3Pu5SM/hSHKEse57YceLNajyNc4mwu7D9M0+OXIHZjPsiDtQP87qEZPG/kjLLjWX
	 ++z1pOY3d8gg/KUmZyU6y++L4Rzhy4IwCoPpFGeGpQpEz64SQu9KWpyizuLseqiG9Ww==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793606695;
	h=DMARC-Filter:Received:X-Virus-Scanned:Received:Received:DKIM-Filter:
	 DKIM-Signature:Received:Received:From:To:CC:Subject:Date:Message-ID:
	 X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding:Content-Type:X-ClientProxiedBy;
	bh=RN0KtHePRWJJDIJqcoSp9L1s2pTtBDmwuk/8VGE9Y7A=;
	b=gl4qPR0ejsSp+Piois5rHmUgBNSYJPHIoZVpDBgK19wIVgyCainbKptRtZ7Bh/lTpOeb
	 em1e8uz4CBgNjAL0Pf6fEk0aARCyFDuTVKh1UGX0ENf8FpTpXSSHdf+rexRST9pJ5Fr4A
	 SK8wDkC9vkAGAwwPdt9RBJjfygTEaf1/pt5K74Uvcmk7uLCKo1blWRL/aQHCInUWNSBgR
	 XZvMTnktP9fi9ijLlGIHKd9yo/w4u8LJQO62REPLpDF8q5g0UPK1GoWZOhE2WZAEYXsK4
	 oGyA4zAQilBjbgHsMC2TghYNnmQowDd4wPqjkIBkfYFmO7xvPPP0KfWuW4LUQCqUXGg==
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=PiVMWyyB;
	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 8CD1460A380F
	for <netdev@vger.kernel.org>; Mon,  2 Nov 2026 08:04:54 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8CD1460A380F
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 266F7207C6;
	Mon,  2 Nov 2026 09:04:53 +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 NFDoqxW9Bk8D; Mon,  2 Nov 2026 09:04:52 +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 681DC207B0;
	Mon,  2 Nov 2026 09:04:52 +0100 (CET)
X-DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.secunet.com 681DC207B0
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secunet.com;
	s=202301; t=1793606692;
	bh=RN0KtHePRWJJDIJqcoSp9L1s2pTtBDmwuk/8VGE9Y7A=;
	h=From:To:CC:Subject:Date:In-Reply-To:References:From;
	b=PiVMWyyBzDpsUWjIyzt+yrPldt5Ikp7lLLN9oK64DuQ9Yf4JOF1lna7scFL4avZ9Q
	 6CKk6PiQsb/NXU3F946IdikIuvF9VXITrku/yr8h2bZNmpHQhujsPClT7VTlNgKKJn
	 ls67nmz53TMM5hcY48u9Joaf/mDpLtvyj9EDpiPS0e+tdXVDFnFktwSGSwMmFSMQOB
	 gt9AwBSHv+yRkI6Kwn+WdTXelWOW/NUxPO2VhCKS133On/HIbuAFvKJb3VvoCqlCTF
	 NlebRb0ebL4qex2CBEogTDKvSnUZi36vulxhtupiXr0huOIYXBCA0DqfS37aZhiGrY
	 6xQcU+H64Whuw==
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; Mon, 2 Nov
 2026 09:04:52 +0100
X-Received: (nullmailer pid 2505897 invoked by uid 1000);
	Mon, 02 Nov 2026 10:04:58 -0000
X-CC: Herbert Xu <herbert@gondor.apana.org.au>, Steffen Klassert
	<steffen.klassert@secunet.com>, <netdev@vger.kernel.org>
X-Mailer: git-send-email 2.53.0
X-In-Reply-To: <20261102100451.2505200-1-steffen.klassert@secunet.com>
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-ClientProxiedBy: EXCH-01.secunet.de (10.32.0.171) To EXCH-01.secunet.de
 (10.32.0.171)