Subject: strace: bogus (on the order of 2^54) tv_nsec readings for clock_nanosleep_time64() on armel

From: наб <[email-masked]>
Date: Sun, 12 Feb 2023 20:28:34 +0100

Package: strace
Version: 5.10-1
Version: 6.1-0.1
Severity: normal

Dear Maintainer,

When running this test program under strace, built with
  cc qwe.c -g -target arm-linux-gnueabi -o qwe -fuse-ld=lld
(binary attached):
-- >8 --

       #include <sys/types.h>
       #include <sys/stat.h>
       #include <fcntl.h>
	       #include <unistd.h>

int main() {
int fd = open("/sys/class/leds/ACT/brightness", O_WRONLY);

char dupa[] = {'0', '1'};
for(int q = 0;;++q) {
		          ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
				  pwrite(fd, &dupa[q%2], 1, 0);
				  sleep(1);
}

}
-- >8 --

I observe 
-- >8 --
# strace /tmp/qwe
execve("/tmp/qwe", ["/tmp/qwe"], 0xbeb5d800 /* 13 vars */) = 0
brk(NULL)                               = 0x1b29000
uname({sysname="Linux", nodename="ciastko-malinowe", ...}) = 0
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=10129, ...}) = 0
mmap2(NULL, 10129, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb6f54000
close(3)                                = 0
openat(AT_FDCWD, "/lib/arm-linux-gnueabi/libc.so.6", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\\y\1\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1340264, ...}) = 0
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f52000
mmap2(NULL, 1409596, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6dcd000
mprotect(0xb6f11000, 61440, PROT_NONE)  = 0
mmap2(0xb6f20000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x143000) = 0xb6f20000
mmap2(0xb6f23000, 8764, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb6f23000
close(3)                                = 0
set_tls(0xb6f52bf0)                     = 0
mprotect(0xb6f20000, 8192, PROT_READ)   = 0
mprotect(0x4a0000, 4096, PROT_READ)     = 0
mprotect(0xb6f57000, 4096, PROT_READ)   = 0
munmap(0xb6f54000, 10129)               = 0
openat(AT_FDCWD, "/sys/class/leds/ACT/brightness", O_WRONLY) = 3
pwrite64(3, "0", 1, 0)                  = 1
clock_nanosleep_time64(CLOCK_REALTIME, 0, {tv_sec=1, tv_nsec=20839490557837312}, 0xbea51638) = 0
pwrite64(3, "1", 1, 0)                  = 1
clock_nanosleep_time64(CLOCK_REALTIME, 0, {tv_sec=1, tv_nsec=20839490557837312}, 0xbea51638) = 0
pwrite64(3, "0", 1, 0)                  = 1
clock_nanosleep_time64(CLOCK_REALTIME, 0, {tv_sec=1, tv_nsec=20839490557837312}, 0xbea51638) = 0
pwrite64(3, "1", 1, 0)                  = 1
clock_nanosleep_time64(CLOCK_REALTIME, 0, {tv_sec=1, tv_nsec=20839490557837312}, 0xbea51638) = 0
pwrite64(3, "0", 1, 0)                  = 1
clock_nanosleep_time64(CLOCK_REALTIME, 0, {tv_sec=1, tv_nsec=20839490557837312}, 0xbea51638) = 0
...
-- >8 --
(the precise tv_nsec value changes, as does the pointer due to ASLR;
 I'm assuming those are related effects).

Affects the official bullseye package and my sid (6.1-0.1) rebuild.

-- System Information:
Debian Release: 11.5
Architecture: armel

Kernel: Linux 5.10.0-18-rpi (UP)
Kernel taint flags: MOD_STAGING UNSIGNED
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages strace depends on:
ii  libc6        2.31-13+deb11u4

strace recommends no packages.

strace suggests no packages.

-- no debconf information