Commit graph

42732 commits

Author SHA1 Message Date
Florian Mayer
08b1404cc2 Merge "Fix incorrect links" into main 2024-04-16 23:03:22 +00:00
Florian Mayer
7d098bbee7 Fix incorrect links
Change-Id: Iee24c6b2e1a63d01359dadd5af7499fa3b4abaa5
2024-04-16 21:12:40 +00:00
Treehugger Robot
6b776d9db2 Merge "tlsdesc_resolver.S: use L() macro for local labels." into main 2024-04-16 17:01:35 +00:00
Christopher Ferris
b830ddf90e Update to v6.8 kernel headers.
Kernel headers coming from:

Git: https://android.googlesource.com/kernel/common/
Branch: android-mainline
Tag: android-mainline-6.8

Test: Builds and bionic unit tests pass on raven.
Test: Able to log in to an Android GO 32 bit device.
Change-Id: I0022cdb20c19726f526acaab2866f1e25794b77e
2024-04-16 09:49:56 -07:00
Elliott Hughes
12773b6eca Merge "Simplify Oryon ifunc resolvers." into main 2024-04-16 15:06:14 +00:00
Elliott Hughes
f978a85cc3 Simplify Oryon ifunc resolvers.
Mainly just factoring out the code, but there are two functional
changes here too:

1. The inline assembler was missing `volatile`, making the hwcap
check ineffective (because the compiler would sometimes move the
MIDR_EL1 read above the hwcap check).

2. The previous code accepted variants 0x0 to 0x5 while the comment
said 0x1 to 0x5. The comment was correct.

I resisted the temptation to actually have a table to search on the assumption that it'll be a while before we need such a thing.

Bug: https://issuetracker.google.com/330105715
Change-Id: I9fdc1e70e49b26ef32794b55ca5e5fd37f1163f9
2024-04-16 15:05:55 +00:00
Treehugger Robot
e7f4506bcb Merge "Add LINE_MAX." into main 2024-04-15 23:20:22 +00:00
Treehugger Robot
d73b7b3e24 Merge "[[nodiscard]] the various ElfReader functions." into main 2024-04-10 23:59:15 +00:00
Elliott Hughes
396868c747 [[nodiscard]] the various ElfReader functions.
These are either only useful for their side-effects, or things you
really need to check.

Change-Id: I8e231185eb7fc8656fd3cb916169661833b525bf
2024-04-10 21:52:10 +00:00
Steven Moreland
117478dd4e Merge "Prefer __BIONIC_DEPRECATED_PAGE_SIZE_MACRO" into main 2024-04-10 20:57:45 +00:00
Mitch Phillips
4435aff516 Merge "[GWP-ASan] Use recoverable everywhere" into main 2024-04-10 09:30:58 +00:00
Treehugger Robot
3db97c73a2 Merge "Add NGROUPS." into main 2024-04-09 19:33:36 +00:00
Treehugger Robot
2f526fb4d1 Merge "<sys/shm.h>: fix a hard-coded 4096 page size." into main 2024-04-09 17:52:17 +00:00
Elliott Hughes
e5bd239ba1 Add NGROUPS.
Historical code still uses this, and people work around its absence
locally. All of iOS/macOS and musl/glibc have this.

Change-Id: I119834f535b346275be5fa1df3c323eee9e242cc
2024-04-09 16:48:18 +00:00
Elliott Hughes
f666d822bd <sys/shm.h>: fix a hard-coded 4096 page size.
Change-Id: I932b1ea44ab6a54a2e4d2bcd1577c6f5859f583a
2024-04-09 16:40:27 +00:00
Steven Moreland
a69e5af7ee Prefer __BIONIC_DEPRECATED_PAGE_SIZE_MACRO
Platform and future NDK releases will have no PAGE_SIZE by default,
unless __BIONIC_DEPRECATED_PAGE_SIZE_MACRO is specified.

This ensures that when people use these headers with non-standard build
systems, they will still become aware of the changes.

