Comments (7)
I confirmed that 763b8a5 indeed causes the problem by using socket2 from Git as follows:
[dependencies.socket2]
features = ["unix", "reuseport"]
git = "https://github.com/alexcrichton/socket2-rs"
rev = "763b8a59a28324ddcd981a9243375a309eb81679"
Commits prior to this one will all pass, but starting with this commit the accept
calls fail.
from socket2.
Thanks for the report! Can you try running strace
and/or providing more details to your system? I'm not sure how that comit would have changed the behavior like this.
from socket2.
@alexcrichton This is on Linux, specifically kernel version 5.2.1. The output of strace
is the following:
execve("target/release/playground", ["target/release/playground"], 0x7ffea47435d0 /* 66 vars */) = 0
brk(NULL) = 0x55f121f0f000
arch_prctl(0x3001 /* ARCH_??? */, 0x7ffc30d2f120) = -1 EINVAL (Invalid argument)
access("/etc/ld.so.preload", R_OK) = 0
openat(AT_FDCWD, "/etc/ld.so.preload", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
close(3) = 0
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=225898, ...}) = 0
mmap(NULL, 225898, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f237cfb3000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\22\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=14512, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f237cfb1000
mmap(NULL, 16528, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f237cfac000
mmap(0x7f237cfad000, 4096, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0x7f237cfad000
mmap(0x7f237cfae000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f237cfae000
mmap(0x7f237cfaf000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f237cfaf000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/librt.so.1", 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\3606\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=39408, ...}) = 0
mmap(NULL, 43512, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f237cfa1000
mmap(0x7f237cfa4000, 16384, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7f237cfa4000
mmap(0x7f237cfa8000, 8192, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7f237cfa8000
mmap(0x7f237cfaa000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x8000) = 0x7f237cfaa000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/libpthread.so.0", 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\360\201\0\0\0\0\0\0"..., 832) = 832
lseek(3, 824, SEEK_SET) = 824
read(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\222g\260<=\26\316\256\274\274\324\330\35st\262"..., 68) = 68
fstat(3, {st_mode=S_IFREG|0755, st_size=155904, ...}) = 0
lseek(3, 824, SEEK_SET) = 824
read(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\222g\260<=\26\316\256\274\274\324\330\35st\262"..., 68) = 68
mmap(NULL, 131528, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f237cf80000
mmap(0x7f237cf87000, 61440, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7f237cf87000
mmap(0x7f237cf96000, 20480, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16000) = 0x7f237cf96000
mmap(0x7f237cf9b000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1a000) = 0x7f237cf9b000
mmap(0x7f237cf9d000, 12744, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f237cf9d000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 0\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=869664, ...}) = 0
mmap(NULL, 103152, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f237cf66000
mmap(0x7f237cf69000, 69632, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7f237cf69000
mmap(0x7f237cf7a000, 16384, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14000) = 0x7f237cf7a000
mmap(0x7f237cf7e000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x7f237cf7e000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/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\360o\2\0\0\0\0\0"..., 832) = 832
lseek(3, 64, SEEK_SET) = 64
read(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) = 784
lseek(3, 848, SEEK_SET) = 848
read(3, "\4\0\0\0\20\0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0", 32) = 32
lseek(3, 880, SEEK_SET) = 880
read(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\250\257l\201\313(\243{\363\245F\227\v\366B$"..., 68) = 68
fstat(3, {st_mode=S_IFREG|0755, st_size=2133648, ...}) = 0
lseek(3, 64, SEEK_SET) = 64
read(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) = 784
lseek(3, 848, SEEK_SET) = 848
read(3, "\4\0\0\0\20\0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0", 32) = 32
lseek(3, 880, SEEK_SET) = 880
read(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\250\257l\201\313(\243{\363\245F\227\v\366B$"..., 68) = 68
mmap(NULL, 1844408, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f237cda3000
mprotect(0x7f237cdc8000, 1654784, PROT_NONE) = 0
mmap(0x7f237cdc8000, 1351680, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x25000) = 0x7f237cdc8000
mmap(0x7f237cf12000, 299008, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16f000) = 0x7f237cf12000
mmap(0x7f237cf5c000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b8000) = 0x7f237cf5c000
mmap(0x7f237cf62000, 13496, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f237cf62000
close(3) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f237cda1000
arch_prctl(ARCH_SET_FS, 0x7f237cda2340) = 0
mprotect(0x7f237cf5c000, 12288, PROT_READ) = 0
mprotect(0x7f237cf7e000, 4096, PROT_READ) = 0
mprotect(0x7f237cf9b000, 4096, PROT_READ) = 0
mprotect(0x7f237cfaa000, 4096, PROT_READ) = 0
mprotect(0x7f237cfaf000, 4096, PROT_READ) = 0
mprotect(0x55f121ded000, 8192, PROT_READ) = 0
mprotect(0x7f237d015000, 4096, PROT_READ) = 0
munmap(0x7f237cfb3000, 225898) = 0
set_tid_address(0x7f237cda2610) = 28324
set_robust_list(0x7f237cda2620, 24) = 0
rt_sigaction(SIGRTMIN, {sa_handler=0x7f237cf87c30, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x7f237cf93d00}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {sa_handler=0x7f237cf87cd0, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0x7f237cf93d00}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
rt_sigaction(SIGPIPE, {sa_handler=SIG_IGN, sa_mask=[PIPE], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f237cddd7e0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
brk(NULL) = 0x55f121f0f000
brk(0x55f121f30000) = 0x55f121f30000
openat(AT_FDCWD, "/proc/self/maps", O_RDONLY|O_CLOEXEC) = 3
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
read(3, "55f121dbf000-55f121dc3000 r--p 0"..., 1024) = 1024
read(3, "b/libc-2.29.so\n7f237cf12000-7f23"..., 1024) = 1024
read(3, "\n7f237cf87000-7f237cf96000 r-xp "..., 1024) = 1024
read(3, "29.so\n7f237cfad000-7f237cfae000 "..., 1024) = 1024
read(3, " [stack]\n7ffc30d4c000-7ffc30d4f"..., 1024) = 170
close(3) = 0
sched_getaffinity(28324, 32, [0, 1, 2, 3]) = 32
rt_sigaction(SIGSEGV, {sa_handler=0x55f121dce070, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK|SA_SIGINFO, sa_restorer=0x7f237cf93d00}, NULL, 8) = 0
rt_sigaction(SIGBUS, {sa_handler=0x55f121dce070, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK|SA_SIGINFO, sa_restorer=0x7f237cf93d00}, NULL, 8) = 0
sigaltstack(NULL, {ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=0}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f237cfe9000
sigaltstack({ss_sp=0x7f237cfe9000, ss_flags=0, ss_size=8192}, NULL) = 0
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0) = 3
bind(3, {sa_family=AF_UNIX, sun_path=@"dummy"}, 8) = 0
listen(3, 128) = 0
accept4(3, 0x7ffc30d2eab0, 0x80, SOCK_CLOEXEC) = -1 EFAULT (Bad address)
write(2, "thread '", 8thread ') = 8
write(2, "main", 4main) = 4
write(2, "' panicked at '", 15' panicked at ') = 15
write(2, "Failed in accept(2): Os { code: "..., 73Failed in accept(2): Os { code: 14, kind: Other, message: "Bad address" }) = 73
write(2, "', ", 3', ) = 3
write(2, "src/libcore/result.rs", 21src/libcore/result.rs) = 21
write(2, ":", 1:) = 1
write(2, "997", 3997) = 3
write(2, ":", 1:) = 1
write(2, "5", 15) = 1
write(2, "\n", 1
) = 1
write(2, "note: Run with `RUST_BACKTRACE=1"..., 79note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
) = 79
futex(0x7f237cf7f060, FUTEX_WAKE_PRIVATE, 2147483647) = 0
close(3) = 0
sigaltstack({ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=8192}, NULL) = 0
munmap(0x7f237cfe9000, 8192) = 0
exit_group(101) = ?
+++ exited with 101 +++
The interesting bits are:
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0) = 3
bind(3, {sa_family=AF_UNIX, sun_path=@"dummy"}, 8) = 0
listen(3, 128) = 0
accept4(3, 0x7ffc30d2eab0, 0x80, SOCK_CLOEXEC) = -1 EFAULT (Bad address)
write(2, "thread '", 8thread ') = 8
write(2, "main", 4main) = 4
write(2, "' panicked at '", 15' panicked at ') = 15
write(2, "Failed in accept(2): Os { code: "..., 73Failed in accept(2): Os { code: 14, kind: Other, message: "Bad address" }) = 73
write(2, "', ", 3', ) = 3
write(2, "src/libcore/result.rs", 21src/libcore/result.rs) = 21
write(2, ":", 1:) = 1
write(2, "997", 3997) = 3
write(2, ":", 1:) = 1
write(2, "5", 15) = 1
write(2, "\n", 1
) = 1
write(2, "note: Run with `RUST_BACKTRACE=1"..., 79note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
) = 79
futex(0x7f237cf7f060, FUTEX_WAKE_PRIVATE, 2147483647) = 0
close(3) = 0
sigaltstack({ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=8192}, NULL) = 0
munmap(0x7f237cfe9000, 8192) = 0
exit_group(101) = ?
+++ exited with 101 +++
Using socket2 0.3.9, the strace output is:
execve("target/release/playground", ["target/release/playground"], 0x7ffd6a511570 /* 66 vars */) = 0
brk(NULL) = 0x55c712de6000
arch_prctl(0x3001 /* ARCH_??? */, 0x7ffd0c58aaa0) = -1 EINVAL (Invalid argument)
access("/etc/ld.so.preload", R_OK) = 0
openat(AT_FDCWD, "/etc/ld.so.preload", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
close(3) = 0
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=225898, ...}) = 0
mmap(NULL, 225898, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fe713898000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\22\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=14512, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe713896000
mmap(NULL, 16528, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fe713891000
mmap(0x7fe713892000, 4096, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0x7fe713892000
mmap(0x7fe713893000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7fe713893000
mmap(0x7fe713894000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7fe713894000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/librt.so.1", 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\3606\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=39408, ...}) = 0
mmap(NULL, 43512, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fe713886000
mmap(0x7fe713889000, 16384, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7fe713889000
mmap(0x7fe71388d000, 8192, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7fe71388d000
mmap(0x7fe71388f000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x8000) = 0x7fe71388f000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/libpthread.so.0", 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\360\201\0\0\0\0\0\0"..., 832) = 832
lseek(3, 824, SEEK_SET) = 824
read(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\222g\260<=\26\316\256\274\274\324\330\35st\262"..., 68) = 68
fstat(3, {st_mode=S_IFREG|0755, st_size=155904, ...}) = 0
lseek(3, 824, SEEK_SET) = 824
read(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\222g\260<=\26\316\256\274\274\324\330\35st\262"..., 68) = 68
mmap(NULL, 131528, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fe713865000
mmap(0x7fe71386c000, 61440, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7fe71386c000
mmap(0x7fe71387b000, 20480, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16000) = 0x7fe71387b000
mmap(0x7fe713880000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1a000) = 0x7fe713880000
mmap(0x7fe713882000, 12744, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fe713882000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 0\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=869664, ...}) = 0
mmap(NULL, 103152, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fe71384b000
mmap(0x7fe71384e000, 69632, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7fe71384e000
mmap(0x7fe71385f000, 16384, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14000) = 0x7fe71385f000
mmap(0x7fe713863000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x7fe713863000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/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\360o\2\0\0\0\0\0"..., 832) = 832
lseek(3, 64, SEEK_SET) = 64
read(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) = 784
lseek(3, 848, SEEK_SET) = 848
read(3, "\4\0\0\0\20\0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0", 32) = 32
lseek(3, 880, SEEK_SET) = 880
read(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\250\257l\201\313(\243{\363\245F\227\v\366B$"..., 68) = 68
fstat(3, {st_mode=S_IFREG|0755, st_size=2133648, ...}) = 0
lseek(3, 64, SEEK_SET) = 64
read(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) = 784
lseek(3, 848, SEEK_SET) = 848
read(3, "\4\0\0\0\20\0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0", 32) = 32
lseek(3, 880, SEEK_SET) = 880
read(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\250\257l\201\313(\243{\363\245F\227\v\366B$"..., 68) = 68
mmap(NULL, 1844408, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fe713688000
mprotect(0x7fe7136ad000, 1654784, PROT_NONE) = 0
mmap(0x7fe7136ad000, 1351680, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x25000) = 0x7fe7136ad000
mmap(0x7fe7137f7000, 299008, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16f000) = 0x7fe7137f7000
mmap(0x7fe713841000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b8000) = 0x7fe713841000
mmap(0x7fe713847000, 13496, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fe713847000
close(3) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe713686000
arch_prctl(ARCH_SET_FS, 0x7fe713687340) = 0
mprotect(0x7fe713841000, 12288, PROT_READ) = 0
mprotect(0x7fe713863000, 4096, PROT_READ) = 0
mprotect(0x7fe713880000, 4096, PROT_READ) = 0
mprotect(0x7fe71388f000, 4096, PROT_READ) = 0
mprotect(0x7fe713894000, 4096, PROT_READ) = 0
mprotect(0x55c7116f3000, 8192, PROT_READ) = 0
mprotect(0x7fe7138fa000, 4096, PROT_READ) = 0
munmap(0x7fe713898000, 225898) = 0
set_tid_address(0x7fe713687610) = 28501
set_robust_list(0x7fe713687620, 24) = 0
rt_sigaction(SIGRTMIN, {sa_handler=0x7fe71386cc30, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x7fe713878d00}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {sa_handler=0x7fe71386ccd0, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0x7fe713878d00}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
rt_sigaction(SIGPIPE, {sa_handler=SIG_IGN, sa_mask=[PIPE], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7fe7136c27e0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
brk(NULL) = 0x55c712de6000
brk(0x55c712e07000) = 0x55c712e07000
openat(AT_FDCWD, "/proc/self/maps", O_RDONLY|O_CLOEXEC) = 3
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
read(3, "55c7116c4000-55c7116c8000 r--p 0"..., 1024) = 1024
read(3, "b/libc-2.29.so\n7fe7137f7000-7fe7"..., 1024) = 1024
read(3, "\n7fe71386c000-7fe71387b000 r-xp "..., 1024) = 1024
read(3, "29.so\n7fe713892000-7fe713893000 "..., 1024) = 1024
read(3, " [stack]\n7ffd0c5d1000-7ffd0c5d4"..., 1024) = 170
close(3) = 0
sched_getaffinity(28501, 32, [0, 1, 2, 3]) = 32
rt_sigaction(SIGSEGV, {sa_handler=0x55c7116d31b0, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK|SA_SIGINFO, sa_restorer=0x7fe713878d00}, NULL, 8) = 0
rt_sigaction(SIGBUS, {sa_handler=0x55c7116d31b0, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK|SA_SIGINFO, sa_restorer=0x7fe713878d00}, NULL, 8) = 0
sigaltstack(NULL, {ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=0}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe7138ce000
sigaltstack({ss_sp=0x7fe7138ce000, ss_flags=0, ss_size=8192}, NULL) = 0
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0) = 3
bind(3, {sa_family=AF_UNIX, sun_path=@"dummy"}, 8) = 0
listen(3, 128) = 0
futex(0x7fe713895048, FUTEX_WAKE_PRIVATE, 2147483647) = 0
accept4(3, {sa_family=AF_UNIX}, [128->2], SOCK_CLOEXEC) = 4
close(4) = 0
close(3) = 0
sigaltstack({ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=8192}, NULL) = 0
munmap(0x7fe7138ce000, 8192) = 0
exit_group(0) = ?
+++ exited with 0 +++
The part starting after the accept
call:
accept4(3, {sa_family=AF_UNIX}, [128->2], SOCK_CLOEXEC) = 4
close(4) = 0
close(3) = 0
sigaltstack({ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=8192}, NULL) = 0
munmap(0x7fe7138ce000, 8192) = 0
exit_group(0) = ?
+++ exited with 0 +++
from socket2.
The differences in the accept
calls are as follows:
0.3.9:
accept4(3, {sa_family=AF_UNIX}, [128->2], SOCK_CLOEXEC) = 4
0.3.10:
accept4(3, 0x7ffc30d2eab0, 0x80, SOCK_CLOEXEC) = -1 EFAULT (Bad address)
from socket2.
The problem is that the address length is passed incorrectly. This is done as follows:
libc::syscall(
libc::SYS_accept4,
self.fd as libc::c_long,
&mut storage as *mut _ as libc::c_long,
len as libc::c_long,
libc::SOCK_CLOEXEC as libc::c_long,
) as libc::c_int
accept4
is supposed to receive a pointer as the length (a socklen_t *
to be exact), but is instead given an int
instead. This can be solved using the following patch:
diff --git a/src/sys/unix.rs b/src/sys/unix.rs
index a480a14..e138e68 100644
--- a/src/sys/unix.rs
+++ b/src/sys/unix.rs
@@ -281,7 +281,7 @@ impl Socket {
libc::SYS_accept4,
self.fd as libc::c_long,
&mut storage as *mut _ as libc::c_long,
- len as libc::c_long,
+ &mut len,
libc::SOCK_CLOEXEC as libc::c_long,
) as libc::c_int
});
Using this patch, my test no longer fails.
from socket2.
Oddly enough this seems to already fail in the test suite when running with cargo test --features unix
, suggesting that CI might not be running all tests.
from socket2.
Actually the tests do run everything, and they have already been failing: https://travis-ci.com/alexcrichton/socket2-rs/jobs/220558233
from socket2.
Related Issues (20)
- Add CI support for ESP-IDF
- msghdr as a private field in MsgHdr/MsgMutHdr HOT 2
- Set Socket interface using interface index HOT 1
- What happened to the `RAW` socket type? HOT 1
- Question: Possible to support architectures that only provide the `std::net` interface (and only TCP)? HOT 4
- Windows: `sa_family_t` should use `ADDRESS_FAMILY` from `windows-sys` HOT 5
- nonblocking connect HOT 6
- Set `ss_len` when creating `SockAddr` from std HOT 1
- Why cannot find WASStartup and WSACleanup in source code? HOT 7
- bind_device succeeds, but subsequent sends fail with no such device or address. HOT 5
- QUESTION: How to special `laddr` when dialing connection? HOT 3
- Android support HOT 3
- don'tassign8080 port
- Currently socket2 has no way to set the DF bit on packets. The attached patch adds it. HOT 3
- Error: BoxSend(Os { code: 98, kind: AddrInUse, message: "Address already in use" }) HOT 2
- How to read EventExtra from the event? HOT 2
- socket() always fails on WSL1 due to unsupported SOCK_CLOEXEC flag HOT 5
- Support for {recv,send}mmsg HOT 2
- New release HOT 1
- socket error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from socket2.