- Feb 01, 2023
-
-
Andrii Nakryiko authored
As reported in [0], we are missing openat2.h in libbpf-local UAPI headers. Sync it and adjust sync script to keep syncing it going forward. [0] https://github.com/libbpf/libbpf/issues/649 Closes: https://github.com/libbpf/libbpf/issues/649 Signed-off-by:
Andrii Nakryiko <andrii@kernel.org>
-
- Jan 31, 2023
-
-
Joanne Koong authored
Currently, CI is unable to locate llvm-16 on aarch64/gcc, aarch64/llvm-16, and s390x/gcc [0]. This change upgrades the default llvm version to 17. [0] https://github.com/kernel-patches/bpf/actions/runs/4040302668 Signed-off-by:
Joanne Koong <joannekoong@gmail.com>
-
- Jan 26, 2023
-
-
Dave Marchevsky authored
Signed-off-by:
Dave Marchevsky <davemarchevsky@gmail.com>
-
Andrii Nakryiko authored
It is mysteriously fails in CI, for now don't run it. Signed-off-by:
Andrii Nakryiko <andrii@kernel.org>
-
Andrii Nakryiko authored
Regenerate latest vmlinux.h for old kernel CI tests. Signed-off-by:
Andrii Nakryiko <andrii@kernel.org>
-
Andrii Nakryiko authored
Bump LIBBPF_MINOR_VERSION to 2 for v1.2 dev cycle. Signed-off-by:
Andrii Nakryiko <andrii@kernel.org>
-
Andrii Nakryiko authored
Syncing latest libbpf commits from kernel repository. Baseline bpf-next commit: 7b43df6c6ec38c9097420902a1c8165c4b25bf70 Checkpoint bpf-next commit: a5f6b9d577eba18601c14bba2dbff4a9b76af962 Baseline bpf commit: 54c3f1a81421f85e60ae2eaae7be3727a09916ee Checkpoint bpf commit: e8c8fd9b8393d7064152c8806f5ac446d760a23e Alexei Starovoitov (1): libbpf: Restore errno after pr_warn. Andrii Nakryiko (24): libbpf: start v1.2 development cycle libbpf: Add support for fetching up to 8 arguments in kprobes libbpf: Add 6th argument support for x86-64 in bpf_tracing.h libbpf: Fix arm and arm64 specs in bpf_tracing.h libbpf: Complete mips spec in bpf_tracing.h libbpf: Complete powerpc spec in bpf_tracing.h libbpf: Complete sparc spec in bpf_tracing.h libbpf: Complete riscv arch spec in bpf_tracing.h libbpf: Fix and complete ARC spec in bpf_tracing.h libbpf: Complete LoongArch (loongarch) spec in bpf_tracing.h libbpf: Add BPF_UPROBE and BPF_URETPROBE macro aliases libbpf: Improve syscall tracing support in bpf_tracing.h libbpf: Define x86-64 syscall regs spec in bpf_tracing.h libbpf: Define i386 syscall regs spec in bpf_tracing.h libbpf: Define s390x syscall regs spec in bpf_tracing.h libbpf: Define arm syscall regs spec in bpf_tracing.h libbpf: Define arm64 syscall regs spec in bpf_tracing.h libbpf: Define mips syscall regs spec in bpf_tracing.h libbpf: Define powerpc syscall regs spec in bpf_tracing.h libbpf: Define sparc syscall regs spec in bpf_tracing.h libbpf: Define riscv syscall regs spec in bpf_tracing.h libbpf: Define arc syscall regs spec in bpf_tracing.h libbpf: Define loongarch syscall regs spec in bpf_tracing.h libbpf: Clean up now not needed __PT_PARM{1-6}_SYSCALL_REG defaults Changbin Du (1): libbpf: Return -ENODATA for missing btf section Daniel T. Lee (1): libbpf: Fix invalid return address register in s390 David Vernet (1): libbpf: Support sleepable struct_ops.s section Hengqi Chen (1): libbpf: Add LoongArch support to bpf_tracing.h Ludovic L'Hours (1): libbpf: Fix map creation flags sanitization Menglong Dong (1): libbpf: Replace '.' with '_' in legacy kprobe event name Rong Tao (1): libbpf: Poison strlcpy() Stanislav Fomichev (1): bpf: Introduce device-bound XDP programs Xin Liu (2): libbpf: fix errno is overwritten after being closed. libbpf: Added the description of some API functions Ziyang Xuan (1): bpf: Add ipip6 and ip6ip decap support for bpf_skb_adjust_room() include/uapi/linux/bpf.h | 12 ++ src/bpf_tracing.h | 320 ++++++++++++++++++++++++++++++++++----- src/btf.c | 2 +- src/libbpf.c | 10 +- src/libbpf.h | 29 +++- src/libbpf.map | 3 + src/libbpf_internal.h | 5 +- src/libbpf_version.h | 2 +- 8 files changed, 341 insertions(+), 42 deletions(-) Signed-off-by:
Andrii Nakryiko <andrii@kernel.org>
-
Andrii Nakryiko authored
Latest changes to BPF helper definitions. Signed-off-by:
Andrii Nakryiko <andrii@kernel.org>
-
David Vernet authored
In a prior change, the verifier was updated to support sleepable BPF_PROG_TYPE_STRUCT_OPS programs. A caller could set the program as sleepable with bpf_program__set_flags(), but it would be more ergonomic and more in-line with other sleepable program types if we supported suffixing a struct_ops section name with .s to indicate that it's sleepable. Signed-off-by:
David Vernet <void@manifault.com> Link: https://lore.kernel.org/r/20230125164735.785732-3-void@manifault.com Signed-off-by:
Alexei Starovoitov <ast@kernel.org>
-
Andrii Nakryiko authored
Each architecture supports at least 6 syscall argument registers, so now that specs for each architecture is defined in bpf_tracing.h, remove unnecessary macro overrides, which previously were required to keep existing BPF_KSYSCALL() uses compiling and working. Signed-off-by:
Andrii Nakryiko <andrii@kernel.org> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20230120200914.3008030-26-andrii@kernel.org
-
Andrii Nakryiko authored
Define explicit table of registers used for syscall argument passing. Signed-off-by:
Andrii Nakryiko <andrii@kernel.org> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20230120200914.3008030-24-andrii@kernel.org
-
Andrii Nakryiko authored
Define explicit table of registers used for syscall argument passing. Signed-off-by:
Andrii Nakryiko <andrii@kernel.org> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20230120200914.3008030-23-andrii@kernel.org
-
Andrii Nakryiko authored
Define explicit table of registers used for syscall argument passing. Signed-off-by:
Andrii Nakryiko <andrii@kernel.org> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net> Tested-by: Pu Lehui <pulehui@huawei.com> # RISC-V Link: https://lore.kernel.org/bpf/20230120200914.3008030-22-andrii@kernel.org
-
Andrii Nakryiko authored
Define explicit table of registers used for syscall argument passing. Signed-off-by:
Andrii Nakryiko <andrii@kernel.org> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20230120200914.3008030-21-andrii@kernel.org
-
Andrii Nakryiko authored
Define explicit table of registers used for syscall argument passing. Note that 7th arg is supported on 32-bit powerpc architecture, by not on powerpc64. Signed-off-by:
Andrii Nakryiko <andrii@kernel.org> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20230120200914.3008030-20-andrii@kernel.org
-
Andrii Nakryiko authored
Define explicit table of registers used for syscall argument passing. Signed-off-by:
Andrii Nakryiko <andrii@kernel.org> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20230120200914.3008030-19-andrii@kernel.org
-
Andrii Nakryiko authored
Define explicit table of registers used for syscall argument passing. We need PT_REGS_PARM1_[CORE_]SYSCALL macros overrides, similarly to s390x, due to orig_x0 not being present in UAPI's pt_regs, so we need to utilize BPF CO-RE and custom pt_regs___arm64 definition. Signed-off-by:
Andrii Nakryiko <andrii@kernel.org> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net> Tested-by: Alan Maguire <alan.maguire@oracle.com> # arm64 Link: https://lore.kernel.org/bpf/20230120200914.3008030-18-andrii@kernel.org
-
Andrii Nakryiko authored
Define explicit table of registers used for syscall argument passing. Signed-off-by:
Andrii Nakryiko <andrii@kernel.org> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20230120200914.3008030-17-andrii@kernel.org
-
Andrii Nakryiko authored
Define explicit table of registers used for syscall argument passing. Note that we need custom overrides for PT_REGS_PARM1_[CORE_]SYSCALL macros due to the need to use BPF CO-RE and custom local pt_regs definitions to fetch orig_gpr2, storing 1st argument. Signed-off-by:
Andrii Nakryiko <andrii@kernel.org> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net> Tested-by: Ilya Leoshkevich <iii@linux.ibm.com> # s390x Acked-by:
Ilya Leoshkevich <iii@linux.ibm.com> Link: https://lore.kernel.org/bpf/20230120200914.3008030-16-andrii@kernel.org
-
Andrii Nakryiko authored
Define explicit table of registers used for syscall argument passing. Signed-off-by:
Andrii Nakryiko <andrii@kernel.org> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20230120200914.3008030-15-andrii@kernel.org
-
Andrii Nakryiko authored
Define explicit table of registers used for syscall argument passing. Remove now unnecessary overrides of PT_REGS_PARM5_[CORE_]SYSCALL macros. Signed-off-by:
Andrii Nakryiko <andrii@kernel.org> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20230120200914.3008030-14-andrii@kernel.org
-
Andrii Nakryiko authored
Set up generic support in bpf_tracing.h for up to 7 syscall arguments tracing with BPF_KSYSCALL, which seems to be the limit according to syscall(2) manpage. Also change the way that syscall convention is specified to be more explicit. Subsequent patches will adjust and define proper per-architecture syscall conventions. __PT_PARM1_SYSCALL_REG through __PT_PARM6_SYSCALL_REG is added temporarily to keep everything working before each architecture has syscall reg tables defined. They will be removed afterwards. Signed-off-by:
Andrii Nakryiko <andrii@kernel.org> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net> Tested-by: Alan Maguire <alan.maguire@oracle.com> # arm64 Link: https://lore.kernel.org/bpf/20230120200914.3008030-13-andrii@kernel.org
-
Andrii Nakryiko authored
Add BPF_UPROBE and BPF_URETPROBE macros, aliased to BPF_KPROBE and BPF_KRETPROBE, respectively. This makes uprobe-based BPF program code much less confusing, especially to people new to tracing, at no cost in terms of maintainability. We'll use this macro in selftests in subsequent patch. Signed-off-by:
Andrii Nakryiko <andrii@kernel.org> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20230120200914.3008030-11-andrii@kernel.org
-
Andrii Nakryiko authored
Add PARM6 through PARM8 definitions. Add kernel docs link describing ABI for LoongArch. Signed-off-by:
Andrii Nakryiko <andrii@kernel.org> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20230120200914.3008030-10-andrii@kernel.org
-
Andrii Nakryiko authored
Add PARM6 through PARM8 definitions. Also fix frame pointer (FP) register definition. Also leave a link to where to find ABI spec. Signed-off-by:
Andrii Nakryiko <andrii@kernel.org> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20230120200914.3008030-9-andrii@kernel.org
-
Andrii Nakryiko authored
Add PARM6 through PARM8 definitions for RISC V (riscv) arch. Leave the link for ABI doc for future reference. Signed-off-by:
Andrii Nakryiko <andrii@kernel.org> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net> Tested-by: Pu Lehui <pulehui@huawei.com> # RISC-V Link: https://lore.kernel.org/bpf/20230120200914.3008030-8-andrii@kernel.org
-
Andrii Nakryiko authored
Add PARM6 definition for sparc architecture. Leave a link to calling convention documentation. Signed-off-by:
Andrii Nakryiko <andrii@kernel.org> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20230120200914.3008030-7-andrii@kernel.org
-
Andrii Nakryiko authored
Add definitions of PARM6 through PARM8 for powerpc architecture. Add also a link to a functiona call sequence documentation for future reference. Signed-off-by:
Andrii Nakryiko <andrii@kernel.org> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20230120200914.3008030-6-andrii@kernel.org
-
Andrii Nakryiko authored
Add registers for PARM6 through PARM8. Add a link to an ABI. We don't distinguish between O32, N32, and N64, so document that we assume N64 right now. Signed-off-by:
Andrii Nakryiko <andrii@kernel.org> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20230120200914.3008030-5-andrii@kernel.org
-
Andrii Nakryiko authored
Remove invalid support for PARM5 on 32-bit arm, as per ABI. Add three more argument registers for arm64. Also leave links to ABI specs for future reference. Signed-off-by:
Andrii Nakryiko <andrii@kernel.org> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net> Tested-by: Alan Maguire <alan.maguire@oracle.com> # arm64 Link: https://lore.kernel.org/bpf/20230120200914.3008030-4-andrii@kernel.org
-
Andrii Nakryiko authored
Add r9 as register containing 6th argument on x86-64 architecture, as per its ABI. Add also a link to a page describing ABI for easier future reference. Signed-off-by:
Andrii Nakryiko <andrii@kernel.org> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20230120200914.3008030-3-andrii@kernel.org
-
Andrii Nakryiko authored
Add BPF_KPROBE() and PT_REGS_PARMx() support for up to 8 arguments, if target architecture supports this. Currently all architectures are limited to only 5 register-placed arguments, which is limiting even on x86-64. This patch adds generic macro machinery to support up to 8 arguments both when explicitly fetching it from pt_regs through PT_REGS_PARMx() macros, as well as more ergonomic access in BPF_KPROBE(). Also, for i386 architecture we now don't have to define fake PARM4 and PARM5 definitions, they will be generically substituted, just like for PARM6 through PARM8. Subsequent patches will fill out architecture-specific definitions, where appropriate. Signed-off-by:
Andrii Nakryiko <andrii@kernel.org> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net> Tested-by: Alan Maguire <alan.maguire@oracle.com> # arm64 Tested-by: Ilya Leoshkevich <iii@linux.ibm.com> # s390x Link: https://lore.kernel.org/bpf/20230120200914.3008030-2-andrii@kernel.org
-
Stanislav Fomichev authored
New flag BPF_F_XDP_DEV_BOUND_ONLY plus all the infra to have a way to associate a netdev with a BPF program at load time. netdevsim checks are dropped in favor of generic check in dev_xdp_attach. Cc: John Fastabend <john.fastabend@gmail.com> Cc: David Ahern <dsahern@gmail.com> Cc: Martin KaFai Lau <martin.lau@linux.dev> Cc: Jakub Kicinski <kuba@kernel.org> Cc: Willem de Bruijn <willemb@google.com> Cc: Jesper Dangaard Brouer <brouer@redhat.com> Cc: Anatoly Burakov <anatoly.burakov@intel.com> Cc: Alexander Lobakin <alexandr.lobakin@intel.com> Cc: Magnus Karlsson <magnus.karlsson@gmail.com> Cc: Maryam Tahhan <mtahhan@redhat.com> Cc: xdp-hints@xdp-project.net Cc: netdev@vger.kernel.org Signed-off-by:
Stanislav Fomichev <sdf@google.com> Link: https://lore.kernel.org/r/20230119221536.3349901-6-sdf@google.com Signed-off-by:
Martin KaFai Lau <martin.lau@kernel.org>
-
Ziyang Xuan authored
Add ipip6 and ip6ip decap support for bpf_skb_adjust_room(). Main use case is for using cls_bpf on ingress hook to decapsulate IPv4 over IPv6 and IPv6 over IPv4 tunnel packets. Add two new flags BPF_F_ADJ_ROOM_DECAP_L3_IPV{4,6} to indicate the new IP header version after decapsulating the outer IP header. Suggested-by:
Willem de Bruijn <willemb@google.com> Signed-off-by:
Ziyang Xuan <william.xuanziyang@huawei.com> Reviewed-by:
Willem de Bruijn <willemb@google.com> Link: https://lore.kernel.org/r/b268ec7f0ff9431f4f43b1b40ab856ebb28cb4e1.1673574419.git.william.xuanziyang@huawei.com Signed-off-by:
Martin KaFai Lau <martin.lau@kernel.org>
-
Menglong Dong authored
'.' is not allowed in the event name of kprobe. Therefore, we will get a EINVAL if the kernel function name has a '.' in legacy kprobe attach case, such as 'icmp_reply.constprop.0'. In order to adapt this case, we need to replace the '.' with other char in gen_kprobe_legacy_event_name(). And I use '_' for this propose. Signed-off-by:
Menglong Dong <imagedong@tencent.com> Signed-off-by:
Andrii Nakryiko <andrii@kernel.org> Reviewed-by:
Alan Maguire <alan.maguire@oracle.com> Link: https://lore.kernel.org/bpf/20230113093427.1666466-1-imagedong@tencent.com
-
Ludovic L'Hours authored
As BPF_F_MMAPABLE flag is now conditionnaly set (by map_is_mmapable), it should not be toggled but disabled if not supported by kernel. Fixes: 4fcac46c7e10 ("libbpf: only add BPF_F_MMAPABLE flag for data maps with global vars") Signed-off-by:
Ludovic L'Hours <ludovic.lhours@gmail.com> Acked-by:
Jiri Olsa <jolsa@kernel.org> Link: https://lore.kernel.org/r/20230108182018.24433-1-ludovic.lhours@gmail.com Signed-off-by:
Martin KaFai Lau <martin.lau@kernel.org>
-
Rong Tao authored
Since commit 9fc205b413b3("libbpf: Add sane strncpy alternative and use it internally") introduce libbpf_strlcpy(), thus add strlcpy() to a poison list to prevent accidental use of it. Signed-off-by:
Rong Tao <rongtao@cestc.cn> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net> Acked-by:
Stanislav Fomichev <sdf@google.com> Link: https://lore.kernel.org/bpf/tencent_5695A257C4D16B4413036BA1DAACDECB0B07@qq.com
-
Changbin Du authored
As discussed before, return -ENODATA (No data available) would be more meaningful than ENOENT (No such file or directory). Suggested-by:
Leo Yan <leo.yan@linaro.org> Signed-off-by:
Changbin Du <changbin.du@gmail.com> Signed-off-by:
Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20221231151436.6541-1-changbin.du@gmail.com
-
Hengqi Chen authored
Add PT_REGS macros for LoongArch ([0]). [0]: https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html Signed-off-by:
Hengqi Chen <hengqi.chen@gmail.com> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net> Acked-by:
Huacai Chen <chenhuacai@loongson.cn> Link: https://lore.kernel.org/bpf/20221231100757.3177034-1-hengqi.chen@gmail.com
-
Alexei Starovoitov authored
pr_warn calls into user-provided callback, which can clobber errno, so `errno = saved_errno` should happen after pr_warn. Fixes: 07453245620c ("libbpf: fix errno is overwritten after being closed.") Signed-off-by:
Alexei Starovoitov <ast@kernel.org>
-