Fix issues with pinned sk_storage map #3833
Merged
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.
The BPF_SK_STORAGE map is defined as below:
The structure has two func pointer members, sk_storage_get and
sk_storage_delete, which will be translated to corresponding
bpf helpers by rewriter.
If a BPF_SK_STORAGE map is pinned to bpffs, the map can be
used in another bcc based process with BPF_TABLE_PINNED macro.
Miao Xu reported an issue such that the structure supporting BPF_TABLE
does not have func pointer member sk_storage_get and sk_storage_delete and
this may cause BPF program compilation failure. For example,
without helpers.h change in this patch, the test case in this patch will have the
following error:
To fix the above issue, we need to add sk_storage_get and
sk_storage_delete to BPF_F_TABLE macro. I also added
{task, inode}storage{get, delete} func pointer members
to BPF_F_TABLE macro. Some other map macros like BPF_SOCKMAP,
BPF_SOCKHASH, etc. also have special func pointer members.
But I leave them for future patches if we have use cases for it.
Signed-off-by: Yonghong Song yhs@fb.com