public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/93456] No overflow check in __atomic_futex_unsigned_base::_M_futex_wait_until
       [not found] <bug-93456-4@http.gcc.gnu.org/bugzilla/>
@ 2020-11-14  0:16 ` cvs-commit at gcc dot gnu.org
  2020-11-14  0:25 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-11-14  0:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93456

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:b8d36dcc917e8a06d8c20b9f5ecc920ed2b9e947

commit r11-5021-gb8d36dcc917e8a06d8c20b9f5ecc920ed2b9e947
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Nov 13 20:57:15 2020 +0000

    libstdc++: Remove redundant overflow check for futex timeout [PR 93456]

    The relative_timespec function already checks for the case where the
    specified timeout is in the past, so the difference can never be
    negative. That means we dn't need to check if it's more negative than
    the minimum time_t value.

    libstdc++-v3/ChangeLog:

            PR libstdc++/93456
            * src/c++11/futex.cc (relative_timespec): Remove redundant check
            negative values.
            * testsuite/30_threads/future/members/wait_until_overflow.cc: Moved
to...
            * testsuite/30_threads/future/members/93456.cc: ...here.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/93456] No overflow check in __atomic_futex_unsigned_base::_M_futex_wait_until
       [not found] <bug-93456-4@http.gcc.gnu.org/bugzilla/>
  2020-11-14  0:16 ` [Bug libstdc++/93456] No overflow check in __atomic_futex_unsigned_base::_M_futex_wait_until cvs-commit at gcc dot gnu.org
@ 2020-11-14  0:25 ` redi at gcc dot gnu.org
  2020-11-16 21:15 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2020-11-14  0:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93456

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed on trunk by the patch above and a few other recent commits today.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/93456] No overflow check in __atomic_futex_unsigned_base::_M_futex_wait_until
       [not found] <bug-93456-4@http.gcc.gnu.org/bugzilla/>
  2020-11-14  0:16 ` [Bug libstdc++/93456] No overflow check in __atomic_futex_unsigned_base::_M_futex_wait_until cvs-commit at gcc dot gnu.org
  2020-11-14  0:25 ` redi at gcc dot gnu.org
@ 2020-11-16 21:15 ` cvs-commit at gcc dot gnu.org
  2020-11-19 13:33 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-11-16 21:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93456

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:730e1357dfb9aff481d6c47a21ef748f0d810d4f

commit r10-9031-g730e1357dfb9aff481d6c47a21ef748f0d810d4f
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Nov 13 19:11:02 2020 +0000

    libstdc++: Remove redundant overflow check for futex timeout [PR 93456]

    The relative_timespec function already checks for the case where the
    specified timeout is in the past, so the difference can never be
    negative. That means we dn't need to check if it's more negative than
    the minimum time_t value.

    libstdc++-v3/ChangeLog:

            PR libstdc++/93456
            * src/c++11/futex.cc (relative_timespec): Remove redundant check
            negative values.
            * testsuite/30_threads/future/members/93456.cc: New.

    (cherry picked from commit b8d36dcc917e8a06d8c20b9f5ecc920ed2b9e947)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/93456] No overflow check in __atomic_futex_unsigned_base::_M_futex_wait_until
       [not found] <bug-93456-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2020-11-16 21:15 ` cvs-commit at gcc dot gnu.org
@ 2020-11-19 13:33 ` cvs-commit at gcc dot gnu.org
  2020-11-25 15:11 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-11-19 13:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93456

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:b108faa9400e13a3d00dd7f71cff0ac45e29c5c9

commit r11-5167-gb108faa9400e13a3d00dd7f71cff0ac45e29c5c9
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Nov 19 13:33:11 2020 +0000

    libstdc++: Fix overflow checks to use the correct "time_t" [PR 93456]

    I recently added overflow checks to src/c++11/futex.cc for PR 93456, but
    then changed the type of the timespec for PR 93421. This meant the
    overflow checks were no longer using the right range, because the
    variable being written to might be smaller than time_t.

    This introduces new typedef that corresponds to the tv_sec member of the
    struct being passed to the syscall, and uses that typedef in the range
    checks.

    libstdc++-v3/ChangeLog:

            PR libstdc++/93421
            PR libstdc++/93456
            * src/c++11/futex.cc (syscall_time_t): New typedef for
            the type of the syscall_timespec::tv_sec member.
            (relative_timespec, _M_futex_wait_until)
            (_M_futex_wait_until_steady): Use syscall_time_t in overflow
            checks, not time_t.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/93456] No overflow check in __atomic_futex_unsigned_base::_M_futex_wait_until
       [not found] <bug-93456-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2020-11-19 13:33 ` cvs-commit at gcc dot gnu.org
@ 2020-11-25 15:11 ` redi at gcc dot gnu.org
  2020-12-29 13:12 ` aoliva at gcc dot gnu.org
  2021-04-19 10:40 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2020-11-25 15:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93456

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to CVS Commits from comment #3)
>             * testsuite/30_threads/future/members/93456.cc: ...here.

This test is failing for powerpc-darwin9, probably because I added overflow
checks for the futex version of __atomic_futex_unsigned_base but not the
generic version that uses a condition variable.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/93456] No overflow check in __atomic_futex_unsigned_base::_M_futex_wait_until
       [not found] <bug-93456-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2020-11-25 15:11 ` redi at gcc dot gnu.org
@ 2020-12-29 13:12 ` aoliva at gcc dot gnu.org
  2021-04-19 10:40 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: aoliva at gcc dot gnu.org @ 2020-12-29 13:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93456

Alexandre Oliva <aoliva at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aoliva at gcc dot gnu.org

--- Comment #8 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
On arm-vxworks, that has 32-bit time_t, this also fails.  The initial
gthread_cond_timedwait sleeps for a second or two, then it times out and
returns.  However, the wider C++ types used in the
condition_variable::__wait_until_impl check for a timeout and decide we have
NOT timed out, so the __Predicate version of __wait_until sees the condition
it's waiting for hasn't been met, and attempts to wait again.  But since the
timeout has already been reached, gthread_cond_wait returns immediately, and we
busy-loop.  Since vxworks won't preempt threads, and we're not in a SMP
configuration, the async call never gets a chance to complete, and the test
runs till the rlimit runs out.

While investigating this, I noticed that adding __gthread_yield calls in the
__wait_until_impl loop, the other thread gets enough cycles to complete, and
the test passes, but I thought that would defeat the point of the test, right?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/93456] No overflow check in __atomic_futex_unsigned_base::_M_futex_wait_until
       [not found] <bug-93456-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2020-12-29 13:12 ` aoliva at gcc dot gnu.org
@ 2021-04-19 10:40 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2021-04-19 10:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93456

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|redi at gcc dot gnu.org            |unassigned at gcc dot gnu.org
             Status|ASSIGNED                    |NEW

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-04-19 10:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-93456-4@http.gcc.gnu.org/bugzilla/>
2020-11-14  0:16 ` [Bug libstdc++/93456] No overflow check in __atomic_futex_unsigned_base::_M_futex_wait_until cvs-commit at gcc dot gnu.org
2020-11-14  0:25 ` redi at gcc dot gnu.org
2020-11-16 21:15 ` cvs-commit at gcc dot gnu.org
2020-11-19 13:33 ` cvs-commit at gcc dot gnu.org
2020-11-25 15:11 ` redi at gcc dot gnu.org
2020-12-29 13:12 ` aoliva at gcc dot gnu.org
2021-04-19 10:40 ` redi at gcc dot gnu.org

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).