platform_bionic/libc/arch-x86/syscalls
Elliott Hughes b30aff405a Revert "Revert "Lose the hand-written futex assembler.""
The problem with the original patch was that using syscall(3) means that
errno can be set, but pthread_create(3) was abusing the TLS errno slot as
a pthread_mutex_t for the thread startup handshake.

There was also a mistake in the check for syscall failures --- it should
have checked against -1 instead of 0 (not just because that's the default
idiom, but also here because futex(2) can legitimately return values > 0).

This patch stops abusing the TLS errno slot and adds a pthread_mutex_t to
pthread_internal_t instead. (Note that for LP64 sizeof(pthread_mutex_t) >
sizeof(uintptr_t), so we could potentially clobber other TLS slots too.)

I've also rewritten the LP32 compatibility stubs to directly reuse the
code from the .h file.

This reverts commit 75c55ff84e.

Bug: 15195455
Change-Id: I6ffb13e5cf6a35d8f59f692d94192aae9ab4593d
2014-05-28 18:31:15 -07:00
..
__accept4.S Mark sockets on creation (socket()) and accept4(). 2014-05-19 15:19:16 -07:00
__brk.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__connect.S Introduce netd_client, a dynamic library that talks to netd. 2014-05-13 11:30:03 -07:00
__epoll_pwait.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__exit.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__fcntl64.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__fstatfs64.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__getcpu.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__getcwd.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__getpriority.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__ioctl.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__llseek.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__mmap2.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__openat.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__ppoll.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__pselect6.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__ptrace.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__reboot.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__rt_sigaction.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__rt_sigpending.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__rt_sigprocmask.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__rt_sigsuspend.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__rt_sigtimedwait.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__sched_getaffinity.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__set_thread_area.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__set_tid_address.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__sigaction.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__signalfd4.S Hide __signalfd4, used to implement signalfd(3). 2014-05-16 15:47:29 -07:00
__socket.S Mark sockets on creation (socket()) and accept4(). 2014-05-19 15:19:16 -07:00
__statfs64.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__timer_create.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__timer_delete.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__timer_getoverrun.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__timer_gettime.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__timer_settime.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
__waitid.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
_exit.S Implement _Exit(3). 2014-04-08 17:16:13 -07:00
acct.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
bind.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
capget.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
capset.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
chdir.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
chroot.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
clock_getres.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
clock_gettime.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
clock_nanosleep.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
clock_settime.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
close.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
delete_module.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
dup.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
dup3.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
epoll_create1.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
epoll_ctl.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
eventfd.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
execve.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
faccessat.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
fallocate64.S Add fallocate/fallocate64/posix_fallocate/posix_fallocate64. 2014-02-03 16:20:46 -08:00
fchdir.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
fchmod.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
fchmodat.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
fchown.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
fchownat.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
fdatasync.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
fgetxattr.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
flistxattr.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
flock.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
fremovexattr.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
fsetxattr.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
fstat64.S Fix build by avoiding the _C_LABEL macro. 2014-02-18 16:42:36 -08:00
fstatat64.S Fix build by avoiding the _C_LABEL macro. 2014-02-18 16:42:36 -08:00
fsync.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
ftruncate.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
ftruncate64.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
getdents.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
getegid.S Stop using the non-uapi <linux/err.h> header file. 2013-11-07 10:31:05 -08:00
geteuid.S Stop using the non-uapi <linux/err.h> header file. 2013-11-07 10:31:05 -08:00
getgid.S Stop using the non-uapi <linux/err.h> header file. 2013-11-07 10:31:05 -08:00
getgroups.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
getitimer.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
getpeername.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
getpgid.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
getpid.S Stop using the non-uapi <linux/err.h> header file. 2013-11-07 10:31:05 -08:00
getppid.S Stop using the non-uapi <linux/err.h> header file. 2013-11-07 10:31:05 -08:00
getresgid.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
getresuid.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
getrlimit.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
getrusage.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
getsid.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
getsockname.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
getsockopt.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
gettid.S Stop using the non-uapi <linux/err.h> header file. 2013-11-07 10:31:05 -08:00
gettimeofday.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
getuid.S Stop using the non-uapi <linux/err.h> header file. 2013-11-07 10:31:05 -08:00
getxattr.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
init_module.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
inotify_add_watch.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
inotify_init1.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
inotify_rm_watch.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
ioprio_get.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
ioprio_set.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
kill.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
klogctl.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
lgetxattr.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
linkat.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
listen.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
listxattr.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
llistxattr.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
lremovexattr.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
lseek.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
lsetxattr.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
madvise.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
mincore.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
mkdirat.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
mknodat.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
mlock.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
mlockall.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
mount.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
mprotect.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
mremap.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
msync.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
munlock.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
munlockall.S Stop using the non-uapi <linux/err.h> header file. 2013-11-07 10:31:05 -08:00
munmap.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
nanosleep.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
personality.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
pipe2.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
prctl.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
pread64.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
prlimit64.S Fix <sys/resource.h>. 2014-01-09 11:00:04 -08:00
pwrite64.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
read.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
readahead.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
readlinkat.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
readv.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
recvfrom.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
recvmmsg.S Add recvmmsg and sendmmsg syscalls. 2014-02-27 14:29:01 -08:00
recvmsg.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
removexattr.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
renameat.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
sched_get_priority_max.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
sched_get_priority_min.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
sched_getparam.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
sched_getscheduler.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
sched_rr_get_interval.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
sched_setaffinity.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
sched_setparam.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
sched_setscheduler.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
sched_yield.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
sendfile.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
sendfile64.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
sendmmsg.S Add recvmmsg and sendmmsg syscalls. 2014-02-27 14:29:01 -08:00
sendmsg.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
sendto.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
setgid.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
setgroups.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
setitimer.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
setns.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
setpgid.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
setpriority.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
setregid.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
setresgid.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
setresuid.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
setreuid.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
setrlimit.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
setsid.S Stop using the non-uapi <linux/err.h> header file. 2013-11-07 10:31:05 -08:00
setsockopt.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
settimeofday.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
setuid.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
setxattr.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
shutdown.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
sigaltstack.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
socketpair.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
swapoff.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
swapon.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
symlinkat.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
sync.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
sysinfo.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
tgkill.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
timerfd_create.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
timerfd_gettime.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
timerfd_settime.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
times.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
truncate.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
truncate64.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
umask.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
umount2.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
uname.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
unlinkat.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
unshare.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
utimensat.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
wait4.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
write.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00
writev.S Add cfi directives to x86 syscalls. 2014-01-06 16:39:10 -08:00