Bug 1475 - cloud-kernel-5.10 上 bpftrace 中的 tcpdrop 不可用
Summary: cloud-kernel-5.10 上 bpftrace 中的 tcpdrop 不可用
Status: CONFIRMED
Alias: None
Product: ANCK 5.10 Dev
Classification: ANCK
Component: net (show other bugs) net
Version: unspecified
Hardware: x86_64 Linux
: P3-Medium S4-trivial
Target Milestone: ---
Assignee: XuanZhuo
QA Contact: shuming
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-06-16 10:55 UTC by kangjie
Modified: 2022-06-16 10:56 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kangjie 2022-06-16 10:55:22 UTC
Description of problem:

alinux3 上面执行 bpftrace 的 tcpdrop 失败:
[root@wuya-alinux3 ~]# /usr/share/bpftrace/tools/tcpdrop.bt
Attaching 3 probes...
cannot attach kprobe, probe entry may not exist
ERROR: Error attaching probe: 'kprobe:tcp_drop'

发现没有这个 tcp_drop 的符号:
[root@wuya-alinux3 ~]# cat /proc/kallsyms | grep tcp_drop

Version-Release number of selected component (if applicable):



How reproducible:


Steps to Reproduce:

1. 替换cloud-kernel,
2. 安装 bpftrace,yum install bpftrace,
3. 执行/usr/share/bpftrace/tools/tcpdrop.bt即可复现

Actual results:
tcpdrop.bt执行发现没有符号

Expected results:
tcpdrop.bt正常执行

Additional info:

从代码看,5.10 这里并没有什么变化,看起来主要是编译编译的时候把这个函数 inline 掉了,导致没有生成单独的函数符号。

解决方法有几种方法:
1. 编译器看看怎么不 inline 这个函数
2. 内核的 tcp_drop 上面加上 __attribute__((noinline))
3. 往上游提交一个 patch 增加一个 tracepoint