__extension__ typedef int __pid_t; typedef unsigned int uintptr_t; typedef __pid_t pid_t; typedef struct __pthread_internal_slist { } __pthread_slist_t; typedef union dtv { void *self; int multiple_threads; uintptr_t sysinfo; } tcbhead_t; struct sched_param { }; typedef struct list_head { struct list_head *next; struct list_head *prev; } list_t; typedef struct td_thr_events { } td_thr_events_t; typedef enum { _URC_NO_REASON = 0, _URC_FOREIGN_EXCEPTION_CAUGHT = 1, _URC_FATAL_PHASE2_ERROR = 2, _URC_FATAL_PHASE1_ERROR = 3, _URC_NORMAL_STOP = 4, _URC_END_OF_STACK = 5, _URC_HANDLER_FOUND = 6, _URC_INSTALL_CONTEXT = 7, _URC_CONTINUE_UNWIND = 8 } _Unwind_Reason_Code; struct _Unwind_Exception { } __attribute__((__aligned__)); struct sockaddr { }; typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error } res_sendhookact; struct __res_state { }; struct xid_command { int syscall_no; long int id[3]; volatile int cntr; }; struct robust_list_head { }; struct pthread { union { tcbhead_t header; void *__padding[24]; }; list_t list; pid_t tid; pid_t pid; int cancelhandling; } __attribute ((aligned (64))); extern __thread int errno __attribute__ ((tls_model ("initial-exec"))); extern list_t __stack_user; extern __typeof (__stack_user) __stack_user __asm__ ("" "__GI___stack_user") __attribute__ ((visibility ("hidden"))); static list_t stack_used = { &(stack_used), &(stack_used) }; static int __attribute__ ((regparm (3), stdcall)) setxid_signal_thread (struct xid_command *cmdp, struct pthread *t) { if ((t->cancelhandling & (0x01 << 6)) == 0) return 0; int val; val = ({ register unsigned int resultvar; asm volatile ( "xchgl %%ebx, %%edi\n\t" "movl %1, %%eax\n\t" "int $0x80\n\t" "xchgl %%edi, %%ebx\n\t" : "=a" (resultvar) : "i" (270) , "D" (({ __typeof (({ struct pthread *__self; asm ("movl %%gs:%c1,%0" : "=r" (__self) : "i" (__builtin_offsetof (struct pthread, header.self))); __self;})->pid) __value; if (sizeof (__value) == 1) asm volatile ("movb %%gs:%P2,%b0" : "=q" (__value) : "0" (0), "i" (__builtin_offsetof (struct pthread, pid))); else if (sizeof (__value) == 4) asm volatile ("movl %%gs:%P1,%0" : "=r" (__value) : "i" (__builtin_offsetof (struct pthread, pid))); else { if (sizeof (__value) != 8) abort (); asm volatile ("movl %%gs:%P1,%%eax\n\t" "movl %%gs:%P2,%%edx" : "=A" (__value) : "i" (__builtin_offsetof (struct pthread, pid)), "i" (__builtin_offsetof (struct pthread, pid) + 4)); } __value; })), "c" (t->tid), "d" ((32 + 1)) : "memory", "cc"); (int) resultvar; } ) ; if (!((unsigned int) (val) >= 0xfffff001u)) { do { if (sizeof (*&cmdp->cntr) == 1) __asm __volatile ("lock;" "incb %b0" : "=m" (*&cmdp->cntr) : "m" (*&cmdp->cntr), "i" (__builtin_offsetof (tcbhead_t, multiple_threads))); else if (sizeof (*&cmdp->cntr) == 2) __asm __volatile ("lock;" "incw %w0" : "=m" (*&cmdp->cntr) : "m" (*&cmdp->cntr), "i" (__builtin_offsetof (tcbhead_t, multiple_threads))); else if (sizeof (*&cmdp->cntr) == 4) __asm __volatile ("lock;" "incl %0" : "=m" (*&cmdp->cntr) : "m" (*&cmdp->cntr), "i" (__builtin_offsetof (tcbhead_t, multiple_threads))); else { __typeof (&cmdp->cntr) __memp = (&cmdp->cntr); __typeof (*&cmdp->cntr) __oldval = *__memp; __typeof (*&cmdp->cntr) __tmpval; do __tmpval = __oldval; while ((__oldval = ({ __typeof (*__memp) ret = *(__memp); abort (); ret = (__oldval + 1); ret = (__oldval); ret; })) == __tmpval); } } while (0); return 1; } else return 0; } int __attribute__ ((visibility ("hidden"))) __nptl_setxid (struct xid_command *cmdp) { int signalled; int result; struct pthread *self = ({ struct pthread *__self; asm ("movl %%gs:%c1,%0" : "=r" (__self) : "i" (__builtin_offsetof (struct pthread, header.self))); __self;} ); list_t *runp; for (runp = (&stack_used)->next; runp != (&stack_used); runp = runp->next) { struct pthread *t = ((struct pthread *) ((char *) (runp) - (unsigned long) (&((struct pthread *) 0)->list))); if (t == self) continue; setxid_mark_thread (cmdp, t); } for (runp = (&__stack_user)->next; runp != (&__stack_user); runp = runp->next) { struct pthread *t = ((struct pthread *) ((char *) (runp) - (unsigned long) (&((struct pthread *) 0)->list))); if (t == self) continue; setxid_mark_thread (cmdp, t); } do { signalled = 0; for (runp = (&stack_used)->next; runp != (&stack_used); runp = runp->next) { struct pthread *t = ((struct pthread *) ((char *) (runp) - (unsigned long) (&((struct pthread *) 0)->list))); if (t == self) continue; signalled += setxid_signal_thread (cmdp, t); } for (runp = (&__stack_user)->next; runp != (&__stack_user); runp = runp->next) { struct pthread *t = ((struct pthread *) ((char *) (runp) - (unsigned long) (&((struct pthread *) 0)->list))); if (t == self) continue; signalled += setxid_signal_thread (cmdp, t); } int cur = cmdp->cntr; while (cur != 0) { ({ int __status; register __typeof (cur) _val asm ("edx") = (cur); __asm __volatile ("xchgl %2, %%ebx\n" "int $0x80\n\t" "xchgl %2, %%ebx\n" : "=a" (__status) : "0" (240), "D" (&cmdp->cntr), "S" (((void *)0)), "c" ((((0) | 128) ^ (0))), "d" (_val), "i" (__builtin_offsetof (tcbhead_t, sysinfo)) : "memory"); __status; }); cur = cmdp->cntr; } } while (signalled != 0); for (runp = (&stack_used)->next; runp != (&stack_used); runp = runp->next) { struct pthread *t = ((struct pthread *) ((char *) (runp) - (unsigned long) (&((struct pthread *) 0)->list))); if (t == self) continue; setxid_unmark_thread (cmdp, t); } result = ({ register unsigned int resultvar; asm volatile ( "xchgl %%ebx, %%edi\n\t" "int $0x80\n\t" "xchgl %%edi, %%ebx\n\t" : "=a" (resultvar) : "0" (cmdp->syscall_no) , "D" (cmdp->id[0]), "c" (cmdp->id[1]), "d" (cmdp->id[2]) : "memory", "cc"); (int) resultvar; } ) ; int error = 0; if (__builtin_expect ((((unsigned int) (result) >= 0xfffff001u)), 0)) { error = (-(result)); (errno = (error)); result = -1; } __nptl_setxid_error (cmdp, error); return result; }