bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: Stanislav Fomichev <sdf@google.com>,
	netdev@vger.kernel.org, bpf@vger.kernel.org
Cc: davem@davemloft.net, ast@kernel.org, daniel@iogearbox.net,
	Stanislav Fomichev <sdf@google.com>,
	Andrii Nakryiko <andriin@fb.com>
Subject: RE: [PATCH bpf] bpf: force .BTF section start to zero when dumping from vmlinux
Date: Wed, 27 Nov 2019 20:37:07 -0800	[thread overview]
Message-ID: <5ddf4ef366a69_3c082aca725cc5bcbb@john-XPS-13-9370.notmuch> (raw)
In-Reply-To: <20191127225759.39923-1-sdf@google.com>

Stanislav Fomichev wrote:
> While trying to figure out why fentry_fexit selftest doesn't pass for me
> (old pahole, broken BTF), I found out that my latest patch can break vmlinux
> .BTF generation. objcopy preserves section start when doing --only-section,
> so there is a chance (depending on where pahole inserts .BTF section) to
> have leading empty zeroes. Let's explicitly force section offset to zero.
> 
> Before:
> $ objcopy --set-section-flags .BTF=alloc -O binary \
> 	--only-section=.BTF vmlinux .btf.vmlinux.bin
> $ xxd .btf.vmlinux.bin | head -n1
> 00000000: 0000 0000 0000 0000 0000 0000 0000 0000  ................
> 
> After:
> $ objcopy --change-section-address .BTF=0 \
> 	--set-section-flags .BTF=alloc -O binary \
> 	--only-section=.BTF vmlinux .btf.vmlinux.bin
> $ xxd .btf.vmlinux.bin | head -n1
> 00000000: 9feb 0100 1800 0000 0000 0000 80e1 1c00  ................
>           ^BTF magic
> 
> As part of this change, I'm also dropping '2>/dev/null' from objcopy
> invocation to be able to catch possible other issues (objcopy doesn't
> produce any warnings for me anymore, it did before with --dump-section).

Agree dropping /dev/null seems like a good choice. Otherwise seems reasonable
to me.

Acked-by: John Fastabend <john.fastabend@gmail.com>

  reply	other threads:[~2019-11-28  4:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-27 22:57 [PATCH bpf] bpf: force .BTF section start to zero when dumping from vmlinux Stanislav Fomichev
2019-11-28  4:37 ` John Fastabend [this message]
2019-11-29 15:16   ` Daniel Borkmann

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=5ddf4ef366a69_3c082aca725cc5bcbb@john-XPS-13-9370.notmuch \
    --to=john.fastabend@gmail.com \
    --cc=andriin@fb.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=sdf@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).