Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app-compat: ping not working with app-elfloader (setsockopt problem?) #982

Open
jobpaardekooper opened this issue Jul 15, 2023 · 0 comments
Labels
kind/bug Something isn't working

Comments

@jobpaardekooper
Copy link

jobpaardekooper commented Jul 15, 2023

Describe the bug

When using app-elfloader (via the run.sh script in run-app-elfloader) to run the iputils ping dynamic PIE build, ping fails to function correctly.

It seems like this issue is related to how some specific socket options are being handled. Ping needs to use some specific options in order to work but is unable to set them.

Steps to reproduce

Clone run-app-elfloader and dynamic-apps.

Try to ping some ip using the following command:

sudo ./run.sh -n -k app-elfloader_qemu-x86_64 -r ./dynamic-apps/iputils ./bin/ping 8.8.8.8

Expected behavior

The expected output should be showing successful ping messages for example like this:

PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=116 time=29.0 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=116 time=29.1 ms

Which architectures were you using or does this bug affect?

x86_64

Which platforms were you using or does this bug affect?

kvm

Relevant log output

SeaBIOS (version 1.16.0-debian-1.16.0-5)


iPXE (https://ipxe.org) 00:03.0 C000 PCI2.10 PnP PMM+7EFCAEC0+7EF0AEC0 C000
                                                                               


Booting from ROM..1: Set IPv4 address 172.44.0.2 mask 255.255.255.0 gw 172.44.0.1
en1: Added
en1: Interface is up
Powered by
o.   .o       _ _               __ _
Oo   Oo  ___ (_) | __ __  __ _ ' _) :_
oO   oO ' _ `| | |/ /  _)' _` | |_|  _)
oOo oOO| | | | |   (| | | (_) |  _) :_
 OoOoO ._, ._:_:_,\_._,  .__,_:_, \___)
                  Atlas 0.13.1~d20aa7cb
brk(NULL) = va:0x400200000
arch_prctl(0x3001, 0x4000dfcc0, ...) = Invalid argument (-22)
uname(<out>utsname:{sysname="Unikraft", nodename="unikraft", ...}) = OK
access("/etc/ld.so.preload", R_OK) = No such file or directory (-2)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = No such file or directory (-2)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/glibc-hwcaps/x86-64-v2/libcap.so.2", O_RDONLY|O_CLOEXEC) = No such file or directory (-2)
newfstatat(0xffffff9c, 0x4000dee20, ...) = No such file or directory (-2)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/tls/x86_64/x86_64/libcap.so.2", O_RDONLY|O_CLOEXEC) = No such file or directory (-2)
newfstatat(0xffffff9c, 0x4000dee20, ...) = No such file or directory (-2)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/tls/x86_64/libcap.so.2", O_RDONLY|O_CLOEXEC) = No such file or directory (-2)
newfstatat(0xffffff9c, 0x4000dee20, ...) = No such file or directory (-2)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/tls/x86_64/libcap.so.2", O_RDONLY|O_CLOEXEC) = No such file or directory (-2)
newfstatat(0xffffff9c, 0x4000dee20, ...) = No such file or directory (-2)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/tls/libcap.so.2", O_RDONLY|O_CLOEXEC) = No such file or directory (-2)
newfstatat(0xffffff9c, 0x4000dee20, ...) = No such file or directory (-2)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/x86_64/x86_64/libcap.so.2", O_RDONLY|O_CLOEXEC) = No such file or directory (-2)
newfstatat(0xffffff9c, 0x4000dee20, ...) = No such file or directory (-2)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/x86_64/libcap.so.2", O_RDONLY|O_CLOEXEC) = No such file or directory (-2)
newfstatat(0xffffff9c, 0x4000dee20, ...) = No such file or directory (-2)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/x86_64/libcap.so.2", O_RDONLY|O_CLOEXEC) = No such file or directory (-2)
newfstatat(0xffffff9c, 0x4000dee20, ...) = No such file or directory (-2)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libcap.so.2", O_RDONLY|O_CLOEXEC) = fd:3
read(fd:3, <out>"\x7FELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00>\x00\x01\x00\x00\x00"..., 832) = 832
newfstatat(0x3, 0x47f8efee9, ...) = 0x0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, fd:-1, 0) = va:0x1000008000
mmap(NULL, 41016, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, fd:3, 0) = va:0x100000a000
mmap(va:0x100000d000, 16384, PROT_EXEC|PROT_READ, MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED, fd:3, 12288) = va:0x100000d000
mmap(va:0x1000011000, 8192, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED, fd:3, 28672) = va:0x1000011000
mmap(va:0x1000013000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED, fd:3, 32768) = va:0x1000013000
close(fd:3) = OK
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libidn2.so.0", O_RDONLY|O_CLOEXEC) = fd:3
read(fd:3, <out>"\x7FELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00>\x00\x01\x00\x00\x00"..., 832) = 832
newfstatat(0x3, 0x47f8efee9, ...) = 0x0
mmap(NULL, 131088, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, fd:3, 0) = va:0x1000015000
mmap(va:0x1000017000, 16384, PROT_EXEC|PROT_READ, MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED, fd:3, 8192) = va:0x1000017000
mmap(va:0x100001b000, 102400, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED, fd:3, 24576) = va:0x100001b000
mmap(va:0x1000034000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED, fd:3, 122880) = va:0x1000034000
close(fd:3) = OK
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = fd:3
read(fd:3, <out>"\x7FELF\x02\x01\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00>\x00\x01\x00\x00\x00"..., 832) = 832
pread64(fd:3, <out>"\x06\x00\x00\x00\x04\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00"..., 784, 64) = 784
pread64(fd:3, <out>"\x04\x00\x00\x00 \x00\x00\x00\x05\x00\x00\x00GNU\x00\x02\x00\x00\xC0\x04\x00\x00\x00"..., 48, 848) = 48
pread64(fd:3, <out>"\x04\x00\x00\x00\x14\x00\x00\x00\x03\x00\x00\x00GNU\x00i8\x9DHZ\x97\x93\xDB"..., 68, 896) = 68
newfstatat(0x3, 0x47f8efee9, ...) = 0x0
pread64(fd:3, <out>"\x06\x00\x00\x00\x04\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00"..., 784, 64) = 784
mmap(NULL, 2260560, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, fd:3, 0) = va:0x1000036000
mmap(va:0x100005e000, 1658880, PROT_EXEC|PROT_READ, MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED, fd:3, 163840) = va:0x100005e000
mmap(va:0x10001f3000, 360448, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED, fd:3, 1822720) = va:0x10001f3000
mmap(va:0x100024b000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED, fd:3, 2179072) = va:0x100024b000
mmap(va:0x1000251000, 52816, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED, fd:-1, 0) = va:0x1000251000
close(fd:3) = OK
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libunistring.so.2", O_RDONLY|O_CLOEXEC) = fd:3
read(fd:3, <out>"\x7FELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00>\x00\x01\x00\x00\x00"..., 832) = 832
newfstatat(0x3, 0x47f8efee9, ...) = 0x0
mmap(NULL, 1743080, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, fd:3, 0) = va:0x100025e000
mmap(va:0x100026f000, 221184, PROT_EXEC|PROT_READ, MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED, fd:3, 69632) = va:0x100026f000
mmap(va:0x10002a5000, 1433600, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED, fd:3, 290816) = va:0x10002a5000
mmap(va:0x1000403000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED, fd:3, 1724416) = va:0x1000403000
close(fd:3) = OK
mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, fd:-1, 0) = va:0x1000408000
arch_prctl(0x1002, 0x1000408740, ...) = 0x0
set_tid_address(0x1000408a10, 0x1000408740, ...) = 0x1
set_robust_list(0x1000408a20, 0x18, ...) = Function not implemented (-38)
rseq(0x10004090e0, 0x20, ...) = Function not implemented (-38)
mprotect(va:0x100024b000, 16384, PROT_READ) = OK
mprotect(va:0x1000403000, 16384, PROT_READ) = OK
mprotect(va:0x1000034000, 4096, PROT_READ) = OK
mprotect(va:0x1000013000, 4096, PROT_READ) = OK
mprotect(va:0x47f852000, 4096, PROT_READ) = OK
mprotect(va:0x47f8f9000, 8192, PROT_READ) = OK
prlimit64(0x0, 0x3, ...) = 0x0
prctl(0x17, 0x20, ...) = 0x0
prctl(0x17, 0x30, ...) = 0x0
prctl(0x17, 0x38, ...) = 0x0
prctl(0x17, 0x3c, ...) = 0x0
prctl(0x17, 0x3e, ...) = 0x0
prctl(0x17, 0x3f, ...) = 0x0
prctl(0x17, 0x40, ...) = 0x0
getrandom(0x10002564d8, 0x8, ...) = 0x8
brk(NULL) = va:0x400200000
brk(va:0x400221000) = va:0x400221000
capget(0x4002002a4, 0x0, ...) = 0x0
capget(0x4002002a4, 0x4002002ac, ...) = 0x0
capget(0x4002002d4, 0x0, ...) = 0x0
capset(0x4002002d4, 0x4002002dc, ...) = 0x0
prctl(0x8, 0x1, ...) = 0x0
getuid(0x8, 0x1, ...) = 0x0
setuid(0x0, 0x1, ...) = 0x0
prctl(0x8, 0x0, ...) = 0x0
getuid(0x7, 0x400200010, ...) = 0x0
getrandom(0x4000dc578, 0x4, ...) = 0x4
capget(0x400200364, 0x0, ...) = 0x0
capget(0x400200364, 0x40020036c, ...) = 0x0
socket(AF_INET, SOCK_DGRAM, 1) = fd:3
socket(AF_INET6, SOCK_DGRAM, 58) = Address family not supported by protocol (-97)
capget(0x400200394, 0x0, ...) = 0x0
capget(0x400200394, 0x40020039c, ...) = 0x0
socket(AF_INET, SOCK_DGRAM, 0) = fd:4
connect(0x4, 0x4000dc5d0, ...) = 0x0
getsockname(0x4, 0x4000dec8c, ...) = 0x0
close(fd:4) = OK
setsockopt(0x3, 0x0, ...) = Protocol not available (-92)
ping: write(fd:2, "ping: ", 6) = 6
WARNING: your kernel is veeery old. No problems.write(fd:2, "WARNING: your kernel is "..., 48) = 48

write(fd:2, "\x0A", 1) = 1
setsockopt(0x3, 0x0, ...) = Protocol not available (-92)
ping: write(fd:2, "ping: ", 6) = 6
WARNING: setsockopt(IP_RECVTTL)write(fd:2, "WARNING: setsockopt(IP_R"..., 31) = 31
: Protocol not availablewrite(fd:2, ": Protocol not available", 24) = 24

write(fd:2, "\x0A", 1) = 1
setsockopt(0x3, 0x0, ...) = Protocol not available (-92)
ping: write(fd:2, "ping: ", 6) = 6
WARNING: setsockopt(IP_RETOPTS)write(fd:2, "WARNING: setsockopt(IP_R"..., 31) = 31
: Protocol not availablewrite(fd:2, ": Protocol not available", 24) = 24

write(fd:2, "\x0A", 1) = 1
setsockopt(0x3, 0x1, ...) = Protocol not available (-92)
setsockopt(0x3, 0x1, ...) = Protocol not available (-92)
getsockopt(0x3, 0x1, ...) = Protocol not available (-92)
newfstatat(0x1, 0x100020e46f, ...) = 0x0
ioctl(0x1, 0x5401, ...) = 0x0
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
write(fd:1, "PING 8.8.8.8 (8.8.8.8) 5"..., 45) = 45
setsockopt(0x3, 0x1, ...) = Protocol not available (-92)
ping: write(fd:2, "ping: ", 6) = 6
Warning: no SO_TIMESTAMP support, falling back to SIOCGSTAMPwrite(fd:2, "Warning: no SO_TIMESTAMP"..., 60) = 60

write(fd:2, "\x0A", 1) = 1
setsockopt(0x3, 0x1, ...) = Protocol not available (-92)
setsockopt(0x3, 0x1, ...) = Protocol not available (-92)
rt_sigaction(0x2, 0x4000dc2c0, ...) = 0x0
rt_sigaction(0xe, 0x4000dc2c0, ...) = 0x0
rt_sigaction(0x3, 0x4000dc2c0, ...) = 0x0
rt_sigprocmask(0x2, 0x4000dc450, ...) = 0x0
clock_gettime(CLOCK_0x4, <out>timespec:0x4000dea60) = Invalid argument (-22)
ioctl(0x1, 0x5401, ...) = 0x0
ioctl(0x1, 0x5413, ...) = 0x0
clock_gettime(CLOCK_0x4, <out>timespec:0x4000dea70) = Invalid argument (-22)
gettimeofday(0x4000db350, 0x0, ...) = 0x0
sendto(fd:3, "\x08\x00\xCF \x00\x00\x00\x01\x03\x96\xB2d\x00\x00\x00\x00\xAC\x10\x08\x00\x00\x00\x00\x00"..., 64, 0x0, va:0x4000dec70, 16) = OK
poll(0x4000db3f0, 0x1, ...) = 0x0
clock_gettime(CLOCK_0x4, <out>timespec:0x4000dea70) = Invalid argument (-22)
gettimeofday(0x4000db350, 0x0, ...) = 0x0
sendto(fd:3, "\x08\x00\xED\xD1\x00\x00\x00\x02\x04\x96\xB2d\x00\x00\x00\x00\x8C^\x08\x00\x00\x00\x00\x00"..., 64, 0x0, va:0x4000dec70, 16) = OK
poll(0x4000db3f0, 0x1, ...) = 0x0
clock_gettime(CLOCK_0x4, <out>timespec:0x4000dea70) = Invalid argument (-22)
gettimeofday(0x4000db350, 0x0, ...) = 0x0
sendto(fd:3, "\x08\x00&z\x00\x00\x00\x03\x05\x96\xB2d\x00\x00\x00\x00R\xB5\x08\x00\x00\x00\x00\x00"..., 64, 0x0, va:0x4000dec70, 16) = OK
poll(0x4000db3f0, 0x1, ...) = 0x0
clock_gettime(CLOCK_0x4, <out>timespec:0x4000dea70) = Invalid argument (-22)
gettimeofday(0x4000db350, 0x0, ...) = 0x0
sendto(fd:3, "\x08\x00\xB9$\x00\x00\x00\x04\x06\x96\xB2d\x00\x00\x00\x00\xBE\x09\x09\x00\x00\x00\x00\x00"..., 64, 0x0, va:0x4000dec70, 16) = OK
@jobpaardekooper jobpaardekooper added the kind/bug Something isn't working label Jul 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant