semtimedop, powerpc, time64 and older kernels
Matheus Castanho
msc@linux.ibm.com
Wed Sep 30 18:29:27 GMT 2020
On 9/30/20 3:01 PM, Matheus Castanho via Libc-alpha wrote:
> 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?
-----------------^
Sorry, I meant !_ASSUME_TIME64_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;
>
Also, looks like my email client messed up the diff *sigh*. I'm sending
a proper patch attached this time.
--
Matheus Castanho
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-sysvipc-Fix-semtimedop-for-Linux-5.1.patch
Type: text/x-patch
Size: 1078 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20200930/8e51eac9/attachment.bin>
More information about the Libc-alpha
mailing list