lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 02 Jan 2020 15:13:15 +0100
From:   "Eelco Chaudron" <echaudro@...hat.com>
To:     "Andrii Nakryiko" <andrii.nakryiko@...il.com>
Cc:     bpf <bpf@...r.kernel.org>, "David S. Miller" <davem@...emloft.net>,
        "Alexei Starovoitov" <ast@...nel.org>,
        Networking <netdev@...r.kernel.org>
Subject: Re: [PATCH bpf-next] selftests/bpf: Add a test for attaching a bpf
 fentry/fexit trace to an XDP program



On 20 Dec 2019, at 0:02, Andrii Nakryiko wrote:

> On Thu, Dec 19, 2019 at 3:04 AM Eelco Chaudron <echaudro@...hat.com> 
> wrote:
>>
>> Add a test that will attach a FENTRY and FEXIT program to the XDP 
>> test
>> program. It will also verify data from the XDP context on FENTRY and
>> verifies the return code on exit.
>>
>> Signed-off-by: Eelco Chaudron <echaudro@...hat.com>
>> ---
>>  .../testing/selftests/bpf/prog_tests/xdp_bpf2bpf.c |   95 
>> ++++++++++++++++++++
>>  .../testing/selftests/bpf/progs/test_xdp_bpf2bpf.c |   44 +++++++++
>>  2 files changed, 139 insertions(+)
>>  create mode 100644 
>> tools/testing/selftests/bpf/prog_tests/xdp_bpf2bpf.c
>>  create mode 100644 
>> tools/testing/selftests/bpf/progs/test_xdp_bpf2bpf.c
>>
>
> [...]
>
>> +       /* Load XDP program to introspect */
>> +       err = bpf_prog_load(file, BPF_PROG_TYPE_XDP, &obj, &prog_fd);
>
> Please use BPF skeleton for this test. It will make it significantly
> shorter and clearer. See other fentry_fexit selftest for example.
>

Trying to do this, however, I’m getting the following when trying to 
execute the test:

test_xdp_bpf2bpf:PASS:pkt_skel_load 0 nsec
libbpf: fentry/_xdp_tx_iptunnel is not found in vmlinux BTF
libbpf: failed to load object 'test_xdp_bpf2bpf'
libbpf: failed to load BPF skeleton 'test_xdp_bpf2bpf': -2
test_xdp_bpf2bpf:FAIL:ftrace_skel_load ftrace skeleton failed


My program is straight forward following the fentry_fexit.c example:

     pkt_skel = test_xdp__open_and_load();
     if (CHECK(!pkt_skel, "pkt_skel_load", "test_xdp skeleton 
failed\n"))
         return;

     map_fd = bpf_map__fd(pkt_skel->maps.vip2tnl);
     bpf_map_update_elem(map_fd, &key4, &value4, 0);

     /* Load eBPF trace program */
     ftrace_skel = test_xdp_bpf2bpf__open_and_load();
     if (CHECK(!ftrace_skel, "ftrace_skel_load", "ftrace skeleton 
failed\n"))
         goto out;

I assume this is due to the missing link from the XDP program to the 
eBPF trace program.
Previously I did this trough:

+	DECLARE_LIBBPF_OPTS(bpf_object_open_opts, opts,
+			    .attach_prog_fd = prog_fd,
+			   );
+
+	tracer_obj = bpf_object__open_file("./test_xdp_bpf2bpf.o", &opts);


If I use this approach as before it works, i.e.:

         DECLARE_LIBBPF_OPTS(bpf_object_open_opts, opts,
                             .attach_prog_fd = pkt_fd,
                            );

         ftrace_skel = test_xdp_bpf2bpf__open_opts(&opts);
         if (CHECK(!ftrace_skel, "__open_opts”, "ftrace skeleton 
failed\n"))
           goto out;
         if (CHECK(test_xdp_bpf2bpf__load(ftrace_skel), "__load", 
"ftrace skeleton failed\n"))
           goto out;

But I do not see this in the fentry_fexit.c example, guess I might be 
missing something that is right in front of me :(


[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