Commit graph

17157 commits

Author SHA1 Message Date
Dimitry Ivanov
8bdf70e6e4 linker: add test for empty shdr table
Bug: http://b/30795430
Change-Id: Id839c22f88276f31e0615bc2a67d75e27a9aa7c6
Test: run bionic-unit-tests --gtest_filter=dlfcn.dlopen_invalid*
2016-08-15 11:30:45 -07:00
Dimitry Ivanov
c9a95613a9 linker: add test for zero shstrndx
Bug: http://b/30166532
Bug: http://b/30795430
Test: bionic-unit-tests --gtest_filter=dlfcn.dlopen_invalid*
Change-Id: I4cec73635cf403df9dd60b9a294d2298bb0abe3d
2016-08-15 10:29:50 -07:00
Dimitry Ivanov
0deb70cd04 Merge changes Ibcefd6d9,I249c0815,If59cb6da
* changes:
  Remove some duplication in the makefile
  linker: add test for zero e_shentsize
  Add test for misaligned section header
2016-08-13 03:42:15 +00:00
Treehugger Robot
3e3364a89d Merge "versioner: Ignore if Clang is missing" 2016-08-13 03:27:11 +00:00
Andreas Gampe
64da006063 versioner: Ignore if Clang is missing
This happens in some branches. Work around for now.

Change-Id: I75c01a3ae52ce89f6c56a19728903bf86db0a309
2016-08-12 19:10:21 -07:00
Treehugger Robot
e73fc63f96 Merge "Move some POSIX math functions out of _USE_GNU/_USE_BSD." 2016-08-13 00:43:54 +00:00
Josh Gao
0538dcfd4c Merge "versioner: copy unmodified headers when preprocessing." 2016-08-13 00:28:34 +00:00
Dimitry Ivanov
ff25581083 Remove some duplication in the makefile
Bug: http://b/30795430
Test: bionic-unit-tests --gtest_filter=dlfcn.dlopen_invalid*
Change-Id: Ibcefd6d913abafe0b202a83399db72050510cd5d
2016-08-12 16:55:17 -07:00
Elliott Hughes
c1929e4452 Move some POSIX math functions out of _USE_GNU/_USE_BSD.
The signgam global and the j0/j1/jn and y0/y1/yn functions are POSIX.

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/math.h.html

Change-Id: I802997a2060a011a777c2b641f28c1d58dfe49ed
2016-08-12 16:25:40 -07:00
Josh Gao
79786347db versioner: copy unmodified headers when preprocessing.
Change-Id: I2517f560fd44fb519d6ee7e8d0a485036d3ecd87
2016-08-12 16:24:04 -07:00
Treehugger Robot
9519fc08b7 Merge changes I9b662ca9,Iad7f3fc9,I1b16a4b5,I47b07755,I6496a8c4, ...
* changes:
  versioner: add support for preprocessing headers.
  versioner: fix makefiles.
  versioner: purge iostreams.
  versioner: assorted fixes.
  versioner: replace availability attributes with annotate.
  versioner: improve the test script.
2016-08-12 23:14:19 +00:00
Dimitry Ivanov
cb86c3128f linker: add test for zero e_shentsize
Bug: http://b/30166532
Bug: http://b/30795430
Change-Id: I249c081563f0ca7bcc799d8445a53683616eaa4e
Test: run bionic-unit-tests --gtest_filter=dlfcn.dlopen_invalid*
2016-08-12 15:28:42 -07:00
Dimitry Ivanov
972e3d0787 Add test for misaligned section header
Make sure linker does not crash when dlopening
elf-file with odd section header offset.

Bug: http://b/30795430
Bug: http://b/30687964
Test: bionic-unit-tests --gtest_filter=dlfcn.dlopen_invalid*
Change-Id: If59cb6da85b8752a69dc5687de85f9a9b74c92b4
2016-08-12 14:48:15 -07:00
Treehugger Robot
6f89d02f55 Merge "POSIX says <sys/types.h> should make all the pthread_* types available." 2016-08-12 21:32:21 +00:00
Elliott Hughes
280236537e POSIX says <sys/types.h> should make all the pthread_* types available.
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html

