bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next 00/13] Fix sanitizer-reported libbpf and selftest issues
@ 2021-11-24  0:23 Andrii Nakryiko
  2021-11-24  0:23 ` [PATCH bpf-next 01/13] tools/resolve_btf_ids: close ELF file on error Andrii Nakryiko
                   ` (12 more replies)
  0 siblings, 13 replies; 17+ messages in thread
From: Andrii Nakryiko @ 2021-11-24  0:23 UTC (permalink / raw)
  To: bpf, ast, daniel; +Cc: andrii, kernel-team

After doing another run with ASAN, LSAN, and UBSAN, they turned up a bunch of
new issues not noticed before. Fix all of them in preparation for sanitized
test_progs runs in BPF CI in the near future.

Andrii Nakryiko (13):
  tools/resolve_btf_ids: close ELF file on error
  libbpf: fix potential misaligned memory access in btf_ext__new()
  libbpf: prevent UBSan from complaining about integer overflow
  libbpf: don't call libc APIs with NULL pointers
  libbpf: fix glob_syms memory leak in bpf_linker
  libbpf: fix using invalidated memory in bpf_linker
  selftests/bpf: fix UBSan complaint about signed __int128 overflow
  selftests/bpf: fix possible NULL passed to memcpy() with zero size
  selftests/bpf: prevent misaligned memory access in get_stack_raw_tp
    test
  selftests/bpf: fix misaligned memory access in queue_stack_map test
  selftests/bpf: prevent out-of-bounds stack access in test_bpffs
  selftests/bpf: fix misaligned memory accesses in xdp_bonding test
  selftests/bpf: fix misaligned accesses in xdp and xdp_bpf2bpf tests

 tools/bpf/resolve_btfids/main.c               |  5 +--
 tools/lib/bpf/btf.c                           | 11 +++---
 tools/lib/bpf/btf.h                           |  2 +-
 tools/lib/bpf/libbpf.c                        | 10 ++++--
 tools/lib/bpf/linker.c                        |  6 +++-
 .../selftests/bpf/prog_tests/btf_dump.c       |  2 +-
 .../selftests/bpf/prog_tests/core_reloc.c     |  3 +-
 .../bpf/prog_tests/get_stack_raw_tp.c         | 14 +++++---
 .../bpf/prog_tests/queue_stack_map.c          | 12 ++++---
 .../selftests/bpf/prog_tests/test_bpffs.c     |  4 ++-
 tools/testing/selftests/bpf/prog_tests/xdp.c  | 11 +++---
 .../selftests/bpf/prog_tests/xdp_bonding.c    | 36 ++++++++++---------
 .../selftests/bpf/prog_tests/xdp_bpf2bpf.c    |  6 ++--
 13 files changed, 74 insertions(+), 48 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH bpf-next 01/13] tools/resolve_btf_ids: close ELF file on error
  2021-11-24  0:23 [PATCH bpf-next 00/13] Fix sanitizer-reported libbpf and selftest issues Andrii Nakryiko
@ 2021-11-24  0:23 ` Andrii Nakryiko
  2021-11-24  0:23 ` [PATCH bpf-next 02/13] libbpf: fix potential misaligned memory access in btf_ext__new() Andrii Nakryiko
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Andrii Nakryiko @ 2021-11-24  0:23 UTC (permalink / raw)
  To: bpf, ast, daniel; +Cc: andrii, kernel-team

Fix one case where we don't do explicit clean up.

Fixes: fbbb68de80a4 ("bpf: Add resolve_btfids tool to resolve BTF IDs in ELF object")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
 tools/bpf/resolve_btfids/main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/main.c
index a59cb0ee609c..e9e6166c3f28 100644
--- a/tools/bpf/resolve_btfids/main.c
+++ b/tools/bpf/resolve_btfids/main.c
@@ -167,7 +167,7 @@ static struct btf_id *btf_id__find(struct rb_root *root, const char *name)
 	return NULL;
 }
 
-static struct btf_id*
+static struct btf_id *
 btf_id__add(struct rb_root *root, char *name, bool unique)
 {
 	struct rb_node **p = &root->rb_node;
@@ -730,7 +730,8 @@ int main(int argc, const char **argv)
 	if (obj.efile.idlist_shndx == -1 ||
 	    obj.efile.symbols_shndx == -1) {
 		pr_debug("Cannot find .BTF_ids or symbols sections, nothing to do\n");
-		return 0;
+		err = 0;
+		goto out;
 	}
 
 	if (symbols_collect(&obj))
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH bpf-next 02/13] libbpf: fix potential misaligned memory access in btf_ext__new()
  2021-11-24  0:23 [PATCH bpf-next 00/13] Fix sanitizer-reported libbpf and selftest issues Andrii Nakryiko
  2021-11-24  0:23 ` [PATCH bpf-next 01/13] tools/resolve_btf_ids: close ELF file on error Andrii Nakryiko
@ 2021-11-24  0:23 ` Andrii Nakryiko
  2021-11-24  0:23 ` [PATCH bpf-next 03/13] libbpf: prevent UBSan from complaining about integer overflow Andrii Nakryiko
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Andrii Nakryiko @ 2021-11-24  0:23 UTC (permalink / raw)
  To: bpf, ast, daniel; +Cc: andrii, kernel-team, Evgeny Vereshchagin

Perform a memory copy before we do the sanity checks of btf_ext_hdr.
This prevents misaligned memory access if raw btf_ext data is not 4-byte
aligned ([0]).

While at it, also add missing const qualifier.

  [0] Closes: https://github.com/libbpf/libbpf/issues/391

Reported-by: Evgeny Vereshchagin <evvers@ya.ru>
Fixes: 2993e0515bb4 ("tools/bpf: add support to read .BTF.ext sections")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
 tools/lib/bpf/btf.c | 10 +++++-----
 tools/lib/bpf/btf.h |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
index e97217a77196..8024fe355ca8 100644
--- a/tools/lib/bpf/btf.c
+++ b/tools/lib/bpf/btf.c
@@ -2731,15 +2731,11 @@ void btf_ext__free(struct btf_ext *btf_ext)
 	free(btf_ext);
 }
 
-struct btf_ext *btf_ext__new(__u8 *data, __u32 size)
+struct btf_ext *btf_ext__new(const __u8 *data, __u32 size)
 {
 	struct btf_ext *btf_ext;
 	int err;
 
-	err = btf_ext_parse_hdr(data, size);
-	if (err)
-		return libbpf_err_ptr(err);
-
 	btf_ext = calloc(1, sizeof(struct btf_ext));
 	if (!btf_ext)
 		return libbpf_err_ptr(-ENOMEM);
@@ -2752,6 +2748,10 @@ struct btf_ext *btf_ext__new(__u8 *data, __u32 size)
 	}
 	memcpy(btf_ext->data, data, size);
 
+	err = btf_ext_parse_hdr(btf_ext->data, size);
+	if (err)
+		goto done;
+
 	if (btf_ext->hdr->hdr_len < offsetofend(struct btf_ext_header, line_info_len)) {
 		err = -EINVAL;
 		goto done;
diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h
index 5c73a5b0a044..742a2bf71c5e 100644
--- a/tools/lib/bpf/btf.h
+++ b/tools/lib/bpf/btf.h
@@ -157,7 +157,7 @@ LIBBPF_API int btf__get_map_kv_tids(const struct btf *btf, const char *map_name,
 				    __u32 expected_value_size,
 				    __u32 *key_type_id, __u32 *value_type_id);
 
-LIBBPF_API struct btf_ext *btf_ext__new(__u8 *data, __u32 size);
+LIBBPF_API struct btf_ext *btf_ext__new(const __u8 *data, __u32 size);
 LIBBPF_API void btf_ext__free(struct btf_ext *btf_ext);
 LIBBPF_API const void *btf_ext__get_raw_data(const struct btf_ext *btf_ext,
 					     __u32 *size);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH bpf-next 03/13] libbpf: prevent UBSan from complaining about integer overflow
  2021-11-24  0:23 [PATCH bpf-next 00/13] Fix sanitizer-reported libbpf and selftest issues Andrii Nakryiko
  2021-11-24  0:23 ` [PATCH bpf-next 01/13] tools/resolve_btf_ids: close ELF file on error Andrii Nakryiko
  2021-11-24  0:23 ` [PATCH bpf-next 02/13] libbpf: fix potential misaligned memory access in btf_ext__new() Andrii Nakryiko
@ 2021-11-24  0:23 ` Andrii Nakryiko
  2021-11-25 22:21   ` Daniel Borkmann
  2021-11-24  0:23 ` [PATCH bpf-next 04/13] libbpf: don't call libc APIs with NULL pointers Andrii Nakryiko
                   ` (9 subsequent siblings)
  12 siblings, 1 reply; 17+ messages in thread
From: Andrii Nakryiko @ 2021-11-24  0:23 UTC (permalink / raw)
  To: bpf, ast, daniel; +Cc: andrii, kernel-team

Integer overflow is intentional, silence the sanitizer. It works
completely reliably on sane compilers and architectures.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
 tools/lib/bpf/btf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
index 8024fe355ca8..be1dafd56a13 100644
--- a/tools/lib/bpf/btf.c
+++ b/tools/lib/bpf/btf.c
@@ -3127,6 +3127,7 @@ struct btf_dedup {
 	struct strset *strs_set;
 };
 
+__attribute__((no_sanitize("signed-integer-overflow")))
 static long hash_combine(long h, long value)
 {
 	return h * 31 + value;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH bpf-next 04/13] libbpf: don't call libc APIs with NULL pointers
  2021-11-24  0:23 [PATCH bpf-next 00/13] Fix sanitizer-reported libbpf and selftest issues Andrii Nakryiko
                   ` (2 preceding siblings ...)
  2021-11-24  0:23 ` [PATCH bpf-next 03/13] libbpf: prevent UBSan from complaining about integer overflow Andrii Nakryiko
@ 2021-11-24  0:23 ` Andrii Nakryiko
  2021-11-24  0:23 ` [PATCH bpf-next 05/13] libbpf: fix glob_syms memory leak in bpf_linker Andrii Nakryiko
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Andrii Nakryiko @ 2021-11-24  0:23 UTC (permalink / raw)
  To: bpf, ast, daniel; +Cc: andrii, kernel-team

Sanitizer complains about qsort(), bsearch(), and memcpy() being called
with NULL pointer. This can only happen when the associated number of
elements is zero, so no harm should be done. But still prevent this from
happening to keep sanitizer runs clean from extra noise.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
 tools/lib/bpf/libbpf.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index af405c38aadc..23f84757c806 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -3369,7 +3369,8 @@ static int bpf_object__elf_collect(struct bpf_object *obj)
 
 	/* sort BPF programs by section name and in-section instruction offset
 	 * for faster search */
-	qsort(obj->programs, obj->nr_programs, sizeof(*obj->programs), cmp_progs);
+	if (obj->nr_programs)
+		qsort(obj->programs, obj->nr_programs, sizeof(*obj->programs), cmp_progs);
 
 	return bpf_object__init_btf(obj, btf_data, btf_ext_data);
 }
@@ -5816,6 +5817,8 @@ static int cmp_relo_by_insn_idx(const void *key, const void *elem)
 
 static struct reloc_desc *find_prog_insn_relo(const struct bpf_program *prog, size_t insn_idx)
 {
+	if (!prog->nr_reloc)
+		return NULL;
 	return bsearch(&insn_idx, prog->reloc_desc, prog->nr_reloc,
 		       sizeof(*prog->reloc_desc), cmp_relo_by_insn_idx);
 }
@@ -5831,8 +5834,9 @@ static int append_subprog_relos(struct bpf_program *main_prog, struct bpf_progra
 	relos = libbpf_reallocarray(main_prog->reloc_desc, new_cnt, sizeof(*relos));
 	if (!relos)
 		return -ENOMEM;
-	memcpy(relos + main_prog->nr_reloc, subprog->reloc_desc,
-	       sizeof(*relos) * subprog->nr_reloc);
+	if (subprog->nr_reloc)
+		memcpy(relos + main_prog->nr_reloc, subprog->reloc_desc,
+		       sizeof(*relos) * subprog->nr_reloc);
 
 	for (i = main_prog->nr_reloc; i < new_cnt; i++)
 		relos[i].insn_idx += subprog->sub_insn_off;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH bpf-next 05/13] libbpf: fix glob_syms memory leak in bpf_linker
  2021-11-24  0:23 [PATCH bpf-next 00/13] Fix sanitizer-reported libbpf and selftest issues Andrii Nakryiko
                   ` (3 preceding siblings ...)
  2021-11-24  0:23 ` [PATCH bpf-next 04/13] libbpf: don't call libc APIs with NULL pointers Andrii Nakryiko
@ 2021-11-24  0:23 ` Andrii Nakryiko
  2021-11-24  0:23 ` [PATCH bpf-next 06/13] libbpf: fix using invalidated memory " Andrii Nakryiko
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Andrii Nakryiko @ 2021-11-24  0:23 UTC (permalink / raw)
  To: bpf, ast, daniel; +Cc: andrii, kernel-team

glob_syms array wasn't freed on bpf_link__free(). Fix that.

Fixes: a46349227cd8 ("libbpf: Add linker extern resolution support for functions and global variables")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
 tools/lib/bpf/linker.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/lib/bpf/linker.c b/tools/lib/bpf/linker.c
index 594b206fa674..3e1b2a15fdc7 100644
--- a/tools/lib/bpf/linker.c
+++ b/tools/lib/bpf/linker.c
@@ -210,6 +210,7 @@ void bpf_linker__free(struct bpf_linker *linker)
 	}
 	free(linker->secs);
 
+	free(linker->glob_syms);
 	free(linker);
 }
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH bpf-next 06/13] libbpf: fix using invalidated memory in bpf_linker
  2021-11-24  0:23 [PATCH bpf-next 00/13] Fix sanitizer-reported libbpf and selftest issues Andrii Nakryiko
                   ` (4 preceding siblings ...)
  2021-11-24  0:23 ` [PATCH bpf-next 05/13] libbpf: fix glob_syms memory leak in bpf_linker Andrii Nakryiko
@ 2021-11-24  0:23 ` Andrii Nakryiko
  2021-11-24  0:23 ` [PATCH bpf-next 07/13] selftests/bpf: fix UBSan complaint about signed __int128 overflow Andrii Nakryiko
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Andrii Nakryiko @ 2021-11-24  0:23 UTC (permalink / raw)
  To: bpf, ast, daniel; +Cc: andrii, kernel-team

add_dst_sec() can invalidate bpf_linker's section index making
dst_symtab pointer pointing into unallocated memory. Reinitialize
dst_symtab pointer on each iteration to make sure it's always valid.

Fixes: faf6ed321cf6 ("libbpf: Add BPF static linker APIs")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
 tools/lib/bpf/linker.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/lib/bpf/linker.c b/tools/lib/bpf/linker.c
index 3e1b2a15fdc7..9aa016fb55aa 100644
--- a/tools/lib/bpf/linker.c
+++ b/tools/lib/bpf/linker.c
@@ -2000,7 +2000,7 @@ static int linker_append_elf_sym(struct bpf_linker *linker, struct src_obj *obj,
 static int linker_append_elf_relos(struct bpf_linker *linker, struct src_obj *obj)
 {
 	struct src_sec *src_symtab = &obj->secs[obj->symtab_sec_idx];
-	struct dst_sec *dst_symtab = &linker->secs[linker->symtab_sec_idx];
+	struct dst_sec *dst_symtab;
 	int i, err;
 
 	for (i = 1; i < obj->sec_cnt; i++) {
@@ -2033,6 +2033,9 @@ static int linker_append_elf_relos(struct bpf_linker *linker, struct src_obj *ob
 			return -1;
 		}
 
+		/* add_dst_sec() above could have invalidated linker->secs */
+		dst_symtab = &linker->secs[linker->symtab_sec_idx];
+
 		/* shdr->sh_link points to SYMTAB */
 		dst_sec->shdr->sh_link = linker->symtab_sec_idx;
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH bpf-next 07/13] selftests/bpf: fix UBSan complaint about signed __int128 overflow
  2021-11-24  0:23 [PATCH bpf-next 00/13] Fix sanitizer-reported libbpf and selftest issues Andrii Nakryiko
                   ` (5 preceding siblings ...)
  2021-11-24  0:23 ` [PATCH bpf-next 06/13] libbpf: fix using invalidated memory " Andrii Nakryiko
@ 2021-11-24  0:23 ` Andrii Nakryiko
  2021-11-24  0:23 ` [PATCH bpf-next 08/13] selftests/bpf: fix possible NULL passed to memcpy() with zero size Andrii Nakryiko
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Andrii Nakryiko @ 2021-11-24  0:23 UTC (permalink / raw)
  To: bpf, ast, daniel; +Cc: andrii, kernel-team

Test is using __int128 variable as unsigned and highest order bit can be
set to 1 after bit shift. Use unsigned __int128 explicitly and prevent
UBSan from complaining.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
 tools/testing/selftests/bpf/prog_tests/btf_dump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/btf_dump.c b/tools/testing/selftests/bpf/prog_tests/btf_dump.c
index af47aeb211e7..9e26903f9170 100644
--- a/tools/testing/selftests/bpf/prog_tests/btf_dump.c
+++ b/tools/testing/selftests/bpf/prog_tests/btf_dump.c
@@ -323,7 +323,7 @@ static void test_btf_dump_int_data(struct btf *btf, struct btf_dump *d,
 				   char *str)
 {
 #ifdef __SIZEOF_INT128__
-	__int128 i = 0xffffffffffffffff;
+	unsigned __int128 i = 0xffffffffffffffff;
 
 	/* this dance is required because we cannot directly initialize
 	 * a 128-bit value to anything larger than a 64-bit value.
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH bpf-next 08/13] selftests/bpf: fix possible NULL passed to memcpy() with zero size
  2021-11-24  0:23 [PATCH bpf-next 00/13] Fix sanitizer-reported libbpf and selftest issues Andrii Nakryiko
                   ` (6 preceding siblings ...)
  2021-11-24  0:23 ` [PATCH bpf-next 07/13] selftests/bpf: fix UBSan complaint about signed __int128 overflow Andrii Nakryiko
@ 2021-11-24  0:23 ` Andrii Nakryiko
  2021-11-24  0:23 ` [PATCH bpf-next 09/13] selftests/bpf: prevent misaligned memory access in get_stack_raw_tp test Andrii Nakryiko
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Andrii Nakryiko @ 2021-11-24  0:23 UTC (permalink / raw)
  To: bpf, ast, daniel; +Cc: andrii, kernel-team

Prevent sanitizer from complaining about passing NULL into memcpy(),
even if it happens with zero size.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
 tools/testing/selftests/bpf/prog_tests/core_reloc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/core_reloc.c b/tools/testing/selftests/bpf/prog_tests/core_reloc.c
index 1041d0c593f6..44a9868c70ea 100644
--- a/tools/testing/selftests/bpf/prog_tests/core_reloc.c
+++ b/tools/testing/selftests/bpf/prog_tests/core_reloc.c
@@ -881,7 +881,8 @@ void test_core_reloc(void)
 		data = mmap_data;
 
 		memset(mmap_data, 0, sizeof(*data));
-		memcpy(data->in, test_case->input, test_case->input_len);
+		if (test_case->input_len)
+			memcpy(data->in, test_case->input, test_case->input_len);
 		data->my_pid_tgid = my_pid_tgid;
 
 		link = bpf_program__attach_raw_tracepoint(prog, tp_name);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH bpf-next 09/13] selftests/bpf: prevent misaligned memory access in get_stack_raw_tp test
  2021-11-24  0:23 [PATCH bpf-next 00/13] Fix sanitizer-reported libbpf and selftest issues Andrii Nakryiko
                   ` (7 preceding siblings ...)
  2021-11-24  0:23 ` [PATCH bpf-next 08/13] selftests/bpf: fix possible NULL passed to memcpy() with zero size Andrii Nakryiko
@ 2021-11-24  0:23 ` Andrii Nakryiko
  2021-11-24  0:23 ` [PATCH bpf-next 10/13] selftests/bpf: fix misaligned memory access in queue_stack_map test Andrii Nakryiko
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Andrii Nakryiko @ 2021-11-24  0:23 UTC (permalink / raw)
  To: bpf, ast, daniel; +Cc: andrii, kernel-team

Perfbuf doesn't guarantee 8-byte alignment of the data like BPF ringbuf
does, so struct get_stack_trace_t can arrive not properly aligned for
subsequent u64 accesses. Easiest fix is to just copy data locally.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
 .../selftests/bpf/prog_tests/get_stack_raw_tp.c    | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c b/tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c
index 4184c399d4c6..977ab433a946 100644
--- a/tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c
+++ b/tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c
@@ -24,13 +24,19 @@ static void get_stack_print_output(void *ctx, int cpu, void *data, __u32 size)
 {
 	bool good_kern_stack = false, good_user_stack = false;
 	const char *nonjit_func = "___bpf_prog_run";
-	struct get_stack_trace_t *e = data;
+	/* perfbuf-submitted data is 4-byte aligned, but we need 8-byte
+	 * alignment, so copy data into a local variable, for simplicity
+	 */
+	struct get_stack_trace_t e;
 	int i, num_stack;
 	static __u64 cnt;
 	struct ksym *ks;
 
 	cnt++;
 
+	memset(&e, 0, sizeof(e));
+	memcpy(&e, data, size <= sizeof(e) ? size : sizeof(e));
+
 	if (size < sizeof(struct get_stack_trace_t)) {
 		__u64 *raw_data = data;
 		bool found = false;
@@ -57,19 +63,19 @@ static void get_stack_print_output(void *ctx, int cpu, void *data, __u32 size)
 			good_user_stack = true;
 		}
 	} else {
-		num_stack = e->kern_stack_size / sizeof(__u64);
+		num_stack = e.kern_stack_size / sizeof(__u64);
 		if (env.jit_enabled) {
 			good_kern_stack = num_stack > 0;
 		} else {
 			for (i = 0; i < num_stack; i++) {
-				ks = ksym_search(e->kern_stack[i]);
+				ks = ksym_search(e.kern_stack[i]);
 				if (ks && (strcmp(ks->name, nonjit_func) == 0)) {
 					good_kern_stack = true;
 					break;
 				}
 			}
 		}
-		if (e->user_stack_size > 0 && e->user_stack_buildid_size > 0)
+		if (e.user_stack_size > 0 && e.user_stack_buildid_size > 0)
 			good_user_stack = true;
 	}
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH bpf-next 10/13] selftests/bpf: fix misaligned memory access in queue_stack_map test
  2021-11-24  0:23 [PATCH bpf-next 00/13] Fix sanitizer-reported libbpf and selftest issues Andrii Nakryiko
                   ` (8 preceding siblings ...)
  2021-11-24  0:23 ` [PATCH bpf-next 09/13] selftests/bpf: prevent misaligned memory access in get_stack_raw_tp test Andrii Nakryiko
@ 2021-11-24  0:23 ` Andrii Nakryiko
  2021-11-24  0:23 ` [PATCH bpf-next 11/13] selftests/bpf: prevent out-of-bounds stack access in test_bpffs Andrii Nakryiko
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Andrii Nakryiko @ 2021-11-24  0:23 UTC (permalink / raw)
  To: bpf, ast, daniel; +Cc: andrii, kernel-team

Copy over iphdr into a local variable before accessing its fields.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
 .../selftests/bpf/prog_tests/queue_stack_map.c       | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/queue_stack_map.c b/tools/testing/selftests/bpf/prog_tests/queue_stack_map.c
index 8ccba3ab70ee..b9822f914eeb 100644
--- a/tools/testing/selftests/bpf/prog_tests/queue_stack_map.c
+++ b/tools/testing/selftests/bpf/prog_tests/queue_stack_map.c
@@ -14,7 +14,7 @@ static void test_queue_stack_map_by_type(int type)
 	int i, err, prog_fd, map_in_fd, map_out_fd;
 	char file[32], buf[128];
 	struct bpf_object *obj;
-	struct iphdr *iph = (void *)buf + sizeof(struct ethhdr);
+	struct iphdr iph;
 
 	/* Fill test values to be used */
 	for (i = 0; i < MAP_SIZE; i++)
@@ -60,15 +60,17 @@ static void test_queue_stack_map_by_type(int type)
 
 		err = bpf_prog_test_run(prog_fd, 1, &pkt_v4, sizeof(pkt_v4),
 					buf, &size, &retval, &duration);
-		if (err || retval || size != sizeof(pkt_v4) ||
-		    iph->daddr != val)
+		if (err || retval || size != sizeof(pkt_v4))
+			break;
+		memcpy(&iph, buf + sizeof(struct ethhdr), sizeof(iph));
+		if (iph.daddr != val)
 			break;
 	}
 
-	CHECK(err || retval || size != sizeof(pkt_v4) || iph->daddr != val,
+	CHECK(err || retval || size != sizeof(pkt_v4) || iph.daddr != val,
 	      "bpf_map_pop_elem",
 	      "err %d errno %d retval %d size %d iph->daddr %u\n",
-	      err, errno, retval, size, iph->daddr);
+	      err, errno, retval, size, iph.daddr);
 
 	/* Queue is empty, program should return TC_ACT_SHOT */
 	err = bpf_prog_test_run(prog_fd, 1, &pkt_v4, sizeof(pkt_v4),
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH bpf-next 11/13] selftests/bpf: prevent out-of-bounds stack access in test_bpffs
  2021-11-24  0:23 [PATCH bpf-next 00/13] Fix sanitizer-reported libbpf and selftest issues Andrii Nakryiko
                   ` (9 preceding siblings ...)
  2021-11-24  0:23 ` [PATCH bpf-next 10/13] selftests/bpf: fix misaligned memory access in queue_stack_map test Andrii Nakryiko
@ 2021-11-24  0:23 ` Andrii Nakryiko
  2021-11-24  0:23 ` [PATCH bpf-next 12/13] selftests/bpf: fix misaligned memory accesses in xdp_bonding test Andrii Nakryiko
  2021-11-24  0:23 ` [PATCH bpf-next 13/13] selftests/bpf: fix misaligned accesses in xdp and xdp_bpf2bpf tests Andrii Nakryiko
  12 siblings, 0 replies; 17+ messages in thread
