History log of /bionic/libc/bionic/libc_init_common.cpp
Revision Date Author Comments
9ce09e423f24823d52f19ab8247e078977100132 12-Nov-2015 Mingwei Shi <mingwei.shi@intel.com> libc: implement kernel vdso syscalls for i386

This patch uses __kernel_vsyscall instead of "int 0x80"
as the syscall entry point. AT_SYSINFO points to
an adapter to mask the arch specific difference and gives a
performance boost on i386 architecture.

Bug: http://b/27533895
Change-ID: Ib340c604d02c6c25714a95793737e3cfdc3fc5d7
Signed-off-by: Mingwei Shi <mingwei.shi@intel.com>

(cherry picked from commit be910529322b461148debefd50b9e0d67ae84f8e)
d1981c0f6f80c6218730b6bd9f8f8f17b4a9c868 04-Mar-2016 Elliott Hughes <enh@google.com> Improve and fix the stack-protector tests.

Bug: http://b/26888853

(cherry picked from commit fc69a8ad5f0d9b63de48e3858fb4811ede7ac64e)

Change-Id: Ibc431076000b9a8db46f68f858480045b03b6e79
12393862e55b9ab28dd29ae16fbdf498371726a7 04-Mar-2016 Elliott Hughes <enh@google.com> Improve and fix the stack-protector tests.

Bug: http://b/26888853

(cherry picked from commit fc69a8ad5f0d9b63de48e3858fb4811ede7ac64e)

Change-Id: Ibc431076000b9a8db46f68f858480045b03b6e79
63860cb8fd1adf3f679b9b4ad876323a8d65cd9d 17-Nov-2015 Christopher Ferris <cferris@google.com> Malloc debug rewrite.

The major components of the rewrite:

- Completely remove the qemu shared library code. Nobody was using it
and it appears to have broken at some point.
- Adds the ability to enable/disable different options independently.
- Adds a new option that can enable the backtrace on alloc/free when
a process gets a specific signal.
- Adds a new way to enable malloc debug. If a special property is
set, and the process has an environment variable set, then debug
malloc will be enabled. This allows something that might be
a derivative of app_process to be started with an environment variable
being enabled.
- get_malloc_leak_info() used to return one element for each pointer that
had the exact same backtrace. The new version returns information for
every one of the pointers with same backtrace. It turns out ddms already
automatically coalesces these, so the old method simply hid the fact
that there where multiple pointers with the same amount of backtrace.
- Moved all of the malloc debug specific code into the library.
Nothing related to the malloc debug data structures remains in libc.
- Removed the calls to the debug malloc cleanup routine. Instead, I
added an atexit call with the debug malloc cleanup routine. This gets
around most problems related to the timing of doing the cleanup.

The new properties and environment variables:

libc.debug.malloc.options
Set by option name (such as "backtrace"). Setting this to a bad value
will cause a usage statement to be printed to the log.

libc.debug.malloc.program
Same as before. If this is set, then only the program named will
be launched with malloc debug enabled. This is not a complete match,
but if any part of the property is in the program name, malloc debug is
enabled.

libc.debug.malloc.env_enabled
If set, then malloc debug is only enabled if the running process has the
environment variable LIBC_DEBUG_MALLOC_ENABLE set.

Bug: 19145921

Change-Id: I7b0e58cc85cc6d4118173fe1f8627a391b64c0d7
42d949ff9d2956e25f84e537f43a8f93ecb37baf 07-Jan-2016 Elliott Hughes <enh@google.com> Defend against -fstack-protector in libc startup.

Exactly which functions get a stack protector is up to the compiler, so
let's separate the code that sets up the environment stack protection
requires and explicitly build it with -fno-stack-protector.

Bug: http://b/26276517
Change-Id: I8719e23ead1f1e81715c32c1335da868f68369b5
40c2bf6cf6d9fa423d36128823451ae1cc1f7662 06-Jan-2016 Elliott Hughes <enh@google.com> Fix a broken link in a comment.

Bug: https://code.google.com/p/android/issues/detail?id=197784
Change-Id: I2f9e5bc2dd2b8a6992c7c55bc856e4a323c7c8a8
6c54ddd20f663de9e383fcd7b4cff93471369d87 08-Dec-2015 Elliott Hughes <enh@google.com> Fix -fstack-protector-strong for x86.

We need to ensure %gs:20 is set up early enough for -fstack-protector-strong
on x86, and that __set_tls doesn't get stack protector checks because it's a
prerequisite for them. x86 devices/emulators won't boot without this.

