naccyde / rpms / iproute

Forked from rpms/iproute 10 months ago
Clone

Blame SOURCES/0065-bpf-add-btf-func-and-func_proto-kind-support.patch

8def76
From 5c940644dfc632f1270f39ee909e1abb877ff081 Mon Sep 17 00:00:00 2001
8def76
From: Andrea Claudi <aclaudi@redhat.com>
8def76
Date: Thu, 13 Jun 2019 14:37:57 +0200
8def76
Subject: [PATCH] bpf: add btf func and func_proto kind support
8def76
8def76
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1716361
8def76
Upstream Status: iproute2.git commit 3da6d055d93fe
8def76
8def76
commit 3da6d055d93fefe40bf88a9bc37b4ce3433696ee
8def76
Author: Yonghong Song <yhs@fb.com>
8def76
Date:   Thu Jan 24 16:41:07 2019 -0800
8def76
8def76
    bpf: add btf func and func_proto kind support
8def76
8def76
    The issue is discovered for bpf selftest test_skb_cgroup.sh.
8def76
    Currently we have,
8def76
      $ ./test_skb_cgroup_id.sh
8def76
      Wait for testing link-local IP to become available ... OK
8def76
      Object has unknown BTF type: 13!
8def76
      [PASS]
8def76
8def76
    In the above the BTF type 13 refers to BTF kind
8def76
    BTF_KIND_FUNC_PROTO.
8def76
    This patch added support of BTF_KIND_FUNC_PROTO and
8def76
    BTF_KIND_FUNC during type parsing.
8def76
    With this patch, I got
8def76
      $ ./test_skb_cgroup_id.sh
8def76
      Wait for testing link-local IP to become available ... OK
8def76
      [PASS]
8def76
8def76
    Signed-off-by: Yonghong Song <yhs@fb.com>
8def76
    Acked-by: Daniel Borkmann <daniel@iogearbox.net>
8def76
    Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
8def76
---
8def76
 lib/bpf.c | 4 ++++
8def76
 1 file changed, 4 insertions(+)
8def76
8def76
diff --git a/lib/bpf.c b/lib/bpf.c
8def76
index 5e85cfc0bdd5b..762f8857453ff 100644
8def76
--- a/lib/bpf.c
8def76
+++ b/lib/bpf.c
8def76
@@ -2193,12 +2193,16 @@ static int bpf_btf_prep_type_data(struct bpf_elf_ctx *ctx)
8def76
 		case BTF_KIND_ENUM:
8def76
 			type_cur += var_len * sizeof(struct btf_enum);
8def76
 			break;
8def76
+		case BTF_KIND_FUNC_PROTO:
8def76
+			type_cur += var_len * sizeof(struct btf_param);
8def76
+			break;
8def76
 		case BTF_KIND_TYPEDEF:
8def76
 		case BTF_KIND_PTR:
8def76
 		case BTF_KIND_FWD:
8def76
 		case BTF_KIND_VOLATILE:
8def76
 		case BTF_KIND_CONST:
8def76
 		case BTF_KIND_RESTRICT:
8def76
+		case BTF_KIND_FUNC:
8def76
 			break;
8def76
 		default:
8def76
 			fprintf(stderr, "Object has unknown BTF type: %u!\n", kind);
8def76
-- 
8def76
2.20.1
8def76