From: Andrii Nakryiko @ 2021-11-24  0:23 UTC (permalink / raw)
  To: bpf, ast, daniel; +Cc: andrii, kernel-team

Buf can be not zero-terminated leading to strstr() to access data beyond
the intended buf[] array. Fix by forcing zero termination.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
 tools/testing/selftests/bpf/prog_tests/test_bpffs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/test_bpffs.c b/tools/testing/selftests/bpf/prog_tests/test_bpffs.c
index d29ebfeef9c5..e36782c8ec49 100644
--- a/tools/testing/selftests/bpf/prog_tests/test_bpffs.c
+++ b/tools/testing/selftests/bpf/prog_tests/test_bpffs.c
@@ -19,11 +19,13 @@ static int read_iter(char *file)
 	fd = open(file, 0);
 	if (fd < 0)
 		return -1;
-	while ((len = read(fd, buf, sizeof(buf))) > 0)
+	while ((len = read(fd, buf, sizeof(buf))) > 0) {
+		buf[sizeof(buf) - 1] = '\0';
 		if (strstr(buf, "iter")) {
 			close(fd);
 			return 0;
 		}
+	}
 	close(fd);
 	return -1;
 }
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH bpf-next 12/13] selftests/bpf: fix misaligned memory accesses in xdp_bonding test
  2021-11-24  0:23 [PATCH bpf-next 00/13] Fix sanitizer-reported libbpf and selftest issues Andrii Nakryiko
                   ` (10 preceding siblings ...)
  2021-11-24  0:23 ` [PATCH bpf-next 11/13] selftests/bpf: prevent out-of-bounds stack access in test_bpffs Andrii Nakryiko
@ 2021-11-24  0:23 ` Andrii Nakryiko
  2021-11-24  0:23 ` [PATCH bpf-next 13/13] selftests/bpf: fix misaligned accesses in xdp and xdp_bpf2bpf tests Andrii Nakryiko
  12 siblings, 0 replies; 17+ messages in thread
From: Andrii Nakryiko @ 2021-11-24  0:23 UTC (permalink / raw)
  To: bpf, ast, daniel; +Cc: andrii, kernel-team

Construct packet buffer explicitly for each packet to avoid unaligned
memory accesses.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
 .../selftests/bpf/prog_tests/xdp_bonding.c    | 36 ++++++++++---------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_bonding.c b/tools/testing/selftests/bpf/prog_tests/xdp_bonding.c
index faa22b84f2ee..5e3a26b15ec6 100644
--- a/tools/testing/selftests/bpf/prog_tests/xdp_bonding.c
+++ b/tools/testing/selftests/bpf/prog_tests/xdp_bonding.c
@@ -218,9 +218,9 @@ static int send_udp_packets(int vary_dst_ip)
 		.h_dest = BOND2_MAC,
 		.h_proto = htons(ETH_P_IP),
 	};
-	uint8_t buf[128] = {};
-	struct iphdr *iph = (struct iphdr *)(buf + sizeof(eh));
-	struct udphdr *uh = (struct udphdr *)(buf + sizeof(eh) + sizeof(*iph));
+	struct iphdr iph = {};
+	struct udphdr uh = {};
+	uint8_t buf[128];
 	int i, s = -1;
 	int ifindex;
 
@@ -232,17 +232,16 @@ static int send_udp_packets(int vary_dst_ip)
 	if (!ASSERT_GT(ifindex, 0, "get bond1 ifindex"))
 		goto err;
 
-	memcpy(buf, &eh, sizeof(eh));
-	iph->ihl = 5;
-	iph->version = 4;
-	iph->tos = 16;
-	iph->id = 1;
-	iph->ttl = 64;
-	iph->protocol = IPPROTO_UDP;
-	iph->saddr = 1;
-	iph->daddr = 2;
-	iph->tot_len = htons(sizeof(buf) - ETH_HLEN);
-	iph->check = 0;
+	iph.ihl = 5;
+	iph.version = 4;
+	iph.tos = 16;
+	iph.id = 1;
+	iph.ttl = 64;
+	iph.protocol = IPPROTO_UDP;
+	iph.saddr = 1;
+	iph.daddr = 2;
+	iph.tot_len = htons(sizeof(buf) - ETH_HLEN);
+	iph.check = 0;
 
 	for (i = 1; i <= NPACKETS; i++) {
 		int n;
@@ -253,10 +252,15 @@ static int send_udp_packets(int vary_dst_ip)
 		};
 
 		/* vary the UDP destination port for even distribution with roundrobin/xor modes */
-		uh->dest++;
+		uh.dest++;
 
 		if (vary_dst_ip)
-			iph->daddr++;
+			iph.daddr++;
+
+		/* construct a packet */
+		memcpy(buf, &eh, sizeof(eh));
+		memcpy(buf + sizeof(eh), &iph, sizeof(iph));
+		memcpy(buf + sizeof(eh) + sizeof(iph), &uh, sizeof(uh));
 
 		n = sendto(s, buf, sizeof(buf), 0, (struct sockaddr *)&saddr_ll, sizeof(saddr_ll));
 		if (!ASSERT_EQ(n, sizeof(buf), "sendto"))
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH bpf-next 13/13] selftests/bpf: fix misaligned accesses in xdp and xdp_bpf2bpf tests
  2021-11-24  0:23 [PATCH bpf-next 00/13] Fix sanitizer-reported libbpf and selftest issues Andrii Nakryiko
                   ` (11 preceding siblings ...)
  2021-11-24  0:23 ` [PATCH bpf-next 12/13] selftests/bpf: fix misaligned memory accesses in xdp_bonding test Andrii Nakryiko
@ 2021-11-24  0:23 ` Andrii Nakryiko
  12 siblings, 0 replies; 17+ messages in thread
From: Andrii Nakryiko @ 2021-11-24  0:23 UTC (permalink / raw)
  To: bpf, ast, daniel; +Cc: andrii, kernel-team

Similar to previous patch, just copy over necessary struct into local
stack variable before checking its fields.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
 tools/testing/selftests/bpf/prog_tests/xdp.c         | 11 ++++++-----
 tools/testing/selftests/bpf/prog_tests/xdp_bpf2bpf.c |  6 +++---
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/xdp.c b/tools/testing/selftests/bpf/prog_tests/xdp.c
index 7a7ef9d4e151..ac65456b7ab8 100644
--- a/tools/testing/selftests/bpf/prog_tests/xdp.c
+++ b/tools/testing/selftests/bpf/prog_tests/xdp.c
@@ -11,8 +11,8 @@ void test_xdp(void)
 	const char *file = "./test_xdp.o";
 	struct bpf_object *obj;
 	char buf[128];
-	struct ipv6hdr *iph6 = (void *)buf + sizeof(struct ethhdr);
-	struct iphdr *iph = (void *)buf + sizeof(struct ethhdr);
+	struct ipv6hdr iph6;
+	struct iphdr iph;
 	__u32 duration, retval, size;
 	int err, prog_fd, map_fd;
 
@@ -28,16 +28,17 @@ void test_xdp(void)
 
 	err = bpf_prog_test_run(prog_fd, 1, &pkt_v4, sizeof(pkt_v4),
 				buf, &size, &retval, &duration);
-
+	memcpy(&iph, buf + sizeof(struct ethhdr), sizeof(iph));
 	CHECK(err || retval != XDP_TX || size != 74 ||
-	      iph->protocol != IPPROTO_IPIP, "ipv4",
+	      iph.protocol != IPPROTO_IPIP, "ipv4",
 	      "err %d errno %d retval %d size %d\n",
 	      err, errno, retval, size);
 
 	err = bpf_prog_test_run(prog_fd, 1, &pkt_v6, sizeof(pkt_v6),
 				buf, &size, &retval, &duration);
+	memcpy(&iph6, buf + sizeof(struct ethhdr), sizeof(iph6));
 	CHECK(err || retval != XDP_TX || size != 114 ||
-	      iph6->nexthdr != IPPROTO_IPV6, "ipv6",
+	      iph6.nexthdr != IPPROTO_IPV6, "ipv6",
 	      "err %d errno %d retval %d size %d\n",
 	      err, errno, retval, size);
 out:
diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_bpf2bpf.c b/tools/testing/selftests/bpf/prog_tests/xdp_bpf2bpf.c
index f99386d1dc4c..c98a897ad692 100644
--- a/tools/testing/selftests/bpf/prog_tests/xdp_bpf2bpf.c
+++ b/tools/testing/selftests/bpf/prog_tests/xdp_bpf2bpf.c
@@ -42,7 +42,7 @@ void test_xdp_bpf2bpf(void)
 	char buf[128];
 	int err, pkt_fd, map_fd;
 	bool passed = false;
-	struct iphdr *iph = (void *)buf + sizeof(struct ethhdr);
+	struct iphdr iph;
 	struct iptnl_info value4 = {.family = AF_INET};
 	struct test_xdp *pkt_skel = NULL;
 	struct test_xdp_bpf2bpf *ftrace_skel = NULL;
@@ -93,9 +93,9 @@ void test_xdp_bpf2bpf(void)
 	/* Run test program */
 	err = bpf_prog_test_run(pkt_fd, 1, &pkt_v4, sizeof(pkt_v4),
 				buf, &size, &retval, &duration);
-
+	memcpy(&iph, buf + sizeof(struct ethhdr), sizeof(iph));
 	if (CHECK(err || retval != XDP_TX || size != 74 ||
-		  iph->protocol != IPPROTO_IPIP, "ipv4",
+		  iph.protocol != IPPROTO_IPIP, "ipv4",
 		  "err %d errno %d retval %d size %d\n",
 		  err, errno, retval, size))
 		goto out;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH bpf-next 03/13] libbpf: prevent UBSan from complaining about integer overflow
  2021-11-24  0:23 ` [PATCH bpf-next 03/13] libbpf: prevent UBSan from complaining about integer overflow Andrii Nakryiko
