-
Notifications
You must be signed in to change notification settings - Fork 380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: eliminate variables by BPF_CORE_READ_INTO #214
Conversation
bpf/lib/bpf_helpers.h
Outdated
*/ | ||
static long (*bpf_probe_read)(void *dst, __u32 size, | ||
const void *unsafe_ptr) = (void *)4; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because currently, probe_read
is defined in https://github.com/cilium/tetragon/blob/HEAD/bpf/include/api.h#L206, so it can work without this definition.
However, BPF_CORE_READ_INTO
in fact calls bpf_core_read
, which is defined in
https://github.com/cilium/tetragon/blob/HEAD/bpf/libbpf/bpf_core_read.h#L117
by bpf_probe_read
.
bpf_probe_read
is not defined. So we have to supplement its definition, if we want to use BPF_CORE_READ_INTO
.
The BPF_CORE_READ_INTO can help reduce unnecessary variables and simplify the logic Signed-off-by: Peihao Yang <[email protected]>
2f25478
to
5106199
Compare
Rebase since the definition of |
The BPF_CORE_READ_INTO can help reduce unnecessary variables and simplify the logic
Signed-off-by: Peihao Yang [email protected]