<feed xmlns='http://www.w3.org/2005/Atom'>
<title>lwn.git/samples/bpf/bpf_load.c, branch v5.14</title>
<subtitle>Linux kernel documentation tree maintained by Jonathan Corbet</subtitle>
<id>http://mirrors.hust.edu.cn/git/lwn.git/atom?h=v5.14</id>
<link rel='self' href='http://mirrors.hust.edu.cn/git/lwn.git/atom?h=v5.14'/>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/'/>
<updated>2020-11-27T03:33:36+00:00</updated>
<entry>
<title>samples: bpf: Remove bpf_load loader completely</title>
<updated>2020-11-27T03:33:36+00:00</updated>
<author>
<name>Daniel T. Lee</name>
<email>danieltimlee@gmail.com</email>
</author>
<published>2020-11-24T09:03:10+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=ceb5dea5654354fb4e6e393c99f1d0bf4debab0e'/>
<id>urn:sha1:ceb5dea5654354fb4e6e393c99f1d0bf4debab0e</id>
<content type='text'>
Numerous refactoring that rewrites BPF programs written with bpf_load
to use the libbpf loader was finally completed, resulting in BPF
programs using bpf_load within the kernel being completely no longer
present.

This commit removes bpf_load, an outdated bpf loader that is difficult
to keep up with the latest kernel BPF and causes confusion.

Also, this commit removes the unused trace_helper and bpf_load from
samples/bpf target objects from Makefile.

Signed-off-by: Daniel T. Lee &lt;danieltimlee@gmail.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Jesper Dangaard Brouer &lt;brouer@redhat.com&gt;
Acked-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20201124090310.24374-8-danieltimlee@gmail.com
</content>
</entry>
<entry>
<title>samples, bpf: Move read_trace_pipe to trace_helpers</title>
<updated>2020-03-23T21:27:51+00:00</updated>
<author>
<name>Daniel T. Lee</name>
<email>danieltimlee@gmail.com</email>
</author>
<published>2020-03-21T10:04:23+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=24a6034acc922f1f6292636be4ec4dc3d9b4d2d7'/>
<id>urn:sha1:24a6034acc922f1f6292636be4ec4dc3d9b4d2d7</id>
<content type='text'>
To reduce the reliance of trace samples (trace*_user) on bpf_load,
move read_trace_pipe to trace_helpers. By moving this bpf_loader helper
elsewhere, trace functions can be easily migrated to libbbpf.

Signed-off-by: Daniel T. Lee &lt;danieltimlee@gmail.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Link: https://lore.kernel.org/bpf/20200321100424.1593964-2-danieltimlee@gmail.com
</content>
</entry>
<entry>
<title>Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net</title>
<updated>2019-06-18T03:20:36+00:00</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2019-06-18T02:48:13+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=13091aa30535b719e269f20a7bc34002bf5afae5'/>
<id>urn:sha1:13091aa30535b719e269f20a7bc34002bf5afae5</id>
<content type='text'>
Honestly all the conflicts were simple overlapping changes,
nothing really interesting to report.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>samples/bpf: fix a couple of style issues in bpf_load</title>
<updated>2019-05-28T09:10:37+00:00</updated>
<author>
<name>Daniel T. Lee</name>
<email>danieltimlee@gmail.com</email>
</author>
<published>2019-05-23T07:24:48+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=37b54aed123faa19eb21d7ef2534756c5a152a7c'/>
<id>urn:sha1:37b54aed123faa19eb21d7ef2534756c5a152a7c</id>
<content type='text'>
This commit fixes a few style problems in samples/bpf/bpf_load.c:

 - Magic string use of 'DEBUGFS'
 - Useless zero initialization of a global variable
 - Minor style fix with whitespace

Signed-off-by: Daniel T. Lee &lt;danieltimlee@gmail.com&gt;
Acked-by: Yonghong Song &lt;yhs@fb.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>samples, bpf: fix to change the buffer size for read()</title>
<updated>2019-05-21T14:36:48+00:00</updated>
<author>
<name>Chang-Hsien Tsai</name>
<email>luke.tw@gmail.com</email>
</author>
<published>2019-05-19T09:05:44+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=f7c2d64bac1be2ff32f8e4f500c6e5429c1003e0'/>
<id>urn:sha1:f7c2d64bac1be2ff32f8e4f500c6e5429c1003e0</id>
<content type='text'>
If the trace for read is larger than 4096, the return
value sz will be 4096. This results in off-by-one error
on buf:

    static char buf[4096];
    ssize_t sz;

    sz = read(trace_fd, buf, sizeof(buf));
    if (sz &gt; 0) {
        buf[sz] = 0;
        puts(buf);
    }

