mbox

[0/7] Linux 64-bit time_t socket fixes

Message ID 20210705183027.3804093-1-adhemerval.zanella@linaro.org
Headers

Message

Adhemerval Zanella Netto July 5, 2021, 6:30 p.m. UTC
  This series fixes some issues with socket timestamps on legacy ABIs 
with 32-bit time_t support.
  
The first two patches consolidates the setsockopt and getsockopt, which
fixes the missing timestamp handling on some architectures (hppa,
mips32, arm, cksy, and nios2).
     
The third and forth patches fixes a wrong conversion for timestamps
and a wrong argument usage for setsockopt.

Finally the remaining patches adds proper tests for both recvmsg
and recvmmsg.  They check for timestamp on both syscalls() with
different ancilliary data sizes (to check if convertion take this in
consideration, and with different time_t sizes.
 
I checked it on x86_64-linux-gnu and i686-linux-gnu on both 
5.11 kernel and on 4.15 kernel.  I am planning to run on some
different system with different kernels as well.
 
It might worth to check if this series fix the ruby issue [1].
 
[1] https://sourceware.org/pipermail/libc-alpha/2021-June/128113.html

Adhemerval Zanella (7):
  linux: Consolidate Linux getsockopt implementation
  linux: Consolidate Linux setsockopt implementation
  linux: Use the expected size for SO_TIMESTAMP{NS} convertion
  linux: Fix setsockopt fallback
  support: Add support_socket_time64_timestamp
  socket: Add recvmsg timestamp test
  socket: Add recvmmsg timestamp test

 support/Makefile                              |   1 +
 support/support.h                             |   3 +
 support/support_socket_time64_timestamp.c     |  68 +++++++
 sysdeps/unix/sysv/linux/Makefile              |   3 +
 sysdeps/unix/sysv/linux/alpha/syscalls.list   |   2 -
 sysdeps/unix/sysv/linux/arm/syscalls.list     |   2 -
 .../unix/sysv/linux/convert_scm_timestamps.c  |   8 +-
 sysdeps/unix/sysv/linux/generic/syscalls.list |   2 -
 sysdeps/unix/sysv/linux/hppa/syscalls.list    |   2 -
 .../unix/sysv/linux/i386/kernel-features.h    |   4 +-
 sysdeps/unix/sysv/linux/ia64/syscalls.list    |   2 -
 sysdeps/unix/sysv/linux/kernel-features.h     |   2 +
 .../unix/sysv/linux/m68k/kernel-features.h    |   4 +-
 .../sysv/linux/microblaze/kernel-features.h   |   2 -
 sysdeps/unix/sysv/linux/mips/syscalls.list    |   2 -
 .../unix/sysv/linux/powerpc/kernel-features.h |   2 -
 .../unix/sysv/linux/s390/kernel-features.h    |   4 +-
 sysdeps/unix/sysv/linux/setsockopt.c          |   2 +-
 sysdeps/unix/sysv/linux/sh/kernel-features.h  |   2 -
 .../unix/sysv/linux/sparc/kernel-features.h   |   4 +-
 sysdeps/unix/sysv/linux/tst-recvmmsg-time64.c |   1 +
 sysdeps/unix/sysv/linux/tst-recvmmsg.c        | 185 ++++++++++++++++++
 sysdeps/unix/sysv/linux/tst-recvmsg-time64.c  |   1 +
 sysdeps/unix/sysv/linux/tst-recvmsg.c         | 171 ++++++++++++++++
 sysdeps/unix/sysv/linux/x86_64/syscalls.list  |   2 -
 25 files changed, 450 insertions(+), 31 deletions(-)
 create mode 100644 support/support_socket_time64_timestamp.c
 create mode 100644 sysdeps/unix/sysv/linux/tst-recvmmsg-time64.c
 create mode 100644 sysdeps/unix/sysv/linux/tst-recvmmsg.c
 create mode 100644 sysdeps/unix/sysv/linux/tst-recvmsg-time64.c
 create mode 100644 sysdeps/unix/sysv/linux/tst-recvmsg.c