hi, >Can't reproduce. Please, post "strace -f ./proc-pid-vm". test in "Debian GNU/Linux bookworm/sid" And the strace output is attached. best regards, ________________________________________ From: Alexey Dobriyan <adobriyan@xxxxxxxxx> Sent: Friday, September 9, 2022 1:20 PM To: Zhou, Jie2X Cc: shuah@xxxxxxxxxx; guozhengkui@xxxxxxxx; akpm@xxxxxxxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; linux-fsdevel@xxxxxxxxxxxxxxx; linux-kselftest@xxxxxxxxxxxxxxx; Li, Philip Subject: Re: make run_tests -C proc: proc-pid-vm assertion failed. On Fri, Sep 09, 2022 at 10:19:16AM +0800, Jie2x Zhou wrote: > hi, > > The test error is caused by g_vsyscall set failed. > Error output: > selftests: proc: proc-pid-vm > proc-pid-vm: proc-pid-vm.c:389: main: Assertion `rv == len' failed. > Aborted > > g_vsyscall is set to 0. > In proc-pid-vm.c: > /* > * 0: vsyscall VMA doesn't exist vsyscall=none > * 1: vsyscall VMA is r-xp vsyscall=emulate > * 2: vsyscall VMA is --xp vsyscall=xonly > */ > static int g_vsyscall; > static const char *str_vsyscall; > > static const char str_vsyscall_0[] = ""; > static const char str_vsyscall_1[] = > "ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]\n"; > static const char str_vsyscall_2[] = > "ffffffffff600000-ffffffffff601000 --xp 00000000 00:00 0 [vsyscall]\n"; > > The /proc/%u/maps output is: > buf=100000000-100001000 r-xp 00000000 00:2d 2 /tmp/#2 (deleted) > ffffffffff600000-ffffffffff601000 --xp 00000000 00:00 0 [vsyscall] > > So the g_vsyscall should be 2 according to commentary(2: vsyscall VMA is --xp). > Is it a bug? Can't reproduce. Please, post "strace -f ./proc-pid-vm".
execve("./proc-pid-vm", ["./proc-pid-vm"], 0x7ffe5aee08c8 /* 111 vars */) = 0 brk(NULL) = 0x55cafcf35000 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f48d79c3000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=29295, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 29295, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f48d79bb000 close(3) = 0 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300\223\2\0\0\0\0\0"..., 832) = 832 pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784 pread64(3, "\4\0\0\0\20\0\0\0\5\0\0\0GNU\0\2\200\0\300\4\0\0\0\1\0\0\0\0\0\0\0", 32, 848) = 32 pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\335~7a\231\333\307\256\207\267%F\271\34\267\211"..., 68, 880) = 68 newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=2049032, ...}, AT_EMPTY_PATH) = 0 pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784 mmap(NULL, 2101136, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f48d77ba000 mmap(0x7f48d77e2000, 1499136, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x28000) = 0x7f48d77e2000 mmap(0x7f48d7950000, 360448, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x196000) = 0x7f48d7950000 mmap(0x7f48d79a8000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1ed000) = 0x7f48d79a8000 mmap(0x7f48d79ae000, 53136, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f48d79ae000 close(3) = 0 mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f48d77b7000 arch_prctl(ARCH_SET_FS, 0x7f48d77b7740) = 0 set_tid_address(0x7f48d77b7a10) = 10678 set_robust_list(0x7f48d77b7a20, 24) = 0 mprotect(0x7f48d79a8000, 16384, PROT_READ) = 0 mprotect(0x55cafc70a000, 4096, PROT_READ) = 0 mprotect(0x7f48d79f5000, 8192, PROT_READ) = 0 prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0 munmap(0x7f48d79bb000, 29295) = 0 clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f48d77b7a10) = 10679 strace: Process 10679 attached [pid 10678] wait4(10679, <unfinished ...> [pid 10679] set_robust_list(0x7f48d77b7a20, 24) = 0 [pid 10679] prlimit64(0, RLIMIT_CORE, {rlim_cur=0, rlim_max=0}, NULL) = 0 [pid 10679] rt_sigaction(SIGSEGV, {sa_handler=0x55cafc708080, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x7f48d77f7af0}, NULL, 8) = 0 [pid 10679] --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x55cafbd06000} --- [pid 10679] exit_group(1) = ? [pid 10679] +++ exited with 1 +++ <... wait4 resumed>[{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0, NULL) = 10679 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=10679, si_uid=0, si_status=1, si_utime=0, si_stime=0} --- unshare(CLONE_NEWNS) = 0 mount(NULL, "/", NULL, MS_REC|MS_PRIVATE, NULL) = 0 mount(NULL, "/tmp", "tmpfs", 0, NULL) = 0 close(0) = 0 openat(AT_FDCWD, "/", O_RDONLY|O_PATH|O_DIRECTORY) = 0 openat(AT_FDCWD, "/tmp", O_WRONLY|O_EXCL|O_TMPFILE, 0700) = 3 writev(3, [{iov_base="\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\2\0>\0\1\0\0\0x\0\0\0\1\0\0\0"..., iov_len=64}, {iov_base="\1\0\0\0\5\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0"..., iov_len=56}, {iov_base="H\277\0\20\0\0\1\0\0\0H\276\0\340\377\377\376\177\0\0\270\v\0\0\0\17\0051\377H\2155"..., iov_len=57}], 3) = 177 openat(AT_FDCWD, "/proc/self/fd/3", O_RDONLY|O_CLOEXEC) = 4 close(3) = 0 pipe([3, 5]) = 0 dup2(5, 0) = 0 clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLDstrace: Process 10680 attached , child_tidptr=0x7f48d77b7a10) = 10680 [pid 10680] set_robust_list(0x7f48d77b7a20, 24 <unfinished ...> [pid 10678] read(3, <unfinished ...> [pid 10680] <... set_robust_list resumed>) = 0 [pid 10680] execveat(4, "", NULL, NULL, AT_EMPTY_PATH) = 0 [pid 10680] munmap(0x100001000, 140733193379840) = 0 [pid 10680] write(0, "\272", 1) = 1 [pid 10678] <... read resumed>"\272", 1) = 1 [pid 10680] pause( <unfinished ...> [pid 10678] newfstatat(4, "", {st_mode=S_IFREG|0700, st_size=177, ...}, AT_EMPTY_PATH) = 0 [pid 10678] openat(AT_FDCWD, "/proc/10680/maps", O_RDONLY) = 6 [pid 10678] read(6, "100000000-100001000 r-xp 0000000"..., 256) = 175 [pid 10678] getrandom("\x39\xfb\x5d\x5b\x64\xbf\x58\x89", 8, GRND_NONBLOCK) = 8 [pid 10678] brk(NULL) = 0x55cafcf35000 [pid 10678] brk(0x55cafcf56000) = 0x55cafcf56000 [pid 10678] write(2, "proc-pid-vm: proc-pid-vm.c:389: "..., 68proc-pid-vm: proc-pid-vm.c:389: main: Assertion `rv == len' failed. ) = 68 [pid 10678] mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f48d79c2000 [pid 10678] rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0 [pid 10678] gettid() = 10678 [pid 10678] getpid() = 10678 [pid 10678] tgkill(10678, 10678, SIGABRT) = 0 [pid 10678] --- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=10678, si_uid=0} --- [pid 10678] +++ killed by SIGABRT +++ <... pause resumed>) = ? ERESTARTNOHAND (To be restarted if no handler) strace: Process 10680 detached