semtimedop, powerpc, time64 and older kernels

Matheus Castanho msc@linux.ibm.com
Wed Sep 30 18:01:28 GMT 2020


Hi Adhemerval,

sysvipc/test-sysvsem started failing on ppc64le on kernels older than
5.1 after:

commit aaa12e9ff02b32d5fbb2f367d7d6b6985a2176d6
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Sep 25 15:04:34 2020 -0300

    sysvipc: Fix semtimeop for !__ASSUME_DIRECT_SYSVIPC_SYSCALLS

    The __NR_ipc syscall does not support 64-bit time operations.  It
    fixes 7c437d3778.

    Checked on i686-linux-gnu on a Linux 5.4.

It fails with:
FAIL: sysvipc/test-sysvsem
original exit status 1
error: test-sysvsem.c:101: semop failed (errno=38)
error: 1 test failures

Looks like semtimedop was added on Linux 5.1, so it makes sense that
older kernels will fail with ENOSYS when calling that. So in such cases
should we also apply time convertion and fallback to semtimedop/ipc in
__semtimedop64 as done when !__ASSUME_DIRECT_SYSVIPC_SYSCALLS?

The patch below seems to solve the issue, at least on ppc64le.

Suggestions?

Thanks,
Matheus Castanho

--- 8< ---

diff --git a/sysdeps/unix/sysv/linux/semtimedop.c
b/sysdeps/unix/sysv/linux/semtimedop.c
index a9ad922ee2..510fea1852 100644
--- a/sysdeps/unix/sysv/linux/semtimedop.c
+++ b/sysdeps/unix/sysv/linux/semtimedop.c
@@ -32,7 +32,7 @@ __semtimedop64 (int semid, struct sembuf *sops, size_t
nsops,
   int r = INLINE_SYSCALL_CALL (semtimedop_time64, semid, sops, nsops,
                               timeout);

-#ifndef __ASSUME_TIME64_SYSCALLS
+#if !(defined __ASSUME_TIME64_SYSCALLS) || __LINUX_KERNEL_VERSION <
0x050100
   if (r == 0 || errno != ENOSYS)
     return r;


More information about the Libc-alpha mailing list