8000 Libbpf sync 2025-05-19T12:53:49.313Z by mykyta5 · Pull Request #900 · libbpf/libbpf · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Libbpf sync 2025-05-19T12:53:49.313Z #900

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

Merged
merged 7 commits into from
May 19, 2025

Conversation

mykyta5
Copy link
Contributor
@mykyta5 mykyta5 commented May 19, 2025
Dumping existing libbpf commit signatures...
WORKDIR:          /home/yatsenko/git/libbpf
LINUX REPO:       /home/yatsenko/git/linux
LIBBPF REPO:      /home/yatsenko/git/libbpf
TEMP DIR:         /tmp/tmp.X9B9ZivxGE
SUFFIX:           2025-05-19T12-53-49.313Z
BASE COMMIT:      '8e64c387c942 ("libbpf: Add identical pointer detection to btf_dedup_is_equiv()")'
TIP COMMIT:       '9325d53fe9ad ("Merge branch 's390-bpf-remove-the-orig_call-null-check'")'
BPF BASE COMMIT:  'b4432656b36e ("Linux 6.15-rc4")'
BPF TIP COMMIT:   'b4432656b36e ("Linux 6.15-rc4")'
SQUASH COMMIT:    d2f498d8be2bc89ac2e07373d2b5a99531ea3bac
BASELINE TAG:     libbpf-baseline-2025-05-19T12-53-49.313Z
TIP TAG:          libbpf-tip-2025-05-19T12-53-49.313Z
BPF BASELINE TAG: libbpf-bpf-baseline-2025-05-19T12-53-49.313Z
BPF TIP TAG:      libbpf-bpf-tip-2025-05-19T12-53-49.313Z
SQUASH BASE TAG:  libbpf-squash-base-2025-05-19T12-53-49.313Z
SQUASH TIP TAG:   libbpf-squash-tip-2025-05-19T12-53-49.313Z
VIEW TAG:         libbpf-view-2025-05-19T12-53-49.313Z
LIBBPF SYNC TAG:  libbpf-sync-2025-05-19T12-53-49.313Z
PATCHES:          /tmp/tmp.X9B9ZivxGE/patches
Switched to a new branch 'libbpf-squash-tip-2025-05-19T12-53-49.313Z'
Picking '358b1c0f56eb ("libbpf: Use proper errno value in linker")'...
Picking '41d4ce6df3f4 ("bpf: Fix uninitialized values in BPF_{CORE,PROBE}_READ")'...
Picking '62e23f183839 ("libbpf: Improve BTF dedup handling of "identical" BTF types")'...
Picking '823153334042 ("bpf: Add support to retrieve ref_ctr_offset for uprobe perf link")'...
Picking 'fd5fd538a1f4 ("libbpf: Use proper errno value in nlattr")'...
Picking 'd0445d7dd3fd ("libbpf: Check bpf_map_skeleton link for NULL")'...
Rewrite f30567611625821f3ee81f5f73e0f2a39552c4fd (7/7) (14 seconds passed, remaining 0 predicted)     
Ref 'refs/heads/libbpf-squash-tip-2025-05-19T12-53-49.313Z' was rewritten
Ref 'refs/heads/libbpf-squash-base-2025-05-19T12-53-49.313Z' was rewritten
Rewrite 773b9f46a7b2c6b90e1a202af70758c654bdb837 (5/7) (1 seconds passed, remaining 0 predicted)    
Ref 'refs/heads/libbpf-squash-tip-2025-05-19T12-53-49.313Z' was rewritten
Ref 'refs/hea
8000
ds/libbpf-squash-base-2025-05-19T12-53-49.313Z' was rewritten
/tmp/tmp.X9B9ZivxGE/patches/0000-cover-letter.patch
/tmp/tmp.X9B9ZivxGE/patches/0001-libbpf-Use-proper-errno-value-in-linker.patch
/tmp/tmp.X9B9ZivxGE/patches/0002-bpf-Fix-uninitialized-values-in-BPF_-CORE-PROBE-_REA.patch
/tmp/tmp.X9B9ZivxGE/patches/0003-libbpf-Improve-BTF-dedup-handling-of-identical-BTF-t.patch
/tmp/tmp.X9B9ZivxGE/patches/0004-bpf-Add-support-to-retrieve-ref_ctr_offset-for-uprob.patch
/tmp/tmp.X9B9ZivxGE/patches/0005-libbpf-Use-proper-errno-value-in-nlattr.patch
/tmp/tmp.X9B9ZivxGE/patches/0006-libbpf-Check-bpf_map_skeleton-link-for-NULL.patch
Switched to a new branch 'libbpf-sync-2025-05-19T12-53-49.313Z'
Applying: libbpf: Use proper errno value in linker
Applying: bpf: Fix uninitialized values in BPF_{CORE,PROBE}_READ
Applying: libbpf: Improve BTF dedup handling of "identical" BTF types
Applying: bpf: Add support to retrieve ref_ctr_offset for uprobe perf link
Applying: libbpf: Use proper errno value in nlattr
Applying: libbpf: Check bpf_map_skeleton link for NULL
Updating files: 100% (88883/88883), done.
Switched to branch 'libbpf-tip-2025-05-19T12-53-49.313Z'
Regenerating .mailmap...
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
[libbpf-sync-2025-05-19T12-53-49.313Z feb7c0844119] sync: latest libbpf changes from kernel
 1 file changed, 1 insertion(+), 1 deletion(-)
