On 6/27/25 2:34 PM, Alexei Starovoitov wrote:
On Fri, Jun 27, 2025 at 2:19 PM Ihor Solodrai <ihor.solodrai@xxxxxxxxx> wrote:
On 6/27/25 12:12 PM, Song Liu wrote:
cgroup_xattr/read_cgroupfs_xattr has two issues:
1. cgroup_xattr/read_cgroupfs_xattr messes up lo without creating a netns
first. This causes issue with other tests.
Fix this by using a different hook (lsm.s/file_open) and not messing
with lo.
2. cgroup_xattr/read_cgroupfs_xattr sets up cgroups without proper
mount namespaces.
Fix this by using the existing cgroup helpers. A new helper
set_cgroup_xattr() is added to set xattr on cgroup files.
Fixes: f4fba2d6d282 ("selftests/bpf: Add tests for bpf_cgroup_read_xattr")
Reported-by: Alexei Starovoitov <ast@xxxxxxxxxx>
Closes: https://lore.kernel.org/bpf/CAADnVQ+iqMi2HEj_iH7hsx+XJAsqaMWqSDe4tzcGAnehFWA9Sw@xxxxxxxxxxxxxx/
Signed-off-by: Song Liu <song@xxxxxxxxxx>
---
Changes v1 => v2:
1. Add the second fix above.
v1: https://lore.kernel.org/bpf/20250627165831.2979022-1-song@xxxxxxxxxx/
---
tools/testing/selftests/bpf/cgroup_helpers.c | 21 ++++
tools/testing/selftests/bpf/cgroup_helpers.h | 4 +
.../selftests/bpf/prog_tests/cgroup_xattr.c | 117 ++++--------------
.../selftests/bpf/progs/read_cgroupfs_xattr.c | 4 +-
4 files changed, 49 insertions(+), 97 deletions(-)
Hi Song.
I tried this patch on BPF CI, and it appears it fixes the hanging
failure we've been seeing today on bpf-next and netdev.
I am going to add it to ci/diffs.
Applied to bpf-next already.
CI patches apply to all base branches. My understanding is, it's needed
at least for netdev too.