Kprobe BPF程序执行顺序

huangapple go评论63阅读模式
英文:

Kprobe BPF programs execution order

问题

Is there a reliable way to explicitly specify BPF kprobe programs execution order (without kretprobes).

For example, when I name programs like kprobe__<func>_1 and kprobe__<func>_2, I get an execution order like kprobe__<func>_2 -> kprobe__<func>_1, that is in backward order. Does the order of programs loading or its name make sense? I can't find any documentation about that and don't know how to make sure that my programs will be executed in the order I really need on whole kernels.

I was just trying to rename my functions with suffixes [n], where n is a strictly positive number (including zero), and it works but doesn't guarantee that it will work on all kernels the same.

英文:

Is there a reliable way to explicitly specify BPF kprobe programs execution order (without kretprobes).

For example, when I name programs like kprobe__&lt;func&gt;_1 and kprobe__&lt;func&gt;_2 I get an execution order like kprobe__&lt;func&gt;_2 -> kprobe__&lt;func&gt;_1, that is in backward order. Does the order of programs loading or it's name makes sense? I can't find any documentation about that and don't know how to make sure that my programs will be executed in order I really need on whole kernels.

I was just trying to rename my functions with suffixes _[n], where n is strighly positive number (including zero), and it works, but doesn't gives sure that it will work on whole kernels same.

答案1

得分: 1

以下是要翻译的内容:

无法保证kprobe程序的特定执行顺序,因为在不同的内核版本中,排序可能会有所不同。即使依赖命名约定或程序加载的顺序也不能保证特定的执行顺序。

因此,建议设计独立于彼此执行顺序的kprobe程序,或将它们合并为一个程序。

英文:

It is not possible to guarantee a particular execution order of kprobe programs since the ordering can vary across different kernel versions. Even relying on naming conventions or the order in which the programs were loaded does not guarantee a specific execution order.

Therefore, it is advisable to design kprobe programs that are independent of each other's order of execution or combine them into one.

huangapple
  • 本文由 发表于 2023年4月13日 20:02:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/76005179.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定