SUCCESS! 6 commits synced.
Verifying Linux's and Github's libbpf state
Switched to a new branch 'libbpf-view-2025-05-19T12-53-49.313Z'
Rewrite 9325d53fe9adff354b6a93fda5f38c165947da0f (3/3) (8 seconds passed, remaining 0 predicted)    
Ref 'refs/heads/libbpf-view-2025-05-19T12-53-49.313Z' was rewritten
Rewrite d0901a4a5b9c6ae3c722818da5d1a25ef1f44488 (1/1) (0 seconds passed, remaining 0 predicted)    
Ref 'refs/heads/libbpf-view-2025-05-19T12-53-49.313Z' was rewritten
Comparing list of files...
Comparing file contents...
Great! Content is identical!
Cleaning up...
Updating files: 100% (88883/88883), done.
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
Deleted branch libbpf-baseline-2025-05-19T12-53-49.313Z (was 8e64c387c942).
Deleted branch libbpf-tip-2025-05-19T12-53-49.313Z (was 9325d53fe9ad).
Deleted branch libbpf-bpf-baseline-2025-05-19T12-53-49.313Z (was b4432656b36e).
Deleted branch libbpf-bpf-tip-2025-05-19T12-53-49.313Z (was b4432656b36e).
Deleted branch libbpf-squash-base-2025-05-19T12-53-49.313Z (was 7f2cf6f79dee).
Deleted branch libbpf-squash-tip-2025-05-19T12-53-49.313Z (was 7a3692c429ef).
Deleted branch libbpf-view-2025-05-19T12-53-49.313Z (was dabb4e96fb53).
DONE.

aspsk and others added 7 commits April 30, 2025 12:08
Return values of the linker_append_sec_data() and the
linker_append_elf_relos() functions are propagated all the
way up to users of libbpf API. In some error cases these
functions return -1 which will be seen as -EPERM from user's
point of view. Instead, return a more reasonable -EINVAL.

