Commit graph

24896 commits

Author SHA1 Message Date
dimitry
965d06da1e Fix logic in loading dependencies crossing namespace boundaries
This change addresses multiple problems introduced by
02586a2a34

1. In the case of unsuccessful dlopen the failure guard is triggered
for two namespaces which leads to double unload.

2. In the case where load_tasks includes libraries from 3 and more
namespaces it results in incorrect linking of libraries shared between
second and third/forth and so on namespaces.

The root cause of these problems was recursive call to find_libraries.
It does not do what it is expected to do. It does not form new load_tasks
list and immediately jumps to linking local_group. Not only this skips
reference counting it also will include unlinked but accessible library
from third (and fourth and fifth) namespaces in invalid local group. The
best case scenario here is that for 3 or more namesapces this will
fail to link. The worse case scenario it will link the library
incorrectly with will lead to very hard to catch bugs.

This change removes recursive call and replaces it with explicit list of
local_groups which should be linked. It also revisits the way we do
reference counting - with this change the reference counts are updated after
after libraries are successfully loaded.

Also update soinfo_free to abort in case when linker tries to free same
soinfo for the second time - this makes linker behavior less undefined.

Test: bionic-unit-tests
Bug: http://b/69787209
Change-Id: Iea25ced181a98c6503cce6e2b832c91d697342d5
2017-12-10 22:04:55 +01:00
Elliott Hughes
d351581aa9 Merge "Add a few missing <time.h> tests." 2017-12-09 00:08:03 +00:00
Elliott Hughes
066d5ec4a1 Merge "Add sscanf %[ tests and fix the bug that fell out." 2017-12-09 00:07:59 +00:00
Elliott Hughes
b787c6fe4b Merge "A few new bionic tests." 2017-12-09 00:07:52 +00:00
Elliott Hughes
5a29d541fc Add a few missing <time.h> tests.
Bug: N/A
Test: ran tests
Change-Id: I0c1a17503eaceedac39320efa704313384c5b7be
2017-12-07 16:05:57 -08:00
Aleksandra Tsvetkova
608b4514cb A few new bionic tests.
Trivial tests for <alloca.h> and <byteswap.h>, plus slightly improved
test coverage for <inttypes.h> and <stdlib.h>.

