2016-07-12 01:20:06 +02:00
|
|
|
//
|
|
|
|
// Copyright (C) 2012 The Android Open Source Project
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
//
|
|
|
|
|
2021-02-19 22:06:22 +01:00
|
|
|
package {
|
2024-02-02 14:57:12 +01:00
|
|
|
default_team: "trendy_team_native_tools_libraries",
|
2021-02-19 22:06:22 +01:00
|
|
|
default_applicable_licenses: ["bionic_tests_license"],
|
|
|
|
}
|
|
|
|
|
|
|
|
license {
|
|
|
|
name: "bionic_tests_license",
|
|
|
|
visibility: [":__subpackages__"],
|
|
|
|
license_kinds: [
|
|
|
|
"SPDX-license-identifier-Apache-2.0",
|
|
|
|
"SPDX-license-identifier-BSD",
|
|
|
|
],
|
|
|
|
license_text: [
|
|
|
|
"NOTICE",
|
|
|
|
],
|
|
|
|
}
|
|
|
|
|
2016-07-12 01:20:06 +02:00
|
|
|
cc_defaults {
|
|
|
|
name: "bionic_tests_defaults",
|
|
|
|
host_supported: true,
|
|
|
|
target: {
|
|
|
|
darwin: {
|
|
|
|
enabled: false,
|
|
|
|
},
|
2020-04-23 17:47:19 +02:00
|
|
|
android: {
|
|
|
|
header_libs: ["bionic_libc_platform_headers"],
|
|
|
|
},
|
|
|
|
linux_bionic: {
|
|
|
|
header_libs: ["bionic_libc_platform_headers"],
|
|
|
|
},
|
2016-07-12 01:20:06 +02:00
|
|
|
},
|
|
|
|
cflags: [
|
|
|
|
"-fstack-protector-all",
|
|
|
|
"-g",
|
|
|
|
"-Wall",
|
|
|
|
"-Wextra",
|
|
|
|
"-Wunused",
|
|
|
|
"-Werror",
|
|
|
|
"-fno-builtin",
|
|
|
|
|
|
|
|
// We want to test deprecated API too.
|
|
|
|
"-Wno-deprecated-declarations",
|
|
|
|
|
2020-10-02 22:47:03 +02:00
|
|
|
// Needed to test pthread_internal_t layout.
|
|
|
|
"-Wno-invalid-offsetof",
|
|
|
|
|
2023-09-12 20:06:29 +02:00
|
|
|
// This warning does not provide any benefit to the tests.
|
|
|
|
"-Wno-reorder-init-list",
|
2016-07-12 01:20:06 +02:00
|
|
|
],
|
2020-12-01 00:04:14 +01:00
|
|
|
header_libs: [
|
|
|
|
"libcutils_headers",
|
2024-01-19 20:05:36 +01:00
|
|
|
"gwp_asan_headers",
|
2020-12-01 00:04:14 +01:00
|
|
|
],
|
2023-02-10 03:00:03 +01:00
|
|
|
stl: "libc++",
|
|
|
|
|
|
|
|
// Ensure that the tests exercise shadow call stack support.
|
|
|
|
// We don't use `scs: true` here because that would give us a second
|
|
|
|
// variant of this library where we actually just want to say "this
|
|
|
|
// library should always be built this way".
|
2018-11-13 05:09:14 +01:00
|
|
|
arch: {
|
|
|
|
arm64: {
|
2023-02-10 03:00:03 +01:00
|
|
|
cflags: ["-fsanitize=shadow-call-stack"],
|
|
|
|
},
|
|
|
|
riscv64: {
|
|
|
|
cflags: ["-fsanitize=shadow-call-stack"],
|
2018-11-13 05:09:14 +01:00
|
|
|
},
|
|
|
|
},
|
2016-07-12 01:20:06 +02:00
|
|
|
sanitize: {
|
2019-02-06 03:43:34 +01:00
|
|
|
address: false,
|
2016-07-12 01:20:06 +02:00
|
|
|
},
|
2020-04-01 02:34:03 +02:00
|
|
|
|
|
|
|
// Use the bootstrap version of bionic because some tests call private APIs
|
|
|
|
// that aren't exposed by the APEX bionic stubs.
|
2018-12-13 10:26:48 +01:00
|
|
|
bootstrap: true,
|
2016-07-12 01:20:06 +02:00
|
|
|
}
|
|
|
|
|
2020-06-16 00:22:10 +02:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// Prebuilt shared libraries for use in tests.
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
cc_prebuilt_test_library_shared {
|
|
|
|
name: "libtest_invalid-rw_load_segment",
|
|
|
|
strip: {
|
|
|
|
none: true,
|
|
|
|
},
|
|
|
|
check_elf_files: false,
|
|
|
|
relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
|
|
|
|
arch: {
|
|
|
|
arm: {
|
|
|
|
srcs: ["prebuilt-elf-files/arm/libtest_invalid-rw_load_segment.so"],
|
|
|
|
},
|
|
|
|
arm64: {
|
|
|
|
srcs: ["prebuilt-elf-files/arm64/libtest_invalid-rw_load_segment.so"],
|
|
|
|
},
|
2022-11-16 01:23:21 +01:00
|
|
|
riscv64: {
|
|
|
|
srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-rw_load_segment.so"],
|
|
|
|
},
|
2020-06-16 00:22:10 +02:00
|
|
|
x86: {
|
|
|
|
srcs: ["prebuilt-elf-files/x86/libtest_invalid-rw_load_segment.so"],
|
|
|
|
},
|
|
|
|
x86_64: {
|
|
|
|
srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-rw_load_segment.so"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_prebuilt_test_library_shared {
|
|
|
|
name: "libtest_invalid-unaligned_shdr_offset",
|
|
|
|
strip: {
|
|
|
|
none: true,
|
|
|
|
},
|
|
|
|
check_elf_files: false,
|
|
|
|
relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
|
|
|
|
arch: {
|
|
|
|
arm: {
|
|
|
|
srcs: ["prebuilt-elf-files/arm/libtest_invalid-unaligned_shdr_offset.so"],
|
|
|
|
},
|
|
|
|
arm64: {
|
|
|
|
srcs: ["prebuilt-elf-files/arm64/libtest_invalid-unaligned_shdr_offset.so"],
|
|
|
|
},
|
2022-11-16 01:23:21 +01:00
|
|
|
riscv64: {
|
|
|
|
srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-unaligned_shdr_offset.so"],
|
|
|
|
},
|
2020-06-16 00:22:10 +02:00
|
|
|
x86: {
|
|
|
|
srcs: ["prebuilt-elf-files/x86/libtest_invalid-unaligned_shdr_offset.so"],
|
|
|
|
},
|
|
|
|
x86_64: {
|
|
|
|
srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-unaligned_shdr_offset.so"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_prebuilt_test_library_shared {
|
|
|
|
name: "libtest_invalid-zero_shentsize",
|
|
|
|
strip: {
|
|
|
|
none: true,
|
|
|
|
},
|
|
|
|
check_elf_files: false,
|
|
|
|
relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
|
|
|
|
arch: {
|
|
|
|
arm: {
|
|
|
|
srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shentsize.so"],
|
|
|
|
},
|
|
|
|
arm64: {
|
|
|
|
srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shentsize.so"],
|
|
|
|
},
|
2022-11-16 01:23:21 +01:00
|
|
|
riscv64: {
|
|
|
|
srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shentsize.so"],
|
|
|
|
},
|
2020-06-16 00:22:10 +02:00
|
|
|
x86: {
|
|
|
|
srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shentsize.so"],
|
|
|
|
},
|
|
|
|
x86_64: {
|
|
|
|
srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shentsize.so"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_prebuilt_test_library_shared {
|
|
|
|
name: "libtest_invalid-zero_shstrndx",
|
|
|
|
strip: {
|
|
|
|
none: true,
|
|
|
|
},
|
|
|
|
check_elf_files: false,
|
|
|
|
relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
|
|
|
|
arch: {
|
|
|
|
arm: {
|
|
|
|
srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shstrndx.so"],
|
|
|
|
},
|
|
|
|
arm64: {
|
|
|
|
srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shstrndx.so"],
|
|
|
|
},
|
2022-11-16 01:23:21 +01:00
|
|
|
riscv64: {
|
|
|
|
srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shstrndx.so"],
|
|
|
|
},
|
2020-06-16 00:22:10 +02:00
|
|
|
x86: {
|
|
|
|
srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shstrndx.so"],
|
|
|
|
},
|
|
|
|
x86_64: {
|
|
|
|
srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shstrndx.so"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_prebuilt_test_library_shared {
|
|
|
|
name: "libtest_invalid-empty_shdr_table",
|
|
|
|
strip: {
|
|
|
|
none: true,
|
|
|
|
},
|
|
|
|
check_elf_files: false,
|
|
|
|
relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
|
|
|
|
arch: {
|
|
|
|
arm: {
|
|
|
|
srcs: ["prebuilt-elf-files/arm/libtest_invalid-empty_shdr_table.so"],
|
|
|
|
},
|
|
|
|
arm64: {
|
|
|
|
srcs: ["prebuilt-elf-files/arm64/libtest_invalid-empty_shdr_table.so"],
|
|
|
|
},
|
2022-11-16 01:23:21 +01:00
|
|
|
riscv64: {
|
|
|
|
srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-empty_shdr_table.so"],
|
|
|
|
},
|
2020-06-16 00:22:10 +02:00
|
|
|
x86: {
|
|
|
|
srcs: ["prebuilt-elf-files/x86/libtest_invalid-empty_shdr_table.so"],
|
|
|
|
},
|
|
|
|
x86_64: {
|
|
|
|
srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-empty_shdr_table.so"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_prebuilt_test_library_shared {
|
|
|
|
name: "libtest_invalid-zero_shdr_table_offset",
|
|
|
|
strip: {
|
|
|
|
none: true,
|
|
|
|
},
|
|
|
|
check_elf_files: false,
|
|
|
|
relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
|
|
|
|
arch: {
|
|
|
|
arm: {
|
|
|
|
srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_offset.so"],
|
|
|
|
},
|
|
|
|
arm64: {
|
|
|
|
srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_offset.so"],
|
|
|
|
},
|
2022-11-16 01:23:21 +01:00
|
|
|
riscv64: {
|
|
|
|
srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shdr_table_offset.so"],
|
|
|
|
},
|
2020-06-16 00:22:10 +02:00
|
|
|
x86: {
|
|
|
|
srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_offset.so"],
|
|
|
|
},
|
|
|
|
x86_64: {
|
|
|
|
srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_offset.so"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_prebuilt_test_library_shared {
|
|
|
|
name: "libtest_invalid-zero_shdr_table_content",
|
|
|
|
strip: {
|
|
|
|
none: true,
|
|
|
|
},
|
|
|
|
check_elf_files: false,
|
|
|
|
relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
|
|
|
|
arch: {
|
|
|
|
arm: {
|
|
|
|
srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_content.so"],
|
|
|
|
},
|
|
|
|
arm64: {
|
|
|
|
srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_content.so"],
|
|
|
|
},
|
2022-11-16 01:23:21 +01:00
|
|
|
riscv64: {
|
|
|
|
srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shdr_table_content.so"],
|
|
|
|
},
|
2020-06-16 00:22:10 +02:00
|
|
|
x86: {
|
|
|
|
srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_content.so"],
|
|
|
|
},
|
|
|
|
x86_64: {
|
|
|
|
srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_content.so"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_prebuilt_test_library_shared {
|
|
|
|
name: "libtest_invalid-textrels",
|
|
|
|
strip: {
|
|
|
|
none: true,
|
|
|
|
},
|
|
|
|
check_elf_files: false,
|
|
|
|
relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
|
|
|
|
arch: {
|
|
|
|
arm: {
|
|
|
|
srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels.so"],
|
|
|
|
},
|
|
|
|
arm64: {
|
|
|
|
srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels.so"],
|
|
|
|
},
|
2022-11-16 01:23:21 +01:00
|
|
|
riscv64: {
|
|
|
|
srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-textrels.so"],
|
|
|
|
},
|
2020-06-16 00:22:10 +02:00
|
|
|
x86: {
|
|
|
|
srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels.so"],
|
|
|
|
},
|
|
|
|
x86_64: {
|
|
|
|
srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels.so"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_prebuilt_test_library_shared {
|
|
|
|
name: "libtest_invalid-textrels2",
|
|
|
|
strip: {
|
|
|
|
none: true,
|
|
|
|
},
|
|
|
|
check_elf_files: false,
|
|
|
|
relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
|
|
|
|
arch: {
|
|
|
|
arm: {
|
|
|
|
srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels2.so"],
|
|
|
|
},
|
|
|
|
arm64: {
|
|
|
|
srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels2.so"],
|
|
|
|
},
|
2022-11-16 01:23:21 +01:00
|
|
|
riscv64: {
|
|
|
|
srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-textrels2.so"],
|
|
|
|
},
|
2020-06-16 00:22:10 +02:00
|
|
|
x86: {
|
|
|
|
srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels2.so"],
|
|
|
|
},
|
|
|
|
x86_64: {
|
|
|
|
srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels2.so"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2022-03-25 05:14:27 +01:00
|
|
|
cc_prebuilt_test_library_shared {
|
|
|
|
name: "libtest_invalid-local-tls",
|
|
|
|
strip: {
|
|
|
|
none: true,
|
|
|
|
},
|
|
|
|
check_elf_files: false,
|
|
|
|
relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
|
|
|
|
arch: {
|
|
|
|
arm: {
|
|
|
|
srcs: ["prebuilt-elf-files/arm/libtest_invalid-local-tls.so"],
|
|
|
|
},
|
|
|
|
arm64: {
|
|
|
|
srcs: ["prebuilt-elf-files/arm64/libtest_invalid-local-tls.so"],
|
|
|
|
},
|
|
|
|
x86: {
|
|
|
|
srcs: ["prebuilt-elf-files/x86/libtest_invalid-local-tls.so"],
|
|
|
|
},
|
|
|
|
x86_64: {
|
|
|
|
srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-local-tls.so"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2016-07-12 01:20:06 +02:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// All standard tests.
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2018-03-16 22:15:01 +01:00
|
|
|
// Test diagnostics emitted by clang. The library that results is useless; we
|
|
|
|
// just want to run '-Xclang -verify', which will fail if the diagnostics don't
|
|
|
|
// match up with what the source file says they should be.
|
|
|
|
cc_test_library {
|
|
|
|
name: "clang_diagnostic_tests",
|
|
|
|
cflags: [
|
2022-04-21 04:54:27 +02:00
|
|
|
"-Xclang",
|
|
|
|
"-verify",
|
2018-03-16 22:15:01 +01:00
|
|
|
],
|
|
|
|
srcs: ["sys_ioctl_diag_test.cpp"],
|
|
|
|
}
|
|
|
|
|
2016-07-12 01:20:06 +02:00
|
|
|
cc_test_library {
|
|
|
|
name: "libBionicStandardTests",
|
2023-12-21 20:57:13 +01:00
|
|
|
defaults: [
|
|
|
|
"bionic_tests_defaults",
|
|
|
|
"large_system_property_node_defaults",
|
|
|
|
],
|
2022-12-16 04:30:55 +01:00
|
|
|
tidy_disabled_srcs: [
|
|
|
|
"malloc_test.cpp", // timed out with clang-tidy, and too many warnings
|
|
|
|
],
|
2016-07-12 01:20:06 +02:00
|
|
|
srcs: [
|
2018-12-31 06:10:26 +01:00
|
|
|
"__aeabi_read_tp_test.cpp",
|
2020-02-05 00:46:15 +01:00
|
|
|
"__cxa_atexit_test.cpp",
|
2020-10-26 23:05:35 +01:00
|
|
|
"__cxa_demangle_test.cpp",
|
2015-02-27 13:01:59 +01:00
|
|
|
"alloca_test.cpp",
|
2018-09-06 22:26:08 +02:00
|
|
|
"android_get_device_api_level.cpp",
|
2022-04-12 01:01:37 +02:00
|
|
|
"android_set_abort_message_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"arpa_inet_test.cpp",
|
2017-04-25 02:48:32 +02:00
|
|
|
"async_safe_test.cpp",
|
2016-07-25 18:20:57 +02:00
|
|
|
"assert_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"buffer_tests.cpp",
|
|
|
|
"bug_26110743_test.cpp",
|
2015-02-27 13:01:59 +01:00
|
|
|
"byteswap_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"complex_test.cpp",
|
|
|
|
"ctype_test.cpp",
|
|
|
|
"dirent_test.cpp",
|
2017-05-01 07:56:10 +02:00
|
|
|
"elf_test.cpp",
|
2017-02-25 01:19:53 +01:00
|
|
|
"endian_test.cpp",
|
2017-06-13 23:43:53 +02:00
|
|
|
"errno_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"error_test.cpp",
|
|
|
|
"eventfd_test.cpp",
|
|
|
|
"fcntl_test.cpp",
|
2018-06-02 00:30:54 +02:00
|
|
|
"fdsan_test.cpp",
|
2019-11-06 22:15:00 +01:00
|
|
|
"fdtrack_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"fenv_test.cpp",
|
2020-01-30 04:20:45 +01:00
|
|
|
"_FILE_OFFSET_BITS_test.cpp",
|
2017-08-30 00:28:33 +02:00
|
|
|
"float_test.cpp",
|
2020-11-21 01:51:21 +01:00
|
|
|
"fnmatch_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"ftw_test.cpp",
|
|
|
|
"getauxval_test.cpp",
|
|
|
|
"getcwd_test.cpp",
|
2017-09-27 02:09:07 +02:00
|
|
|
"glob_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"grp_pwd_test.cpp",
|
2018-02-03 01:10:07 +01:00
|
|
|
"grp_pwd_file_test.cpp",
|
2020-04-02 04:54:48 +02:00
|
|
|
"heap_tagging_level_test.cpp",
|
2017-08-16 08:16:48 +02:00
|
|
|
"iconv_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"ifaddrs_test.cpp",
|
2019-01-24 02:56:24 +01:00
|
|
|
"ifunc_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"inttypes_test.cpp",
|
2017-08-30 00:28:33 +02:00
|
|
|
"iso646_test.c",
|
2016-11-19 01:27:29 +01:00
|
|
|
"langinfo_test.cpp",
|
2017-03-14 01:10:46 +01:00
|
|
|
"leak_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"libgen_basename_test.cpp",
|
|
|
|
"libgen_test.cpp",
|
2017-08-30 00:28:33 +02:00
|
|
|
"limits_test.cpp",
|
2017-04-20 22:38:49 +02:00
|
|
|
"linux_swab_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"locale_test.cpp",
|
2018-10-15 19:02:38 +02:00
|
|
|
"malloc_iterate_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"malloc_test.cpp",
|
|
|
|
"math_test.cpp",
|
2018-08-30 12:10:23 +02:00
|
|
|
"membarrier_test.cpp",
|
2022-08-31 22:57:03 +02:00
|
|
|
"memtag_stack_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"mntent_test.cpp",
|
2020-01-30 01:27:31 +01:00
|
|
|
"mte_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"netdb_test.cpp",
|
|
|
|
"net_if_test.cpp",
|
|
|
|
"netinet_ether_test.cpp",
|
|
|
|
"netinet_in_test.cpp",
|
2018-06-27 21:29:06 +02:00
|
|
|
"netinet_ip_icmp_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"netinet_udp_test.cpp",
|
|
|
|
"nl_types_test.cpp",
|
2021-02-23 03:09:48 +01:00
|
|
|
"pidfd_test.cpp",
|
2018-08-30 21:15:56 +02:00
|
|
|
"poll_test.cpp",
|
2020-10-23 18:55:33 +02:00
|
|
|
"prio_ctor_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"pthread_test.cpp",
|
|
|
|
"pty_test.cpp",
|
|
|
|
"regex_test.cpp",
|
|
|
|
"resolv_test.cpp",
|
|
|
|
"sched_test.cpp",
|
2018-11-14 21:41:41 +01:00
|
|
|
"scs_test.cpp",
|
2017-05-26 02:13:32 +02:00
|
|
|
"scsi_sg_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"search_test.cpp",
|
|
|
|
"semaphore_test.cpp",
|
|
|
|
"setjmp_test.cpp",
|
|
|
|
"signal_test.cpp",
|
2017-10-07 01:58:36 +02:00
|
|
|
"spawn_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"stack_protector_test.cpp",
|
|
|
|
"stack_protector_test_helper.cpp",
|
|
|
|
"stack_unwinding_test.cpp",
|
2017-08-30 00:28:33 +02:00
|
|
|
"stdalign_test.cpp",
|
|
|
|
"stdarg_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"stdatomic_test.cpp",
|
2017-08-30 00:28:33 +02:00
|
|
|
"stdbool_test.c",
|
2016-07-12 01:20:06 +02:00
|
|
|
"stdint_test.cpp",
|
|
|
|
"stdio_nofortify_test.cpp",
|
|
|
|
"stdio_test.cpp",
|
|
|
|
"stdio_ext_test.cpp",
|
|
|
|
"stdlib_test.cpp",
|
2017-08-30 00:28:33 +02:00
|
|
|
"stdnoreturn_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"string_nofortify_test.cpp",
|
|
|
|
"string_test.cpp",
|
|
|
|
"string_posix_strerror_r_test.cpp",
|
2021-07-30 07:45:34 +02:00
|
|
|
"string_posix_strerror_r_wrapper.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"strings_nofortify_test.cpp",
|
|
|
|
"strings_test.cpp",
|
2020-10-02 22:47:03 +02:00
|
|
|
"struct_layout_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"sstream_test.cpp",
|
2020-02-24 18:52:14 +01:00
|
|
|
"sys_auxv_test.cpp",
|
2023-07-13 01:30:55 +02:00
|
|
|
"sys_cachectl_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"sys_epoll_test.cpp",
|
2023-07-28 01:53:30 +02:00
|
|
|
"sys_hwprobe_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"sys_mman_test.cpp",
|
2016-08-17 03:14:26 +02:00
|
|
|
"sys_msg_test.cpp",
|
2019-03-21 22:04:33 +01:00
|
|
|
"sys_param_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"sys_personality_test.cpp",
|
|
|
|
"sys_prctl_test.cpp",
|
|
|
|
"sys_procfs_test.cpp",
|
|
|
|
"sys_ptrace_test.cpp",
|
|
|
|
"sys_quota_test.cpp",
|
2017-09-28 01:33:35 +02:00
|
|
|
"sys_random_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"sys_resource_test.cpp",
|
|
|
|
"sys_select_test.cpp",
|
2016-08-17 03:14:26 +02:00
|
|
|
"sys_sem_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"sys_sendfile_test.cpp",
|
2016-08-17 03:14:26 +02:00
|
|
|
"sys_shm_test.cpp",
|
2018-01-31 00:09:51 +01:00
|
|
|
"sys_signalfd_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"sys_socket_test.cpp",
|
|
|
|
"sys_stat_test.cpp",
|
|
|
|
"sys_statvfs_test.cpp",
|
|
|
|
"sys_syscall_test.cpp",
|
|
|
|
"sys_sysinfo_test.cpp",
|
|
|
|
"sys_sysmacros_test.cpp",
|
|
|
|
"sys_time_test.cpp",
|
|
|
|
"sys_timex_test.cpp",
|
2017-07-06 19:33:15 +02:00
|
|
|
"sys_ttydefaults_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"sys_types_test.cpp",
|
|
|
|
"sys_uio_test.cpp",
|
2018-06-27 22:30:02 +02:00
|
|
|
"sys_un_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"sys_vfs_test.cpp",
|
2020-08-12 23:25:41 +02:00
|
|
|
"sys_wait_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"sys_xattr_test.cpp",
|
2023-03-01 23:56:13 +01:00
|
|
|
"syslog_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"system_properties_test.cpp",
|
2017-01-24 21:43:29 +01:00
|
|
|
"system_properties_test2.cpp",
|
2017-12-14 18:43:59 +01:00
|
|
|
"termios_test.cpp",
|
2017-08-30 00:28:33 +02:00
|
|
|
"tgmath_test.c",
|
2019-04-18 23:27:24 +02:00
|
|
|
"threads_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"time_test.cpp",
|
|
|
|
"uchar_test.cpp",
|
|
|
|
"unistd_nofortify_test.cpp",
|
|
|
|
"unistd_test.cpp",
|
2022-06-23 20:07:00 +02:00
|
|
|
"utils.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"utmp_test.cpp",
|
2023-04-04 01:30:39 +02:00
|
|
|
"utmpx_test.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"wchar_test.cpp",
|
|
|
|
"wctype_test.cpp",
|
|
|
|
],
|
|
|
|
|
|
|
|
include_dirs: [
|
|
|
|
"bionic/libc",
|
|
|
|
],
|
|
|
|
|
2017-04-25 02:48:32 +02:00
|
|
|
target: {
|
2017-09-22 01:56:06 +02:00
|
|
|
bionic: {
|
2017-12-12 08:31:33 +01:00
|
|
|
whole_static_libs: [
|
|
|
|
"libasync_safe",
|
2018-10-15 19:02:38 +02:00
|
|
|
"libprocinfo",
|
2017-12-12 08:31:33 +01:00
|
|
|
"libsystemproperties",
|
|
|
|
],
|
2017-04-25 02:48:32 +02:00
|
|
|
},
|
2021-07-28 20:18:11 +02:00
|
|
|
musl: {
|
|
|
|
exclude_srcs: [
|
|
|
|
// musl doesn't have error.h
|
|
|
|
"error_test.cpp",
|
|
|
|
|
|
|
|
// musl doesn't define noreturn for C++
|
|
|
|
"stdnoreturn_test.cpp",
|
|
|
|
|
|
|
|
// unsupported relocation type 37
|
|
|
|
"ifunc_test.cpp",
|
2023-04-14 18:33:11 +02:00
|
|
|
|
|
|
|
// musl #defines utmp to utmpx, causing a collision with
|
|
|
|
// utmpx_test.cpp
|
|
|
|
"utmp_test.cpp",
|
2021-07-28 20:18:11 +02:00
|
|
|
],
|
|
|
|
},
|
2017-04-25 02:48:32 +02:00
|
|
|
},
|
|
|
|
|
2016-09-01 01:35:01 +02:00
|
|
|
static_libs: [
|
|
|
|
"libtinyxml2",
|
|
|
|
"liblog",
|
|
|
|
"libbase",
|
|
|
|
],
|
2016-09-01 20:37:39 +02:00
|
|
|
shared: {
|
|
|
|
enabled: false,
|
|
|
|
},
|
2016-12-14 00:47:25 +01:00
|
|
|
|
|
|
|
generated_headers: ["generated_android_ids"],
|
2022-02-23 00:01:27 +01:00
|
|
|
|
|
|
|
// Bug: http://b/218788252 IR verifier too strict for ifunc resolver that
|
|
|
|
// accept parameters.
|
|
|
|
lto: {
|
|
|
|
never: true,
|
|
|
|
},
|
2016-07-12 01:20:06 +02:00
|
|
|
}
|
|
|
|
|
2019-01-16 05:35:00 +01:00
|
|
|
cc_test_library {
|
|
|
|
name: "libBionicElfTlsTests",
|
|
|
|
defaults: ["bionic_tests_defaults"],
|
|
|
|
srcs: [
|
|
|
|
"elftls_test.cpp",
|
|
|
|
],
|
|
|
|
include_dirs: [
|
|
|
|
"bionic/libc",
|
|
|
|
],
|
Fix StaticTlsLayout for atypical alignment values
arm32/arm64: Previously, the loader miscalculated a negative value for
offset_bionic_tcb_ when the executable's alignment was greater than
(8 * sizeof(void*)). The process then tended to crash.
riscv: Previously, the loader didn't propagate the p_align field of the
PT_TLS segment into StaticTlsLayout::alignment_, so high alignment
values were ignored.
__bionic_check_tls_alignment: Stop capping alignment at page_size().
There is no need to cap it, and the uncapped value is necessary for
correctly positioning the TLS segment relative to the thread pointer
(TP) for ARM and x86. The uncapped value is now used for computing
static TLS layout, but only a page of alignment is actually provided:
* static TLS: __allocate_thread_mapping uses mmap, which provides only
a page's worth of alignment
* dynamic TLS: BionicAllocator::memalign caps align to page_size()
* There were no callers to StaticTlsLayout::alignment(), so remove it.
Allow PT_TLS.p_align to be 0: quietly convert it to 1.
For static TLS, ensure that the address of a TLS block is congruent to
p_vaddr, modulo p_align. That is, ensure this formula holds:
(&tls_block % p_align) == (p_vaddr % p_align)
For dynamic TLS, a TLS block is still allocated congruent to 0 modulo
p_align. Fixing dynamic TLS congruence is mostly a separate problem
from fixing static TLS congruence, and requires changing the dynamic
TLS allocator and/or DTV structure, so it should be fixed in a
later follow-up commit.
Typically (p_vaddr % p_align) is zero, but it's currently possible to
get a non-zero value with LLD: when .tbss has greater than page
alignment, but .tdata does not, LLD can produce a TLS segment where
(p_vaddr % p_align) is non-zero. LLD calculates TP offsets assuming
the loader will align the segment using (p_vaddr % p_align).
Previously, Bionic and LLD disagreed on the offsets from the TP to
the executable's TLS variables.
Add unit tests for StaticTlsLayout in bionic-unit-tests-static.
See also:
* https://github.com/llvm/llvm-project/issues/40872
* https://sourceware.org/bugzilla/show_bug.cgi?id=24606
* https://reviews.llvm.org/D61824
* https://reviews.freebsd.org/D31538
Bug: http://b/133354825
Bug: http://b/328844725
Bug: http://b/328844839
Test: bionic-unit-tests bionic-unit-tests-static
Change-Id: I8850c32ff742a45d3450d8fc39075c10a1e11000
2024-03-15 00:51:27 +01:00
|
|
|
static_libs: [
|
|
|
|
"libbase",
|
|
|
|
],
|
2019-01-16 05:35:00 +01:00
|
|
|
shared: {
|
|
|
|
enabled: false,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_test_library {
|
|
|
|
name: "libBionicElfTlsLoaderTests",
|
|
|
|
defaults: ["bionic_tests_defaults"],
|
|
|
|
srcs: [
|
|
|
|
"elftls_dl_test.cpp",
|
|
|
|
],
|
|
|
|
include_dirs: [
|
|
|
|
"bionic/libc",
|
|
|
|
],
|
|
|
|
static_libs: [
|
|
|
|
"liblog",
|
|
|
|
"libbase",
|
|
|
|
],
|
|
|
|
shared: {
|
|
|
|
enabled: false,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2020-01-15 02:59:41 +01:00
|
|
|
cc_test_library {
|
|
|
|
name: "libBionicFramePointerTests",
|
|
|
|
defaults: ["bionic_tests_defaults"],
|
|
|
|
srcs: [
|
|
|
|
"android_unsafe_frame_pointer_chase_test.cpp",
|
|
|
|
],
|
|
|
|
include_dirs: [
|
|
|
|
"bionic/libc",
|
|
|
|
],
|
|
|
|
cflags: [
|
|
|
|
"-fno-omit-frame-pointer",
|
|
|
|
],
|
|
|
|
}
|
|
|
|
|
2016-07-12 01:20:06 +02:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// Fortify tests.
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2019-06-05 00:39:52 +02:00
|
|
|
cc_defaults {
|
|
|
|
name: "bionic_clang_fortify_tests_w_flags",
|
|
|
|
cflags: [
|
|
|
|
"-Wno-builtin-memcpy-chk-size",
|
2019-06-07 02:45:05 +02:00
|
|
|
"-Wno-format-security",
|
2019-06-05 00:39:52 +02:00
|
|
|
"-Wno-format-zero-length",
|
Adapt tests due to the new Clang fortify-source warning
https://reviews.llvm.org/D58797 added several new compile time
_FORTIFY_SOURCE diagnostics. This broke clang_fortify_tests:
FAILED: out/target/product/walleye/obj/STATIC_LIBRARIES/bionic-compile-time-tests2-clang++_intermediates/clang_fortify_tests.o
error: 'warning' diagnostics seen but not expected:
Line 159: 'memcpy' will always overflow; destination buffer has size 8, but size argument is 9
Line 161: 'memmove' will always overflow; destination buffer has size 8, but size argument is 9
Line 165: 'memset' will always overflow; destination buffer has size 8, but size argument is 9
Line 183: 'strncpy' size argument is too large; destination buffer has size 8, but size argument is 9
Line 185: 'stpncpy' size argument is too large; destination buffer has size 8, but size argument is 9
Line 189: 'strncat' size argument is too large; destination buffer has size 8, but size argument is 9
Line 227: 'strncpy' size argument is too large; destination buffer has size 4, but size argument is 5
Line 232: 'stpncpy' size argument is too large; destination buffer has size 4, but size argument is 5
Line 242: 'strncat' size argument is too large; destination buffer has size 4, but size argument is 5
Line 490: 'snprintf' size argument is too large; destination buffer has size 8, but size argument is 9
Line 495: 'vsnprintf' size argument is too large; destination buffer has size 8, but size argument is 9
error: 'note' diagnostics seen but not expected:
File bionic/libc/include/bits/fortify/fcntl.h Line 50: 'open' has been explicitly marked unavailable here
File bionic/libc/include/bits/fortify/fcntl.h Line 102: 'open64' has been explicitly marked unavailable here
File bionic/libc/include/bits/fortify/fcntl.h Line 75: 'openat' has been explicitly marked unavailable here
File bionic/libc/include/bits/fortify/fcntl.h Line 121: 'openat64' has been explicitly marked unavailable here
File bionic/libc/include/bits/fortify/stdio.h Line 68: 'sprintf' has been explicitly marked unavailable here
16 errors generated.
Bug: 131328001
Bug: 138701853
Test: Build with r365631 toolchain
Change-Id: I103ecb7b3abcf4b5cfc4f36ccab69e03d0976275
2019-08-04 03:26:05 +02:00
|
|
|
"-Wno-fortify-source",
|
2019-06-05 00:39:52 +02:00
|
|
|
"-Wno-memset-transposed-args",
|
2019-06-06 23:14:52 +02:00
|
|
|
"-Wno-strlcpy-strlcat-size",
|
2019-06-05 00:39:52 +02:00
|
|
|
"-Wno-strncat-size",
|
|
|
|
],
|
2021-04-10 02:13:09 +02:00
|
|
|
static_libs: [
|
|
|
|
"libbase",
|
|
|
|
],
|
2019-06-05 00:39:52 +02:00
|
|
|
}
|
|
|
|
|
2016-07-12 01:20:06 +02:00
|
|
|
cc_defaults {
|
|
|
|
name: "bionic_fortify_tests_defaults",
|
|
|
|
cflags: [
|
|
|
|
"-U_FORTIFY_SOURCE",
|
|
|
|
],
|
|
|
|
srcs: ["fortify_test_main.cpp"],
|
2021-04-10 02:13:09 +02:00
|
|
|
static_libs: [
|
|
|
|
"libbase",
|
|
|
|
],
|
2021-01-27 21:28:20 +01:00
|
|
|
tidy: false,
|
2016-07-12 01:20:06 +02:00
|
|
|
target: {
|
2022-02-03 19:28:12 +01:00
|
|
|
musl: {
|
|
|
|
// Musl doesn't have fortify
|
|
|
|
enabled: false,
|
|
|
|
},
|
2016-07-12 01:20:06 +02:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2017-10-31 05:41:22 +01:00
|
|
|
// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
|
|
|
|
// it can confuse these tools pretty easily. If this builds successfully, then
|
|
|
|
// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
|
|
|
|
// enabled. The library that results from building this is meant to be unused.
|
|
|
|
cc_test_library {
|
|
|
|
name: "fortify_disabled_for_tidy",
|
2019-06-05 00:39:52 +02:00
|
|
|
defaults: [
|
|
|
|
"bionic_clang_fortify_tests_w_flags",
|
|
|
|
],
|
2017-10-31 05:41:22 +01:00
|
|
|
cflags: [
|
|
|
|
"-Werror",
|
|
|
|
"-D_FORTIFY_SOURCE=2",
|
|
|
|
"-D__clang_analyzer__",
|
|
|
|
],
|
2019-06-05 00:39:52 +02:00
|
|
|
srcs: ["clang_fortify_tests.cpp"],
|
2021-01-27 21:28:20 +01:00
|
|
|
tidy: false,
|
2017-10-31 05:41:22 +01:00
|
|
|
}
|
|
|
|
|
2016-07-12 01:20:06 +02:00
|
|
|
cc_test_library {
|
|
|
|
name: "libfortify1-tests-clang",
|
2018-02-06 02:30:57 +01:00
|
|
|
defaults: [
|
|
|
|
"bionic_fortify_tests_defaults",
|
|
|
|
"bionic_tests_defaults",
|
|
|
|
],
|
2016-07-12 01:20:06 +02:00
|
|
|
cflags: [
|
|
|
|
"-D_FORTIFY_SOURCE=1",
|
2018-02-06 02:30:57 +01:00
|
|
|
"-DTEST_NAME=Fortify1_clang",
|
2016-07-12 01:20:06 +02:00
|
|
|
],
|
2016-09-01 20:37:39 +02:00
|
|
|
shared: {
|
|
|
|
enabled: false,
|
|
|
|
},
|
2016-07-12 01:20:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
cc_test_library {
|
|
|
|
name: "libfortify2-tests-clang",
|
2018-02-06 02:30:57 +01:00
|
|
|
defaults: [
|
|
|
|
"bionic_fortify_tests_defaults",
|
|
|
|
"bionic_tests_defaults",
|
|
|
|
],
|
2016-07-12 01:20:06 +02:00
|
|
|
cflags: [
|
|
|
|
"-D_FORTIFY_SOURCE=2",
|
2018-02-06 02:30:57 +01:00
|
|
|
"-DTEST_NAME=Fortify2_clang",
|
2016-07-12 01:20:06 +02:00
|
|
|
],
|
2016-09-01 20:37:39 +02:00
|
|
|
shared: {
|
|
|
|
enabled: false,
|
|
|
|
},
|
2016-07-12 01:20:06 +02:00
|
|
|
}
|
|
|
|
|
2019-06-05 00:39:52 +02:00
|
|
|
cc_defaults {
|
|
|
|
name: "bionic_new_fortify_tests_defaults",
|
|
|
|
defaults: [
|
|
|
|
"bionic_clang_fortify_tests_w_flags",
|
|
|
|
],
|
|
|
|
cflags: [
|
|
|
|
"-U_FORTIFY_SOURCE",
|
|
|
|
],
|
|
|
|
srcs: ["clang_fortify_tests.cpp"],
|
2021-01-27 21:28:20 +01:00
|
|
|
tidy: false,
|
2019-06-05 00:39:52 +02:00
|
|
|
target: {
|
|
|
|
host: {
|
2022-04-21 04:54:27 +02:00
|
|
|
cflags: ["-D__clang__"],
|
2019-06-05 00:39:52 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_test_library {
|
|
|
|
name: "libfortify1-new-tests-clang",
|
|
|
|
defaults: [
|
|
|
|
"bionic_new_fortify_tests_defaults",
|
|
|
|
"bionic_tests_defaults",
|
|
|
|
],
|
|
|
|
cflags: [
|
|
|
|
"-D_FORTIFY_SOURCE=1",
|
|
|
|
"-DTEST_NAME=Fortify1_clang_new",
|
|
|
|
],
|
|
|
|
shared: {
|
|
|
|
enabled: false,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_test_library {
|
|
|
|
name: "libfortify2-new-tests-clang",
|
|
|
|
defaults: [
|
|
|
|
"bionic_new_fortify_tests_defaults",
|
|
|
|
"bionic_tests_defaults",
|
|
|
|
],
|
|
|
|
cflags: [
|
|
|
|
"-D_FORTIFY_SOURCE=2",
|
|
|
|
"-DTEST_NAME=Fortify2_clang_new",
|
|
|
|
],
|
|
|
|
shared: {
|
|
|
|
enabled: false,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2016-07-12 01:20:06 +02:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// Library of all tests (excluding the dynamic linker tests).
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
cc_test_library {
|
|
|
|
name: "libBionicTests",
|
|
|
|
defaults: ["bionic_tests_defaults"],
|
2022-02-03 19:28:12 +01:00
|
|
|
host_supported: false,
|
2016-07-12 01:20:06 +02:00
|
|
|
whole_static_libs: [
|
|
|
|
"libBionicStandardTests",
|
2019-01-16 05:35:00 +01:00
|
|
|
"libBionicElfTlsTests",
|
2020-01-15 02:59:41 +01:00
|
|
|
"libBionicFramePointerTests",
|
2016-07-12 01:20:06 +02:00
|
|
|
"libfortify1-tests-clang",
|
2019-06-05 00:39:52 +02:00
|
|
|
"libfortify1-new-tests-clang",
|
2016-07-12 01:20:06 +02:00
|
|
|
"libfortify2-tests-clang",
|
2019-06-05 00:39:52 +02:00
|
|
|
"libfortify2-new-tests-clang",
|
2016-07-12 01:20:06 +02:00
|
|
|
],
|
2016-09-01 01:35:01 +02:00
|
|
|
shared: {
|
|
|
|
enabled: false,
|
2016-09-01 20:37:39 +02:00
|
|
|
},
|
2016-07-12 01:20:06 +02:00
|
|
|
}
|
|
|
|
|
2016-09-16 01:25:31 +02:00
|
|
|
cc_test_library {
|
|
|
|
name: "libBionicLoaderTests",
|
2018-02-06 02:30:57 +01:00
|
|
|
defaults: [
|
|
|
|
"bionic_tests_defaults",
|
|
|
|
],
|
2016-09-16 01:25:31 +02:00
|
|
|
srcs: [
|
|
|
|
"atexit_test.cpp",
|
|
|
|
"dl_test.cpp",
|
2016-09-19 19:50:28 +02:00
|
|
|
"dlfcn_symlink_support.cpp",
|
2016-09-16 01:25:31 +02:00
|
|
|
"dlfcn_test.cpp",
|
2021-10-15 00:44:47 +02:00
|
|
|
"execinfo_test.cpp",
|
2017-04-22 02:15:41 +02:00
|
|
|
"link_test.cpp",
|
2016-09-16 01:25:31 +02:00
|
|
|
"pthread_dlfcn_test.cpp",
|
|
|
|
],
|
|
|
|
static_libs: [
|
|
|
|
"libbase",
|
2024-03-13 21:35:49 +01:00
|
|
|
"libprocinfo",
|
2016-09-16 01:25:31 +02:00
|
|
|
],
|
|
|
|
include_dirs: [
|
|
|
|
"bionic/libc",
|
|
|
|
],
|
|
|
|
shared: {
|
|
|
|
enabled: false,
|
|
|
|
},
|
|
|
|
target: {
|
|
|
|
android: {
|
|
|
|
srcs: [
|
2016-07-06 22:20:59 +02:00
|
|
|
"cfi_test.cpp",
|
2016-09-16 01:25:31 +02:00
|
|
|
"dlext_test.cpp",
|
|
|
|
"libdl_test.cpp",
|
|
|
|
],
|
|
|
|
static_libs: [
|
2019-01-21 23:22:05 +01:00
|
|
|
"libmeminfo",
|
2018-10-17 21:59:38 +02:00
|
|
|
"libprocinfo",
|
2017-07-06 07:36:20 +02:00
|
|
|
"libziparchive",
|
2016-09-16 01:25:31 +02:00
|
|
|
],
|
2018-02-06 02:30:57 +01:00
|
|
|
},
|
2017-05-19 18:01:24 +02:00
|
|
|
},
|
2016-09-16 01:25:31 +02:00
|
|
|
}
|
|
|
|
|
2016-07-12 01:20:06 +02:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// Library of bionic customized gtest main function, with normal gtest output format,
|
|
|
|
// which is needed by bionic cts test.
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
cc_test_library {
|
|
|
|
name: "libBionicCtsGtestMain",
|
|
|
|
defaults: ["bionic_tests_defaults"],
|
2016-09-21 20:17:13 +02:00
|
|
|
srcs: [
|
2021-09-25 02:49:58 +02:00
|
|
|
"gtest_globals.cpp",
|
2018-08-22 03:13:10 +02:00
|
|
|
"gtest_main.cpp",
|
2016-09-21 20:17:13 +02:00
|
|
|
],
|
2016-09-01 20:37:39 +02:00
|
|
|
shared: {
|
|
|
|
enabled: false,
|
|
|
|
},
|
2018-08-22 03:13:10 +02:00
|
|
|
whole_static_libs: [
|
2021-09-25 02:49:58 +02:00
|
|
|
"libbase",
|
2018-08-22 03:13:10 +02:00
|
|
|
"libgtest_isolated",
|
|
|
|
],
|
2016-07-12 01:20:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
cc_defaults {
|
2023-08-21 13:53:15 +02:00
|
|
|
name: "bionic_unit_tests_data",
|
2021-09-25 02:49:58 +02:00
|
|
|
data_bins: [
|
2017-04-11 01:52:25 +02:00
|
|
|
"cfi_test_helper",
|
|
|
|
"cfi_test_helper2",
|
Fix StaticTlsLayout for atypical alignment values
arm32/arm64: Previously, the loader miscalculated a negative value for
offset_bionic_tcb_ when the executable's alignment was greater than
(8 * sizeof(void*)). The process then tended to crash.
riscv: Previously, the loader didn't propagate the p_align field of the
PT_TLS segment into StaticTlsLayout::alignment_, so high alignment
values were ignored.
__bionic_check_tls_alignment: Stop capping alignment at page_size().
There is no need to cap it, and the uncapped value is necessary for
correctly positioning the TLS segment relative to the thread pointer
(TP) for ARM and x86. The uncapped value is now used for computing
static TLS layout, but only a page of alignment is actually provided:
* static TLS: __allocate_thread_mapping uses mmap, which provides only
a page's worth of alignment
* dynamic TLS: BionicAllocator::memalign caps align to page_size()
* There were no callers to StaticTlsLayout::alignment(), so remove it.
Allow PT_TLS.p_align to be 0: quietly convert it to 1.
For static TLS, ensure that the address of a TLS block is congruent to
p_vaddr, modulo p_align. That is, ensure this formula holds:
(&tls_block % p_align) == (p_vaddr % p_align)
For dynamic TLS, a TLS block is still allocated congruent to 0 modulo
p_align. Fixing dynamic TLS congruence is mostly a separate problem
from fixing static TLS congruence, and requires changing the dynamic
TLS allocator and/or DTV structure, so it should be fixed in a
later follow-up commit.
Typically (p_vaddr % p_align) is zero, but it's currently possible to
get a non-zero value with LLD: when .tbss has greater than page
alignment, but .tdata does not, LLD can produce a TLS segment where
(p_vaddr % p_align) is non-zero. LLD calculates TP offsets assuming
the loader will align the segment using (p_vaddr % p_align).
Previously, Bionic and LLD disagreed on the offsets from the TP to
the executable's TLS variables.
Add unit tests for StaticTlsLayout in bionic-unit-tests-static.
See also:
* https://github.com/llvm/llvm-project/issues/40872
* https://sourceware.org/bugzilla/show_bug.cgi?id=24606
* https://reviews.llvm.org/D61824
* https://reviews.freebsd.org/D31538
Bug: http://b/133354825
Bug: http://b/328844725
Bug: http://b/328844839
Test: bionic-unit-tests bionic-unit-tests-static
Change-Id: I8850c32ff742a45d3450d8fc39075c10a1e11000
2024-03-15 00:51:27 +01:00
|
|
|
"elftls_align_test_helper",
|
2019-01-16 05:35:00 +01:00
|
|
|
"elftls_dlopen_ie_error_helper",
|
2024-03-01 07:56:36 +01:00
|
|
|
"elftls_dtv_resize_helper",
|
Fix StaticTlsLayout for atypical alignment values
arm32/arm64: Previously, the loader miscalculated a negative value for
offset_bionic_tcb_ when the executable's alignment was greater than
(8 * sizeof(void*)). The process then tended to crash.
riscv: Previously, the loader didn't propagate the p_align field of the
PT_TLS segment into StaticTlsLayout::alignment_, so high alignment
values were ignored.
__bionic_check_tls_alignment: Stop capping alignment at page_size().
There is no need to cap it, and the uncapped value is necessary for
correctly positioning the TLS segment relative to the thread pointer
(TP) for ARM and x86. The uncapped value is now used for computing
static TLS layout, but only a page of alignment is actually provided:
* static TLS: __allocate_thread_mapping uses mmap, which provides only
a page's worth of alignment
* dynamic TLS: BionicAllocator::memalign caps align to page_size()
* There were no callers to StaticTlsLayout::alignment(), so remove it.
Allow PT_TLS.p_align to be 0: quietly convert it to 1.
For static TLS, ensure that the address of a TLS block is congruent to
p_vaddr, modulo p_align. That is, ensure this formula holds:
(&tls_block % p_align) == (p_vaddr % p_align)
For dynamic TLS, a TLS block is still allocated congruent to 0 modulo
p_align. Fixing dynamic TLS congruence is mostly a separate problem
from fixing static TLS congruence, and requires changing the dynamic
TLS allocator and/or DTV structure, so it should be fixed in a
later follow-up commit.
Typically (p_vaddr % p_align) is zero, but it's currently possible to
get a non-zero value with LLD: when .tbss has greater than page
alignment, but .tdata does not, LLD can produce a TLS segment where
(p_vaddr % p_align) is non-zero. LLD calculates TP offsets assuming
the loader will align the segment using (p_vaddr % p_align).
Previously, Bionic and LLD disagreed on the offsets from the TP to
the executable's TLS variables.
Add unit tests for StaticTlsLayout in bionic-unit-tests-static.
See also:
* https://github.com/llvm/llvm-project/issues/40872
* https://sourceware.org/bugzilla/show_bug.cgi?id=24606
* https://reviews.llvm.org/D61824
* https://reviews.freebsd.org/D31538
Bug: http://b/133354825
Bug: http://b/328844725
Bug: http://b/328844839
Test: bionic-unit-tests bionic-unit-tests-static
Change-Id: I8850c32ff742a45d3450d8fc39075c10a1e11000
2024-03-15 00:51:27 +01:00
|
|
|
"elftls_skew_align_test_helper",
|
2018-10-02 08:10:05 +02:00
|
|
|
"exec_linker_helper",
|
|
|
|
"exec_linker_helper_lib",
|
2021-01-13 01:07:50 +01:00
|
|
|
"heap_tagging_async_helper",
|
|
|
|
"heap_tagging_disabled_helper",
|
|
|
|
"heap_tagging_static_async_helper",
|
|
|
|
"heap_tagging_static_disabled_helper",
|
|
|
|
"heap_tagging_static_sync_helper",
|
|
|
|
"heap_tagging_sync_helper",
|
2022-08-31 22:57:03 +02:00
|
|
|
"stack_tagging_helper",
|
|
|
|
"stack_tagging_static_helper",
|
2021-01-13 01:07:50 +01:00
|
|
|
"ld_config_test_helper",
|
|
|
|
"ld_config_test_helper_lib1",
|
|
|
|
"ld_config_test_helper_lib2",
|
|
|
|
"ld_config_test_helper_lib3",
|
|
|
|
"ld_preload_test_helper",
|
|
|
|
"ld_preload_test_helper_lib1",
|
|
|
|
"ld_preload_test_helper_lib2",
|
2021-09-25 02:49:58 +02:00
|
|
|
"ns_hidden_child_helper",
|
|
|
|
"preinit_getauxval_test_helper",
|
|
|
|
"preinit_syscall_test_helper",
|
|
|
|
"thread_exit_cb_helper",
|
|
|
|
"tls_properties_helper",
|
|
|
|
],
|
|
|
|
data_libs: [
|
2017-04-11 01:52:25 +02:00
|
|
|
"libatest_simple_zip",
|
|
|
|
"libcfi-test",
|
|
|
|
"libcfi-test-bad",
|
2021-01-13 01:07:50 +01:00
|
|
|
"libdl_preempt_test_1",
|
|
|
|
"libdl_preempt_test_2",
|
|
|
|
"libdl_test_df_1_global",
|
|
|
|
"libdlext_test",
|
2017-04-11 01:52:25 +02:00
|
|
|
"libdlext_test_different_soname",
|
|
|
|
"libdlext_test_fd",
|
|
|
|
"libdlext_test_norelro",
|
2018-10-17 21:59:38 +02:00
|
|
|
"libdlext_test_recursive",
|
2017-04-11 01:52:25 +02:00
|
|
|
"libdlext_test_zip",
|
2017-04-19 20:58:52 +02:00
|
|
|
"libgnu-hash-table-library",
|
2021-01-13 01:07:50 +01:00
|
|
|
"libns_hidden_child_app",
|
|
|
|
"libns_hidden_child_global",
|
|
|
|
"libns_hidden_child_internal",
|
|
|
|
"libns_hidden_child_public",
|
|
|
|
"libnstest_dlopened",
|
|
|
|
"libnstest_ns_a_public1",
|
|
|
|
"libnstest_ns_a_public1_internal",
|
|
|
|
"libnstest_ns_b_public2",
|
|
|
|
"libnstest_ns_b_public3",
|
|
|
|
"libnstest_private",
|
|
|
|
"libnstest_private_external",
|
|
|
|
"libnstest_public",
|
|
|
|
"libnstest_public_internal",
|
|
|
|
"libnstest_root",
|
|
|
|
"libnstest_root_not_isolated",
|
2020-01-28 21:18:35 +01:00
|
|
|
"librelocations-ANDROID_REL",
|
2021-01-13 01:07:50 +01:00
|
|
|
"librelocations-ANDROID_RELR",
|
2020-01-28 21:18:35 +01:00
|
|
|
"librelocations-RELR",
|
|
|
|
"librelocations-fat",
|
2021-01-13 01:07:50 +01:00
|
|
|
"libsegment_gap_inner",
|
|
|
|
"libsegment_gap_outer",
|
2017-04-11 01:52:25 +02:00
|
|
|
"libsysv-hash-table-library",
|
|
|
|
"libtest_atexit",
|
2021-01-13 01:07:50 +01:00
|
|
|
"libtest_check_order_dlsym",
|
2017-04-11 01:52:25 +02:00
|
|
|
"libtest_check_order_dlsym_1_left",
|
|
|
|
"libtest_check_order_dlsym_2_right",
|
|
|
|
"libtest_check_order_dlsym_3_c",
|
|
|
|
"libtest_check_order_dlsym_a",
|
|
|
|
"libtest_check_order_dlsym_b",
|
|
|
|
"libtest_check_order_dlsym_d",
|
2021-01-13 01:07:50 +01:00
|
|
|
"libtest_check_order_reloc_root",
|
2017-04-11 01:52:25 +02:00
|
|
|
"libtest_check_order_reloc_root_1",
|
|
|
|
"libtest_check_order_reloc_root_2",
|
2021-01-13 01:07:50 +01:00
|
|
|
"libtest_check_order_reloc_siblings",
|
2017-04-11 01:52:25 +02:00
|
|
|
"libtest_check_order_reloc_siblings_1",
|
|
|
|
"libtest_check_order_reloc_siblings_2",
|
|
|
|
"libtest_check_order_reloc_siblings_3",
|
|
|
|
"libtest_check_order_reloc_siblings_a",
|
|
|
|
"libtest_check_order_reloc_siblings_b",
|
2021-01-13 01:07:50 +01:00
|
|
|
"libtest_check_order_reloc_siblings_c",
|
2017-04-11 01:52:25 +02:00
|
|
|
"libtest_check_order_reloc_siblings_c_1",
|
|
|
|
"libtest_check_order_reloc_siblings_c_2",
|
|
|
|
"libtest_check_order_reloc_siblings_d",
|
|
|
|
"libtest_check_order_reloc_siblings_e",
|
|
|
|
"libtest_check_order_reloc_siblings_f",
|
|
|
|
"libtest_check_rtld_next_from_library",
|
2018-03-27 19:32:19 +02:00
|
|
|
"libtest_dlopen_df_1_global",
|
2017-04-11 01:52:25 +02:00
|
|
|
"libtest_dlopen_from_ctor",
|
2021-01-13 01:07:50 +01:00
|
|
|
"libtest_dlopen_from_ctor_main",
|
2017-04-11 01:52:25 +02:00
|
|
|
"libtest_dlopen_weak_undefined_func",
|
|
|
|
"libtest_dlsym_df_1_global",
|
2021-01-13 01:07:50 +01:00
|
|
|
"libtest_dlsym_from_this",
|
2017-04-11 01:52:25 +02:00
|
|
|
"libtest_dlsym_from_this_child",
|
|
|
|
"libtest_dlsym_from_this_grandchild",
|
|
|
|
"libtest_dlsym_weak_func",
|
2021-01-13 01:07:50 +01:00
|
|
|
"libtest_dt_runpath_a",
|
|
|
|
"libtest_dt_runpath_b",
|
|
|
|
"libtest_dt_runpath_c",
|
2017-04-11 01:52:25 +02:00
|
|
|
"libtest_dt_runpath_d",
|
2021-01-13 01:07:50 +01:00
|
|
|
"libtest_dt_runpath_x",
|
|
|
|
"libtest_dt_runpath_y",
|
2019-01-24 08:19:19 +01:00
|
|
|
"libtest_elftls_dynamic",
|
|
|
|
"libtest_elftls_dynamic_filler_1",
|
|
|
|
"libtest_elftls_dynamic_filler_2",
|
|
|
|
"libtest_elftls_dynamic_filler_3",
|
2024-03-01 07:56:36 +01:00
|
|
|
"libtest_elftls_dynamic_filler_4",
|
|
|
|
"libtest_elftls_dynamic_filler_5",
|
2019-01-16 05:35:00 +01:00
|
|
|
"libtest_elftls_shared_var",
|
|
|
|
"libtest_elftls_shared_var_ie",
|
|
|
|
"libtest_elftls_tprel",
|
2017-04-11 01:52:25 +02:00
|
|
|
"libtest_empty",
|
2017-04-19 20:58:52 +02:00
|
|
|
"libtest_ifunc",
|
2021-01-13 01:07:50 +01:00
|
|
|
"libtest_ifunc_variable",
|
|
|
|
"libtest_ifunc_variable_impl",
|
|
|
|
"libtest_indirect_thread_local_dtor",
|
2017-04-11 01:52:25 +02:00
|
|
|
"libtest_init_fini_order_child",
|
|
|
|
"libtest_init_fini_order_grand_child",
|
|
|
|
"libtest_init_fini_order_root",
|
2021-01-13 01:07:50 +01:00
|
|
|
"libtest_init_fini_order_root2",
|
|
|
|
"libtest_invalid-empty_shdr_table",
|
2022-03-25 05:14:27 +01:00
|
|
|
"libtest_invalid-local-tls",
|
2021-01-13 01:07:50 +01:00
|
|
|
"libtest_invalid-rw_load_segment",
|
|
|
|
"libtest_invalid-textrels",
|
|
|
|
"libtest_invalid-textrels2",
|
|
|
|
"libtest_invalid-unaligned_shdr_offset",
|
|
|
|
"libtest_invalid-zero_shdr_table_content",
|
|
|
|
"libtest_invalid-zero_shdr_table_offset",
|
|
|
|
"libtest_invalid-zero_shentsize",
|
|
|
|
"libtest_invalid-zero_shstrndx",
|
|
|
|
"libtest_missing_symbol",
|
2018-03-29 20:28:53 +02:00
|
|
|
"libtest_missing_symbol_child_private",
|
2021-01-13 01:07:50 +01:00
|
|
|
"libtest_missing_symbol_child_public",
|
2018-03-27 19:32:19 +02:00
|
|
|
"libtest_missing_symbol_root",
|
2017-04-11 01:52:25 +02:00
|
|
|
"libtest_nodelete_1",
|
|
|
|
"libtest_nodelete_2",
|
|
|
|
"libtest_nodelete_dt_flags_1",
|
|
|
|
"libtest_pthread_atfork",
|
2021-01-13 01:07:50 +01:00
|
|
|
"libtest_relo_check_dt_needed_order",
|
2017-04-11 01:52:25 +02:00
|
|
|
"libtest_relo_check_dt_needed_order_1",
|
|
|
|
"libtest_relo_check_dt_needed_order_2",
|
|
|
|
"libtest_simple",
|
2021-01-13 01:07:50 +01:00
|
|
|
"libtest_thread_local_dtor",
|
|
|
|
"libtest_thread_local_dtor2",
|
2017-04-11 01:52:25 +02:00
|
|
|
"libtest_two_parents_child",
|
|
|
|
"libtest_two_parents_parent1",
|
|
|
|
"libtest_two_parents_parent2",
|
|
|
|
"libtest_versioned_lib",
|
|
|
|
"libtest_versioned_libv1",
|
|
|
|
"libtest_versioned_libv2",
|
|
|
|
"libtest_versioned_otherlib",
|
2021-01-13 01:07:50 +01:00
|
|
|
"libtest_versioned_otherlib_empty",
|
2017-04-11 01:52:25 +02:00
|
|
|
"libtest_versioned_uselibv1",
|
|
|
|
"libtest_versioned_uselibv2",
|
2021-01-13 01:07:50 +01:00
|
|
|
"libtest_versioned_uselibv2_other",
|
2017-04-11 01:52:25 +02:00
|
|
|
"libtest_versioned_uselibv3_other",
|
2021-01-13 01:07:50 +01:00
|
|
|
"libtest_with_dependency",
|
|
|
|
"libtest_with_dependency_loop",
|
2017-04-11 01:52:25 +02:00
|
|
|
"libtest_with_dependency_loop_a",
|
|
|
|
"libtest_with_dependency_loop_b",
|
|
|
|
"libtest_with_dependency_loop_c",
|
2021-01-13 01:07:50 +01:00
|
|
|
"libtestshared",
|
2017-04-11 01:52:25 +02:00
|
|
|
],
|
2016-07-12 01:20:06 +02:00
|
|
|
}
|
|
|
|
|
2023-08-21 13:53:15 +02:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// Tests for the device using bionic's .so. Run with:
|
|
|
|
// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
|
|
|
|
// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
cc_defaults {
|
|
|
|
name: "bionic_unit_tests_defaults",
|
|
|
|
host_supported: false,
|
|
|
|
gtest: false,
|
|
|
|
|
|
|
|
defaults: [
|
|
|
|
"bionic_tests_defaults",
|
|
|
|
"bionic_unit_tests_data",
|
|
|
|
],
|
|
|
|
|
|
|
|
whole_static_libs: [
|
|
|
|
"libBionicTests",
|
|
|
|
"libBionicLoaderTests",
|
|
|
|
"libBionicElfTlsLoaderTests",
|
|
|
|
],
|
|
|
|
|
|
|
|
static_libs: [
|
|
|
|
"libtinyxml2",
|
|
|
|
"liblog",
|
|
|
|
"libbase",
|
|
|
|
"libgtest_isolated",
|
|
|
|
],
|
|
|
|
|
|
|
|
srcs: [
|
|
|
|
// TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
|
|
|
|
"__cxa_thread_atexit_test.cpp",
|
|
|
|
"gtest_globals.cpp",
|
|
|
|
"gtest_main.cpp",
|
|
|
|
"gwp_asan_test.cpp",
|
|
|
|
"thread_local_test.cpp",
|
|
|
|
],
|
|
|
|
|
|
|
|
conlyflags: [
|
|
|
|
"-fexceptions",
|
|
|
|
"-fnon-call-exceptions",
|
|
|
|
],
|
|
|
|
|
|
|
|
ldflags: ["-Wl,--export-dynamic"],
|
|
|
|
|
|
|
|
include_dirs: ["bionic/libc"],
|
|
|
|
|
|
|
|
stl: "libc++_static",
|
|
|
|
|
|
|
|
target: {
|
|
|
|
android: {
|
|
|
|
shared_libs: [
|
|
|
|
"ld-android",
|
|
|
|
"libdl",
|
|
|
|
"libdl_android",
|
|
|
|
"libdl_preempt_test_1",
|
|
|
|
"libdl_preempt_test_2",
|
|
|
|
"libdl_test_df_1_global",
|
|
|
|
"libtest_elftls_shared_var",
|
|
|
|
"libtest_elftls_tprel",
|
|
|
|
],
|
|
|
|
static_libs: [
|
|
|
|
// The order of these libraries matters, do not shuffle them.
|
|
|
|
"libmeminfo",
|
|
|
|
"libziparchive",
|
|
|
|
"libz",
|
|
|
|
"libutils",
|
|
|
|
],
|
|
|
|
ldflags: [
|
|
|
|
"-Wl,--rpath,${ORIGIN}/bionic-loader-test-libs",
|
|
|
|
"-Wl,--enable-new-dtags",
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2019-02-28 03:07:55 +01:00
|
|
|
cc_test {
|
|
|
|
name: "bionic-unit-tests",
|
|
|
|
defaults: [
|
|
|
|
"bionic_unit_tests_defaults",
|
|
|
|
],
|
2021-09-30 23:04:39 +02:00
|
|
|
test_suites: ["device-tests"],
|
2021-09-25 02:49:58 +02:00
|
|
|
data: [
|
|
|
|
":libdlext_test_runpath_zip_zipaligned",
|
|
|
|
":libdlext_test_zip_zipaligned",
|
|
|
|
],
|
2019-02-28 03:07:55 +01:00
|
|
|
}
|
|
|
|
|
2023-03-23 00:12:49 +01:00
|
|
|
cc_test {
|
|
|
|
name: "hwasan_test",
|
|
|
|
enabled: false,
|
|
|
|
// This does not use bionic_tests_defaults because it is not supported on
|
|
|
|
// host.
|
|
|
|
arch: {
|
|
|
|
arm64: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
sanitize: {
|
|
|
|
hwaddress: true,
|
|
|
|
},
|
|
|
|
srcs: [
|
|
|
|
"hwasan_test.cpp",
|
|
|
|
],
|
|
|
|
shared_libs: [
|
|
|
|
"libbase",
|
|
|
|
],
|
2024-01-19 20:05:36 +01:00
|
|
|
data_libs: [
|
|
|
|
"libtest_simple_hwasan",
|
|
|
|
"libtest_simple_hwasan_nohwasan",
|
|
|
|
],
|
2023-03-23 00:12:49 +01:00
|
|
|
header_libs: ["bionic_libc_platform_headers"],
|
|
|
|
test_suites: ["device-tests"],
|
2024-02-15 23:20:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
cc_test {
|
|
|
|
name: "memtag_stack_dlopen_test",
|
|
|
|
enabled: false,
|
|
|
|
// This does not use bionic_tests_defaults because it is not supported on
|
|
|
|
// host.
|
|
|
|
arch: {
|
|
|
|
arm64: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
sanitize: {
|
|
|
|
memtag_heap: true,
|
|
|
|
memtag_stack: false,
|
|
|
|
},
|
|
|
|
srcs: [
|
|
|
|
"memtag_stack_dlopen_test.cpp",
|
|
|
|
],
|
|
|
|
shared_libs: [
|
|
|
|
"libbase",
|
|
|
|
],
|
2024-05-24 15:54:42 +02:00
|
|
|
data_libs: [
|
|
|
|
"libtest_simple_memtag_stack",
|
|
|
|
"libtest_depends_on_simple_memtag_stack",
|
|
|
|
],
|
2024-02-15 23:20:54 +01:00
|
|
|
data_bins: [
|
|
|
|
"testbinary_depends_on_simple_memtag_stack",
|
|
|
|
"testbinary_depends_on_depends_on_simple_memtag_stack",
|
2024-05-24 15:54:42 +02:00
|
|
|
"testbinary_is_stack_mte_after_dlopen",
|
2024-02-15 23:20:54 +01:00
|
|
|
],
|
|
|
|
header_libs: ["bionic_libc_platform_headers"],
|
|
|
|
test_suites: ["device-tests"],
|
2023-03-23 00:12:49 +01:00
|
|
|
}
|
|
|
|
|
2019-10-21 21:35:05 +02:00
|
|
|
cc_test {
|
|
|
|
name: "bionic-stress-tests",
|
|
|
|
defaults: [
|
|
|
|
"bionic_tests_defaults",
|
|
|
|
],
|
|
|
|
|
|
|
|
// For now, these tests run forever, so do not use the isolation framework.
|
|
|
|
isolated: false,
|
2021-02-05 01:52:14 +01:00
|
|
|
// Running forever, do not consider unit test.
|
|
|
|
test_options: {
|
|
|
|
unit_test: false,
|
|
|
|
},
|
2019-10-21 21:35:05 +02:00
|
|
|
|
|
|
|
srcs: [
|
|
|
|
"malloc_stress_test.cpp",
|
|
|
|
],
|
|
|
|
|
|
|
|
shared_libs: [
|
|
|
|
"libbase",
|
|
|
|
],
|
|
|
|
|
|
|
|
target: {
|
|
|
|
android: {
|
|
|
|
static_libs: [
|
|
|
|
"libmeminfo",
|
|
|
|
"libprocinfo",
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2016-07-12 01:20:06 +02:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// Tests for the device linked against bionic's static library. Run with:
|
2018-06-18 07:14:43 +02:00
|
|
|
// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
|
|
|
|
// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
|
2016-07-12 01:20:06 +02:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
cc_test {
|
|
|
|
name: "bionic-unit-tests-static",
|
2018-08-22 03:13:10 +02:00
|
|
|
gtest: false,
|
2016-07-12 01:20:06 +02:00
|
|
|
defaults: ["bionic_tests_defaults"],
|
2021-09-30 23:04:39 +02:00
|
|
|
test_suites: ["device-tests"],
|
2016-07-12 01:20:06 +02:00
|
|
|
host_supported: false,
|
|
|
|
|
2017-01-06 23:49:57 +01:00
|
|
|
srcs: [
|
|
|
|
"gtest_preinit_debuggerd.cpp",
|
2018-08-22 03:13:10 +02:00
|
|
|
"gtest_globals.cpp",
|
|
|
|
"gtest_main.cpp",
|
2019-01-24 22:47:13 +01:00
|
|
|
|
Fix StaticTlsLayout for atypical alignment values
arm32/arm64: Previously, the loader miscalculated a negative value for
offset_bionic_tcb_ when the executable's alignment was greater than
(8 * sizeof(void*)). The process then tended to crash.
riscv: Previously, the loader didn't propagate the p_align field of the
PT_TLS segment into StaticTlsLayout::alignment_, so high alignment
values were ignored.
__bionic_check_tls_alignment: Stop capping alignment at page_size().
There is no need to cap it, and the uncapped value is necessary for
correctly positioning the TLS segment relative to the thread pointer
(TP) for ARM and x86. The uncapped value is now used for computing
static TLS layout, but only a page of alignment is actually provided:
* static TLS: __allocate_thread_mapping uses mmap, which provides only
a page's worth of alignment
* dynamic TLS: BionicAllocator::memalign caps align to page_size()
* There were no callers to StaticTlsLayout::alignment(), so remove it.
Allow PT_TLS.p_align to be 0: quietly convert it to 1.
For static TLS, ensure that the address of a TLS block is congruent to
p_vaddr, modulo p_align. That is, ensure this formula holds:
(&tls_block % p_align) == (p_vaddr % p_align)
For dynamic TLS, a TLS block is still allocated congruent to 0 modulo
p_align. Fixing dynamic TLS congruence is mostly a separate problem
from fixing static TLS congruence, and requires changing the dynamic
TLS allocator and/or DTV structure, so it should be fixed in a
later follow-up commit.
Typically (p_vaddr % p_align) is zero, but it's currently possible to
get a non-zero value with LLD: when .tbss has greater than page
alignment, but .tdata does not, LLD can produce a TLS segment where
(p_vaddr % p_align) is non-zero. LLD calculates TP offsets assuming
the loader will align the segment using (p_vaddr % p_align).
Previously, Bionic and LLD disagreed on the offsets from the TP to
the executable's TLS variables.
Add unit tests for StaticTlsLayout in bionic-unit-tests-static.
See also:
* https://github.com/llvm/llvm-project/issues/40872
* https://sourceware.org/bugzilla/show_bug.cgi?id=24606
* https://reviews.llvm.org/D61824
* https://reviews.freebsd.org/D31538
Bug: http://b/133354825
Bug: http://b/328844725
Bug: http://b/328844839
Test: bionic-unit-tests bionic-unit-tests-static
Change-Id: I8850c32ff742a45d3450d8fc39075c10a1e11000
2024-03-15 00:51:27 +01:00
|
|
|
// Test internal parts of Bionic that aren't exposed via libc.so.
|
2019-01-24 22:47:13 +01:00
|
|
|
"bionic_allocator_test.cpp",
|
Fix StaticTlsLayout for atypical alignment values
arm32/arm64: Previously, the loader miscalculated a negative value for
offset_bionic_tcb_ when the executable's alignment was greater than
(8 * sizeof(void*)). The process then tended to crash.
riscv: Previously, the loader didn't propagate the p_align field of the
PT_TLS segment into StaticTlsLayout::alignment_, so high alignment
values were ignored.
__bionic_check_tls_alignment: Stop capping alignment at page_size().
There is no need to cap it, and the uncapped value is necessary for
correctly positioning the TLS segment relative to the thread pointer
(TP) for ARM and x86. The uncapped value is now used for computing
static TLS layout, but only a page of alignment is actually provided:
* static TLS: __allocate_thread_mapping uses mmap, which provides only
a page's worth of alignment
* dynamic TLS: BionicAllocator::memalign caps align to page_size()
* There were no callers to StaticTlsLayout::alignment(), so remove it.
Allow PT_TLS.p_align to be 0: quietly convert it to 1.
For static TLS, ensure that the address of a TLS block is congruent to
p_vaddr, modulo p_align. That is, ensure this formula holds:
(&tls_block % p_align) == (p_vaddr % p_align)
For dynamic TLS, a TLS block is still allocated congruent to 0 modulo
p_align. Fixing dynamic TLS congruence is mostly a separate problem
from fixing static TLS congruence, and requires changing the dynamic
TLS allocator and/or DTV structure, so it should be fixed in a
later follow-up commit.
Typically (p_vaddr % p_align) is zero, but it's currently possible to
get a non-zero value with LLD: when .tbss has greater than page
alignment, but .tdata does not, LLD can produce a TLS segment where
(p_vaddr % p_align) is non-zero. LLD calculates TP offsets assuming
the loader will align the segment using (p_vaddr % p_align).
Previously, Bionic and LLD disagreed on the offsets from the TP to
the executable's TLS variables.
Add unit tests for StaticTlsLayout in bionic-unit-tests-static.
See also:
* https://github.com/llvm/llvm-project/issues/40872
* https://sourceware.org/bugzilla/show_bug.cgi?id=24606
* https://reviews.llvm.org/D61824
* https://reviews.freebsd.org/D31538
Bug: http://b/133354825
Bug: http://b/328844725
Bug: http://b/328844839
Test: bionic-unit-tests bionic-unit-tests-static
Change-Id: I8850c32ff742a45d3450d8fc39075c10a1e11000
2024-03-15 00:51:27 +01:00
|
|
|
"static_tls_layout_test.cpp",
|
2019-01-24 22:47:13 +01:00
|
|
|
],
|
|
|
|
include_dirs: [
|
|
|
|
"bionic/libc",
|
2017-01-06 23:49:57 +01:00
|
|
|
],
|
2016-07-12 01:20:06 +02:00
|
|
|
whole_static_libs: [
|
|
|
|
"libBionicTests",
|
|
|
|
],
|
|
|
|
|
|
|
|
static_libs: [
|
|
|
|
"libm",
|
|
|
|
"libc",
|
|
|
|
"libdl",
|
|
|
|
"libtinyxml2",
|
|
|
|
"liblog",
|
|
|
|
"libbase",
|
2016-10-27 02:55:49 +02:00
|
|
|
"libdebuggerd_handler",
|
2018-08-22 03:13:10 +02:00
|
|
|
"libgtest_isolated",
|
2019-01-16 05:35:00 +01:00
|
|
|
"libtest_elftls_shared_var",
|
|
|
|
"libtest_elftls_tprel",
|
2016-07-12 01:20:06 +02:00
|
|
|
],
|
|
|
|
|
|
|
|
static_executable: true,
|
|
|
|
stl: "libc++_static",
|
2021-10-21 11:31:35 +02:00
|
|
|
// Clang cannot build ifunc with LTO.
|
|
|
|
// http://b/203737712
|
|
|
|
lto: {
|
|
|
|
never: true,
|
|
|
|
},
|
2022-02-05 02:13:27 +01:00
|
|
|
data_bins: [
|
Fix StaticTlsLayout for atypical alignment values
arm32/arm64: Previously, the loader miscalculated a negative value for
offset_bionic_tcb_ when the executable's alignment was greater than
(8 * sizeof(void*)). The process then tended to crash.
riscv: Previously, the loader didn't propagate the p_align field of the
PT_TLS segment into StaticTlsLayout::alignment_, so high alignment
values were ignored.
__bionic_check_tls_alignment: Stop capping alignment at page_size().
There is no need to cap it, and the uncapped value is necessary for
correctly positioning the TLS segment relative to the thread pointer
(TP) for ARM and x86. The uncapped value is now used for computing
static TLS layout, but only a page of alignment is actually provided:
* static TLS: __allocate_thread_mapping uses mmap, which provides only
a page's worth of alignment
* dynamic TLS: BionicAllocator::memalign caps align to page_size()
* There were no callers to StaticTlsLayout::alignment(), so remove it.
Allow PT_TLS.p_align to be 0: quietly convert it to 1.
For static TLS, ensure that the address of a TLS block is congruent to
p_vaddr, modulo p_align. That is, ensure this formula holds:
(&tls_block % p_align) == (p_vaddr % p_align)
For dynamic TLS, a TLS block is still allocated congruent to 0 modulo
p_align. Fixing dynamic TLS congruence is mostly a separate problem
from fixing static TLS congruence, and requires changing the dynamic
TLS allocator and/or DTV structure, so it should be fixed in a
later follow-up commit.
Typically (p_vaddr % p_align) is zero, but it's currently possible to
get a non-zero value with LLD: when .tbss has greater than page
alignment, but .tdata does not, LLD can produce a TLS segment where
(p_vaddr % p_align) is non-zero. LLD calculates TP offsets assuming
the loader will align the segment using (p_vaddr % p_align).
Previously, Bionic and LLD disagreed on the offsets from the TP to
the executable's TLS variables.
Add unit tests for StaticTlsLayout in bionic-unit-tests-static.
See also:
* https://github.com/llvm/llvm-project/issues/40872
* https://sourceware.org/bugzilla/show_bug.cgi?id=24606
* https://reviews.llvm.org/D61824
* https://reviews.freebsd.org/D31538
Bug: http://b/133354825
Bug: http://b/328844725
Bug: http://b/328844839
Test: bionic-unit-tests bionic-unit-tests-static
Change-Id: I8850c32ff742a45d3450d8fc39075c10a1e11000
2024-03-15 00:51:27 +01:00
|
|
|
"elftls_align_test_helper",
|
|
|
|
"elftls_skew_align_test_helper",
|
2022-02-05 02:13:27 +01:00
|
|
|
"heap_tagging_async_helper",
|
|
|
|
"heap_tagging_disabled_helper",
|
|
|
|
"heap_tagging_static_async_helper",
|
|
|
|
"heap_tagging_static_disabled_helper",
|
|
|
|
"heap_tagging_static_sync_helper",
|
|
|
|
"heap_tagging_sync_helper",
|
2022-08-31 22:57:03 +02:00
|
|
|
"stack_tagging_helper",
|
|
|
|
"stack_tagging_static_helper",
|
2022-02-05 02:13:27 +01:00
|
|
|
],
|
2016-07-12 01:20:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// Tests to run on the host and linked against glibc. Run with:
|
|
|
|
// cd bionic/tests; mm bionic-unit-tests-glibc-run
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
cc_test_host {
|
|
|
|
name: "bionic-unit-tests-glibc",
|
2018-08-22 03:13:10 +02:00
|
|
|
gtest: false,
|
2016-07-12 01:20:06 +02:00
|
|
|
defaults: ["bionic_tests_defaults"],
|
|
|
|
|
|
|
|
srcs: [
|
|
|
|
"atexit_test.cpp",
|
2016-09-19 19:50:28 +02:00
|
|
|
"dlfcn_symlink_support.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"dlfcn_test.cpp",
|
|
|
|
"dl_test.cpp",
|
2021-10-15 00:44:47 +02:00
|
|
|
"execinfo_test.cpp",
|
2018-08-22 03:13:10 +02:00
|
|
|
"gtest_globals.cpp",
|
|
|
|
"gtest_main.cpp",
|
2016-07-12 01:20:06 +02:00
|
|
|
"pthread_dlfcn_test.cpp",
|
|
|
|
],
|
|
|
|
|
|
|
|
shared_libs: [
|
|
|
|
"libdl_preempt_test_1",
|
|
|
|
"libdl_preempt_test_2",
|
|
|
|
"libdl_test_df_1_global",
|
2019-01-16 05:35:00 +01:00
|
|
|
"libtest_elftls_shared_var",
|
|
|
|
"libtest_elftls_tprel",
|
2016-07-12 01:20:06 +02:00
|
|
|
],
|
|
|
|
|
|
|
|
whole_static_libs: [
|
|
|
|
"libBionicStandardTests",
|
2019-01-16 05:35:00 +01:00
|
|
|
"libBionicElfTlsTests",
|
|
|
|
"libBionicElfTlsLoaderTests",
|
2016-07-12 01:20:06 +02:00
|
|
|
"libfortify1-tests-clang",
|
|
|
|
"libfortify2-tests-clang",
|
|
|
|
],
|
|
|
|
|
|
|
|
static_libs: [
|
|
|
|
"libbase",
|
|
|
|
"liblog",
|
|
|
|
"libcutils",
|
2018-08-22 03:13:10 +02:00
|
|
|
"libgtest_isolated",
|
2016-07-12 01:20:06 +02:00
|
|
|
],
|
|
|
|
|
|
|
|
host_ldlibs: [
|
|
|
|
"-lresolv",
|
|
|
|
"-lutil",
|
|
|
|
],
|
|
|
|
|
2018-08-22 03:13:10 +02:00
|
|
|
include_dirs: [
|
|
|
|
"bionic/libc",
|
|
|
|
],
|
2016-07-12 01:20:06 +02:00
|
|
|
|
2016-11-25 21:23:11 +01:00
|
|
|
ldflags: [
|
|
|
|
"-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
|
|
|
|
"-Wl,--export-dynamic",
|
|
|
|
],
|
2016-07-12 01:20:06 +02:00
|
|
|
|
|
|
|
sanitize: {
|
|
|
|
never: false,
|
|
|
|
},
|
2017-09-22 01:56:06 +02:00
|
|
|
|
|
|
|
target: {
|
|
|
|
linux_bionic: {
|
|
|
|
enabled: false,
|
|
|
|
},
|
2021-07-28 20:18:11 +02:00
|
|
|
musl: {
|
|
|
|
exclude_static_libs: [
|
|
|
|
// Musl doesn't have fortify
|
|
|
|
"libfortify1-tests-clang",
|
|
|
|
"libfortify2-tests-clang",
|
|
|
|
],
|
|
|
|
},
|
2017-09-22 01:56:06 +02:00
|
|
|
},
|
2016-07-12 01:20:06 +02:00
|
|
|
}
|
|
|
|
|
2024-05-24 15:54:42 +02:00
|
|
|
cc_defaults {
|
|
|
|
name: "bionic_compile_time_tests_defaults",
|
|
|
|
enabled: false,
|
|
|
|
target: {
|
|
|
|
linux_x86: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
linux_x86_64: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
tidy: false,
|
|
|
|
clang_verify: true,
|
|
|
|
cflags: [
|
|
|
|
"-Wall",
|
|
|
|
"-Wno-error",
|
|
|
|
"-fno-color-diagnostics",
|
|
|
|
"-ferror-limit=10000",
|
|
|
|
"-DCOMPILATION_TESTS=1",
|
|
|
|
"-Wformat-nonliteral",
|
|
|
|
"-U_FORTIFY_SOURCE",
|
|
|
|
],
|
|
|
|
srcs: ["clang_fortify_tests.cpp"],
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library_static {
|
|
|
|
name: "bionic-compile-time-tests1-clang++",
|
|
|
|
defaults: [
|
|
|
|
"bionic_compile_time_tests_defaults",
|
|
|
|
],
|
|
|
|
cppflags: [
|
|
|
|
"-D_FORTIFY_SOURCE=1",
|
|
|
|
],
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library_static {
|
|
|
|
name: "bionic-compile-time-tests2-clang++",
|
|
|
|
defaults: [
|
|
|
|
"bionic_compile_time_tests_defaults",
|
|
|
|
],
|
|
|
|
cppflags: [
|
|
|
|
"-D_FORTIFY_SOURCE=2",
|
|
|
|
],
|
|
|
|
}
|