public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Matheus Castanho <msc@linux.ibm.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>,
	GNU C Library <libc-alpha@sourceware.org>
Subject: semtimedop, powerpc, time64 and older kernels
Date: Wed, 30 Sep 2020 15:01:28 -0300	[thread overview]
Message-ID: <6f370467-8d0a-bd3d-29b2-2fefef4e475f@linux.ibm.com> (raw)

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;

             reply	other threads:[~2020-09-30 18:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-30 18:01 Matheus Castanho [this message]
2020-09-30 18:29 ` Matheus Castanho
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=6f370467-8d0a-bd3d-29b2-2fefef4e475f@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).