<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/tools/lib/bpf/xsk.c, branch linux-5.2.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.2.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.2.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2019-08-29T06:30:05Z</updated>
<entry>
<title>libbpf: silence GCC8 warning about string truncation</title>
<updated>2019-08-29T06:30:05Z</updated>
<author>
<name>Andrii Nakryiko</name>
</author>
<published>2019-07-24T21:47:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8f28ebbdf9bc5a3e14fe71b5467af2d5ccf1a524'/>
<id>urn:sha1:8f28ebbdf9bc5a3e14fe71b5467af2d5ccf1a524</id>
<content type='text'>
[ Upstream commit cb8ffde5694ae5fffb456eae932aac442aa3a207 ]

Despite a proper NULL-termination after strncpy(..., ..., IFNAMSIZ - 1),
GCC8 still complains about *expected* string truncation:

  xsk.c:330:2: error: 'strncpy' output may be truncated copying 15 bytes
  from a string of length 15 [-Werror=stringop-truncation]
    strncpy(ifr.ifr_name, xsk-&gt;ifname, IFNAMSIZ - 1);

This patch gets rid of the issue altogether by using memcpy instead.
There is no performance regression, as strncpy will still copy and fill
all of the bytes anyway.

v1-&gt;v2:
- rebase against bpf tree.

Cc: Magnus Karlsson &lt;magnus.karlsson@intel.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Acked-by: Magnus Karlsson &lt;magnus.karlsson@intel.com&gt;
Acked-by: Song Liu &lt;songliubraving@fb.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>libbpf: fix using uninitialized ioctl results</title>
<updated>2019-08-29T06:30:04Z</updated>
<author>
<name>Ilya Maximets</name>
</author>
<published>2019-07-23T12:08:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7dae14d19c4f9ca518c52ef4a14532c902ed60ca'/>
<id>urn:sha1:7dae14d19c4f9ca518c52ef4a14532c902ed60ca</id>
<content type='text'>
[ Upstream commit decb705e01a5d325c9876b9674043cde4b54f0db ]

'channels.max_combined' initialized only on ioctl success and
errno is only valid on ioctl failure.

The code doesn't produce any runtime issues, but makes memory
sanitizers angry:

 Conditional jump or move depends on uninitialised value(s)
    at 0x55C056F: xsk_get_max_queues (xsk.c:336)
    by 0x55C05B2: xsk_create_bpf_maps (xsk.c:354)
    by 0x55C089F: xsk_setup_xdp_prog (xsk.c:447)
    by 0x55C0E57: xsk_socket__create (xsk.c:601)
  Uninitialised value was created by a stack allocation
    at 0x55C04CD: xsk_get_max_queues (xsk.c:318)

Additionally fixed warning on uninitialized bytes in ioctl arguments:

 Syscall param ioctl(SIOCETHTOOL) points to uninitialised byte(s)
    at 0x648D45B: ioctl (in /usr/lib64/libc-2.28.so)
    by 0x55C0546: xsk_get_max_queues (xsk.c:330)
    by 0x55C05B2: xsk_create_bpf_maps (xsk.c:354)
    by 0x55C089F: xsk_setup_xdp_prog (xsk.c:447)
    by 0x55C0E57: xsk_socket__create (xsk.c:601)
  Address 0x1ffefff378 is on thread 1's stack
  in frame #1, created by xsk_get_max_queues (xsk.c:318)
  Uninitialised value was created by a stack allocation
    at 0x55C04CD: xsk_get_max_queues (xsk.c:318)

CC: Magnus Karlsson &lt;magnus.karlsson@intel.com&gt;
Fixes: 1cad07884239 ("libbpf: add support for using AF_XDP sockets")
Signed-off-by: Ilya Maximets &lt;i.maximets@samsung.com&gt;
Acked-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>libbpf: fix another GCC8 warning for strncpy</title>
<updated>2019-07-26T07:10:47Z</updated>
<author>
<name>Andrii Nakryiko</name>
</author>
<published>2019-07-16T03:57:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d092fcf1d773950aa06253ebe933966fa04fc41a'/>
<id>urn:sha1:d092fcf1d773950aa06253ebe933966fa04fc41a</id>
<content type='text'>
[ Upstream commit 763ff0e7d9c72e7094b31e7fb84a859be9325635 ]

