Commit Graph

2450 Commits

Author SHA1 Message Date
Elliott Hughes
2fc3e1efda am b2c5bd54: Merge "ARM: warn about atexit() calls from legacy shared libraries"
* commit 'b2c5bd543dcbbc1b2cbf7afd8b124256ce2c128e':
  ARM: warn about atexit() calls from legacy shared libraries
2012-09-05 10:29:23 -07:00
Elliott Hughes
b2c5bd543d Merge "ARM: warn about atexit() calls from legacy shared libraries" 2012-09-05 10:18:43 -07:00
Elliott Hughes
a76f2ecaa2 am 26f2e4a1: Merge "ARM: make CRT_LEGACY_WORKAROUND work as intended"
* commit '26f2e4a1639a959513c4ff5981b4eb52757e8012':
  ARM: make CRT_LEGACY_WORKAROUND work as intended
2012-09-05 09:57:15 -07:00
Elliott Hughes
26f2e4a163 Merge "ARM: make CRT_LEGACY_WORKAROUND work as intended" 2012-09-05 09:43:35 -07:00
Ian Rogers
7310a1c432 am 82978cae: Merge "Avoid malloc lock while calling pthread_atfork."
* commit '82978cae4eec238a9d631d2b61b8985daa02516e':
  Avoid malloc lock while calling pthread_atfork.
2012-09-05 07:48:14 -07:00
Ian Rogers
82978cae4e Merge "Avoid malloc lock while calling pthread_atfork." 2012-09-05 07:41:32 -07:00
Elliott Hughes
b9f0a6eb75 am be19a367: Merge "termios: add tcdrain"
* commit 'be19a3671709879ccc0156b94f7ef7540027dc37':
  termios: add tcdrain
2012-09-04 18:10:07 -07:00
Elliott Hughes
be19a36717 Merge "termios: add tcdrain" 2012-09-04 17:52:40 -07:00
Elliott Hughes
bc3740787a am 5ff23471: Merge "Add getsid system call to bionic"
* commit '5ff23471303a1b99ddc1e1751662aa45f34b5e21':
  Add getsid system call to bionic
2012-09-04 16:44:54 -07:00
Elliott Hughes
5ff2347130 Merge "Add getsid system call to bionic" 2012-09-04 16:36:27 -07:00
Elliott Hughes
507bcabb35 am e03ab936: Merge "Add missing MALLOC_FAILURE_ACTION calls to dlmalloc."
* commit 'e03ab936996a1a46d461cdad463d7f5bca10b051':
  Add missing MALLOC_FAILURE_ACTION calls to dlmalloc.
2012-09-04 15:56:12 -07:00
Elliott Hughes
e03ab93699 Merge "Add missing MALLOC_FAILURE_ACTION calls to dlmalloc." 2012-09-04 15:51:55 -07:00
Elliott Hughes
63deae5e4f Add missing MALLOC_FAILURE_ACTION calls to dlmalloc.
Without these, sometimes malloc(3) returns NULL without setting errno.

Change-Id: I4708c3f675bf2c878ddcaf012fde7848b255826b
2012-09-04 15:42:23 -07:00
Elliott Hughes
b438c54d02 am 1db615b4: Merge "bionic: Fix TINY_ANDROID build"
* commit '1db615b4ae469c9f33dc1d88b24924ca8efc10ef':
  bionic: Fix TINY_ANDROID build
2012-09-04 13:46:46 -07:00
Elliott Hughes
1db615b4ae Merge "bionic: Fix TINY_ANDROID build" 2012-09-04 13:42:57 -07:00
Benoit Goby
5ac9eee1d3 bionic: Fix TINY_ANDROID build
(cherry-pick of 545d5dbbcb0dc9e44323c4f2e687a3aace75a483.)

Change-Id: Ifc91e84ffed5a3a287accabd7f08b02752688db6
2012-09-04 13:36:54 -07:00
Vitaly Wool
954923858b termios: add tcdrain
Change-Id: I05c0007f7bcc6ef5295c32f86fafbf1ad31e07fa
2012-09-04 14:11:28 +02:00
Irina Tirdea
1ad10a566e Add getsid system call to bionic
Add getsid() system call to bionic for
all architectures. This is needed for various tools
(e.g. perf).

Adding the getsid system call was done in 3 steps:
() add getsid system call (function name and syscall
number) to libc/SYSCALLS.TXT
() generate all necessary headers by calling
libc/tools/gensyscalls.py. This patch is adding
the generated files since the build system
does not call gensyscalls.py.
() add the system call signature to libc/include/unistd.h

Change-Id: Id69a257e13ec02e1a44085a6b217a3f19ab025b1
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
2012-09-03 01:38:34 +03:00
Kirill Artamonov
3e2d2936b0 Avoid malloc lock while calling pthread_atfork.
Expecting the memory in a forked child process to be sane wrt threading
is a bad idea. An example of a problem is when the parent process has
the malloc lock and a child process is forked. The malloc lock in the
child will appear locked by a thread that doesn't exist.

This change aims to make bionic more compatible with glibc by reseting
the malloc lock in the child forked process, as well as holding it
during the fork. This is a feature in dlmalloc 2.8.6 called
LOCK_AT_FORK. In general this feature isn't necessary as a forked
process will then exec. Some bad applications rely on being able to use
features like malloc before the exec and having multiple threads running
in the parent program. This isn't a problem with glibc and this patch
makes it not a problem for bionic.

Unfortunately for use in bionic, LOCK_AT_FORK has an issue as internally
it uses pthread_atfork that in bionic uses malloc. This leads to the
LOCK_AT_FORK initialization deadlocking with pthread_atfork's call to
malloc due to the malloc lock. This change moves the pthread_atfork logic
in LOCK_AT_FORK to be called without the malloc lock held.

Change-Id: Id68175a564a6abb936ee4488b44d9479f7311f69
2012-08-31 11:11:40 -07:00
Ian Rogers
6abab301db am 6fe901ef: Merge "Upgrade to dlmalloc 2.8.6."
* commit '6fe901ef38898d9cb6007720940e915f7180fc11':
  Upgrade to dlmalloc 2.8.6.
2012-08-31 08:55:41 -07:00
Ian Rogers
6fe901ef38 Merge "Upgrade to dlmalloc 2.8.6." 2012-08-31 08:42:41 -07:00
Ian Rogers
c6d95add30 Upgrade to dlmalloc 2.8.6.
This fixes a bug and enables the use of MORECORE_CONTIGUOUS.

Change-Id: Ia7c5d32bdc46e99b3ecb92ee94d1f702c4385d5d
2012-08-29 18:18:29 -07:00
Elliott Hughes
dde94f4c16 am 8b4e8a93: Merge "Improve the dynamic linker diagnostics."
* commit '8b4e8a937be2e7ac94e52d596813095ef16c9ec8':
  Improve the dynamic linker diagnostics.
2012-08-29 14:04:25 -07:00
Nick Kralevich
92133ca427 am 17d9be8a: Merge "disable _FORTIFY_SOURCE under clang"
* commit '17d9be8ad73170275f25ffe8795a0d04b3e2cd8b':
  disable _FORTIFY_SOURCE under clang
2012-08-29 14:04:24 -07:00
Elliott Hughes
8b4e8a937b Merge "Improve the dynamic linker diagnostics." 2012-08-29 13:56:40 -07:00
Nick Kralevich
17d9be8ad7 Merge "disable _FORTIFY_SOURCE under clang" 2012-08-29 13:54:49 -07:00
Elliott Hughes
e5b85f45f9 am 0d7177c0: Merge "Clean up warnings in the malloc_debug_* files."
* commit '0d7177c0d47517514c81713427fc28e04dc3cd37':
  Clean up warnings in the malloc_debug_* files.
2012-08-29 13:15:10 -07:00
Elliott Hughes
e9b6fc6f82 Improve the dynamic linker diagnostics.
Lose the pid, only show the name of the function (not its whole signature),
and include the name of the library we failed to load. (I hadn't noticed
that the library name was missing before because in Java we add that into
the UnsatisfiedLinkError detail message.)

The new output looks like this:

  Cannot load library: soinfo_relocate(linker.cpp:968): cannot locate symbol "__libc_malloc_default_dispatch" referenced by "libc_malloc_debug_leak.so"...

Change-Id: I3bb5c9780d9aaf3a9e4418ea55bc98122a81f80f
2012-08-29 13:10:54 -07:00
Elliott Hughes
0d7177c0d4 Merge "Clean up warnings in the malloc_debug_* files." 2012-08-29 13:08:50 -07:00
Nick Kralevich
829c089f83 disable _FORTIFY_SOURCE under clang
Clang and _FORTIFY_SOURCE are just plain incompatible with
each other.  First of all, clang doesn't understand the
__attribute__((gnu_inline)) header. Second of all,
Clang doesn't have support for __builtin_va_arg_pack()
and __builtin_va_arg_pack_len() (see
http://clang.llvm.org/docs/UsersManual.html#c_unimpl_gcc)

Until we can resolve these issues, don't even try using
_FORTIFY_SOURCE under clang.

Change-Id: I81c2b8073bb3276fa9a4a6b93c427b641038356a
2012-08-29 12:47:41 -07:00
Elliott Hughes
c4d1fecc10 Clean up warnings in the malloc_debug_* files.
Also clean up cpplint.py-detected lint.

Change-Id: Ia18e89c4c6878764f8d7ed34b8247e7a8d8fe88b
2012-08-29 12:08:13 -07:00
Nick Kralevich
d3d09f7d75 am 069c64cd: Merge "ARM: make sure __on_dlclose() actually gets called"
* commit '069c64cdf2d3da7b7ff6ea5d1041f982fb10ab22':
  ARM: make sure __on_dlclose() actually gets called
2012-08-28 13:17:00 -07:00
Nick Kralevich
069c64cdf2 Merge "ARM: make sure __on_dlclose() actually gets called" 2012-08-28 13:04:22 -07:00
Nick Kralevich
1389db8b94 am e026b1d8: Merge "ARM: remove dummy entries from .so init_array/fini_array"
* commit 'e026b1d89a0dcada499da186d4d94cc3ce5d3ef3':
  ARM: remove dummy entries from .so init_array/fini_array
2012-08-28 13:01:22 -07:00
Nick Kralevich
7cab21885a am ad180738: Merge "linker: Fix ARM_R_COPY relocations"
* commit 'ad18073897378d3a13aaa6a7e7005f254ab8c1c8':
  linker: Fix ARM_R_COPY relocations
2012-08-28 13:01:21 -07:00
Nick Kralevich
e026b1d89a Merge "ARM: remove dummy entries from .so init_array/fini_array" 2012-08-28 12:49:46 -07:00
Nick Kralevich
ad18073897 Merge "linker: Fix ARM_R_COPY relocations" 2012-08-28 12:48:01 -07:00
Nick Kralevich
d39c3abd5a linker: Fix ARM_R_COPY relocations
Per http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044d/IHI0044D_aaelf.pdf
Section 4.7.1.10, ARM_R_COPY relocations are only suppose to reference shared
libraries, not the executable itself.  When resolving an R_ARM_COPY symbol,
ensure we don't look in our own symbol.

This partially addresses
http://code.google.com/p/android/issues/detail?id=28598 .  After this
patch, the printfs generated by the test program are:

global = 0x42 (0x401c7000)
global = 0x42 (0x11000)

before, the output was:

global = 0x42 (0x40071000)
global = 0x0 (0x11000)

I'm still not very happy with this patch, but I think it's an improvement
over where we were at before.

This change was modeled after https://android-review.googlesource.com/38871

Change-Id: Id7ad921e58395e76a36875bcc742ec5eeba53f08
2012-08-28 11:48:32 -07:00
Nick Kralevich
c7d9c40012 am c410a961: Merge "libc: remove ctors/dtors sections"
* commit 'c410a9613a837790d2ea13aee3f88881e0d54c17':
  libc: remove ctors/dtors sections
2012-08-28 10:34:14 -07:00
Nick Kralevich
c410a9613a Merge "libc: remove ctors/dtors sections" 2012-08-28 10:20:27 -07:00
Ard Biesheuvel
144c291866 ARM: warn about atexit() calls from legacy shared libraries
Legacy ARM shared libraries use this generic version of atexit(),
which queues exit functions for invocation at program exit, at
which time the library may have been dlclose()'d, causing the
program to crash.

Change-Id: I41ae153c23268daa65ede7fb8966fc3e9caec369
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@gmail.com>
2012-08-28 11:23:06 +02:00
Ard Biesheuvel
f3cfcd869d ARM: make CRT_LEGACY_WORKAROUND work as intended
To properly support legacy ARM shared libraries, libc.so needs
to export the symbols __dso_handle and atexit, even though
these are now supplied by the crt startup code.

This patch reshuffles the existing CRT_LEGACY_WORKAROUND
conditionally compiled code slightly so it works as the
original author likely intended.

Change-Id: Id6c0e94dc65b7928324a5f0bad7eba6eb2f464b9
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@gmail.com>
2012-08-28 10:27:02 +02:00
Ard Biesheuvel
c23092887f ARM: remove dummy entries from .so init_array/fini_array
The runtime linker parses the ELF section headers to
discover the size of the init_array and fini_array, so
there is no point in putting NULL terminators at the end.

Change-Id: I3246cd585efce9314155600277dd829e9f37d04f
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@gmail.com>
2012-08-28 09:55:51 +02:00
Nick Kralevich
775dabd4d7 am 9dfaa63a: Merge "Allow linker to compile with -DLINKER_DEBUG=1"
* commit '9dfaa63a1c0d1b8e75dd9d7077a8103a19821fa9':
  Allow linker to compile with -DLINKER_DEBUG=1
2012-08-27 16:06:34 -07:00
Nick Kralevich
9dfaa63a1c Merge "Allow linker to compile with -DLINKER_DEBUG=1" 2012-08-27 16:00:50 -07:00
Elliott Hughes
d2d8031df1 am bc366292: Merge "Added missing cache failed notification"
* commit 'bc366292ff47ad9a5053e213ec253992baeee648':
  Added missing cache failed notification
2012-08-27 15:18:52 -07:00
Elliott Hughes
bc366292ff Merge "Added missing cache failed notification" 2012-08-27 15:00:51 -07:00
Nick Kralevich
3697b52605 Allow linker to compile with -DLINKER_DEBUG=1
Change-Id: I27e734048cbcb9ed936369115582b3c734de1280
2012-08-24 17:11:45 -07:00
Ian Rogers
05fddb41d0 am a37ce7fa: Merge "Add missing va_end() to prevent stack corruptions"
* commit 'a37ce7faa6d6c7355e3c6f6e09e5268cbf29c291':
  Add missing va_end() to prevent stack corruptions
2012-08-24 15:21:12 -07:00
Ian Rogers
a37ce7faa6 Merge "Add missing va_end() to prevent stack corruptions" 2012-08-24 15:10:07 -07:00