Commit graph

3499 commits

Author SHA1 Message Date
Elliott Hughes
a216b269ef Merge "Add _Fork()." into main 2024-02-29 22:25:45 +00:00
Elliott Hughes
2411fff9f2 Add _Fork().
POSIX issue 8 function, already in musl/glibc (but not iOS/macOS).

Bug: https://austingroupbugs.net/view.php?id=62
Test: treehugger
Change-Id: Id51611afdab92dff36a540b7d8737fc0e31f3d36
2024-02-29 20:50:58 +00:00
Kalesh Singh
824fa8065c Merge changes from topic "reland_bionic_vma_fixes" into main am: f9c297d344 am: c5b4880d0a
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2966884

Change-Id: Idab9845138b4ac32639d37717ad9e66ee05893cf
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-28 17:45:55 +00:00
Kalesh Singh
f9c297d344 Merge changes from topic "reland_bionic_vma_fixes" into main
* changes:
  RELAND: bionic: loader: Extend GNU_RELRO protection
  RELAND: bionic: loader: Extend LOAD segment VMAs
2024-02-28 16:20:08 +00:00
Kalesh Singh
944164c5e2 RELAND: bionic: loader: Extend LOAD segment VMAs
When the page_size < p_align of the ELF load segment, the loader
will end up creating extra PROT_NONE gap VMA mappings between the
LOAD segments. This problem is exacerbated by Android's zygote
model, where the number of loaded .so's can lead to ~30MB increase
in vm_area_struct unreclaimable slab memory.

Extend the LOAD segment VMA's to cover the range between the
segment's end and the start of the next segment, being careful
to avoid touching regions of the extended mapping where the offset
would overrun the size of the file. This avoids the loader
creating an additional gap VMA for each LOAD segment.

Consider a system with 4KB page size and the ELF files with 64K
alignment. e.g:

$ readelf -Wl /system/lib64/bootstrap/libc.so | grep 'Type\|LOAD'

Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
LOAD           0x000000 0x0000000000000000 0x0000000000000000 0x0441a8 0x0441a8 R   0x10000
LOAD           0x0441b0 0x00000000000541b0 0x00000000000541b0 0x091860 0x091860 R E 0x10000
LOAD           0x0d5a10 0x00000000000f5a10 0x00000000000f5a10 0x003d40 0x003d40 RW  0x10000
LOAD           0x0d9760 0x0000000000109760 0x0000000000109760 0x0005c0 0x459844 RW  0x10000

Before this patch:

$ cat /proc/1/maps | grep -A1 libc.so

7fa1d4a90000-7fa1d4ad5000 r--p 00000000 fe:09 20635520                   /system/lib64/bootstrap/libc.so
7fa1d4ad5000-7fa1d4ae4000 ---p 00000000 00:00 0
7fa1d4ae4000-7fa1d4b76000 r-xp 00044000 fe:09 20635520                   /system/lib64/bootstrap/libc.so
7fa1d4b76000-7fa1d4b85000 ---p 00000000 00:00 0
7fa1d4b85000-7fa1d4b8a000 r--p 000d5000 fe:09 20635520                   /system/lib64/bootstrap/libc.so
7fa1d4b8a000-7fa1d4b99000 ---p 00000000 00:00 0
7fa1d4b99000-7fa1d4b9a000 rw-p 000d9000 fe:09 20635520                   /system/lib64/bootstrap/libc.so
7fa1d4b9a000-7fa1d4feb000 rw-p 00000000 00:00 0                          [anon:.bss]

3 additional PROT_NONE (---p) VMAs for gap mappings.

After this patch:

$ cat /proc/1/maps | grep -A1 libc.so

7f468f069000-7f468f0bd000 r--p 00000000 fe:09 20635520                   /system/lib64/bootstrap/libc.so
7f468f0bd000-7f468f15e000 r-xp 00044000 fe:09 20635520                   /system/lib64/bootstrap/libc.so
7f468f15e000-7f468f163000 r--p 000d5000 fe:09 20635520                   /system/lib64/bootstrap/libc.so
7f468f163000-7f468f172000 rw-p 000da000 fe:09 20635520                   /system/lib64/bootstrap/libc.so
7f468f172000-7f468f173000 rw-p 000d9000 fe:09 20635520                   /system/lib64/bootstrap/libc.so
7f468f173000-7f468f5c4000 rw-p 00000000 00:00 0                          [anon:.bss]

No additional gap VMAs. However notice there is an extra RW VMA at
offset 0x000da000. This is caused by the RO protection of the
GNU_RELRO segment, which causes the extended RW VMA to split.
The GNU_RELRO protection extension is handled in the subsequent
patch in this series.

Bug: 316403210
Bug: 300367402
Bug: 307803052
Bug: 312550202
Test: atest -c linker-unit-tests
Test: atest -c bionic-unit-tests
Change-Id: I7150ed22af0723cc0b2d326c046e4e4a8b56ad09
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2024-02-27 06:13:11 +00:00
Ryan Prichard
ee22b445b8 Merge "cxa_demangle_test: expand accepted outputs" into main am: a5ac8de33f am: 18f7e80351
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2976251

