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
36111509
Commit
36111509
authored
8 months ago
by
Samuel Thibault
Browse files
Options
Downloads
Patches
Plain Diff
hurd: Fix pthread_self() without libpthread
debian/patches/hurd-i386/git-pthread_self.diff
parent
59b2ff82
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
+7
-0
7 additions, 0 deletions
debian/changelog
debian/patches/hurd-i386/git-pthread_self.diff
+99
-0
99 additions, 0 deletions
debian/patches/hurd-i386/git-pthread_self.diff
debian/patches/series
+1
-0
1 addition, 0 deletions
debian/patches/series
with
107 additions
and
0 deletions
debian/changelog
+
7
−
0
View file @
36111509
glibc (2.39-5) UNRELEASED; urgency=medium
* debian/patches/hurd-i386/git-pthread_self.diff: Fix pthread_self() without
libpthread.
-- Samuel Thibault <sthibault@debian.org> Wed, 17 Jul 2024 14:16:31 +0200
glibc (2.39-4) unstable; urgency=medium
[ Aurelien Jarno ]
...
...
This diff is collapsed.
Click to expand it.
debian/patches/hurd-i386/git-pthread_self.diff
0 → 100644
+
99
−
0
View file @
36111509
commit 0e75c4a4634f44ad24a65fda01f571781ac79d5f
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Wed Jul 17 14:06:25 2024 +0200
hurd: Fix pthread_self() without libpthread
5476f8cd2e68 ("htl: move pthread_self info libc.") moved the htl
pthread_self() function from libpthread to libc, replacing the previous libc
stub that just returns 0. And 53da64d1cf36 ("htl: Initialize ___pthread_self
early") added initialization code which is needed before being able to
call pthread_self. It is currently in libpthread, and thus never called
before programs can call pthread_self from libc, which then segfaults
when accessing _pthread_self()->thread.
This moves the initialization to libc itself, as initialized variables, so
pthread_self can always be called fine.
diff --git a/htl/Versions b/htl/Versions
index e1524117a0..69b79b4f1b 100644
--- a/htl/Versions
+++ b/htl/Versions
@@ -38,6 +38,7 @@
libc {
__pthread_cleanup_stack;
__pthread_total;
___pthread_self;
+ __pthread_init_thread;
}
}
diff --git a/sysdeps/mach/hurd/htl/pt-pthread_self.c b/sysdeps/mach/hurd/htl/pt-pthread_self.c
index 04fa283aab..08ef2e4956 100644
--- a/sysdeps/mach/hurd/htl/pt-pthread_self.c
+++ b/sysdeps/mach/hurd/htl/pt-pthread_self.c
@@ -17,6 +17,13 @@
<https://www.gnu.org/licenses/>. */
#include <pt-sysdep.h>
+#include <pt-internal.h>
-__thread struct __pthread *___pthread_self;
+/* Initial thread structure used before libpthread is initialized, so various
+ * functions can already work at least basically. */
+struct __pthread __pthread_init_thread = {
+ .thread = 1,
+};
+
+__thread struct __pthread *___pthread_self = &__pthread_init_thread;
libc_hidden_tls_def (___pthread_self)
diff --git a/sysdeps/mach/hurd/htl/pt-sysdep.c b/sysdeps/mach/hurd/htl/pt-sysdep.c
index 5372cbf77f..f5c1c246eb 100644
--- a/sysdeps/mach/hurd/htl/pt-sysdep.c
+++ b/sysdeps/mach/hurd/htl/pt-sysdep.c
@@ -26,10 +26,6 @@
#include <pt-internal.h>
#include <pthreadP.h>
-/* Initial thread structure used temporarily during initialization, so various
- * functions can already work at least basically. */
-static struct __pthread init_thread;
-
static void
reset_pthread_total (void)
{
@@ -51,10 +47,6 @@
_init_routine (void *stack)
/* Already initialized */
return;
- /* Initialize early thread structure. */
- init_thread.thread = 1;
- ___pthread_self = &init_thread;
-
/* Initialize the library. */
___pthread_init ();
@@ -116,9 +108,9 @@
_init_routine (void *stack)
#endif
/* Copy over the thread-specific state */
- assert (!init_thread.thread_specifics);
+ assert (!__pthread_init_thread.thread_specifics);
memcpy (&thread->static_thread_specifics,
- &init_thread.static_thread_specifics,
+ &__pthread_init_thread.static_thread_specifics,
sizeof (thread->static_thread_specifics));
___pthread_self = thread;
diff --git a/sysdeps/mach/hurd/htl/pt-sysdep.h b/sysdeps/mach/hurd/htl/pt-sysdep.h
index 09d9547a8e..ef7f509611 100644
--- a/sysdeps/mach/hurd/htl/pt-sysdep.h
+++ b/sysdeps/mach/hurd/htl/pt-sysdep.h
@@ -34,6 +34,8 @@
extern __thread struct __pthread *___pthread_self;
libc_hidden_tls_proto (___pthread_self)
+extern struct __pthread ___pthread_init_thread;
+libc_hidden_proto (___pthread_init_thread)
#ifdef DEBUG
#define _pthread_self() \
This diff is collapsed.
Click to expand it.
debian/patches/series
+
1
−
0
View file @
36111509
...
...
@@ -31,6 +31,7 @@ hurd-i386/git-xattr.diff
hurd-i386/git-proc_getchildren_rusage.diff
hurd-i386/git-AT_NO_AUTOMOUNT.diff
hurd-i386/git-intr-msg-clobber.diff
hurd-i386/git-pthread_self.diff
hurd-i386/local-intr-msg-clobber.diff
hurd-i386/local-enable-ldconfig.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