]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests/bpf: Fix bpf_iter/task_vma test
authorYonghong Song <yonghong.song@linux.dev>
Wed, 10 Jun 2026 05:18:31 +0000 (22:18 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 10 Jun 2026 15:02:29 +0000 (08:02 -0700)
For selftest bpf_iter/task_vma, I got a failure like below on my qemu run:

test_task_vma_common:FAIL:compare_output unexpected compare_output:
    actual
    '561593546000-561593585000r--p0000000000:241256579534/root/devshare/bpf-next/tools/testing/selftests/bpf/test_progs'
    != expected
    '561593546000-561593585000r--p0000000000:245551546830/root/devshare/bpf-next/tools/testing/selftests/bpf/test_progs'

Further debugging found out file->f_inode->i_ino value may exceed 32bit,
e.g., i_ino = 0x14c2eae35, but the format string is '%u'. This caused
inode mismatch between bpf iter and proc result.

Fix the issue by using format string '%llu' to accommodate 64bit i_ino.

Fixes: e8168840e16c ("selftests/bpf: Add test for bpf_iter_task_vma")
Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
Acked-by: Leon Hwang <leon.hwang@linux.dev>
Link: https://lore.kernel.org/r/20260610051831.1346659-1-yonghong.song@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/progs/bpf_iter_task_vmas.c

index d64ba7ddaed54e36ae9efda5aa873adbcafd6796..d7fb561ed4fb90bc300b7bd94832da0cc57857e9 100644 (file)
@@ -52,7 +52,7 @@ SEC("iter/task_vma") int proc_maps(struct bpf_iter__task_vma *ctx)
                bpf_d_path(&file->f_path, d_path_buf, D_PATH_BUF_SIZE);
 
                BPF_SEQ_PRINTF(seq, "%08llx ", vma->vm_pgoff << 12);
-               BPF_SEQ_PRINTF(seq, "%02x:%02x %u", MAJOR(dev), MINOR(dev),
+               BPF_SEQ_PRINTF(seq, "%02x:%02x %llu", MAJOR(dev), MINOR(dev),
                               file->f_inode->i_ino);
                BPF_SEQ_PRINTF(seq, "\t%s\n", d_path_buf);
        } else {