Merge "Make public.libraries.android.txt available to filesystem" into main
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
index 9b96f36..f47c317 100644
--- a/PREUPLOAD.cfg
+++ b/PREUPLOAD.cfg
@@ -1,6 +1,7 @@
[Builtin Hooks]
clang_format = true
rustfmt = true
+bpfmt = true
[Builtin Hooks Options]
clang_format = --commit ${PREUPLOAD_COMMIT} --style file --extensions c,h,cc,cpp
diff --git a/debuggerd/proto/tombstone.proto b/debuggerd/proto/tombstone.proto
index 6f9cd96..b662d36 100644
--- a/debuggerd/proto/tombstone.proto
+++ b/debuggerd/proto/tombstone.proto
@@ -18,6 +18,8 @@
message CrashDetail {
bytes name = 1;
bytes data = 2;
+
+ reserved 3 to 999;
}
message Tombstone {
diff --git a/fastboot/Android.bp b/fastboot/Android.bp
index c0445f3..774af28 100644
--- a/fastboot/Android.bp
+++ b/fastboot/Android.bp
@@ -190,7 +190,6 @@
static_libs: [
"android.hardware.health-translate-ndk",
- "libc++fs",
"libhealthhalutils",
"libhealthshim",
"libfastbootshim",
@@ -416,7 +415,6 @@
srcs: ["vendor_boot_img_utils_test.cpp"],
static_libs: [
"libbase",
- "libc++fs",
"libfastboot",
"libgmock",
"liblog",
diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp
index 835a3e7..7f41cea 100644
--- a/fs_mgr/fs_mgr.cpp
+++ b/fs_mgr/fs_mgr.cpp
@@ -1656,6 +1656,19 @@
continue;
}
}
+ if (userdata_mounted) {
+ Fstab mounted_fstab;
+ if (!ReadFstabFromFile("/proc/mounts", &mounted_fstab)) {
+ LOG(ERROR) << "Could't load fstab from /proc/mounts , unable to set ro.fstype.data . "
+ "init.rc actions depending on this prop would not run, boot might fail.";
+ } else {
+ for (const auto& entry : mounted_fstab) {
+ if (entry.mount_point == "/data") {
+ android::base::SetProperty("ro.fstype.data", entry.fs_type);
+ }
+ }
+ }
+ }
set_type_property(encryptable);
diff --git a/fs_mgr/libsnapshot/Android.bp b/fs_mgr/libsnapshot/Android.bp
index 402eb82..39b5b76 100644
--- a/fs_mgr/libsnapshot/Android.bp
+++ b/fs_mgr/libsnapshot/Android.bp
@@ -126,7 +126,6 @@
"libprotobuf-cpp-lite",
],
static_libs: [
- "libc++fs",
"libsnapshot_cow",
],
}
@@ -269,7 +268,6 @@
"android.hardware.boot@1.1",
"android.hardware.boot-V1-ndk",
"libbrotli",
- "libc++fs",
"libfs_mgr_binder",
"libgflags",
"libgsi",
@@ -350,7 +348,6 @@
],
static_libs: [
"libbrotli",
- "libc++fs",
"libfstab",
"libz",
"update_metadata-protos",
diff --git a/fs_mgr/libsnapshot/android/snapshot/snapshot.proto b/fs_mgr/libsnapshot/android/snapshot/snapshot.proto
index 076a918..d04c9c1 100644
--- a/fs_mgr/libsnapshot/android/snapshot/snapshot.proto
+++ b/fs_mgr/libsnapshot/android/snapshot/snapshot.proto
@@ -103,7 +103,7 @@
// The old partition size (if none existed, this will be zero).
uint64 old_partition_size = 10;
- // Compression algorithm (none, gz, lz4, zstd, or brotli).
+ // Compression algorithm (none, lz4, zstd).
string compression_algorithm = 11;
// Estimated COW size from OTA manifest.
@@ -120,6 +120,18 @@
// Max bytes to be compressed at once (4k, 8k, 16k, 32k, 64k, 128k)
uint64 compression_factor = 16;
+
+ // Default value is 32, can be set lower for low mem devices
+ uint32 read_ahead_size = 17;
+
+ // Enable direct reads on source device
+ bool o_direct = 18;
+
+ // Blocks size to be verified at once
+ uint64 verify_block_size = 19;
+
+ // Default value is 2, configures threads to do verification phase
+ uint32 num_verify_threads = 20;
}
// Next: 8
diff --git a/fs_mgr/libsnapshot/partition_cow_creator.h b/fs_mgr/libsnapshot/partition_cow_creator.h
index cbd664f..a75d993 100644
--- a/fs_mgr/libsnapshot/partition_cow_creator.h
+++ b/fs_mgr/libsnapshot/partition_cow_creator.h
@@ -60,6 +60,7 @@
bool using_snapuserd = false;
std::string compression_algorithm;
uint64_t compression_factor;
+ uint32_t read_ahead_size;
// True if multi-threaded compression should be enabled
bool enable_threading;
diff --git a/fs_mgr/libsnapshot/snapshot.cpp b/fs_mgr/libsnapshot/snapshot.cpp
index 7ca53ad..8620620 100644
--- a/fs_mgr/libsnapshot/snapshot.cpp
+++ b/fs_mgr/libsnapshot/snapshot.cpp
@@ -101,8 +101,7 @@
* time, they could use O_DIRECT functionality wherein the I/O to the source
* block device will be O_DIRECT.
*/
-static constexpr auto kCowReadAheadSizeKb = 32;
-static constexpr auto kSourceReadAheadSizeKb = 32;
+static constexpr auto kReadAheadSizeKb = 32;
// Note: IImageManager is an incomplete type in the header, so the default
// destructor doesn't work.
@@ -418,6 +417,7 @@
status->set_using_snapuserd(cow_creator->using_snapuserd);
status->set_compression_algorithm(cow_creator->compression_algorithm);
status->set_compression_factor(cow_creator->compression_factor);
+ status->set_read_ahead_size(cow_creator->read_ahead_size);
if (cow_creator->enable_threading) {
status->set_enable_threading(cow_creator->enable_threading);
}
@@ -1142,8 +1142,8 @@
return result;
}
-auto SnapshotManager::CheckMergeState(LockedFile* lock, const std::function<bool()>& before_cancel)
- -> MergeResult {
+auto SnapshotManager::CheckMergeState(LockedFile* lock,
+ const std::function<bool()>& before_cancel) -> MergeResult {
SnapshotUpdateStatus update_status = ReadSnapshotUpdateStatus(lock);
switch (update_status.state()) {
case UpdateState::None:
@@ -1765,9 +1765,8 @@
base_path_merge;
snapuserd_argv->emplace_back(std::move(message));
}
-
- SetReadAheadSize(cow_image_device, kCowReadAheadSizeKb);
- SetReadAheadSize(source_device, kSourceReadAheadSizeKb);
+ SetReadAheadSize(cow_image_device, snapshot_status.read_ahead_size());
+ SetReadAheadSize(source_device, snapshot_status.read_ahead_size());
// Do not attempt to connect to the new snapuserd yet, it hasn't
// been started. We do however want to wait for the misc device
@@ -2852,8 +2851,8 @@
return true;
}
-auto SnapshotManager::OpenFile(const std::string& file, int lock_flags)
- -> std::unique_ptr<LockedFile> {
+auto SnapshotManager::OpenFile(const std::string& file,
+ int lock_flags) -> std::unique_ptr<LockedFile> {
unique_fd fd(open(file.c_str(), O_RDONLY | O_CLOEXEC | O_NOFOLLOW));
if (fd < 0) {
PLOG(ERROR) << "Open failed: " << file;
@@ -3309,19 +3308,19 @@
LOG(INFO) << "using compression algorithm: " << compression_algorithm
<< ", max compressible block size: " << compression_factor;
}
-
- PartitionCowCreator cow_creator{
- .target_metadata = target_metadata.get(),
- .target_suffix = target_suffix,
- .target_partition = nullptr,
- .current_metadata = current_metadata.get(),
- .current_suffix = current_suffix,
- .update = nullptr,
- .extra_extents = {},
- .using_snapuserd = using_snapuserd,
- .compression_algorithm = compression_algorithm,
- .compression_factor = compression_factor,
- };
+ auto read_ahead_size =
+ android::base::GetUintProperty<uint>("ro.virtual_ab.read_ahead_size", kReadAheadSizeKb);
+ PartitionCowCreator cow_creator{.target_metadata = target_metadata.get(),
+ .target_suffix = target_suffix,
+ .target_partition = nullptr,
+ .current_metadata = current_metadata.get(),
+ .current_suffix = current_suffix,
+ .update = nullptr,
+ .extra_extents = {},
+ .using_snapuserd = using_snapuserd,
+ .compression_algorithm = compression_algorithm,
+ .compression_factor = compression_factor,
+ .read_ahead_size = read_ahead_size};
if (dap_metadata.vabc_feature_set().has_threaded()) {
cow_creator.enable_threading = dap_metadata.vabc_feature_set().threaded();
diff --git a/fs_mgr/libsnapshot/snapuserd/user-space-merge/handler_manager.cpp b/fs_mgr/libsnapshot/snapuserd/user-space-merge/handler_manager.cpp
index 711e704..ea11f0e 100644
--- a/fs_mgr/libsnapshot/snapuserd/user-space-merge/handler_manager.cpp
+++ b/fs_mgr/libsnapshot/snapuserd/user-space-merge/handler_manager.cpp
@@ -19,6 +19,7 @@
#include <android-base/logging.h>
+#include "android-base/properties.h"
#include "merge_worker.h"
#include "read_worker.h"
#include "snapuserd_core.h"
@@ -235,8 +236,10 @@
LOG(INFO) << "MonitorMerge: active-merge-threads: " << active_merge_threads_;
{
+ auto num_merge_threads = android::base::GetUintProperty<uint>(
+ "ro.virtual_ab.num_merge_threads", kMaxMergeThreads);
std::lock_guard<std::mutex> lock(lock_);
- while (active_merge_threads_ < kMaxMergeThreads && merge_handlers_.size() > 0) {
+ while (active_merge_threads_ < num_merge_threads && merge_handlers_.size() > 0) {
auto handler = merge_handlers_.front();
merge_handlers_.pop();
diff --git a/fs_mgr/libsnapshot/snapuserd/user-space-merge/snapuserd_server.h b/fs_mgr/libsnapshot/snapuserd/user-space-merge/snapuserd_server.h
index 3013c47..d9cf97f 100644
--- a/fs_mgr/libsnapshot/snapuserd/user-space-merge/snapuserd_server.h
+++ b/fs_mgr/libsnapshot/snapuserd/user-space-merge/snapuserd_server.h
@@ -39,7 +39,7 @@
namespace snapshot {
static constexpr uint32_t kMaxPacketSize = 512;
-static constexpr uint8_t kMaxMergeThreads = 2;
+
static constexpr char kBootSnapshotsWithoutSlotSwitch[] =
"/metadata/ota/snapshot-boot-without-slot-switch";
diff --git a/fs_mgr/tests/Android.bp b/fs_mgr/tests/Android.bp
index 2aeba0a..041762f 100644
--- a/fs_mgr/tests/Android.bp
+++ b/fs_mgr/tests/Android.bp
@@ -14,6 +14,7 @@
package {
default_applicable_licenses: ["Android-Apache-2.0"],
+ default_team: "trendy_team_android_kernel",
}
cc_test {
diff --git a/init/Android.bp b/init/Android.bp
index 6160a71..57e5a68 100644
--- a/init/Android.bp
+++ b/init/Android.bp
@@ -96,6 +96,7 @@
config_namespace: "ANDROID",
bool_variables: [
"PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT",
+ "release_write_appcompat_override_system_properties",
],
properties: [
"cflags",
@@ -159,12 +160,14 @@
"-DINSTALL_DEBUG_POLICY_TO_SYSTEM_EXT=1",
],
},
+ release_write_appcompat_override_system_properties: {
+ cflags: ["-DWRITE_APPCOMPAT_OVERRIDE_SYSTEM_PROPERTIES"],
+ }
},
static_libs: [
"libavb",
"libavf_cc_flags",
"libbootloader_message",
- "libc++fs",
"libcgrouprc_format",
"liblmkd_utils",
"liblz4",
@@ -367,7 +370,6 @@
],
static_libs: [
- "libc++fs",
"libfs_avb",
"libavf_cc_flags",
"libfs_mgr",
@@ -567,6 +569,11 @@
],
export_include_dirs: ["test_utils/include"], // for tests
header_libs: ["bionic_libc_platform_headers"],
+ product_variables: {
+ shipping_api_level: {
+ cflags: ["-DBUILD_SHIPPING_API_LEVEL=%s"],
+ },
+ },
}
// Host Verifier
@@ -621,6 +628,11 @@
enabled: false,
},
},
+ product_variables: {
+ shipping_api_level: {
+ cflags: ["-DBUILD_SHIPPING_API_LEVEL=%s"],
+ },
+ },
}
cc_binary {
diff --git a/init/devices.cpp b/init/devices.cpp
index 792d8c8..5560c20 100644
--- a/init/devices.cpp
+++ b/init/devices.cpp
@@ -435,6 +435,7 @@
if (ReadFileToString("/sys/class/block/" + uevent.device_name + "/queue/zoned", &model) &&
!StartsWith(model, "none")) {
links.emplace_back("/dev/block/by-name/zoned_device");
+ links.emplace_back("/dev/sys/block/by-name/zoned_device");
}
auto last_slash = uevent.path.rfind('/');
@@ -483,11 +484,21 @@
// event.
if (action == "add" || (action == "change" && StartsWith(devpath, "/dev/block/dm-"))) {
for (const auto& link : links) {
+ std::string target;
+ if (StartsWith(link, "/dev/block/")) {
+ target = devpath;
+ } else if (StartsWith(link, "/dev/sys/block/")) {
+ target = "/sys/class/block/" + Basename(devpath);
+ } else {
+ LOG(ERROR) << "Unrecognized link type: " << link;
+ continue;
+ }
+
if (!mkdir_recursive(Dirname(link), 0755)) {
PLOG(ERROR) << "Failed to create directory " << Dirname(link);
}
- if (symlink(devpath.c_str(), link.c_str())) {
+ if (symlink(target.c_str(), link.c_str())) {
if (errno != EEXIST) {
PLOG(ERROR) << "Failed to symlink " << devpath << " to " << link;
} else if (std::string link_path;
diff --git a/init/fuzzer/Android.bp b/init/fuzzer/Android.bp
index 9916246..5823932 100644
--- a/init/fuzzer/Android.bp
+++ b/init/fuzzer/Android.bp
@@ -20,7 +20,6 @@
cc_defaults {
name: "libinit_fuzzer_defaults",
static_libs: [
- "libc++fs",
"liblmkd_utils",
"libmodprobe",
"libprotobuf-cpp-lite",
diff --git a/init/init_test.cpp b/init/init_test.cpp
index b2f586b..5088273 100644
--- a/init/init_test.cpp
+++ b/init/init_test.cpp
@@ -630,7 +630,7 @@
ASSERT_TRUE(parser.ParseConfig(tf.path));
- if (GetIntProperty("ro.vendor.api_level", 0) > __ANDROID_API_V__) {
+ if (GetIntProperty("ro.vendor.api_level", 0) > 202404) {
ASSERT_EQ(1u, parser.parse_error_count());
} else {
ASSERT_EQ(0u, parser.parse_error_count());
diff --git a/init/property_service.cpp b/init/property_service.cpp
index cd5933d..0d6eb15 100644
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -1323,12 +1323,14 @@
}
selinux_android_restorecon(PROP_TREE_FILE, 0);
+#ifdef WRITE_APPCOMPAT_OVERRIDE_SYSTEM_PROPERTIES
mkdir(APPCOMPAT_OVERRIDE_PROP_FOLDERNAME, S_IRWXU | S_IXGRP | S_IXOTH);
if (!WriteStringToFile(serialized_contexts, APPCOMPAT_OVERRIDE_PROP_TREE_FILE, 0444, 0, 0,
false)) {
PLOG(ERROR) << "Unable to write appcompat override property infos to file";
}
selinux_android_restorecon(APPCOMPAT_OVERRIDE_PROP_TREE_FILE, 0);
+#endif
}
static void ExportKernelBootProps() {
diff --git a/init/service_parser.cpp b/init/service_parser.cpp
index 6f3e368..6781c70 100644
--- a/init/service_parser.cpp
+++ b/init/service_parser.cpp
@@ -52,6 +52,18 @@
namespace android {
namespace init {
+#ifdef INIT_FULL_SOURCES
+// on full sources, we have better information on device to
+// make this decision
+constexpr bool kAlwaysErrorUserRoot = false;
+#else
+constexpr uint64_t kBuildShippingApiLevel = BUILD_SHIPPING_API_LEVEL + 0 /* +0 if empty */;
+// on partial sources, the host build, we don't have the specific
+// vendor API level, but we can enforce things based on the
+// shipping API level.
+constexpr bool kAlwaysErrorUserRoot = kBuildShippingApiLevel > __ANDROID_API_V__;
+#endif
+
Result<void> ServiceParser::ParseCapabilities(std::vector<std::string>&& args) {
service_->capabilities_ = 0;
@@ -680,7 +692,8 @@
}
if (service_->proc_attr_.parsed_uid == std::nullopt) {
- if (android::base::GetIntProperty("ro.vendor.api_level", 0) > __ANDROID_API_V__) {
+ if (kAlwaysErrorUserRoot ||
+ android::base::GetIntProperty("ro.vendor.api_level", 0) > 202404) {
return Error() << "No user specified for service '" << service_->name()
<< "', so it would have been root.";
} else {
diff --git a/libcutils/fs_config.cpp b/libcutils/fs_config.cpp
index c34cd71..2e4b9b4 100644
--- a/libcutils/fs_config.cpp
+++ b/libcutils/fs_config.cpp
@@ -207,6 +207,7 @@
{ 00755, AID_ROOT, AID_ROOT, 0, "bin/*" },
{ 00640, AID_ROOT, AID_SHELL, 0, "fstab.*" },
{ 00750, AID_ROOT, AID_SHELL, 0, "init*" },
+ { 00644, AID_ROOT, AID_ROOT, 0, "*.rc" },
{ 00755, AID_ROOT, AID_SHELL, 0, "odm/bin/*" },
{ 00644, AID_ROOT, AID_ROOT, 0, "odm/framework/*" },
{ 00644, AID_ROOT, AID_ROOT, 0, "odm/app/*" },
diff --git a/libutils/binder/Android.bp b/libutils/binder/Android.bp
index 60b0cb6..e358391 100644
--- a/libutils/binder/Android.bp
+++ b/libutils/binder/Android.bp
@@ -22,6 +22,12 @@
"VectorImpl.cpp",
],
+ cflags: [
+ "-Winvalid-offsetof",
+ "-Wsequence-point",
+ "-Wzero-as-null-pointer-constant",
+ ],
+
apex_available: [
"//apex_available:anyapex",
"//apex_available:platform",
@@ -41,11 +47,13 @@
cc_library {
name: "libutils_binder",
defaults: ["libutils_binder_impl_defaults"],
+ cmake_snapshot_supported: false,
}
cc_library_shared {
name: "libutils_binder_sdk",
defaults: ["libutils_binder_impl_defaults_nodeps"],
+ cmake_snapshot_supported: true,
header_libs: [
"liblog_stub",
diff --git a/libutils/binder/SharedBuffer.cpp b/libutils/binder/SharedBuffer.cpp
index 3e703db..d16bdb0 100644
--- a/libutils/binder/SharedBuffer.cpp
+++ b/libutils/binder/SharedBuffer.cpp
@@ -75,7 +75,7 @@
LOG_ALWAYS_FATAL_IF((newSize >= (SIZE_MAX - sizeof(SharedBuffer))),
"Invalid buffer size %zu", newSize);
- buf = (SharedBuffer*)realloc(buf, sizeof(SharedBuffer) + newSize);
+ buf = (SharedBuffer*)realloc(reinterpret_cast<void*>(buf), sizeof(SharedBuffer) + newSize);
if (buf != nullptr) {
buf->mSize = newSize;
return buf;
diff --git a/libutils/binder/String16.cpp b/libutils/binder/String16.cpp
index 07a3d23..96e1477 100644
--- a/libutils/binder/String16.cpp
+++ b/libutils/binder/String16.cpp
@@ -22,6 +22,19 @@
#include "SharedBuffer.h"
+#define LIBUTILS_PRAGMA(arg) _Pragma(#arg)
+#if defined(__clang__)
+#define LIBUTILS_PRAGMA_FOR_COMPILER(arg) LIBUTILS_PRAGMA(clang arg)
+#elif defined(__GNUC__)
+#define LIBUTILS_PRAGMA_FOR_COMPILER(arg) LIBUTILS_PRAGMA(GCC arg)
+#else
+#define LIBUTILS_PRAGMA_FOR_COMPILER(arg)
+#endif
+#define LIBUTILS_IGNORE(warning_flag) \
+ LIBUTILS_PRAGMA_FOR_COMPILER(diagnostic push) \
+ LIBUTILS_PRAGMA_FOR_COMPILER(diagnostic ignored warning_flag)
+#define LIBUTILS_IGNORE_END() LIBUTILS_PRAGMA_FOR_COMPILER(diagnostic pop)
+
namespace android {
static const StaticString16 emptyString(u"");
@@ -347,7 +360,9 @@
bool String16::isStaticString() const {
// See String16.h for notes on the memory layout of String16::StaticData and
// SharedBuffer.
+ LIBUTILS_IGNORE("-Winvalid-offsetof")
static_assert(sizeof(SharedBuffer) - offsetof(SharedBuffer, mClientMetadata) == 4);
+ LIBUTILS_IGNORE_END()
const uint32_t* p = reinterpret_cast<const uint32_t*>(mString);
return (*(p - 1) & kIsSharedBufferAllocated) == 0;
}
@@ -355,7 +370,9 @@
size_t String16::staticStringSize() const {
// See String16.h for notes on the memory layout of String16::StaticData and
// SharedBuffer.
+ LIBUTILS_IGNORE("-Winvalid-offsetof")
static_assert(sizeof(SharedBuffer) - offsetof(SharedBuffer, mClientMetadata) == 4);
+ LIBUTILS_IGNORE_END()
const uint32_t* p = reinterpret_cast<const uint32_t*>(mString);
return static_cast<size_t>(*(p - 1));
}
diff --git a/libutils/binder/include/utils/RefBase.h b/libutils/binder/include/utils/RefBase.h
index f03e1be..b6a8707 100644
--- a/libutils/binder/include/utils/RefBase.h
+++ b/libutils/binder/include/utils/RefBase.h
@@ -555,7 +555,7 @@
wp<T>::wp(T* other)
: m_ptr(other)
{
- m_refs = other ? m_refs = other->createWeak(this) : nullptr;
+ m_refs = other ? other->createWeak(this) : nullptr;
}
template <typename T>
@@ -662,8 +662,7 @@
template<typename T> template<typename U>
wp<T>& wp<T>::operator = (const sp<U>& other)
{
- weakref_type* newRefs =
- other != nullptr ? other->createWeak(this) : 0;
+ weakref_type* newRefs = other != nullptr ? other->createWeak(this) : nullptr;
U* otherPtr(other.m_ptr);
if (m_ptr) m_refs->decWeak(this);
m_ptr = otherPtr;
@@ -695,8 +694,8 @@
{
if (m_ptr) {
m_refs->decWeak(this);
- m_refs = 0;
- m_ptr = 0;
+ m_refs = nullptr;
+ m_ptr = nullptr;
}
}
diff --git a/libutils/binder/include/utils/TypeHelpers.h b/libutils/binder/include/utils/TypeHelpers.h
index 21d9b3d..007036b 100644
--- a/libutils/binder/include/utils/TypeHelpers.h
+++ b/libutils/binder/include/utils/TypeHelpers.h
@@ -200,7 +200,7 @@
typename std::enable_if<use_trivial_move<TYPE>::value>::type
inline
move_forward_type(TYPE* d, const TYPE* s, size_t n = 1) {
- memmove(d, s, n*sizeof(TYPE));
+ memmove(reinterpret_cast<void*>(d), s, n * sizeof(TYPE));
}
template<typename TYPE>
@@ -227,7 +227,7 @@
typename std::enable_if<use_trivial_move<TYPE>::value>::type
inline
move_backward_type(TYPE* d, const TYPE* s, size_t n = 1) {
- memmove(d, s, n*sizeof(TYPE));
+ memmove(reinterpret_cast<void*>(d), s, n * sizeof(TYPE));
}
template<typename TYPE>
diff --git a/rootdir/Android.mk b/rootdir/Android.mk
index 06e8730..4c1f2e4 100644
--- a/rootdir/Android.mk
+++ b/rootdir/Android.mk
@@ -72,9 +72,9 @@
EXPORT_GLOBAL_CLANG_COVERAGE_OPTIONS :=
ifeq ($(CLANG_COVERAGE),true)
ifeq ($(CLANG_COVERAGE_CONTINUOUS_MODE),true)
- EXPORT_GLOBAL_CLANG_COVERAGE_OPTIONS := export LLVM_PROFILE_FILE /data/local/tmp/clang%c-%20m.profraw
+ EXPORT_GLOBAL_CLANG_COVERAGE_OPTIONS := export LLVM_PROFILE_FILE /data/misc/trace/clang%c-%20m.profraw
else
- EXPORT_GLOBAL_CLANG_COVERAGE_OPTIONS := export LLVM_PROFILE_FILE /data/local/tmp/clang-%20m.profraw
+ EXPORT_GLOBAL_CLANG_COVERAGE_OPTIONS := export LLVM_PROFILE_FILE /data/misc/trace/clang-%20m.profraw
endif
endif
diff --git a/rootdir/init.zygote32.rc b/rootdir/init.zygote32.rc
index 442bd15..862afb6 100644
--- a/rootdir/init.zygote32.rc
+++ b/rootdir/init.zygote32.rc
@@ -16,5 +16,5 @@
onrestart restart --only-if-running media.tuner
onrestart restart netd
onrestart restart wificond
- task_profiles ProcessCapacityHigh
+ task_profiles ProcessCapacityHigh MaxPerformance
critical window=${zygote.critical_window.minute:-off} target=zygote-fatal
diff --git a/toolbox/modprobe.cpp b/toolbox/modprobe.cpp
index b0e76ea..7fde491 100644
--- a/toolbox/modprobe.cpp
+++ b/toolbox/modprobe.cpp
@@ -15,9 +15,9 @@
*/
#include <ctype.h>
-#include <fcntl.h>
#include <getopt.h>
#include <stdlib.h>
+#include <unistd.h>
#include <string>
@@ -28,7 +28,6 @@
#include <modprobe/modprobe.h>
#include <sys/utsname.h>
-#include <unistd.h>
namespace {
@@ -87,6 +86,20 @@
}
}
+static bool ModDirMatchesKernelPageSize(const char* mod_dir) {
+ static const unsigned int kernel_pgsize_kb = getpagesize() / 1024;
+ const char* mod_sfx = strrchr(mod_dir, '_');
+ unsigned int mod_pgsize_kb;
+ int mod_sfx_len;
+
+ if (mod_sfx == NULL || sscanf(mod_sfx, "_%uk%n", &mod_pgsize_kb, &mod_sfx_len) != 1 ||
+ strlen(mod_sfx) != mod_sfx_len) {
+ mod_pgsize_kb = 4;
+ }
+
+ return kernel_pgsize_kb == mod_pgsize_kb;
+}
+
// Find directories in format of "/lib/modules/x.y.z-*".
static int KernelVersionNameFilter(const dirent* de) {
unsigned int major, minor;
@@ -102,16 +115,11 @@
}
if (android::base::StartsWith(de->d_name, kernel_version)) {
- return 1;
+ return ModDirMatchesKernelPageSize(de->d_name);
}
return 0;
}
-std::string GetPageSizeSuffix() {
- static const size_t page_size = sysconf(_SC_PAGE_SIZE);
- return android::base::StringPrintf("_%zuk", page_size / 1024);
-}
-
} // anonymous namespace
extern "C" int modprobe_main(int argc, char** argv) {
@@ -240,19 +248,6 @@
// Allow modules to be directly inside /lib/modules
mod_dirs.emplace_back(LIB_MODULES_PREFIX);
}
- if (getpagesize() != 4096) {
- struct utsname uts {};
- if (uname(&uts)) {
- PLOG(FATAL) << "Failed to get kernel version";
- }
- const auto module_dir = android::base::StringPrintf("/lib/modules/%s%s", uts.release,
- GetPageSizeSuffix().c_str());
- struct stat st {};
- if (stat(module_dir.c_str(), &st) == 0 && S_ISDIR(st.st_mode)) {
- mod_dirs.clear();
- mod_dirs.emplace_back(module_dir);
- }
- }
LOG(DEBUG) << "mode is " << mode;
LOG(DEBUG) << "mod_dirs is: " << android::base::Join(mod_dirs, " ");
diff --git a/trusty/OWNERS b/trusty/OWNERS
index 4016792..46f1410 100644
--- a/trusty/OWNERS
+++ b/trusty/OWNERS
@@ -1,11 +1,5 @@
-armellel@google.com
-arve@android.com
-danielangell@google.com
-gmar@google.com
+# include OWNERS from the top level trusty repo
+include trusty:main:/OWNERS
+
mikemcternan@google.com
-mmaurer@google.com
-ncbray@google.com
-swillden@google.com
-thurston@google.com
-trong@google.com
-wenhaowang@google.com
+swillden@google.com
\ No newline at end of file
diff --git a/trusty/metrics/include/trusty/metrics/tipc.h b/trusty/metrics/include/trusty/metrics/tipc.h
index e2cf57b..b4428d5 100644
--- a/trusty/metrics/include/trusty/metrics/tipc.h
+++ b/trusty/metrics/include/trusty/metrics/tipc.h
@@ -49,6 +49,7 @@
* @METRICS_CMD_REQ_SHIFT: number of bits used by @METRICS_CMD_RESP_BIT
* @METRICS_CMD_REPORT_EVENT_DROP: report gaps in the event stream
* @METRICS_CMD_REPORT_CRASH: report an app crash event
+ * @METRICS_CMD_REPORT_EXIT: report an app exit
* @METRICS_CMD_REPORT_STORAGE_ERROR: report trusty storage error
*/
enum metrics_cmd {
@@ -57,7 +58,8 @@
METRICS_CMD_REPORT_EVENT_DROP = (1 << METRICS_CMD_REQ_SHIFT),
METRICS_CMD_REPORT_CRASH = (2 << METRICS_CMD_REQ_SHIFT),
- METRICS_CMD_REPORT_STORAGE_ERROR = (3 << METRICS_CMD_REQ_SHIFT),
+ METRICS_CMD_REPORT_EXIT = (3 << METRICS_CMD_REQ_SHIFT),
+ METRICS_CMD_REPORT_STORAGE_ERROR = (4 << METRICS_CMD_REQ_SHIFT),
};
/**
@@ -92,9 +94,22 @@
} __attribute__((__packed__));
/**
+ * struct metrics_report_exit_req - arguments of %METRICS_CMD_REPORT_EXIT
+ * requests
+ * @app_id: app_id in the form UUID in ascii format
+ * "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
+ * @exit_code: architecture-specific exit code
+ */
+struct metrics_report_exit_req {
+ char app_id[UUID_STR_SIZE];
+ uint32_t exit_code;
+} __attribute__((__packed__));
+
+/**
* struct metrics_report_crash_req - arguments of %METRICS_CMD_REPORT_CRASH
* requests
- * @app_id: uuid of the app that crashed
+ * @app_id: app_id in the form UUID in ascii format
+ * "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
* @crash_reason: architecture-specific code representing the reason for the
* crash
*/
@@ -158,6 +173,7 @@
struct metrics_req req;
union {
struct metrics_report_crash_req crash_args;
+ struct metrics_report_exit_req exit_args;
struct metrics_report_storage_error_req storage_args;
};
} __attribute__((__packed__));
\ No newline at end of file