Commit graph

39227 commits

Author SHA1 Message Date
Christopher Ferris
636b9b9bf2 Merge "Increase time to set allocation limit." into main 2023-08-04 22:54:05 +00:00
Treehugger Robot
b00078830d Merge "Update NOTICE file." into main 2023-08-04 22:50:15 +00:00
Treehugger Robot
23c97e925c Merge "Fix signature of mbstate_reset_and_return." into main 2023-08-04 22:36:05 +00:00
Treehugger Robot
007bb4d1e8 Merge changes Ia6b8cff4,I390ea200 into main
* changes:
  Make multibyte result constants public.
  Disable 0b parsing test for glibc.
2023-08-04 22:35:29 +00:00
Dan Albert
e1fbf3e15a Merge changes I51c6536e,Ifa0a555e,Iead5eb01,I11236609,Ia307cbd6 into main
* changes:
  Improve output for failed wcsto* tests.
  Add missing setlocale/uselocale for glibc tests.
  Fix test for out of range multibyte characters.
  Fix wchar tests for zero length conversions.
  Fix wcsto*_l tests for glibc.
2023-08-04 22:18:23 +00:00
Elliott Hughes
bc192cff55 Add the L() macro for local labels to <private/bionic_asm.h>.
This lets us remove the riscv64 "sys/asm.h" file. It turns out everyone
loves this macro --- tons of x86 and arm assembler is already using it!

I'll clean up some of the now-duplicate definitions separately, and I'll
move the assembler we wrote ourselves over to this macro (rather than
the current `.L_foo` style) too.

Test: built riscv64 _and_ arm/arm64 _and_ x86/x86-64
Change-Id: If3f93c9b71094a8bed1fd1bb81bb83ec60ce409e
2023-08-04 15:12:30 -07:00
Christopher Ferris
e9ffc52da7 Increase time to set allocation limit.
Under some circumstances, it's possible to fail the enable allocation
limit android_mallopt call. Increase the total allowed time for the
function to complete.

In addition, if the enable fails, allow another limit call to succeed
in the future.

Finally, change the limit test to use _exit instead of exit.

Bug: 291672185

Test: Ran limit test thousands of times.
Test: Forced the limit to fail and verified the second call passes.
Change-Id: I0948e6fd97231a7538b9b82b76f0a207386681b1
2023-08-04 13:10:48 -07:00
Dan Albert
16007d5204 Fix result for zero-length non-null conversion.
Bug: None
Test: deleted the xfail half of the test
Change-Id: I1a60d6ef27ebad14de79ac3bc637a6f2280334d8
2023-08-04 19:48:56 +00:00
Dan Albert
013d747dd3 Fix signature of mbstate_reset_and_return.
Bug: None
Test: None
Change-Id: Ifab9f68f542354fafa8514bf4ea73b185796bdad
2023-08-04 19:48:35 +00:00
Dan Albert
a9e914dd2f Make multibyte result constants public.
The magic numbers that C defines are obnoxious. We had partial
definitions for these internally. Add the missing one and move them to
a public header for anyone else that may want to use them.

Bug: None
Test: None
Change-Id: Ia6b8cff4310bcccb23078c52216528db668ac966
2023-08-04 19:48:35 +00:00
Dan Albert
3a8fed1ac3 Fix mismatched return types for surrogate pairs.
We've had these backward all this time. The relevant quote is in a
code comment in the implementation, but the first call after
completely decoding a code point that requires a surrogate pair should
return the number of bytes decoded by the most recent call, and the
second call should return -3 (if only C had given those some named
constants that might have been more obviously wrong).

Bug: https://issuetracker.google.com/289419882
Test: Fixed the test, tests run against glibc and musl to confirm
Change-Id: Idabf01075b1cad35b604ede8d676d6f0b1dc91e6
2023-08-04 19:48:35 +00:00
Dan Albert
9f30c6ba92 Disable 0b parsing test for glibc.
Bug: None
Test: ran on glibc
Change-Id: I390ea20015f94b26ab3cdbeb6ade6cbcfefa7b0a
2023-08-04 19:48:34 +00:00
Elliott Hughes
a137234742 Update NOTICE file.
I don't know why we seem to keep missing this so much these days...

