[bpf] selftests/bpf: don't hard-code root cgroup id
diff mbox series

Message ID 20191202200143.250793-1-sdf@google.com
State Accepted
Delegated to: BPF Maintainers
Headers show
Series
  • [bpf] selftests/bpf: don't hard-code root cgroup id
Related show

Commit Message

Stanislav Fomichev Dec. 2, 2019, 8:01 p.m. UTC
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")
Signed-off-by: Stanislav Fomichev <sdf@google.com>
---
 tools/testing/selftests/bpf/test_skb_cgroup_id_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexei Starovoitov Dec. 5, 2019, 1:57 a.m. UTC | #1
On Mon, Dec 2, 2019 at 12:01 PM Stanislav Fomichev <sdf@google.com> wrote:
>
> 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")
> Signed-off-by: Stanislav Fomichev <sdf@google.com>

Applied. Thanks for the fix!

Patch
diff mbox series

diff --git a/tools/testing/selftests/bpf/test_skb_cgroup_id_user.c b/tools/testing/selftests/bpf/test_skb_cgroup_id_user.c
index 9220747c069d..356351c0ac28 100644
--- a/tools/testing/selftests/bpf/test_skb_cgroup_id_user.c
+++ b/tools/testing/selftests/bpf/test_skb_cgroup_id_user.c
@@ -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 */