From mboxrd@z Thu Jan 1 00:00:00 1970 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 370FB4E021A; Wed, 30 Sep 2026 16:49:15 +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=1790786957; cv=none; b=iRTAH3vKPprOvmTIXv9SvLdfviFLLg7VZCPr0EP+UyyrL9rjXGE5ATpEpQfwQVYsnHAnZIcXCFlztbCq39DcWevN7mHo3Lu53ZUIjjLkKH5hkfnYYJhi4YHpAsJUKoq2Vg4TY5Ivno1dUN5ArTeNvN5JnNU1z0kxWnv/BkzFdQg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790786957; c=relaxed/simple; bh=JWyFEs/op4fkGDUPzgLiF4M/RjxR6efSbRe8EVgzYbE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gfO6GAjGW1MnsRN9zGaXoZgMQ8YVjnVTIzOYa7zUVLo7r8yyZhVITL5iVynHdjy51ICxq470IIrovg8gYyZXswywC+FpJy1F9CCm5bHcsVjSMx41tH2WQEnVz/Ra953g1MsPtuKozshb0OhTOsjRBE8rKsprWBt0s31ZgXhT1NA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=QEpLwTmL; 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="QEpLwTmL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 471E41F000FF; Wed, 30 Sep 2026 16:49:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790786955; bh=ekBv6FGe89JBX+la+P3MZaZByAmh7JN2J93cRJnvgQM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QEpLwTmLwS9SFrGV3Ev/WVkl7uPFOcnJ7SdS111DNQgu5o8LUh/zcpthR/dvFq0KN bWdyPFQYKDZV48B8wrcjKSBD5/KviIpTVXREzR1Vr+E3+z2D9oSZYH/Eac4nrb4Cfm oQcli/9suVlIOQt6goTj4ZvxN+Z4hOwBoGJeccRA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, co+adfca3e91be95776@bugs.sh, Alexei Starovoitov , Weiming Shi , Daniel Borkmann , Emil Tsalapatis , Sasha Levin Subject: [PATCH 7.2 016/457] bpf: Disallow bpf_skb_pull_data() for LWT_SEG6LOCAL Date: Wed, 30 Sep 2026 17:22:01 +0200 Message-ID: <20260930152346.380513217@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930152346.024115587@linuxfoundation.org> References: <20260930152346.024115587@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 7.2-stable review patch. If anyone has any objections, please let me know. ------------------ From: Weiming Shi [ Upstream commit e4a62833adff6ef0fe7c0b90393204fe3c26b5c5 ] An LWT_SEG6LOCAL program can invalidate its cached SRH with bpf_lwt_seg6_adjust_srh() and then call bpf_skb_pull_data(). The latter may reallocate skb->head, leaving the per-CPU SRH pointer dangling. Post-program SRH validation then writes through that pointer. Disallow bpf_skb_pull_data() for LWT_SEG6LOCAL programs so the verifier rejects this unsafe helper combination. Other LWT program types continue to expose the helper through lwt_out_func_proto(). Fixes: 004d4b274e2a ("ipv6: sr: Add seg6local action End.BPF") Reported-by: co+adfca3e91be95776@bugs.sh Suggested-by: Alexei Starovoitov Signed-off-by: Weiming Shi Signed-off-by: Daniel Borkmann Reviewed-by: Emil Tsalapatis Closes: https://lore.kernel.org/all/GCy0KRM2IcQGoJQTjJEU9D0maBxXzEDHuQpq@bugs.sh/ Link: https://lore.kernel.org/bpf/DL9COXZQXX4V.1FN45QO2Q77ZH@gmail.com/ Link: https://lore.kernel.org/bpf/20260909040807.3885815-2-bestswngs@gmail.com Signed-off-by: Sasha Levin --- net/core/filter.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/core/filter.c b/net/core/filter.c index 73c6fa3d73467..d0465db6f1c42 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -8881,6 +8881,8 @@ static const struct bpf_func_proto * lwt_seg6local_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) { switch (func_id) { + case BPF_FUNC_skb_pull_data: + return NULL; #if IS_ENABLED(CONFIG_IPV6_SEG6_BPF) case BPF_FUNC_lwt_seg6_store_bytes: return &bpf_lwt_seg6_store_bytes_proto; -- 2.53.0