From: Matheus Castanho <msc@linux.ibm.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>,
GNU C Library <libc-alpha@sourceware.org>
Subject: Re: semtimedop, powerpc, time64 and older kernels
Date: Wed, 30 Sep 2020 15:29:27 -0300 [thread overview]
Message-ID: <490fc1e6-fd80-c5e5-0d0f-603fed44d4b6@linux.ibm.com> (raw)
In-Reply-To: <6f370467-8d0a-bd3d-29b2-2fefef4e475f@linux.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 1928 bytes --]
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
[-- Attachment #2: 0001-sysvipc-Fix-semtimedop-for-Linux-5.1.patch --]
[-- Type: text/x-patch, Size: 1077 bytes --]
From 1c0a497a3f986bc6980581c9eab482ccf7bb190f Mon Sep 17 00:00:00 2001
From: Matheus Castanho <msc@linux.ibm.com>
Date: Wed, 30 Sep 2020 14:22:18 -0300
Subject: [PATCH] sysvipc: Fix semtimedop for Linux < 5.1
Kernels older than 5.1 will fail with ENOSYS when calling
semtimedop_time64 syscall in __semtimedop_time64. Just like for
!__ASSUME_TIME64_SYSCALLS, we should fallback to using the old mechanism
in such cases.
---
sysdeps/unix/sysv/linux/semtimedop.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
--
2.26.2
next prev parent reply other threads:[~2020-09-30 18:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-30 18:01 Matheus Castanho
2020-09-30 18:29 ` Matheus Castanho [this message]
2020-09-30 18:45 ` Andreas Schwab
2020-09-30 19:12 ` Adhemerval Zanella
2020-09-30 20:45 ` Matheus Castanho
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=490fc1e6-fd80-c5e5-0d0f-603fed44d4b6@linux.ibm.com \
--to=msc@linux.ibm.com \
--cc=adhemerval.zanella@linaro.org \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).