Skip to contentSkip to conversation

samples: bpf: Fix broken bpf programs due to removed symbol

PATCH Applied Daniel T. Lee 3 participants 3 messages Aug 18, 2020 – Aug 19, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 samples: bpf: Fix broken bpf programs due to removed symbol

From commit f1394b798814 ("block: mark blk_account_io_completion static") symbol blk_account_io_completion() has been marked as static, which makes it no longer possible to attach kprobe to this event. Currently, there are broken samples due to this reason.

As a solution to this, attach kprobe events to blk_account_io_done() to modify them to perform the same behavior as before.

---
 samples/bpf/task_fd_query_kern.c | 2 +-
 samples/bpf/task_fd_query_user.c | 2 +-
 samples/bpf/tracex3_kern.c       | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
samples/bpf/task_fd_query_kern.c +1 -1
index 278ade5427c8..c821294e1774 100644
@@ -10,7 +10,7 @@ int bpf_prog1(struct pt_regs *ctx)
 	return 0;
 }
 
-SEC("kretprobe/blk_account_io_completion")
+SEC("kretprobe/blk_account_io_done")
 int bpf_prog2(struct pt_regs *ctx)
 {
 	return 0;
samples/bpf/task_fd_query_user.c +1 -1
index ff2e9c1c7266..4a74531dc403 100644
@@ -314,7 +314,7 @@ int main(int argc, char **argv)
 	/* test two functions in the corresponding *_kern.c file */
 	CHECK_AND_RET(test_debug_fs_kprobe(0, "blk_mq_start_request",
 					   BPF_FD_TYPE_KPROBE));
-	CHECK_AND_RET(test_debug_fs_kprobe(1, "blk_account_io_completion",
+	CHECK_AND_RET(test_debug_fs_kprobe(1, "blk_account_io_done",
 					   BPF_FD_TYPE_KRETPROBE));
 
 	/* test nondebug fs kprobe */
samples/bpf/tracex3_kern.c +1 -1
index 659613c19a82..710a4410b2fb 100644
@@ -49,7 +49,7 @@ struct {
 	__uint(max_entries, SLOTS);
 } lat_map SEC(".maps");
 
-SEC("kprobe/blk_account_io_completion")
+SEC("kprobe/blk_account_io_done")
 int bpf_prog2(struct pt_regs *ctx)
 {
 	long rq = PT_REGS_PARM1(ctx);
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Daniel T. Lee

From commit f1394b798814 ("block: mark blk_account_io_completion
static") symbol blk_account_io_completion() has been marked as static, which makes it no longer possible to attach kprobe to this event. Currently, there are broken samples due to this reason.

As a solution to this, attach kprobe events to blk_account_io_done() to modify them to perform the same behavior as before.

#2 lore raw
Quoted 9 lines · Yonghong Song
Quoted 5 lines · Daniel T. Lee

From commit f1394b798814 ("block: mark blk_account_io_completion
static") symbol blk_account_io_completion() has been marked as static, which makes it no longer possible to attach kprobe to this event. Currently, there are broken samples due to this reason.

Quoted 6 lines
Quoted 4 lines

As a solution to this, attach kprobe events to blk_account_io_done() to modify them to perform the same behavior as before.

Applied. Thanks