Skip to content

Commit a1e9ae2

Browse files
Implementation of new pthreads for GLIBC
1 parent 0671c27 commit a1e9ae2

File tree

3 files changed

+863
-608
lines changed

3 files changed

+863
-608
lines changed

gum/backend-linux/gumlinux-priv.h

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ G_BEGIN_DECLS
1616

1717
typedef struct _GumProcMapsIter GumProcMapsIter;
1818

19+
#ifndef HAVE_GLIBC
1920
typedef struct _GumLinuxPThread GumLinuxPThread;
21+
#endif
2022
typedef struct _GumGlibcList GumGlibcList;
2123
typedef int GumGlibcLock;
2224

@@ -33,9 +35,12 @@ struct _GumLinuxPThreadSpec
3335
int (* set_name) (pthread_t thread, const char * name);
3436

3537
#if defined (HAVE_GLIBC)
38+
gsize flink_offset;
39+
gsize blink_offset;
3640
GumGlibcList * stack_used;
3741
GumGlibcList * stack_user;
3842
GumGlibcLock * stack_lock;
43+
gsize tid_offset;
3944
#elif defined (HAVE_MUSL)
4045
GumLinuxPThread * main_thread;
4146
void (* tl_lock) (void);
@@ -59,29 +64,20 @@ struct _GumGlibcList
5964
GumGlibcList * prev;
6065
};
6166

67+
#ifndef HAVE_GLIBC
6268
struct _GumLinuxPThread
6369
{
64-
#if defined (HAVE_GLIBC)
65-
union
66-
{
67-
# if defined (HAVE_I386) && GLIB_SIZEOF_VOID_P == 8
68-
guint8 tcb_header[704];
69-
# endif
70-
gpointer padding[24];
71-
} header;
72-
GumGlibcList list;
73-
pid_t tid;
74-
#elif defined (HAVE_MUSL)
70+
# if defined (HAVE_MUSL)
7571
gpointer self;
76-
# ifdef HAVE_I386
72+
# ifdef HAVE_I386
7773
gpointer dtv;
78-
# endif
74+
# endif
7975
GumLinuxPThread * prev;
8076
GumLinuxPThread * next;
8177
gpointer sysinfo;
82-
# ifdef HAVE_I386
78+
# ifdef HAVE_I386
8379
gsize canary;
84-
# endif
80+
# endif
8581
int tid;
8682
int errno_val;
8783
volatile int detach_state;
@@ -93,12 +89,13 @@ struct _GumLinuxPThread
9389
guint8 * map_base;
9490
gsize map_size;
9591
gpointer stack;
96-
#elif defined (HAVE_ANDROID)
92+
# elif defined (HAVE_ANDROID)
9793
GumLinuxPThread * next;
9894
GumLinuxPThread * prev;
9995
pid_t tid;
100-
#endif
96+
# endif
10197
};
98+
#endif
10299

103100
G_GNUC_INTERNAL const Dl_info * _gum_process_get_libc_info (void);
104101

0 commit comments

Comments
 (0)