Bug: N/A
Test: ran tests
Change-Id: Idac4141ffc760c4f7756332477ce5112950d61a5
Signed-off-by: Aleksandra Tsvetkova <aleksandra.tsvetkova@intel.com>
2017-12-07 15:44:20 -08:00
Treehugger Robot
8ac7f0b738 Merge "Add OWNERS." 2017-12-07 22:57:27 +00:00
Elliott Hughes
0d3ba1f047 Add sscanf %[ tests and fix the bug that fell out.
Strictly, POSIX says "If a '-' is in the scanlist and is not the first
wide character, nor the second where the first wide character is a '^',
nor the last wide character, the behavior is implementation-defined",
but it seems unreasonable for swscanf to interpret `a-c` differently
from sscanf. Make ours behave the same as each other by making swscanf
work the same as sscanf.

Bug: http://b/68672236
Test: ran tests
Change-Id: Ia84805897628d7128e901b468e02504373730e61
2017-12-07 14:13:57 -08:00
Treehugger Robot
1d3cea54c8 Merge changes I80c0a510,I11ea200f,Ibc48e838
* changes:
  bionic: add vdso clock_getres
  bionic: benchmark: add clock_getres performance tests
  bionic: benchmark: additional clock_gettime performance tests
2017-12-07 21:43:37 +00:00
Elliott Hughes
949f58320d Add OWNERS.
Bug: N/A
Test: N/A
Change-Id: I14e09ad57715eff98687f7267c36a60c00b5c3ff
2017-12-07 11:10:57 -08:00
Mark Salyzyn
79249b0897 bionic: add vdso clock_getres
clock_getres() should not be a hot call, nevertheless it is
~6-7 times faster for supported clock ids if it uses
__vdso_clock_getres if available.  There is a 3% performance
penalty for unsupported clock ids via __vdso_clock_getres with
respect to a direct syscall.

[TL;DR]

w/vdso32 kernel patches, locked cores to MAX, little cores only.

BEFORE:

hikey960 vdso (aarch64):

----------------------------------------------------------------------
Benchmark                               Time           CPU Iterations
----------------------------------------------------------------------
BM_time_clock_getres                  126 ns        126 ns    5577874
BM_time_clock_getres_syscall          127 ns        127 ns    5505016
BM_time_clock_getres_REALTIME         126 ns        126 ns    5574682
BM_time_clock_getres_BOOTTIME         126 ns        126 ns    5575237
BM_time_clock_getres_TAI              126 ns        126 ns    5576810
BM_time_clock_getres_unsupported      128 ns        128 ns    5480189

hikey960 vdso32 (aarch32):

----------------------------------------------------------------------
Benchmark                               Time           CPU Iterations
----------------------------------------------------------------------
BM_time_clock_getres                  199 ns        199 ns    3508708
BM_time_clock_getres_syscall          220 ns        220 ns    3184676
BM_time_clock_getres_REALTIME         199 ns        199 ns    3509697
BM_time_clock_getres_BOOTTIME         199 ns        199 ns    3513551
BM_time_clock_getres_TAI              200 ns        199 ns    3512412
BM_time_clock_getres_unsupported      196 ns        196 ns    3575609

x86_64 (glibc):

---------------------------------------------------------------------
Benchmark                              Time           CPU Iterations
---------------------------------------------------------------------
BM_time_clock_getres                 252 ns        252 ns    2370263
BM_time_clock_getres_syscall         215 ns        215 ns    3287497
BM_time_clock_getres_REALTIME        214 ns        214 ns    3294228
BM_time_clock_getres_BOOTTIME        213 ns        213 ns    3277519
BM_time_clock_getres_TAI             213 ns        213 ns    3294991
BM_time_clock_getres_unsupported     206 ns        206 ns    3450654

imx7d_pico IOT nyc (w/arm,cpu-registers-not-fw-configured) (armv7a):
(Virtual Timers)

Benchmark                           Time(ns)    CPU(ns) Iterations
------------------------------------------------------------------
BM_time_clock_getres                      16        345    2000000
BM_time_clock_getres_syscall              16        339    2121212
BM_time_clock_getres_REALTIME             17        350    2058824
BM_time_clock_getres_BOOTTIME             17        345    2000000
BM_time_clock_getres_TAI                  16        350    2000000
BM_time_clock_getres_unsupported          13        284    2500000

AFTER:

hikey960 vdso (aarch64):

---------------------------------------------------------------------
Benchmark                              Time           CPU Iterations
---------------------------------------------------------------------
BM_time_clock_getres                  18 ns         18 ns   37880389
BM_time_clock_getres_syscall         127 ns        127 ns    5520029
BM_time_clock_getres_REALTIME         18 ns         18 ns   37879962
BM_time_clock_getres_BOOTTIME         19 ns         18 ns   37878361
BM_time_clock_getres_TAI             131 ns        131 ns    5368484
BM_time_clock_getres_unsupported      97 ns         97 ns    7182864

hikey960 vdso32 (aarch32):

---------------------------------------------------------------------
Benchmark                              Time           CPU Iterations
---------------------------------------------------------------------
BM_time_clock_getres                  36 ns         36 ns   19205240
BM_time_clock_getres_syscall         212 ns        212 ns    3297100
BM_time_clock_getres_REALTIME         36 ns         36 ns   19219109
BM_time_clock_getres_BOOTTIME         36 ns         36 ns   19222490
BM_time_clock_getres_TAI             206 ns        206 ns    3402868
BM_time_clock_getres_unsupported     159 ns        159 ns    4409492

imx7d_pico IOT nyc (wo/arm,cpu-registers-not-fw-configured) (armv7a):
(Physical Timers)

Benchmark                           Time(ns)    CPU(ns) Iterations
------------------------------------------------------------------
BM_time_clock_getres                       2         48   14000000
BM_time_clock_getres_syscall              14        335    2058824
BM_time_clock_getres_REALTIME              2         49   14583333
BM_time_clock_getres_BOOTTIME              2         48   14000000
BM_time_clock_getres_TAI                  14        350    2058824
BM_time_clock_getres_unsupported           8        203    3500000

Test: taskset F \
        /data/benchmarktest{64}/bionic-benchmarks/bionic-benchmarks \
        --bionic_xml=vdso.xml --benchmark_filter=BM_time_clock_getres*
Bug: 63737556
Change-Id: I80c0a5106625d76720287f715fcf145d2aad1705
2017-12-07 09:41:48 -08:00
Mark Salyzyn
6f9c35ded2 bionic: benchmark: add clock_getres performance tests
Provide a means to check vdso kernel performance for all reasoned
combinations of clock_getres, same set of ids as clock_gettime.

Add to suites/vdso.xml

Test: /data/nativetest{64}/bionic-benchmarks-tests/bionic-benchmarks-tests
      /data/benchmarktest{64}/bionic-benchmarks/bionic-benchmarks \
        --bionic_xml=vdso.xml --benchmark_filter=BM_time_clock_getres*
Bug: 63737556
Change-Id: I11ea200f67aec2a2f6ad9284960f2941298da222
2017-12-07 09:41:31 -08:00
Mark Salyzyn
6ffa10f483 bionic: benchmark: additional clock_gettime performance tests
Provide a means to check vdso kernel performance for each of
CLOCK_MONOTONIC (current), CLOCK_MONOTONIC_COARSE,
CLOCK_MONOTONIC_RAW, CLOCK_REALTIME, CLOCK_REALTIME_COARSE,
CLOCK_BOOTTIME.

Add a suites/vdso.xml to select subset of tests impacted by
vdso implementations.

Test: /data/nativetest{64}/bionic-benchmarks-tests/bionic-benchmarks-tests
      /data/benchmarktest{64}/bionic-benchmarks/bionic-benchmarks \
        --bionic_xml=vdso.xml --benchmark_filter=BM_time_clock_gettime*
Bug: 63737556
Change-Id: Ibc48e838e50929527ce8d221dd1a608bf185cbc2
2017-12-07 09:41:13 -08:00
Xin Li
78b40e8fe1 Merge "DO NOT MERGE: Merge Oreo MR1 into master" 2017-12-06 23:18:28 +00:00
Xin Li
9fffc8edeb DO NOT MERGE: Merge Oreo MR1 into master
Exempt-From-Owner-Approval: Changes already landed internally
Change-Id: Ib379c20f06c4b22a16bc715b34ba39b87b5f10fd
2017-12-06 14:24:42 -08:00
Elliott Hughes
68e425fb34 Merge "Add more missing ELF structures/constants."
am: e57a398977

Change-Id: I58e2d0777c0feb72d836ab4c3bb61e46f6a722ed
2017-12-06 16:47:53 +00:00
Elliott Hughes
e57a398977 Merge "Add more missing ELF structures/constants." 2017-12-06 16:39:31 +00:00
Alin Jerpelea
fbebaaa84b Merge "libc: add /odm/bin to the DEFPATH"
am: e455c829cd

Change-Id: Ib6166de487b7d5da8a796a0f9ff96c6bddadbf6b
2017-12-06 04:09:47 +00:00
Alin Jerpelea
816b259880 Merge "linker: add support for odm partition"
am: 7b5073767d

Change-Id: I0c1356f53cd33e0cd6a78f0798fed8b395893859
2017-12-06 04:09:37 +00:00
Treehugger Robot
e455c829cd Merge "libc: add /odm/bin to the DEFPATH" 2017-12-06 04:03:07 +00:00
Treehugger Robot
7b5073767d Merge "linker: add support for odm partition" 2017-12-06 04:03:07 +00:00
Elliott Hughes
89d8a3c4cd Add more missing ELF structures/constants.
Needed to build libelf.

Bug: N/A
Test: builds
Change-Id: If0c5e633547a1f4bd8e5d77ffb815739f13c641f
2017-12-05 13:00:22 -08:00
Elliott Hughes
6c77566dbf Merge "Make it clear that "dlopen" logging includes "dlclose"."
am: c5f193cc45

Change-Id: I077e3644af47248273a6cf050b48842cd7d8d34e
2017-12-05 20:44:02 +00:00
Elliott Hughes
c5f193cc45 Merge "Make it clear that "dlopen" logging includes "dlclose"." 2017-12-05 20:29:14 +00:00
Elliott Hughes
1d318329a7 Merge "Make our fortify FD_ISSET const, and expose the fd_mask type."
am: c1f6219c32

Change-Id: Iee9d523a0802c7ce2ebe309c503e324ef7cec7c7
2017-12-05 17:37:21 +00:00
Elliott Hughes
c5f78240f3 Make it clear that "dlopen" logging includes "dlclose".
Bug: http://b/69921537
Test: N/A
Change-Id: I23d534bb92d5542dd952ff664ee34bb327c896cc
2017-12-05 09:23:51 -08:00
Elliott Hughes
c1f6219c32 Merge "Make our fortify FD_ISSET const, and expose the fd_mask type." 2017-12-05 17:09:17 +00:00
Josh Gao
2cacb63bae Merge "Reformat SIGRTMIN comments."
am: d5e486cc88

Change-Id: I1c2458696fe811d8e492826514977b9241b3d307
2017-12-04 23:55:09 +00:00
Treehugger Robot
d5e486cc88 Merge "Reformat SIGRTMIN comments." 2017-12-04 23:24:04 +00:00
Elliott Hughes
d381beb246 Merge "Give ELF notes 4-byte alignment."
am: ce4b624174

Change-Id: I88216bbc4bce401402f20466ca4e2d52f724085d
2017-12-04 23:09:05 +00:00
Treehugger Robot
ce4b624174 Merge "Give ELF notes 4-byte alignment." 2017-12-04 22:59:14 +00:00
Elliott Hughes
a6714d106b Make our fortify FD_ISSET const, and expose the fd_mask type.
Bug: http://b/70171464
Test: ran tests
Change-Id: Ifbee29d9888ce7cf76b99844dd9700128256a486
2017-12-04 14:16:38 -08:00
Josh Gao
b8facf2aca Reformat SIGRTMIN comments.
Test: none
Change-Id: Ief1f0c06c17df6704863c8c7176941447f2e28f4
2017-12-04 13:47:17 -08:00
Elliott Hughes
12533271fb Give ELF notes 4-byte alignment.
Use .balign because what the argument means doesn't vary between
architectures.

Bug: http://b/70166421
Test: builds
Change-Id: I1d54f2f6942dd2893f3fda30bac08d07ea9cd346
2017-12-04 13:21:01 -08:00
Alin Jerpelea
c7ec6d46fb libc: add /odm/bin to the DEFPATH
change is need to be able to share services on the odm partition

Change-Id: I28cc37a9f049d0776fbcb7f92b05652385348b3e
Test: services can launch from odm partition.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sonymobile.com>
2017-12-04 16:09:29 +01:00
Jiyong Park
2573be637c Merge "Allow property += value in ld.config.txt"
am: bfd06f63e5

Change-Id: Id536cea8a7161c5dc31f654d1989eb61ff966a2e
2017-12-04 01:52:14 +00:00
Treehugger Robot
bfd06f63e5 Merge "Allow property += value in ld.config.txt" 2017-12-04 01:43:27 +00:00
Justin Yun
bf9cf750a4 Merge "Use ld.config.$VER.txt when current VNDK version is $VER"
am: 86a3803799

Change-Id: I350a75a183717e3cd0a68d3a9ed524f19f077a2f
2017-12-03 14:32:36 +00:00
Treehugger Robot
86a3803799 Merge "Use ld.config.$VER.txt when current VNDK version is $VER" 2017-12-03 14:27:49 +00:00
Justin Yun
53ce74288c Use ld.config.$VER.txt when current VNDK version is $VER
When ro.vndk.version is set to a specific version, not "current",
use ld.config.$VER.txt as a linker namespace configuration file,
where $VER is the VNDK version set by ro.vndk.version.

Because ro.vndk.version is set by the vendor partition, the
configuration file will be automatically selected by the VNDK version
of vendor patition.

If ro.vndk.version is current or not set, ld.config.txt will be used
as before.

Bug: 69531793
Test: Build for a Pixel2 device.
  In the out/target/product/<device> directory,
    rename system/etc/ld.config.txt to system/etc/ld.config.27.1.0.txt
    rename system/lib[64]/vndk to system/lib[64]/vndk-27.1.0
    copy system/lib[64]/vndk-sp to system/lib[64]/vndk-sp-27.1.0
    set ro.vndk.version to 27.1.0 in vendor/default.prop
  Build system and vendor images with "make snod" and "make vnod".
  Disble vbmeta using avbtool.
  Flash a device and check boot.

Change-Id: Ic55bb0a741d434e5fa93e109be15df9d9de3f105
2017-12-03 23:26:53 +09:00
Tom Cherry
f8fdd5dacd Merge "Fix static classes in system properties"
am: 96867b148f

Change-Id: I1ea84734c10875b7d5398699ca0ec7aaefae96fe
2017-12-01 18:19:25 +00:00
Tom Cherry
96867b148f Merge "Fix static classes in system properties" 2017-12-01 18:12:46 +00:00
Christopher Ferris
e4169c6e0e Merge "Add new benchmark options."
am: dc85247ab6

Change-Id: I75956886a0a7de4a27186c9ed97d3b4ff4153e97
2017-12-01 02:42:59 +00:00
Christopher Ferris
dc85247ab6 Merge "Add new benchmark options." 2017-12-01 02:36:56 +00:00
Jiyong Park
8b02951135 Allow property += value in ld.config.txt
ld.config.txt currently does not support split line. As the file gets
larger, this limitation makes the file very unreadable. Now, long lines
can be avoided by breaking one line into multiple lines using +=
operator.

ex)