@ 2021-11-25 22:21   ` Daniel Borkmann
  2021-11-25 23:19     ` Daniel Borkmann
  0 siblings, 1 reply; 17+ messages in thread
From: Daniel Borkmann @ 2021-11-25 22:21 UTC (permalink / raw)
  To: Andrii Nakryiko, bpf, ast; +Cc: kernel-team

On 11/24/21 1:23 AM, Andrii Nakryiko wrote:
> Integer overflow is intentional, silence the sanitizer. It works
> completely reliably on sane compilers and architectures.
> 
> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
> ---
>   tools/lib/bpf/btf.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
> index 8024fe355ca8..be1dafd56a13 100644
> --- a/tools/lib/bpf/btf.c
> +++ b/tools/lib/bpf/btf.c
> @@ -3127,6 +3127,7 @@ struct btf_dedup {
>   	struct strset *strs_set;
>   };
>   
> +__attribute__((no_sanitize("signed-integer-overflow")))
>   static long hash_combine(long h, long value)
>   {
>   	return h * 31 + value;
> 

Sgtm, I guess my only question, was there a reason for not using e.g. __u64 in
the first place? Meaning, __u64 hash_combine(__u64 h, __u64 value) plus the
call-sites where you have h variable re-feeding into hash_combine().

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH bpf-next 03/13] libbpf: prevent UBSan from complaining about integer overflow
  2021-11-25 22:21   ` Daniel Borkmann
@ 2021-11-25 23:19     ` Daniel Borkmann
  2021-11-26  1:23       ` Andrii Nakryiko
  0 siblings, 1 reply; 17+ messages in thread
From: Daniel Borkmann @ 2021-11-25 23:19 UTC (permalink / raw)
  To: Andrii Nakryiko, bpf, ast; +Cc: kernel-team

On 11/25/21 11:21 PM, Daniel Borkmann wrote:
> On 11/24/21 1:23 AM, Andrii Nakryiko wrote:
>> Integer overflow is intentional, silence the sanitizer. It works
>> completely reliably on sane compilers and architectures.
>>
>> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
>> ---
>>   tools/lib/bpf/btf.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
>> index 8024fe355ca8..be1dafd56a13 100644
>> --- a/tools/lib/bpf/btf.c
>> +++ b/tools/lib/bpf/btf.c
>> @@ -3127,6 +3127,7 @@ struct btf_dedup {
>>       struct strset *strs_set;
>>   };
>> +__attribute__((no_sanitize("signed-integer-overflow")))
>>   static long hash_combine(long h, long value)
>>   {
>>       return h * 31 + value;
>>
> 
> Sgtm, I guess my only question, was there a reason for not using e.g. __u64 in
> the first place? Meaning, __u64 hash_combine(__u64 h, __u64 value) plus the
> call-sites where you have h variable re-feeding into hash_combine().

Given the remainder of the series is all straight forward, I took that in already,
but would still be nice if we can silence the sanitizer complaint w/o such attribute
workaround.

Thanks,
Daniel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH bpf-next 03/13] libbpf: prevent UBSan from complaining about integer overflow
  2021-11-25 23:19     ` Daniel Borkmann