Change-Id: Ibc946a863a7e52230ad4a3e3b6bca91533ebf0d5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-26 22:22:01 +00:00
Ryan Prichard
a5ac8de33f Merge "cxa_demangle_test: expand accepted outputs" into main 2024-02-26 21:34:17 +00:00
Ryan Prichard
1a5e871374 cxa_demangle_test: expand accepted outputs
After updating libc++, the demangled output's float literal ends with
'L' and the <template-args> ends with a '>'. However, the input is
invalid, so the demangler probably should return nullptr.

Bug: http://b/175635923
Test: bionic-unit-tests
Change-Id: I8440118e4f5791a3464e15d6f9d2f5f3d006e54d
2024-02-23 20:00:35 -08:00
Elliott Hughes
f113cc0778 Merge "Clean up the <netinet/ether.h> implementation." into main am: 9a7da857a7 am: 00fa3f3083
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2966403

Change-Id: Icfa16a3c909d8c1e4a65b9c8981063c5ea9f9c4b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-22 17:11:32 +00:00
Elliott Hughes
1b96583ab6 Merge "Clarify _PC_REC_INCR_XFER_SIZE and _PC_REC_MAX_XFER_SIZE." into main am: ea8be9ff96 am: 0514c95667
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2971213

Change-Id: I476fee5679e0cb41127d738bbcbca822c81d2de3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-22 17:10:24 +00:00
Elliott Hughes
9a7da857a7 Merge "Clean up the <netinet/ether.h> implementation." into main 2024-02-22 15:35:36 +00:00
Elliott Hughes
ea8be9ff96 Merge "Clarify _PC_REC_INCR_XFER_SIZE and _PC_REC_MAX_XFER_SIZE." into main 2024-02-22 15:34:28 +00:00
Elliott Hughes
491dea344f Merge "Fix copyright headers on new tests." into main am: e2600ea491 am: e0188acf0a
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2971214

Change-Id: I8a47b6bc21e4a397176ee4efd44d0ee50d090e9a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-22 01:45:06 +00:00
Automerger Merge Worker
897b73e5e9 Merge "Merge "grp_pwd_test: Hack around "trunk stable"." into android14-tests-dev am: 40f12b4aa6" into main am: bf0dcc4367 am: 463a3ca89a
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2957235

Change-Id: If6a06e142f3e488311e7b4c61df6d12facae2557
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-22 00:21:06 +00:00
Elliott Hughes
e2600ea491 Merge "Fix copyright headers on new tests." into main 2024-02-22 00:20:17 +00:00
Elliott Hughes
f31c52d54c Merge "grp_pwd_test: Hack around "trunk stable"." into android14-tests-dev am: 40f12b4aa6
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2957235

Change-Id: I22b5c2a3da1182aa249bda93044caf00ffca9657
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-21 23:00:31 +00:00
Elliott Hughes
49e0b3d571 Fix copyright headers on new tests.
The upload hook doesn't spot changes in tests/, so fix that too!

Test: repo upload .
Change-Id: If8ae0463e53063b7f584642b5e993658bbc8df32
2024-02-21 19:54:59 +00:00
Elliott Hughes
ae0d0c9e76 Clarify _PC_REC_INCR_XFER_SIZE and _PC_REC_MAX_XFER_SIZE.
The -1 from pathconf()/fpathconf() with these isn't the "I don't know
what you're talking about" -1/EINVAL, but the "I understand the
question, but don't have an answer for you --- you'll have to try it and
see" -1.

Bug: http://b/326245682
Test: treehugger
Change-Id: I67be277f3ffd9b5a355787ae7ffc4a31e32b0128
2024-02-21 19:18:09 +00:00
Florian Mayer
cb3a3a9edb Merge "Reland^2 "[MTE] remap stacks with PROT_MTE when requested by dlopened library"" into main am: ca6861e8ad am: ce81e05947
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2966402

Change-Id: If9b203dbc49fc869a5c48afceb2d3f007e11b589
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-17 01:03:11 +00:00
Elliott Hughes
140e4d35c0 grp_pwd_test: Hack around "trunk stable".
The 2024Q builds don't have their own branches like QPR builds used to,
and there's no API bump until V proper, so the same CTS build needs to
cope with both last year's Android release _and_ the one that doesn't
have an API level yet. So poke holes in the uid test to support these
mismatches.

This runs the risk of allowing accidental misuse in U of the very uids
that will definitely be used in V, so check that _if_ the uids do exist,
they have the names we're expecting them to have. That should make
accidents easier to spot?

Bug: http://b/322256445
Test: treehugger
Change-Id: I3b24b8fafe20012df70c73589b40dba5a10e50e9
2024-02-17 00:14:55 +00:00
Elliott Hughes
fc61ca5b4e Merge "Clean up and explain libs_utils.h^WCHECK.h." into main am: 1529990938 am: bb009466b6
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2966822

Change-Id: I9887d6b9a28c8250c2a1f9e946b24e3a68445cd8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-16 17:06:20 +00:00
Florian Mayer
e65e1939a1 Reland^2 "[MTE] remap stacks with PROT_MTE when requested by dlopened library"
Also enable stack MTE if main binary links in a library that needs it.

