Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9151948pxu; Mon, 28 Dec 2020 07:54:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJyXeA+dtQ/412y9mJ/3hYRdVRsSJy9jMxe2huuNO7d8oQAFM/L4lwyawy+nMQVRmAw0lFaL X-Received: by 2002:a17:906:94c5:: with SMTP id d5mr40962775ejy.427.1609170854630; Mon, 28 Dec 2020 07:54:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609170854; cv=none; d=google.com; s=arc-20160816; b=rJTHBau0xwL5Lv116Zs444W46/Ov479c7awlul6S4KnoXJaSKvnGx4dhwKUAcjYWqk PR4RtnemPW3zHtUwStLGoTDdGeQp37gTH7YaTE+a5UTQIyQVK/UwonBlGdsi6q47N5/x RqsYpjc9gIh+XM6kFWZzTlDoo6VAdiQDPBmheUNT+9N2d+SeSxzDQX06e/Kdb6QPBeaW 9sYFVXFPHk0jLxDlRHlTC4BxRqyLdjNv2tan0dVzqkT47py0vrkR02EQDTzeko5monm3 ZWqzxNrmo25hO6vc78VltuT+71aOWcB/56mZ2ByJeN6P7pnHxz4vWpwMQPZmgcBBpC+X eHDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=qtjzQnYDyk5DZh0doxfk9ryaDoFYVWbE/m+K0gu0ViY=; b=wheeZ4WekmyQ0qST5ZwID1+levoxPPEozIu0DNm9Lv6BgTEiGrfttNNjA72NvRMQyH uYNmKSj3jWhshznHC+DR4N7uElJgF+mebs+spAWjiNJdXMd5Ftwi7/2wqIZIb14YWHfr q4+LKmdAAl3C3yW1RfhM61jc36MABwbVpMg+cosE78VJ2jd1RaqWhIpjmaroGyvDubV5 e81ezUmf/07o04X5tO7sP/dphT86wvQBhOhHayWap1j6cr23GxXNlmJF6eRTCtz7a+f1 mZXuryGSRATz/G0bv3w4D6GBq4+BORZG0iN5Wcp4fko8qQlssQ9YDh78LQht/KwvLrqW Hx+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LV5PziCM; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bm26si20809712edb.528.2020.12.28.07.53.51; Mon, 28 Dec 2020 07:54:14 -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=@linaro.org header.s=google header.b=LV5PziCM; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2632855AbgL1PuW (ORCPT + 99 others); Mon, 28 Dec 2020 10:50:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404083AbgL1PuV (ORCPT ); Mon, 28 Dec 2020 10:50:21 -0500 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06D27C061796 for ; Mon, 28 Dec 2020 07:49:41 -0800 (PST) Received: by mail-ed1-x535.google.com with SMTP id p22so10092694edu.11 for ; Mon, 28 Dec 2020 07:49:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qtjzQnYDyk5DZh0doxfk9ryaDoFYVWbE/m+K0gu0ViY=; b=LV5PziCMI8V0lNM/j2hZ4/vfrM66RgWuPfQnkq6isqcBORDwmUVBr38xHk2UVaSI/l M8a/9etOMgPFMSFroXCSRJwqaYO9BoQ7wgenvUIo67soknImAmNAT3H4VCuoqfaT0m9M TtIVXNTjYNRB+fLrnS5G+r5x0VL/tuZ+q9NukTT2frkKGtokMDnqRU+5pkiF+koY6XH8 yxib9G/K+EMQUfT8EE5nr19F6OBBjD1SZbL6J0MKUrRK8VglQ9IGzbHACGl4GTdO/k9A shPJunmPxl2flAX5VqobuOx7xiP9SscFWJ/yCUTJIu2F8nRMI0UDTENBpgbHggIPwb2Y XENQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qtjzQnYDyk5DZh0doxfk9ryaDoFYVWbE/m+K0gu0ViY=; b=f1otLp7bYxiEvAh0esuql8mbWmH1uBtQfIUa9Kel5u3iEv5mfKPD4jAusDhKQBTy24 5dKkIJPluYzpn7Zu/UOqKMgk595IZXYvh1KVB/Y0+C7nfyIPV4U4WT99vPuSbn4nwC5L Ug7O8QDoAEtMFqH/nZ3ahGPkHbbF+WPierLuSYZRLNrQKx9BFu6OpLRALvPftNC39y2D EzqBz38xItBWKUWjFMcRXSoK72lPSUqLRjbA9oSgQeVxrj+lk79omXAS+F0woL2Nz2DG UUBhhG/Ev3MGKYHIY1JhxQ8YOYCSnWAuo1NqyBDmPCgLAImc3FCGO241Mubld6ePx0pB e35Q== X-Gm-Message-State: AOAM533KgkpPG/s1O9L6VKI23vA5rF156EBmxwhVa1xOVh/qhC79todN iOKSwZHpYcFmF0TPMnaHmqg4VdGk+mYmkaYWPTmKbg== X-Received: by 2002:aa7:cdc3:: with SMTP id h3mr42108289edw.52.1609170579555; Mon, 28 Dec 2020 07:49:39 -0800 (PST) MIME-Version: 1.0 References: <20201228124937.240114599@linuxfoundation.org> <20201228124942.316302285@linuxfoundation.org> In-Reply-To: <20201228124942.316302285@linuxfoundation.org> From: Naresh Kamboju Date: Mon, 28 Dec 2020 21:19:28 +0530 Message-ID: Subject: Re: [PATCH 5.4 106/453] libbpf: Fix BTF data layout checks and allow empty BTF To: Greg Kroah-Hartman Cc: open list , linux-stable , Andrii Nakryiko , Alexei Starovoitov , Sasha Levin Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); ^~~~~~~~ full build log link, https://ci.linaro.org/view/lkft/job/openembedded-lkft-linux-stable-rc-5.4/DISTRO=lkft,MACHINE=intel-corei7-64,label=docker-buster-lkft/346/consoleText -- Linaro LKFT https://lkft.linaro.org