From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Wang Nan <wangnan0@huawei.com>
Cc: ast@kernel.org, acme@kernel.org, linux-kernel@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Daniel Borkmann <daniel@iogearbox.net>,
Li Zefan <lizefan@huawei.com>,
pi3orama@163.com
Subject: Re: [PATCH 2/2] perf bpf: Check relocation target section
Date: Fri, 22 Jan 2016 09:11:03 -0800 [thread overview]
Message-ID: <20160122171102.GB9608@ast-mbp.thefacebook.com> (raw)
In-Reply-To: <1453454841-232334-3-git-send-email-wangnan0@huawei.com>
On Fri, Jan 22, 2016 at 09:27:21AM +0000, Wang Nan wrote:
> Libbpf should check target section before doing relocation to ensure
> the relocation is correct. If not, a bug in LLVM causes error. See [1].
> Also, if an incorrect BPF script uses both global variable and
> map, global variable whould be treated as map and be relocated
> without error.
>
> This patch saves id of map section into obj->efile and compare
> target section of a relocation symbol against it during relocation.
...
> [1] https://llvm.org/bugs/show_bug.cgi?id=26243
...
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
>
> + if (sym.st_shndx != maps_shndx) {
> + pr_warning("Program '%s' contains non-map related relo data pointing to section %u\n",
> + prog->section_name, sym.st_shndx);
> + return -LIBBPF_ERRNO__RELOC;
> + }
May be 'pr_err' instead of 'pr_warning', since such program will fail
to load by kernel anyway. Looks good otherwise.
Acked-by: Alexei Starovoitov <ast@kernel.org>
next prev parent reply other threads:[~2016-01-22 17:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-22 9:27 [PATCH 0/2] perf bpf: Fix relocation error Wang Nan
2016-01-22 9:27 ` [PATCH 1/2] perf test: Add libbpf relocation checker Wang Nan
2016-01-22 15:40 ` Arnaldo Carvalho de Melo
2016-01-22 17:07 ` Alexei Starovoitov
2016-01-22 17:22 ` clang --target=bpf missing on f23 was: " Arnaldo Carvalho de Melo
2016-01-22 17:35 ` Adam Jackson
2016-01-22 17:42 ` Alexei Starovoitov
2016-01-22 21:09 ` David Airlie
2016-01-22 17:56 ` Daniel Borkmann
2016-01-22 19:09 ` Arnaldo Carvalho de Melo
2016-01-22 9:27 ` [PATCH 2/2] perf bpf: Check relocation target section Wang Nan
2016-01-22 17:11 ` Alexei Starovoitov [this message]
2016-01-25 1:56 ` Wangnan (F)
2016-01-25 2:04 ` Wangnan (F)
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=20160122171102.GB9608@ast-mbp.thefacebook.com \
--to=alexei.starovoitov@gmail.com \
--cc=acme@kernel.org \
--cc=acme@redhat.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=pi3orama@163.com \
--cc=wangnan0@huawei.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
all inboxes | Powered by JetHome®