Test: treehugger
Change-Id: I018a528f35aa938f8fc5cdafe2eaf3f1bbc1a6d9
2023-08-04 12:43:21 -07:00
Elliott Hughes
9a80691e38 Merge "Sync upstream FreeBSD libm." into main 2023-08-04 14:51:38 +00:00
Dan Albert
a40159fa22 Improve output for failed wcsto* tests.
Bug: None
Test: ran these and finally understood which sub-test was failing
Change-Id: I51c6536eba4b9c82ed4b062b1702128e23cf339c
2023-08-03 21:05:29 +00:00
Dan Albert
9f78c51e03 Add missing setlocale/uselocale for glibc tests.
Bug: None
Test: these
Change-Id: Ifa0a555e3a771b27ba733b1316f7531c7b262f8b
2023-08-03 21:05:29 +00:00
Dan Albert
5325653b0f Fix test for out of range multibyte characters.
Same as in uchar_test.cpp: glibc implements a much older unicode
standard which allows these.

Bug: None
Test: this is a test
Change-Id: Iead5eb01d391be85a7b1a034ea9e7f8828e81cdb
2023-08-03 21:04:31 +00:00
Elliott Hughes
4088e3a587 Sync upstream FreeBSD libm.
Test: treehugger
Change-Id: I583a3e93821d512c975db34fc1610ffd22445d58
2023-08-03 13:33:56 -07:00
Dan Albert
512469a858 Fix wchar tests for zero length conversions.
Same as the previous change for the uchar tests: the tests are wrong
to match bionic's wrong implementation. Fix the test to encode the bug
for now while I get the tests into good shape, then I'll be back to
fix the bugs and remove the test differences.

Bug: None
Test: this is a test
Change-Id: I1123660994f755f8bac1f2656f6890d5a43310b3
2023-08-03 20:03:28 +00:00
Dan Albert
686e67d077 Fix wcsto*_l tests for glibc.
glibc immediately dereferences the locale passed to all wcsto*_l
functions, even if it won't be used, and even if it's
LC_GLOBAL_LOCALE, which isn't a pointer to valid memory.

Bug: None
Test: this is the test
Change-Id: Ia307cbd6a5c5b4b904c978a03e6d06c1cef6ceed
2023-08-03 19:59:11 +00:00
Treehugger Robot
e31c863307 Merge "Define gettid symbol when testing on glibc < 2.30" into main 2023-08-03 16:44:11 +00:00
Tomasz Wasilczyk
704e4e6936 Define gettid symbol when testing on glibc < 2.30
Bug: 289414897
Test: it builds
Change-Id: Ic44514953f34096e8a681ef2587439953096ba53
2023-08-03 07:19:17 -07:00
Elliott Hughes
249ae824fd Merge "riscv64: inline raise." into main 2023-08-03 14:07:49 +00:00
Elliott Hughes
0e5b89c4bf riscv64: inline raise.
Not necessary (as demonstrated by the lack of this for x86), but this
saves one stack frame in aborts, which gets you one more useful stack
frame in logs and clustering etc, which improves your chances of finding
your bug.

Test: crasher64 abort
Change-Id: Ieb214f3b46520161edc1e53c0d766353b777d8ba
2023-08-02 16:04:25 -07:00
Matthias Männich
85beaceda3 Merge "libm/libc: remove 'allow_untyped_symbols' flags" into main 2023-08-01 21:33:16 +00:00
Matthias Maennich
68cbdca6bb libm/libc: remove 'allow_untyped_symbols' flags
Those flags were used to suppress ABI tidy errors, but by now are not in
use anymore and can safely be removed.

Bug: 156513478
Change-Id: Ibc9625d139f933e48ebb4ddebe70d424f6231f3f
Signed-off-by: Matthias Maennich <maennich@google.com>
2023-08-01 17:23:49 +00:00
Elliott Hughes
2df6e5fa8f Merge "riscv64: use vdso for __riscv_hwprobe()." into main 2023-08-01 14:32:52 +00:00
Elliott Hughes
95936aec6f Merge "riscv64: pass a null argument to ifunc resolvers." into main 2023-08-01 14:32:35 +00:00
Elliott Hughes
1af07a92d6 Merge "avx2 memset: add missing vzeroupper." into main 2023-08-01 14:08:00 +00:00
Elliott Hughes
b08f79af78 riscv64: pass a null argument to ifunc resolvers.
glibc maintainer Florian Weimer pointed out that glibc passes a null first
argument to riscv64 ifunc resolvers. While not super useful right now,
that does make it much easier to switch to providing arguments in future,
such as my favorite idea of passing a default set of hwprobe key/value
pairs, along with a count of how many pairs.