Otherwise the following is possible:

1. a binary doesn't require stack MTE, but links in libraries that use
   stg on the stack
2. that binary later dlopens a library that requires stack MTE, and our
   logic in dlopen remaps the stacks with MTE
3. the libraries from step 1 now have tagged pointers with missing tags
   in memory, so things go wrong

This reverts commit f53e91cc81.

Reason for revert: Fixed problem detected in b/324568991

Test: atest memtag_stack_dlopen_test with MTE enabled
Test: check crash is gone on fullmte build
Change-Id: I4a93f6814a19683c3ea5fe1e6d455df5459d31e1
2024-02-15 17:47:19 -08:00
Elliott Hughes
3ed6e722e3 Clean up the <netinet/ether.h> implementation.
Test: treehugger
Change-Id: Ifd8bf344583b74737a05b80e30373ab7bef94f8d
2024-02-16 01:23:46 +00:00
Elliott Hughes
611019b5a4 Clean up and explain libs_utils.h^WCHECK.h.
Test: treehugger
Change-Id: I73d6ed21520a0c2659826d1c01479917ed9b388d
2024-02-15 17:08:28 -08:00
Elliott Hughes
243d421837 Merge "Simplify our trivial initgroups(), and add a test." into main am: 76cab44ab1 am: 886193648e
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2961910

Change-Id: If888b50abe9187cf8578608fa589dc357bc459a2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-16 00:15:42 +00:00
Elliott Hughes
76cab44ab1 Merge "Simplify our trivial initgroups(), and add a test." into main 2024-02-15 23:04:02 +00:00
Treehugger Robot
eddb17b778 Merge "dlopen tests: silence warnings." into main am: 87843127b5 am: 7530f81bbf
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2962679

Change-Id: I1922e67c9a87f04d6f054fa88ead3ba97458fc9d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-15 08:33:37 +00:00
Treehugger Robot
87843127b5 Merge "dlopen tests: silence warnings." into main 2024-02-15 04:50:36 +00:00
Elliott Hughes
6a45884851 Simplify our trivial initgroups(), and add a test.
initgroups() is just a call to getgrouplist() followed by a call to
setgroups(). The tricky part is memory allocation. OpenBSD allocates an
NGROUPS_MAX-sized array of gid_t on the stack. FreeBSD allocates a
sysconf(_SC_NGROUPS_MAX)-sized array of gid_t on the heap. bionic had a
mix where it would try a 2-element stack array but fall back to a heap
allocation, which sounds reasonable if you want to avoid a 256KiB
(64Ki*4 bytes) allocation on either stack or heap. But that constant 2?
That's weird in two ways... It's really small (musl has an NGROUPS_MAX
of 32 unlike the Linux kernel's 64Ki, but 32 is still a lot larger than
2), but at the same time it's too big --- bionic's getgrouplist() always
returns a single element.

So although the FreeBSD "what the hell, let's just allocate 256KiB on
the heap" implementation would have been fine, there's really no point,
and anyone who's trying to understand initgroups() on Android really
needs to read getgroupslist() anyway, so let's just have the most
trivial implementation -- a single-element array -- and let's have it
right next to getgroupslist() in the same file as all the other <grp.h>
functions.

Also add a trivial smoke test. You mostly won't have permission to do
anything interesting with initgroups(), and it's basically unused save
for privilege dropping tcpdump and strace, but we may as well make an
effort. (I tested tcpdump before and after too.)

Test: treehugger
Change-Id: I67fe02e309ed1dbefc490c01733738363ca606be
2024-02-14 17:19:14 -08:00
Treehugger Robot
a2c712c940 Merge "Revert^3 "[MTE] remap stacks with PROT_MTE when requested by dlopened library"" into main am: 469568b94a am: 37bea4ec73
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2957057

Change-Id: Ieaca004a0afe921839ade69c4eab9291773982e2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-15 01:03:24 +00:00
Treehugger Robot
469568b94a Merge "Revert^3 "[MTE] remap stacks with PROT_MTE when requested by dlopened library"" into main 2024-02-14 23:48:49 +00:00
Elliott Hughes
c057791a54 Merge "Fix sysconf(_SC_NGROUPS_MAX)." into main am: b28adb35bd am: 976f598cf3
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2962906

Change-Id: Id7e2b5bea5186a988aa535434ecd3291fe6800db
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-14 22:19:21 +00:00
Elliott Hughes
3f7be222ed dlopen tests: silence warnings.
A workaround for an earlier bug was causing set-but-not-used warnings.

Test: treehugger
Change-Id: I00ad83377560c0ea7aaa7c17c62a1cfb02023c16
2024-02-14 21:34:02 +00:00
Elliott Hughes
b28adb35bd Merge "Fix sysconf(_SC_NGROUPS_MAX)." into main 2024-02-14 21:17:29 +00:00
Florian Mayer
f53e91cc81 Revert^3 "[MTE] remap stacks with PROT_MTE when requested by dlopened library"
This reverts commit a453c2df74.

Reason for revert: b/324568991

