Comment 1 for bug 2053134

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

This is happening on arm64 because __NR_signalfd is not defined there. arm64 only has __NR_signalfd4[1]

The following #ifdef[2] in usr/util.h then fails:

#if defined(__NR_signalfd) && defined(USE_SIGNALFD)
...

And we end up in the #else clause, which:
#else
#define __signalfd(fd, mask, flags) (-1)
struct signalfd_siginfo {
};
#endif

This essentially makes this struct zero, and gcc/glibc is now catching that in usr/bs.c[3]:

 struct signalfd_siginfo siginfo[16];
...
 ret = read(fd, (char *)siginfo, sizeof(siginfo));

sizeof(siginfo) is zero, so nothing should be written, but this is tripping the -Wstringop-overflow check.

I also wonder if we are incorrectly building tgt without signalfd support for all this time, unknowingly, because of this...

1. https://github.com/bminor/glibc/blob/f9ac84f92f151e07586c55e14ed628d493a5929d/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h#L255

2. https://github.com/fujita/tgt/blob/master/usr/util.h#L106

3. https://github.com/fujita/tgt/blob/master/usr/bs.c#L196