lxd

Comment 8 for bug 2062176

Revision history for this message
Aleksandr Mikhalitsyn (mihalicyn) wrote (last edit ):

>The test case given in the github issue is invalid, because it builds without the default noble compiler flags of -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 so tells us nothing about what code is actually being run as part of noble that depends on the old syscall.

It's not invalid, cause we can't require old software binaries to be built with a new -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 flags. Imagine people who run, let say, Ubuntu Bionic for armhf inside the LXD container. All the binaries inside that container image will use __NR_futex and not __NR_futex_time64 for obvious reasons. We can not ask people to rebuild all the software with a new flags, that breaks idea of running stuff inside the container. Isn't it?

Also, right now, I have repeated my experiment but with a new flags:
# arm-linux-gnueabihf-gcc -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 -static test.c
# strace -n -f /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3 ./a.out
[ 221] execve("/usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3", ["/usr/arm-linux-gnueabihf/lib/ld-"..., "./a.out"], 0xffffddf2a718 /* 27 vars */ <unfinished ...>
[ 221] [ Process PID=2166 runs in 32 bit mode. ]
strace: WARNING: Proper structure decoding for this personality is not supported, please consider building strace with mpers support enabled.
[ 221] <... execve resumed>) = 0
...
[ 6] close(3) = 0
[ 11] execve("./a.out", ["./a.out"], 0xffd6a6a0 /* 27 vars */) = 0
[ 45] brk(NULL) = 0x1c96000
...
[ 125] mprotect(0x5f000, 12288, PROT_READ) = 0
[ 240] futex(0xff812a1c, FUTEX_WAKE, 1) = -1 ENOSYS (Function not implemented)
[ 397] statx(1, "", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT|AT_EMPTY_PATH, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFCHR|0620, stx_size=0, ...}) = 0
[ 4] write(1, "Error! Function not implemented", 31Error! Function not implemented) = 31
[ 248] exit_group(1) = ?
[ 248] +++ exited with 1 +++

Obviously, these flags are not changing anything in behavior because __NR_futex constant value does not depend on _TIME_BITS or _FILE_OFFSET_BITS values.

=== strace from a real armhf container (Ubuntu 22.04.4 LTS inside):

# strace -o strace.log -n -f lxc-start -F ubuntu-armh

2944 [ 322] openat(4, "systemd", O_RDONLY|O_LARGEFILE|O_NOFOLLOW|O_CLOEXEC|O_PATH) = 5
...
e=4096, ...}) = 0
2944 [ 6] close(4) = 0
2944 [ 322] openat(5, "system.conf.d", O_RDONLY|O_LARGEFILE|O_NOFOLLOW|O_CLOEXEC|O_PATH) = -1
 ENOENT (No such file or directory)
...
2944 [ 240] futex(0xf798a4b4, FUTEX_WAKE_PRIVATE, 2147483647) = -1 ENOSYS (Function not imple
mented)
2944 [ 146] writev(2, [{iov_base="The futex facility returned an u"..., iov_len=54}], 1) = 54
2944 [ 192] mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf79c0000
2944 [ 175] rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
2944 [ 224] gettid() = 1
2944 [ 20] getpid() = 1
2944 [ 268] tgkill(1, 1, SIGABRT) = 0
2944 [ 268] --- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=1, si_uid=0} ---

As we can see:
2944 [ 240] futex(0xf798a4b4, FUTEX_WAKE_PRIVATE, 2147483647) = -1 ENOSYS (Function not imple
mented)

so, the same syscall number 240 was called.