Signed-off-by: Chang-Hsien Tsai &lt;luke.tw@gmail.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>samples: bpf: fix: seg fault with NULL pointer arg</title>
<updated>2018-12-03T22:58:03+00:00</updated>
<author>
<name>Daniel T. Lee</name>
<email>danieltimlee@gmail.com</email>
</author>
<published>2018-12-03T10:39:30+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=d59dd69d5576d699d7d3f5da0b4738c3a36d0133'/>
<id>urn:sha1:d59dd69d5576d699d7d3f5da0b4738c3a36d0133</id>
<content type='text'>
When NULL pointer accidentally passed to write_kprobe_events,
due to strlen(NULL), segmentation fault happens.
Changed code returns -1 to deal with this situation.

Bug issued with Smatch, static analysis.

Signed-off-by: Daniel T. Lee &lt;danieltimlee@gmail.com&gt;
Acked-by: Song Liu &lt;songliubraving@fb.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>samples: bpf: fix: error handling regarding kprobe_events</title>
<updated>2018-11-23T21:39:09+00:00</updated>
<author>
<name>Daniel T. Lee</name>
<email>danieltimlee@gmail.com</email>
</author>
<published>2018-11-22T22:14:32+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=5a863813216ce79e16a8c1503b2543c528b778b6'/>
<id>urn:sha1:5a863813216ce79e16a8c1503b2543c528b778b6</id>
<content type='text'>
Currently, kprobe_events failure won't be handled properly.
Due to calling system() indirectly to write to kprobe_events,
it can't be identified whether an error is derived from kprobe or system.

    // buf = "echo '%c:%s %s' &gt;&gt; /s/k/d/t/kprobe_events"
    err = system(buf);
    if (err &lt; 0) {
        printf("failed to create kprobe ..");
        return -1;
    }

For example, running ./tracex7 sample in ext4 partition,
"echo p:open_ctree open_ctree &gt;&gt; /s/k/d/t/kprobe_events"
gets 256 error code system() failure.
=&gt; The error comes from kprobe, but it's not handled correctly.

According to man of system(3), it's return value
just passes the termination status of the child shell
rather than treating the error as -1. (don't care success)

Which means, currently it's not working as desired.
(According to the upper code snippet)

    ex) running ./tracex7 with ext4 env.
    # Current Output
    sh: echo: I/O error
    failed to open event open_ctree

    # Desired Output
    failed to create kprobe 'open_ctree' error 'No such file or directory'

The problem is, error can't be verified whether from child ps
or system. But using write() directly can verify the command
failure, and it will treat all error as -1. So I suggest using
write() directly to 'kprobe_events' rather than calling system().

Signed-off-by: Daniel T. Lee &lt;danieltimlee@gmail.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>bpf_load: add map name to load_maps error message</title>
<updated>2018-11-07T21:34:54+00:00</updated>
<author>
<name>Shannon Nelson</name>
<email>shannon.nelson@oracle.com</email>
</author>
<published>2018-10-29T21:14:41+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=bce6a14996f991e570d973179b5ff57544efaa9a'/>
<id>urn:sha1:bce6a14996f991e570d973179b5ff57544efaa9a</id>
<content type='text'>
To help when debugging bpf/xdp load issues, have the load_map()
error message include the number and name of the map that
failed.

Signed-off-by: Shannon Nelson &lt;shannon.nelson@oracle.com&gt;
Acked-by: John Fastabend &lt;john.fastabend@gmail.com&gt;
Acked-by: Song Liu &lt;songliubraving@fb.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>samples/bpf: remove duplicated includes</title>
<updated>2018-09-18T15:49:33+00:00</updated>
<author>
<name>YueHaibing</name>
<email>yuehaibing@huawei.com</email>
</author>
<published>2018-09-18T01:45:34+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=664e7878451f62389b273e204ae8866c85ef1456'/>
<id>urn:sha1:664e7878451f62389b273e204ae8866c85ef1456</id>
<content type='text'>
Remove duplicated includes.

Signed-off-by: YueHaibing &lt;yuehaibing@huawei.com&gt;
Acked-by: Yonghong Song &lt;yhs@fb.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>samples: bpf: ensure that we don't load over MAX_PROGS programs</title>
<updated>2018-07-16T22:00:56+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2018-07-13T15:11:39+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=b0294bc1ad19e9d2dd03df5faa1ccc395d4ddd4b'/>
<id>urn:sha1:b0294bc1ad19e9d2dd03df5faa1ccc395d4ddd4b</id>
<content type='text'>
I can't see that we check prog_cnt to ensure it doesn't go over
MAX_PROGS.

Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
</feed>