Bug: 324568991
Change-Id: Ia6250ebe51c505bd4b77af2b4ff4e95c8b370acd
2024-02-14 18:50:42 +00:00
Lev Rumyantsev
eeb29b51be Merge "Remove unused define" into main am: eca232d514 am: 114830dc83
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2963522

Change-Id: I08f796ce6165d0588e24519c150d28800c36d8ef
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-14 18:27:03 +00:00
Lev Rumyantsev
eca232d514 Merge "Remove unused define" into main 2024-02-14 17:35:29 +00:00
Zheng Pan
72436e3d53 Merge changes from topic "revert-2803156-loader_crt_pad_segment-HJBTSCOMQA" into main am: 7e0598bd61 am: 09e06f0349
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2962067

Change-Id: I89d9bd69cdb71402715f42c26bea93f0c76f41f1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-14 06:03:05 +00:00
Lev Rumyantsev
69e72105bb Remove unused define
Change-Id: I1442c127d7f92059a02eecac24951297155853d7
2024-02-14 03:35:17 +00:00
Elliott Hughes
b3877437cd Fix sysconf(_SC_NGROUPS_MAX).
The previous implementation wasn't wrong (it returned the "maximum
maximum"), but we can return the actual runtime value from the kernel.

Noticed while looking at initgroups().

Test: treehugger
Change-Id: I891fe4ff29bd82ee05d9e05ed8299d32c21abd7f
2024-02-13 16:48:30 -08:00
Zheng Pan
92a7e1c55c Revert "bionic: loader: Extend LOAD segment VMAs"
Revert submission 2803156-loader_crt_pad_segment

Reason for revert: b/324952273

Reverted changes: /q/submissionid:2803156-loader_crt_pad_segment

Change-Id: I8af115c426c0113914abbf8fbd3e74c0d89408d1
2024-02-14 00:04:10 +00:00
Florian Mayer
62cb54ca90 Merge "Reland "[MTE] remap stacks with PROT_MTE when requested by dlopened library"" into main am: a732e2aef5 am: 5b44bc316a
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2955914

Change-Id: I11860136c155016bf322c06a8fd34946de1994e8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-09 05:53:57 +00:00
Florian Mayer
a732e2aef5 Merge "Reland "[MTE] remap stacks with PROT_MTE when requested by dlopened library"" into main 2024-02-09 04:35:03 +00:00
Kalesh Singh
e44260f6bd Merge changes from topic "loader_crt_pad_segment" into main am: 61a90188e5 am: b7826c5cf0
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2803156

Change-Id: I3d4be70552b31a291b5b3d5609fd427c54c24df9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-09 02:02:54 +00:00
Florian Mayer
a453c2df74 Reland "[MTE] remap stacks with PROT_MTE when requested by dlopened library"
This reverts commit c20e1c2bdf.

Reason for revert: Was not the root-cause of test failure.

Change-Id: I7dcd9fc3cbac47703fa8ecd5aafd7e1c3ed87301
2024-02-09 00:40:45 +00:00
Kalesh Singh
61a90188e5 Merge changes from topic "loader_crt_pad_segment" into main
* changes:
  bionic: loader: Extend GNU_RELRO protection
  bionic: loader: Extend LOAD segment VMAs
2024-02-09 00:39:50 +00:00
Kalesh Singh
4b4fb6f439 bionic: loader: Extend LOAD segment VMAs
When the page_size < p_align of the ELF load segment, the loader
will end up creating extra PROT_NONE gap VMA mappings between the
LOAD segments. This problem is exacerbated by Android's zygote
model, where the number of loaded .so's can lead to ~30MB increase
in vm_area_struct unreclaimable slab memory.

Extend the LOAD segment VMA's to cover the range between the
segment's end and the start of the next segment, being careful
to avoid touching regions of the extended mapping where the offset
would overrun the size of the file. This avoids the loader
creating an additional gap VMA for each LOAD segment.

Consider a system with 4KB page size and the ELF files with 64K
alignment. e.g:

$ readelf -Wl /system/lib64/bootstrap/libc.so | grep 'Type\|LOAD'

Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
LOAD           0x000000 0x0000000000000000 0x0000000000000000 0x0441a8 0x0441a8 R   0x10000
LOAD           0x0441b0 0x00000000000541b0 0x00000000000541b0 0x091860 0x091860 R E 0x10000
LOAD           0x0d5a10 0x00000000000f5a10 0x00000000000f5a10 0x003d40 0x003d40 RW  0x10000
LOAD           0x0d9760 0x0000000000109760 0x0000000000109760 0x0005c0 0x459844 RW  0x10000

Before this patch:

$ cat /proc/1/maps | grep -A1 libc.so

7fa1d4a90000-7fa1d4ad5000 r--p 00000000 fe:09 20635520                   /system/lib64/bootstrap/libc.so
7fa1d4ad5000-7fa1d4ae4000 ---p 00000000 00:00 0
7fa1d4ae4000-7fa1d4b76000 r-xp 00044000 fe:09 20635520                   /system/lib64/bootstrap/libc.so
7fa1d4b76000-7fa1d4b85000 ---p 00000000 00:00 0
7fa1d4b85000-7fa1d4b8a000 r--p 000d5000 fe:09 20635520                   /system/lib64/bootstrap/libc.so
7fa1d4b8a000-7fa1d4b99000 ---p 00000000 00:00 0
7fa1d4b99000-7fa1d4b9a000 rw-p 000d9000 fe:09 20635520                   /system/lib64/bootstrap/libc.so
7fa1d4b9a000-7fa1d4feb000 rw-p 00000000 00:00 0                          [anon:.bss]

