From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6A83C47095 for ; Wed, 9 Jun 2021 04:43:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BC7ED6128A for ; Wed, 9 Jun 2021 04:43:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230417AbhFIEo4 (ORCPT ); Wed, 9 Jun 2021 00:44:56 -0400 Received: from mail-yb1-f177.google.com ([209.85.219.177]:34719 "EHLO mail-yb1-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232633AbhFIEo4 (ORCPT ); Wed, 9 Jun 2021 00:44:56 -0400 Received: by mail-yb1-f177.google.com with SMTP id i6so18975225ybm.1; Tue, 08 Jun 2021 21:42:50 -0700 (PDT) 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:content-transfer-encoding; bh=1It3ah1+98p8ZGjPRnK/5mUdjsC9zsL06VzWcGHzOU4=; b=mics4lm8falO3q/2aJPi+I3lD6dZwBAiXRJGTm6B1GmODHkVcQwFCA/6VZndLKBw5Q xjDrltZXY6yGkp8kJhHcXXAKV8okoXdVDemf8MSV4deueYS4UP7uj0rUGgJz0AZhf//1 G/TgEd+0n1X0bd1qPzSZsAfHgD1fPP+UiUx+UKqWWeF0suCkqMsTeT4ZUtUQrVbJcPBf pBhvKnaGszXV8UJbSzUGBQahSrZEMIyTIzaPeaAxXSnNFC8rEw/fQPL3CxapVIPc6FZ6 wDk7BJ1jrEQ32/q9QVAkzwGrx3ve68Z0sqdznC96C7l4XUNNgzJrYej1GEKd+k2LYIDj Q7og== 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:content-transfer-encoding; bh=1It3ah1+98p8ZGjPRnK/5mUdjsC9zsL06VzWcGHzOU4=; b=j33HxRRgSZBacFOLHRDMWii2WjnETsME5yr+DG6zJS4tP+GP1tHp88md4RLtAVSFRI PPVUeYpPFLD7PqiFQ9Q728hq9B78NFEQu9JNheSLHZDCSMO3u4ICWYjpQHkg8hh1GYBh PsHvfXwqncAvF3JyxN0PbYjqx7Fy93MKJeXfl3QKpiO227fV5x5pKjKDmUIMCQFanlG0 n8XzJuKnJp5ISb6Pp1C1/Ac53NHYZTIzTfmnFyZ+NIZT+r6zm9G7xr+MV9EwIUpVAc7+ PlK2FLHCUSHoKb9hg5SAb0Lz9784fxIy8GHRaIfKGB7BXROEg7FV9SfBWukABS6xhGkm wbqQ== X-Gm-Message-State: AOAM531VeDfKUltwMQ82Mlq3MMzy4lV9F73OEq+DmMthn2HBPlAtarQP PC83XtQUVTDhdf+2nlmHeApWFMJr75NsuOPaCyw= X-Google-Smtp-Source: ABdhPJxs687O3Nb8b09iV1obkGTop6vXrj1niFLgYKEatrY8i40OwgIZpIjMHVpRDRfn4QY0Do5FpEwhnFQX2quQLIc= X-Received: by 2002:a25:9942:: with SMTP id n2mr36841367ybo.230.1623213709823; Tue, 08 Jun 2021 21:41:49 -0700 (PDT) MIME-Version: 1.0 References: <20210313193537.1548766-7-andrii@kernel.org> <20210607231146.1077-1-tstellar@redhat.com> <84b3cb2c-2dff-4cd8-724c-a1b56316816b@redhat.com> In-Reply-To: From: Andrii Nakryiko Date: Tue, 8 Jun 2021 21:41:38 -0700 Message-ID: Subject: Re: [PATCH v2 bpf-next 06/11] libbpf: add BPF static linker APIs To: Tom Stellard Cc: Andrii Nakryiko , Alexei Starovoitov , bpf , Daniel Borkmann , Kernel Team , Networking Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Tue, Jun 8, 2021 at 8:44 PM Tom Stellard wrote: > > On 6/7/21 9:08 PM, Andrii Nakryiko wrote: > > On Mon, Jun 7, 2021 at 7:41 PM Tom Stellard wrote= : > >> > >> On 6/7/21 5:25 PM, Andrii Nakryiko wrote: > >>> On Mon, Jun 7, 2021 at 4:12 PM Tom Stellard wro= te: > >>>> > >>>> > >>>> Hi, > >>>> > >>>>> + } else { > >>>>> + pr_warn("relocation against= STT_SECTION in non-exec section is not supported!\n"); > >>>>> + return -EINVAL; > >>>>> + } > >>>> > >>>> Kernel build of commit 324c92e5e0ee are failing for me with this err= or > >>>> message: > >>>> > >>>> /builddir/build/BUILD/kernel-5.13-rc4-61-g324c92e5e0ee/linux-5.13.0-= 0.rc4.20210603git324c92e5e0ee.35.fc35.x86_64/tools/bpf/bpftool/bpftool gen = object /builddir/build/BUILD/kernel-5.13-rc4-61-g324c92e5e0ee/linux-5.13.0-= 0.rc4.20210603git324c92e5e0ee.35.fc35.x86_64/tools/testing/selftests/bpf/bi= nd_perm.linked1.o /builddir/build/BUILD/kernel-5.13-rc4-61-g324c92e5e0ee/li= nux-5.13.0-0.rc4.20210603git324c92e5e0ee.35.fc35.x86_64/tools/testing/selft= ests/bpf/bind_perm.o > >>>> libbpf: relocation against STT_SECTION in non-exec section is not su= pported! > >>>> > >>>> What information can I provide to help debug this failure? > >>> > >>> Can you please send that bind_perm.o file? Also what's your `clang > >>> --version` output? > >>> > >> > >> clang version 12.0.0 (Fedora 12.0.0-2.fc35) > >> > >>>> I suspect this might be due to Clang commit 6a2ea84600ba ("BPF: Add > >>>> more relocation kinds"), but I get a different error on 324c92e5e0ee= . > >>>> So meanwhile you might try applying 9f0c317f6aa1 ("libbpf: Add suppo= rt > >>>> for new llvm bpf relocations") from bpf-next/master and check if tha= t > >>>> helps. But please do share bind_perm.o, just to double-check what's > >>>> going on. > >>>> > >> > >> Here is bind_perm.o: https://fedorapeople.org/~tstellar/bind_perm.o > >> > > > > So somehow you end up with .eh_frame section in BPF object file, which > > shouldn't ever happen. So there must be something that you are doing > > differently (compiler flags or something else) that makes Clang > > produce .eh_frame. So we need to figure out why .eh_frame gets > > generated. Not sure how, but maybe you have some ideas of what might > > be different about your build. > > > > Thanks for the pointer. The problem was that in the Fedora kernel builds= , > we enable -funwind-tables by default on all architectures, which is why t= he > .eh_frame section was there. I fixed our clang builds, but I'm now getti= ng > a new error when I run: CC=3Dclang make -C tools/testing/selftests/bpf V= =3D1 > > > /builddir/build/BUILD/kernel-5.13-rc4-61-g324c92e5e0ee/linux-5.13.0-0.rc4= .20210603git324c92e5e0ee.35.fc35.x86_64/tools/testing/selftests/bpf/tools/s= bin/bpftool gen skeleton /builddir/build/BUILD/kernel-5.13-rc4-61-g324c92e5= e0ee/linux-5.13.0-0.rc4.20210603git324c92e5e0ee.35.fc35.x86_64/tools/testin= g/selftests/bpf/bpf_cubic.linked3.o name bpf_cubic > /builddir/build/BUILD/= kernel-5.13-rc4-61-g324c92e5e0ee/linux-5.13.0-0.rc4.20210603git324c92e5e0ee= .35.fc35.x86_64/tools/testing/selftests/bpf/bpf_cubic.skel.h > libbpf: failed to find BTF for extern 'tcp_cong_avoid_ai' [27] section: -= 2 > > Here is the bpf_cubic.lined3.o object file: https://fedorapeople.org/~tst= ellar/bpf_cubic.linked3.o > See README.rst in selftests/bpf: Kernel function call test and Clang version =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Some selftests (e.g. kfunc_call and bpf_tcp_ca) require a LLVM support to generate extern function in BTF. It was introduced in `Clang 13`__. Without it, the error from compiling bpf selftests looks like: .. code-block:: console libbpf: failed to find BTF for extern 'tcp_slow_start' [25] section: -2 __ https://reviews.llvm.org/D93563 > -Tom > > > > >> Thanks, > >> Tom > >> > >>>> > >>>>> > >>>>> Thanks, > >>>>> Tom > >>>>> > >>>> > >>> > >> > > >