Change-Id: I606194e15ceaa3129f266a9a460c358eaa8bf686
2016-08-12 13:18:32 -07:00
Treehugger Robot
cea5c8a609 Merge "POSIX says <locale.h> makes NULL visible." 2016-08-12 19:56:46 +00:00
Elliott Hughes
51b3b44585 Merge "Fix sysconf(_SC_ARG_MAX)." 2016-08-12 19:53:46 +00:00
Treehugger Robot
4a77fa3dcd Merge "Fix recvfrom prototype." 2016-08-12 19:48:38 +00:00
Treehugger Robot
f8f2949744 Merge "Fix pthread_barrierattr_getpshared prototype." 2016-08-12 19:13:37 +00:00
Treehugger Robot
a1858a7f59 Merge "POSIX says IPPORT_RESERVED is in <netdb.h>." 2016-08-12 18:52:58 +00:00
Treehugger Robot
5b45d2fec8 Merge "POSIX says SEM_FAILED shall have type sem_t*." 2016-08-12 18:42:44 +00:00
Treehugger Robot
f135e4e56b Merge "POSIX says <fcntl.h> makes SEEK_* visible." 2016-08-12 18:35:17 +00:00
Dimitry Ivanov
e8087022c1 Merge "linker: disallow W + E PT_LOAD segments" 2016-08-12 17:55:36 +00:00
Treehugger Robot
0e1b92af2f Merge "Add two missing POSIX constant-only headers." 2016-08-12 17:42:12 +00:00
Elliott Hughes
e43778880e POSIX says IPPORT_RESERVED is in <netdb.h>.
In <netdb.h>:

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netdb.h.html

Not in <netinet/in.h>:

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html

Change-Id: Ie34cdb80eeb1443cf292944f3c68d8383aee2295
2016-08-12 10:38:35 -07:00
Elliott Hughes
95b0680cde POSIX says SEM_FAILED shall have type sem_t*.
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/semaphore.h.html

(Even if it didn't, this header previously referred to NULL without ensuring
that NULL was actually visible.)

Change-Id: I70577f4afc21f32c9e585076986127899ef8c8c1
2016-08-12 10:28:52 -07:00
Elliott Hughes
c5537889f5 POSIX says <locale.h> makes NULL visible.
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/locale.h.html

Change-Id: I81a600153738dff6ce3d9cde95c787b71d81a368
2016-08-12 10:28:08 -07:00
Elliott Hughes
fd936ae025 POSIX says <fcntl.h> makes SEEK_* visible.
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/fcntl.h.html

We already had two copies of these constants, so time to factor them out
into bits/.

Change-Id: I213c0d2372e41463593f878d338002b8eaa918cd
2016-08-12 10:16:34 -07:00
Treehugger Robot
b17d845d9b Merge "Use sysinfo(2) to implement more of <sys/sysinfo.h>." 2016-08-12 17:07:41 +00:00
Elliott Hughes
48bfc6e0df Add two missing POSIX constant-only headers.
Change-Id: Ic175635a0edc16f9354445adeb7b90837d3e858b
2016-08-12 09:28:17 -07:00
Elliott Hughes
8197aca7f2 Fix recvfrom prototype.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html

Change-Id: Iba203c74045c88e53e28c2e0c8bc1f9ac63ce23e
2016-08-12 09:20:07 -07:00
Elliott Hughes
02ac028bf7 Fix pthread_barrierattr_getpshared prototype.
As http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_barrierattr_getpshared.html
is my witness, there's a missing `const` here.

Change-Id: Ifd68188fb952460b64d144bdc21a53bc40ed82a7
2016-08-11 23:18:13 -07:00
Dimitry Ivanov
9700babc05 linker: disallow W + E PT_LOAD segments
No mapped segment from the elf file can be writable and
executable at the same time. This commit adds a check
for malformed PT_LOAD segments in the elf-files.

Bug: http://b/30146890
Test: run bionic-unit-tests --gtest_filter=dlfcn.*
Change-Id: Ia23acbe5a48780b65d7e4a50bbe024cd528079f4
2016-08-11 17:24:47 -07:00
Treehugger Robot
166f875eab Merge "dlerror returns char*, not const char*." 2016-08-11 23:16:59 +00:00
Elliott Hughes
5e071a18ce dlerror returns char*, not const char*.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlerror.html:

    char *dlerror(void);
    ...
    The application shall not modify the string returned.