3 additional PROT_NONE (---p) VMAs for gap mappings.

After this patch:

$ cat /proc/1/maps | grep -A1 libc.so

7f468f069000-7f468f0bd000 r--p 00000000 fe:09 20635520                   /system/lib64/bootstrap/libc.so
7f468f0bd000-7f468f15e000 r-xp 00044000 fe:09 20635520                   /system/lib64/bootstrap/libc.so
7f468f15e000-7f468f163000 r--p 000d5000 fe:09 20635520                   /system/lib64/bootstrap/libc.so
7f468f163000-7f468f172000 rw-p 000da000 fe:09 20635520                   /system/lib64/bootstrap/libc.so
7f468f172000-7f468f173000 rw-p 000d9000 fe:09 20635520                   /system/lib64/bootstrap/libc.so
7f468f173000-7f468f5c4000 rw-p 00000000 00:00 0                          [anon:.bss]

No additional gap VMAs. However notice there is an extra RW VMA at
offset 0x000da000. This is caused by the RO protection of the
GNU_RELRO segment, which causes the extended RW VMA to split.
The GNU_RELRO protection extension is handled in the subsequent
patch in this series.

Bug: 316403210
Bug: 300367402
Bug: 307803052
Bug: 312550202
Test: atest -c linker-unit-tests [Later patch]
Test: atest -c bionic-unit-tests
Change-Id: I3363172c02d5a4e2b2a39c44809e433a4716bc45
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2024-02-08 13:07:04 -08:00
Florian Mayer
920345607e Merge "Revert "[MTE] remap stacks with PROT_MTE when requested by dlopened library"" into main am: cebe1f1351 am: e8ea440525
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2954775

Change-Id: Ie5d41c895c8d2e0dccc2e87be9fc4455517406ed
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-08 20:06:48 +00:00
Florian Mayer
cebe1f1351 Merge "Revert "[MTE] remap stacks with PROT_MTE when requested by dlopened library"" into main 2024-02-08 18:47:42 +00:00
Sojin Moon
c20e1c2bdf Revert "[MTE] remap stacks with PROT_MTE when requested by dlopened library"
This reverts commit 79c9694c91.

Reason for revert: DroidMonitor: Potential culprit for Bug b/324348078 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.

Change-Id: I32f7bc824900e18a7d53b025ffe3aaef0ee71802
2024-02-08 07:21:15 +00:00
Elliott Hughes
92be5ce73c Merge "Stop defining __STDC_*_MACROS macros." into main am: 78714d102f am: 8f288d8f42
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2955173

Change-Id: I61bbc1b46e0e839ae8389d4c6d8af23716d38877
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-08 01:15:20 +00:00
Elliott Hughes
3bb9880a57 Stop defining __STDC_*_MACROS macros.
The libcs we use don't need these any more (if they ever did), and we
were setting these globally in the build system anyway.

Also remove the -D_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS from versioner
which doesn't seem needed any more either.

Test: treehugger
Change-Id: I9fb225b085906a02918c5847401d6c59f7779581
2024-02-07 21:05:44 +00:00
Florian Mayer
79cd8b8519 Merge "[MTE] remap stacks with PROT_MTE when requested by dlopened library" into main am: ba5630cede am: f252b3fda6
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2901508

Change-Id: Id912233d287ce492657d5ebca053e5a7995bf113
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-06 17:40:52 +00:00
Florian Mayer
ba5630cede Merge "[MTE] remap stacks with PROT_MTE when requested by dlopened library" into main 2024-02-06 16:16:03 +00:00
Florian Mayer
79c9694c91 [MTE] remap stacks with PROT_MTE when requested by dlopened library
BYPASS_INCLUSIVE_LANGUAGE_REASON="man" refers to manual not person

Bug: 318749472
Test: atest pthread on MTE enabled device
Test: atest memtag_stack_dlopen_test on MTE enabled device
Test: manual with NDK r26b built app with fsanitize=memtag-stack
Change-Id: Iac191c31b87ccbdc6a52c63ddd22e7b440354202
2024-02-05 18:17:24 -08:00
Aditya Choudhary
829c064ccc Merge "Migrate Test Targets to New Android Ownership Model" into main am: d7144fcdf0 am: 72f82334d5
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2946528

Change-Id: Ib29cccd2cba3862f451518437b56421ff031c2d1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-04 22:14:00 +00:00
Aditya Choudhary
d9d37c09d8 Migrate Test Targets to New Android Ownership Model
This CL is created as a best effort to migrate test targets to the new Android ownership model.
It is based on historical data from repository history and insights from git blame.
Given the nature of this effort, there may be instances of incorrect attribution. If you find incorrect or unnecessary
attribution in this CL, please create a new CL to fix that.

For detailed guidelines and further information on the migration please refer to the link below,
go/new-android-ownership-model