Bug: 312546062
Test: build/boot
Change-Id: I29f5de2cd5d59d3cefdd45a6da1ccdd7c12f1f19
2024-04-09 16:35:15 +00:00
Elliott Hughes
b266f6522f Add LINE_MAX.
LINE_MAX is a bad idea from the 1970s that we've ignored until now,
but there's already one hack in the AOSP tree (external/ltp) to work
around its absence, and kselftests would need another. Both uses are
bad code, but bad code exists, and iOS/macOS and musl/glibc all have
the same 2048 value, and it is in POSIX, so at least it's consistent
idiocy. Hopefully we're not encouraging more of it!

Bug: https://github.com/llvm/llvm-project/issues/88119
Change-Id: Ief219c3fe20b3d95da7040c4b9411f997b1c0470
2024-04-09 15:41:10 +00:00
Mitch Phillips
aa8c229e7d [GWP-ASan] Use recoverable everywhere
Use recoverable mode for system processes and system apps as well.
Given we're a sampled bug detector anyway, why not let these processes
continue. This might save some user experience if something ends up
crashing that requires a SysUI reboot (like system_server). And, hey,
starting up processes is expensive.

Bug: N/A
Test: atest CtsGwpAsanTestCases
Change-Id: Ia6be4fcf3b3ed55a3089587d060aba7ab318cf97
2024-04-09 12:35:31 +02:00
Elliott Hughes
252ed5704a Merge "riscv64: use L() in the handful of places we didn't already." into main 2024-04-08 21:30:36 +00:00
Elliott Hughes
b064be8bcf Merge "arm64: use L() in the handful of places we didn't already." into main 2024-04-08 21:30:33 +00:00
Elliott Hughes
6937761c52 arm64: use L() in the handful of places we didn't already.
Change-Id: Ieb3cc5c9623291421c1d2fdc204e27812fee8ffd
2024-04-08 16:38:41 +00:00
Elliott Hughes
9e892499d9 riscv64: use L() in the handful of places we didn't already.
Change-Id: If34ae7a0eb3f7d0bd84018de4b987fd437decf58
2024-04-08 16:32:25 +00:00
Elliott Hughes
f1bb280542 tlsdesc_resolver.S: use L() macro for local labels.
Change-Id: I1bbb293e34f2f47b5bd2956619036f0ac06dabf5
2024-04-08 16:26:55 +00:00
Ryan Prichard
d162eb922a Switch the loader to a noexcept version of libc++
The current external/libcxx uses the pthreads API to access EH globals,
which is unlikely to work in the loader. The new libc++ prebuilt uses
ELF TLS, which also doesn't work in the loader and crashes the arm64
loader on startup.

Bug: http://b/332594828
Test: treehugger
Change-Id: Icf40085d78cbaba751a97a1d457cb6cc7af7e065
2024-04-05 15:25:44 -07:00
Treehugger Robot
b97459693e Merge "Hide overaligned global address from the compiler." into main 2024-04-05 01:42:14 +00:00
Peter Collingbourne
8bd83d8c98 Hide overaligned global address from the compiler.
The address of contents is only guaranteed to be aligned to 4KB on
4KB page size systems, but the compiler was generating code that
assumed it to be aligned to 64KB, which broke on a 4KB page size
system. This probably ought to be fixed, either in the compiler so
it can't generate code assuming such large alignments (it's hard to
see what useful optimizations are possible by assuming such large
alignments anyway) or by making bionic respect the p_align field in
PT_LOAD, but for now let's hide the address behind an asm statement
that the compiler can't see through.

As a result of this change, the code generation for the function
__bionic_setjmp_cookie_get on x86 changed so that it clobbers ecx,
as allowed by the calling convention. However, the x86 assembly
implementation for setjmp was assuming that it wouldn't be
clobbered. Fix it.

