untag_memory didn't correctly handle the case where from = to, and would
always untag the first byte.
not changing the assembly for now to make this more obvious for
cherry-picking purposes.
Test: atest bionic-unit-tests-static
Bug: 348142687
(cherry picked from https://android-review.googlesource.com/q/commit:6b174efa140304f857547e3058baff445dd2f17f)
Merged-In: I47c635897e0b50bbe4367a869d9b53fa45be0dc0
Change-Id: I47c635897e0b50bbe4367a869d9b53fa45be0dc0
Similar to mmap(), this confuses me every time I look at it. Move it out
of the way, and make it clearer that this is just junk that can be
deleted when we remove 32-bit support.
Also improve coverage by adding a test for the varargs special case.
Ignore-AOSP-First: work around the lack of an ABI 35 dump in AOSP
Test: treehugger
Change-Id: Ia375c29d18e31e646b795e643534f0be07d382b9
Also group all the RELR/arm64/riscv64 bits together rather than mixing them up slightly as we'd done so far.
Change-Id: Iff1ea2cfca9ff702b88aa2e7d09db46e2f34f965
Add basic assembly stubs for TLS Descriptor support in the dynamic
linker, and enable several code paths related to TLSDESC for RISC-V.
Note: This patch requires an updated toolchain that supports TLSDESC
for RISC-V, and the `-mtls-dialect=` compiler option specifically.
Test: adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests --gtest_filter=*tls*
Bug: 322984914
Change-Id: I74bd0fa216b44b4ca2c5a5a6aec37b3fc47b00d9
Every time I look at mmap.cpp, I fail to realize it's only built for ILP32.
Also improve some of the commentary in SYSCALLS.TXT and legacy_32_bit_support.cpp.
Change-Id: Ieedfe800b437e30c060c3e8663b6d96d517dbf6f
clang-19 and later default to C++14 sized deallocation. Currently we don't have C23's C equivalent of free_sized(), so we just implement these in terms of free() for now.
Bug: http://b/344993254
Change-Id: I708710aee3f7a684bfe494a96f7baed014acbe57
Not a security problem, but definitely a bug if you're calling this and ignoring the result, since it has no side-effects.
(All of the more important functions -- realloc() especially -- are already annotated.)
Change-Id: I217463518b4716befcc0ed9426648eafbfbbdde4
Kernel headers coming from:
Git: https://android.googlesource.com/kernel/common/
Branch: android-mainline
Tag: android-mainline-6.9
Test: Builds and bionic unit tests pass on raven.
Test: Able to log in to an Android GO 32 bit device.
Change-Id: If53a38bbb65c3c653ce790fe5c6e51597901a14e
This is just POSIX nonsense. Android, iOS/macOS, the BSDs, and glibc all have getpagesize(). Window doesn't, but Windows doesn't have sysconf(3) either, so there's not a strong "portability" argument to be had there!
Change-Id: Ieacfbb61c3612045f27c20c3fa4fa12694db2243
This is fairly conservative, touching only those functions (such as feof()) where it's clearly an error to not use the return value.
Also fix a test that was ignoring the return value of feof() (because it was just checking whether the function could take the lock, and genuinely didn't care about the result).
Change-Id: If2ade10ae87df45a8b9bfcb24828e460201fa9a1
I only came to improve the signature mismatch error, but I was then annoyed by the copy & paste of the other checks.
get_chunk_size() seems to be deliberately avoiding any checks, though I think that might be a bug, and there should be a get_chunk_size() that _does_ check for most callers, and a get_chunk_size_unchecked() for the <sys/thread_properties.h> stuff that seems to want to only be "best effort" (but does still have _some_ possibility of aborting, in addition to the possibility of segfaulting).
Also a bit of "include what you use" after cider complained about all the unused includes in bionic_allocator.h.
Bug: https://issuetracker.google.com/341850283
Change-Id: I278b495601353733af516a2d60ed10feb9cef36b
We only use this in one other place anyway.
Also be explicit about how `__tls_get_addr` and `___tls_get_addr` differ, since I missed that at first!
Change-Id: Ica214886c5346f118f063bca26e6dd8d74ee21f4
Strictly, this is more of "swap one form of duplication for another", but
I found the existing code non-obvious in part because people have added new
code under existing comments (which don't apply), in two places. At this
point, duplicating the _condition_ (which is much less likely to change at
all, let alone grow more complex) clarifies the code and makes the comments
match the code they're adjacent to again.
Test: treehugger
Change-Id: Ic8f01dc5b4fd14e942bf8dd7c72cab7df06d99d5