Change-Id: I5e684bfd3930c39a2a30ea6fd005a5d5d3e5b181
2016-08-11 15:02:45 -07:00
Elliott Hughes
c508de0e41 Use sysinfo(2) to implement more of <sys/sysinfo.h>.
We already had implementations of some of the functions, and I didn't
bother rewriting them when we added sysinfo(2). Ross Anderson said in
https://www.lightbluetouchpaper.org/2016/07/29/yet-another-android-side-channel/
that we should "simply disable access to all procfs files", which made
me curious how many places we use /proc in bionic. This is the one that's
obviously unnecessary. The others I'm not aware of alternative APIs for.

Change-Id: Ia64f36b76f29a7a1dd67845270a5472e121aae10
2016-08-11 14:51:31 -07:00
Dimitry Ivanov
c623e7efc9 Merge "linker: use stat(2) to check file existence" 2016-08-11 19:53:02 +00:00
Dimitry Ivanov
4cf7024db7 linker: use stat(2) to check file existence
open(2) can be used to open directories; use stat to
check that the file exists and is a regular file.

Addresses review comments for 5aa67675f8

Bug: http://b/30320104
Change-Id: Ia944db2f2f779a87ea01dd41dcd171e59c9bef01
2016-08-11 11:11:52 -07:00
Treehugger Robot
cea35d77a2 Merge "linker_asan: Translate absolute dlopen paths to use asan-libraries." 2016-08-11 17:38:07 +00:00
Dimitry Ivanov
45d25ca728 linker_asan: Translate absolute dlopen paths to use asan-libraries.
This patch enables absolute path translation to instrumented library
when linker_asan is in use.

Test: adb shell cat /proc/<rlid pid>/maps | grep libril-qc-qmi-1.so
      check that it is mapped from /data/vendor/lib64 and not /vendor/lib64
Bug: http://b/30320104
Change-Id: I3bc24754b192afc0a72d6f3801f7b42141ce715b
(cherry picked from commit 5aa67675f8)
2016-08-10 21:37:50 -07:00
Treehugger Robot
4519a4d182 Merge "Add ndk_library for libdl." 2016-08-11 01:33:31 +00:00
Treehugger Robot
32a2e137a5 Merge "Add __attribute__((sentinel)) tags to execl and friends." 2016-08-11 01:19:23 +00:00
Treehugger Robot
3e35b26704 Merge "Check alignment along with range of mapped file fragments" 2016-08-11 00:46:33 +00:00
Treehugger Robot
299e501419 Merge "Move brillo closer to Android." 2016-08-10 23:59:19 +00:00
Treehugger Robot
18af5bfa5d Merge "Remove __static_cast macro from <sys/cdefs.h>." 2016-08-10 23:58:12 +00:00
Elliott Hughes
38dba2e7e1 Fix sysconf(_SC_ARG_MAX).
ARG_MAX hasn't been a constant since Linux 2.6.23.

Bug: http://lists.landley.net/pipermail/toybox-landley.net/2016-August/008592.html
Change-Id: I1eddb562751604c75b89fa610d79be0655c53693
Test: ran the bionic tests on device and against glibc
2016-08-10 15:51:06 -07:00
Josh Gao
d80a52eb65 Add __attribute__((sentinel)) tags to execl and friends.
Give a compile time diagnostic when the nullptr sentinel is missing
from an execl family call, instead of just pulling arbitrary values.

Bug: http://b/30793878
Change-Id: I1c49005c58b7ad4a5b04f0435b722d4c744e8f0e
Test: Built bullhead
2016-08-10 15:26:41 -07:00
Elliott Hughes
d1dd7c58b4 Remove __static_cast macro from <sys/cdefs.h>.
We don't use it, and we added the more general __BIONIC_CAST anyway.

Change-Id: I2cb8a108b58bb2cb24ed2b1890d9efed671196dc
2016-08-10 14:18:01 -07:00
Elliott Hughes
af211ab23f Merge "Fortify vsnprintf in more cases." 2016-08-10 21:11:10 +00:00
Elliott Hughes
5ffed9b856 Move brillo closer to Android.
Hiding our legacy cruft seemed like a good idea, but in practice it will only
mean worse interoperability.

Plus we got it wrong, as the recent `putw` example showed.

Change-Id: I167c7168eff133889028089c22a7a0dfb8d6d0cf
2016-08-10 14:08:31 -07:00