Fixes: faf6ed321cf6 ("libbpf: Add BPF static linker APIs")
Signed-off-by: Anton Protopopov <a.s.protopopov@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20250430120820.2262053-1-a.s.protopopov@gmail.com
With the latest LLVM bpf selftests build will fail with
the following error message:

    progs/profiler.inc.h:710:31: error: default initialization of an object of type 'typeof ((parent_task)->real_cred->uid.val)' (aka 'const unsigned int') leaves the object uninitialized and is incompatible with C++ [-Werror,-Wdefault-const-init-unsafe]
      710 |         proc_exec_data->parent_uid = BPF_CORE_READ(parent_task, real_cred, uid.val);
          |                                      ^
    tools/testing/selftests/bpf/tools/include/bpf/bpf_core_read.h:520:35: note: expanded from macro 'BPF_CORE_READ'
      520 |         ___type((src), a, ##__VA_ARGS__) __r;                               \
          |                                          ^

This happens because BPF_CORE_READ (and other macro) declare the
variable __r using the ___type macro which can inherit const modifier
from intermediate types.

Fix this by using __typeof_unqual__, when supported. (And when it
is not supported, the problem shouldn't appear, as older compilers
haven't complained.)

Fixes: 792001f4f7aa ("libbpf: Add user-space variants of BPF_CORE_READ() family of macros")
Fixes: a4b09a9ef945 ("libbpf: Add non-CO-RE variants of BPF_CORE_READ() macro family")
Signed-off-by: Anton Protopopov <a.s.protopopov@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20250502193031.3522715-1-a.s.protopopov@gmail.com
BTF dedup has a strong assumption that compiler with deduplicate identical
types within any given compilation unit (i.e., .c file). This property
is used when establishing equilvalence of two subgraphs of types.

Unfortunately, this property doesn't always holds in practice. We've
seen cases of having truly identical structs, unions, array definitions,
and, most recently, even pointers to the same type being duplicated
within CU.

Previously, we mitigated this on a case-by-case basis, adding a few
simple heuristics for validating that two BTF types (having two
different type IDs) are structurally the same. But this approach scales
poorly, and we can have more weird cases come up in the future.

So let's take a half-step back, and implement a bit more generic
structural equivalence check, recursively. We still limit it to
reasonable depth to avoid long reference loops. Depth-wise limiting of
potentially cyclical graph isn't great, but as I mentioned below doesn't
seem to be detrimental performance-wise. We can always improve this in
the future with per-type visited markers, if necessary.

Performance-wise this doesn't seem too affect vmlinux BTF dedup, which
makes sense because this logic kicks in not so frequently and only if we
already established a canonical candidate type match, but suddenly find
a different (but probably identical) type.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Reviewed-by: Alan Maguire <alan.maguire@oracle.com>
Link: https://lore.kernel.org/r/20250501235231.1339822-1-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Adding support to retrieve ref_ctr_offset for uprobe perf link,
which got somehow omitted from the initial uprobe link info changes.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Yafang Shao <laoar.shao@gmail.com>
Link: https://lore.kernel.org/bpf/20250509153539.779599-2-jolsa@kernel.org
Return value of the validate_nla() function can be propagated all the
way up to users of libbpf API. In case of error this libbpf version
of validate_nla returns -1 which will be seen as -EPERM from user's
point of view. Instead, return a more reasonable -EINVAL.

Fixes: bbf48c18ee0c ("libbpf: add error reporting in XDP")
Suggested-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Anton Protopopov <a.s.protopopov@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20250510182011.2246631-1-a.s.protopopov@gmail.com
Avoid dereferencing bpf_map_skeleton's link field if it's NULL.
If BPF map skeleton is created with the size, that indicates containing
link field, but the field was not actually initialized with valid
bpf_link pointer, libbpf crashes. This may happen when using libbpf-rs
skeleton.
Skeleton loading may still progress, but user needs to attach struct_ops
map separately.

Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20250514113220.219095-1-mykyta.yatsenko5@gmail.com
Syncing latest libbpf commits from kernel repository.
Baseline bpf-next commit:   8e64c387c942229c551d0f23de4d9993d3a2acb6
Checkpoint bpf-next commit: 9325d53fe9adff354b6a93fda5f38c165947da0f
Baseline bpf commit:        b4432656b36e5cc1d50a1f2dc15357543add530e
Checkpoint bpf commit:      b4432656b36e5cc1d50a1f2dc15357543add530e

Andrii Nakryiko (1):
  libbpf: Improve BTF dedup handling of "identical" BTF types

Anton Protopopov (3):
  libbpf: Use proper errno value in linker
  bpf: Fix uninitialized values in BPF_{CORE,PROBE}_READ
  libbpf: Use proper errno value in nlattr

Jiri Olsa (1):
  bpf: Add support to retrieve ref_ctr_offset for uprobe perf link

Mykyta Yatsenko (1):
  libbpf: Check bpf_map_skeleton link for NULL

 include/uapi/linux/bpf.h |   1 +
 src/bpf_core_read.h      |   6 ++
 src/btf.c                | 137 +++++++++++++++++++++++++--------------
 src/libbpf.c             |   6 ++
 src/linker.c             |   4 +-
 src/nlattr.c             |  15 ++---
 6 files changed, 111 insertions(+), 58 deletions(-)

Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>
@anakryiko anakryiko merged commit 02bdeb7 into libbpf:master May 19, 2025
25 checks passed
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.

4 participants
0