tment to the crafted cases that we added in the 2nd patch
- add the 3rd patch
Changes since v2:
- fix a typo in the subject of the 1st patch
- add some comments to the 1st patch, as Eduard advised
- add some cases to the "crafted_cases"
Changes since v1:
- simplify the code in the
lthrough(FALSE) branch, the dst_reg will not be handled, which makes
the [min, max] for a is [0, 99], not [1, 99].
For BPF_JNE, we can reduce the range of the dst reg if the src reg is a
const and is exactly the edge of the dst reg.
Signed-off-by: Menglong Dong
Acked-by: Andrii Nakryiko
Acked-by: Sh
The "S32_MIN" is already defined with s32 casting, so there is no need
to do it again.
Signed-off-by: Menglong Dong
---
tools/testing/selftests/bpf/prog_tests/reg_bounds.c | 8
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/bpf/
are mainly used to test the edge of the src reg and dst reg.
All reg bounds testings has passed in the SLOW_TESTS mode:
$ export SLOW_TESTS=1 && ./test_progs -t reg_bounds -j
Summary: 65/18959832 PASSED, 0 SKIPPED, 0 FAILED
Signed-off-by: Menglong Dong
---
v5:
- add "{U32, U32,
t; 0" here will be optimized to "a != 0" */
if (a > 0) {
/* now the range of a should be [1, 7] */
bpf_skb_store_bytes(skb, 0, &b, a, 0);
}
Signed-off-by: Menglong Dong
---
v5:
- add some comments to the function that we add
- add reg_not_equal_const()
---
n't need to call bpf helpers for csum update any more.
In the second patch, we add some testcases for the read/write testing for
skb->csum and skb->ip_summed.
If this series is acceptable, we can define the inlined functions for csum
update in libbpf in the next step.
Menglong Do
f, which are much more efficient.
Signed-off-by: Menglong Dong
---
include/linux/skbuff.h | 2 ++
include/uapi/linux/bpf.h | 2 ++
net/core/filter.c | 22 ++
tools/include/uapi/linux/bpf.h | 2 ++
4 files changed, 28 insertions(+)
diff --git a/includ
The testcases for read/write access of skb->csum is added to ctx_skb.c.
And the read access testing for skb->ip_summed is also added.
Signed-off-by: Menglong Dong
---
.../testing/selftests/bpf/verifier/ctx_skb.c | 43 +++
1 file changed, 43 insertions(+)
diff --git a
On Wed, Jan 3, 2024 at 8:52 AM Martin KaFai Lau wrote:
>
> On 1/2/24 10:11 AM, Stanislav Fomichev wrote:
> > On 12/29, Menglong Dong wrote:
> >> For now, we have to call some helpers when we need to update the csum,
> >> such as bpf_l4_csum_replace, bpf_l3_csum_r
On Wed, Jan 3, 2024 at 11:55 AM Yonghong Song wrote:
>
>
> On 1/2/24 6:54 PM, Menglong Dong wrote:
> > On Wed, Jan 3, 2024 at 8:52 AM Martin KaFai Lau
> > wrote:
> >> On 1/2/24 10:11 AM, Stanislav Fomichev wrote:
> >>> On 12/29, Menglong Dong wrote:
&g
roduce the function libbpf_find_kernel_btf_id() to
libbpf to find the btf type id of the kernel function, and this function
will be used in the next commit.
In the 5th patch, we add the testcases for this series.
Menglong Dong (5):
bpf: tracing: add support to record and check the accessed
s function will be
used in the following commit.
Signed-off-by: Menglong Dong
---
include/linux/bpf.h | 4 ++
kernel/bpf/btf.c| 121
2 files changed, 125 insertions(+)
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index c7aa99b44dbd..02
as the origin target.
Signed-off-by: Menglong Dong
---
include/linux/bpf.h | 2 +
include/uapi/linux/bpf.h | 1 +
kernel/bpf/syscall.c | 117 +++
3 files changed, 98 insertions(+), 22 deletions(-)
diff --git a/include/linux/bpf.h b/include/linux/bpf.
As now we support to attach the tracing program to multiple target, we can
set the bpf cookie even if the target btf id is offered in
bpf_link_create().
Signed-off-by: Menglong Dong
---
tools/lib/bpf/bpf.c | 17 -
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a
Add new function libbpf_find_kernel_btf_id() to find the btf type id of
the kernel, including vmlinux and modules.
Signed-off-by: Menglong Dong
---
tools/lib/bpf/libbpf.c | 83
tools/lib/bpf/libbpf.h | 3 ++
tools/lib/bpf/libbpf.map | 1 +
3 files
In this commit, we add the testcases for multiple attaching of tracing,
include FENTRY, FEXIT, MODIFY_RETURN.
Signed-off-by: Menglong Dong
---
.../selftests/bpf/bpf_testmod/bpf_testmod.c | 49 ++
.../bpf/prog_tests/tracing_multi_attach.c | 155 ++
.../selftests/bpf
this series.
Changes since v1:
- According to the advice of Alexei, introduce multi-link for tracing
instead of attaching a tracing program to multiple trampolines with
creating multi instance of bpf_link.
Menglong Dong (9):
bpf: tracing: add support to record and check the accessed args
s function will be
used in the following commit.
Signed-off-by: Menglong Dong
---
include/linux/bpf.h | 4 ++
kernel/bpf/btf.c| 108 +++-
2 files changed, 110 insertions(+), 2 deletions(-)
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 95
t sure where
to add it now, and let's move it to kernel/bpf/syscall.c for now.
Signed-off-by: Menglong Dong
---
include/linux/bpf.h | 10 +
kernel/bpf/syscall.c | 37 +++
kernel/trace/bpf_trace.c | 48 ++--
be the
bridge between bpf_tramp_link and trampoline. And we also chang the type
of links in struct bpf_tramp_links to struct bpf_tramp_link_conn.
Signed-off-by: Menglong Dong
---
arch/arm64/net/bpf_jit_comp.c | 4 ++--
arch/riscv/net/bpf_jit_comp64.c | 4 ++--
arch/s390/net/bpf_jit_comp.c|
Introduce the struct bpf_tramp_multi_link, which is used to attach
a bpf_link to multi trampoline. Meanwhile, introduce corresponding
function bpf_trampoline_multi_{link,unlink}_prog.
Signed-off-by: Menglong Dong
---
include/linux/bpf.h | 14
kernel/bpf/trampoline.c | 47
Add target btf to the function args of bpf_check_attach_target(), then
the caller can specify the btf to check.
Signed-off-by: Menglong Dong
---
include/linux/bpf_verifier.h | 1 +
kernel/bpf/syscall.c | 6 --
kernel/bpf/trampoline.c | 1 +
kernel/bpf/verifier.c| 8
g loading, the first target is used for verification by the verifer.
And during attaching, we check the consistency of all the targets with
the target that we loaded, which is the first target.
Signed-off-by: Menglong Dong
---
include/linux/bpf.h| 11 +
include/linux/bpf_types.h |
grams of the type multi-link tracing exist.
Meanwhile, introduce the new api bpf_object__free_btf() to manually free
the btfs after attaching.
Signed-off-by: Menglong Dong
---
tools/lib/bpf/libbpf.c | 47 ++--
tools/lib/bpf/libbpf.h | 2 ++
tools/li
Add support for the attach types of:
BPF_TRACE_FENTRY_MULTI
BPF_TRACE_FEXIT_MULTI
BPF_MODIFY_RETURN_MULTI
Signed-off-by: Menglong Dong
---
tools/bpf/bpftool/common.c | 3 +
tools/lib/bpf/bpf.c| 10 +++
tools/lib/bpf/bpf.h| 6 ++
tools/lib/bpf/libbpf.c | 168
In this commit, we add some testcases for the following attach types:
BPF_TRACE_FENTRY_MULTI
BPF_TRACE_FEXIT_MULTI
BPF_MODIFY_RETURN_MULTI
Signed-off-by: Menglong Dong
---
net/bpf/test_run.c| 3 +
.../selftests/bpf/bpf_testmod/bpf_testmod.c | 49
.../bpf
26 matches
Mail list logo