Similar issue was fixed in cdfc7f888c2a ("libbpf: fix GCC8 warning for
strncpy") already. This one was missed. Fixing now.

Cc: Magnus Karlsson &lt;magnus.karlsson@intel.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Acked-by: Magnus Karlsson &lt;magnus.karlsson@intel.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>libbpf: fix GCC8 warning for strncpy</title>
<updated>2019-07-26T07:10:43Z</updated>
<author>
<name>Andrii Nakryiko</name>
</author>
<published>2019-07-02T15:16:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ba38126fbd973264d4c4c35c937c13de511097f6'/>
<id>urn:sha1:ba38126fbd973264d4c4c35c937c13de511097f6</id>
<content type='text'>
[ Upstream commit cdfc7f888c2a355b01308e97c6df108f1c2b64e8 ]

GCC8 started emitting warning about using strncpy with number of bytes
exactly equal destination size, which is generally unsafe, as can lead
to non-zero terminated string being copied. Use IFNAMSIZ - 1 as number
of bytes to ensure name is always zero-terminated.

Signed-off-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Cc: Magnus Karlsson &lt;magnus.karlsson@intel.com&gt;
Acked-by: Yonghong Song &lt;yhs@fb.com&gt;
Acked-by: Magnus Karlsson &lt;magnus.karlsson@intel.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>libbpf: move logging helpers into libbpf_internal.h</title>
<updated>2019-05-16T19:47:47Z</updated>
<author>
<name>Andrii Nakryiko</name>
</author>
<published>2019-05-16T03:39:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d72386fe7a8472f859333b078fd8bb9d254d51f2'/>
<id>urn:sha1:d72386fe7a8472f859333b078fd8bb9d254d51f2</id>
<content type='text'>
libbpf_util.h header was recently exposed as public as a dependency of
xsk.h. In addition to memory barriers, it contained logging helpers,
which are not supposed to be exposed. This patch moves those into
libbpf_internal.h, which is kept as an internal header.

Cc: Stanislav Fomichev &lt;sdf@google.com&gt;
Cc: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Fixes: 7080da890984 ("libbpf: add libbpf_util.h to header install.")
Signed-off-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>libbpf: remove unnecessary cast-to-void</title>
<updated>2019-05-06T09:35:17Z</updated>
<author>
<name>Björn Töpel</name>
</author>
<published>2019-05-06T09:24:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d24ed99b3b270c6de8f47c25d709b5f6ef7d3807'/>
<id>urn:sha1:d24ed99b3b270c6de8f47c25d709b5f6ef7d3807</id>
<content type='text'>
The patches with fixes tags added a cast-to-void in the places when
the return value of a function was ignored.

This is not common practice in the kernel, and is therefore removed in
this patch.

Reported-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Fixes: 5750902a6e9b ("libbpf: proper XSKMAP cleanup")
Fixes: 0e6741f09297 ("libbpf: fix invalid munmap call")
Signed-off-by: Björn Töpel &lt;bjorn.topel@intel.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>libbpf: proper XSKMAP cleanup</title>
<updated>2019-05-05T06:26:22Z</updated>
<author>
<name>Björn Töpel</name>
</author>
<published>2019-04-30T12:45:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5750902a6e9bc6adb77da8257c0e34db2bfdebb2'/>
<id>urn:sha1:5750902a6e9bc6adb77da8257c0e34db2bfdebb2</id>
<content type='text'>
The bpf_map_update_elem() function, when used on an XSKMAP, will fail
if not a valid AF_XDP socket is passed as value. Therefore, this is
function cannot be used to clear the XSKMAP. Instead, the
bpf_map_delete_elem() function should be used for that.

This patch also simplifies the code by breaking up
xsk_update_bpf_maps() into three smaller functions.

Reported-by: William Tu &lt;u9012063@gmail.com&gt;
Fixes: 1cad07884239 ("libbpf: add support for using AF_XDP sockets")
Signed-off-by: Björn Töpel &lt;bjorn.topel@intel.com&gt;
Tested-by: William Tu &lt;u9012063@gmail.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>libbpf: fix invalid munmap call</title>
<updated>2019-05-05T06:26:22Z</updated>
<author>
<name>Björn Töpel</name>
</author>
<published>2019-04-30T12:45:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0e6741f092979535d159d5a851f12c88bfb7cb9a'/>
<id>urn:sha1:0e6741f092979535d159d5a851f12c88bfb7cb9a</id>
<content type='text'>
When unmapping the AF_XDP memory regions used for the rings, an
invalid address was passed to the munmap() calls. Instead of passing
the beginning of the memory region, the descriptor region was passed
to munmap.

When the userspace application tried to tear down an AF_XDP socket,
the operation failed and the application would still have a reference
to socket it wished to get rid of.

Reported-by: William Tu &lt;u9012063@gmail.com&gt;
Fixes: 1cad07884239 ("libbpf: add support for using AF_XDP sockets")
Signed-off-by: Björn Töpel &lt;bjorn.topel@intel.com&gt;
Tested-by: William Tu &lt;u9012063@gmail.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>libbpf: fix crash in XDP socket part with new larger BPF_LOG_BUF_SIZE</title>
<updated>2019-04-10T07:51:50Z</updated>
<author>
<name>Magnus Karlsson</name>
</author>
<published>2019-04-10T06:54:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=50bd645b3a21a374dbd0fa8273a5f4e98001fb05'/>
<id>urn:sha1:50bd645b3a21a374dbd0fa8273a5f4e98001fb05</id>
<content type='text'>
In commit da11b417583e ("libbpf: teach libbpf about log_level bit 2"),
the BPF_LOG_BUF_SIZE was increased to 16M. The XDP socket part of
libbpf allocated the log_buf on the stack, but for the new 16M buffer
size this is not going to work. Change the code so it uses a 16K buffer
instead.

Fixes: da11b417583e ("libbpf: teach libbpf about log_level bit 2")
Signed-off-by: Magnus Karlsson &lt;magnus.karlsson@intel.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>libbpf: fix to reject unknown flags in xsk_socket__create()</title>
<updated>2019-03-12T20:58:18Z</updated>
<author>
<name>Magnus Karlsson</name>
</author>
<published>2019-03-12T08:59:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6bf21b54a596d60905cfc7e8af8e2fe16d9fe7e9'/>
<id>urn:sha1:6bf21b54a596d60905cfc7e8af8e2fe16d9fe7e9</id>
<content type='text'>
In xsk_socket__create(), the libbpf_flags field was not checked for
setting currently unused/unknown flags. This patch fixes that by
returning -EINVAL if the user has set any flag that is not in use at
this point in time.

Fixes: 1cad07884239 ("libbpf: add support for using AF_XDP sockets")
Signed-off-by: Magnus Karlsson &lt;magnus.karlsson@intel.com&gt;
Reviewed-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
</feed>