Bug: 304529413
Test: N/A
Change-Id: Ie36b2a3245d9901323affcc5e51dafbb87af9248
2024-02-02 13:57:12 +00:00
Treehugger Robot
adba83240b Merge "sys_statvfs_test: fix expectation for Linux 6.7." into android13-tests-dev am: 7123abff51
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2928751

Change-Id: I38541b1db092dd37044970a52494dafc5ed6ed26
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-31 19:15:43 +00:00
Treehugger Robot
7123abff51 Merge "sys_statvfs_test: fix expectation for Linux 6.7." into android13-tests-dev 2024-01-31 18:42:56 +00:00
Elliott Hughes
d06a358244 Merge "sys_vfs_test: fix expectation for Linux 6.7." into android13-tests-dev am: fb7d4c4761
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2929452

Change-Id: Ib4321aba8f1be78db8a79e7f858c7813d71ed11f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-31 16:02:50 +00:00
Elliott Hughes
234dc36ac6 sys_statvfs_test: fix expectation for Linux 6.7.
I'd assumed that it was _deliberate_ that filesystems like procfs
reported 0 here, but apparently not. Good news: this makes for a more
worthwhile test than we had previously (at least when run on a 6.7+
kernel).

Bug: http://b/321880382 (for sys_vfs_test)
Bug: http://b/319590754 (for sys_statvfs_test)
Test: treehugger
Change-Id: I0a63faa8ca359592a29d7bca1a40ecd94fd50044
(cherry picked from commit 7506c37386)
2024-01-26 23:45:11 +00:00
Elliott Hughes
6df96da2d4 Merge "sys_vfs_test: fix expectation for Linux 6.7." into main am: 284596e19e am: c10762164b
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2928750

Change-Id: I40b63bedec6dc84a11e7df9d879c9e2f8e5b64cc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-26 00:17:13 +00:00
Elliott Hughes
3e7e2251fa sys_vfs_test: fix expectation for Linux 6.7.
I'd assumed that it was _deliberate_ that filesystems like procfs
reported 0 here, but apparently not. Good news: this makes for a more
worthwhile test than we had previously (at least when run on a 6.7+
kernel).

(This is the sys_vfs_test equivalent of the earlier change made to
sys_statvfs_test.)

Bug: http://b/321880382 (for sys_vfs_test)
Bug: http://b/319590754 (for sys_statvfs_test)
Test: treehugger
Change-Id: I3c6f784d1e348bf1be3a102d1dd6336c33d0b2db
(cherry picked from commit 1b48afbc66)
2024-01-25 22:53:16 +00:00
Elliott Hughes
1b48afbc66 sys_vfs_test: fix expectation for Linux 6.7.
I'd assumed that it was _deliberate_ that filesystems like procfs
reported 0 here, but apparently not. Good news: this makes for a more
worthwhile test than we had previously (at least when run on a 6.7+
kernel).

(This is the sys_vfs_test equivalent of the earlier change made to
sys_statvfs_test.)

Bug: http://b/321880382 (for sys_vfs_test)
Bug: http://b/319590754 (for sys_statvfs_test)
Test: treehugger
Change-Id: I3c6f784d1e348bf1be3a102d1dd6336c33d0b2db
2024-01-25 10:12:37 -08:00
Treehugger Robot
5d16f2ebb3 Merge "Disable stack protector test with stack MTE" into main am: e8cfc14651 am: df5a96be4e
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2920186

Change-Id: I8d467383c5031e132b5f9b92724c5cf9bded1dd1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-23 10:29:10 +00:00
Treehugger Robot
e8cfc14651 Merge "Disable stack protector test with stack MTE" into main 2024-01-23 09:22:16 +00:00
Mitch Phillips
7ce3ec389b Disable stack protector test with stack MTE
Obviously stack MTE conflates with the stack protector test. It doesn't
conflate with heap MTE (which we're expecting to push more broadly as
part of the -eng build), and so we want to keep this test working under
heap-mte scenarios as well.

Hence, the check-if-stack-variable-is-tagged test, and only under that
case, we skip.

Test: atest bionic-unit-tests on a fullmte device (with stack MTE turned
back on and the new compiler).
Bug: 320448268

Change-Id: I2ecee8a7c46416883235bf5c4ee2de9408047829
2024-01-22 12:40:34 +01:00
Treehugger Robot
1eb127b9ea Merge "bpfmt all the .bp files to silence ayeaye." into main am: 6467c97105 am: 2569eb859b
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2918991

Change-Id: I7fc367f7c75495525fba093761c8354f1042a378
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-19 23:32:41 +00:00
Elliott Hughes
1eacc0edc0 bpfmt all the .bp files to silence ayeaye.
Test: treehugger
Change-Id: I5b7add6f013dcd2d4eee4851b7a2a22310c6d533
2024-01-19 19:05:36 +00:00
Elliott Hughes
7c9c122c4c Revert "[RESTRICT AUTOMERGE] time_test#mktime_EOVERFLOW: allow both Android 14 and 2024Q1 behavior."
This reverts commit 4c5eeb8346 in main,
where we have the newer tzcode and so can pass the stricter test.

