Commit Graph

1522 Commits

Author SHA1 Message Date
openharmony_ci
fa89e3b08f
!21 【轻量级 PR】:清理OAT告警
Merge pull request !21 from wenlong_12/N/A
2023-05-29 08:23:00 +00:00
wenlong_12
9afb566464
清理OAT告警
Signed-off-by: wenlong_12 <wenlong12@huawei.com>
2023-05-29 07:46:20 +00:00
openharmony_ci
dcacc9ebdf
!20 【轻量级 PR】:清理oat 的告警
Merge pull request !20 from wenlong_12/N/A
2023-05-27 10:20:23 +00:00
wenlong_12
ae9063344f
清理oat 的告警
Signed-off-by: wenlong_12 <wenlong12@huawei.com>
2023-05-26 10:11:18 +00:00
openharmony_ci
4fa4b280b8
!18 清理oat的告警
Merge pull request !18 from wenlong_12/master
2023-05-25 06:14:06 +00:00
wenlong_12
20c55151ef 清理oat 的告警
Signed-off-by: wenlong_12 <wenlong12@huawei.com>

Signed-off-by: wenlong_12 <wenlong12@huawei.com>
2023-05-25 12:17:07 +08:00
openharmony_ci
631e40c4bc
!17 libbpf 升级到1.1版本
Merge pull request !17 from wenlong_12/master
2023-05-09 06:15:54 +00:00
wenlong_12
3e5f423e0a libbpf 修改oat.xm
Signed-off-by: wenlong_12 <wenlong12@huawei.com>

Signed-off-by: wenlong_12 <wenlong12@huawei.com>
2023-05-09 09:19:47 +08:00
wenlong_12
af6f52adca libbpf 修改oat.xm
Signed-off-by: wenlong_12 <wenlong12@huawei.com>

Signed-off-by: wenlong_12 <wenlong12@huawei.com>
2023-05-08 18:56:29 +08:00
wenlong_12
0aa3b705b3 libbpf 修改oat.xm
Signed-off-by: wenlong_12 <wenlong12@huawei.com>

Signed-off-by: wenlong_12 <wenlong12@huawei.com>
2023-05-08 18:52:47 +08:00
wenlong_12
4fc56a6441 libbpf 修改oat.xm
Signed-off-by: wenlong_12 <wenlong12@huawei.com>

Signed-off-by: wenlong_12 <wenlong12@huawei.com>
2023-05-08 18:44:38 +08:00
wenlong_12
9e5aef3df9 libbpf 修改oat.xm
Signed-off-by: wenlong_12 <wenlong12@huawei.com>

Signed-off-by: wenlong_12 <wenlong12@huawei.com>
2023-05-08 16:12:41 +08:00
wenlong_12
f359bf27ea libbpf 修改oat.xm
Signed-off-by: wenlong_12 <wenlong12@huawei.com>

Signed-off-by: wenlong_12 <wenlong12@huawei.com>
2023-05-08 14:47:43 +08:00
wenlong_12
c2051bea4e libbpf 修改oat.xm
Signed-off-by: wenlong_12 <wenlong12@huawei.com>

Signed-off-by: wenlong_12 <wenlong12@huawei.com>
2023-05-08 14:19:40 +08:00
wenlong_12
8a83e110ec libbpf 修改版本号
Signed-off-by: wenlong_12 <wenlong12@huawei.com>

Signed-off-by: wenlong_12 <wenlong12@huawei.com>
2023-05-06 16:32:10 +08:00
wenlong_12
92410c9ffc libbpf 升级到1.1版本
Signed-off-by: wenlong_12 <wenlong12@huawei.com>

