Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3976604pxb; Tue, 25 Jan 2022 00:27:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJytRy/KcYpoNNUW8MmgMWF9a4bYPjwiP2DxCGaDCIp3k8Pmn08kmoQJ/rTjg2CZy0OPw7zJ X-Received: by 2002:a17:903:31c8:b0:149:a463:ad38 with SMTP id v8-20020a17090331c800b00149a463ad38mr17484209ple.76.1643099226362; Tue, 25 Jan 2022 00:27:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643099226; cv=none; d=google.com; s=arc-20160816; b=pFOANalvr3ON9SQTWwJohGziLJnBkYNyzf3SE+Z+kxJoTMgjKAJg+UdXMpHhe2jYp6 1lH+l56CnNVI0Fb97TapXtu8yshYNMYMkqFekzqQcH2E+5OhiVoRrny8DXz7oJ/8gS6k r0o5MMlJp9f9HhX11+uQ+Ryv06MES3Yele28qjXZ1thbmnHB1iMgYsEdFfQK5mHHjvnT xkx2MJQjMY3llCqE2Bp9g+04zqfam9fRO2fmMWtHmAr2baNWQ4SQcBwR4B3TTCxOMLFk tj++yLupAwQjDxXJxf8KppycWHwhPE695k9NzJz8g/mBUafu4TL04GjAVD8k+rTHZybz dvyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4NUPWiOAOElba2KXwJBmIp1kYb5fhjdVlHaoVhnFMaE=; b=iMeGx3qdcXPG+4+FnK6pOlVAuv5NjWqV7tcvaUEBEZsVeuFOAlkUYrszTOr6wqxE/L d9qXUGNz+zbBGIiLySYFk2Vium8yGqxZkNCSh/PD1Mn+YCqdW1/KZP/pE2P+h1+Ig7Zj /rfIeE8CQ2POGObzZZ69O6efubxBbOEIgm+Oq5YMNZf8Pjie70tD7dHj8cl5bxlENZpI rZqdrAOVOHWKClAfFVM3QCuduZmgiWFlsgfDcYaLHWFX8Sc+2cUf1+M8KHk8V/VsgkUG HRXYTZjldOkAcWbnJBWTgLRTRUEOxq4oVAABTY5gSAOPz7Q0iLHo71FjVoE5a9QxXXal 55cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Rwc6pk7A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v202si2729425pgb.255.2022.01.25.00.26.54; Tue, 25 Jan 2022 00:27:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Rwc6pk7A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3422598AbiAYCbl (ORCPT + 99 others); Mon, 24 Jan 2022 21:31:41 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:57132 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381224AbiAXUTy (ORCPT ); Mon, 24 Jan 2022 15:19:54 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CA09FB8122A; Mon, 24 Jan 2022 20:19:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0DBDC340E5; Mon, 24 Jan 2022 20:19:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055592; bh=Ipaf2xrialY117D8ei2KWYiw/gJ+vYaZHb44lVq9cJ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rwc6pk7A2mMTeJLgr54Ca4tQhRrs4PRsDjNDMa2EjnCPEN92NjiN3SB+TNa1MIfWV zV34FHaIY3qEwRYjM959NTzT+Mt2SJWZVWwldapMtGfxG4Gww2viT5y8zzNiA16I7K Qf6OH00NAxpLhsRYvQeE+vsH8HAUA+ENJOETQ3kQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexei Starovoitov , Andrii Nakryiko , Sasha Levin Subject: [PATCH 5.15 201/846] bpf: Adjust BTF log size limit. Date: Mon, 24 Jan 2022 19:35:18 +0100 Message-Id: <20220124184107.868752221@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexei Starovoitov [ Upstream commit c5a2d43e998a821701029f23e25b62f9188e93ff ] Make BTF log size limit to be the same as the verifier log size limit. Otherwise tools that progressively increase log size and use the same log for BTF loading and program loading will be hitting hard to debug EINVAL. Signed-off-by: Alexei Starovoitov Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20211201181040.23337-7-alexei.starovoitov@gmail.com Signed-off-by: Sasha Levin --- kernel/bpf/btf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index dfe61df4f974d..79c0bcdcab842 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -4332,7 +4332,7 @@ static struct btf *btf_parse(bpfptr_t btf_data, u32 btf_data_size, log->len_total = log_size; /* log attributes have to be sane */ - if (log->len_total < 128 || log->len_total > UINT_MAX >> 8 || + if (log->len_total < 128 || log->len_total > UINT_MAX >> 2 || !log->level || !log->ubuf) { err = -EINVAL; goto errout; -- 2.34.1