Skip to content
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

Bpftool sync 2024-10-14 #168

Merged
merged 6 commits into from
Oct 14, 2024

Conversation

qmonnet
Copy link
Member

@qmonnet qmonnet commented Oct 14, 2024

Pull latest libbpf from mirror and sync bpftool repo with kernel, up to the commits used for libbpf sync. This is an automatic update performed by calling the sync script from this repo:

$ ./scripts/sync-kernel.sh . <path/to/>linux

Although there's only one patch affecting bpftool directly, we're also interesting in pulling the changes from libbpf, with support for cross-compiling with BPF skeletons.

Fixes: #81

eddyz87 and others added 6 commits September 16, 2024 02:17
Generate __attribute__((bpf_fastcall)) for kfuncs marked with
"bpf_fastcall" decl tag. E.g. for the following BTF:

    $ bpftool btf dump file vmlinux
    ...
    [A] FUNC 'bpf_rdonly_cast' type_id=...
    ...
    [B] DECL_TAG 'bpf_kfunc' type_id=A component_idx=-1
    [C] DECL_TAG 'bpf_fastcall' type_id=A component_idx=-1

Generate the following vmlinux.h:

    #ifndef __VMLINUX_H__
    #define __VMLINUX_H__
    ...
    #ifndef __bpf_fastcall
    #if __has_attribute(bpf_fastcall)
    #define __bpf_fastcall __attribute__((bpf_fastcall))
    #else
    #define __bpf_fastcall
    #endif
    #endif
    ...
    __bpf_fastcall extern void *bpf_rdonly_cast(...) ...;

The "bpf_fastcall" / "bpf_kfunc" tags pair would generated by pahole
when constructing vmlinux BTF.

While at it, sort printed kfuncs by name for better vmlinux.h
stability.

Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20240916091712.2929279-5-eddyz87@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
The `index` argument to bpf_loop() is threaded as an u64.
This lead in a subtle verifier denial where clang cloned the argument
in another register[1].

[1] systemd/systemd#34650 (comment)

Signed-off-by: Matteo Croce <teknoraver@meta.com>
Link: https://lore.kernel.org/r/20241010035652.17830-1-technoboy85@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
The documentation says CONFIG_FUNCTION_ERROR_INJECTION is supported only
on x86. This was presumably true at the time of writing, but it's now
supported on many other architectures too. Drop this statement, since
it's not correct anymore and it fits better in other documentation
anyway.

Signed-off-by: Martin Kelly <martin.kelly@crowdstrike.com>
Link: https://lore.kernel.org/r/20241010193301.995909-1-martin.kelly@crowdstrike.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Pull latest libbpf from mirror.
Libbpf version: 1.5.0
Libbpf commit:  fc064eb41e9de925beaeaf5b656ecf0f5ff83c08

Signed-off-by: Quentin Monnet <qmo@kernel.org>
Since [1] kernel supports __bpf_fastcall attribute for helper function
bpf_get_smp_processor_id(). Update uapi definition for this helper in
order to have this attribute in the generated bpf_helper_defs.h

[1] commit 91b7fbf3936f ("bpf, x86, riscv, arm: no_caller_saved_registers for bpf_get_smp_processor_id()")

Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20240916091712.2929279-3-eddyz87@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Syncing latest bpftool commits from kernel repository.
Baseline bpf-next commit:   b24d7f0da6ef5a23456a301eaf51b170f961d4ae
Checkpoint bpf-next commit: 989a29cfed9b5092c3e18be14e9032c51bb1c9f6
Baseline bpf commit:        b24d7f0da6ef5a23456a301eaf51b170f961d4ae
Checkpoint bpf commit:      b836cbdf3b81a4a22b3452186efa2e5105a77e10

Eduard Zingerman (2):
  bpf: __bpf_fastcall for bpf_get_smp_processor_id in uapi
  bpftool: __bpf_fastcall for kfuncs marked with special decl_tag

Martin Kelly (1):
  bpf: Update bpf_override_return() comment

Matteo Croce (1):
  bpf: fix argument type in bpf_loop documentation

 include/uapi/linux/bpf.h |  8 ++--
 src/btf.c                | 98 ++++++++++++++++++++++++++++++++++++----
 2 files changed, 91 insertions(+), 15 deletions(-)

Signed-off-by: Quentin Monnet <qmo@kernel.org>
@qmonnet qmonnet changed the title Bpftool sync 2024 10 14 t08 49 25.865 z Bpftool sync 2024-10-14 Oct 14, 2024
@qmonnet qmonnet merged commit 39d789e into libbpf:main Oct 14, 2024
6 checks passed
@qmonnet qmonnet deleted the bpftool-sync-2024-10-14T08-49-25.865Z branch October 14, 2024 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Skeletons: Support cross-compiling towards architectures with different endianness
3 participants