Bug: http://b/307680874
Test: treehugger
Change-Id: I28a6f423815655a59fb503230e50a7b618b0349a
2024-01-12 23:49:44 +00:00
Elliott Hughes
1c116ba64a [RESTRICT AUTOMERGE] time_test#mktime_EOVERFLOW: allow both Android 14 and 2024Q1 behavior. am: 4c5eeb8346
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2908740

Change-Id: Ib623cf4b4dda4791b0647b7c6d93543389431e30
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-12 22:47:23 +00:00
Elliott Hughes
4d04e858c4 Merge "sys_statvfs_test: fix expectation for Linux 6.7." into main am: f71f6cfea7 am: 831d4ae043 am: 02e0d81101
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2907296

Change-Id: Ica376463841d0a72da4999fc6bc585706fae2c74
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-12 21:23:50 +00:00
Elliott Hughes
4c5eeb8346 [RESTRICT AUTOMERGE] time_test#mktime_EOVERFLOW: allow both Android 14 and 2024Q1 behavior.
As long as 2024Q1 is using Android 14's CTS, Android 14's CTS needs to
work with both. That doesn't make much sense for this test of a bug fix,
so just disable it.

Bug: http://b/307680874
Test: treehugger
Change-Id: Ic1bea5d0404c91279a025ac97b521f07e4d2d387
2024-01-12 19:52:55 +00:00
Elliott Hughes
f71f6cfea7 Merge "sys_statvfs_test: fix expectation for Linux 6.7." into main 2024-01-12 17:22:47 +00:00
Elliott Hughes
7506c37386 sys_statvfs_test: fix expectation for Linux 6.7.
I'd assumed that it was _deliberate_ that filesystems like procfs
reported 0 here, but apparently not. Good news: this makes for a more
worthwhile test than we had previously (at least when run on a 6.7+
kernel).

Bug: http://b/319590754
Test: treehugger
Change-Id: I0a63faa8ca359592a29d7bca1a40ecd94fd50044
2024-01-11 20:46:23 +00:00
Ryan Prichard
91091d62b9 Merge "Avoid printing char16_t* and wchar_t to gtest Message" into main am: 45884037fe am: 6282a053b8 am: c9a1198b98
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2902185

Change-Id: Idca843e160e518711ccf9e547f00125dd3cefac4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-11 00:37:56 +00:00
Ryan Prichard
45884037fe Merge "Avoid printing char16_t* and wchar_t to gtest Message" into main 2024-01-10 22:02:02 +00:00
Ryan Prichard
f40f25829e Avoid printing char16_t* and wchar_t to gtest Message
gtest's Message class has a special handler for operator<< of wchar_t*
to convert it to UTF-8, but it doesn't have one for a single wchar_t or
for a char16_t* string. It delegates these to std::stringstream, which
as of a libc++ upgrade, deletes its operator<< for char16_t and
wchar_t. See wg21.link/p1423r3.

Bug: http://b/175635923
Test: m MODULES-IN-bionic
Change-Id: I8307663b72855cfc0b91d7f63993f1f6fe028b8e
2024-01-10 10:30:02 -08:00
Elliott Hughes
74c359277a Merge "[RESTRICT AUTOMERGE] fcntl_F_SETFD test: allow both Android 14 and 2024Q1 behavior." into android14-tests-dev 2024-01-09 14:39:00 +00:00
Elliott Hughes
82decc79bf Merge "[RESTRICT AUTOMERGE] uchar/wchar tests: allow both Android 14 and 2024Q1 behaviors." into android14-tests-dev 2024-01-09 14:38:47 +00:00
Elliott Hughes
7922ce0d0d [RESTRICT AUTOMERGE] fcntl_F_SETFD test: allow both Android 14 and 2024Q1 behavior.
What's important is that we name the flag. It doesn't really matter
whether you have the better message that will be in Android 15. As long
as 2024Q1 is using Android 14's CTS, Android 14's CTS needs to work with
both.

Bug: http://b/307680874
Test: treehugger
Change-Id: I8c50707e1dfd6b40e6ced887ae105508c6339989
2024-01-06 00:28:41 +00:00
Elliott Hughes
30fc7dee98 [RESTRICT AUTOMERGE] uchar/wchar tests: allow both Android 14 and 2024Q1 behaviors.
As long as 2024Q1 is using Android 14's CTS, Android 14's CTS needs
to work with both. That doesn't really seem practical for these tests,
so just disable them.

Bug: http://b/307680874
Test: treehugger
Change-Id: Iab4085ce1be1b0e00a6714eaf3008787e29e7e7b
2024-01-06 00:26:26 +00:00
Elliott Hughes
db123a73ca time.mktime_EOVERFLOW: set an explicit timezone.
Bug: http://b/283397453 (original)
Bug: http://b/307680874 (cherrypick)
Test: export TZ=Asia/Shanghai
Change-Id: Ia03822adad367abf35a0fdf55d7367cd1764fcdd
(cherry picked from commit f52b2165cb)
2024-01-06 00:19:03 +00:00
Dennis Shen
5951b4100c sys_prop: add a flag to enable large sys prop node only for internal
builds

