<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/tools/net/bpf_dbg.c, branch linux-4.14.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.14.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.14.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2018-06-20T19:02:49Z</updated>
<entry>
<title>bpf: fix uninitialized variable in bpf tools</title>
<updated>2018-06-20T19:02:49Z</updated>
<author>
<name>John Fastabend</name>
</author>
<published>2018-04-25T22:08:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=40d526e672125a75342b779a9305b64f8792e1b0'/>
<id>urn:sha1:40d526e672125a75342b779a9305b64f8792e1b0</id>
<content type='text'>
[ Upstream commit 815425567dea6c54494e85050631d6bdda907c5d ]

Here the variable cont is used as the saved_pointer for a call to
strtok_r(). It is safe to use the value uninitialized in this
context however and the later reference is only ever used if
the strtok_r is successful. But, 'gcc-5' at least doesn't have all
this knowledge so initialize cont to NULL. Additionally, do the
natural NULL check before accessing just for completness.

The warning is the following:

./bpf/tools/bpf/bpf_dbg.c: In function ‘cmd_load’:
./bpf/tools/bpf/bpf_dbg.c:1077:13: warning: ‘cont’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  } else if (matches(subcmd, "pcap") == 0) {

Fixes: fd981e3c321a "filter: bpf_dbg: add minimal bpf debugger"
Signed-off-by: John Fastabend &lt;john.fastabend@gmail.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>bpf_dbg: do not initialise statics to 0</title>
<updated>2016-02-11T09:24:45Z</updated>
<author>
<name>Wei Tang</name>
</author>
<published>2016-02-04T09:36:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1490d2bd1bbcf9ad127f7764b7f28b26a55e011b'/>
<id>urn:sha1:1490d2bd1bbcf9ad127f7764b7f28b26a55e011b</id>
<content type='text'>
This patch fixes the checkpatch.pl error to bpf_dbg.c:

ERROR: do not initialise statics to 0

Signed-off-by: Wei Tang &lt;tangwei@cmss.chinamobile.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>bpf_dbg: fix wrong register usage</title>
<updated>2014-04-30T20:12:22Z</updated>
<author>
<name>Brendan Hickey</name>
</author>
<published>2014-04-30T08:24:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e5744fe9d262d11131916d04ea79ea539fe296c0'/>
<id>urn:sha1:e5744fe9d262d11131916d04ea79ea539fe296c0</id>
<content type='text'>
The AND instruction is erroneously using the X register instead
of the K register.

Signed-off-by: Brendan Hickey &lt;bhickey@google.com&gt;
Signed-off-by: Daniel Borkmann &lt;dborkman@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>tools: bpf_dbg: various misc code cleanups</title>
<updated>2014-02-25T00:02:10Z</updated>
<author>
<name>Daniel Borkmann</name>
</author>
<published>2014-02-22T17:37:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7debf7806e0e984ea7e43cc271dc9400b0dffc14'/>
<id>urn:sha1:7debf7806e0e984ea7e43cc271dc9400b0dffc14</id>
<content type='text'>
Lets clean up bpf_dbg a bit and improve its code slightly
in various areas: i) Get rid of some macros as there's no
good reason for keeping them, ii) remove one unused variable
and reduce scope of various variables found by cppcheck,
iii) Close non-default file descriptors when exiting the shell.

Signed-off-by: Daniel Borkmann &lt;dborkman@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>bpf_dbg: always close socket in bpf_runnable</title>
<updated>2013-12-17T22:11:00Z</updated>
<author>
<name>Daniel Borkmann</name>
</author>
<published>2013-12-16T10:45:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8b138da62f3ef370bebaaed7385020993bb787ae'/>
<id>urn:sha1:8b138da62f3ef370bebaaed7385020993bb787ae</id>
<content type='text'>
We must not leave the socket intact in bpf_runnable(). The socket
is used to test if the filter code is being accepted by the kernel
or not. So right after we do the setsockopt(2), we need to close
it again.

Signed-off-by: Daniel Borkmann &lt;dborkman@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>filter: bpf_dbg: add minimal bpf debugger</title>
<updated>2013-12-12T01:28:35Z</updated>
<author>
<name>Daniel Borkmann</name>
</author>
<published>2013-12-11T22:43:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fd981e3c321a7e8661e06fa6077aea89e8228c3a'/>
<id>urn:sha1:fd981e3c321a7e8661e06fa6077aea89e8228c3a</id>
<content type='text'>
This patch adds a minimal BPF debugger that "emulates" the kernel's
BPF engine (w/o extensions) and allows for single stepping (forwards
and backwards through BPF code) or running with &gt;=1 breakpoints through
selected or all packets from a pcap file with a provided user filter
in order to facilitate verification of a BPF program. When a breakpoint
is being hit, it dumps all register contents, decoded instructions and
in case of branches both decoded branch targets as well as other useful
information.

Having this facility is in particular useful to verify BPF programs
against given test traffic *before* attaching to a live system.

With the general availability of cls_bpf, xt_bpf, socket filters,
team driver and e.g. PTP code, all BPF users, quite often a single
more complex BPF program is being used. Reasons for a more complex
BPF program are primarily to optimize execution time for making a
verdict when multiple simple BPF programs are combined into one in
order to prevent parsing same headers multiple times. In particular,
for cls_bpf that can have various return paths for encoding flowids,
and xt_bpf to come to a fw verdict this can be the case.

Therefore, as this can result in more complex and harder to debug
code, it would be very useful to have this minimal tool for testing
purposes. It can also be of help for BPF JIT developers as filters
are "test attached" to the kernel on a temporary socket thus
triggering a JIT image dump when enabled. The tool uses an interactive
libreadline shell with auto-completion and history support.

Signed-off-by: Daniel Borkmann &lt;dborkman@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