Bug: 332534664
Change-Id: I07fa737d8cf892d27ce08c305dafb0a53fef36cb
2024-04-04 16:33:01 -07:00
Ryan Prichard
1d141ce1c8 Merge "Call relocate_relr before the ifunc resolvers" into main 2024-04-04 22:27:34 +00:00
Florian Mayer
e564066696 Merge "Disable USE_SCUDO branches for HWASan" into main 2024-04-04 20:07:45 +00:00
Florian Mayer
d8ad152208 Disable USE_SCUDO branches for HWASan
It would be nicer to do this in the build system properly, and skip
linking scudo altogether when using HWASan, but this workaround is
almost as good, so we should submit this for now.

Test: CtsWrapHwasanTestCases
Change-Id: If38df37daadae93b8979279dce7f2c9cc5bc03f8
2024-04-04 20:07:04 +00:00
Ryan Prichard
2a901e6937 Call relocate_relr before the ifunc resolvers
Previously, on RISC-V, the static hwcap variable in
__bionic_call_ifunc_resolver resulted in a call to __cxa_guard_acquire,
which used a GOT access to __stack_chk_guard, but the GOT hadn't yet
been initialized. Fix this problem by applying RELR relocations
earlier.

Bug: http://b/330725041
Test: lunch aosp_cf_riscv64_phone-trunk_staging-eng; boot device
Change-Id: Ib10fdcc0d2c1b875eba6bc5e0115a6768d6f25ee
2024-04-04 03:23:04 -07:00
Treehugger Robot
2931c646d9 Merge "Remove duplicate PT_ARM_EXIDX definition." into main 2024-04-03 19:16:00 +00:00
Elliott Hughes
0e179328f9 Remove duplicate PT_ARM_EXIDX definition.
Change-Id: I62aefc53c3f24254ca193d29c80050ed20a671bf
2024-04-03 15:50:23 +00:00
Treehugger Robot
74d67442a3 Merge "ReadPadSegmentNote: Skip PT_NOTEs that are beyond the end of the file" into main 2024-04-02 06:18:36 +00:00
Kalesh Singh
751bb8ae9d ReadPadSegmentNote: Skip PT_NOTEs that are beyond the end of the file
Some obfuscated ELFs have PT_NOTE headers that are past the end of the
file. Skip parsing these for crt_pad_segment note, as accesses beyond
the file will cause a SIGBUS.

Bug: 331717625
Test: Manual - Launch Guns up app
Change-Id: I39365064e6c1538b0be1114479557d94a72ee369
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2024-04-02 00:53:20 +00:00
Elliott Hughes
a778b83a53 Merge changes I479a572a,I0c97398a into main
* changes:
  Custom memset implementation for Qualcomm Oryon CPU
  Custom memcpy implementation for Qualcomm Oryon CPU
2024-04-01 19:31:28 +00:00
Treehugger Robot
5fc949184a Merge "Address review comments on previous change." into main 2024-03-29 20:45:36 +00:00
Elliott Hughes
b90421ac0e Address review comments on previous change.
Change-Id: I956d0045a3d03b6fc1d9b3b2ea7c3f25ec11a04c
2024-03-29 19:24:21 +00:00
Elliott Hughes
9a1d8b4aae Merge "docs: be more consistent about saying "API level"." into main 2024-03-29 18:50:37 +00:00
Vaisakh K V
54a612187d Custom memset implementation for Qualcomm Oryon CPU
Submitted on behalf of a third-party: Linaro Limited

License rights, if any, to the submission are granted solely by the
copyright owner of such submission under its applicable intellectual
property.

Copyright (c) 2012, Linaro Limited
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
  notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
 notice, this list of conditions and the following disclaimer in the
 documentation and/or other materials provided with the distribution.
* Neither the name of the Linaro nor the
 names of its contributors may be used to endorse or promote products
 derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Origin Project URL: https://android.googlesource.com/platform/bionic/
Commit ID: 7e4fa56099

Third Party code includes additions/modifications from Qualcomm Innovation Center, Inc.