Use a soong config var to control if we should use a large sys prop node
size. Node in prop_area.cpp, the PA_SIZE is controlled by a macro flag.
This macro flag is passed in as a compiler flag which is then added when
the soong configure variable (large_system_property_node) is true.

The sooong configure variable is then backed by a build system flag
defined in build/release/build_flags.scl. The value of this flag is then
determined by different release configurations. Only internal build
release configuration would set this flag to true.

Bug: b/316932568
Change-Id: Ibe2ffda9155246f2217aaa0e7d589ed7effec311
2024-01-05 23:53:47 +00:00
Elliott Hughes
2ddb20d29d Remove a few glibc #if hacks.
We've updated the corresponding glibc headers so we don't need these
hacks any more.

Bug: http://b/318541070
Test: treehugger
Change-Id: Ic1974f30f9edb2589cc93041822706bc89909882
2024-01-04 16:44:57 -08:00
Dennis Shen
c1e79efa0a Merge "Revert "system properties: doubling the shared file size to 256Kb"" into main 2024-01-04 21:24:20 +00:00
Dennis Shen
3d1ce8c831 Revert "system properties: doubling the shared file size to 256Kb"
This reverts commit 46cce48995.

Reason for revert: 

Will put a change behind flags to bump storage to 1Mb for internal build only. AOSP code does not need to be changed. The change will be only made to git_main.

Change-Id: If3484d0e56f4c3d8fc729f55744c2d8ebdd13b11
2024-01-04 14:18:38 +00:00
Elliott Hughes
3ef682790e riscv64: remove some obsolete #if cruft.
We have newer uapi headers now.

Test: treehugger
Change-Id: Ic5d602f3a97a860ee9f1ad5b791b46013f25e743
2024-01-03 12:08:51 -08:00
Dennis Shen
46cce48995 system properties: doubling the shared file size to 256Kb
While aconfig flag storage is being migrated to its own dedicated
storage, we need to provide some relief to the current flag users which
are running into storage capacity limit of system property. Currently
system property by default allocates a file of 128Kb for each storage
node. Bump it to 256Kb for now.

Bug: b/316037066
Change-Id: I8b0b58733f362c3789ec92ae09ee589c7c1b72c6
2023-12-18 14:02:21 +00:00
Andy Hung
46f0ddb29f Merge "bionic: fix pthread_mutex_timedlock for PI mutexes" into main 2023-12-14 17:52:55 +00:00
Andy Hung
5e19b185fd bionic: fix pthread_mutex_timedlock for PI mutexes
FUTEX_LOCK_PI uses CLOCK_REALTIME so adjust clock timebase
accordingly.

FUTEX_WAIT_BITSET, FUTEX_WAIT_REQUEUE_PI, FUTEX_LOCK_PI2
are updated to check the presence of FUTEX_CLOCK_REALTIME flag.

Test: atest bionic-unit-tests
Bug: 312787238
Bug: 315897315
Change-Id: I2d93286cf22d3b3d9f3757d49b46f7ee9ea5490c
2023-12-13 12:10:50 -08:00
Elliott Hughes
00ab1a5f95 Merge "Add a missing strtol() family test and a hex benchmark." into main 2023-12-12 14:27:30 +00:00
Elliott Hughes
4e62055462 Add a missing strtol() family test and a hex benchmark.
Benchmark added to test an optimization I'll send round next, test added
when an even bigger refactoring (as part of a more interesting
optimization) broke strtol() in a way the strtol() tests didn't notice.

Test: treehugger
Change-Id: Ic974900021107938dbbbe98648960adb102d9595
2023-12-11 16:57:03 -08:00
Colin Cross
0ce2dcfad2 Merge "Remove bionic bp2build properties" into main 2023-12-11 23:12:54 +00:00
Juan Yescas
717debf261 Merge "16k: Fix sysconf_SC_ARG_MAX test to support 16k page sizes" into main 2023-12-08 21:01:54 +00:00
Elliott Hughes
4fa4354799 Merge "Remove obsolete workaround." into main 2023-12-08 19:56:42 +00:00
Juan Yescas
2da31cf7b0 16k: Fix sysconf_SC_ARG_MAX test to support 16k page sizes
The sysconf_SC_ARG_MAX test was failing because it didn't
handle the case for 16k. After fixing the test case, it will
handle 4k/16k page sizes and fail when there is another page
size.

Bug: 315174209
Test: atest -c bionic-unit-tests-static
Change-Id: Ie24a79be9d6790a1243be48d39f67acda485c37d
2023-12-08 11:51:39 -08:00
Juan Yescas
837e4d1f52 Merge "16k: Fix pthread tests to support 4k/16k page sizes" into main 2023-12-08 17:50:38 +00:00
Elliott Hughes
5c17d7d092 Remove obsolete workaround.
These were added because the tests wouldn't build without them, but they
do now.

Bug: http://b/132640749
Test: treehugger
Change-Id: Idc0aff08ce461bde5ed2cd816f04dcdef5d7af5d
2023-12-08 09:47:07 -08:00
Elliott Hughes
9cf79d736f Merge "Stop saying -fno-emulated-tls in tests." into main 2023-12-08 17:33:59 +00:00