Skip to contentSkip to conversation

selftests/bpf: don't hard-code root cgroup id

PATCH Applied Stanislav Fomichev 2 participants 2 messages Dec 2, 2019 – Dec 5, 2019

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/bpf: don't hard-code root cgroup id

Commit 40430452fd5d ("kernfs: use 64bit inos if ino_t is 64bit") changed the way cgroup ids are exposed to the userspace. Instead of assuming fixed root id, let's query it.

Fixes 40430452fd5d ("kernfs: use 64bit inos if ino_t is 64bit")
---
 tools/testing/selftests/bpf/test_skb_cgroup_id_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/test_skb_cgroup_id_user.c +1 -1
index 9220747c069d..356351c0ac28 100644
@@ -120,7 +120,7 @@ int check_ancestor_cgroup_ids(int prog_id)
 	int err = 0;
 	int map_fd;
 
-	expected_ids[0] = 0x100000001;	/* root cgroup */
+	expected_ids[0] = get_cgroup_id("/..");	/* root cgroup */
 	expected_ids[1] = get_cgroup_id("");
 	expected_ids[2] = get_cgroup_id(CGROUP_PATH);
 	expected_ids[3] = 0; /* non-existent cgroup */
Signature · 1 line
2.24.0.393.g34dc348eaf-goog
#1 lore raw
Quoted 7 lines · Stanislav Fomichev

Commit 40430452fd5d ("kernfs: use 64bit inos if ino_t is 64bit") changed the way cgroup ids are exposed to the userspace. Instead of assuming fixed root id, let's query it.

Fixes 40430452fd5d ("kernfs: use 64bit inos if ino_t is 64bit")

Applied. Thanks for the fix!