Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
glibc
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GNU Libc Maintainers
glibc
Commits
79a251c1
Commit
79a251c1
authored
2 years ago
by
Samuel Thibault
Browse files
Options
Downloads
Patches
Plain Diff
debian/patches/hurd-i386/git-cond-destroy.diff: Fix tst-cond20
parent
43916f8b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
debian/changelog
+1
-0
1 addition, 0 deletions
debian/changelog
debian/patches/hurd-i386/git-cond-destroy.diff
+61
-0
61 additions, 0 deletions
debian/patches/hurd-i386/git-cond-destroy.diff
debian/patches/series
+1
-0
1 addition, 0 deletions
debian/patches/series
with
63 additions
and
0 deletions
debian/changelog
+
1
−
0
View file @
79a251c1
...
...
@@ -13,6 +13,7 @@ glibc (2.34-5) UNRELEASED; urgency=medium
dependency.
* debian/patches/hurd-i386/git-loadfail.diff: Fix elf/loadfail missing
dependency.
* debian/patches/hurd-i386/git-cond-destroy.diff: Fix tst-cond20.
[ Aurelien Jarno ]
* debian/debhelper.in/libc-dev.NEWS: fix a typo.
...
...
This diff is collapsed.
Click to expand it.
debian/patches/hurd-i386/git-cond-destroy.diff
0 → 100644
+
61
−
0
View file @
79a251c1
commit 4565083abc972bffe810e4151f8f3cb48531e526
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Mon Aug 22 22:27:24 2022 +0200
htl: Make pthread*_cond_timedwait register wref before releasing mutex
Otherwise another thread could be rightly trying to destroy the condition,
see e.g. tst-cond20.
diff --git a/sysdeps/htl/pt-cond-timedwait.c b/sysdeps/htl/pt-cond-timedwait.c
index 6f4cb41bf1..4352e54fff 100644
--- a/sysdeps/htl/pt-cond-timedwait.c
+++ b/sysdeps/htl/pt-cond-timedwait.c
@@ -142,13 +142,15 @@
__pthread_cond_timedwait_internal (pthread_cond_t *cond,
__pthread_mutex_unlock (&self->cancel_lock);
- /* Release MUTEX before blocking. */
- __pthread_mutex_unlock (mutex);
-
/* Increase the waiter reference count. Relaxed MO is sufficient because
- we only need to synchronize when decrementing the reference count. */
+ we only need to synchronize when decrementing the reference count.
+ We however need to have the mutex held to prevent concurrency with
+ a pthread_cond_destroy. */
atomic_fetch_add_relaxed (&cond->__wrefs, 2);
+ /* Release MUTEX before blocking. */
+ __pthread_mutex_unlock (mutex);
+
/* Block the thread. */
if (abstime != NULL)
err = __pthread_timedblock (self, abstime, clock_id);
diff --git a/sysdeps/mach/hurd/htl/pt-hurd-cond-timedwait.c b/sysdeps/mach/hurd/htl/pt-hurd-cond-timedwait.c
index 16f0d3b309..1677925755 100644
--- a/sysdeps/mach/hurd/htl/pt-hurd-cond-timedwait.c
+++ b/sysdeps/mach/hurd/htl/pt-hurd-cond-timedwait.c
@@ -103,6 +103,12 @@
__pthread_hurd_cond_timedwait_internal (pthread_cond_t *cond,
__pthread_spin_unlock (&cond->__lock);
__spin_unlock (&ss->lock);
+ /* Increase the waiter reference count. Relaxed MO is sufficient because
+ we only need to synchronize when decrementing the reference count.
+ We however need to have the mutex held to prevent concurrency with
+ a pthread_cond_destroy. */
+ atomic_fetch_add_relaxed (&cond->__wrefs, 2);
+
if (cancel)
{
/* Cancelled on entry. Just leave the mutex locked. */
@@ -115,10 +121,6 @@
__pthread_hurd_cond_timedwait_internal (pthread_cond_t *cond,
/* Release MUTEX before blocking. */
__pthread_mutex_unlock (mutex);
- /* Increase the waiter reference count. Relaxed MO is sufficient because
- we only need to synchronize when decrementing the reference count. */
- atomic_fetch_add_relaxed (&cond->__wrefs, 2);
-
/* Block the thread. */
if (abstime != NULL)
err = __pthread_timedblock (self, abstime, clock_id);
This diff is collapsed.
Click to expand it.
debian/patches/series
+
1
−
0
View file @
79a251c1
...
...
@@ -58,6 +58,7 @@ hurd-i386/git-htl-pthread-self-early.diff
hurd-i386/git-ipv6.diff
hurd-i386/git-ip_mreqn.diff
hurd-i386/git-bootstrap-enable_secure.diff
hurd-i386/git-cond-destroy.diff
hurd-i386/local-enable-ldconfig.diff
hurd-i386/tg-sysvshm.diff
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment