Commit graph

2105 commits

Author SHA1 Message Date
Nick Kralevich
70f6901c3d libc: make atoi, atol, and atoll pure functions
Change-Id: Ib831c079c865929b6c91d42f35e117f2e974808f
2012-06-14 13:57:43 -07:00
Nick Kralevich
8df49ad246 FORTIFY_SOURCE: add strlcpy / strlcat support
Add strlcpy / strlcat support to FORTIFY_SOURCE. This allows
us to do consistency checks on to ensure we don't overflow buffers
when the compiler is able to tell us the size of the buffer we're
dealing with.

Unlike previous changes, this change DOES NOT use the compiler's
builtin support. Instead, we do everything the compiler would
normally do.

Change-Id: I47c099a911382452eafd711f8e9bfe7c2d0a0d22
2012-06-14 12:52:42 -07:00
David 'Digit' Turner
4442d512c6 Merge "linker: small code-cleanup" 2012-06-13 21:45:52 -07:00
Nick Kralevich
a5eaa02f62 Merge "Don't mark realloc with __attribute__((malloc))" 2012-06-13 16:13:32 -07:00
Nick Kralevich
b27631b9ae Don't mark realloc with __attribute__((malloc))
According to
http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html

realloc should NOT be marked with __attribute__((malloc)). Quoting:

   realloc-like functions do not have this property as the memory
   pointed to does not have undefined content.

For reference, __mallocfunc is defined in sys/cdefs.h as:

    #define __mallocfunc  __attribute__((malloc))

Change-Id: I56083542ba92e4608dd7c55fb5596a138eb50cc9
2012-06-13 15:43:14 -07:00
David 'Digit' Turner
1608416811 linker: small code-cleanup
This patch adds to make the linker a little bit easier to understand
by making all functions that acts on a sofino object with a soinfo_
prefix.

This is to more easily distinguish functions that operate on global
state, and those that operate on individual libraries.

This should be purely stylistic, i.e. no feature/behaviour change.

Change-Id: Ie510d13d743aa4317644caefa9910b8af7e84f44
2012-06-13 22:47:20 +02:00
Nick Kralevich
8c54c56723 Merge "FORTIFY_SOURCE: add sprintf / vsprintf support" 2012-06-13 11:03:42 -07:00
Nick Kralevich
9b549c39c9 FORTIFY_SOURCE: add sprintf / vsprintf support
sprintf FORTIFY_SOURCE protections are not available
on clang.

Also add various __attribute__s to stdio functions.

Change-Id: I936d1f9e55fe53a68885c4524b7b59e68fed218d
2012-06-13 09:14:30 -07:00
Nick Kralevich
ca622f5748 Merge "update filter.h / prctl.h / seccomp.h" 2012-06-12 16:34:46 -07:00
Robert Greenwalt
8f88aa7d38 am c5cab345: am 028ccf5d: Merge "Avoid multiple dns lookups for the same query"
* commit 'c5cab3452d5ced55474e56497594579108670b51':
  Avoid multiple dns lookups for the same query
2012-06-12 15:56:29 -07:00
Robert Greenwalt
c5cab3452d am 028ccf5d: Merge "Avoid multiple dns lookups for the same query"
* commit '028ccf5d40dd9a945ea92aa79822c08c6f6aa1d2':
  Avoid multiple dns lookups for the same query
2012-06-12 15:52:56 -07:00
Nick Kralevich
d1a6918508 update filter.h / prctl.h / seccomp.h
Pull in an updated version of filter.h / prctl.h / seccomp.h
from the linux kernel.  Pulled from upstream kernel at
94fa83c424321189ca24fb6cb4c0d224cdedc72d

This file was generated using the following command:

cd bionic/libc/kernel/
./tools/clean_header.py -u ../../../external/kernel-headers/original/linux/seccomp.h
./tools/clean_header.py -u ../../../external/kernel-headers/original/linux/filter.h
./tools/clean_header.py -u ../../../external/kernel-headers/original/linux/prctl.h

Change-Id: I1ca996541d05b0d5927ab828a6ce49c09877ea01
2012-06-12 15:46:31 -07:00
Robert Greenwalt
028ccf5d40 Merge "Avoid multiple dns lookups for the same query" 2012-06-12 15:06:24 -07:00
Nick Kralevich
c2f1d215b1 Merge "FORTIFY_SOURCE: add snprintf, vsnprintf" 2012-06-12 08:50:57 -07:00
Elliott Hughes
f525fb525b am 20afd4e7: am e0961445: Merge "Remove the meaningless on Linux if_dl.h header."
* commit '20afd4e70c2f346d7cd03a7a3049f8de2d176d5c':
  Remove the meaningless on Linux if_dl.h header.
2012-06-11 17:42:44 -07:00
Elliott Hughes
c9142d4d8e am 571da80c: am c75491e2: Merge "Remove an obsolete jamfile."
* commit '571da80c58e13eac4d4fb29d38342879e5dede13':
  Remove an obsolete jamfile.
2012-06-11 17:42:43 -07:00
Elliott Hughes
20afd4e70c am e0961445: Merge "Remove the meaningless on Linux if_dl.h header."
* commit 'e0961445124b5ff39412da32578e14e0d1f6afd6':
  Remove the meaningless on Linux if_dl.h header.
2012-06-11 17:41:10 -07:00
Elliott Hughes
571da80c58 am c75491e2: Merge "Remove an obsolete jamfile."
* commit 'c75491e291586540c213ae088fc75b71fc4d3752':
  Remove an obsolete jamfile.
2012-06-11 17:41:04 -07:00
Elliott Hughes
e096144512 Merge "Remove the meaningless on Linux if_dl.h header." 2012-06-11 16:49:57 -07:00
Nick Kralevich
cffdf6693f FORTIFY_SOURCE: add snprintf, vsnprintf
Add _FORTIFY_SOURCE support for snprintf, vsnprintf

At this time, we opt out of these protections for clang, as clang
does not implement __builtin_va_arg_pack().

http://clang.llvm.org/docs/UsersManual.html#c_unimpl_gcc

Change-Id: I73ebe5ec8dad1dca8898a76d6afb693a25f75375
2012-06-11 16:46:16 -07:00
Elliott Hughes
c75491e291 Merge "Remove an obsolete jamfile." 2012-06-11 16:29:46 -07:00
Elliott Hughes
4c19e4f64f Remove an obsolete jamfile.
Was bionic ever built with jam? Weird!

Change-Id: Iea9a7af8bf46ee8319963e642da48e3bb49f6c60
2012-06-11 16:17:45 -07:00
Nick Kralevich
0f5b48ce28 Merge "inet_ntop: pass the size of tmp to snprintf()" 2012-06-11 16:11:20 -07:00
Nick Kralevich
85b06f9365 inet_ntop: pass the size of tmp to snprintf()
Fix runtime error when snprintf() FORTIFY_SOURCE protections are
applied. The size passed to snprintf() is larger than the tmp
buffer size, which results in a runtime assertion failure.

Even though the size passed to snprintf is larger than the buffer,
there's no danger of overwriting the buffer because of the format
string passed to snprintf.

Change-Id: I35f0217d25f3b9c6d04c5a76c3238759c235545a
2012-06-11 16:00:52 -07:00
Elliott Hughes
c3d45b822c Remove the meaningless on Linux if_dl.h header.
This was misleading 'configure' into thinking we actually support AF_LINK,
but we're Linux, so we don't, and we never implemented the functions we
declared here either.

Reported to AOSP by Jun-ya Kato.

(cherry-pick of 5056f1fad1187cd67729bb04ba72397d78256f03.)

Change-Id: Ic67f674d2221497c8166994812bb5fc7f0831066
2012-06-11 15:13:37 -07:00
Elliott Hughes
7c5c68f5c7 Merge "Remove the meaningless on Linux if_dl.h header." 2012-06-11 15:09:57 -07:00
Elliott Hughes
5056f1fad1 Remove the meaningless on Linux if_dl.h header.
This was misleading 'configure' into thinking we actually support AF_LINK,
but we're Linux, so we don't, and we never implemented the functions we
declared here either.

Reported to AOSP by Jun-ya Kato.

Change-Id: I111f9887f3812469b411b9cf5124d9dd624f19f7
2012-06-11 15:01:10 -07:00
Geremy Condra
631498de43 Merge "Added event logging for some spoofed DNS queries." 2012-06-11 12:17:12 -07:00
Geremy Condra
fd49579f3a Merge "Added actual event logging calls to the FORTIFY_SOURCE methods." 2012-06-11 11:50:03 -07:00
Geremy Condra
524c87c61c Added event logging for some spoofed DNS queries.
Change-Id: I40909306e8cf922f1dd5a5685db89f732a709794
2012-06-11 11:44:48 -07:00
Geremy Condra
009f38478e Added actual event logging calls to the FORTIFY_SOURCE methods.
Change-Id: I3bf4fa8678c33187cb8ce4b75e666ddcd24403ab
2012-06-11 11:30:56 -07:00
The Android Open Source Project
8f2887be93 am 5ff025a5: Reconcile with jb-release
* commit '5ff025a50ccd7d30ea39c989d9ed8b1084ded47f':
2012-06-11 09:23:11 -07:00
The Android Open Source Project
5ff025a50c Reconcile with jb-release
Change-Id: I7cbfbab55783f245c0854543843c2052c4c2e932
2012-06-11 09:20:36 -07:00
The Android Automerger
ff7eae7b08 merge in jb-release history after reset to jb-dev 2012-06-11 06:59:25 -07:00
Nick Kralevich
76656afc6d _FORTIFY_SOURCE: check for integer overflows
Ensure that strcat / strncat check for integer overflows
when computing the length of the resulting string.

Change-Id: Ib806ad33a0d3b50876f384bc17787a28f0dddc37
2012-06-08 20:18:19 -07:00
Jeff Brown
f41855949d am e4db460a: am b7630f01: Use new debuggerd protocol.
* commit 'e4db460a54e4f024b83a7df9a3f9920d695da9f3':
  Use new debuggerd protocol.
2012-06-08 15:33:31 -07:00
Jeff Brown
e4db460a54 am b7630f01: Use new debuggerd protocol.
* commit 'b7630f018abc83261acf78e8cf9a88c1df72f7f5':
  Use new debuggerd protocol.
2012-06-08 15:30:39 -07:00
Geremy Condra
ec8addcc8a Merge "Adding event logging to libc." 2012-06-08 12:17:11 -07:00
Geremy Condra
8b11c4cec2 Adding event logging to libc.
I've basically just copied the relevant bits out of liblog and
EventLog.cpp. While this will let us do the uid logging we want
to address the concerns in 245c07027f78565858dd489eb0d94c3d48743e9d
it doesn't give us much else.

Change-Id: Icac6ff20bc0a3ade5927f6f76fedffe1ae6f8522
2012-06-08 12:14:48 -07:00
Nick Kralevich
7e5993bec7 Merge "_FORTIFY_SOURCE: add memset / bzero support" 2012-06-07 14:30:20 -07:00
Nick Kralevich
71a18dd435 _FORTIFY_SOURCE: add memset / bzero support
Add _FORTIFY_SOURCE support for the following functions:

* memset
* bzero

Move the __BIONIC_FORTIFY_INLINE definition to cdefs.h so it
can be used from multiple header files.

Change-Id: Iead4d5e35de6ec97786d58ee12573f9b11135bb7
2012-06-07 14:19:52 -07:00
Elliott Hughes
1a6b0bb3a6 Merge "Support non-zero p_vaddr in first PT_LOAD segment" 2012-06-07 11:43:47 -07:00
The Android Open Source Project
7d11009a97 am d06a73bc: Reconcile with jb-release
* commit 'd06a73bcb330e1a560373158be9009daef10a046':
2012-06-07 07:51:59 -07:00
The Android Open Source Project
d06a73bcb3 Reconcile with jb-release
Change-Id: I2c8264a9a4e3299bca7fc01d67063993b6b1b886
2012-06-07 07:48:47 -07:00
Jeff Brown
b7630f018a Use new debuggerd protocol.
Bug: 6615693
Change-Id: Ibfddc0de3fa2a882f7d0238ab797e5b29296b54b
2012-06-06 18:37:48 -07:00
Elliott Hughes
459049719c am d0c25027: am 2b89f1e3: Merge "Fix sysconf(_SC_NPROCESSORS_CONF) on ARM."
* commit 'd0c250271c983c3de282ff02bd2528e74ad8b5f1':
  Fix sysconf(_SC_NPROCESSORS_CONF) on ARM.
2012-06-06 13:50:29 -07:00
Elliott Hughes
d0c250271c am 2b89f1e3: Merge "Fix sysconf(_SC_NPROCESSORS_CONF) on ARM."
* commit '2b89f1e37df838e466d382fc602728930bad4c68':
  Fix sysconf(_SC_NPROCESSORS_CONF) on ARM.
2012-06-06 13:48:07 -07:00
Elliott Hughes
2b89f1e37d Merge "Fix sysconf(_SC_NPROCESSORS_CONF) on ARM." 2012-06-06 13:32:19 -07:00
Elliott Hughes
a985076bfe Fix sysconf(_SC_NPROCESSORS_CONF) on ARM.
Bug: http://code.google.com/p/enh/issues/detail?id=33
Change-Id: I679b4cd888d362031042284e8edf01c5273a92aa
2012-06-06 12:04:38 -07:00
Elliott Hughes
158ad015c2 am 3069270d: am c2bba24d: Merge "Give the timer_create SIGEV_THREAD helper threads sensible names."
* commit '3069270d8641c7bb57aa308d8f90b4d2dcbf66fc':
  Give the timer_create SIGEV_THREAD helper threads sensible names.
2012-06-06 11:37:25 -07:00