Test: treehugger
Change-Id: Ibe2148dc28aa6ad230e6324b6d725fe472b7ef33
2023-07-31 19:34:38 +00:00
Elliott Hughes
9a7d048712 riscv64: use vdso for __riscv_hwprobe().
Also de-pessimize time(), where the vdso entrypoint only exists on
x86/x86-64 anyway.

Bug: https://github.com/google/android-riscv64/issues/8
Test: strace
Change-Id: I14cb2a3130b6ff88d06d43ea13d3a825a26de290
2023-07-31 12:24:31 -07:00
Florian Mayer
8a2f0358ed Merge "Don't assume size of functions." into main 2023-07-29 01:48:02 +00:00
Elliott Hughes
c4d3867b6c Merge "riscv64: add <sys/hwprobe.h>." into main 2023-07-28 23:53:15 +00:00
Florian Mayer
8fc5ab4f72 Don't assume size of functions.
Bug: 293532332
Change-Id: I93a8c5380b17b77ff85f4027b48ea5318a03e9e3
2023-07-28 15:51:38 -07:00
Elliott Hughes
f3d6b44e2b riscv64: add <sys/hwprobe.h>.
This is source compatible with the current proposal for glibc.

Bug: https://github.com/google/android-riscv64/issues/27
Test: treehugger
Change-Id: I428777e4eac1fe643d442a93a4b3ad1fdf0ffd97
2023-07-28 09:29:06 -07:00
Elliott Hughes
7c95495ead avx2 memset: add missing vzeroupper.
Also improve a few labels. This actually improves performance slightly,
and removes the weird behavior I was seeing around 512 bytes in the
"before" numbers...

Before:
```
BM_string_memset/8/0            2.12 ns         2.12 ns    332002763 bytes_per_second=3.52172G/s
BM_string_memset/16/0           2.36 ns         2.36 ns    297459840 bytes_per_second=6.31618G/s
BM_string_memset/32/0           2.36 ns         2.36 ns    296996995 bytes_per_second=12.6321G/s
BM_string_memset/64/0           2.37 ns         2.36 ns    296196644 bytes_per_second=25.2097G/s
BM_string_memset/512/0          65.9 ns         65.8 ns     10609200 bytes_per_second=7.24172G/s
BM_string_memset/1024/0         69.5 ns         69.5 ns     10079176 bytes_per_second=13.7312G/s
BM_string_memset/8192/0          123 ns          123 ns      5726682 bytes_per_second=62.2494G/s
BM_string_memset/16384/0         183 ns          183 ns      3832127 bytes_per_second=83.5219G/s
BM_string_memset/32768/0         306 ns          306 ns      2292654 bytes_per_second=99.8293G/s
BM_string_memset/65536/0         570 ns          569 ns      1224926 bytes_per_second=107.185G/s
BM_string_memset/131072/0       1067 ns         1067 ns       654098 bytes_per_second=114.395G/s
```

After:
```
BM_string_memset/8/0            2.34 ns         2.34 ns    299919615 bytes_per_second=3.18993G/s
BM_string_memset/16/0           2.58 ns         2.58 ns    271170449 bytes_per_second=5.76711G/s
BM_string_memset/32/0           2.61 ns         2.61 ns    266003840 bytes_per_second=11.4245G/s
BM_string_memset/64/0           2.62 ns         2.62 ns    269191710 bytes_per_second=22.784G/s
BM_string_memset/128/0          2.84 ns         2.84 ns    244486639 bytes_per_second=41.994G/s
BM_string_memset/256/0          4.23 ns         4.23 ns    165575532 bytes_per_second=56.4047G/s
BM_string_memset/512/0          7.12 ns         7.12 ns     99398933 bytes_per_second=67.0164G/s
BM_string_memset/1024/0         10.9 ns         10.9 ns     64108888 bytes_per_second=87.2884G/s
BM_string_memset/8192/0         63.6 ns         63.6 ns     11012138 bytes_per_second=119.989G/s
BM_string_memset/16384/0         127 ns          127 ns      5506888 bytes_per_second=120.065G/s
BM_string_memset/32768/0         252 ns          251 ns      2783524 bytes_per_second=121.346G/s
BM_string_memset/65536/0         515 ns          515 ns      1357500 bytes_per_second=118.587G/s
BM_string_memset/131072/0       1013 ns         1012 ns       691605 bytes_per_second=120.587G/s
```