namespace.default.search.paths = /system/${LIB}
namespace.default.search.paths += /system/${LIB}

Delimitor (':' for *.paths and *.shared_libs, and ',' for *.links) is
automatically added.

Bug: 69888716
Test: linker-unit-tests passes

Change-Id: I4b94fd4e7f8a76d59db8d1096c86aa2118e46625
2017-12-01 10:58:10 +09:00
Tom Cherry
8d366a81a3 Fix static classes in system properties
Previously, the functionality for mapping properties to contexts were
broken into a set of classes, each statically defined in
system_properties.cpp to prevent using new/malloc.  This is a mistake
however, since system property initialization happens before static
initialization, so it is possible for the Constructors of these
classes to clobber the initialized data.

This change fixes that by placing them in a Union and having that
Union have a no-op constructor.  The individual classes will be
initialized via placement new before they are used as is typically
done with classes in a union.

Test: boot bullhead
Change-Id: Ideb9d6ad8b6fc768811d8615d005cd4b8d134bce
2017-11-30 16:26:34 -08:00
Christopher Ferris
e2188d460b Add new benchmark options.
Add a bunch of extra options to allow greater flexibility for creating
benchmarks. Add a pattern option that can be used to represent any
one buffer or two buffer possibility. This should fully replace the
functionality of microbench.

Add a single option for one buffer benchmarks and two buffer benchmarks
that represents all of the possible options to run a string benchmark.

Add a string test suite that includes all string benchmarks using the
above option.

Test: New unit tests to cover all the new options, and all pass.
Test: Ran new string test suite with a single bionic iteration.
Change-Id: Idb13ea15e44cec626e9f46672ccd648d7ca72ba6
2017-11-30 15:49:45 -08:00
Alin Jerpelea
074a9fd3da linker: add support for odm partition
If libraries are on the odm partition they will fail to load
This patch adds the odm path as a search path for linker.

Test: libraries load from the odm partition
Change-Id: Ia7786e047cc565d74d25c025dacf9266b3763650
Signed-off-by: Alin Jerpelea <alin.jerpelea@son.com>
2017-12-01 06:21:17 +09:00
Christopher Ferris
8e9ad19103 Merge "Generate all the benchmarks to run."
am: fdacec1d42

Change-Id: Ia4aadfb288b92144ce8e4214d584455db2e8f2d1
2017-11-30 20:03:34 +00:00
Christopher Ferris
fdacec1d42 Merge "Generate all the benchmarks to run." 2017-11-30 19:53:39 +00:00