Merge "Add TEST_MAPPING for debuggerd CTS" into main
diff --git a/debuggerd/Android.bp b/debuggerd/Android.bp
index 7d20995..439218d 100644
--- a/debuggerd/Android.bp
+++ b/debuggerd/Android.bp
@@ -21,8 +21,11 @@
local_include_dirs: ["include"],
product_variables: {
debuggable: {
- cflags: ["-UANDROID_DEBUGGABLE", "-DANDROID_DEBUGGABLE=1"],
- }
+ cflags: [
+ "-UANDROID_DEBUGGABLE",
+ "-DANDROID_DEBUGGABLE=1",
+ ],
+ },
},
}
@@ -256,7 +259,7 @@
],
static_libs: [
- "libdexfile_support", // libunwindstack dependency
+ "libdexfile_support", // libunwindstack dependency
"libunwindstack",
"liblzma",
"libbase",
@@ -299,7 +302,7 @@
},
android: {
runtime_libs: [
- "libdexfile", // libdexfile_support dependency
+ "libdexfile", // libdexfile_support dependency
],
},
},
@@ -494,7 +497,7 @@
header_libs: [
"bionic_libc_platform_headers",
- "libdebuggerd_common_headers"
+ "libdebuggerd_common_headers",
],
static_libs: [
@@ -552,7 +555,6 @@
},
}
-
// This installs the "other" architecture (so 32-bit on 64-bit device).
prebuilt_etc {
name: "crash_dump.policy_other",
diff --git a/debuggerd/crasher/Android.bp b/debuggerd/crasher/Android.bp
index fe1689c..4c6a400 100644
--- a/debuggerd/crasher/Android.bp
+++ b/debuggerd/crasher/Android.bp
@@ -15,7 +15,7 @@
"-fstack-protector-all",
"-Wno-date-time",
],
- tidy: false, // crasher.cpp tests many memory access errors
+ tidy: false, // crasher.cpp tests many memory access errors
srcs: ["crasher.cpp"],
arch: {
arm: {
diff --git a/debuggerd/proto/Android.bp b/debuggerd/proto/Android.bp
index 7be5d61..7b9e780 100644
--- a/debuggerd/proto/Android.bp
+++ b/debuggerd/proto/Android.bp
@@ -52,4 +52,3 @@
sdk_version: "current",
static_libs: ["libprotobuf-java-lite"],
}
-
diff --git a/debuggerd/rust/tombstoned_client/Android.bp b/debuggerd/rust/tombstoned_client/Android.bp
index 2007f39..bf19bb7 100644
--- a/debuggerd/rust/tombstoned_client/Android.bp
+++ b/debuggerd/rust/tombstoned_client/Android.bp
@@ -8,7 +8,7 @@
"wrapper.cpp",
],
generated_sources: [
- "libtombstoned_client_rust_bridge_code"
+ "libtombstoned_client_rust_bridge_code",
],
header_libs: [
"libbase_headers",
diff --git a/debuggerd/test_permissive_mte/Android.bp b/debuggerd/test_permissive_mte/Android.bp
index d3f7520..0ad3243 100644
--- a/debuggerd/test_permissive_mte/Android.bp
+++ b/debuggerd/test_permissive_mte/Android.bp
@@ -17,22 +17,28 @@
}
cc_binary {
- name: "mte_crash",
- tidy: false,
- srcs: ["mte_crash.cpp"],
- sanitize: {
- memtag_heap: true,
- diag: {
- memtag_heap: true,
+ name: "mte_crash",
+ tidy: false,
+ srcs: ["mte_crash.cpp"],
+ sanitize: {
+ memtag_heap: true,
+ diag: {
+ memtag_heap: true,
+ },
},
- },
}
java_test_host {
name: "permissive_mte_test",
libs: ["tradefed"],
- static_libs: ["frameworks-base-hostutils", "cts-install-lib-host"],
- srcs: ["src/**/PermissiveMteTest.java", ":libtombstone_proto-src"],
+ static_libs: [
+ "frameworks-base-hostutils",
+ "cts-install-lib-host",
+ ],
+ srcs: [
+ "src/**/PermissiveMteTest.java",
+ ":libtombstone_proto-src",
+ ],
data: [":mte_crash"],
test_config: "AndroidTest.xml",
test_suites: ["general-tests"],
diff --git a/debuggerd/tombstoned/tombstoned.cpp b/debuggerd/tombstoned/tombstoned.cpp
index e79035f..e2a67a2 100644
--- a/debuggerd/tombstoned/tombstoned.cpp
+++ b/debuggerd/tombstoned/tombstoned.cpp
@@ -61,7 +61,6 @@
struct CrashArtifact {
unique_fd fd;
- std::optional<std::string> temporary_path;
static CrashArtifact devnull() {
CrashArtifact result;
@@ -145,16 +144,13 @@
std::optional<std::string> path;
result.fd.reset(openat(dir_fd_, ".", O_WRONLY | O_APPEND | O_TMPFILE | O_CLOEXEC, 0660));
if (result.fd == -1) {
- // We might not have O_TMPFILE. Try creating with an arbitrary filename instead.
- static size_t counter = 0;
- std::string tmp_filename = StringPrintf(".temporary%zu", counter++);
- result.fd.reset(openat(dir_fd_, tmp_filename.c_str(),
- O_WRONLY | O_APPEND | O_CREAT | O_TRUNC | O_CLOEXEC, 0660));
- if (result.fd == -1) {
- PLOG(FATAL) << "failed to create temporary tombstone in " << dir_path_;
- }
+ PLOG(FATAL) << "failed to create temporary tombstone in " << dir_path_;
+ }
- result.temporary_path = std::move(tmp_filename);
+ // We need to fchmodat after creating to avoid getting the umask applied.
+ std::string fd_path = StringPrintf("/proc/self/fd/%d", result.fd.get());
+ if (fchmodat(dir_fd_, fd_path.c_str(), 0664, 0) != 0) {
+ PLOG(ERROR) << "Failed to make tombstone world-readable";
}
return std::move(result);
@@ -472,20 +468,6 @@
rename_tombstone_fd(crash->output.proto->fd, queue->dir_fd(), *paths.proto);
}
}
-
- // If we don't have O_TMPFILE, we need to clean up after ourselves.
- if (crash->output.text.temporary_path) {
- rc = unlinkat(queue->dir_fd().get(), crash->output.text.temporary_path->c_str(), 0);
- if (rc != 0) {
- PLOG(ERROR) << "failed to unlink temporary tombstone at " << paths.text;
- }
- }
- if (crash->output.proto && crash->output.proto->temporary_path) {
- rc = unlinkat(queue->dir_fd().get(), crash->output.proto->temporary_path->c_str(), 0);
- if (rc != 0) {
- PLOG(ERROR) << "failed to unlink temporary proto tombstone";
- }
- }
}
static void crash_completed_cb(evutil_socket_t sockfd, short ev, void* arg) {
diff --git a/fs_mgr/libdm/dm_target.cpp b/fs_mgr/libdm/dm_target.cpp
index 90d91a0..1f6bd1a 100644
--- a/fs_mgr/libdm/dm_target.cpp
+++ b/fs_mgr/libdm/dm_target.cpp
@@ -61,6 +61,10 @@
return block_device_ + " " + std::to_string(physical_sector_);
}
+std::string DmTargetStripe::GetParameterString() const {
+ return "2 " + std::to_string(chunksize) + " " + block_device0_ + " 0 " + block_device1_ + " 0";
+}
+
DmTargetVerity::DmTargetVerity(uint64_t start, uint64_t length, uint32_t version,
const std::string& block_device, const std::string& hash_device,
uint32_t data_block_size, uint32_t hash_block_size,
diff --git a/fs_mgr/libdm/dm_test.cpp b/fs_mgr/libdm/dm_test.cpp
index a0129c2..d043be6 100644
--- a/fs_mgr/libdm/dm_test.cpp
+++ b/fs_mgr/libdm/dm_test.cpp
@@ -181,6 +181,13 @@
ASSERT_EQ(dm.GetState(dev.name()), DmDeviceState::ACTIVE);
}
+TEST_F(DmTest, StripeArgs) {
+ DmTargetStripe target(0, 4096, 1024, "/dev/loop0", "/dev/loop1");
+ ASSERT_EQ(target.name(), "striped");
+ ASSERT_TRUE(target.Valid());
+ ASSERT_EQ(target.GetParameterString(), "2 1024 /dev/loop0 0 /dev/loop1 0");
+}
+
TEST_F(DmTest, DmVerityArgsAvb2) {
std::string device = "/dev/block/platform/soc/1da4000.ufshc/by-name/vendor_a";
std::string algorithm = "sha1";
diff --git a/fs_mgr/libdm/include/libdm/dm_target.h b/fs_mgr/libdm/include/libdm/dm_target.h
index 09fe200..97f3c13 100644
--- a/fs_mgr/libdm/include/libdm/dm_target.h
+++ b/fs_mgr/libdm/include/libdm/dm_target.h
@@ -116,6 +116,24 @@
uint64_t physical_sector_;
};
+class DmTargetStripe final : public DmTarget {
+ public:
+ DmTargetStripe(uint64_t start, uint64_t length, uint64_t chunksize,
+ const std::string& block_device0, const std::string& block_device1)
+ : DmTarget(start, length),
+ chunksize(chunksize),
+ block_device0_(block_device0),
+ block_device1_(block_device1) {}
+
+ std::string name() const override { return "striped"; }
+ std::string GetParameterString() const override;
+
+ private:
+ uint64_t chunksize;
+ std::string block_device0_;
+ std::string block_device1_;
+};
+
class DmTargetVerity final : public DmTarget {
public:
DmTargetVerity(uint64_t start, uint64_t length, uint32_t version,
diff --git a/fs_mgr/tools/dmctl.cpp b/fs_mgr/tools/dmctl.cpp
index 7273087..9dc8c24 100644
--- a/fs_mgr/tools/dmctl.cpp
+++ b/fs_mgr/tools/dmctl.cpp
@@ -115,6 +115,21 @@
std::string block_device = NextArg();
return std::make_unique<DmTargetAndroidVerity>(start_sector, num_sectors, keyid,
block_device);
+ } else if (target_type == "striped") {
+ if (!HasArgs(3)) {
+ std::cerr << "Expected \"striped\" <block_device0> <block_device1> <chunksize>"
+ << std::endl;
+ return nullptr;
+ }
+ std::string block_device0 = NextArg();
+ std::string block_device1 = NextArg();
+ uint64_t chunk_size;
+ if (!android::base::ParseUint(NextArg(), &chunk_size)) {
+ std::cerr << "Expected start sector, got: " << PreviousArg() << std::endl;
+ return nullptr;
+ }
+ return std::make_unique<DmTargetStripe>(start_sector, num_sectors, chunk_size,
+ block_device0, block_device1);
} else if (target_type == "bow") {
if (!HasArgs(1)) {
std::cerr << "Expected \"bow\" <block_device>" << std::endl;
diff --git a/libvendorsupport/Android.bp b/libvendorsupport/Android.bp
index b4457b1..e87959e 100644
--- a/libvendorsupport/Android.bp
+++ b/libvendorsupport/Android.bp
@@ -34,3 +34,32 @@
"liblog",
],
}
+
+cc_library_headers {
+ name: "libvendorsupport_llndk_headers",
+ host_supported: true,
+ vendor_available: true,
+ recovery_available: true,
+ ramdisk_available: true,
+ vendor_ramdisk_available: true,
+ native_bridge_supported: true,
+
+ export_include_dirs: ["include_llndk"],
+ llndk: {
+ llndk_headers: true,
+ },
+
+ apex_available: [
+ "//apex_available:platform",
+ "//apex_available:anyapex",
+ ],
+ min_sdk_version: "apex_inherit",
+
+ system_shared_libs: [],
+ stl: "none",
+
+ // This header library is used for libc and must be available to any sdk
+ // versions.
+ // Setting sdk_version to the lowest version allows the dependencies.
+ sdk_version: "1",
+}
diff --git a/libvendorsupport/include_llndk/android/llndk-versioning.h b/libvendorsupport/include_llndk/android/llndk-versioning.h
new file mode 100644
index 0000000..7c408c9
--- /dev/null
+++ b/libvendorsupport/include_llndk/android/llndk-versioning.h
@@ -0,0 +1,48 @@
+// Copyright (C) 2024 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.
+
+#pragma once
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
+#if defined(__ANDROID_VENDOR__)
+
+// LLNDK (https://source.android.com/docs/core/architecture/vndk/build-system#ll-ndk) is similar to
+// NDK, but uses its own versioning of YYYYMM format for vendor builds. The LLNDK symbols are
+// enabled when the vendor api level is equal to or newer than the ro.board.api_level.
+#define __INTRODUCED_IN_LLNDK(vendor_api_level) \
+ _Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \
+ __attribute__((enable_if( \
+ __ANDROID_VENDOR_API__ >= vendor_api_level, \
+ "available in vendor API level " #vendor_api_level " that " \
+ "is newer than the current vendor API level. Guard the API " \
+ "call with '#if (__ANDROID_VENDOR_API__ >= " #vendor_api_level ")'."))) \
+ _Pragma("clang diagnostic pop")
+
+// For the vendor libraries, __INTRODUCED_IN must be ignored because they are only for NDKs but not
+// for LLNDKs.
+#undef __INTRODUCED_IN
+#define __INTRODUCED_IN(x)
+
+#else // __ANDROID_VENDOR__
+
+// For non-vendor libraries, __INTRODUCED_IN_LLNDK must be ignored because it must not change
+// symbols of NDK or the system side of the treble boundary.
+#define __INTRODUCED_IN_LLNDK(vendor_api_level)
+
+#endif // __ANDROID_VENDOR__
+
+__END_DECLS
diff --git a/rootdir/init.rc b/rootdir/init.rc
index f3b2d03..8a2ed9f 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -641,9 +641,9 @@
mkdir /metadata/staged-install 0770 root system
- mkdir /metadata/aconfig 0750 root system
- mkdir /metadata/aconfig/flags 0750 root system
- mkdir /metadata/aconfig/boot 0754 root system
+ mkdir /metadata/aconfig 0775 root system
+ mkdir /metadata/aconfig/flags 0770 root system
+ mkdir /metadata/aconfig/boot 0775 root system
on late-fs
# Ensure that tracefs has the correct permissions.
@@ -709,7 +709,7 @@
# Start tombstoned early to be able to store tombstones.
mkdir /data/anr 0775 system system encryption=Require
- mkdir /data/tombstones 0771 system system encryption=Require
+ mkdir /data/tombstones 0775 system system encryption=Require
mkdir /data/vendor/tombstones 0771 root root
mkdir /data/vendor/tombstones/wifi 0771 wifi wifi
start tombstoned