libbpf/backport-libbpf-Support-detecting-and-attaching-of-writable-t.patch
Lv Ying 9ffcfd10c8 sync backport patch from 20.03-LTS-SP3 branch
Signed-off-by: Lv Ying <lvying6@huawei.com>
(cherry picked from commit 28ce6ef7419e94008ffa6fb8ed2c80f928af0372)
2022-08-04 10:16:56 +08:00

35 lines
1.1 KiB
Diff

From 4d32ba754a242fb31827923c4a6f051063b32fea Mon Sep 17 00:00:00 2001
From: Hou Tao <houtao1@huawei.com>
Date: Mon, 4 Oct 2021 17:48:56 +0800
Subject: [PATCH] libbpf: Support detecting and attaching of writable
tracepoint program
Program on writable tracepoint is BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE,
but its attachment is the same as BPF_PROG_TYPE_RAW_TRACEPOINT.
Signed-off-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20211004094857.30868-3-hotforest@gmail.com
---
src/libbpf.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/libbpf.c b/src/libbpf.c
index d9ece93..02e9d33 100644
--- a/src/libbpf.c
+++ b/src/libbpf.c
@@ -6894,6 +6894,10 @@ static const struct bpf_sec_def section_defs[] = {
.attach_fn = attach_raw_tp),
SEC_DEF("raw_tp/", RAW_TRACEPOINT,
.attach_fn = attach_raw_tp),
+ SEC_DEF("raw_tracepoint.w/", RAW_TRACEPOINT_WRITABLE,
+ .attach_fn = attach_raw_tp),
+ SEC_DEF("raw_tp.w/", RAW_TRACEPOINT_WRITABLE,
+ .attach_fn = attach_raw_tp),
SEC_DEF("tp_btf/", TRACING,
.expected_attach_type = BPF_TRACE_RAW_TP,
.is_attach_btf = true,
--
2.29.2