Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F1D742882B; Sat, 12 Sep 2026 15:09:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789225775; cv=none; b=Sqm7Y44wRgArdnYsqfMvIqy1kjYEy9z0sn3inKszKIF2blJTlR807fA4Dd3CyPrjoULu21TYJnt4vgqWBH2Ex+m20o4wc3s5qq8zwgjorFB/j4F2ENk3s/+NoF8iJNwRPpPgNXSFGVqP/eiueDBWfOJZhm8ngjKzF0Y9j07PhH8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789225775; c=relaxed/simple; bh=9CjwSSlSHEx/vYRL+bh8lIwSdlL+DtHrM20V6HXvQ4E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BrdOoDjJI1+J7MUcaCIZb8elZNDauZsu5r3xxd7eCTERn1WF5h5oUjKKnvuNL4SCU6Wm6GGnS+ofdL3G1aMA5ST8BojZhj82rUSBqYUY0j+TPwQ3mTW4c5KC5EZBJLwWLUUnfERwsQP7HdbtcC4tXZ56KsApJONsHtENKscNFbU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=m7VjxvPk; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="m7VjxvPk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0FE41F00898; Sat, 12 Sep 2026 15:09:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789225768; bh=ltO2Dhkv9GCMCrH0QQf1doklWsWvmXFk/khcCEodsUo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=m7VjxvPkItxu9OB+VQyYv6aL11nz1/6nZ1lKsywF86HHiFr10WxeFBU1jQ0+bBzPe Kootpm8L3oOImF7SLalVtrCq6zvH52PBQM/oUD1PxEzoNhndxBreyHCD0IvzN7eM4B 4XXVkqSgVvZEEWHxPV2IgdEYWZPfwXuEKO8XwEpM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sechang Lim , Junseo Lim , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.6 1264/1424] net: kcm: Hold RCU read lock while running BPF parser Date: Sat, 12 Sep 2026 09:01:36 +0200 Message-ID: <20260912065635.587867363@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065607.279695368@linuxfoundation.org> References: <20260912065607.279695368@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Junseo Lim [ Upstream commit b0346dd64e4905291cc9c479f2e6cf1884ced4e6 ] kcm_parse_func_strparser() calls bpf_prog_run_pin_on_cpu() which prevents CPU migration, but does not establish an RCU read-side critical section. Consequently, BPF map operations can trigger WARN_ON_ONCE(!bpf_rcu_lock_held()) when called from the KCM strparser program. Hold the RCU read lock while running the program. Fixes: 9b73896a81dc ("kcm: Use stream parser") Reported-by: Sechang Lim Signed-off-by: Junseo Lim Link: https://patch.msgid.link/20260813035136.106167-1-zirajs7@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/kcm/kcmsock.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c index a47afaaea2a13..93b1c499d76d1 100644 --- a/net/kcm/kcmsock.c +++ b/net/kcm/kcmsock.c @@ -5,6 +5,7 @@ * Copyright (c) 2016 Tom Herbert */ +#include #include #include #include @@ -389,7 +390,9 @@ static int kcm_parse_func_strparser(struct strparser *strp, struct sk_buff *skb) struct bpf_prog *prog = psock->bpf_prog; int res; + rcu_read_lock(); res = bpf_prog_run_pin_on_cpu(prog, skb); + rcu_read_unlock(); return res; } -- 2.53.0