Archive-only list for syzbot
 help / color / mirror / Atom feed
From: "syzbot" <syzbot@kernel.org>
To: syzkaller-upstream-moderation@googlegroups.com
Cc: syzbot@lists.linux.dev
Subject: [PATCH RFC] xfrm: add missing RCU read lock in xfrm_send_migrate_state()
Date: Fri, 31 Jul 2026 09:38:04 +0000 (UTC)	[thread overview]
Message-ID: <d9a2552d-df0d-4144-a5ad-1db7aabb3dee@mail.kernel.org> (raw)

The xfrm_nlmsg_multicast() function requires the caller to hold the RCU
read lock because it uses rcu_dereference() to safely access
net->xfrm.nlsk.

When xfrm_send_migrate_state() is called directly from the netlink message
handler xfrm_do_migrate_state(), it bypasses the xfrm_mgr callbacks which
typically acquire the RCU read lock centrally. The netlink handler only
holds the xfrm_cfg_mutex and does not hold the RCU read lock, leading to a
suspicious RCU usage warning:

WARNING: suspicious RCU usage
net/xfrm/xfrm_user.c:1630 suspicious rcu_dereference_check() usage!

Call trace:
 lockdep_rcu_suspicious+0x168/0x26c kernel/locking/lockdep.c:6876
 xfrm_nlmsg_multicast net/xfrm/xfrm_user.c:1630 [inline]
 xfrm_send_migrate_state+0x6b0/0x958 net/xfrm/xfrm_user.c:3340
 xfrm_do_migrate_state+0x1114/0x1728 net/xfrm/xfrm_user.c:3507
 xfrm_user_rcv_msg+0x4e0/0x950 net/xfrm/xfrm_user.c:3907
 netlink_rcv_skb+0x238/0x414 net/netlink/af_netlink.c:2556
 xfrm_netlink_rcv+0x80/0x9c net/xfrm/xfrm_user.c:3929

Fix this by explicitly acquiring and releasing the RCU read lock around the
xfrm_nlmsg_multicast() call in xfrm_send_migrate_state(), similar to what
is done in other direct netlink handlers like xfrm_notify_userpolicy().

Fixes: a9d155ea9b44 ("xfrm: add XFRM_MSG_MIGRATE_STATE for single SA
migration")

Fixes: a9d155ea9b44 ("xfrm: add XFRM_MSG_MIGRATE_STATE for single SA migration")
Assisted-by: Gemini:gemini-3.5-flash Gemini:gemini-3.1-pro-preview syzbot
Reported-by: syzbot+b9e97485773456b16a4a@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=b9e97485773456b16a4a
Link: https://syzkaller.appspot.com/ai_job?id=d3018c43-91ed-4b51-be71-8469c523a748
To: "David S. Miller" <davem@davemloft.net>
To: "Eric Dumazet" <edumazet@google.com>
To: "Herbert Xu" <herbert@gondor.apana.org.au>
To: "Jakub Kicinski" <kuba@kernel.org>
To: <netdev@vger.kernel.org>
To: "Paolo Abeni" <pabeni@redhat.com>
To: "Steffen Klassert" <steffen.klassert@secunet.com>
To: "Antony Antony" <antony.antony@secunet.com>
Cc: "Simon Horman" <horms@kernel.org>
Cc: <linux-kernel@vger.kernel.org>

---
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index d6db63304..0ba0614d6 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -3337,7 +3337,11 @@ static int xfrm_send_migrate_state(struct net *net,
 		return err;
 	}
 
-	return xfrm_nlmsg_multicast(net, skb, 0, XFRMNLGRP_MIGRATE);
+	rcu_read_lock();
+	err = xfrm_nlmsg_multicast(net, skb, 0, XFRMNLGRP_MIGRATE);
+	rcu_read_unlock();
+
+	return err;
 }
 
 static int xfrm_do_migrate_state(struct sk_buff *skb, struct nlmsghdr *nlh,


base-commit: f5098b6bae761e346ebcd9da7f95622c04733cff
-- 
This is an AI-generated patch subject to moderation.
Reply with '#syz upstream' to Sign-off the patch as a human author
and send it to the upstream kernel mailing lists.
Reply with '#syz reject' to reject it ('#syz unreject' to undo).

See https://goo.gle/syzbot-ai-patches for information about AI-generated patches.
You can comment on the patch as usual, syzbot will try to address
the comments and send a new version of the patch if necessary.
syzbot engineers can be reached at syzkaller@googlegroups.com.

             reply	other threads:[~2026-07-31  9:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31  9:38 syzbot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-07-31  8:11 [PATCH RFC] xfrm: add missing RCU read lock in xfrm_send_migrate_state() syzbot
2026-07-31 10:03 ` Aleksandr Nogikh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d9a2552d-df0d-4144-a5ad-1db7aabb3dee@mail.kernel.org \
    --to=syzbot@kernel.org \
    --cc=syzbot@lists.linux.dev \
    --cc=syzkaller-upstream-moderation@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox