Commit graph

16216 commits

Author SHA1 Message Date
Christopher Ferris
249fefbda0 Merge "Fix the default alignment of the allocations." 2016-02-13 01:37:06 +00:00
Christopher Ferris
72df6708c8 Fix the default alignment of the allocations.
In order to enforce this constraint:

The pointer returned if the allocation succeeds shall be suitably
aligned so that it may be assigned to a pointer to any type of object
and then used to access such an object in the space allocated.

Force all allocations on 32 bit systems to have 8 byte alignment,
and all allocations on 64 bit systems to have 16 byte alignment.

Add a test to verify that the allocator returns the correct alignments.

Bug: 26739265
Change-Id: I9af53279617408676b94e4ec6481b3ed7ffafc6a
2016-02-12 17:30:30 -08:00
Elliott Hughes
925bf56447 Merge "Fix regerror(..., nullptr, 0)." 2016-02-13 00:59:42 +00:00
Elliott Hughes
cac2908b08 Fix regerror(..., nullptr, 0).
Found by passing a bad regular expression to the Google benchmark
code (https://github.com/google/benchmark).

Change-Id: I475db71c25706bbf02091b754acabe8254062f3a
2016-02-12 16:00:53 -08:00
Dimitry Ivanov
9750a77b31 Merge "Split out liblinker_malloc static library" 2016-02-11 23:29:06 +00:00
Dimitry Ivanov
a80564318a Split out liblinker_malloc static library
Bug: http://b/14998480
Bug: http://b/25716705
Change-Id: I8c7ba3971d1b17dbfc1a2ab5553aa04fe5da6677
2016-02-11 13:48:49 -08:00
Elliott Hughes
72bca4b410 Merge "Add tests for zero-sized allocations." 2016-02-11 17:53:04 +00:00
Elliott Hughes
884f76e3aa Add tests for zero-sized allocations.
POSIX lets us return null and set errno, but that would be annoying and
surprising.

Bug: http://b/27101951
Change-Id: I320a8a14884abb806a8d30e3e6cf1ede28b49335
2016-02-11 08:45:40 -08:00
Elliott Hughes
8fa00a5836 Merge "Set x86 TLS limit to 0xfffff, not PAGE_SIZE." 2016-02-10 15:48:53 +00:00
Elliott Hughes
01b85d5df3 Set x86 TLS limit to 0xfffff, not PAGE_SIZE.
Not least because we set limit_in_pages to 1. PAGE_SIZE pages was never
anyone's intention.

Change-Id: Ide867f44a2fb20d4d5d0cd67ced468e8665a0193
2016-02-09 22:44:16 -08:00
Chih-hung Hsieh
4c3cf4ad4d Merge "Enable clang for x86_64 after fp128 fix in clang-2577113." 2016-02-09 01:27:01 +00:00
Chih-Hung Hsieh
63fedd76ad Enable clang for x86_64 after fp128 fix in clang-2577113.
Upstream LLVM fix was included in prebuilt clang-2577113.

BUG: 21899249
Change-Id: Ief3f3e28650c0bbf8749a5e5d26f45c39e15ed62
2016-02-08 17:07:33 -08:00
Elliott Hughes
273f2e8ccc Merge "Update NOTICE files." 2016-02-09 01:03:01 +00:00
Elliott Hughes
b4931cee76 Update NOTICE files.
Change-Id: I6c4628534c5842c9835ead1bfff6582c5dce38e3
2016-02-08 17:00:12 -08:00
Elliott Hughes
3dbdb9dbe6 Merge "Add a test for a possible overflow in *printf." 2016-02-07 05:35:34 +00:00
Mike Frysinger
9c212fc436 Merge "define pw_gecos to pw_passwd for LP32 systems" 2016-02-06 19:29:29 +00:00
Mike Frysinger
ca6af7f4a8 define pw_gecos to pw_passwd for LP32 systems
Since we set both fields to NULL all the time, we can alias the two
fields together on LP32 to provide build-time compatibility.

BUG=24918750
TEST=python now builds for Brillo boards

Change-Id: I3394aea80c9a5288669389f71d0e4132f2157e3c
2016-02-06 09:28:44 -05:00
Elliott Hughes
8200e55d94 Add a test for a possible overflow in *printf.
It turns out we don't have any bugs here, but glibc does. Found while
chasing down a toybox failure I saw on the host, but we may as well
add the test in case we ever screw up here in future.

Change-Id: Ib8dd227ed3b742dc4dab8c09dc08e6ea9a35c807
2016-02-05 21:57:37 -08:00
Christopher Ferris
831c8a5249 Merge "Updated to v4.4.1 kernel headers." 2016-02-06 05:24:53 +00:00
Dan Willemsen
138a11c8a1 Merge "Update Android.bp" 2016-02-06 00:43:13 +00:00
Christopher Ferris
05d08e9716 Updated to v4.4.1 kernel headers.
Small modifications needed to allow compilation with the new headers:

- Manually modify bionic/libc/kernel/uapi/asm-mips/asm/siginfo.h to
  remove the uapi from the include.
- PR_XXX defines are now available for mips, so remove the definition
  from linker_mips.cpp.

Bug: 23789423
Change-Id: I6dc8a03b012426d3a937db15cb24d3a50fab5a8c
2016-02-05 16:03:55 -08:00
Elliott Hughes
865f6bce75 Merge "Add a test for snprintf on a PTHREAD_STACK_MIN-sized stack." 2016-02-05 20:48:01 +00:00
Elliott Hughes
43f7c87565 Add a test for snprintf on a PTHREAD_STACK_MIN-sized stack.
This is a common thing for people to want to do, snprintf requires
a lot of stack for itself, and PTHREAD_STACK_MIN should be usable
for realistic code.

Change-Id: Ib09cfb4e0beec1c69ee0944c3ea4c5d03a94c491
2016-02-05 11:18:41 -08:00
Dimitry Ivanov
b90837c3d3 Merge "Add check for pthread_self() when looking up a thread" 2016-02-05 04:29:54 +00:00
Dimitry Ivanov
4bc739a54c Add check for pthread_self() when looking up a thread
Check if thread_id is in fact pthread_self before
locking on g_thread_list_lock in __pthread_internal_find.

The main reason for doing this is not performance but to allow
the linker use raise() which was not working because pthread_kill()
couldn't find pthread_self() thread because the global thread
list is initialized in libc.so and the linker's version of this
list is empty.

Bug: http://b/25867917
Change-Id: I18fe620e8cd465b30f0e1ff45fff32958f3c5c00
2016-02-04 16:48:47 -08:00
Dan Willemsen
3e62171516 Update Android.bp
Also reorders some arch-specific sources to match the order in the
Android.mk system.

Change-Id: Ibde46a7cef9840b759be796ce9ac6618d3b06532
2016-02-03 21:48:08 -08:00
Elliott Hughes
d2be380258 Merge "Add in6addr_any and in6addr_loopback symbols." 2016-02-03 23:12:10 +00:00
Elliott Hughes
0c485dae70 Add in6addr_any and in6addr_loopback symbols.
Change-Id: I3a90fa448b6bd43321672ba74b84a4e9e8a67738
2016-02-03 14:13:52 -08:00
Elliott Hughes
5da33dd673 Merge "Really add adjtimex(2), and add clock_adjtime(2) too." 2016-02-03 22:03:09 +00:00
Dimitry Ivanov
c92ffa95fc Merge "linker: Change the library search order" 2016-02-03 21:58:40 +00:00
Elliott Hughes
5f26c6bc91 Really add adjtimex(2), and add clock_adjtime(2) too.
Change-Id: I81fde2ec9fdf787bb19a784ad13df92d33a4f852
2016-02-03 13:19:10 -08:00
Elliott Hughes
36ff699570 Merge "Add fopen64/freopen64/tmpfile64 aliases." 2016-02-03 20:52:42 +00:00
Elliott Hughes
f226ee59e0 Add fopen64/freopen64/tmpfile64 aliases.
Our fopen/freopen/tmpfile are already always O_LARGEFILE, but let's add
the aliases for _LARGEFILE_SOURCE compatibility.

Bug: http://b/24807045
Change-Id: I5d99b3ef3c9f27ce70f13313f6a92e96c7f21f80
2016-02-03 11:24:28 -08:00
Elliott Hughes
a279324094 Merge "Fix ifaddrs#getifaddrs_INET flakiness." 2016-02-03 18:55:20 +00:00
Elliott Hughes
b3cfafd2bd Merge "Expose ftello64." 2016-02-03 18:43:17 +00:00
Elliott Hughes
2d5e21f00d Fix ifaddrs#getifaddrs_INET flakiness.
The interface name wasn't being nul-terminated for the ioctl. Also clean up
the code a bit to give more useful diagnostics on failure.

Bug: http://b/26887941
Change-Id: I30c6bdc1a32733971a27ed1fb7db9d8239b6262b
2016-02-03 07:42:33 -08:00
Elliott Hughes
e4fa6e9cc7 Expose ftello64.
Also add the missing test that would have caught this.

Bug: http://b/24807045
Change-Id: I756a4d825595b52396b15898e3f717156fd1ba2f
2016-02-02 22:39:15 -08:00
Dan Albert
3e75110bcb Merge "Fix our fortify tests for global -Werror." 2016-02-03 02:28:42 +00:00
Josh Gao
153e9928b8 Merge "use GNU C89 extern inline semantics for __size_mul_overflow()" 2016-02-03 01:28:48 +00:00
Xia Yang
6b45d57739 use GNU C89 extern inline semantics for __size_mul_overflow()
__size_mul_overflow generates warning under following compilation envrionment:

-OX -D_FORTIFY_SOURCE=2 (X=1, 2, 3)

For example:

echo '#include <stdio.h>' | \
prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/arm-linux-androideabi-gcc \
    -I bionic/libc/arch-arm/include \
    -I bionic/libc/include \
    -I bionic/libc/kernel/uapi \
    -I bionic/libc/kernel/common \
    -I bionic/libc/kernel/uapi/asm-arm \
    -I bionic/libm/include \
    -I bionic/libm/include/arm \
    -I bionic/libc/include \
    -Werror \
    -O1 \
    -D_FORTIFY_SOURCE=2 \
    -c \
    -x c \
    -

bionic/libc/include/stdio.h:360:13: error: '__size_mul_overflow' is
static but used in inline function 'fread' which is not static [-Werror]
         if (__size_mul_overflow(size, count, &total)) {
                          ^

C99 - 6.7.4
"An inline definition of a function with external linkage shall not contain
a definition of a modifiable object with static storage duration, and shall
not contain a reference to an identifier with internal linkage."

As standard does not require compiler to determine when it is safe to
reference an internal function in an external inline function, but instead
delegalizes such reference as a whole, gcc throws a warning for such code
under C99 compilation.  Warning produced by libc header is inhereted widely
and strips the option of using -Werror to track code sanity.

Replace static inline specifier with gnu89 extern inline. Latter "is used
only for inlining. In no case is the function compiled on its own", which
is slightly different from former semantically, but should produce the same
result here.

Change-Id: I6a3374498e5499d110e54468cf9d0d67d2debbe2
2016-02-02 17:28:16 -08:00
Dan Albert
f68dcbe093 Fix our fortify tests for global -Werror.
If anyone has a better way of doing this it would be welcome...

Bug: http://b/26936282
Change-Id: I796896866327b4b5b5ee4ec36994fb320993f85d
2016-02-02 17:13:03 -08:00
Christopher Ferris
fe60bae4b7 Merge "Remove the unused TrackHeader structure." 2016-02-02 22:09:30 +00:00
Christopher Ferris
701bb65511 Remove the unused TrackHeader structure.
Change-Id: I07ae5de717e1fcfbe5dfe552a531db9f630da622
2016-02-02 13:22:40 -08:00
Christopher Ferris
4821db1b3e Merge "Add better free tracking." 2016-02-02 20:40:36 +00:00
Greg Hackmann
5992e5fb6d Merge changes I8ca219fa,Ia92d35b1
* changes:
  socket.h: update AF_* constants
  Add adjtimex
2016-02-02 18:03:35 +00:00
Dimitry Ivanov
88f5111123 linker: Change the library search order
Look into "/system/lib" before "/vendor/lib", this way
we can ensure that in case of name conflict /system libraries
take precedence.

Change-Id: Ifacdc9dc7a4e175853f499ed09782b2257f09e5a
2016-02-01 23:00:55 -08:00
Greg Hackmann
c7ca8f3a63 socket.h: update AF_* constants
Change-Id: I8ca219fa429ca8d8f872ed1db98275cd1a06f00b
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-02-02 00:28:35 +00:00
Christopher Ferris
7993b80f89 Add better free tracking.
Included in this change:

- Change the tag when a pointer is freed so it's easy to detect if
  an already freed pointer is being used.
- Move the free backtrace out of the header. This backtrace is only
  used under only some circumstances, so no need to allocate space
  in all headers for it.
- Add new option free_track_backtrace_num_frames to specify how many
  frames to record when the free occurs. This removes the dependency
  on the backtrace option to get backtraces.

Bug: 26739265
Change-Id: I76f5209507dcf46af67ada162a7cb2bf282116f2
2016-01-29 15:19:22 -08:00
Shinichiro Hamaji
37591462fa Merge "Tell kati about generated dependencies around crt" 2016-01-29 06:37:46 +00:00
Christopher Ferris
50647711eb Merge "Add min/max values for config values." 2016-01-29 02:31:07 +00:00