Commit graph

37179 commits

Author SHA1 Message Date
Christopher Ferris
e0cb4e1094 Fix old python2 test issue.
The map function returns a list in python2, but not in python3.
Force the test in cpp.py get_blocks() function to return a list.

Test: All cpp.py unit tests pass.
Change-Id: I1a63b92ac6cdb785830846fbd7e726eca7520e96
2022-08-05 12:59:05 -07:00
Elliott Hughes
70efcef338 Merge "Don't even try to allocate 2GiB on LP32." am: 462c542855
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2172902

Change-Id: I3e4e8e91e78f42e7f263c1a90417b9c1afe62943
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-03 16:01:17 +00:00
Elliott Hughes
462c542855 Merge "Don't even try to allocate 2GiB on LP32." 2022-08-03 15:35:49 +00:00
Treehugger Robot
2d9b7fe265 Merge "[MTE] Add comment about nested ScopedDisableMTE in test." am: c3288a19e9
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2172809

Change-Id: I5e776528c017b37e2e99957854dd4598f85ea1a7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-03 03:06:23 +00:00
Treehugger Robot
c3288a19e9 Merge "[MTE] Add comment about nested ScopedDisableMTE in test." 2022-08-03 02:50:38 +00:00
Florian Mayer
5d35ab8f42 [MTE] Add comment about nested ScopedDisableMTE in test.
Change-Id: I02a4b44ebe1fad6f00b10d1083b43b52a0b5c316
2022-08-02 23:52:43 +00:00
Elliott Hughes
15008d6a76 Merge "Add %b and %B support to the printf/wprintf family." am: cede011a2c
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2169037

Change-Id: Ifc47fe448921e91788c6afac3488f19596f1803a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-02 18:30:21 +00:00
Elliott Hughes
0cac2919fd Don't even try to allocate 2GiB on LP32.
std::vector will just throw std::length_error anyway...

Bug: http://b/241114825
Test: treehugger
Change-Id: I44a9be9a5357c7b3a1c1d1273ef90a023a91e81b
2022-08-02 18:25:22 +00:00
Elliott Hughes
cede011a2c Merge "Add %b and %B support to the printf/wprintf family." 2022-08-02 18:13:09 +00:00
Florian Mayer
6b9ec7f312 Merge "[MTE] Allow remote mode override for process." am: 4ff089f82a
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2169036

Change-Id: I0c62f38e914f54544909f90e2bb6a01b56a8e8f3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-02 00:35:12 +00:00
Florian Mayer
4ff089f82a Merge "[MTE] Allow remote mode override for process." 2022-08-02 00:17:05 +00:00
Treehugger Robot
f955373494 Merge "[MTE] use static buffer for per-process property name." am: c7bf4d419c
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2169035

Change-Id: I6a8ecb79989654d1f75006d822409e4db130de9e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-02 00:08:43 +00:00
Treehugger Robot
c7bf4d419c Merge "[MTE] use static buffer for per-process property name." 2022-08-01 23:51:07 +00:00
Elliott Hughes
b813a6a6be Add %b and %B support to the printf/wprintf family.
Coming to C23 via WG14 N2630, and already in glibc.

We're still missing clang support for %b and %B in format string checking,
but it's probably easier to fix this first. (Apparently GCC already has
support because of glibc.)

Test: treehugger
Change-Id: Ie8bfe4630d00c50e1d047d6756a7f799205356db
2022-08-01 22:18:40 +00:00
Florian Mayer
dee80d515f [MTE] Allow remote mode override for process.
Test: setprop persist.device_config.memory_safety_native.mode_override.process.mte_crash sync
Test: setprop persist.device_config.memory_safety_native.mode_override.process.mte_crash off
Change-Id: I5b167a30a56f56e3f292088f116f398afde65644
2022-08-01 15:17:46 -07:00
Florian Mayer
27914298f5 [MTE] use static buffer for per-process property name.
Change-Id: I3b0d0fdffe72aef7d66544fecac18f7a097ddbaf
2022-08-01 15:02:47 -07:00
Treehugger Robot
b84a2adfd5 Merge "[style] [MTE] remove unnecessary condition." am: 21a1ac3f9b
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2170065

