Commit graph

9180 commits

Author SHA1 Message Date
Orion Hodson
dca7d3fae5 Merge "libc: Add membarrier to common seccomp allowed list" 2018-09-07 09:46:08 +00:00
Treehugger Robot
dc91d900ae Merge "bionic: Add magic to abort message" 2018-09-07 01:32:14 +00:00
Elliott Hughes
e15e93a247 Merge "Use strerror_r(3) for the printf family %m." 2018-09-06 23:45:18 +00:00
Luis Hector Chavez
6d93c60778 bionic: Add magic to abort message
This change adds a 128-bit magic value just before the abort message
(and its length). This allows Chrome OS crash collector (which cannot
reliably correlate a crash with its corresponding tombstone) to extract
the abort message from the core dump.

Bug: 62387553
Test: /data/nativetest{,64}/debuggerd_test/*
Test: /data/nativetest{,64}/bionic-unit-tests{,-static}/*

Change-Id: I69ff021d773b3a10081ab16ddf6f23233320fb02
2018-09-06 15:18:21 -07:00
Treehugger Robot
a2a114ba26 Merge "Annotate siglongjmp for HWASan." 2018-09-06 21:35:09 +00:00
Elliott Hughes
f340a56d1c Use strerror_r(3) for the printf family %m.
There's TLS space used for unknown errno values, and a call to printf
shouldn't clobber that. No-one will ever hit this in real life, but
since it's easily fixed...

Bug: http://b/112776560
Test: ran tests
Change-Id: I8c2437f2e5214e652119791d4e162a197b049d5b
2018-09-06 10:42:40 -07:00
Orion Hodson
6ba6694ec2 libc: Add membarrier to common seccomp allowed list
Allows ART JIT use membarrier to invalidate instruction
pipelines.

Bug: 66095511
Test: bionic-unit-tests
Change-Id: I8cf83929f00baf5a3c440a899d2667a992bda8e2
2018-09-06 16:36:09 +01:00
Evgenii Stepanov
b16e9ce7b8 Annotate siglongjmp for HWASan.
HWASan needs to re-tag the newly unallocated stack space to match SP.

Bug: 112438058
Test: SANITIZE_TARGET=hwaddress

Change-Id: I4dddef542d802d63bdea59e32a03425a2c4f870b
2018-09-05 13:37:14 -07:00
Elliott Hughes
74934aaf10 Merge "Add the %m GNU extension to printf/wprintf." 2018-09-05 18:47:44 +00:00
Treehugger Robot
198fb7b6df Merge "Prevent netd from using the libnetd_client wrappers" 2018-09-05 15:22:59 +00:00
Bernie Innocenti
1b2ecee5da Prevent netd from using the libnetd_client wrappers
Netd looping connections to itself via the libnetd_client connect()
wrapper has always unintended, although it worked until now. Once we
move the resolver into netd, the frequency of connect() calls will
increase, which makes it less acceptable.

There are several ways to detect if the calling process is netd.
Checking both uid == 0 and the argv[0] == netd makes it hard for
non-system components to spoof as netd.

Test: flash a device and check that netd logs the "Skipping..." message
Test: atest netd_integration_test
Change-Id: I9506facb4aa3094b16a98a913a1e2394056ce91a
2018-09-05 17:43:42 +09:00
Treehugger Robot
c69757a2d5 Merge "Generalize abort's inline_tgkill, use it in fdsan." 2018-09-04 21:59:54 +00:00
Evgenii Stepanov
0425a2db07 Merge "(arm64) Extend branch range in __memcpy_chk." 2018-09-04 20:28:44 +00:00
Josh Gao
f5693c688d Generalize abort's inline_tgkill, use it in fdsan.
Convert abort's inline_tgkill to do the equivalent of
pthread_sigqueue(pthread_self(), ...), so that we can use it in fdsan
as well.

Test: bionic-unit-tests
Test: debuggerd_test32
Test: debuggerd_test64
Change-Id: I92a7b84e2f00ce021b4043ed8a3bd8683d77fe9c
2018-08-31 16:39:23 -07:00
Evgenii Stepanov
00d087c629 (arm64) Extend branch range in __memcpy_chk.
Conditional branch has limited range (1MB) and can not be extended by
the linker. The current distance (in walleye build) is 500KB, about
half of the maximum. HWASan pushes it over the limit.

Replace conditional branch with regular branch, which has longer
range (26 vs 19 bits offset) and can be extended in the linker if
needed.

Bug: 112437884
Bug: 12231437
Test: SANITIZE_TARGET=hwaddress

Change-Id: Idc083fb557ab3a859541beb009809992406a6703
2018-08-31 15:02:12 -07:00
Josh Gao
ab6a0802af fdsan: add type for ART's FdFile.
Bug: http://b/113558485
Test: none
Change-Id: I9bc874d8689cc54563f2a5878d324b27ad85060e
2018-08-30 17:37:52 -07:00
Elliott Hughes
654cd8331b Add the %m GNU extension to printf/wprintf.
And remove the local hack from syslog(3).

Bug: http://b/112776560
Test: ran tests
Change-Id: I5807e729a978df26187ea0ee255bba4ca74220c8
2018-08-30 16:00:42 -07:00
Elliott Hughes
222ce95c8a Remove ARM/MIPS fenv duplication.
Bug: http://b/32709207
Test: ran tests
Change-Id: I58d354e9f8b1e6023427ba271bf39e4e24b7f8ab
2018-08-30 09:26:43 -07:00
Treehugger Robot
003521af47 Merge "Document the set*id functions." 2018-08-28 22:52:31 +00:00
Treehugger Robot
6ef10547e9 Merge "Accept NULL for fds parameter in poll." 2018-08-28 22:41:25 +00:00
Chih-Hung Hsieh
4be542629a Accept NULL for fds parameter in poll.
* Some callers, e.g. external/curl/lib/select.c, do
  poll(NULL, 0, ...) and get clang-diagnostic-nonnull check error.

Test: build with WITH_TIDY=1
Bug: 111850071
Change-Id: I7ea433d185cb84011a954f05964181b5518febd4
2018-08-28 14:20:15 -07:00
Josh Gao
cd524ca71f Merge changes from topic "fdsan_abort_msg"
* changes:
  fdsan: provide abort message in warning tombstones.
  Implement pthread_sigqueue.
  Stringify api_level in <android/versioning.h>.
  Delete archaic pre-ANSI C support.
2018-08-28 20:20:21 +00:00
Treehugger Robot
ec247245de Merge changes from topic "bionic_fdsan_java"
* changes:
  fdsan: make the tag type values sequential.
  fdsan: expose functions to get and interpret tags.
2018-08-28 20:17:59 +00:00
Elliott Hughes
9c6017778b Document the set*id functions.
In particular, document the fact that they only affect the calling thread
on Android.

Bug: http://b/13134174
Test: ran tests
Change-Id: Ica6af451400d47e24358f59495ded63b2110eb8b
2018-08-28 12:17:20 -07:00
Treehugger Robot
24107698b4 Merge "Add fdsan owner type for sqlite." 2018-08-28 00:16:34 +00:00
Josh Gao
be66a06412 fdsan: provide abort message in warning tombstones.
Bug: http://b/112770187
Test: debuggerd_test
Test: bionic-unit-tests
Test: crasher fdsan_file
Change-Id: I55e18eafaee8b0c35bacd2795b7830bcb9d59291
2018-08-27 16:48:17 -07:00
Josh Gao
726b63f725 Implement pthread_sigqueue.
Bug: http://b/112770187
Test: bionic-unit-tests
Change-Id: I03382cd5df2490b2e87265dba9007e2cb1b14cd2
2018-08-27 16:48:17 -07:00
Josh Gao
f3aa3007e3 Stringify api_level in <android/versioning.h>.
Make it so that we can use __ANDROID_API_<letter>__ constants in
__INTRODUCED_IN macros.

Test: treehugger
Change-Id: I0929c01e23e58f51d12f73200e1daf5ef484ea5d
2018-08-27 16:48:17 -07:00
Josh Gao
1dc2503e1a Delete archaic pre-ANSI C support.
Test: treehugger
Change-Id: I02e7887a18d947e657f32760d57e58f8b3295fd8
2018-08-27 16:48:15 -07:00
Elliott Hughes
062eac88b5 <sys/socket.h>: add constant for kernel TLS.
Bug: N/A
Test: builds
Change-Id: I53e8dde1131fec781bee5371c03d4eb54cab9722
2018-08-27 11:27:06 -07:00
Elliott Hughes
4b9379c889 Merge "Start documenting libc." 2018-08-24 17:16:53 +00:00
Josh Gao
c1b4476808 fdsan: make the tag type values sequential.
In retrospect, allocating tag types from both ends will just make the
future creation of user-defined tags harder, because constants that are
introduced, and then used in previous versions might collide with
user-defined tags. Move all of the tag values to the front, so that we
can allocate from the end to minimize this.

Test: bionic_unit_tests
Change-Id: I5063adf8301b1063bd4931a6ce8b70dfe2411efd
2018-08-23 23:10:52 -07:00
Josh Gao
27cc4bc414 Add fdsan owner type for sqlite.
Test: none
Change-Id: Ib331d108e7e0431250eba3609f3557d8e4665aba
2018-08-23 23:10:52 -07:00
Josh Gao
b6b3a1d4f9 fdsan: expose functions to get and interpret tags.
Make it easier to write tests in users of fdsan by exposing functions
to allow users to get and interpret the tags.

Test: bionic_unit_tests
Change-Id: Iafa9bcaeb5e4db230f3dfec6f483274f34602694
2018-08-23 23:10:52 -07:00
Elliott Hughes
462e90cf4d Start documenting libc.
Bug: N/A
Test: N/A
Change-Id: I17345cb72a5ffc3af1688cf5874589cfb1e1fea0
2018-08-23 11:03:17 -07:00
Treehugger Robot
780cc6b189 Merge "Folks are starting to need a placeholder name for Q." 2018-08-22 20:11:19 +00:00
Elliott Hughes
cf97d7f121 Folks are starting to need a placeholder name for Q.
Better to just have one place to update...

Bug: N/A
Test: builds
Change-Id: If7135d26f498b0841f9ae505bf6ca3ed05767345
2018-08-22 10:50:29 -07:00
Elliott Hughes
99d54656bd Add PR_SET_VMA and PR_SET_VMA_ANON_NAME to <sys/prctl.h>.
We've copied & pasted these to too many places. And if we're going to
have another go at upstreaming these, that's probably yet another reason
to have the *values* in just one place. (Even if upstream wants different
names, we'll likely keep the legacy names around for a while for source
compatibility.)

Bug: http://b/111903542
Test: ran tests
Change-Id: I8ccc557453d69530e5b74f865cbe0b458c84e3ba
2018-08-22 10:36:23 -07:00
Adhemerval Zanella
65a6211f4d [AArch64] Improve strncmp for mutually misaligned inputs
This patch was originally written by Siddhesh Poyarekar and pushed on
cortex-strings [1]. The mutually misaligned inputs on aarch64 are
compared with a simple byte copy, which is not very efficient.
This patch enhances the comparison similar to strcmp by loading a
double-word at a time.

Comparison on the default bionic and proposed optimized routines
shows the following performance improvements on A54 (using the
new proposed memcmp input data from test_strncmp.xml):

  - No noticeable change on aligned inputs or with same alignment.

  - Large improvements on unaligned inputs from sizes larger than
    16 bytes.

Benchmark                               Time             CPU      Time Old      Time New       CPU Old       CPU New
--------------------------------------------------------------------------------------------------------------------
BM_string_strncmp/1/0/0              -0.0954         -0.0954            19            17            19            17
BM_string_strncmp/2/0/0              -0.0344         -0.0344            19            18            19            18
BM_string_strncmp/3/0/0              +0.1768         +0.1768            15            18            15            18
BM_string_strncmp/4/0/0              -0.0344         -0.0344            19            18            19            18
BM_string_strncmp/5/0/0              -0.0344         -0.0344            19            18            19            18
BM_string_strncmp/6/0/0              +0.1589         +0.1589            15            18            15            18
BM_string_strncmp/7/0/0              -0.0344         -0.0344            19            18            19            18
BM_string_strncmp/8/0/0              -0.0998         -0.0998            19            17            19            17
BM_string_strncmp/9/0/0              -0.0277         -0.0277            23            22            23            22
BM_string_strncmp/10/0/0             -0.0270         -0.0270            23            22            23            22
BM_string_strncmp/11/0/0             -0.0331         -0.0331            23            22            23            22
BM_string_strncmp/12/0/0             -0.0270         -0.0270            23            22            23            22
BM_string_strncmp/13/0/0             -0.0284         -0.0284            23            22            23            22
BM_string_strncmp/14/0/0             +0.1042         +0.1042            20            22            20            22
BM_string_strncmp/15/0/0             -0.0277         -0.0277            23            22            23            22
BM_string_strncmp/16/0/0             +0.0214         +0.0215            22            22            22            22
BM_string_strncmp/24/0/0             -0.1291         -0.1291            24            21            24            21
BM_string_strncmp/32/0/0             -0.0470         -0.0470            27            26            27            26
BM_string_strncmp/40/0/0             -0.0433         -0.0433            29            28            29            28
BM_string_strncmp/48/0/0             -0.0301         -0.0301            31            30            31            30
BM_string_strncmp/56/0/0             -0.0800         -0.0800            33            31            33            31
BM_string_strncmp/64/0/0             +0.0188         +0.0188            34            34            34            34
BM_string_strncmp/72/0/0             -0.0334         -0.0334            38            37            38            37
BM_string_strncmp/80/0/0             -0.0000         -0.0000            40            40            40            40
BM_string_strncmp/88/0/0             +0.0413         +0.0413            61            64            61            64
BM_string_strncmp/96/0/0             -0.0215         -0.0216            69            67            69            67
BM_string_strncmp/104/0/0            -0.0208         -0.0208            72            70            72            70
BM_string_strncmp/112/0/0            -0.0173         -0.0173            75            74            75            74
BM_string_strncmp/120/0/0            -0.0166         -0.0166            78            77            78            77
BM_string_strncmp/128/0/0            -0.0158         -0.0158            81            80            81            80
BM_string_strncmp/136/0/0            -0.0149         -0.0149            84            83            84            83
BM_string_strncmp/144/0/0            -0.0201         -0.0201            88            86            88            86
BM_string_strncmp/160/0/0            -0.0136         -0.0136            94            93            94            93
BM_string_strncmp/176/0/0            +0.0224         +0.0224            96            98            96            98
BM_string_strncmp/192/0/0            +0.0289         +0.0289           102           105           102           105
BM_string_strncmp/208/0/0            +0.0101         +0.0101           111           112           111           112
BM_string_strncmp/224/0/0            -0.0107         -0.0107           119           118           119           118
BM_string_strncmp/240/0/0            -0.0088         -0.0088           126           125           126           125
BM_string_strncmp/256/0/0            -0.0101         -0.0101           132           131           132           131
BM_string_strncmp/512/0/0            -0.0056         -0.0056           235           233           235           233
BM_string_strncmp/1024/0/0           -0.0030         -0.0030           439           437           439           437
BM_string_strncmp/8192/0/0           -0.0431         -0.0431          3799          3635          3799          3635
BM_string_strncmp/16384/0/0          -0.0069         -0.0069          6778          6732          6779          6732
BM_string_strncmp/32768/0/0          -0.0001         -0.0002         13405         13403         13405         13403
BM_string_strncmp/65536/0/0          +0.0005         +0.0005         26968         26981         26968         26981
BM_string_strncmp/131072/0/0         -0.0057         -0.0057         53959         53650         53958         53650
BM_string_strncmp/1/4/0              -0.1352         -0.1352            12            10            12            10
BM_string_strncmp/2/4/0              +0.0020         +0.0020            15            15            15            15
BM_string_strncmp/3/4/0              -0.1560         -0.1560            20            17            20            17
BM_string_strncmp/4/4/0              +0.0296         +0.0296            22            22            22            22
BM_string_strncmp/5/4/0              +0.0573         +0.0573            22            23            22            23
BM_string_strncmp/6/4/0              -0.0340         -0.0340            25            24            25            24
BM_string_strncmp/7/4/0              +0.0185         +0.0185            26            26            26            26
BM_string_strncmp/8/4/0              -0.0050         -0.0050            27            27            27            27
BM_string_strncmp/9/4/0              -0.1294         -0.1294            28            24            28            24
BM_string_strncmp/10/4/0             +0.0109         +0.0109            29            29            29            29
BM_string_strncmp/11/4/0             -0.0000         -0.0001            30            30            30            30
BM_string_strncmp/12/4/0             +0.0055         +0.0055            50            50            50            50
BM_string_strncmp/13/4/0             -0.0249         -0.0249            51            50            51            50
BM_string_strncmp/14/4/0             -0.0289         -0.0289            53            52            53            52
BM_string_strncmp/15/4/0             -0.0205         -0.0205            55            54            55            54
BM_string_strncmp/16/4/0             -0.4616         -0.4616            57            31            57            31
BM_string_strncmp/24/4/0             -0.4871         -0.4871            72            37            72            37
BM_string_strncmp/32/4/0             -0.5549         -0.5549            87            39            87            39
BM_string_strncmp/40/4/0             -0.5964         -0.5964           103            42           103            42
BM_string_strncmp/48/4/0             -0.6647         -0.6647           118            40           118            40
BM_string_strncmp/56/4/0             -0.6551         -0.6551           134            46           134            46
BM_string_strncmp/64/4/0             -0.6609         -0.6609           145            49           145            49
BM_string_strncmp/72/4/0             -0.5709         -0.5710           164            70           164            70
BM_string_strncmp/80/4/0             -0.5929         -0.5929           180            73           180            73
BM_string_strncmp/88/4/0             -0.6051         -0.6051           195            77           195            77
BM_string_strncmp/96/4/0             -0.6160         -0.6160           210            81           210            81
BM_string_strncmp/104/4/0            -0.6199         -0.6199           223            85           223            85
BM_string_strncmp/112/4/0            -0.6293         -0.6293           240            89           240            89
BM_string_strncmp/120/4/0            -0.6439         -0.6439           255            91           255            91
BM_string_strncmp/128/4/0            -0.6493         -0.6493           271            95           271            95
BM_string_strncmp/136/4/0            -0.6704         -0.6704           287            95           287            95
BM_string_strncmp/144/4/0            -0.6744         -0.6744           302            98           302            98
BM_string_strncmp/160/4/0            -0.6700         -0.6700           333           110           333           110
BM_string_strncmp/176/4/0            -0.6821         -0.6821           364           116           364           116
BM_string_strncmp/192/4/0            -0.6887         -0.6887           394           123           394           123
BM_string_strncmp/208/4/0            -0.6949         -0.6949           425           130           425           130
BM_string_strncmp/224/4/0            -0.7069         -0.7069           456           134           456           134
BM_string_strncmp/240/4/0            -0.7042         -0.7042           486           144           486           144
BM_string_strncmp/256/4/0            -0.7043         -0.7043           514           152           514           152
BM_string_strncmp/1/0/4              +0.0227         +0.0227            14            14            14            14
BM_string_strncmp/2/0/4              +0.0442         +0.0442            15            16            15            16
BM_string_strncmp/3/0/4              +0.5829         +0.5829            17            27            17            27
BM_string_strncmp/4/0/4              -0.1593         -0.1593            22            19            22            19
BM_string_strncmp/5/0/4              -0.0516         -0.0516            23            22            23            22
BM_string_strncmp/6/0/4              -0.1684         -0.1684            25            20            25            20
BM_string_strncmp/7/0/4              +0.0170         +0.0170            26            26            26            26
BM_string_strncmp/8/0/4              +0.0006         +0.0006            27            27            27            27
BM_string_strncmp/9/0/4              +0.1272         +0.1272            25            28            25            28
BM_string_strncmp/10/0/4             +0.0108         +0.0108            29            29            29            29
BM_string_strncmp/11/0/4             -0.0001         -0.0001            30            30            30            30
BM_string_strncmp/12/0/4             -0.3557         -0.3557            50            32            50            32
BM_string_strncmp/13/0/4             -0.3370         -0.3370            51            34            51            34
BM_string_strncmp/14/0/4             -0.3444         -0.3444            53            35            53            35
BM_string_strncmp/15/0/4             +0.0946         +0.0946            51            56            51            56
BM_string_strncmp/16/0/4             -0.5203         -0.5203            53            25            53            25
BM_string_strncmp/24/0/4             -0.6109         -0.6109            72            28            72            28
BM_string_strncmp/32/0/4             -0.6934         -0.6934            88            27            88            27
BM_string_strncmp/40/0/4             -0.6833         -0.6833           103            33           103            33
BM_string_strncmp/48/0/4             -0.6973         -0.6973           118            36           118            36
BM_string_strncmp/56/0/4             -0.7116         -0.7116           134            39           134            39
BM_string_strncmp/64/0/4             -0.6017         -0.6018           149            59           149            59
BM_string_strncmp/72/0/4             -0.6268         -0.6268           164            61           164            61
BM_string_strncmp/80/0/4             -0.6409         -0.6409           179            64           179            64
BM_string_strncmp/88/0/4             -0.6465         -0.6465           195            69           195            69
BM_string_strncmp/96/0/4             -0.6551         -0.6551           210            72           210            72
BM_string_strncmp/104/0/4            -0.6662         -0.6662           227            76           227            76
BM_string_strncmp/112/0/4            -0.6700         -0.6700           240            79           240            79
BM_string_strncmp/120/0/4            -0.6740         -0.6740           256            83           256            83
BM_string_strncmp/128/0/4            -0.6862         -0.6862           271            85           271            85
BM_string_strncmp/136/0/4            -0.6883         -0.6883           287            89           287            89
BM_string_strncmp/144/0/4            -0.7031         -0.7031           297            88           297            88
BM_string_strncmp/160/0/4            -0.6985         -0.6985           333           100           333           100
BM_string_strncmp/176/0/4            -0.7082         -0.7082           364           106           364           106
BM_string_strncmp/192/0/4            -0.7223         -0.7223           396           110           396           110
BM_string_strncmp/208/0/4            -0.7135         -0.7135           421           121           421           121
BM_string_strncmp/224/0/4            -0.7194         -0.7194           455           128           455           128
BM_string_strncmp/240/0/4            -0.7233         -0.7233           487           135           487           135
BM_string_strncmp/256/0/4            -0.7239         -0.7239           516           143           516           143
BM_string_strncmp/1/4/4              +0.0224         +0.0225            21            22            21            22
BM_string_strncmp/2/4/4              -0.0001         -0.0001            22            22            22            22
BM_string_strncmp/3/4/4              -0.0001         -0.0001            22            22            22            22
BM_string_strncmp/4/4/4              -0.0435         -0.0435            22            21            22            21
BM_string_strncmp/5/4/4              -0.0118         -0.0118            27            27            27            27
BM_string_strncmp/6/4/4              -0.0118         -0.0118            27            27            27            27
BM_string_strncmp/7/4/4              -0.0117         -0.0117            27            27            27            27
BM_string_strncmp/8/4/4              -0.0118         -0.0118            27            27            27            27
BM_string_strncmp/9/4/4              -0.0117         -0.0117            27            27            27            27
BM_string_strncmp/10/4/4             +0.1447         +0.1447            23            27            23            27
BM_string_strncmp/11/4/4             -0.0062         -0.0062            27            27            27            27
BM_string_strncmp/12/4/4             -0.0454         -0.0454            28            27            28            27
BM_string_strncmp/13/4/4             -0.1507         -0.1507            29            24            29            24
BM_string_strncmp/14/4/4             -0.0003         -0.0003            29            29            29            29
BM_string_strncmp/15/4/4             -0.0002         -0.0003            29            29            29            29
BM_string_strncmp/16/4/4             +0.0047         +0.0047            29            29            29            29
BM_string_strncmp/24/4/4             -0.0104         -0.0104            31            30            31            30
BM_string_strncmp/32/4/4             -0.0290         -0.0290            33            32            33            32
BM_string_strncmp/40/4/4             -0.0189         -0.0189            34            33            34            33
BM_string_strncmp/48/4/4             -0.0059         -0.0059            36            36            36            36
BM_string_strncmp/56/4/4             +0.0000         +0.0000            39            39            39            39
BM_string_strncmp/64/4/4             +0.0000         +0.0000            42            42            42            42
BM_string_strncmp/72/4/4             +0.0000         +0.0000            45            45            45            45
BM_string_strncmp/80/4/4             +0.0391         +0.0392            65            68            65            68
BM_string_strncmp/88/4/4             -0.0090         -0.0090            71            70            71            70
BM_string_strncmp/96/4/4             -0.0034         -0.0034            74            74            74            74
BM_string_strncmp/104/4/4            -0.0482         -0.0482            77            73            77            73
BM_string_strncmp/112/4/4            +0.0387         +0.0387            77            80            77            80
BM_string_strncmp/120/4/4            -0.0072         -0.0073            84            83            84            83
BM_string_strncmp/128/4/4            -0.0071         -0.0071            87            86            87            86
BM_string_strncmp/136/4/4            +0.0366         +0.0366            86            89            86            89
BM_string_strncmp/144/4/4            -0.0068         -0.0068            93            93            93            93
BM_string_strncmp/160/4/4            -0.0064         -0.0064           100            99           100            99
BM_string_strncmp/176/4/4            -0.0063         -0.0063           106           105           106           105
BM_string_strncmp/192/4/4            -0.0012         -0.0012           112           112           112           112
BM_string_strncmp/208/4/4            -0.0098         -0.0098           119           118           119           118
BM_string_strncmp/224/4/4            -0.0050         -0.0050           125           125           125           125
BM_string_strncmp/240/4/4            -0.0060         -0.0060           132           131           132           131
BM_string_strncmp/256/4/4            -0.0046         -0.0046           138           137           138           137

[1] Commit id: 26cc4faec37a55529e5d0a39949f7b6ec81008f9

Test: bionic tests and benchmarks on aarch64.
Change-Id: Ied579d2044b4092fc95fad486af6541d1eb71dc3
2018-08-21 19:50:09 +00:00
Treehugger Robot
2019f96247 Merge "HWASan support in bionic." 2018-08-21 19:42:36 +00:00
Adhemerval Zanella
b42ff1b5c3 [AArch64] Improve strcmp performance for misaligned strings
This patch was originally written by Siddhesh Poyarekar and pushed on
cortex-strings [1]. Replace the simple byte-wise compare in the
misaligned case with a dword compare with page boundary checks in
place. For simplicity its uses a 4K page boundary so that it does not
have to query the actual page size on the system.

Comparison on the default bionic and proposed optimized routines
shows the following performance improvements on A64 (using the
new proposed memcmp input data from test_strcmp.xml):

  - Small improvement for aligned arguments with sizes up to 56 bytes
    (from 10% to 20%).

  - Large improvements for unaligned arguments for small sizes (from
    3 to 256 bytes).

Benchmark                              Time             CPU      Time Old      Time New       CPU Old       CPU New
-------------------------------------------------------------------------------------------------------------------
BM_string_strcmp/1/0/0              +0.0034         +0.0034            11            11            11            11
BM_string_strcmp/2/0/0              +0.0000         +0.0000            11            11            11            11
BM_string_strcmp/3/0/0              -0.1726         -0.1726            11             9            11             9
BM_string_strcmp/4/0/0              -0.1726         -0.1726            11             9            11             9
BM_string_strcmp/5/0/0              -0.1726         -0.1726            11             9            11             9
BM_string_strcmp/6/0/0              -0.1719         -0.1719            11             9            11             9
BM_string_strcmp/7/0/0              -0.1724         -0.1724            11             9            11             9
BM_string_strcmp/8/0/0              -0.1718         -0.1718            11             9            11             9
BM_string_strcmp/9/0/0              -0.2008         -0.2008            16            13            16            13
BM_string_strcmp/10/0/0             -0.2008         -0.2008            16            13            16            13
BM_string_strcmp/11/0/0             -0.2040         -0.2040            16            13            16            13
BM_string_strcmp/12/0/0             -0.1991         -0.1991            16            13            16            13
BM_string_strcmp/13/0/0             -0.1997         -0.1997            16            13            16            13
BM_string_strcmp/14/0/0             -0.1988         -0.1989            16            13            16            13
BM_string_strcmp/15/0/0             -0.2006         -0.2006            16            13            16            13
BM_string_strcmp/16/0/0             -0.2043         -0.2043            16            13            16            13
BM_string_strcmp/24/0/0             -0.1927         -0.1927            18            15            18            15
BM_string_strcmp/32/0/0             -0.1743         -0.1743            20            17            20            17
BM_string_strcmp/40/0/0             -0.1427         -0.1427            22            19            22            19
BM_string_strcmp/48/0/0             -0.1053         -0.1053            24            22            24            22
BM_string_strcmp/56/0/0             -0.0805         -0.0805            26            24            26            24
BM_string_strcmp/64/0/0             -0.0454         -0.0454            28            27            28            27
BM_string_strcmp/72/0/0             -0.0303         -0.0303            30            29            30            29
BM_string_strcmp/80/0/0             -0.0111         -0.0111            32            32            32            32
BM_string_strcmp/88/0/0             -0.0004         -0.0004            34            34            34            34
BM_string_strcmp/96/0/0             -0.0058         -0.0058            37            37            37            37
BM_string_strcmp/104/0/0            +0.0000         +0.0000            40            40            40            40
BM_string_strcmp/112/0/0            -0.0457         -0.0457            61            58            61            58
BM_string_strcmp/120/0/0            -0.0486         -0.0487            61            58            61            58
BM_string_strcmp/128/0/0            -0.0499         -0.0499            64            61            64            61
BM_string_strcmp/136/0/0            -0.0529         -0.0529            66            63            66            63
BM_string_strcmp/144/0/0            -0.0492         -0.0492            69            66            69            66
BM_string_strcmp/160/0/0            -0.0459         -0.0459            74            71            74            71
BM_string_strcmp/176/0/0            -0.0400         -0.0401            79            76            79            76
BM_string_strcmp/192/0/0            -0.0378         -0.0378            85            81            85            81
BM_string_strcmp/208/0/0            -0.0009         -0.0009            89            89            89            89
BM_string_strcmp/224/0/0            -0.0003         -0.0003            95            95            95            95
BM_string_strcmp/240/0/0            -0.0320         -0.0320           100            96           100            96
BM_string_strcmp/256/0/0            -0.0303         -0.0304           105           102           105           102
BM_string_strcmp/512/0/0            -0.0171         -0.0171           187           183           187           183
BM_string_strcmp/1024/0/0           -0.0091         -0.0091           350           347           350           347
BM_string_strcmp/8192/0/0           -0.0030         -0.0031          2668          2660          2668          2660
BM_string_strcmp/16384/0/0          +0.0007         +0.0007          5449          5452          5448          5452
BM_string_strcmp/32768/0/0          +0.0635         +0.0635         10868         11558         10867         11557
BM_string_strcmp/65536/0/0          -0.0017         -0.0017         21824         21786         21822         21784
BM_string_strcmp/131072/0/0         +0.0012         +0.0012         43485         43536         43480         43532
BM_string_strcmp/1/4/0              +0.7630         +0.7630             7            12             7            12
BM_string_strcmp/2/4/0              +0.9265         +0.9265            12            23            12            23
BM_string_strcmp/3/4/0              -0.0000         -0.0000            14            14            14            14
BM_string_strcmp/4/4/0              +0.0372         +0.0372            19            19            19            19
BM_string_strcmp/6/4/0              -0.0921         -0.0921            20            19            20            19
BM_string_strcmp/7/4/0              -0.0291         -0.0291            19            19            19            19
BM_string_strcmp/8/4/0              +0.0648         +0.0648            20            22            20            22
BM_string_strcmp/9/4/0              +0.0001         -0.0055            22            22            22            22
BM_string_strcmp/10/4/0             -0.1924         -0.1924            23            19            23            19
BM_string_strcmp/11/4/0             -0.2347         -0.2347            24            19            24            19
BM_string_strcmp/12/4/0             -0.2738         -0.2739            26            19            26            19
BM_string_strcmp/13/4/0             -0.3804         -0.3804            42            26            42            26
BM_string_strcmp/14/4/0             -0.3581         -0.3582            41            26            41            26
BM_string_strcmp/15/4/0             -0.3905         -0.3905            43            26            43            26
BM_string_strcmp/16/4/0             -0.4068         -0.4068            44            26            44            26
BM_string_strcmp/24/4/0             -0.4917         -0.4917            57            29            57            29
BM_string_strcmp/32/4/0             -0.5607         -0.5607            70            31            70            31
BM_string_strcmp/40/4/0             -0.5940         -0.5940            82            33            82            33
BM_string_strcmp/48/4/0             -0.5303         -0.5302            95            45            95            45
BM_string_strcmp/56/4/0             -0.4975         -0.4975           108            54           108            54
BM_string_strcmp/64/4/0             -0.5167         -0.5167           121            58           121            58
BM_string_strcmp/72/4/0             -0.5325         -0.5325           133            62           133            62
BM_string_strcmp/80/4/0             -0.5523         -0.5523           146            65           146            65
BM_string_strcmp/88/4/0             -0.5686         -0.5686           159            69           159            69
BM_string_strcmp/96/4/0             -0.5815         -0.5815           172            72           172            72
BM_string_strcmp/104/4/0            -0.5931         -0.5931           185            75           185            75
BM_string_strcmp/112/4/0            -0.6046         -0.6046           197            78           197            78
BM_string_strcmp/120/4/0            -0.6113         -0.6113           210            82           210            82
BM_string_strcmp/128/4/0            -0.6186         -0.6186           223            85           223            85
BM_string_strcmp/136/4/0            -0.6278         -0.6278           237            88           237            88
BM_string_strcmp/144/4/0            -0.6410         -0.6410           253            91           253            91
BM_string_strcmp/160/4/0            -0.6506         -0.6506           280            98           280            98
BM_string_strcmp/176/4/0            -0.6593         -0.6593           304           104           304           104
BM_string_strcmp/192/4/0            -0.6647         -0.6647           330           111           330           111
BM_string_strcmp/208/4/0            -0.6741         -0.6741           357           116           357           116
BM_string_strcmp/224/4/0            -0.6761         -0.6761           381           123           381           123
BM_string_strcmp/240/4/0            -0.6824         -0.6824           406           129           406           129
BM_string_strcmp/256/4/0            -0.6846         -0.6846           432           136           432           136
BM_string_strcmp/1/0/4              +1.0024         +1.0024             7            14             7            14
BM_string_strcmp/2/0/4              +0.1591         +0.1591            12            14            12            14
BM_string_strcmp/3/0/4              -0.0015         -0.0015            14            14            14            14
BM_string_strcmp/4/0/4              -0.0809         -0.0809            15            14            15            14
BM_string_strcmp/5/0/4              -0.1535         -0.1536            17            14            17            14
BM_string_strcmp/6/0/4              -0.2111         -0.2111            18            14            18            14
BM_string_strcmp/7/0/4              -0.2650         -0.2650            19            14            19            14
BM_string_strcmp/8/0/4              -0.3118         -0.3118            20            14            20            14
BM_string_strcmp/9/0/4              -0.1741         -0.1740            22            18            22            18
BM_string_strcmp/10/0/4             -0.2201         -0.2201            23            18            23            18
BM_string_strcmp/11/0/4             -0.2610         -0.2610            24            18            24            18
BM_string_strcmp/12/0/4             -0.2987         -0.2987            26            18            26            18
BM_string_strcmp/13/0/4             -0.5748         -0.5748            42            18            42            18
BM_string_strcmp/14/0/4             -0.5796         -0.5796            43            18            43            18
BM_string_strcmp/15/0/4             -0.6167         -0.6167            47            18            47            18
BM_string_strcmp/16/0/4             -0.6303         -0.6303            49            18            49            18
BM_string_strcmp/24/0/4             -0.6557         -0.6557            61            21            61            21
BM_string_strcmp/32/0/4             -0.6612         -0.6612            70            24            70            24
BM_string_strcmp/40/0/4             -0.6812         -0.6813            82            26            82            26
BM_string_strcmp/48/0/4             -0.6974         -0.6974            95            29            95            29
BM_string_strcmp/56/0/4             -0.7151         -0.7151           108            31           108            31
BM_string_strcmp/64/0/4             -0.5717         -0.5717           121            52           121            52
BM_string_strcmp/72/0/4             -0.5927         -0.5927           134            54           134            54
BM_string_strcmp/80/0/4             -0.6004         -0.6004           146            58           146            58
BM_string_strcmp/88/0/4             -0.6145         -0.6145           159            61           159            61
BM_string_strcmp/96/0/4             -0.6287         -0.6287           172            64           172            64
BM_string_strcmp/104/0/4            -0.6351         -0.6351           185            67           185            67
BM_string_strcmp/112/0/4            -0.6423         -0.6423           197            71           197            71
BM_string_strcmp/120/0/4            -0.6489         -0.6489           210            74           210            74
BM_string_strcmp/128/0/4            -0.6578         -0.6578           223            76           223            76
BM_string_strcmp/136/0/4            -0.6597         -0.6597           236            80           236            80
BM_string_strcmp/144/0/4            -0.6674         -0.6674           250            83           250            83
BM_string_strcmp/160/0/4            -0.6751         -0.6751           274            89           274            89
BM_string_strcmp/176/0/4            -0.6798         -0.6798           300            96           300            96
BM_string_strcmp/192/0/4            -0.6873         -0.6855           327           102           325           102
BM_string_strcmp/208/0/4            -0.6903         -0.6903           351           109           351           109
BM_string_strcmp/224/0/4            -0.6907         -0.6907           376           116           376           116
BM_string_strcmp/240/0/4            -0.6897         -0.6897           402           125           402           125
BM_string_strcmp/256/0/4            -0.6937         -0.6937           427           131           427           131
BM_string_strcmp/1/4/4              +0.0009         +0.0009            14            14            14            14
BM_string_strcmp/2/4/4              -0.2229         -0.2229            14            11            14            11
BM_string_strcmp/3/4/4              -0.2256         -0.2256            14            11            14            11
BM_string_strcmp/4/4/4              -0.2241         -0.2240            14            11            14            11
BM_string_strcmp/5/4/4              -0.2220         -0.2220            20            15            20            15
BM_string_strcmp/6/4/4              -0.2267         -0.2267            20            15            20            15
BM_string_strcmp/7/4/4              -0.2228         -0.2227            20            15            20            15
BM_string_strcmp/8/4/4              -0.2219         -0.2219            20            15            20            15
BM_string_strcmp/9/4/4              -0.2220         -0.2220            20            15            20            15
BM_string_strcmp/10/4/4             -0.2227         -0.2227            20            15            20            15
BM_string_strcmp/11/4/4             -0.2210         -0.2210            20            15            20            15
BM_string_strcmp/12/4/4             -0.2224         -0.2224            20            15            20            15
BM_string_strcmp/13/4/4             -0.1778         -0.1778            21            17            21            17
BM_string_strcmp/14/4/4             -0.1863         -0.1863            21            17            21            17
BM_string_strcmp/15/4/4             -0.1780         -0.1780            21            17            21            17
BM_string_strcmp/16/4/4             +0.0031         +0.0031            21            21            21            21
BM_string_strcmp/24/4/4             +0.0041         +0.0041            24            24            24            24
BM_string_strcmp/32/4/4             -0.0001         -0.0000            25            25            25            25
BM_string_strcmp/40/4/4             +0.0016         +0.0016            26            26            26            26
BM_string_strcmp/48/4/4             +0.0001         +0.0001            28            28            28            28
BM_string_strcmp/56/4/4             -0.0001         -0.0001            30            30            30            30
BM_string_strcmp/64/4/4             -0.0342         -0.0342            32            31            32            31
BM_string_strcmp/72/4/4             -0.0186         -0.0186            34            34            34            34
BM_string_strcmp/80/4/4             +0.0004         +0.0004            36            36            36            36
BM_string_strcmp/88/4/4             -0.0000         -0.0000            39            39            39            39
BM_string_strcmp/96/4/4             -0.0510         -0.0510            62            59            62            59
BM_string_strcmp/104/4/4            -0.0502         -0.0502            63            60            63            60
BM_string_strcmp/112/4/4            -0.0490         -0.0490            65            62            65            62
BM_string_strcmp/120/4/4            -0.0387         -0.0387            67            65            67            65
BM_string_strcmp/128/4/4            -0.0426         -0.0426            70            67            70            67
BM_string_strcmp/136/4/4            -0.0408         -0.0408            73            70            73            70
BM_string_strcmp/144/4/4            -0.0194         -0.0194            75            74            75            74
BM_string_strcmp/160/4/4            -0.0035         -0.0035            81            81            81            81
BM_string_strcmp/176/4/4            -0.0001         -0.0001            86            86            86            86
BM_string_strcmp/192/4/4            -0.0002         -0.0002            91            91            91            91
BM_string_strcmp/208/4/4            -0.0335         -0.0335            96            93            96            93
BM_string_strcmp/224/4/4            -0.0314         -0.0314           101            98           101            98
BM_string_strcmp/240/4/4            -0.0303         -0.0303           106           103           106           103
BM_string_strcmp/256/4/4            -0.0288         -0.0288           111           108           111           108

[1] Commit id: f98f2a6780d686ca3d44f8011c7823d42d9b083a

Test: bionic tests and benchmarks on aarch64.
Change-Id: I75f8948782b8bd459d21f15e75e1d420905f5e5a
2018-08-21 17:48:52 +00:00
Adhemerval Zanella
4ab56af82d [AArch64] Optimize memcmp for medium to large sizes
This patch was originally written by Siddhesh Poyarekar and pushed on
cortex-strings [1]. This improved memcmp provides a fast path for
compares up to 16 bytes and then compares 16 bytes at a time, thus
optimizing loads from both sources.

Comparison on the default bionic and proposed optimized routines
shows the following performance improvements on A72 (using the
new proposed memcmp input data from test_memcmp.xml):

Benchmark                               Time             CPU      Time Old      Time New       CPU Old       CPU New
--------------------------------------------------------------------------------------------------------------------
BM_string_memcmp/1/0/0               -0.2074         -0.2074            15            12            15            12
BM_string_memcmp/2/0/0               -0.5193         -0.5193            31            15            31            15
BM_string_memcmp/3/0/0               -0.1291         -0.1291            19            17            19            17
BM_string_memcmp/4/0/0               -0.2889         -0.2889            17            12            17            12
BM_string_memcmp/5/0/0               -0.2606         -0.2606            15            11            15            11
BM_string_memcmp/6/0/0               -0.1656         -0.1655            17            14            17            14
BM_string_memcmp/7/0/0               -0.1721         -0.1721            19            15            19            15
BM_string_memcmp/8/0/0               -0.3048         -0.3048            15            10            15            10
BM_string_memcmp/9/0/0               -0.3041         -0.3041            15            10            15            10
BM_string_memcmp/10/0/0              -0.3040         -0.3040            15            10            15            10
BM_string_memcmp/11/0/0              -0.3048         -0.3048            15            10            15            10
BM_string_memcmp/12/0/0              -0.3041         -0.3041            15            10            15            10
BM_string_memcmp/13/0/0              -0.3040         -0.3040            15            10            15            10
BM_string_memcmp/14/0/0              -0.3048         -0.3048            15            10            15            10
BM_string_memcmp/15/0/0              -0.3040         -0.3040            15            10            15            10
BM_string_memcmp/16/0/0              -0.3041         -0.3041            15            10            15            10
BM_string_memcmp/24/0/0              -0.1209         -0.1209            15            13            15            13
BM_string_memcmp/32/0/0              -0.3228         -0.3228            20            13            20            13
BM_string_memcmp/40/0/0              -0.2937         -0.2937            22            15            22            15
BM_string_memcmp/48/0/0              -0.3299         -0.3299            23            15            23            15
BM_string_memcmp/56/0/0              -0.1845         -0.1845            24            20            24            20
BM_string_memcmp/64/0/0              -0.2247         -0.2247            26            20            26            20
BM_string_memcmp/72/0/0              -0.1947         -0.1947            27            22            27            22
BM_string_memcmp/80/0/0              -0.2275         -0.2275            28            22            28            22
BM_string_memcmp/88/0/0              -0.2360         -0.2360            29            22            29            22
BM_string_memcmp/96/0/0              -0.2675         -0.2675            31            22            31            22
BM_string_memcmp/104/0/0             -0.2559         -0.2559            32            24            32            24
BM_string_memcmp/112/0/0             -0.2787         -0.2786            33            24            33            24
BM_string_memcmp/120/0/0             -0.2599         -0.2599            34            25            34            25
BM_string_memcmp/128/0/0             -0.2860         -0.2860            35            25            35            25
BM_string_memcmp/136/0/0             -0.4708         -0.4708            53            28            53            28
BM_string_memcmp/144/0/0             -0.4719         -0.4719            53            28            53            28
BM_string_memcmp/160/0/0             -0.4680         -0.4680            56            30            56            30
BM_string_memcmp/176/0/0             -0.4645         -0.4645            60            32            60            32
BM_string_memcmp/192/0/0             -0.4641         -0.4641            63            34            63            34
BM_string_memcmp/208/0/0             -0.4555         -0.4555            66            36            66            36
BM_string_memcmp/224/0/0             -0.4558         -0.4557            69            38            69            38
BM_string_memcmp/240/0/0             -0.4534         -0.4534            72            40            72            40
BM_string_memcmp/256/0/0             -0.4463         -0.4463            75            42            75            42
BM_string_memcmp/512/0/0             -0.3077         -0.3077           126            88           126            88
BM_string_memcmp/1024/0/0            -0.3493         -0.3493           229           149           229           149
BM_string_memcmp/8192/0/0            -0.4173         -0.4173          1729          1007          1729          1007
BM_string_memcmp/16384/0/0           -0.3855         -0.3855          3377          2076          3377          2075
BM_string_memcmp/32768/0/0           -0.2968         -0.2968          6847          4815          6847          4814
BM_string_memcmp/65536/0/0           -0.2496         -0.2496         13715         10292         13714         10291
BM_string_memcmp/131072/0/0          -0.2676         -0.2676         27354         20033         27351         20031
BM_string_memcmp/262144/0/0          -0.2319         -0.2319         54604         41943         54598         41939
BM_string_memcmp/524288/0/0          -0.2359         -0.2359        109225         83460        109212         83449
BM_string_memcmp/1048576/0/0         -0.0439         -0.0439        423367        404791        423251        404686
BM_string_memcmp/2097152/0/0         -0.0023         -0.0024        762470        760701        761956        760122
BM_string_memcmp/512/4/4             -0.2853         -0.2853           125            89           125            89
BM_string_memcmp/1024/4/4            -0.3377         -0.3377           228           151           227           151
BM_string_memcmp/8192/4/4            -0.4083         -0.4083          1706          1009          1706          1009
BM_string_memcmp/16384/4/4           -0.3853         -0.3853          3376          2075          3376          2075
BM_string_memcmp/32768/4/4           -0.2974         -0.2974          6846          4810          6845          4810
BM_string_memcmp/65536/4/4           -0.2485         -0.2485         13619         10235         13618         10234
BM_string_memcmp/131072/4/4          -0.2387         -0.2387         27056         20597         27054         20595
BM_string_memcmp/512/4/0             -0.2898         -0.2898           123            88           123            88
BM_string_memcmp/1024/4/0            -0.3401         -0.3401           225           149           225           149
BM_string_memcmp/8192/4/0            -0.4167         -0.4167          1727          1007          1727          1007
BM_string_memcmp/16384/4/0           -0.3820         -0.3820          3384          2092          3384          2091
BM_string_memcmp/32768/4/0           -0.2535         -0.2535          6886          5141          6886          5140
BM_string_memcmp/65536/4/0           -0.1897         -0.1897         13850         11223         13849         11223
BM_string_memcmp/131072/4/0          -0.1972         -0.1972         27536         22106         27533         22104
BM_string_memcmp/512/0/4             -0.2854         -0.2854           125            89           125            89
BM_string_memcmp/1024/0/4            -0.3332         -0.3333           226           151           226           151
BM_string_memcmp/8192/0/4            -0.4199         -0.4199          1740          1009          1740          1009
BM_string_memcmp/16384/0/4           -0.3811         -0.3811          3383          2094          3383          2094
BM_string_memcmp/32768/0/4           -0.2409         -0.2409          6900          5238          6899          5237
BM_string_memcmp/65536/0/4           -0.1920         -0.1920         13922         11250         13921         11248
BM_string_memcmp/131072/0/4          -0.2029         -0.2029         27699         22079         27697         22077

I see similar improvements on A54 as well:

Benchmark                               Time             CPU      Time Old      Time New       CPU Old       CPU New
--------------------------------------------------------------------------------------------------------------------
BM_string_memcmp/1/0/0               -0.2074         -0.2074            15            12            15            12
BM_string_memcmp/2/0/0               -0.5193         -0.5193            31            15            31            15
BM_string_memcmp/3/0/0               -0.1291         -0.1291            19            17            19            17
BM_string_memcmp/4/0/0               -0.2889         -0.2889            17            12            17            12
BM_string_memcmp/5/0/0               -0.2606         -0.2606            15            11            15            11
BM_string_memcmp/6/0/0               -0.1656         -0.1655            17            14            17            14
BM_string_memcmp/7/0/0               -0.1721         -0.1721            19            15            19            15
BM_string_memcmp/8/0/0               -0.3048         -0.3048            15            10            15            10
BM_string_memcmp/9/0/0               -0.3041         -0.3041            15            10            15            10
BM_string_memcmp/10/0/0              -0.3040         -0.3040            15            10            15            10
BM_string_memcmp/11/0/0              -0.3048         -0.3048            15            10            15            10
BM_string_memcmp/12/0/0              -0.3041         -0.3041            15            10            15            10
BM_string_memcmp/13/0/0              -0.3040         -0.3040            15            10            15            10
BM_string_memcmp/14/0/0              -0.3048         -0.3048            15            10            15            10
BM_string_memcmp/15/0/0              -0.3040         -0.3040            15            10            15            10
BM_string_memcmp/16/0/0              -0.3041         -0.3041            15            10            15            10
BM_string_memcmp/24/0/0              -0.1209         -0.1209            15            13            15            13
BM_string_memcmp/32/0/0              -0.3228         -0.3228            20            13            20            13
BM_string_memcmp/40/0/0              -0.2937         -0.2937            22            15            22            15
BM_string_memcmp/48/0/0              -0.3299         -0.3299            23            15            23            15
BM_string_memcmp/56/0/0              -0.1845         -0.1845            24            20            24            20
BM_string_memcmp/64/0/0              -0.2247         -0.2247            26            20            26            20
BM_string_memcmp/72/0/0              -0.1947         -0.1947            27            22            27            22
BM_string_memcmp/80/0/0              -0.2275         -0.2275            28            22            28            22
BM_string_memcmp/88/0/0              -0.2360         -0.2360            29            22            29            22
BM_string_memcmp/96/0/0              -0.2675         -0.2675            31            22            31            22
BM_string_memcmp/104/0/0             -0.2559         -0.2559            32            24            32            24
BM_string_memcmp/112/0/0             -0.2787         -0.2786            33            24            33            24
BM_string_memcmp/120/0/0             -0.2599         -0.2599            34            25            34            25
BM_string_memcmp/128/0/0             -0.2860         -0.2860            35            25            35            25
BM_string_memcmp/136/0/0             -0.4708         -0.4708            53            28            53            28
BM_string_memcmp/144/0/0             -0.4719         -0.4719            53            28            53            28
BM_string_memcmp/160/0/0             -0.4680         -0.4680            56            30            56            30
BM_string_memcmp/176/0/0             -0.4645         -0.4645            60            32            60            32
BM_string_memcmp/192/0/0             -0.4641         -0.4641            63            34            63            34
BM_string_memcmp/208/0/0             -0.4555         -0.4555            66            36            66            36
BM_string_memcmp/224/0/0             -0.4558         -0.4557            69            38            69            38
BM_string_memcmp/240/0/0             -0.4534         -0.4534            72            40            72            40
BM_string_memcmp/256/0/0             -0.4463         -0.4463            75            42            75            42
BM_string_memcmp/512/0/0             -0.3077         -0.3077           126            88           126            88
BM_string_memcmp/1024/0/0            -0.3493         -0.3493           229           149           229           149
BM_string_memcmp/8192/0/0            -0.4173         -0.4173          1729          1007          1729          1007
BM_string_memcmp/16384/0/0           -0.3855         -0.3855          3377          2076          3377          2075
BM_string_memcmp/32768/0/0           -0.2968         -0.2968          6847          4815          6847          4814
BM_string_memcmp/65536/0/0           -0.2496         -0.2496         13715         10292         13714         10291
BM_string_memcmp/131072/0/0          -0.2676         -0.2676         27354         20033         27351         20031
BM_string_memcmp/262144/0/0          -0.2319         -0.2319         54604         41943         54598         41939
BM_string_memcmp/524288/0/0          -0.2359         -0.2359        109225         83460        109212         83449
BM_string_memcmp/1048576/0/0         -0.0439         -0.0439        423367        404791        423251        404686
BM_string_memcmp/2097152/0/0         -0.0023         -0.0024        762470        760701        761956        760122
BM_string_memcmp/512/4/4             -0.2853         -0.2853           125            89           125            89
BM_string_memcmp/1024/4/4            -0.3377         -0.3377           228           151           227           151
BM_string_memcmp/8192/4/4            -0.4083         -0.4083          1706          1009          1706          1009
BM_string_memcmp/16384/4/4           -0.3853         -0.3853          3376          2075          3376          2075
BM_string_memcmp/32768/4/4           -0.2974         -0.2974          6846          4810          6845          4810
BM_string_memcmp/65536/4/4           -0.2485         -0.2485         13619         10235         13618         10234
BM_string_memcmp/131072/4/4          -0.2387         -0.2387         27056         20597         27054         20595
BM_string_memcmp/512/4/0             -0.2898         -0.2898           123            88           123            88
BM_string_memcmp/1024/4/0            -0.3401         -0.3401           225           149           225           149
BM_string_memcmp/8192/4/0            -0.4167         -0.4167          1727          1007          1727          1007
BM_string_memcmp/16384/4/0           -0.3820         -0.3820          3384          2092          3384          2091
BM_string_memcmp/32768/4/0           -0.2535         -0.2535          6886          5141          6886          5140
BM_string_memcmp/65536/4/0           -0.1897         -0.1897         13850         11223         13849         11223
BM_string_memcmp/131072/4/0          -0.1972         -0.1972         27536         22106         27533         22104
BM_string_memcmp/512/0/4             -0.2854         -0.2854           125            89           125            89
BM_string_memcmp/1024/0/4            -0.3332         -0.3333           226           151           226           151
BM_string_memcmp/8192/0/4            -0.4199         -0.4199          1740          1009          1740          1009
BM_string_memcmp/16384/0/4           -0.3811         -0.3811          3383          2094          3383          2094
BM_string_memcmp/32768/0/4           -0.2409         -0.2409          6900          5238          6899          5237
BM_string_memcmp/65536/0/4           -0.1920         -0.1920         13922         11250         13921         11248
BM_string_memcmp/131072/0/4          -0.2029         -0.2029         27699         22079         27697         22077

[1] Commit id: f77e4c932b4fd65177b57dd5e220bd17fb4037d6

Test: bionic tests and benchmarks on aarch64.
Change-Id: I2791e2b20d1c0ad429e8e5a41d3e47b1ac02c921
2018-08-21 17:48:12 +00:00
Evgenii Stepanov
be551f596f HWASan support in bionic.
* Allow sanitization of libc (excluding existing global sanitizers)
  and disallow sanitization of linker. The latter has not been
  necessary before because HWASan is the first sanitizer to support
  static binaries (with the exception of CFI, which is not used
  globally).
* Static binary startup: initialize HWASan shadow very early so that
  almost entire libc can be sanitized. The rest of initialization is
  done in a global constructor; until that is done sanitized code can
  run but can't report errors (will simply crash with SIGTRAP).
* Switch malloc_common from je_*  to __sanitizer_*.
* Call hwasan functions when entering and leaving threads. We can not
  intercept pthread_create when libc depends on libclang_rt.hwasan.
  An alternative to this would be a callback interface like requested
  here:
    https://sourceware.org/glibc/wiki/ThreadPropertiesAPI

All of the above is behind a compile-time check
__has_feature(hwaddress_sanitizer). This means that HWASan actually
requires libc to be instrumented, and would not work otherwise. It's
an implementation choice that greatly reduces complexity of the tool.
Instrumented libc also guarantees that hwasan is present and
initialized in every process, which allows piecemeal sanitization
(i.e. library w/o main executable, or even individual static
libraries), unlike ASan.

Change-Id: If44c46b79b15049d1745ba46ec910ae4f355d19c
2018-08-21 00:15:47 +00:00
Christopher Ferris
ad935c8139 Add more descriptive text around app starting.
Test: NA
Change-Id: If3bcf060b11ec08835863236b0a1408aebe43355
2018-08-16 17:57:23 -07:00
Christopher Ferris
841c9c1ce2 Merge "Add new malloc benchmarks." 2018-08-16 01:09:17 +00:00
George Burgess IV
fa5410fdb7 libc: enable -Wimplicit-fallthrough
libc had some -Wimplicit-fallthrough warnings. They all seem to be
benign. We're trying to enable this flag globally, so we need to
annotate these breaks here.

Bug: 112564944
Test: Builds
Change-Id: I5afae694cc4cf26ad1a61e2c8ae91f00cda7c733
2018-08-15 10:11:08 -07:00
Christopher Ferris
0dc784431b Add new malloc benchmarks.
This runs through the trace of the allocations in a sql benchmark app
executed in the benchmark thread.

Add one benchmark with decay time set to 0 and another with decay time
set to 1.

Include a script that can generate a header file that can be used to
regenerate the data.

Bug: 112317428

Test: Builds, ran unit tests, ran benchmarks.
Change-Id: I62e287cc06b74b74bcc5a4bbee71b0fac0a196fd
2018-08-14 16:01:58 -07:00
Bernie Innocenti
817f578bf4 Merge "Clear the resolver timeout when setting default __res_params" 2018-08-10 02:15:20 +00:00
Treehugger Robot
fce5dae8a3 Merge "Make the resolver retry timeout configurable via __res_params" 2018-08-10 01:55:09 +00:00
Treehugger Robot
a2650eaf1c Merge "seccomp: Allow read(2) and getdents(2) in x86_64 for UBSan's sake" 2018-08-09 23:47:14 +00:00