fix(so): reuse pinned dkapture bpf objects correctly#97
Open
yuKing123-king wants to merge 1 commit into
Open
Conversation
Signed-off-by: Wang Yu <[email protected]>
xu-lang
reviewed
Jul 21, 2026
| struct bpf_map_info info = {}; | ||
| u32 len = sizeof(info); | ||
| std::string map_pin_path(PIN_PATH "/map-"); | ||
| std::string map_pin_path(PIN_PATH "/"); |
Contributor
Author
There was a problem hiding this comment.
因为在bpf-manager.cpp:207中bpf_object__pin_maps(m_obj->obj, PIN_PATH);这个函数会调用 libbpf,把当前 BPF object 里的所有 maps pin 到 PIN_PATH 下。但是libbpf 默认会用 map 自己的名字作为最后一级文件名,而没有map-这个前缀。以map-dk_shared_mem 这个map为例, 会导致
- 存在性判断永远看错地方,代码以为 /sys/fs/bpf/dkapture/map-dk_shared_mem 不存在,于是误判“需要新建”。
- 实际创建时又去创建真正的 dk_shared_mem, 但这个真实 pin 已经存在,于是 libbpf 报: failed to pin map: File exists
- 并且当前仓库里没有把 map pin 成 map-xxx 的定义
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.