Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9676267pxu; Tue, 29 Dec 2020 01:46:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJyyKVyA7kfL0cENZLmOW0QrH8bZjDmPQpkkxowdrRHDgQSBARjkONIFDh2Rv+vwm+wDy1lI X-Received: by 2002:a17:906:d209:: with SMTP id w9mr6309325ejz.211.1609235162792; Tue, 29 Dec 2020 01:46:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609235162; cv=none; d=google.com; s=arc-20160816; b=AlXU80lzIwxVg3PqpCfMw9Wrnkh5tdfBjRAk9RcQjMmvhYnzPKWctOkmi3bJqRvEhC dbMglwOEE6TzE7Pqx3UDMEpKIS7537mlgkDBIq9t2A2sjB4Bdh5yHHwZxTIDlP0UOJVy i7oQlyabYQCobH1Yv+I7H1s8zYcdhHu3AG6OUJu0Qc6sWsOHZNh705SKN1ryPG3RORCF YWO9pzKBHr63rHbEEEtTCu8NAkCgXM0SARuLO2eD3wgZKhn2sKtwneogdgs/J1DpW94V Sn1NbpWjbe1quM8oaLhrYcOqihqGmwo8yOVlS0rn/LiEYYuZ9Dr893SsYGzzdkXImc4B eQ2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=aroumyPaOe/xuhYXJrw56pPl0DJ6BbBqrr8WNP94yg0=; b=L6UhT2RC88LNKvkWaupIw80tsBQL66VfVhfWV8bQZY7Y2+k2w2Lwb7jnYXpx/M4WMv qjqvBMaOfBTKuAw8ymd6KfPbJDje3+fZeaUBml3iISZ4F9g42Fb/iyThcZ/o1kpcQC+s dNfYHR5z1BdmJceQn8o8Xe3kvvOQUV7OcnJYHqrVwjot15dzekMdEDxtruSTfpEYSy2H hdDijG5gKQ6+zfScsUCDmoqV2CjCjpfRhscPCbx7FUqUFU8cVrSICFV0h+9LrWAT5H02 sXVQGG6CBYRD2Qv2Cu2XQTZ0jv942fc9IPqDk+odPtNymgV8+gojPVrLVftaykBAnJyC zHmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Vv8z0EfO; 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 v26si14128635ejc.336.2020.12.29.01.45.40; Tue, 29 Dec 2020 01:46:02 -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=Vv8z0EfO; 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 S1726161AbgL2Jnv (ORCPT + 99 others); Tue, 29 Dec 2020 04:43:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:37644 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725964AbgL2Jnu (ORCPT ); Tue, 29 Dec 2020 04:43:50 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0F5E1206ED; Tue, 29 Dec 2020 09:43:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609234989; bh=sUnwYXpbxM4Oah3agUrzRr2W6shz/+ZuVqCPcEvWiRg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Vv8z0EfOpPnxCpLi9Fv6/spzoMU8jJkDaYuwRVjX0iaETImfS0IGhp7qWgUFO7KfW thg/wk+SheALGMtmf8w8pF37lF2FcubW2JctL/HUA5lJQmNCA/5LL7QgMp1NAxR9pN 1digr2SR4YMxhOQbr4DKxAVf6WUfqxYjR9WLcBR8= Date: Tue, 29 Dec 2020 10:44:29 +0100 From: Greg Kroah-Hartman To: Sasha Levin Cc: Andrii Nakryiko , Naresh Kamboju , open list , linux-stable , Andrii Nakryiko , Alexei Starovoitov Subject: Re: [PATCH 5.4 106/453] libbpf: Fix BTF data layout checks and allow empty BTF Message-ID: References: <20201228124937.240114599@linuxfoundation.org> <20201228124942.316302285@linuxfoundation.org> <20201228230925.GH2790422@sasha-vm> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201228230925.GH2790422@sasha-vm> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 28, 2020 at 06:09:25PM -0500, Sasha Levin wrote: > On Mon, Dec 28, 2020 at 11:47:44AM -0800, Andrii Nakryiko wrote: > > On Mon, Dec 28, 2020 at 7:49 AM Naresh Kamboju > > wrote: > > > > > > Perf build failed on stable-rc 5.4 branch due to this patch. > > > > > > On Mon, 28 Dec 2020 at 19:15, Greg Kroah-Hartman > > > wrote: > > > > > > > > From: Andrii Nakryiko > > > > > > > > [ Upstream commit d8123624506cd62730c9cd9c7672c698e462703d ] > > > > > > > > Make data section layout checks stricter, disallowing overlap of types and > > > > strings data. > > > > > > > > Additionally, allow BTFs with no type data. There is nothing inherently wrong > > > > with having BTF with no types (put potentially with some strings). This could > > > > be a situation with kernel module BTFs, if module doesn't introduce any new > > > > type information. > > > > > > > > Also fix invalid offset alignment check for btf->hdr->type_off. > > > > > > > > Fixes: 8a138aed4a80 ("bpf: btf: Add BTF support to libbpf") > > > > Signed-off-by: Andrii Nakryiko > > > > Signed-off-by: Alexei Starovoitov > > > > Link: https://lore.kernel.org/bpf/20201105043402.2530976-8-andrii@kernel.org > > > > Signed-off-by: Sasha Levin > > > > --- > > > > tools/lib/bpf/btf.c | 16 ++++++---------- > > > > 1 file changed, 6 insertions(+), 10 deletions(-) > > > > > > > > diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c > > > > index d606a358480da..3380aadb74655 100644 > > > > --- a/tools/lib/bpf/btf.c > > > > +++ b/tools/lib/bpf/btf.c > > > > @@ -100,22 +100,18 @@ static int btf_parse_hdr(struct btf *btf) > > > > return -EINVAL; > > > > } > > > > > > > > - if (meta_left < hdr->type_off) { > > > > - pr_debug("Invalid BTF type section offset:%u\n", hdr->type_off); > > > > + if (meta_left < hdr->str_off + hdr->str_len) { > > > > + pr_debug("Invalid BTF total size:%u\n", btf->raw_size); > > > > > > In file included from btf.c:17:0: > > > btf.c: In function 'btf_parse_hdr': > > > btf.c:104:48: error: 'struct btf' has no member named 'raw_size'; did > > > you mean 'data_size'? > > > pr_debug("Invalid BTF total size:%u\n", btf->raw_size); > > > ^ > > > libbpf_internal.h:59:40: note: in definition of macro '__pr' > > > libbpf_print(level, "libbpf: " fmt, ##__VA_ARGS__); \ > > > ^~~~~~~~~~~ > > > btf.c:104:3: note: in expansion of macro 'pr_debug' > > > pr_debug("Invalid BTF total size:%u\n", btf->raw_size); > > > ^~~~~~~~ > > > > > > > This patch fixes the bug introduced back in 8a138aed4a80 ("bpf: btf: > > Add BTF support to libbpf"), but a bunch of other refactorings > > happened since then, adding/renaming struct btf internals. The fix > > here is not that critical, so it's probably best to just drop this > > patch from the stable, if possible. Would it be ok, Greg? > > I'll drop it, thanks. Thanks for dropping this and doing the other fixups. I'll go push out some -rc2 releases soon... greg k-h