summaryrefslogtreecommitdiff
path: root/libc
AgeCommit message (Collapse)Author
2021-02-19Add LOCAL_LICENSE_KINDS to bionicBob Badour
Added SPDX-license-identifier-Apache-2.0 to: apex/Android.bp libdl/Android.bp tools/Android.bp tools/versioner/Android.bp tools/versioner/src/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to: benchmarks/Android.bp benchmarks/linker_relocation/gen/Android.bp libc/malloc_debug/Android.bp libc/system_properties/Android.bp tests/Android.bp tests/libs/Android.bp tests/libs/Android.build.dlext_testzip.mk tests/make_fortify_compile_test.mk Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD SPDX-license-identifier-ISC SPDX-license-identifier-MIT legacy_notice legacy_unencumbered to: libc/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD SPDX-license-identifier-MIT legacy_unencumbered to: libm/Android.bp Added SPDX-license-identifier-Apache-2.0 legacy_unencumbered to: libc/tools/Android.bp Added SPDX-license-identifier-BSD to: benchmarks/linker_relocation/Android.bp benchmarks/spawn/Android.bp libc/async_safe/Android.bp libc/malloc_hooks/Android.bp libfdtrack/Android.bp linker/Android.bp tests/headers/Android.bp tests/headers/posix/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Exempt-From-Owner-Approval: janitorial work Change-Id: Ib05bcaa276b3aa71a7654ccbe8e67e1f16aec9f3
2021-02-19Merge "Update to v5.11 kernel headers."Christopher Ferris
2021-02-19Merge "Move __libc_int0x80 to an assembly file"Treehugger Robot
2021-02-19Merge "Inline the raise(SIGABRT) for x86-64 too."Elliott Hughes
2021-02-19Merge "iconv(3): ignore src_bytes_left if src_bytes is null."Treehugger Robot
2021-02-19bp2build: convert more cc_objects.Jingwen Chen
This CL also discovered that a couple of cc_objects include headers from the bionic subdir, without declaring them in the local_include_dirs. Test: build/bazel/scripts/milestone-2/demo.sh full && build/bazel/scripts/milestone-2/demo.sh cleanup Change-Id: I943980b1d1c6dab39d3c27da8037e587f97f76e3
2021-02-19bp2build: mark crt_beginso1 as bp2build_available.Jingwen Chen
This leaf module is selected as the first cc_object module to be converted by the bp2build converter. Test: GENERATE_BAZEL_FILES=true m nothing && bp2build-sync write && bazel build //bionic/libc:crt_beginso1 Change-Id: Idf752e7b5251161a4fbd58ba52b52dd85c8fc92b
2021-02-18Inline the raise(SIGABRT) for x86-64 too.Elliott Hughes
This matches what we do for arm and arm64. 32-bit x86 is too big a mess to warrant the effort still, but the more testing is done on cuttlefish, the more value there is to making every stack frame count. Before: #00 pc 00000000000596d8 .../libc.so (syscall+24) #01 pc 000000000005d072 .../libc.so (abort+194) #02 pc 000000000005f1f0 .../libc.so (__fortify_fatal(char const*, ...)+160) After: #00 pc 000000000005d07d .../libc.so (abort+205) #01 pc 000000000005f1e0 .../libc.so (__fortify_fatal(char const*, ...)+160) Test: crasher64 fortify Change-Id: Ib74cb8b36341093c268872e26020f35eb2d8ef66
2021-02-18iconv(3): ignore src_bytes_left if src_bytes is null.Elliott Hughes
This is undefined behavior, but glibc and macOS are both lenient, and someone hit this in the wild, so we may as well be lenient too. (The only cost is that it's now slightly easier to write code that works on everything except old versions of Android.) Bug: https://issuetracker.google.com/180598400 Test: treehugger Change-Id: Ia217169ea6283cc53f4fbf71e5abfa08356c2049
2021-02-18Move __libc_int0x80 to an assembly filePirama Arumuga Nainar
Bug: http://b/157081822 If __libc_int0x80 is in a C/C++ file, Clang's coverage instrumentation adds instructions to count the number of times it gets executed [1]. With coverage instrumentation, __libc_sysinfo, used on 32-bit x86, is initialized to the wrong value, causing dl.preinit_system_calls to fail. Moving the function to an assembly file leaves __libc_sysinfo properly initialized. [1] We could change clang so it doesn't instrument functions marked __attribute__((naked)) as a followup. Test: `m CLANG_COVERAGE=true NATIVE_COVERAGE_PATHS=bionic` and run bionic-unit-tests Change-Id: I73558253512392d345de8d5b66d38bb14b308fdf
2021-02-17Merge "Fix/update notices."Elliott Hughes
2021-02-17Merge "Mark cc_library_headers targets as being bp2build_available."Rupert Shuttleworth
2021-02-17Merge "Revert "[LSC] Add LOCAL_LICENSE_KINDS to bionic""Bob Badour
2021-02-16Update to v5.11 kernel headers.Christopher Ferris
Kernel headers coming from: Git: https://android.googlesource.com/kernel/common/ Branch: android-mainline Tag: android-mainline-5.11 Test: Built cuttlefish and flame images. Ran bionic unit tests on both. Change-Id: Ie60337aafad4bda55af99b6c8fe9f56bf2fa787f
2021-02-16Fix/update notices.Elliott Hughes
Auto-generate NOTICE files for all the directories, and for each one individually rather than mixing libc and libm together. Test: N/A Change-Id: I7e251194a8805c4ca78fcc5675c3321bcd5abf0a
2021-02-16Merge "Rename __ANDROID_UNGUARDED_AVAILABILITY__ -> ↵Elliott Hughes
__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__."
2021-02-16Revert "[LSC] Add LOCAL_LICENSE_KINDS to bionic"Elliott Hughes
This reverts commit 48d43034d7b5a419ba56f052856696d53a7bd979. Reason for revert: bionic is multiple projects, not just one. Change-Id: Ib31e1bb8888cc85c6e7736c4e2a1d4652fd23935
2021-02-16Mark cc_library_headers targets as being bp2build_available.Rupert Shuttleworth
Test: build/bazel/scripts/bp2build-sync.sh write. Change-Id: I78a491d20779f50757b55c8e5305b588bf613839
2021-02-12[LSC] Add LOCAL_LICENSE_KINDS to bionicBob Badour
Added SPDX-license-identifier-Apache-2.0 to: libdl/Android.bp tools/versioner/src/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to: benchmarks/Android.bp libc/malloc_debug/Android.bp libc/system_properties/Android.bp linker/Android.bp tests/Android.bp tests/libs/Android.bp tests/libs/Android.build.dlext_testzip.mk tests/make_fortify_compile_test.mk Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD SPDX-license-identifier-ISC SPDX-license-identifier-MIT legacy_notice legacy_unencumbered to: Android.bp libc/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD SPDX-license-identifier-ISC SPDX-license-identifier-MIT legacy_unencumbered to: tools/Android.bp tools/versioner/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD SPDX-license-identifier-MIT legacy_unencumbered to: libm/Android.bp Added SPDX-license-identifier-Apache-2.0 legacy_unencumbered to: libc/tools/Android.bp Added SPDX-license-identifier-BSD to: benchmarks/linker_relocation/Android.bp benchmarks/spawn/Android.bp libc/async_safe/Android.bp libc/malloc_hooks/Android.bp libfdtrack/Android.bp tests/headers/Android.bp tests/headers/posix/Android.bp Added legacy_notice to: apex/Android.bp benchmarks/linker_relocation/gen/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Exempt-From-Owner-Approval: janitorial work Change-Id: I76cad00578b9b99180ee5dd1e04b4646d5c5fedf
2021-02-12Teach debuggerd to pass the secondary ring buffer to __scudo_get_error_info().Peter Collingbourne
With this change we can report memory errors involving secondary allocations. Update the existing crasher tests to also test UAF/overflow/underflow on allocations with sizes sufficient to trigger the secondary allocator. Bug: 135772972 Change-Id: Ic8925c1f18621a8f272e26d5630e5d11d6d34d38
2021-02-11Rename __ANDROID_UNGUARDED_AVAILABILITY__ -> ↵Elliott Hughes
__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__. Also reduce some of the duplication in the macros. Bug: http://b/179067538 Test: treehugger Change-Id: I81ab341731b0faad6c7c5f00037feff8576abafb
2021-02-09Make fd overflow an abort.Elliott Hughes
On LP32, just abort if we're asked to handle an fd that's too big for the `short` field in `struct FILE`. This is unreachable anyway because the ulimit is 32Ki, and this will make issues far more noticeable if we ever do increase that limit (which seems unlikely for LP32 devices). Also rename __finit() to __FILE_init() to match __FILE_close(). Test: treehugger Change-Id: I5db4d6c4529a1f558aff135b4dea071d73666be5
2021-02-08Merge "Fix freopen() where the path is null."Elliott Hughes
2021-02-08Merge SP1A.210208.001Daniel Norman
Change-Id: I3ff65c4f80ca07db3b31cd670e16dbc153717470
2021-02-08Mark //bionic filegroups/genrules as bp2build_available.Jingwen Chen
Test: GENERATE_BAZEL_FILES=true m nothing && build/bazel/scripts/bp2build-sync.sh write && bazel build //bionic/... Change-Id: Ie3e0092a3a03ddc6228a9191e5b78ab206072dde
2021-02-05Merge "Merge SP1A.210122.003 Change-Id: ↵Scott Lobdell
I38a0c2cf0aed3762aafe4b1fa8a69dd03106fa39" into s-keystone-qcom-dev
2021-02-04Fix freopen() where the path is null.Elliott Hughes
This has been in the standard since C99, but we've never supported it before. It's apparently used by SPIRV-Tools. I tried implementing this the other way (with fcntl(2)) first, but eventually realized that that's more complicated and gives worse results. This implementation assumes that /proc is mounted, but so much of libc relies on that at this point that I don't think there's any realistic case where the fcntl(2) implementation would be preferable, and there are many where it's not. The fact that no-one's mentioned this until now suggests that it's not a heavily used feature anyway. I've also replaced AssertCloseOnExec() with a CloseOnExec() boolean-valued function instead, because it's really annoying getting assertion failures that don't point you at the test line in question, and instead point to some common helper code. Test: treehugger Change-Id: Ia2e53bf2664a4f782581042054ecd492830e2aed
2021-02-04Merge "Fix "deprecated instruction in IT block" warning"Chih-hung Hsieh
2021-02-03Fix "deprecated instruction in IT block" warningChih-Hung Hsieh
Bug: 179266557 Test: make with new clang compiler Change-Id: I963609861659cbb2be8ed467654109938185c747
2021-02-03Convert generate-NOTICE.py to Python 3, fix name.Dan Albert
Python module names should be lower case and not use hyphens (the former is a convention, the latter is a requirement for importable modules). Also updates the shell script to always use Python 3 so we don't need to maintain Python 2 compatibility. Test: repo upload, in both a python 2 and python 3 virtualenv Bug: None Change-Id: I486e54a12686b4e528dc6c9c47af5c7a52a7b790
2021-02-03Convert genfunctosyscallnrs to Python 3.Dan Albert
Test: treehugger Test: pytest libc/tools Bug: None Change-Id: Idda7161bbd2e2f351e0750874dc4d766ef98cc2b
2021-02-03Convert gensecomp.py to Python 3.Elliott Hughes
The genseccomp tests haven't been run since at least 2018. Deleted the ones that are testing APIs that no longer exist or have been refactored to take very different inputs. Test: treehugger Test: pytest tools Bug: None Change-Id: Iaf6b6b6a2e922b181a457a74eb4b5abe90425dfb
2021-02-02Move gensseccomp and genfunctosyscallnrs next to their sources.Jingwen Chen
This is a manual refactoring to ensure that the modules respect package boundaries for input files. Test: m gensseccomp genfunctosyscallnrs Change-Id: I8ca6cbe85a50e41bfe874a899653c2309c59a822
2021-02-02Merge changes from topic "builtins-exported"Ryan Prichard
* changes: Use exported variants of arm32/x86 builtins Fix -Wl,--exclude-libs typo: x86->i686
2021-02-01Merge "[MemInit] Remove old API, introduce new MemInit API."Mitch Phillips
2021-02-01Fix __VERSIONER_NO_GUARD cases for availability.Dan Albert
libc++ still depends on these being declared even if they are unavailable. This results in a worse error message (a link error rather than a compiler diagnostic) if these functions end up being used, but without the decl headers like libc++'s math.h can't be included because it refers to an undeclared function. For the cases where weak symbols aren't being used, don't annotate these functions with their availability information. Also need to avoid using __builtin_available for this case because the NDK doesn't have __isOSVersionAtLeast yet. __ANDROID_UNGUARDED_AVAILABILITY__ is being used as a proxy for "building for the NDK" here because we don't have a good signal for that which works for both the NDK proper and the NDK-in-the-platform case. Test: imported into the NDK, built and tested NDK Bug: None Change-Id: I9ef3e19a8fa083bca0be47b80dfef7ba52a94866
2021-01-29Merge "Sync libm with upstream FreeBSD."Treehugger Robot
2021-01-28Use exported variants of arm32/x86 builtinsRyan Prichard
For backwards compatibility (e.g. with old apps), arm32 libc.so and libm.so export some of the builtins. On 32-bit x86, libc.so also exports some of the builtins. The non-exported variant of the builtins will eventually have hidden symbols but doesn't currently because D93431 hasn't been merged into our toolchain yet. See: - https://reviews.llvm.org/D93431 - I44ec79728db92c089e2f39823c35b6f97d24c1ab in toolchain/llvm_android Bug: http://b/153025717 Test: bionic unit tests Change-Id: Ic489cb06a07ef61412502fc65a21b0cf630c11ed
2021-01-28Revert "Gwp-asan: Return false in ShouldGwpAsanSampleProcess always"Rishiraj Manwatkar
This reverts commit 696b43afd73495c2aa355ad3802bb4cae91ed69c. CRs-Fixed: 2828978 Change-Id: I537fb2c9433686af2563f9a9400992cb4adf38a0
2021-01-27Merge "[MTE] Change scudo init order to get correct PROT_MTE pages."Treehugger Robot
2021-01-26Sync libm with upstream FreeBSD.Elliott Hughes
Upstream SHA 78599c32efed3247d165302a1fbe8d9203e38974. Test: treehugger Change-Id: Ib103d211315e320df89a6f0bcb30cd8ba67dd603
2021-01-26Merge changes from topic "proc_madvise_framework"Edgar Arriaga
* changes: Add bionic headers for process_madvise Add a flag to distinguish shared VMAs
2021-01-26Merge SP1A.210122.003Chris Gross
Change-Id: I38a0c2cf0aed3762aafe4b1fa8a69dd03106fa39
2021-01-25[MemInit] Remove old API, introduce new MemInit API.Mitch Phillips
Introduces new heap-zero-init API. We've realised that it's better to be able to individually control MTE and heap zero-init. Having heap-zero-init not be controllable without affecting MTE affects our ability to turn off heap-zero-init in zygote-forked applications. Bug: 135772972 Test: On FVP: atest -s localhost:5555 malloc#zero_init \ Test: malloc#disable_mte heap_tagging_level Change-Id: I8c6722502733259934c699f4f1269eaf1641a09f
2021-01-25Merge "PAC/BTI: no need to keep using `hint`."Elliott Hughes
2021-01-25PAC/BTI: no need to keep using `hint`.Elliott Hughes
The toolchain is new enough that should be able to use the actual instructions now... Test: treehugger Change-Id: I30aafcdc5386268344c40dc6cc9a22caf591915a
2021-01-25[libc] Change literal value in macroTamas Petz
"#" there is incorrect: macro parameter is expected following a hashmark. Test: build libc with -mbranch-protection=standard Change-Id: Ib8e7ddf260b4cdbd36246cc70f69970f33dee200
2021-01-21Merge changes from topic "future_symbol"Jiyong Park
* changes: crtbegin_static is built with min_sdk_version: "current" Guard __libc_current_sigrtmin/max with __builtin_available __INTRODUCED_IN macros add the availability attribute
2021-01-20[MTE] Change scudo init order to get correct PROT_MTE pages.Mitch Phillips
scudo_malloc_* for fill contents in __libc_init_scudo calls scudo's initializers. We haven't told Scudo whether we want MTE-capable (i.e. mapped with PROT_MTE) size class regions yet, which happens in SetDefaultHeapTaggingLevel. This can lead to inconsistent mappings, where processes without ELF notes get the base region with PROT_MTE (which is undesirable because the performance implications are not known). Make sure that scudo is informed of whether regions need to be mapped PROT_MTE or not by hoising the tagging level up. Bug: 135772972 Bug: 172365548 Test: On FVP - 'adb shell MEMTAG_OPTIONS=off sanitizer-status' should have no PROT_MTE mappings (validation by looking for no 'mt' under 'VmFlags:' in /proc/smaps'). Change-Id: Idad64479c4a9459cb40dd211fe942437f8ca16fd
2021-01-20Merge "Don't set native_bridge_supported: true for ndk libraries"Colin Cross