[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzbQBNnNV2rGOJHUs1Yh2Njqu5bEtB_DsgF9AOruGorKHg@mail.gmail.com>
Date: Mon, 15 Jun 2020 12:11:22 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Hao Luo <haoluo@...gle.com>
Cc: Andrii Nakryiko <andriin@...com>, bpf <bpf@...r.kernel.org>,
Networking <netdev@...r.kernel.org>,
Alexei Starovoitov <ast@...com>,
Daniel Borkmann <daniel@...earbox.net>,
Kernel Team <kernel-team@...com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Song Liu <songliubraving@...com>,
Quentin Monnet <quentin@...valent.com>
Subject: Re: [RFC PATCH bpf-next 3/8] selftests/bpf: add __ksym extern selftest
On Mon, Jun 15, 2020 at 9:45 AM Hao Luo <haoluo@...gle.com> wrote:
>
> Andrii, a couple of general comments on fixed_percpu_data.
>
> I think it would be better to check the existence of fixed_percpu_data in kallsyms first. If it's not there, just skip, or maybe warn but not fail.
fixed_percpu_data is always there, but I missed the fact that it's
x86-specific one. I'll switch to some bpf-specific symbol (e.g., like
bpf_prog_fops or something along those lines).
>
> Further, if we really want to be sure that fixed_percpu_data is the first percpu var, we can read the value of __per_cpu_start, which marks the beginning address of the percpu section. Checking the address of fixed_percpu_data against __per_cpu_start rather than 0 should be more robust, I think, given that fixed_percpu_data exists.
There are assertions in Linux sources that fixed_percpu_data is 0, so
I don't think that it necessary. But it's a moot point, as I'll use
something less x86-specific.
>
> Hao
>
> On Fri, Jun 12, 2020 at 3:35 PM Andrii Nakryiko <andriin@...com> wrote:
>>
>> Validate libbpf is able to handle weak and strong kernel symbol externs in BPF
>> code correctly.
>>
>> Signed-off-by: Andrii Nakryiko <andriin@...com>
>> ---
>> .../testing/selftests/bpf/prog_tests/ksyms.c | 71 +++++++++++++++++++
>> .../testing/selftests/bpf/progs/test_ksyms.c | 32 +++++++++
>> 2 files changed, 103 insertions(+)
>> create mode 100644 tools/testing/selftests/bpf/prog_tests/ksyms.c
>> create mode 100644 tools/testing/selftests/bpf/progs/test_ksyms.c
>>
[...]
Powered by blists - more mailing lists