Bug: http://b/26073874
Change-Id: Icf0d34294648cc0c8cb406a3617befe0d45c525a
bb46afd6c44a847efe96e30d72708fd2d0906e8c 05-Dec-2015 Elliott Hughes <enh@google.com> Revert "Revert "Remove __sinit and __sdidinit.""

This reverts commit c8bae05f3ff9f1c736f7be70fa17d02795d748bb.

We were breaking init (ueventd) because we initialize system properties
before we initialize stdio. The new system property implementation uses
stdio to read from /property_contexts, so we end up touching stdio data
structures before they've been initialized.

This second attempt takes things further by removing the stdio initialization
function altogether. The data structures for stdin/stdout/stderr can be
statically initialized as data, and -- since we already had to give the
atexit implementation a backdoor for stdio -- we can just admit that we
need to clean up stdio, and that we always do so last.

This patch also removes the 17 statically pre-allocated file structures,
so the first fopen will now allocate a block of 10 (the usual overflow
behavior). I did this just to make my life simpler, but it's not actually
necessary to remove it if we want it back.

Change-Id: I936b2eb5e88e4ebaf5516121872b71fc88e5609c
c8bae05f3ff9f1c736f7be70fa17d02795d748bb 05-Dec-2015 Elliott Hughes <enh@google.com> Revert "Remove __sinit and __sdidinit."

This reverts commit 4371961e00ad83fca033992c8a19c7d262fe6f84.

This broke booting; ueventd crashes with a null pointer dereference
somewhere in __sfp (but the kernel doesn't unwind, so I don't know
what was calling __sfp).

Change-Id: I65375fdfdf1d339a06558b4057b580cacd6324e2
4371961e00ad83fca033992c8a19c7d262fe6f84 03-Dec-2015 Elliott Hughes <enh@google.com> Remove __sinit and __sdidinit.

We're eagerly initializing stdio now, so this can all be simplified.

Change-Id: Icb288f8dd0ee08f02bea0d23670f75e78bed6b99
d68c9e5906917f1528fe16c2c657e3a34c16e536 25-Nov-2015 Yabin Cui <yabinc@google.com> Init stdio in __libc_init_common.

Previously we call __sinit() lazily. But it is likely to cause data
races like in https://android-review.googlesource.com/#/c/183237/. So
we prefer to call __sinit() explicitly at libc initialization.

Bug: 25392375

Change-Id: I181ea7a4b2e4c7350b45f2e6c86886ea023e80b8
284068f44fd1ad2d22980ea39f49d2c1b74014c7 19-Nov-2015 Yabin Cui <yabinc@google.com> Fix tsan abort for lake of __libc_auxv initialization.

If tsan is used, the following callchain can happen:
__libc_preinit() -> __libc_init_globals() ->
__libc_init_vdso() -> strcmp() -> __tsan_init()
-> sysconf(_SC_PAGE_SIZE) -> getauxval().
But __libc_auxv is initialized in __libc_init_common(),
after __libc_init_globals(). One simple way to fix
this is to initialize __libc_auxv at __libc_init_globals().

Bug: 25392375
Change-Id: I3893b1f567d5f3b7a8c881c0c1b8234b06b7751b
2fb02651c894866c220bd64cbcd5fbd14e086b85 11-Nov-2015 Nick Kralevich <nnk@google.com> libc_init_common.cpp: Clarify when environment stripping occurs

The current comment implies that we only strip sensitive
environment variables on executing a setuid program. This is
true but incomplete. The AT_SECURE flag is set whenever a
security transition occurs, such as executing a setuid program,
SELinux security transition, executing a file with file capabilities,
etc...

Fixup the comments.

Change-Id: I30a73992adfde14d6e5f642b3a1ead2ee56726be
fe9d0ed6cb10d5403e54d2dd12628a0ec345ae6e 07-Oct-2015 Josh Gao <jmgao@google.com> Move setjmp cookie to a shared globals struct.

Change-Id: I59a4c187d61524c4e48655c4c6376dba0d41eee2
93c0f5ee00d1357247fda333c9d49c8673c9c83b 06-Oct-2015 Josh Gao <jmgao@google.com> Move VDSO pointers to a shared globals struct.

Change-Id: I01cbc9cf0917dc1fac52d9205bda2c68529d12ef
a5d5d16c3c5679afd26e6bbc24215b7c20025ade 02-Oct-2015 Josh Gao <jmgao@google.com> Use foreach loop to match setuid unsafe env vars.

Change-Id: I1e94daefac8e601281f38c7ce29ba3172a4a60bb
7fda8d2aa4d24ab400f6f0cb9f792488b634afae 11-Sep-2015 Josh Gao <jmgao@google.com> Implement setjmp cookies on ARM.

Reuse the top bits of _JB_SIGFLAG field previously used to store a
boolean to store a cookie that's validated by [sig]longjmp to make it
harder to use as a ROP gadget. Additionally, encrypt saved registers
with the cookie so that an attacker can't modify a register's value to
a specific value without knowing the cookie.

Bug: http://b/23942752
Change-Id: Id0eb8d06916e89d5d776bfcaa9458f8826717ba3
d29486343a66cae37fc4fc74ed206fd29f25476b 21-Jul-2015 Elliott Hughes <enh@google.com> Use a less misleading name for the code that sets up the main thread.

Change-Id: I50c1b0a3b633cf8bc40a6bd86f12adb6b91e2888
c2247478d5bcd6e8fe4d2b58f0bdeff73daa4c80 01-Jul-2015 Dmitriy Ivanov <dimitry@google.com> Improve personality initialization

1. Personality parameter should be unsigned int (not long)
2. Do not reset bits outside of PER_MASK when setting
personality value.
3. Set personality for static executables.

Bug: http://b/21900686
Change-Id: I4c7e34079cbd59b818ce221eed325c05b9bb2303
(cherry picked from commit f643eb38c36eb63f612e20dea09fd43ac6a6b360)
f643eb38c36eb63f612e20dea09fd43ac6a6b360 01-Jul-2015 Dmitriy Ivanov <dimitry@google.com> Improve personality initialization

1. Personality parameter should be unsigned int (not long)
2. Do not reset bits outside of PER_MASK when setting
personality value.
3. Set personality for static executables.

Bug: http://b/21900686
Change-Id: I4c7e34079cbd59b818ce221eed325c05b9bb2303
66c3b2db2f036ee55e06c1a861d0da82c5f10b3d 09-Jun-2015 Elliott Hughes <enh@google.com> Statically linked executables should honor AT_SECURE.

Bug: http://b/19647373
Change-Id: I10e7682d9cec26a523f1a3597ca5326c3ca42ebe
(cherry picked from commit 1801db3d3fe17df543e721b9fb355e5c882dc6cc)
1801db3d3fe17df543e721b9fb355e5c882dc6cc 09-Jun-2015 Elliott Hughes <enh@google.com> Statically linked executables should honor AT_SECURE.

Bug: http://b/19647373
Change-Id: I10e7682d9cec26a523f1a3597ca5326c3ca42ebe
673b15e4ee2c6d99b150aedddc0f389e29f98e1b 19-Mar-2015 Yabin Cui <yabinc@google.com> Let g_thread_list_lock only protect g_thread_list.

As glibc/netbsd don't protect access to thread struct members by a global
lock, we don't want to do it either. This change reduces the
responsibility of g_thread_list_lock to only protect g_thread_list.

Bug: 19636317
Change-Id: I897890710653dac165d8fa4452c7ecf74abdbf2b
9d0c79304d2413028aa5c213f7a567f00feccde5 06-Mar-2015 Yabin Cui <yabinc@google.com> Remove PTHREAD_ATTR_FLAG_MAIN_THREAD.

Make this change because I think it is more reasonable to check stack info
in pthread_getattr_np. I believe pthread_attr_t is not tied with any thread,
and can't have a flag saying who using it is the main thread.
This change also helps refactor of g_thread_list_lock.

Bug: 19636317
Change-Id: Iedbb85a391ac3e1849dd036d01445dac4bc63db9
8b5df3920f2843c9cdf04160517c1e8b77c992f5 22-Jan-2015 Elliott Hughes <enh@google.com> Turn on -Wold-style-cast and fix the errors.

A couple of dodgy cases where we cast away const, but otherwise pretty boring.

Change-Id: Ibc39ebd525377792b5911464be842121c20f03b9
ba8dfc2669d658dc340eb8f9c9b40ca074f05047 06-Jan-2015 Yabin Cui <yabinc@google.com> Remove PTHREAD_ATTR_FLAG_USER_ALLOCATED_STACK.

Patch for https://android-review.googlesource.com/#/c/120844/.

Change-Id: Idca5ccd7b28e8f07f1d2d1b6e3bba6781b62f0e0
8cf1b305670123aed7638d984ca39bfd22388440 04-Dec-2014 Yabin Cui <yabinc@google.com> Use mmap to create the pthread_internal_t

Add name to mmaped regions.
Add pthread benchmark code.
Allocate pthread_internal_t on regular stack.

Bug: 16847284
Change-Id: Id60835163bb0d68092241f1a118015b5a8f85069
642182341018b282148280a7bdb771493e15bd7d 26-Aug-2014 Elliott Hughes <enh@google.com> Fix pthread_getattr_np for the main thread.

On most architectures the kernel subtracts a random offset to the stack
pointer in create_elf_tables by calling arch_align_stack before writing
the auxval table and so on. On all but x86 this doesn't cause a problem
because the random offset is less than a page, but on x86 it's up to two
pages. This means that our old technique of rounding the stack pointer
doesn't work. (Our old implementation of that technique was wrong too.)

It's also incorrect to assume that the main thread's stack base and size
are constant. Likewise to assume that the main thread has a guard page.
The main thread is not like other threads.

This patch switches to reading /proc/self/maps (and checking RLIMIT_STACK)
whenever we're asked.

Bug: 17111575
Signed-off-by: Fengwei Yin <fengwei.yin@intel.com>

(cherry picked from commit 57b7a6110e7e8b446fc23cce4765ff625ee0a105)

Change-Id: I87e679ee1c0db8092f2d1221c8e7c1461545c5a4
57b7a6110e7e8b446fc23cce4765ff625ee0a105 26-Aug-2014 Elliott Hughes <enh@google.com> Fix pthread_getattr_np for the main thread.

On most architectures the kernel subtracts a random offset to the stack
pointer in create_elf_tables by calling arch_align_stack before writing
the auxval table and so on. On all but x86 this doesn't cause a problem
because the random offset is less than a page, but on x86 it's up to two
pages. This means that our old technique of rounding the stack pointer
doesn't work. (Our old implementation of that technique was wrong too.)

It's also incorrect to assume that the main thread's stack base and size
are constant. Likewise to assume that the main thread has a guard page.
The main thread is not like other threads.

This patch switches to reading /proc/self/maps (and checking RLIMIT_STACK)
whenever we're asked.

Bug: 17111575
Signed-off-by: Fengwei Yin <fengwei.yin@intel.com>
Change-Id: I1d4dbffe7bc7bda1d353c3a295dbf68d29f63158
b3aaf398e1d6af5362e0f30f11ab7c11890644c2 13-Aug-2014 Dan Albert <danalbert@google.com> Hide __libc_init_vdso().

Bug: 11156955
Change-Id: I7ee31e1ee2ce479c5746b374a239637d582815fe
3002131da33401cf1b45abbdbec58b7c751fc43a 16-Jul-2014 Elliott Hughes <enh@google.com> Use VDSO for clock_gettime(2) and gettimeofday(2).

Bug: 15387103

(cherry picked from commit 625993dfbb085a3cde7492eda8ec1cdc1ee39a78)

Change-Id: I0e156d7049ba1495902259071a96936592e74025
625993dfbb085a3cde7492eda8ec1cdc1ee39a78 16-Jul-2014 Elliott Hughes <enh@google.com> Use VDSO for clock_gettime(2) and gettimeofday(2).

Bug: 15387103
Change-Id: Ifc3608ea65060c1dc38120b10b6e79874f182a36
38778e3b6c89689bbdd01f4a52ac88f02bf59783 11-Jul-2014 Dmitriy Ivanov <dimitry@google.com> Upstream atexit

Change-Id: Ia454a2181b5058ed9783dc02b6b1805d0e4d2715
(cherry picked from commit 53c3c271dc9927dd280981fc23409af60f460007)
53c3c271dc9927dd280981fc23409af60f460007 11-Jul-2014 Dmitriy Ivanov <dimitry@google.com> Upstream atexit

Change-Id: Ia454a2181b5058ed9783dc02b6b1805d0e4d2715
7086ad6919feb2415c6027163f5c63323bcca27c 20-Jun-2014 Elliott Hughes <enh@google.com> Cache getpid.

In practice, with this implementation we never need to make a system call.
We get the main thread's tid (which is the same as our pid) back from
the set_tid_address system call we have to make during initialization.
A new pthread will have the same pid as its parent, and a fork child's
main (and only) thread will have a pid equal to its tid, which we get for
free from the kernel before clone returns.

The only time we'd actually have to make a getpid system call now is if
we take a signal during fork and the signal handler calls getpid. (That,
or we call getpid in the dynamic linker while it's still dealing with its
own relocations and hasn't even set up the main thread yet.)

Bug: 15387103
Change-Id: I6d4718ed0a5c912fc75b5f738c49a023dbed5189
1728b2396591853345507a063ed6075dfd251706 14-May-2014 Elliott Hughes <enh@google.com> Switch to g_ for globals.

That's what the Google style guide recommends, and we're starting
to get a mix.

Change-Id: Ib0c53a890bb5deed5c679e887541a715faea91fc
cef3faec0ea40fdfe58e425fd0be64f00de6a26d 20-Nov-2013 Elliott Hughes <enh@google.com> Clean up pthread_internal_t.

Bug: 11755300
Change-Id: Ib509e8c5ec6b23513aa78b5ac5141d7c34ce2dc8
877ec6d90418ff1d6597147d355a2229fdffae7e 16-Nov-2013 Elliott Hughes <enh@google.com> Fix pthread_join.

Let the kernel keep pthread_internal_t::tid updated, including
across forks and for the main thread. This then lets us fix
pthread_join to only return after the thread has really exited.

Also fix the thread attributes of the main thread so we don't
unmap the main thread's stack (which is really owned by the
dynamic linker and contains things like environment variables),
which fixes crashes when joining with an exited main thread
and also fixes problems reported publicly with accessing environment
variables after the main thread exits (for which I've added a new
unit test).

In passing I also fixed a bug where if the clone(2) inside
pthread_create(3) fails, we'd unmap the child's stack and TLS (which
contains the mutex) and then try to unlock the mutex. Boom! It wasn't
until after I'd uploaded the fix for this that I came across a new
public bug reporting this exact failure.

Bug: 8206355
Bug: 11693195
Bug: https://code.google.com/p/android/issues/detail?id=57421
Bug: https://code.google.com/p/android/issues/detail?id=62392
Change-Id: I2af9cf6e8ae510a67256ad93cad891794ed0580b
70b24b1cc2a1a4436b1fea3f8b76616fdcb27224 15-Nov-2013 Elliott Hughes <enh@google.com> Switch pthread_create over to __bionic_clone.

Bug: 8206355
Bug: 11693195
Change-Id: I04aadbc36c87e1b7e33324b9a930a1e441fbfed6
7f70c9b64eec4a4a86a3948966187ff8ee9fa720 13-Oct-2013 Serban Constantinescu <serban.constantinescu@arm.com> AArch64: Fix uses of stack size for 32/64bit libc builds

This patch fixes stack size uses to size_t.

Change-Id: I0671c85ddb1c1aceaf9440a7c73c21fe528653fa
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
eb847bc8666842a3cfc9c06e8458ad1abebebaf0 10-Oct-2013 Elliott Hughes <enh@google.com> Fix x86_64 build, clean up intermediate libraries.

The x86_64 build was failing because clone.S had a call to __thread_entry which
was being added to a different intermediate .a on the way to making libc.so,
and the linker couldn't guarantee statically that such a relocation would be
possible.

ld: error: out/target/product/generic_x86_64/obj/STATIC_LIBRARIES/libc_common_intermediates/libc_common.a(clone.o): requires dynamic R_X86_64_PC32 reloc against '__thread_entry' which may overflow at runtime; recompile with -fPIC

This patch addresses that by ensuring that the caller and callee end up in the
same intermediate .a. While I'm here, I've tried to clean up some of the mess
that led to this situation too. In particular, this removes libc/private/ from
the default include path (except for the DNS code), and splits out the DNS
code into its own library (since it's a weird special case of upstream NetBSD
code that's diverged so heavily it's unlikely ever to get back in sync).

There's more cleanup of the DNS situation possible, but this is definitely a
step in the right direction, and it's more than enough to get x86_64 building
cleanly.

Change-Id: I00425a7245b7a2573df16cc38798187d0729e7c4
9ae59c02ca68da5bb45152c85c4cab6fd6f7aba2 18-Sep-2013 Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org> Declare __page_shift and __page_size with C linkage.

__page_shift and __page_size were accidentally declared in unistd.h with
C linkage - their implementation needs to use the same linkage.

Going forward, though, let's stop the inlining madness and let's kill
the non-standard __getpageshift(). This patch takes getpagesize(3) out
of line and removes __getpageshift but fixes __page_shift and __page_size
for backwards binary compatibility.

Change-Id: I35ed66a08989ced1db422eb03e4d154a5d6b5bda
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
50af69e8f326b2762a44d5fea2b118e7616e5d20 14-Sep-2013 Brian Carlstrom <bdc@google.com> Simplify main thread stack size initialization

Change-Id: Iec09433d9de501031cce09dc75848a5e8f3d96bf
322e7bce235ec6e3f82f65669423a1d9e997b51e 13-Sep-2013 Brian Carlstrom <bdc@google.com> Use kernel default for initial thread size

Bug: 10697851

Change-Id: I8d980f5e0b584799536f6e6b891056c968d26cdf
7751d9158f2dede814be920f80f5ff0b60856d1a 13-Sep-2013 Brian Carlstrom <bdc@google.com> Use kernel default for initial thread size

Bug: 10697851

Change-Id: I8d980f5e0b584799536f6e6b891056c968d26cdf
9a74e36f4810ca22cb12f8eafe4f929edfa57e58 13-Sep-2013 Brian Carlstrom <bdc@google.com> Use kernel default for initial thread size

Bug: 10697851

Change-Id: I8d980f5e0b584799536f6e6b891056c968d26cdf
7b4d77e400d321ccc7cdadd1cd225ebb1a69d358 04-Apr-2013 Elliott Hughes <enh@google.com> Make abort messages available to debuggerd.

This adds __libc_fatal, cleans up the internal logging code a bit more,
and switches suitable callers over to __libc_fatal. In addition to logging,
__libc_fatal stashes the message somewhere that the debuggerd signal handler
can find it before calling abort.

In the debuggerd signal handler, we pass this address to debuggerd so that
it can come back with ptrace to read the message and present it to the user.

Bug: 8531731

(cherry picked from commit 0d787c1fa18c6a1f29ef9840e28a68cf077be1de)

Change-Id: I5daeeaa36c1fc23f7f437d73a19808d9d558dd4d
0d787c1fa18c6a1f29ef9840e28a68cf077be1de 04-Apr-2013 Elliott Hughes <enh@google.com> Make abort messages available to debuggerd.

This adds __libc_fatal, cleans up the internal logging code a bit more,
and switches suitable callers over to __libc_fatal. In addition to logging,
__libc_fatal stashes the message somewhere that the debuggerd signal handler
can find it before calling abort.

In the debuggerd signal handler, we pass this address to debuggerd so that
it can come back with ptrace to read the message and present it to the user.

Bug: 8531731
Change-Id: I416ec1da38a8a1b0d0a582ccd7c8aaa681ed4a29
642331b5dd5647e7d196ac4f44406fd435478a56 07-Mar-2013 Elliott Hughes <enh@google.com> Fix debug malloc.

This was broken by the change to use AT_RANDOM for the stack guards.

Bug: 7959813
Bug: 8330764
Change-Id: I791900092b72a9a900f16585237fa7ad82aaed9f
40eabe24e4e3ae8ebe437f1f4e43cf39cbba2e9e 15-Feb-2013 Elliott Hughes <enh@google.com> Fix the pthread_setname_np test.

Fix the pthread_setname_np test to take into account that emulator kernels are
so old that they don't support setting the name of other threads.

The CLONE_DETACHED thread is obsolete since 2.5 kernels.

Rename kernel_id to tid.

Fix the signature of __pthread_clone.

Clean up the clone and pthread_setname_np implementations slightly.

Change-Id: I16c2ff8845b67530544bbda9aa6618058603066d
6d339182070b035ca94f19bc37c94f4d9813c374 13-Feb-2013 Elliott Hughes <enh@google.com> Simplify pthread_create, using more public API.

Change-Id: I08e65ba88ed01436223e4e528631c9e41ec0e7f4
d3920b3a996b358e48232f417aa0a1e44a60f155 08-Feb-2013 Elliott Hughes <enh@google.com> Switch to using AT_RANDOM for the stack guards.

Bug: 7959813
Change-Id: I8db4b8912ba649bfe668c6f22aa44690ddd401a2
e4ccf5a138a9c6387ee2e4b8e41d628e0a2cc336 07-Feb-2013 Elliott Hughes <enh@google.com> __progname should be const char*, not char*.

Change-Id: I8e846872c30a712fbc05c8da59ffa1cec1be31a4
42b2c6a5eed5e4ef35315b8cd32d1355f12a69b6 07-Feb-2013 Elliott Hughes <enh@google.com> Clean up the argc/argv/envp/auxv handling.

There's now only one place where we deal with this stuff, it only needs to
be parsed once by the dynamic linker (rather than by each recipient), and it's
now easier for us to get hold of auxv data early on.

Change-Id: I6314224257c736547aac2e2a650e66f2ea53bef5