Test: All
Change-Id: I479a572a325e27262d27aa37c516618e4322e9bb
2024-03-29 13:35:04 +05:30
Vaisakh K V
83e55841ea Custom memcpy implementation for Qualcomm Oryon CPU
Submitted on behalf of a third-party: Arm Limited

License rights, if any, to the submission are granted solely by the
copyright owner of such submission under its applicable intellectual
property.

Copyright (c) 2012-2022, Arm Limited.
SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception

Origin Project URL: https://github.com/ARM-software/optimized-routines
Tag: v24.01

Third Party code includes additions/modifications from Qualcomm Innovation Center, Inc.

Test: All
Change-Id: I0c97398a435e3f8ddf8ad38bc6bd71cc0d78aea5
2024-03-29 13:25:10 +05:30
Treehugger Robot
8827343088 Merge "linker: clarify comments in call_ifunc_resolvers()." into main 2024-03-28 20:07:49 +00:00
Elliott Hughes
f67f27b040 linker: clarify comments in call_ifunc_resolvers().
Change-Id: I5a9b9d5ab9d1acdcd574f079edc79a1749f1905c
2024-03-28 14:54:30 +00:00
Treehugger Robot
8ba5f48907 Merge "Disable Android relocation packing in linker." into main 2024-03-28 03:41:50 +00:00
Peter Collingbourne
c630da5928 Disable Android relocation packing in linker.
Newer versions of lld write ifunc relocations for PLT entries
to .rela.dyn instead of .rela.plt. This causes a problem because
.rela.dyn is subject to Android relocation packing and we don't
support relocation packing when calling the linker's own ifunc
resolvers. Resolve the problem by passing --pack-dyn-relocs=relr
which disables Android relocation packing but keeps RELR packing
enabled which covers most of the relocations in the linker.

With the current toolchain there are only two entries in the linker's
.rela.dyn (and these entries look like a bug anyway) so there should
be no substantial change to binary size as a result of this change.

Relocation section '.rela.dyn' at offset 0x8e8 contains 2 entries:
    Offset             Info             Type               Symbol's Value  Symbol's Name + Addend
00000000001691d8  0000000100000401 R_AARCH64_GLOB_DAT     0000000000000000 ZSTD_trace_decompress_begin + 0
00000000001691e0  0000000200000401 R_AARCH64_GLOB_DAT     0000000000000000 ZSTD_trace_decompress_end + 0

Bug: 331450960
Change-Id: Idf403e775d134cbe208d6b1635a84a2a3e70b74b
2024-03-27 18:38:28 -07:00
Elliott Hughes
a5c8bcc743 docs: be more consistent about saying "API level".
It's especially unhelpful of us to say things like "U" given that marketing switched the public back to numbers.

Change-Id: I7fb9e30667fbf9830bc71319dcca18e92d064522
2024-03-28 00:51:13 +00:00
Treehugger Robot
29f233a59e Merge "sysconf()/getpagesize() documentation." into main 2024-03-27 23:25:40 +00:00
Elliott Hughes
3bfb6eeb14 sysconf()/getpagesize() documentation.
Plus a little bit of cleanup of the sysconf() implementation...

Change-Id: I017d50e537e4721c9a4c4a62e9dea771ee920fb8
2024-03-27 21:23:42 +00:00
Treehugger Robot
2910ce1ed5 Merge "Update status.md." into main 2024-03-27 02:59:47 +00:00
Treehugger Robot
a00ed8a895 Merge "linker: Process RELR relocations before ANDROID_REL[A]." into main 2024-03-27 02:53:08 +00:00
Elliott Hughes
a459c0b066 Update status.md.
We were still using "Android O" in developer-facing documentation, we'd forgotten to document the destroyed pthread_mutex_t behavior change, and we'd forgotten to document the existence of _Fork() and <android/crash_detail.h>.

Change-Id: Ie2c94a1956b7252472116cacc90f38fa4e2dd229
2024-03-27 02:16:49 +00:00