Change-Id: I259bd27da7402731424799c54c6f8014c7cb847b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-01 21:21:31 +00:00
Treehugger Robot
21a1ac3f9b Merge "[style] [MTE] remove unnecessary condition." 2022-08-01 21:00:28 +00:00
Florian Mayer
85eb6fd243 [style] [MTE] remove unnecessary condition.
Change-Id: I186cc82d827c75a9a6e68d081ded2e9dba1dd168
2022-08-01 19:00:59 +00:00
Elliott Hughes
2cc3216866 Merge "Always free after getline()." am: d06cd4a765
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2170542

Change-Id: I1e6ad66a124ee6faad288df20289cf435bf330b1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-01 18:16:39 +00:00
Elliott Hughes
d06cd4a765 Merge "Always free after getline()." 2022-08-01 17:57:50 +00:00
Elliott Hughes
f305560b12 Always free after getline().
Noticed by "NRK": https://www.openwall.com/lists/musl/2022/07/29/5

We don't have this problem elsewhere in bionic because it's so rare to
call getline() without a loop, and the free() is always outside the loop
because that's a handy optimization.

Test: treehugger
Change-Id: Iff8845aa226d87357b38cf4a285fc1be3cac5659
2022-07-29 19:28:37 +00:00
Elliott Hughes
ceb57885c0 Merge "Simplify the implementation of get_nproc()." am: 27b3ad2c78
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2168844

Change-Id: I5ad2df692e9433b525f91c09d3c9fdade95cbdad
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-29 18:48:41 +00:00
Elliott Hughes
27b3ad2c78 Merge "Simplify the implementation of get_nproc()." 2022-07-29 18:19:29 +00:00
Elliott Hughes
a49583853e Merge "fread: cope with >2GiB totals." am: 6f4bb0771e
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2168847

Change-Id: I0bf58811efaa6c556bfed216aebc111c56abffde
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-29 16:45:33 +00:00
Elliott Hughes
6f4bb0771e Merge "fread: cope with >2GiB totals." 2022-07-29 16:16:27 +00:00
Elliott Hughes
be78fc90e6 fread: cope with >2GiB totals.
The FILE::_read function pointer takes an int rather than a size_t, so
we need to be careful to break large reads up for it.

fwrite() hasn't (yet) been optimized in this way, so it's immune for
now, but add the corresponding write test anyway.

Seeking already uses a off64_t function pointer where possible, so I
don't think there's anything more to be done there.

No other function pointers in FILE are relevant.

Bug: https://issuetracker.google.com/240139009
Test: treehugger
Change-Id: Ife2537e10f178bb0d980719592539f4b00b67031
2022-07-28 20:58:45 +00:00
Elliott Hughes
d771a7cde3 Simplify the implementation of get_nproc().
It came up on the musl mailing list that there's not actually any need
to iterate over the directory entries:

https://www.openwall.com/lists/musl/2022/07/27/1

This lets us reuse the code for "online" processors in the
implementation of "configured" processors. The question of whether
"configured" should correspond to Linux's "possible" or "present" isn't
obvious to me, but the distinction seems unlikely to matter on mobile
devices anyway, and that's a trivial change should it ever be needed.
Plus the motivating argument from the person who brought this up was
that callers asking for "configured" processors are probably asking for
an upper bound, which sounds convincing to me.

Test: treehugger
Change-Id: I0d4e13538dc6b09a6dba520d9ac24f436906f7c0
2022-07-28 17:52:46 +00:00
Elliott Hughes
fc48a68a2f Merge "Tidy up the x86 atom/silvermont stuff similar to x86-64." am: bf76fc6e64
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2165082

Change-Id: Idc09f7c6671a88a5bd636ca046b93574ed9a5812
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-25 20:22:06 +00:00
Elliott Hughes
bf76fc6e64 Merge "Tidy up the x86 atom/silvermont stuff similar to x86-64." 2022-07-25 19:59:03 +00:00
Treehugger Robot
2ba850cf71 Merge "Handle null TM_ZONE in z case in strftime." am: 2d072335a6
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2153580

