From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 444453861830; Mon, 28 Sep 2020 19:18:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 444453861830 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc] nptl: Fix __futex_abstimed_wait_cancellable32 X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/master X-Git-Oldrev: aaa12e9ff02b32d5fbb2f367d7d6b6985a2176d6 X-Git-Newrev: 50e19ddfcd49cb9e012a6288881a77a48fb0aeaa Message-Id: <20200928191806.444453861830@sourceware.org> Date: Mon, 28 Sep 2020 19:18:06 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Sep 2020 19:18:06 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=50e19ddfcd49cb9e012a6288881a77a48fb0aeaa commit 50e19ddfcd49cb9e012a6288881a77a48fb0aeaa Author: Adhemerval Zanella Date: Mon Sep 28 16:05:32 2020 -0300 nptl: Fix __futex_abstimed_wait_cancellable32 Similar to 64-bit time __futex_abstimed_wait_cancellable64, it should check for overflow and convert to 32-bit timespec iff timeout is not NULL. It fixes some regression on i686-linux-gnu running on a 4.15 kernel. Diff: --- sysdeps/nptl/futex-internal.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sysdeps/nptl/futex-internal.c b/sysdeps/nptl/futex-internal.c index adb3c20611..1594cb6166 100644 --- a/sysdeps/nptl/futex-internal.c +++ b/sysdeps/nptl/futex-internal.c @@ -29,16 +29,22 @@ __futex_abstimed_wait_cancellable32 (unsigned int* futex_word, const struct __timespec64* abstime, int private) { - if (! in_time_t_range (abstime->tv_sec)) - return -EOVERFLOW; + struct timespec ts32, *pts32 = NULL; + if (abstime != NULL) + { + if (! in_time_t_range (abstime->tv_sec)) + return -EOVERFLOW; + + ts32 = valid_timespec64_to_timespec (*abstime); + pts32 = &ts32; + } unsigned int clockbit = (clockid == CLOCK_REALTIME) ? FUTEX_CLOCK_REALTIME : 0; int op = __lll_private_flag (FUTEX_WAIT_BITSET | clockbit, private); - struct timespec ts32 = valid_timespec64_to_timespec (*abstime); return INTERNAL_SYSCALL_CANCEL (futex, futex_word, op, expected, - &ts32, NULL /* Unused. */, + pts32, NULL /* Unused. */, FUTEX_BITSET_MATCH_ANY); } #endif