From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 6284A149C41; Tue, 25 Jun 2024 09:59:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719309550; cv=none; b=l++zanU8mjyVzQCwu60GS3YeGPaMDpahiu/XW4wI3pqF66UoWE1QqtiTmS0h3esE1Hpxy+jKdsojqtVsy/owmcjCjPMPyIdoNnptmNO709qA1yPrtt8QDGlx1jL+ALciJUAVOxoodpGACsDd9WBJ8RJfIYQ5wYNxZTxuHBbEPyw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719309550; c=relaxed/simple; bh=3JlPbhTvOajTuMAvUJRQW3lmOSsbjEcjg4PDEoEfrog=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W8krU6bEtMWZNh6koTkIoYViHjD4LcUmFlHyH2PRfNOa5pUFjSJQ22ac+OhFLgkiI9rszm5JDv+kaaJFd0jMAI1BTqj1FL3r6vd0EZTDfw9z8uuveWDmImWNLFI5lI1u6YzwTZ9K8htGvdjGzA0HORVwPNXm9GSBaCObG4gX2Sk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=CnrQtygC; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="CnrQtygC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D154FC32781; Tue, 25 Jun 2024 09:59:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1719309550; bh=3JlPbhTvOajTuMAvUJRQW3lmOSsbjEcjg4PDEoEfrog=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CnrQtygCGi9/m9Ekx0R5BY4FEvx/aHYgce/h5QphwiIEG7ste6XIwtcJSYWQRM5lp 9lNqqQCC2YI03ktCuhVt+G5izlfburmfAiwXjiCll+TmG1t3O9vXl1jyuEnOE6dtDm ckcx1hGu/vw3MILhHrHX4V05sBBk0CSEj3/WEtkM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+0c4150bff9fff3bf023c@syzkaller.appspotmail.com, Eric Dumazet , Florian Westphal , Daniel Borkmann , Sasha Levin Subject: [PATCH 6.1 053/131] bpf: Avoid splat in pskb_pull_reason Date: Tue, 25 Jun 2024 11:33:28 +0200 Message-ID: <20240625085527.965908566@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240625085525.931079317@linuxfoundation.org> References: <20240625085525.931079317@linuxfoundation.org> User-Agent: quilt/0.67 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.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Florian Westphal [ Upstream commit 2bbe3e5a2f4ef69d13be54f1cf895b4658287080 ] syzkaller builds (CONFIG_DEBUG_NET=y) frequently trigger a debug hint in pskb_may_pull. We'd like to retain this debug check because it might hint at integer overflows and other issues (kernel code should pull headers, not huge value). In bpf case, this splat isn't interesting at all: such (nonsensical) bpf programs are typically generated by a fuzzer anyway. Do what Eric suggested and suppress such warning. For CONFIG_DEBUG_NET=n we don't need the extra check because pskb_may_pull will do the right thing: return an error without the WARN() backtrace. Fixes: 219eee9c0d16 ("net: skbuff: add overflow debug check to pull/push helpers") Reported-by: syzbot+0c4150bff9fff3bf023c@syzkaller.appspotmail.com Suggested-by: Eric Dumazet Signed-off-by: Florian Westphal Signed-off-by: Daniel Borkmann Reviewed-by: Eric Dumazet Acked-by: Daniel Borkmann Closes: https://syzkaller.appspot.com/bug?extid=0c4150bff9fff3bf023c Link: https://lore.kernel.org/netdev/9f254c96-54f2-4457-b7ab-1d9f6187939c@gmail.com/ Link: https://lore.kernel.org/bpf/20240614101801.9496-1-fw@strlen.de Signed-off-by: Sasha Levin --- net/core/filter.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/core/filter.c b/net/core/filter.c index 1d8b271ef8cc2..7a07413913538 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -1655,6 +1655,11 @@ static DEFINE_PER_CPU(struct bpf_scratchpad, bpf_sp); static inline int __bpf_try_make_writable(struct sk_buff *skb, unsigned int write_len) { +#ifdef CONFIG_DEBUG_NET + /* Avoid a splat in pskb_may_pull_reason() */ + if (write_len > INT_MAX) + return -EINVAL; +#endif return skb_ensure_writable(skb, write_len); } -- 2.43.0