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=-8.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 B658BC433DF for ; Thu, 11 Jun 2020 10:52:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8725820801 for ; Thu, 11 Jun 2020 10:52:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=kroah.com header.i=@kroah.com header.b="pLtP1Eie"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="FXcdkL6g" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727097AbgFKKwJ (ORCPT ); Thu, 11 Jun 2020 06:52:09 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:57717 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726995AbgFKKwH (ORCPT ); Thu, 11 Jun 2020 06:52:07 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id CAC3E5C00DE; Thu, 11 Jun 2020 06:52:06 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 11 Jun 2020 06:52:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kroah.com; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=hFixsBB4fRrJtbpr+200c7FS6ZE e/kugxM+bJ6/yTEI=; b=pLtP1EiekFwYm9vY0vAivtJgw1XrxlQhbVht+6Ek/p+ WINXG4E+6fOy8P2due999w/VaU+zk/hwlGkCraJfE6LppM/TBeyjHfr8NyAtLNyj QfJCeA0QI9YrUSIzO4yUwoIDPgbySKgZ2zp9ivlcUlVcidQvoyXm17tzpmCCzA7q l69e6fANcyxVBWdArt1srhkALoIo4v/qI9YBhFbAVzezreSV05h57/RHeWgJRP1A 1bREtGWilzVx2oJENiymuW1vn5BjgE6asV7/SrkxyEOkl7xT//6mCpciBXJnNxl1 uyttuslyJt5MGgksfb0kV31TTk8QwKILCM4Osj/GaAw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=hFixsB B4fRrJtbpr+200c7FS6ZEe/kugxM+bJ6/yTEI=; b=FXcdkL6gyxwQUehM5dPZM/ puFxW4inLc2P144enkJ3gYITiObP3bn30XyKlSymhHOdceB3+kXObdBHwBQAqNNE z+3iJvwtbzhExI6q0o2xLQNNifXoa9IvGe2a0wJ2E7dHV+scAid+JOa7luK6p0il a8KtOEkw62g6xVRljjqjMmn9yYptAUrdfBXoOYBD7PxpdFopsa5N0vHdaUr7CiJ6 23RXZcuYXVEcGPMTofdbmi4Y7Mu0XtbjgYmX3sCqD/iiEDxB1MM1WwEoiX0yMBbm cvuAd38zOVtnI+/7OYC/ME2VqAU7O7qABfyKXVclS5LzGMAAz1uemRFw3no+lMgw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudehledgtdejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpefirhgvghcu mffjuceoghhrvghgsehkrhhorghhrdgtohhmqeenucggtffrrghtthgvrhhnpefhuedtfe ffgeefueevvdfgfeekudefleduveetfeehjedtkefhffejuddvveehfeenucffohhmrghi nhepghhithhhuhgsrdgtohhmpdhkvghrnhgvlhdrohhrghenucfkphepkeefrdekiedrke elrddutdejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhho mhepghhrvghgsehkrhhorghhrdgtohhm X-ME-Proxy: Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id 556C4328005E; Thu, 11 Jun 2020 06:52:05 -0400 (EDT) Date: Thu, 11 Jun 2020 12:51:58 +0200 From: Greg KH To: Maria Teguiani Cc: stable@vger.kernel.org, kernel-team@android.com, Fangrui Song , Nathan Chancellor , Daniel Borkmann , Stanislav Fomichev , Andrii Nakryiko , Kees Cook , Michael Ellerman Subject: Re: [PATCH] bpf: Support llvm-objcopy for vmlinux BTF Message-ID: <20200611105158.GA3802953@kroah.com> References: <20200608133959.97810-1-teguiani@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200608133959.97810-1-teguiani@google.com> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Mon, Jun 08, 2020 at 01:39:59PM +0000, Maria Teguiani wrote: > From: Fangrui Song > > Simplify gen_btf logic to make it work with llvm-objcopy. The existing > 'file format' and 'architecture' parsing logic is brittle and does not > work with llvm-objcopy/llvm-objdump. > > 'file format' output of llvm-objdump>=11 will match GNU objdump, but > 'architecture' (bfdarch) may not. > > .BTF in .tmp_vmlinux.btf is non-SHF_ALLOC. Add the SHF_ALLOC flag > because it is part of vmlinux image used for introspection. C code > can reference the section via linker script defined __start_BTF and > __stop_BTF. This fixes a small problem that previous .BTF had the > SHF_WRITE flag (objcopy -I binary -O elf* synthesized .data). > > Additionally, `objcopy -I binary` synthesized symbols > _binary__btf_vmlinux_bin_start and _binary__btf_vmlinux_bin_stop (not > used elsewhere) are replaced with more commonplace __start_BTF and > __stop_BTF. > > Add 2>/dev/null because GNU objcopy (but not llvm-objcopy) warns > "empty loadable segment detected at vaddr=0xffffffff81000000, is this intentional?" > > We use a dd command to change the e_type field in the ELF header from > ET_EXEC to ET_REL so that lld will accept .btf.vmlinux.bin.o. Accepting > ET_EXEC as an input file is an extremely rare GNU ld feature that lld > does not intend to support, because this is error-prone. > > The output section description .BTF in include/asm-generic/vmlinux.lds.h > avoids potential subtle orphan section placement issues and suppresses > --orphan-handling=warn warnings. > > Fixes: df786c9b9476 ("bpf: Force .BTF section start to zero when dumping from vmlinux") > Fixes: cb0cc635c7a9 ("powerpc: Include .BTF section") > Reported-by: Nathan Chancellor > Signed-off-by: Fangrui Song > Signed-off-by: Daniel Borkmann > Tested-by: Stanislav Fomichev > Tested-by: Andrii Nakryiko > Reviewed-by: Stanislav Fomichev > Reviewed-by: Kees Cook > Acked-by: Andrii Nakryiko > Acked-by: Michael Ellerman (powerpc) > Link: https://github.com/ClangBuiltLinux/linux/issues/871 > Link: https://lore.kernel.org/bpf/20200318222746.173648-1-maskray@google.com > (cherry picked from commit 90ceddcb495008ac8ba7a3dce297841efcd7d584) > Cc: # 5.4.x > Signed-off-by: Maria Teguiani I've also queued this up to the 5.6.y tree, thanks. greg k-h