Bug: http://b/292281479
Test: treehugger
Change-Id: I45bfffedbdf0ec55a1b1341ffbab0af6d240d3a3
2023-07-27 14:23:17 -07:00
Ryan Prichard
6e601911f1 Merge "Hold the loader mutex in linker_main once constructors are running" into main 2023-07-26 03:19:12 +00:00
Ryan Prichard
504590d1e2 Merge changes I9c181568,Ic0b08511 into main
* changes:
  Add aligned_alloc to linker_memory.cpp
  Add missing assert.h include
2023-07-25 20:14:40 +00:00
Christopher Ferris
78a74b02ad Merge "No tombstones under normal bionic unit tests run." into main 2023-07-25 19:24:42 +00:00
Christopher Ferris
15c22cdee0 No tombstones under normal bionic unit tests run.
Change a test to use a signal that does not trigger a tombstone.

Also changed the gwp_asan_integration.DISABLED_assert_gwp_asan_enabled
test to inherit from the SilentDeathTest to prevent tombstones
being generated.

Test: Ran tests and no tombstones generated.
Change-Id: I0f104704829dde692aa515a63dea1c6971278c29
2023-07-24 17:51:41 -07:00
Christopher Ferris
1b42f8bfd6 Merge "Mark death tests properly." into main 2023-07-25 00:42:05 +00:00
Christopher Ferris
c833fabed7 Mark death tests properly.
A few death tests are not set to silence tombstones, so fix
all of those occurrences.

Test: Ran all death tests and no tombstones generated.
Change-Id: If2b54b1a3432edbd54076439d40527d966607f70
2023-07-24 14:31:15 -07:00
Ryan Prichard
18d856e54b Add aligned_alloc to linker_memory.cpp
The new libc++_static.a platform prebuilt prefers to use this C11
function rather than the non-standard memalign.

Bug: http://b/175635923
Test: treehugger
Change-Id: I9c181568ba69c0508e400baac2cbb42b169c9768
2023-07-24 13:08:34 -07:00
Ryan Prichard
3714f21137 Add missing assert.h include
Bug: http://b/175635923
Test: treehugger
Change-Id: Ic0b085116c21ac35720f0558b1ba0b57a41b0f84
2023-07-24 13:08:16 -07:00
Ryan Prichard
9a027c7236 Hold the loader mutex in linker_main once constructors are running
A constructor could spawn a thread, which could call into the loader,
so the global loader mutex must be held.

Bug: http://b/290318196
Test: treehugger
Change-Id: I7a5249898a11fbc62d1ecdb85b24017a42a4b179
2023-07-21 23:14:46 -07:00
Christopher Ferris
1b61cbf604 Merge "Fix potential flakiness in android_mallopt test." into main 2023-07-22 03:28:39 +00:00
Christopher Ferris
fe13041d22 Fix potential flakiness in android_mallopt test.
The set_allocation_limit_multiple_threads test could fail every
once in a while. So rewrite slightly so that the tests wait until
all of the threads are running before letting them start.

I also refactored the code to use std::thread instead of the raw
pthread functions.

Bug: 291672185

Test: Ran the test thousdands of times.
Change-Id: Ia0bdef93d58e0ff8266e551ed4a32e14ff829581
2023-07-21 13:42:09 -07:00
Elliott Hughes
5684b722d9 Merge "Reuse the libm scalbn() as ldexp()." into main 2023-07-21 14:08:15 +00:00
Treehugger Robot
23f67fbb08 Merge "Disable uchar.start_state test for musl." into main 2023-07-21 00:52:17 +00:00
Dan Albert
09d3b5065d Disable uchar.start_state test for musl.
These all appear to be either musl bugs or underspecified corners of
the C standard, so rather than verify the musl behavior I've just
disabled the body of the test for musl.

Now that this is skipped, all the uchar tests are passing for bionic,
glibc, and musl.

Bug: None
Test: None
Change-Id: Icf88ef42e9b750ab45ba76bf8112967b00e72a9f
2023-07-20 22:09:30 +00:00