On 2023/07/07 5:53, Jakub Kicinski wrote: > On Tue, 4 Jul 2023 22:32:00 +0900 Tetsuo Handa wrote: >> I found a simplified reproducer. >> This problem happens when splice() and sendmsg() run in parallel. > > Could you retry with the upstream (tip of Linus's tree) and see if it > still repros? I tried to get a KMSAN kernel to boot on QEMU but it > the kernel doesn't want to start, no idea what's going on :( I can't reproduce this problem as of commit a452483508d7 of linux.git tree, for the simplified reproducer is failing with EBADMSG error. Unless what the simplified reproducer is doing has become illegal, I need to bisect between commit 219d92056ba3 ("splice, net: Fix SPLICE_F_MORE signalling in splice_direct_to_actor()") which fails with EBADMSG error and commit 8a0d57df8938 ("tls: improve lockless access safety of tls_err_abort()") which shows this problem, with commit e6bc8833d80f ("string: use __builtin_memcpy() in strlcpy/strlcat") backported... ---------------------------------------- root@fuzz:~# strace -f ./a.out execve("./a.out", ["./a.out"], 0x7ffedb58a368 /* 26 vars */) = 0 brk(NULL) = 0x564cb3f30000 arch_prctl(0x3001 /* ARCH_??? */, 0x7ffd9c8980a0) = -1 EINVAL (Invalid argument) mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f463d4e6000 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=37735, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 37735, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f463d4dc000 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\0P\237\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 \0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0"..., 48, 848) = 48 pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0i8\235HZ\227\223\333\350s\360\352,\223\340."..., 68, 896) = 68 newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=2216304, ...}, 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, 2260560, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f463d200000 mmap(0x7f463d228000, 1658880, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x28000) = 0x7f463d228000 mmap(0x7f463d3bd000, 360448, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bd000) = 0x7f463d3bd000 mmap(0x7f463d415000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x214000) = 0x7f463d415000 mmap(0x7f463d41b000, 52816, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f463d41b000 close(3) = 0 mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f463d4d9000 arch_prctl(ARCH_SET_FS, 0x7f463d4d9740) = 0 set_tid_address(0x7f463d4d9a10) = 3444 set_robust_list(0x7f463d4d9a20, 24) = 0 rseq(0x7f463d4da0e0, 0x20, 0, 0x53053053) = 0 mprotect(0x7f463d415000, 16384, PROT_READ) = 0 mprotect(0x564cb38ac000, 4096, PROT_READ) = 0 mprotect(0x7f463d520000, 8192, PROT_READ) = 0 prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0 munmap(0x7f463d4dc000, 37735) = 0 socket(AF_INET6, SOCK_STREAM, IPPROTO_IP) = 3 pipe2([4, 5], 0) = 0 setsockopt(3, SOL_TCP, TCP_REPAIR, [1], 4) = 0 connect(3, {sa_family=AF_INET6, sin6_port=htons(0), sin6_flowinfo=htonl(0), inet_pton(AF_INET6, "::1", &sin6_addr), sin6_scope_id=0}, 28) = 0 setsockopt(3, SOL_TCP, TCP_ULP, [7564404], 4) = 0 setsockopt(3, SOL_TLS, TLS_TX, "\3\0035\0%T\244\205\333\f0\362B\221\243\234\206\216\220\243u\347\342P|1\24}Q@\377\227"..., 40) = 0 clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLDstrace: Process 3445 attached , child_tidptr=0x7f463d4d9a10) = 3445 [pid 3444] close(4 <unfinished ...> [pid 3445] set_robust_list(0x7f463d4d9a20, 24 <unfinished ...> [pid 3444] <... close resumed>) = 0 [pid 3445] <... set_robust_list resumed>) = 0 [pid 3444] write(5, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 32768 <unfinished ...> [pid 3445] splice(4, NULL, 3, NULL, 1048576, SPLICE_F_MORE <unfinished ...> [pid 3444] <... write resumed>) = 32768 [pid 3444] poll(NULL, 0, 1) = 0 (Timeout) [pid 3444] sendmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="@@@@@@@@@@@@@@@@", iov_len=16}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_FASTOPEN}, MSG_DONTWAIT|MSG_MORE) = -1 EBADMSG (Bad message) [pid 3445] <... splice resumed>) = -1 EBADMSG (Bad message) [pid 3444] exit_group(0 <unfinished ...> [pid 3445] exit_group(0 <unfinished ...> [pid 3444] <... exit_group resumed>) = ? [pid 3445] <... exit_group resumed>) = ? [pid 3444] +++ exited with 0 +++ +++ exited with 0 +++ ----------------------------------------