Change-Id: I5042ef76af22f235a9c0bfea5d9d82320748ce4f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-25 19:08:15 +00:00
Treehugger Robot
2d072335a6 Merge "Handle null TM_ZONE in z case in strftime." 2022-07-25 18:29:54 +00:00
Elliott Hughes
ed777145e7 Tidy up the x86 atom/silvermont stuff similar to x86-64.
Get rid of the bad precedent of having the architecture variant in the
file name *and* directory name.

Test: treehugger
Change-Id: I78582c12b4390578c51d52d4dd86f57470129abf
2022-07-25 16:27:25 +00:00
Elliott Hughes
414b7ed2f9 Merge "avx2 implementation for memset." am: 61a42bf1ee
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2121016

Change-Id: I24758003d6ba62d2ebd1234cfbab2aa8c783f1ed
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-25 16:17:27 +00:00
Elliott Hughes
61a42bf1ee Merge "avx2 implementation for memset." 2022-07-25 15:51:51 +00:00
Almaz Mingaleev
24bfd8eed7 Handle null TM_ZONE in z case in strftime.
For correct %z output tzcode requires tm struct to be modified by
mktime call or be output of localtime. But as TM_ZONE is null, we
are comparing against +0000.

See https://mm.icann.org/pipermail/tz/2022-July/031674.html

Europe/Lisbon test is added to confirm that current implementation
deviates from libc specification and uses more than just tm_isdst
to find out a time zone's offset.

Bug: 239128167

Test: adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Test: adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static

Change-Id: Ic27775c840467c4e9ef55bc730a313709372314b
2022-07-25 16:39:12 +01:00
ahs
919fb7f2e0 avx2 implementation for memset.
This patch includes handwritten avx2
assembly for memset 64-bit. Uses
non-temporal stores for very large sizes.
Also includes dynamic dispatch for APIs
having multiple implementations.

Convincing benchmark improvements for sizes above 512 bytes, and
although the slight regression for small sizes is unfortunate, it's
probably small enough to be okay?

Before:

  BM_string_memset/8/0            3.06 ns         3.04 ns    222703428 bytes_per_second=2.45261G/s
  BM_string_memset/16/0           3.50 ns         3.47 ns    202569932 bytes_per_second=4.29686G/s
  BM_string_memset/32/0           3.50 ns         3.48 ns    200064955 bytes_per_second=8.57386G/s
  BM_string_memset/64/0           3.49 ns         3.46 ns    201928186 bytes_per_second=17.2184G/s
  BM_string_memset/512/0          14.8 ns         14.7 ns     47776178 bytes_per_second=32.3887G/s
  BM_string_memset/1024/0         27.3 ns         27.1 ns     25884933 bytes_per_second=35.2515G/s
  BM_string_memset/8192/0          203 ns          201 ns      3476903 bytes_per_second=37.9311G/s
  BM_string_memset/16384/0         402 ns          399 ns      1750471 bytes_per_second=38.2725G/s
  BM_string_memset/32768/0         932 ns          925 ns       755750 bytes_per_second=33.0071G/s
  BM_string_memset/65536/0        2038 ns         2014 ns       347060 bytes_per_second=30.3057G/s
  BM_string_memset/131072/0       4012 ns         3980 ns       175186 bytes_per_second=30.6682G/s

