Commit graph

152 commits

Author SHA1 Message Date
Elliott Hughes
9edf071a5d am d2dbf163: am 5995bf88: Merge "don\'t hardcode register r0/v1 when reading the TLS"
* commit 'd2dbf16358bee4777a3e4937cf316fa8bb905559':
  don't hardcode register r0/v1 when reading the TLS
2013-06-17 14:56:04 -07:00
Elliott Hughes
d2dbf16358 am 5995bf88: Merge "don\'t hardcode register r0/v1 when reading the TLS"
* commit '5995bf880e2a7fac249382f0a929b7271c843122':
  don't hardcode register r0/v1 when reading the TLS
2013-06-17 14:53:12 -07:00
Mathias Agopian
b6e340080a don't hardcode register r0/v1 when reading the TLS
this leads to much improved code when calling __get_tls()

Change-Id: I21d870fb33c33a921ca55c4e100772e0f7a8d1e4
2013-06-17 14:50:30 -07:00
Elliott Hughes
7ac852fb05 am 3da47942: am 944ea1a3: Merge "Clean up abort."
* commit '3da47942d3fdeb6f39cf84b03c75cfeb69f91449':
  Clean up abort.
2013-06-12 15:02:34 -07:00
Elliott Hughes
3da47942d3 am 944ea1a3: Merge "Clean up abort."
* commit '944ea1a32018c44d6cb55c9454e670b0e152da6d':
  Clean up abort.
2013-06-12 14:58:32 -07:00
Elliott Hughes
61e699a133 Clean up abort.
* A dlmalloc usage error shouldn't call abort(3) because we want to
  cause a SIGSEGV by writing the address dlmalloc didn't like to an
  address the kernel won't like, so that debuggerd will dump the
  memory around the address that upset dlmalloc.

* Switch to the simpler FreeBSD/NetBSD style of registering stdio
  cleanup. Hopefully this will let us simplify more of the stdio
  implementation.

* Clear the stdio cleanup handler before we abort because of a dlmalloc
  corruption error. This fixes the reported bug, where we'd hang inside
  dlmalloc because the stdio cleanup reentered dlmalloc.

Bug: 9301265
Change-Id: Ief31b389455d6876e5a68f0f5429567d37277dbc
2013-06-12 14:14:53 -07:00
Chad Brubaker
87594a32b8 Add clearing of resolv uid and pid interface maps
Cleanup uid interface map variable names

Change-Id: I712dd83276bb23b149af4180515ef33a1bade5ea
2013-06-07 13:03:23 -07:00
Geremy Condra
a24d14c05d Merge "Add per UID interface support to resolv cache" 2013-06-06 20:48:44 +00:00
Chad Brubaker
0c9bb49a9d Add per UID interface support to resolv cache
Add methods to attach/detach UID ranges to a specific dns cache/interface.

This mirrors the already existing code for attaching specific processes to
specific interfaces but will be used to push all processes from a given
user to a specific cache/interface.

Change-Id: Ic24391e92d3ca46fcb46cc4fc53e13984dec40b3
2013-06-06 12:31:16 -07:00
Elliott Hughes
e51cd6f9c9 am 5a6a0a94: am 18af4503: Merge "Ensure header files using __BEGIN_DECLS include sys/cdefs.h."
* commit '5a6a0a9445d80bf2bd847088921f6d1d99315552':
  Ensure header files using __BEGIN_DECLS include sys/cdefs.h.
2013-06-05 18:11:05 -07:00
Elliott Hughes
5a6a0a9445 am 18af4503: Merge "Ensure header files using __BEGIN_DECLS include sys/cdefs.h."
* commit '18af450393b005b4ead896d82cda750e6876fd33':
  Ensure header files using __BEGIN_DECLS include sys/cdefs.h.
2013-06-05 18:06:04 -07:00
Elliott Hughes
36fa67bcdd Ensure header files using __BEGIN_DECLS include sys/cdefs.h.
We keep fixing these one-by-one; let's fix them all at once.

Found thus:

  find . -name *.h | xargs grep -L sys/cdefs.h | xargs grep -l BEGIN_DECL | xargs grep -L sys/types

Change-Id: I188842aa2484dc6176e96556d57c38a0f785b59b
2013-06-05 17:58:08 -07:00
Elliott Hughes
bedd8e3de1 am ce208f33: am 8d36050a: Merge "Clean up useless declaration in thread_private.h"
* commit 'ce208f3389769026df02f7aebd85c8f5d3e74c73':
  Clean up useless declaration in thread_private.h
2013-06-05 17:06:50 -07:00
Elliott Hughes
ce208f3389 am 8d36050a: Merge "Clean up useless declaration in thread_private.h"
* commit '8d36050ac2bb1c4a6a04462e64c5440e3c23c9f0':
  Clean up useless declaration in thread_private.h
2013-06-05 17:02:29 -07:00
Kito Cheng
94d0daa2dd Clean up useless declaration in thread_private.h
Change-Id: Ie7bcdc7195a3fcbcd09a95f73b0c49e8897ad50b
2013-06-05 11:26:24 +08:00
Nick Kralevich
75c9e17682 am 027a8fae: am 8539961f: Merge "FORTIFY_SOURCE: strcat / strncat optimize"
* commit '027a8fae7750855af2ec0f8dd655e4a48ebf9352':
  FORTIFY_SOURCE: strcat / strncat optimize
2013-05-31 11:21:18 -07:00
Nick Kralevich
027a8fae77 am 8539961f: Merge "FORTIFY_SOURCE: strcat / strncat optimize"
* commit '8539961ff299b05d8feac9be8b119698be22da03':
  FORTIFY_SOURCE: strcat / strncat optimize
2013-05-31 11:14:56 -07:00
Nick Kralevich
cf870199d5 FORTIFY_SOURCE: strcat / strncat optimize
__strcat_chk and __strncat_chk are slightly inefficient,
because they end up traversing over the same memory region
two times.

This change optimizes __strcat_chk / __strncat_chk so they
only access the memory once. Although I haven't benchmarked these
changes, it should improve the performance of these functions.

__strlen_chk - expose this function, even if -D_FORTIFY_SOURCE
isn't defined. This is needed to compile libc itself without
-D_FORTIFY_SOURCE.

Change-Id: Id2c70dff55a276b47c59db27a03734d659f84b74
2013-05-31 09:07:46 -07:00
Elliott Hughes
543f3f0ec4 am 975d4464: am 6f502bc7: Merge "Add more __restricts, clean up __format__ attributes."
* commit '975d4464cef774768cf99a68f3537cfc0678e3f7':
  Add more __restricts, clean up __format__ attributes.
2013-05-14 16:59:34 -07:00
Elliott Hughes
975d4464ce am 6f502bc7: Merge "Add more __restricts, clean up __format__ attributes."
* commit '6f502bc74374804766639e6b1515644875810bda':
  Add more __restricts, clean up __format__ attributes.
2013-05-14 16:56:49 -07:00
Elliott Hughes
d04c183979 Add more __restricts, clean up __format__ attributes.
Change-Id: I7e2d270cc722d339d221eaea92747eaff3b51403
2013-05-14 16:08:43 -07:00
Elliott Hughes
f89ce5b518 am 9c7b510a: am 240fb862: Merge "Make abort messages available to debuggerd."
* commit '9c7b510a408740b5b53f8d14b8f43bf2f2d36ae6':
  Make abort messages available to debuggerd.
2013-04-05 11:47:00 -07:00
Elliott Hughes
9c7b510a40 am 240fb862: Merge "Make abort messages available to debuggerd."
* commit '240fb8623b1fe027d0d33a9d4c41d99ceb385b58':
  Make abort messages available to debuggerd.
2013-04-05 11:43:37 -07:00
Elliott Hughes
0d787c1fa1 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
2013-04-05 11:24:19 -07:00
Nick Kralevich
62bb090f8e resolved conflicts for merge of 5b661481 to master
Change-Id: Ifc68a87a95187b61f7f42a0217af43e14db6d4f8
2013-03-29 17:36:52 -07:00
Nick Kralevich
c01274c4aa resolv_cache: hide some libc private functions
Don't export unnecessary symbols to third party apps.

Bug: 8401049
Change-Id: Ide5abd6ed13e756a85bd1277d93da74d1419addb
2013-03-29 13:56:05 -07:00
Elliott Hughes
6380d21a05 am 92a197f3: am d7dc414a: am 987fc5a3: am adeec096: Merge "Hide various symbols that shouldn\'t be exposed."
* commit '92a197f3051c5befd5e40ec7f23c0643999da259':
  Hide various symbols that shouldn't be exposed.
2013-03-16 00:11:52 +00:00
Elliott Hughes
d7dc414afd am 987fc5a3: am adeec096: Merge "Hide various symbols that shouldn\'t be exposed."
* commit '987fc5a3c4046831dc9e6c252e99a9c694bbd9ee':
  Hide various symbols that shouldn't be exposed.
2013-03-15 17:09:17 -07:00
Elliott Hughes
90f7546c68 am cf23cbb1: am 12ea8005: am 5f829205: am c1416647: Merge "Clean up internal libc logging."
* commit 'cf23cbb1d4826ac579fae28e4fe796a6e4e1ddfd':
  Clean up internal libc logging.
2013-03-15 23:43:01 +00:00
Elliott Hughes
12ea800566 am 5f829205: am c1416647: Merge "Clean up internal libc logging."
* commit '5f8292050fc07f4bf9e70f37a807ad028e3cfc87':
  Clean up internal libc logging.
2013-03-15 16:36:37 -07:00
Elliott Hughes
ce532721aa Hide various symbols that shouldn't be exposed.
A mangled symbol in libc.so is a symbol that shouldn't be exported
by libc.so.

Change-Id: Id92d1e1968b3d11d111a5d9ef692adb1ac7694a1
2013-03-15 16:31:09 -07:00
Elliott Hughes
8f2a5a0b40 Clean up internal libc logging.
We only need one logging API, and I prefer the one that does no
allocation and is thus safe to use in any context.

Also use O_CLOEXEC when opening the /dev/log files.

Move everything logging-related into one header file.

Change-Id: Ic1e3ea8e9b910dc29df351bff6c0aa4db26fbb58
2013-03-15 16:12:58 -07:00
Sasha Levitskiy
fbae9f3c30 Bionic: Libc: Resolv: Stricter function signatures, unitialized return bug fix.
Stricter input parameters help avoid ugly casting when passing
	pointers to immutable protobuf data.
	While at it: an int return was dropped from 2 functions whose users
	never used the result; one of the return paths was returning an
	uninitialized value.
	Size_t for portablity and warning supression, misc warnings addressed.

Change-Id: I2d5cbdaf0c9b6c4621a7d397772da13da5dc0943
2013-02-28 18:46:54 +00:00
Elliott Hughes
aa13eaa934 am d9cb6988: am 406968b2: am c0e9ddd0: Merge "Reimplement scandir(3)."
* commit 'd9cb69881a062c615a8009be0a70270c70eb35da':
  Reimplement scandir(3).
2013-02-25 22:58:44 +00:00
Elliott Hughes
701bec2af3 Reimplement scandir(3).
The old scandir implementation didn't take into account the varying
size of directory entries, and didn't correctly clean up on its
error exits.

Bug: 7339844
Change-Id: Ib40e3564709752241a3119a496cbb2192e3f9abe
2013-02-25 13:14:31 -08:00
Elliott Hughes
6af19237b7 am 39804dcd: Merge "Fix the pthread_setname_np test."
* commit '39804dcde6c1c596285432b28cdb09382ce59663':
  Fix the pthread_setname_np test.
2013-02-15 14:48:05 -08:00
Elliott Hughes
40eabe24e4 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
2013-02-15 12:08:59 -08:00
Elliott Hughes
56a007c157 am 0a2cb815: Merge "Simplify __stack_chk_fail, and fix it so we get debuggerd stack traces."
# Via Elliott Hughes (1) and Gerrit Code Review (1)
* commit '0a2cb815974ea96af664fa966079966a08916722':
  Simplify __stack_chk_fail, and fix it so we get debuggerd stack traces.
2013-02-14 15:59:15 -08:00
Elliott Hughes
fb7eb5e07f Simplify __stack_chk_fail, and fix it so we get debuggerd stack traces.
Bug: 2487269
Change-Id: Iec5e470fc22cd9108404f634a9d4baa2c7b7f58f
2013-02-14 14:37:34 -08:00
Elliott Hughes
2db16ea38e am 3002d64b: Merge "Everyone has a TLS register."
# Via Elliott Hughes (1) and Gerrit Code Review (1)
* commit '3002d64bcd4644456803dd0547d20b39e14be02c':
  Everyone has a TLS register.
2013-02-13 08:11:24 -08:00
Elliott Hughes
91a9925998 Everyone has a TLS register.
Change-Id: Id7cdf67087aa7d5074c9c59b7e595bc391d9f146
2013-02-12 21:56:42 -08:00
Elliott Hughes
78715fca0b am 558a8b1d: Merge "Revert "Revert "More pthreads cleanup."""
# Via Elliott Hughes (1) and Gerrit Code Review (1)
* commit '558a8b1d3b31300941af78232f2f7f4cb4e933b9':
  Revert "Revert "More pthreads cleanup.""
2013-02-12 16:23:24 -08:00
Elliott Hughes
3e898476c7 Revert "Revert "More pthreads cleanup.""
This reverts commit 6f94de3ca4

(Doesn't try to increase the number of TLS slots; that leads to
an inability to boot. Adds more tests.)

Change-Id: Ia7d25ba3995219ed6e686463dbba80c95cc831ca
2013-02-12 15:27:18 -08:00
Elliott Hughes
191f880bdf am bfa199ab: am fcaf4e9f: Merge "Revert "More pthreads cleanup.""
# Via Gerrit Code Review (2) and Android Git Automerger (1)
* commit 'bfa199ab4019a7de9b95cd3db86c4d7176438803':
  Revert "More pthreads cleanup."
2013-02-11 22:20:39 -08:00
Elliott Hughes
6f94de3ca4 Revert "More pthreads cleanup."
This reverts commit 2a1bb4e646

Change-Id: Ia443d0748015c8e9fc3121e40e68258616767b51
2013-02-12 06:06:22 +00:00
Elliott Hughes
23731e841a am a2a9817f: am 85f491f9: Merge "More pthreads cleanup."
# Via Android Git Automerger (1) and others
* commit 'a2a9817f4c08d1f56d90f02ed13f531e8093f8e8':
  More pthreads cleanup.
2013-02-11 18:39:32 -08:00
Elliott Hughes
5bb4f54b4d am 6b73d13f: am 2d3e7233: Merge "Revert "Revert "Pull the pthread_key_t functions out of pthread.c."""
# Via Android Git Automerger (1) and others
* commit '6b73d13fa414afeecba6718bf724e8ac922bac39':
  Revert "Revert "Pull the pthread_key_t functions out of pthread.c.""
2013-02-11 17:34:32 -08:00
Elliott Hughes
1b21249d5a am e4b08318: am 8397cdba: Merge "Revert "Pull the pthread_key_t functions out of pthread.c.""
# Via Gerrit Code Review (2) and Android Git Automerger (1)
* commit 'e4b08318c13fac774b233a5459427563d2983f79':
  Revert "Pull the pthread_key_t functions out of pthread.c."
2013-02-11 17:34:30 -08:00
Elliott Hughes
376bce0097 am 024246ec: am 09e89c3c: Merge "Pull the pthread_key_t functions out of pthread.c."
# Via Android Git Automerger (1) and others
* commit '024246ec274e30bb4a24468d8319620534e13b34':
  Pull the pthread_key_t functions out of pthread.c.
2013-02-11 17:34:29 -08:00
Elliott Hughes
2a1bb4e646 More pthreads cleanup.
POSIX says pthread_create returns EAGAIN, not ENOMEM.

Also pull pthread_attr_t functions into their own file.

Also pull pthread_setname_np into its own file.

Also remove unnecessary #includes from pthread_key.cpp.

Also account for those pthread keys used internally by bionic,
so they don't count against the number of keys available to user
code. (They do with glibc, but glibc's limit is the much more
generous 1024.)

Also factor out the common errno-restoring idiom to reduce gotos.

Bug: 6702535
Change-Id: I555e66efffcf2c1b5a2873569e91489156efca42
2013-02-11 14:56:39 -08:00