Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4600155pxu; Tue, 20 Oct 2020 23:54:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnUs2x1NQyPRjPZPJsAxedTT9Ln6mLY9WeEv9X+sg+XAJ/o//y5bdFMR/7vIMUM1id8S+H X-Received: by 2002:a05:6402:782:: with SMTP id d2mr1605730edy.131.1603263291406; Tue, 20 Oct 2020 23:54:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603263291; cv=none; d=google.com; s=arc-20160816; b=EZ5QNk8mxwfcF7ERJOCDQgBZXyYAqSp9AKzWD4jCtFaOO3sVtyZRoLLeSqDQDeCSYJ LSKS/Jlv+A3Hxk+vJA8PHSt5xTmZNQI+pfWWxNfG9rSdfm2D6oxPEi2Wap+XyxpgBm5B 1GxQ6g/Z1GJd1Zc/L5WM2L8nk5DE6LArxNRtZfJuTD1fYiNPbp5YU6vREov4IjYMBesv /2UL7ia+vU0k4x3ubodLuHeSaJj1Ae0WxvOm3upO6HYLIzJteCkNowaLr7VszoQlOehb q7saFrL/UcLdF1xDwqpB7pXFMEqNNBYnIJWIS81P9gIIiq2YW0mSqU2j/5QaB8332zGV r0EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=QfVexZ2EgTTCM/Ez7NNYUHMSo/X05yXMg16LPX8qpHk=; b=fxxqGiVKUVyjuzOPIRAQz0hl1NPIyWvB+PZUDNQoibIuoULnTQLshf9SGo5+G9ZCYB rrpHCFZ6w0gIzWrkmbIgplG+PqmovaSSrwqaCDXeIKv0SCIvNkDe/qJfPGuzV3Kt9hxl FTFE9krFssO6b3RCYTJpzSWrGimO3tN/lf3YFyry8JtdyBrpAL/uPMbY7jdOMtv63a3F CNudqAoscmQhobHKRQCwlc/PyrlYFaCTBO6ru9+wp/XEZkiAUE7q5AnMhgFLTMRRjNnb ny4wNqlRpGTA9T8T1DTg7G/kusEKEBVFEPWE7yaTqdVOH1MrD9Hiu6a/4W7MAa2T/v1E cNYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=O8rxYUWk; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h9si717557edq.358.2020.10.20.23.54.28; Tue, 20 Oct 2020 23:54:51 -0700 (PDT) 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=@google.com header.s=20161025 header.b=O8rxYUWk; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2395269AbgJTRS6 (ORCPT + 99 others); Tue, 20 Oct 2020 13:18:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390624AbgJTRS6 (ORCPT ); Tue, 20 Oct 2020 13:18:58 -0400 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34D90C0613D3 for ; Tue, 20 Oct 2020 10:18:58 -0700 (PDT) Received: by mail-ej1-x641.google.com with SMTP id e22so3903180ejr.4 for ; Tue, 20 Oct 2020 10:18:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=QfVexZ2EgTTCM/Ez7NNYUHMSo/X05yXMg16LPX8qpHk=; b=O8rxYUWkrTbPdGoFLcMct9G13Pwd1tz673lQMyBarZr2YV+YSXuQpCe2eqg/Sr/gTc NyFzeGkEIB8tKWk4w7aJc0aLzArzt2nXQbglvVfpxd9ljFCtywWnP8/V/RrkRVBDOHsJ mdq6W4qL0qqtMf9Y3Tzt7x460kbk7jtQ37IlzNGoK9uqDsk0dtROe8BPghIXvJmIDpIl ET/0aUV1p3DVQR6q80VYuH/JXfoGDMizXuLSOSTDMF1d4QvwZj0y0F7Y+iVgiNJzSzdw F6GA9mjYemFAnLHEmd1AgweTa0sNU3lBCgAod3zaLS5Ct811+8a6ZGTxq3CnxchGYz5R AC9g== 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=QfVexZ2EgTTCM/Ez7NNYUHMSo/X05yXMg16LPX8qpHk=; b=rozhb72CXmF3WoT/kTRYoeLvkXeeFjZyE9Yxt9KmQIsmsO4KogA94rJiHxbL9VDndA KYOJdZw0kv4WDAnj3KGMCc7wrL5gr/LZ26wWaAwR7J1GDUhF+bDJjDnNAxua/14ly/7S Xk4SOB/ZgzD1ChrEVPmLuTPmM/Q4bErIXUdiV3m3jRsoZ8HOs20lwmpGaDNPoZnCB+PQ /BgrtxLRp5mS1+PknsGhN287Lj5uEScF3kw3shidRgYJ9XkC8V5WZvL0AHJcD81r5MwR H5L/gkpu52rzFwDYT0fJwIKDGBWEFPYNOcgVXw6KQHpNaN1oPiwT6iV9kw3MwibLQB63 yg6A== X-Gm-Message-State: AOAM533MNP//OYG+SeK/PYq6wJdOUHCfVUCssNrEkIEMu5L9Mgc6yYt8 Qi6C9Bguj50DX8ACrCVM3t3AKN2yLupPuIsVPXhPtw== X-Received: by 2002:a17:906:3541:: with SMTP id s1mr4355222eja.413.1603214336466; Tue, 20 Oct 2020 10:18:56 -0700 (PDT) MIME-Version: 1.0 References: <82b757bb-1f49-ab02-2f4b-89577d56fec9@kernel.org> <20201020122015.GH2294271@kernel.org> In-Reply-To: From: Hao Luo Date: Tue, 20 Oct 2020 10:18:45 -0700 Message-ID: Subject: Re: Segfault in pahole 1.18 when building kernel 5.9.1 for arm64 To: Andrii Nakryiko Cc: Arnaldo Carvalho de Melo , Jiri Slaby , =?UTF-8?B?w4lyaWNvIFJvbGlt?= , dwarves@vger.kernel.org, open list , Arnaldo Carvalho de Melo , Andrii Nakryiko , Alexei Starovoitov , bpf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 20, 2020 at 10:10 AM Andrii Nakryiko wrote: > > On Tue, Oct 20, 2020 at 10:05 AM Hao Luo wrote: > > > > Thanks for reporting this and cc'ing me. I forgot to update the error > > messages when renaming the flags. I will send a patch to fix the error > > message. > > > > The commit > > > > commit f3d9054ba8ff1df0fc44e507e3a01c0964cabd42 > > Author: Hao Luo > > AuthorDate: Wed Jul 8 13:44:10 2020 -0700 > > > > btf_encoder: Teach pahole to store percpu variables in vmlinux BTF= . > > > > encodes kernel global variables into BTF so that bpf programs can > > directly access them. If there is no need to access kernel global > > variables, it's perfectly fine to use '--btf_encode_force' to skip > > encoding bad symbols into BTF, or '--skip_encoding_btf_vars' to skip > > encoding all global vars all together. I will add these info into the > > updated error message. > > > > Also cc bpf folks for attention of this bug. > > I've already fixed the message as part of > 2e719cca6672 ("btf_encoder: revamp how per-CPU variables are encoded") > Ah, that's awesome! Thanks for fixing this, Andrii. I haven't got time to take a look at your patches last week, I will try to look at it ASAP. > It's currently still in the tmp.libbtf_encoder branch in pahole repo. > > > > > Hao > > > > On Tue, Oct 20, 2020 at 5:20 AM Arnaldo Carvalho de Melo > > wrote: > > > > > > Em Tue, Oct 20, 2020 at 11:01:39AM +0200, Jiri Slaby escreveu: > > > > Hi, > > > > > > > > On 19. 10. 20, 1:18, =C3=89rico Rolim wrote: > > > > > I'm trying to build kernel 5.9.1 for arm64, and my dotconfig has > > > > > `CONFIG_DEBUG_INFO_BTF=3Dy`, which requires pahole for building. = However, pahole > > > > > version 1.18 segfaults during the build, as can be seen below: > > > > > > > > > > PAHOLE: Error: Found symbol of zero size when encoding btf (sym: > > > > > '__kvm_nvhe_arm64_ssbd_callback_required', cu: > > > > > 'arch/arm64/kernel/cpu_errata.c'). > > > > > > > > The symbol is an alias coming from arch/arm64/kernel/vmlinux.lds: > > > > __kvm_nvhe_arm64_ssbd_callback_required =3D arm64_ssbd_callback_req= uired;; > > > > > > > > > PAHOLE: Error: Use '-j' or '--force' to ignore such symbols and f= orce > > > > > emit the btf. > > > > > scripts/link-vmlinux.sh: line 141: 43837 Segmentation fault > > > > > LLVM_OBJCOPY=3D${OBJCOPY} ${PAHOLE} -J ${1} > > > > > LD .tmp_vmlinux.kallsyms1 > > > > > KSYM .tmp_vmlinux.kallsyms1.o > > > > > LD .tmp_vmlinux.kallsyms2 > > > > > KSYM .tmp_vmlinux.kallsyms2.o > > > > > LD vmlinux > > > > > BTFIDS vmlinux > > > > > FAILED: load BTF from vmlinux: Unknown error -2make: *** > > > > > [Makefile:1162: vmlinux] Error 255 > > > > > > > > > > It is possible to force the build to continue if > > > > > > > > > > LLVM_OBJCOPY=3D${OBJCOPY} ${PAHOLE} -J ${1} > > > > > > > > > > in scripts/link-vmlinux.sh is changed to > > > > > > > > > > LLVM_OBJCOPY=3D${OBJCOPY} ${PAHOLE} -J --btf_encode_force ${1} > > > > > > > > > > The suggested `-j` or `--force` flags don't exist, since they wer= e removed in > > > > > [1]. I believe `--btf_encode_force` should be suggested instead. > > > > > > > > Agreed, '--btf_encode_force' makes pahole to proceed without crashe= s. > > > > > > > > > It should be noted that the same build, but with pahole version 1= .17, works > > > > > without issue, so I think this is either a regression in pahole o= r the script > > > > > will need to be changed for newer versions of pahole. > > > > > > > > Yeah, I observe the very same. I reported it at: > > > > https://bugzilla.suse.com/show_bug.cgi?id=3D1177921 > > > > > > Would it be possible to try with > > > https://git.kernel.org/pub/scm/devel/pahole/pahole.git/commit/?h=3Dtm= p.libbtf_encoder > > > ? > > > > > > This switches to using libbpf for the BTF encoder and may have fixed > > > this problem. > > > > > > - Arnaldo > > > > > [...] > > > > > > > > > > > > > I suspect: > > > > commit f3d9054ba8ff1df0fc44e507e3a01c0964cabd42 > > > > Author: Hao Luo > > > > AuthorDate: Wed Jul 8 13:44:10 2020 -0700 > > > > > > > > btf_encoder: Teach pahole to store percpu variables in vmlinux = BTF. > > > > > > > > > > > > Which added this machinery (btf_elf__add_datasec_type in particular= ). > > > > > > > > > - [1] https://git.kernel.org/pub/scm/devel/pahole/pahole.git/comm= it/pahole.c?h=3Dv1.18&id=3D1abc001417b579b86a9b27ff88c9095d8f498a46 > > > > > > > > > > Thanks, > > > > > =C3=89rico > > > > > > > > > > > > > > > > > -- > > > > js > > > > suse labs > > > > > > -- > > > > > > - Arnaldo