All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Maria Teguiani <teguiani@google.com>
Cc: stable@vger.kernel.org, kernel-team@android.com,
	Fangrui Song <maskray@google.com>,
	Nathan Chancellor <natechancellor@gmail.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Stanislav Fomichev <sdf@google.com>,
	Andrii Nakryiko <andriin@fb.com>,
	Kees Cook <keescook@chromium.org>,
	Michael Ellerman <mpe@ellerman.id.au>
Subject: Re: [PATCH] bpf: Support llvm-objcopy for vmlinux BTF
Date: Thu, 11 Jun 2020 12:51:58 +0200	[thread overview]
Message-ID: <20200611105158.GA3802953@kroah.com> (raw)
In-Reply-To: <20200608133959.97810-1-teguiani@google.com>

On Mon, Jun 08, 2020 at 01:39:59PM +0000, Maria Teguiani wrote:
> From: Fangrui Song <maskray@google.com>
> 
> 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 <natechancellor@gmail.com>
> Signed-off-by: Fangrui Song <maskray@google.com>
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
> Tested-by: Stanislav Fomichev <sdf@google.com>
> Tested-by: Andrii Nakryiko <andriin@fb.com>
> Reviewed-by: Stanislav Fomichev <sdf@google.com>
> Reviewed-by: Kees Cook <keescook@chromium.org>
> Acked-by: Andrii Nakryiko <andriin@fb.com>
> Acked-by: Michael Ellerman <mpe@ellerman.id.au> (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: <stable@vger.kernel.org> # 5.4.x
> Signed-off-by: Maria Teguiani <teguiani@google.com>

I've also queued this up to the 5.6.y tree, thanks.

greg k-h

      parent reply	other threads:[~2020-06-11 10:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-08 13:39 [PATCH] bpf: Support llvm-objcopy for vmlinux BTF Maria Teguiani
2020-06-11  7:13 ` Matthias Maennich
2020-06-11 10:51 ` Greg KH [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200611105158.GA3802953@kroah.com \
    --to=greg@kroah.com \
    --cc=andriin@fb.com \
    --cc=daniel@iogearbox.net \
    --cc=keescook@chromium.org \
    --cc=kernel-team@android.com \
    --cc=maskray@google.com \
    --cc=mpe@ellerman.id.au \
    --cc=natechancellor@gmail.com \
    --cc=sdf@google.com \
    --cc=stable@vger.kernel.org \
    --cc=teguiani@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.