]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
libbpf: Fix faccessat() usage on Android
authorAndrii Nakryiko <andrii@kernel.org>
Fri, 26 Jan 2024 22:09:44 +0000 (14:09 -0800)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:19:23 +0000 (18:19 -0400)
commited168d6c381c889751632b1d8710edbc54c35b56
tree9e70d0087aef7f8f4628a7ba2dbbf6e3fd67abb5
parentff1a989b4a2fc804f345a4352fdc2dc5c642ef9d
libbpf: Fix faccessat() usage on Android

[ Upstream commit ad57654053805bf9a62602aaec74cc78edb6f235 ]

Android implementation of libc errors out with -EINVAL in faccessat() if
passed AT_EACCESS ([0]), this leads to ridiculous issue with libbpf
refusing to load /sys/kernel/btf/vmlinux on Androids ([1]). Fix by
detecting Android and redefining AT_EACCESS to 0, it's equivalent on
Android.

  [0] https://android.googlesource.com/platform/bionic/+/refs/heads/android13-release/libc/bionic/faccessat.cpp#50
  [1] https://github.com/libbpf/libbpf-bootstrap/issues/250#issuecomment-1911324250

Fixes: 6a4ab8869d0b ("libbpf: Fix the case of running as non-root with capabilities")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/bpf/20240126220944.2497665-1-andrii@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/lib/bpf/libbpf_internal.h