Signed-off-by: wenlong_12 <wenlong12@huawei.com>
2023-05-06 16:26:31 +08:00
openharmony_ci
c3067a4444
!16 kernel do_pwritev()内联后hiebpf无法hook问题修改
Merge pull request !16 from zhangjian22/master
2023-05-04 11:07:34 +00:00
zhangjian22
d4f8ff509f kernel do_pwritev()内联后hiebpf无法hook问题修改
Signed-off-by: 张建 <zhangjian22@huawei.com>
#I701ZP
2023-05-04 11:36:52 +08:00
openharmony_ci
9ef68014c6
!13 动态库后缀名改成.so
Merge pull request !13 from Chenshi/master
2022-12-07 08:23:54 +00:00
Chenshi
4566fe2401 .z.so->.so
Signed-off-by: Chenshi <chenshi51@huawei.com>
2022-12-07 11:02:16 +08:00
openharmony_ci
ab3c01994d
!12 【轻量级 PR】:update bundle.json.
Merge pull request !12 from Chenshi/N/A
2022-11-23 06:47:52 +00:00
Chenshi
d971be5f23
update bundle.json.
Signed-off-by: Chenshi <chenshi51@huawei.com>
2022-11-23 06:37:49 +00:00
openharmony_ci
2b25c4a18d
!10 【轻量级 PR】:更正 OAT.xml规则配置
Merge pull request !10 from Chenshi/N/A
2022-11-23 06:15:28 +00:00
openharmony_ci
0ff1af63ee
!11 更新选择的license
Merge pull request !11 from Chenshi/master
2022-11-23 06:14:44 +00:00
Chenshi
3e295d5f30 更新license
Signed-off-by: Chenshi <chenshi51@huawei.com>
2022-11-23 12:57:36 +08:00
Chenshi
c647214ab4
更正 OAT.xml规则配置
Signed-off-by: Chenshi <chenshi51@huawei.com>
2022-11-22 09:45:34 +00:00
openharmony_ci
fbbc7c305c
!9 【轻量级 PR】:update OAT.xml filteritem
Merge pull request !9 from Chenshi/N/A
2022-11-22 06:09:05 +00:00
Chenshi
e1b5c20710
update OAT.xml.
Signed-off-by: Chenshi <chenshi51@huawei.com>
2022-11-22 04:55:10 +00:00
openharmony_ci
5f15395fa4
!7 【轻量级 PR】:update README_OH.md.
Merge pull request !7 from Chenshi/N/A
2022-11-22 01:23:23 +00:00
openharmony_ci
5c32ed86b2
!8 【轻量级 PR】:update OAT.xml.
Merge pull request !8 from Chenshi/N/A
2022-11-22 01:22:44 +00:00
Chenshi
bb8e71ed54
update OAT.xml.
Signed-off-by: Chenshi <chenshi51@huawei.com>
2022-11-22 01:15:02 +00:00
Chenshi
788ad1cecd
update README_OH.md.
Signed-off-by: Chenshi <chenshi51@huawei.com>
2022-11-21 14:10:10 +00:00
openharmony_ci
7c8ccf4183
!5 add OAT.xml
Merge pull request !5 from Chenshi/master
2022-11-21 08:39:55 +00:00
openharmony_ci
dd220fe8f4
!4 add elfio interface
Merge pull request !4 from Chenshi/master
2022-11-21 04:21:09 +00:00
Chenshi
c0449c34a1 add OAT.xml
Signed-off-by: Chenshi <chenshi51@huawei.com>
2022-11-21 11:08:33 +08:00
Chenshi
122b8a4f2e fix code check
Signed-off-by: Chenshi <chenshi51@huawei.com>
2022-11-18 14:20:12 +08:00
Chenshi
6a8736f44b add elfio interface
Signed-off-by: Chenshi <chenshi51@huawei.com>
2022-11-17 21:47:08 +08:00
Andrii Nakryiko
2cd2d03f63 libbpf: Fix libbpf.map inheritance chain for LIBBPF_0.7.0
Ensure that LIBBPF_0.7.0 inherits everything from LIBBPF_0.6.0.

Fixes: dbdd2c7f8cec ("libbpf: Add API to get/set log_level at per-program level")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20220211205235.2089104-1-andrii@kernel.org
2022-02-11 13:01:37 -08:00
Andrii Nakryiko
528094c0c1 sync: latest libbpf changes from kernel
Syncing latest libbpf commits from kernel repository.
Baseline bpf-next commit:   227a0713b319e7a8605312dee1c97c97a719a9fc
Checkpoint bpf-next commit: dc37dc617fabfb1c3a16d49f5d8cc20e9e3608ca
Baseline bpf commit:        77b1b8b43ec3c060ecf7e926a92b0f8772171046
Checkpoint bpf commit:      fe68195daf34d5dddacd3f93dd3eafc4beca3a0e

Andrii Nakryiko (1):
  libbpf: Fix compilation warning due to mismatched printf format

Dan Carpenter (1):
  libbpf: Fix signedness bug in btf_dump_array_data()

Hengqi Chen (1):
  libbpf: Add BPF_KPROBE_SYSCALL macro

Ilya Leoshkevich (7):
  libbpf: Add PT_REGS_SYSCALL_REGS macro
  libbpf: Fix accessing syscall arguments on powerpc
  libbpf: Fix riscv register names
  libbpf: Fix accessing syscall arguments on riscv
  libbpf: Allow overriding PT_REGS_PARM1{_CORE}_SYSCALL
  libbpf: Fix accessing the first syscall argument on arm64
  libbpf: Fix accessing the first syscall argument on s390

Mauricio Vásquez (1):
  libbpf: Remove mode check in libbpf_set_strict_mode()

 src/bpf_tracing.h | 85 +++++++++++++++++++++++++++++++++++++++++------
 src/btf_dump.c    |  6 ++--
 src/libbpf.c      |  8 -----
 3 files changed, 79 insertions(+), 20 deletions(-)

--
2.30.2
2022-02-09 09:48:32 -08:00
Andrii Nakryiko
37493e639f libbpf: Fix compilation warning due to mismatched printf format
On ppc64le architecture __s64 is long int and requires %ld. Cast to
ssize_t and use %zd to avoid architecture-specific specifiers.

Fixes: 4172843ed4a3 ("libbpf: Fix signedness bug in btf_dump_array_data()")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20220209063909.1268319-1-andrii@kernel.org
2022-02-09 09:48:32 -08:00
Hengqi Chen
b0a3b9e8fe libbpf: Add BPF_KPROBE_SYSCALL macro
Add syscall-specific variant of BPF_KPROBE named BPF_KPROBE_SYSCALL ([0]).
The new macro hides the underlying way of getting syscall input arguments.
With the new macro, the following code:

    SEC("kprobe/__x64_sys_close")
    int BPF_KPROBE(do_sys_close, struct pt_regs *regs)
    {
        int fd;

        fd = PT_REGS_PARM1_CORE(regs);
        /* do something with fd */
    }

can be written as:

    SEC("kprobe/__x64_sys_close")
    int BPF_KPROBE_SYSCALL(do_sys_close, int fd)
    {
        /* do something with fd */
    }

  [0] Closes: https://github.com/libbpf/libbpf/issues/425

Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220207143134.2977852-2-hengqi.chen@gmail.com
2022-02-09 09:48:32 -08:00
Ilya Leoshkevich
f7e08b4a8f libbpf: Fix accessing the first syscall argument on s390
On s390, the first syscall argument should be accessed via orig_gpr2
(see arch/s390/include/asm/syscall.h). Currently gpr[2] is used
instead, leading to bpf_syscall_macro test failure.

orig_gpr2 cannot be added to user_pt_regs, since its layout is a part
of the ABI. Therefore provide access to it only through
PT_REGS_PARM1_CORE_SYSCALL() by using a struct pt_regs flavor.

Reported-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220209021745.2215452-11-iii@linux.ibm.com
2022-02-09 09:48:32 -08:00
Ilya Leoshkevich
9f6e3a7a59 libbpf: Fix accessing the first syscall argument on arm64
On arm64, the first syscall argument should be accessed via orig_x0
(see arch/arm64/include/asm/syscall.h). Currently regs[0] is used
instead, leading to bpf_syscall_macro test failure.

orig_x0 cannot be added to struct user_pt_regs, since its layout is a
part of the ABI. Therefore provide access to it only through
PT_REGS_PARM1_CORE_SYSCALL() by using a struct pt_regs flavor.