@ 2021-11-26  1:23       ` Andrii Nakryiko
  0 siblings, 0 replies; 17+ messages in thread
From: Andrii Nakryiko @ 2021-11-26  1:23 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: Andrii Nakryiko, bpf, Alexei Starovoitov, Kernel Team

On Thu, Nov 25, 2021 at 3:19 PM Daniel Borkmann <daniel@iogearbox.net> wrote:
>
> On 11/25/21 11:21 PM, Daniel Borkmann wrote:
> > On 11/24/21 1:23 AM, Andrii Nakryiko wrote:
> >> Integer overflow is intentional, silence the sanitizer. It works
> >> completely reliably on sane compilers and architectures.
> >>
> >> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
> >> ---
> >>   tools/lib/bpf/btf.c | 1 +
> >>   1 file changed, 1 insertion(+)
> >>
> >> diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
> >> index 8024fe355ca8..be1dafd56a13 100644
> >> --- a/tools/lib/bpf/btf.c
> >> +++ b/tools/lib/bpf/btf.c
> >> @@ -3127,6 +3127,7 @@ struct btf_dedup {
> >>       struct strset *strs_set;
> >>   };
> >> +__attribute__((no_sanitize("signed-integer-overflow")))
> >>   static long hash_combine(long h, long value)
> >>   {
> >>       return h * 31 + value;
> >>
> >
> > Sgtm, I guess my only question, was there a reason for not using e.g. __u64 in
> > the first place? Meaning, __u64 hash_combine(__u64 h, __u64 value) plus the
> > call-sites where you have h variable re-feeding into hash_combine().
>
> Given the remainder of the series is all straight forward, I took that in already,
> but would still be nice if we can silence the sanitizer complaint w/o such attribute
> workaround.

You are right, I'll follow up with u64 conversion and will drop the attribute.

>
> Thanks,
> Daniel

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2021-11-26  1:25 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-24  0:23 [PATCH bpf-next 00/13] Fix sanitizer-reported libbpf and selftest issues Andrii Nakryiko
2021-11-24  0:23 ` [PATCH bpf-next 01/13] tools/resolve_btf_ids: close ELF file on error Andrii Nakryiko
2021-11-24  0:23 ` [PATCH bpf-next 02/13] libbpf: fix potential misaligned memory access in btf_ext__new() Andrii Nakryiko
2021-11-24  0:23 ` [PATCH bpf-next 03/13] libbpf: prevent UBSan from complaining about integer overflow Andrii Nakryiko
2021-11-25 22:21   ` Daniel Borkmann
2021-11-25 23:19     ` Daniel Borkmann
2021-11-26  1:23       ` Andrii Nakryiko
2021-11-24  0:23 ` [PATCH bpf-next 04/13] libbpf: don't call libc APIs with NULL pointers Andrii Nakryiko
2021-11-24  0:23 ` [PATCH bpf-next 05/13] libbpf: fix glob_syms memory leak in bpf_linker Andrii Nakryiko
2021-11-24  0:23 ` [PATCH bpf-next 06/13] libbpf: fix using invalidated memory " Andrii Nakryiko
2021-11-24  0:23 ` [PATCH bpf-next 07/13] selftests/bpf: fix UBSan complaint about signed __int128 overflow Andrii Nakryiko
2021-11-24  0:23 ` [PATCH bpf-next 08/13] selftests/bpf: fix possible NULL passed to memcpy() with zero size Andrii Nakryiko
2021-11-24  0:23 ` [PATCH bpf-next 09/13] selftests/bpf: prevent misaligned memory access in get_stack_raw_tp test Andrii Nakryiko
2021-11-24  0:23 ` [PATCH bpf-next 10/13] selftests/bpf: fix misaligned memory access in queue_stack_map test Andrii Nakryiko
2021-11-24  0:23 ` [PATCH bpf-next 11/13] selftests/bpf: prevent out-of-bounds stack access in test_bpffs Andrii Nakryiko
2021-11-24  0:23 ` [PATCH bpf-next 12/13] selftests/bpf: fix misaligned memory accesses in xdp_bonding test Andrii Nakryiko
2021-11-24  0:23 ` [PATCH bpf-next 13/13] selftests/bpf: fix misaligned accesses in xdp and xdp_bpf2bpf tests Andrii Nakryiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).