Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9471286pxu; Mon, 28 Dec 2020 17:45:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJz3vH6+cCDNQjzXdG5wnRwzhMsDzO8y9p/rLwDvIVIwcMVhpddYuykJbUED/p2ucYEkh1/t X-Received: by 2002:a17:906:2e82:: with SMTP id o2mr44190047eji.106.1609206315005; Mon, 28 Dec 2020 17:45:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609206314; cv=none; d=google.com; s=arc-20160816; b=KM+8xSovAejMjd/LJMM3C51FH8EiPjr2MFwA4rXiPCkoKhZVpleX9HQ8F4ooUWM29y wHhVjIAP1rWXg8KJsvPVgq12sqMhEu1hCboJFwYd/8Te009yW1BXgJkto7C5qCrykqxU cV8PMMLpLNFWP/FbYUzIMRsXkxG40SUP1dPZvE6ZYoESvBpbkLHbefTAODH6u+f/1peo EZkgfGvpj73MvNPMJQF+Cb192m69tQVJYJ/+KVWU8FL8GhYZbo4wNBimlmgKEpeIVyDZ fndYl0UvQ9ZxBgeLXZclZbMUyZ/TJ2eD8neKPpu6rD5igG+9urjlqYarirvuROCkIWSl Up3Q== 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=YJxWnY3S6EVUF/zhRpyGnoCte1dOf0xelEIF09j73nE=; b=k3VIXhupRRgyrjJMouatNy13ae4B222CThyQzdpCYeZlQ+QviycSSpUH/GSjOANbWN EzoqixEzhP5vfHMrZ+Nf8RbR4NHufa47b4rr47VXMnG+swonJZGjdflx6TVsEjDj0d6e 29Wzr4AxzhfcRmoRh/Fy9EgFyUbBg7BeeF94xDG0PT/teW9qY/QjO45mMOJgacwKbLCB 0QvlWby9jcNm15Q7leBca1pcmASfEI+svJVeRMGHMebIJG5pEi6Cg1fsSPr8I7HODyyW ZOE1Up2PeOaI2V0vqLW/ZeoJFRqpcxWOXhQNEPnxKDh+ue9qpzo/xsNNiwhLPqk7Ardq AY4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RCZifI1l; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p20si19279408ejx.41.2020.12.28.17.44.52; Mon, 28 Dec 2020 17:45: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=@gmail.com header.s=20161025 header.b=RCZifI1l; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730276AbgL1Wzo (ORCPT + 99 others); Mon, 28 Dec 2020 17:55:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729334AbgL1Tsg (ORCPT ); Mon, 28 Dec 2020 14:48:36 -0500 Received: from mail-yb1-xb2d.google.com (mail-yb1-xb2d.google.com [IPv6:2607:f8b0:4864:20::b2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83981C0613D6; Mon, 28 Dec 2020 11:47:56 -0800 (PST) Received: by mail-yb1-xb2d.google.com with SMTP id v67so10616545ybi.1; Mon, 28 Dec 2020 11:47:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YJxWnY3S6EVUF/zhRpyGnoCte1dOf0xelEIF09j73nE=; b=RCZifI1lUFBuAuSjA+FJzk6ncmyhWCzRBCsChj43TCMv3dLeHpj8+LhbvI+z1vkPEN iQw2b2k33JsygORAbwXGo8lkjxUjPgjuYLD19MEUO/ityxb4RFaK9Pty/F8UX02V0XBu W/TJhGZlTTHa9MT8AY8cHtL+Dqe4Ye44juGhW1PKQh+9HyyW1dGYvqHVKhpTFcYVBFId uwLi8Y1oQVK/OaeFy3D29tgEoVwXD1RQfBpN/FVYSVID0V86YMuGReq0cy3WrCByKOV7 mHiy9h/PR9GzAr+aO6zRoASfPuse+XzrIobf1xDvyyzklQNzgLP7LQdWF/hBkY1lxlZL eKJQ== 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=YJxWnY3S6EVUF/zhRpyGnoCte1dOf0xelEIF09j73nE=; b=QpnTUE7nuUai9BqlnsTEjfIPNX4F3Zey7kf07h7C//b8zOJcXXr8v7NWzwJjUc9xzM ZGwt2whqNCuXrzsRwu8pIuGIXC5/ciEo54nnDBu2qjJD8cake9oYZL0CG5n/u7vZom5E nhu/PaVjN8AsjFkkCgwUA0Jxl8AJO5lR3pmIzZ7Qpn2mrk5++5iGdKVcJsEUuWbTlWvo ZCc6lWcb3bVjor/sr+SbzYZeQ/GXsRaH5xdo3UebtcgO+i9fO2I5tcjt1XF2yG2j9tH+ OYXYf0gZJgcKN0hGeL/ww/uYx1z78tRCFoBir2IDkZvlUrgnLlsb2MwW7iaAZJbtoRj4 m9Eg== X-Gm-Message-State: AOAM531qJrHrzjHpsflvQ+3Y0IRk9LGrPD6T0iHMDcoxP0Zo9mpPfA3r WIrTP7HgwKSYq8rtLJaO9z9SDHd/PMcPCg4lJhg= X-Received: by 2002:a25:2c4c:: with SMTP id s73mr48282328ybs.230.1609184875632; Mon, 28 Dec 2020 11:47:55 -0800 (PST) MIME-Version: 1.0 References: <20201228124937.240114599@linuxfoundation.org> <20201228124942.316302285@linuxfoundation.org> In-Reply-To: From: Andrii Nakryiko Date: Mon, 28 Dec 2020 11:47:44 -0800 Message-ID: Subject: Re: [PATCH 5.4 106/453] libbpf: Fix BTF data layout checks and allow empty BTF To: Naresh Kamboju Cc: Greg Kroah-Hartman , 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 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? > 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