After:

  BM_string_memset/8/0            3.32 ns         3.23 ns    208939089 bytes_per_second=2.3051G/s
  BM_string_memset/16/0           4.07 ns         3.98 ns    173479615 bytes_per_second=3.74822G/s
  BM_string_memset/32/0           4.07 ns         3.95 ns    177208119 bytes_per_second=7.54344G/s
  BM_string_memset/64/0           4.09 ns         4.00 ns    174729144 bytes_per_second=14.8878G/s
  BM_string_memset/512/0          10.7 ns         10.4 ns     65922763 bytes_per_second=45.6611G/s
  BM_string_memset/1024/0         18.0 ns         17.6 ns     40489136 bytes_per_second=54.3166G/s
  BM_string_memset/8192/0          109 ns          106 ns      6577711 bytes_per_second=71.7667G/s
  BM_string_memset/16384/0         221 ns          210 ns      3343800 bytes_per_second=72.684G/s
  BM_string_memset/32768/0         655 ns          623 ns      1153501 bytes_per_second=48.9781G/s
  BM_string_memset/65536/0        1547 ns         1495 ns       461702 bytes_per_second=40.8154G/s
  BM_string_memset/131072/0       2991 ns         2924 ns       240189 bytes_per_second=41.7438G/s

This patch drops the wmemset() code because we don't even have a
microbenchmark for it, we have as many implementations checked in as we
have non-test call sites (!), so at this point it seems like we've spent
more time maintaining wmemset() than running it!

Test: bionic/tests/run-on-host.sh 64
Signed-off-by: ahs <amrita.h.s@intel.com>
Change-Id: Ie5047df5300638c1e4c69f8285d33d034f79c83b
2022-07-22 21:48:50 +00:00
Almaz Mingaleev
468740a504 Merge "Add post 2100 year mktime test." am: 1031e0da38
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2145859

Change-Id: Icd088d8dddab3771664c50ae49e2c20e428527cd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-18 11:38:05 +00:00
Almaz Mingaleev
1031e0da38 Merge "Add post 2100 year mktime test." 2022-07-18 11:14:49 +00:00
Treehugger Robot
886da16305 Merge "Add the other known aliases for the recent Android releases." am: 7c3f9cb63f
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2154497

Change-Id: I79d76fa9d700e397ce6ea94275e20e2bf0068a97
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-16 04:32:03 +00:00
Treehugger Robot
7c3f9cb63f Merge "Add the other known aliases for the recent Android releases." 2022-07-16 04:08:00 +00:00
Elliott Hughes
7b396aee5f Add the other known aliases for the recent Android releases.
Test: treehugger
Change-Id: Ic861cba14236a8e4cd60be340407a8c80cda6c8f
2022-07-15 17:04:50 -07:00
Almaz Mingaleev
10fed72517 Add post 2100 year mktime test.
tzdata now has transitions up to the year 2100. Added test to make
sure that dates beyond that are handled properly too.

Bug: 25413083

Test: see system/timezone CL
Change-Id: I02ea04b2c5cfb47bde5fb05f108113901ea33a39
2022-07-15 14:36:26 +01:00
Treehugger Robot
1467ce25a2 Merge "Rewrite function definitions with identifier lists" am: fee05f06fb
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2132193

Change-Id: I3a46bffa327559016e992218cef8412f76a4645f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-13 17:49:53 +00:00
Treehugger Robot
fee05f06fb Merge "Rewrite function definitions with identifier lists" 2022-07-13 17:29:04 +00:00
Treehugger Robot
44c74424bb Merge "Sync with upstream openbsd." am: 24062ac661
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2151778

Change-Id: If75e8d185ccc32a57a3b42c3271f4338735fbf72
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-13 03:14:51 +00:00
Treehugger Robot
a7c7d8e5ac Merge "Sync libm with upstream freebsd." am: 6c2804bc10
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2151782

Change-Id: Ia20d30ba7b754b53aea08243bca58efeb00a5d52
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-13 03:14:28 +00:00
Yi Kong
7eeb11da01 Rewrite function definitions with identifier lists
This syntax is removed in C2x proposal N2432.

Test: presubmit
Change-Id: Ic1309841423143e48513dd8b67166b4fde2d67fb
2022-07-13 10:58:42 +08:00
Treehugger Robot
24062ac661 Merge "Sync with upstream openbsd." 2022-07-13 02:55:33 +00:00
Treehugger Robot
6c2804bc10 Merge "Sync libm with upstream freebsd." 2022-07-13 02:54:56 +00:00