Reported-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220209021745.2215452-10-iii@linux.ibm.com
2022-02-09 09:48:32 -08:00
Ilya Leoshkevich
f1a756d793 libbpf: Allow overriding PT_REGS_PARM1{_CORE}_SYSCALL
arm64 and s390 need a special way to access the first syscall argument.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220209021745.2215452-9-iii@linux.ibm.com
2022-02-09 09:48:32 -08:00
Ilya Leoshkevich
32c19d8505 libbpf: Fix accessing syscall arguments on riscv
riscv does not select ARCH_HAS_SYSCALL_WRAPPER, so its syscall
handlers take "unpacked" syscall arguments. Indicate this to libbpf
using PT_REGS_SYSCALL_REGS macro.

Reported-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220209021745.2215452-7-iii@linux.ibm.com
2022-02-09 09:48:32 -08:00
Ilya Leoshkevich
497ec1d35c libbpf: Fix riscv register names
riscv registers are accessed via struct user_regs_struct, not struct
pt_regs. The program counter member in this struct is called pc, not
epc. The frame pointer is called s0, not fp.

Fixes: 3cc31d794097 ("libbpf: Normalize PT_REGS_xxx() macro definitions")
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220209021745.2215452-6-iii@linux.ibm.com
2022-02-09 09:48:32 -08:00
Ilya Leoshkevich
8a28842a20 libbpf: Fix accessing syscall arguments on powerpc
powerpc does not select ARCH_HAS_SYSCALL_WRAPPER, so its syscall
handlers take "unpacked" syscall arguments. Indicate this to libbpf
using PT_REGS_SYSCALL_REGS macro.

Reported-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Tested-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Link: https://lore.kernel.org/bpf/20220209021745.2215452-5-iii@linux.ibm.com
2022-02-09 09:48:32 -08:00
Ilya Leoshkevich
50b4d99bbc libbpf: Add PT_REGS_SYSCALL_REGS macro
Architectures that select ARCH_HAS_SYSCALL_WRAPPER pass a pointer to
struct pt_regs to syscall handlers, others unpack it into individual
function parameters. Introduce a macro to describe what a particular
arch does.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220209021745.2215452-3-iii@linux.ibm.com
2022-02-09 09:48:32 -08:00
Dan Carpenter
f5bd7054f9 libbpf: Fix signedness bug in btf_dump_array_data()
The btf__resolve_size() function returns negative error codes so
"elem_size" must be signed for the error handling to work.

Fixes: 920d16af9b42 ("libbpf: BTF dumper support for typed data")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20220208071552.GB10495@kili
2022-02-09 09:48:32 -08:00
Mauricio Vásquez
1ceec54cb0 libbpf: Remove mode check in libbpf_set_strict_mode()
libbpf_set_strict_mode() checks that the passed mode doesn't contain
extra bits for LIBBPF_STRICT_* flags that don't exist yet.

It makes it difficult for applications to disable some strict flags as
something like "LIBBPF_STRICT_ALL & ~LIBBPF_STRICT_MAP_DEFINITIONS"
is rejected by this check and they have to use a rather complicated
formula to calculate it.[0]

One possibility is to change LIBBPF_STRICT_ALL to only contain the bits
of all existing LIBBPF_STRICT_* flags instead of 0xffffffff. However
it's not possible because the idea is that applications compiled against
older libbpf_legacy.h would still be opting into latest
LIBBPF_STRICT_ALL features.[1]

The other possibility is to remove that check so something like
"LIBBPF_STRICT_ALL & ~LIBBPF_STRICT_MAP_DEFINITIONS" is allowed. It's
what this commit does.

[0]: https://lore.kernel.org/bpf/20220204220435.301896-1-mauricio@kinvolk.io/
[1]: https://lore.kernel.org/bpf/CAEf4BzaTWa9fELJLh+bxnOb0P1EMQmaRbJVG0L+nXZdy0b8G3Q@mail.gmail.com/

Fixes: 93b8952d223a ("libbpf: deprecate legacy BPF map definitions")
Signed-off-by: Mauricio Vásquez <mauricio@kinvolk.io>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220207145052.124421-2-mauricio@kinvolk.io
2022-02-09 09:48:32 -08:00