Merge changes I9494ce71,Idc14e4ad,I30de692e,Ieed3223b,I63d0667a
* changes:
liblogcat: add android_logcat_popen and android_logcat_system
liblogcat: add android_logcat_run_command_thread
logcat: Create liblogcat
logcat: Use std::string instead of large static buffer for -Q
logcat: Add coding style
diff --git a/fs_mgr/.clang-format b/fs_mgr/.clang-format
new file mode 120000
index 0000000..4e6d9dd
--- /dev/null
+++ b/fs_mgr/.clang-format
@@ -0,0 +1 @@
+../init/.clang-format
\ No newline at end of file
diff --git a/fs_mgr/fs_mgr_avb.cpp b/fs_mgr/fs_mgr_avb.cpp
index dd08271..68efb00 100644
--- a/fs_mgr/fs_mgr_avb.cpp
+++ b/fs_mgr/fs_mgr_avb.cpp
@@ -51,14 +51,12 @@
"%u %s %s %u %u " \
"%" PRIu64 " %" PRIu64 " %s %s %s "
-#define VERITY_TABLE_PARAMS(hashtree_desc, blk_device, digest, salt) \
- hashtree_desc.dm_verity_version, blk_device, blk_device, \
- hashtree_desc.data_block_size, hashtree_desc.hash_block_size, \
- hashtree_desc.image_size / \
- hashtree_desc.data_block_size, /* num_data_blocks. */ \
- hashtree_desc.tree_offset / \
- hashtree_desc.hash_block_size, /* hash_start_block. */ \
- (char *)hashtree_desc.hash_algorithm, digest, salt
+#define VERITY_TABLE_PARAMS(hashtree_desc, blk_device, digest, salt) \
+ hashtree_desc.dm_verity_version, blk_device, blk_device, hashtree_desc.data_block_size, \
+ hashtree_desc.hash_block_size, \
+ hashtree_desc.image_size / hashtree_desc.data_block_size, /* num_data_blocks. */ \
+ hashtree_desc.tree_offset / hashtree_desc.hash_block_size, /* hash_start_block. */ \
+ (char*)hashtree_desc.hash_algorithm, digest, salt
#define VERITY_TABLE_OPT_RESTART "restart_on_corruption"
#define VERITY_TABLE_OPT_IGNZERO "ignore_zero_blocks"
@@ -67,32 +65,28 @@
* <#opt_params> ignore_zero_blocks restart_on_corruption
*/
#define VERITY_TABLE_OPT_DEFAULT_FORMAT "2 %s %s"
-#define VERITY_TABLE_OPT_DEFAULT_PARAMS \
- VERITY_TABLE_OPT_IGNZERO, VERITY_TABLE_OPT_RESTART
+#define VERITY_TABLE_OPT_DEFAULT_PARAMS VERITY_TABLE_OPT_IGNZERO, VERITY_TABLE_OPT_RESTART
/* The FEC (forward error correction) format of dm-verity optional parameters:
* <#opt_params> use_fec_from_device <fec_dev>
* fec_roots <num> fec_blocks <num> fec_start <offset>
* ignore_zero_blocks restart_on_corruption
*/
-#define VERITY_TABLE_OPT_FEC_FORMAT \
- "10 use_fec_from_device %s fec_roots %u fec_blocks %" PRIu64 \
- " fec_start %" PRIu64 " %s %s"
+#define VERITY_TABLE_OPT_FEC_FORMAT \
+ "10 use_fec_from_device %s fec_roots %u fec_blocks %" PRIu64 " fec_start %" PRIu64 " %s %s"
/* Note that fec_blocks is the size that FEC covers, *not* the
* size of the FEC data. Since we use FEC for everything up until
* the FEC data, it's the same as the offset (fec_start).
*/
-#define VERITY_TABLE_OPT_FEC_PARAMS(hashtree_desc, blk_device) \
- blk_device, hashtree_desc.fec_num_roots, \
- hashtree_desc.fec_offset / \
- hashtree_desc.data_block_size, /* fec_blocks */ \
- hashtree_desc.fec_offset / \
- hashtree_desc.data_block_size, /* fec_start */ \
+#define VERITY_TABLE_OPT_FEC_PARAMS(hashtree_desc, blk_device) \
+ blk_device, hashtree_desc.fec_num_roots, \
+ hashtree_desc.fec_offset / hashtree_desc.data_block_size, /* fec_blocks */ \
+ hashtree_desc.fec_offset / hashtree_desc.data_block_size, /* fec_start */ \
VERITY_TABLE_OPT_IGNZERO, VERITY_TABLE_OPT_RESTART
-AvbSlotVerifyData *fs_mgr_avb_verify_data = nullptr;
-AvbOps *fs_mgr_avb_ops = nullptr;
+AvbSlotVerifyData* fs_mgr_avb_verify_data = nullptr;
+AvbOps* fs_mgr_avb_ops = nullptr;
enum HashAlgorithm {
kInvalid = 0,
@@ -109,8 +103,7 @@
androidboot_vbmeta fs_mgr_vbmeta_prop;
-static inline bool nibble_value(const char &c, uint8_t *value)
-{
+static inline bool nibble_value(const char& c, uint8_t* value) {
FS_MGR_CHECK(value != nullptr);
switch (c) {
@@ -130,10 +123,7 @@
return true;
}
-static bool hex_to_bytes(uint8_t *bytes,
- size_t bytes_len,
- const std::string &hex)
-{
+static bool hex_to_bytes(uint8_t* bytes, size_t bytes_len, const std::string& hex) {
FS_MGR_CHECK(bytes != nullptr);
if (hex.size() % 2 != 0) {
@@ -156,11 +146,10 @@
return true;
}
-static std::string bytes_to_hex(const uint8_t *bytes, size_t bytes_len)
-{
+static std::string bytes_to_hex(const uint8_t* bytes, size_t bytes_len) {
FS_MGR_CHECK(bytes != nullptr);
- static const char *hex_digits = "0123456789abcdef";
+ static const char* hex_digits = "0123456789abcdef";
std::string hex;
for (size_t i = 0; i < bytes_len; i++) {
@@ -170,8 +159,7 @@
return hex;
}
-static bool load_vbmeta_prop(androidboot_vbmeta *vbmeta_prop)
-{
+static bool load_vbmeta_prop(androidboot_vbmeta* vbmeta_prop) {
FS_MGR_CHECK(vbmeta_prop != nullptr);
std::string cmdline;
@@ -180,19 +168,17 @@
std::string hash_alg;
std::string digest;
- for (const auto &entry :
- android::base::Split(android::base::Trim(cmdline), " ")) {
+ for (const auto& entry : android::base::Split(android::base::Trim(cmdline), " ")) {
std::vector<std::string> pieces = android::base::Split(entry, "=");
- const std::string &key = pieces[0];
- const std::string &value = pieces[1];
+ const std::string& key = pieces[0];
+ const std::string& value = pieces[1];
if (key == "androidboot.vbmeta.device_state") {
vbmeta_prop->allow_verification_error = (value == "unlocked");
} else if (key == "androidboot.vbmeta.hash_alg") {
hash_alg = value;
} else if (key == "androidboot.vbmeta.size") {
- if (!android::base::ParseUint(value.c_str(),
- &vbmeta_prop->vbmeta_size)) {
+ if (!android::base::ParseUint(value.c_str(), &vbmeta_prop->vbmeta_size)) {
return false;
}
} else if (key == "androidboot.vbmeta.digest") {
@@ -220,10 +206,8 @@
return false;
}
- if (!hex_to_bytes(vbmeta_prop->digest, sizeof(vbmeta_prop->digest),
- digest)) {
- LERROR << "Hash digest contains non-hexidecimal character: "
- << digest.c_str();
+ if (!hex_to_bytes(vbmeta_prop->digest, sizeof(vbmeta_prop->digest), digest)) {
+ LERROR << "Hash digest contains non-hexidecimal character: " << digest.c_str();
return false;
}
@@ -231,9 +215,8 @@
}
template <typename Hasher>
-static std::pair<size_t, bool> verify_vbmeta_digest(
- const AvbSlotVerifyData &verify_data, const androidboot_vbmeta &vbmeta_prop)
-{
+static std::pair<size_t, bool> verify_vbmeta_digest(const AvbSlotVerifyData& verify_data,
+ const androidboot_vbmeta& vbmeta_prop) {
size_t total_size = 0;
Hasher hasher;
for (size_t n = 0; n < verify_data.num_vbmeta_images; n++) {
@@ -242,15 +225,13 @@
total_size += verify_data.vbmeta_images[n].vbmeta_size;
}
- bool matched = (memcmp(hasher.finalize(), vbmeta_prop.digest,
- Hasher::DIGEST_SIZE) == 0);
+ bool matched = (memcmp(hasher.finalize(), vbmeta_prop.digest, Hasher::DIGEST_SIZE) == 0);
return std::make_pair(total_size, matched);
}
-static bool verify_vbmeta_images(const AvbSlotVerifyData &verify_data,
- const androidboot_vbmeta &vbmeta_prop)
-{
+static bool verify_vbmeta_images(const AvbSlotVerifyData& verify_data,
+ const androidboot_vbmeta& vbmeta_prop) {
if (verify_data.num_vbmeta_images == 0) {
LERROR << "No vbmeta images";
return false;
@@ -281,23 +262,17 @@
return true;
}
-static bool hashtree_load_verity_table(
- struct dm_ioctl *io,
- const std::string &dm_device_name,
- int fd,
- const std::string &blk_device,
- const AvbHashtreeDescriptor &hashtree_desc,
- const std::string &salt,
- const std::string &root_digest)
-{
+static bool hashtree_load_verity_table(struct dm_ioctl* io, const std::string& dm_device_name,
+ int fd, const std::string& blk_device,
+ const AvbHashtreeDescriptor& hashtree_desc,
+ const std::string& salt, const std::string& root_digest) {
fs_mgr_verity_ioctl_init(io, dm_device_name, DM_STATUS_TABLE_FLAG);
// The buffer consists of [dm_ioctl][dm_target_spec][verity_params].
- char *buffer = (char *)io;
+ char* buffer = (char*)io;
// Builds the dm_target_spec arguments.
- struct dm_target_spec *dm_target =
- (struct dm_target_spec *)&buffer[sizeof(struct dm_ioctl)];
+ struct dm_target_spec* dm_target = (struct dm_target_spec*)&buffer[sizeof(struct dm_ioctl)];
io->target_count = 1;
dm_target->status = 0;
dm_target->sector_start = 0;
@@ -305,23 +280,19 @@
strcpy(dm_target->target_type, "verity");
// Builds the verity params.
- char *verity_params =
- buffer + sizeof(struct dm_ioctl) + sizeof(struct dm_target_spec);
+ char* verity_params = buffer + sizeof(struct dm_ioctl) + sizeof(struct dm_target_spec);
size_t bufsize = DM_BUF_SIZE - (verity_params - buffer);
int res = 0;
if (hashtree_desc.fec_size > 0) {
- res = snprintf(
- verity_params, bufsize,
- VERITY_TABLE_FORMAT VERITY_TABLE_OPT_FEC_FORMAT,
- VERITY_TABLE_PARAMS(hashtree_desc, blk_device.c_str(),
- root_digest.c_str(), salt.c_str()),
- VERITY_TABLE_OPT_FEC_PARAMS(hashtree_desc, blk_device.c_str()));
+ res = snprintf(verity_params, bufsize, VERITY_TABLE_FORMAT VERITY_TABLE_OPT_FEC_FORMAT,
+ VERITY_TABLE_PARAMS(hashtree_desc, blk_device.c_str(), root_digest.c_str(),
+ salt.c_str()),
+ VERITY_TABLE_OPT_FEC_PARAMS(hashtree_desc, blk_device.c_str()));
} else {
- res = snprintf(verity_params, bufsize,
- VERITY_TABLE_FORMAT VERITY_TABLE_OPT_DEFAULT_FORMAT,
- VERITY_TABLE_PARAMS(hashtree_desc, blk_device.c_str(),
- root_digest.c_str(), salt.c_str()),
+ res = snprintf(verity_params, bufsize, VERITY_TABLE_FORMAT VERITY_TABLE_OPT_DEFAULT_FORMAT,
+ VERITY_TABLE_PARAMS(hashtree_desc, blk_device.c_str(), root_digest.c_str(),
+ salt.c_str()),
VERITY_TABLE_OPT_DEFAULT_PARAMS);
}
@@ -334,7 +305,7 @@
// Sets ext target boundary.
verity_params += strlen(verity_params) + 1;
- verity_params = (char *)(((unsigned long)verity_params + 7) & ~7);
+ verity_params = (char*)(((unsigned long)verity_params + 7) & ~7);
dm_target->next = verity_params - buffer;
// Sends the ioctl to load the verity table.
@@ -346,11 +317,9 @@
return true;
}
-static bool hashtree_dm_verity_setup(struct fstab_rec *fstab_entry,
- const AvbHashtreeDescriptor &hashtree_desc,
- const std::string &salt,
- const std::string &root_digest)
-{
+static bool hashtree_dm_verity_setup(struct fstab_rec* fstab_entry,
+ const AvbHashtreeDescriptor& hashtree_desc,
+ const std::string& salt, const std::string& root_digest) {
// Gets the device mapper fd.
android::base::unique_fd fd(open("/dev/device-mapper", O_RDWR));
if (fd < 0) {
@@ -360,7 +329,7 @@
// Creates the device.
alignas(dm_ioctl) char buffer[DM_BUF_SIZE];
- struct dm_ioctl *io = (struct dm_ioctl *)buffer;
+ struct dm_ioctl* io = (struct dm_ioctl*)buffer;
const std::string mount_point(basename(fstab_entry->mount_point));
if (!fs_mgr_create_verity_device(io, mount_point, fd)) {
LERROR << "Couldn't create verity device!";
@@ -375,8 +344,7 @@
}
// Loads the verity mapping table.
- if (!hashtree_load_verity_table(io, mount_point, fd,
- std::string(fstab_entry->blk_device),
+ if (!hashtree_load_verity_table(io, mount_point, fd, std::string(fstab_entry->blk_device),
hashtree_desc, salt, root_digest)) {
LERROR << "Couldn't load verity table!";
return false;
@@ -403,24 +371,20 @@
return true;
}
-static bool get_hashtree_descriptor(const std::string &partition_name,
- const AvbSlotVerifyData &verify_data,
- AvbHashtreeDescriptor *out_hashtree_desc,
- std::string *out_salt,
- std::string *out_digest)
-{
+static bool get_hashtree_descriptor(const std::string& partition_name,
+ const AvbSlotVerifyData& verify_data,
+ AvbHashtreeDescriptor* out_hashtree_desc, std::string* out_salt,
+ std::string* out_digest) {
bool found = false;
- const uint8_t *desc_partition_name;
+ const uint8_t* desc_partition_name;
for (size_t i = 0; i < verify_data.num_vbmeta_images && !found; i++) {
// Get descriptors from vbmeta_images[i].
size_t num_descriptors;
- std::unique_ptr<const AvbDescriptor *[], decltype(&avb_free)>
- descriptors(
- avb_descriptor_get_all(verify_data.vbmeta_images[i].vbmeta_data,
- verify_data.vbmeta_images[i].vbmeta_size,
- &num_descriptors),
- avb_free);
+ std::unique_ptr<const AvbDescriptor* [], decltype(&avb_free)> descriptors(
+ avb_descriptor_get_all(verify_data.vbmeta_images[i].vbmeta_data,
+ verify_data.vbmeta_images[i].vbmeta_size, &num_descriptors),
+ avb_free);
if (!descriptors || num_descriptors < 1) {
continue;
@@ -428,12 +392,9 @@
// Ensures that hashtree descriptor is either in /vbmeta or in
// the same partition for verity setup.
- std::string vbmeta_partition_name(
- verify_data.vbmeta_images[i].partition_name);
- if (vbmeta_partition_name != "vbmeta" &&
- vbmeta_partition_name != partition_name) {
- LWARNING << "Skip vbmeta image at "
- << verify_data.vbmeta_images[i].partition_name
+ std::string vbmeta_partition_name(verify_data.vbmeta_images[i].partition_name);
+ if (vbmeta_partition_name != "vbmeta" && vbmeta_partition_name != partition_name) {
+ LWARNING << "Skip vbmeta image at " << verify_data.vbmeta_images[i].partition_name
<< " for partition: " << partition_name.c_str();
continue;
}
@@ -445,21 +406,18 @@
continue;
}
if (desc.tag == AVB_DESCRIPTOR_TAG_HASHTREE) {
- desc_partition_name = (const uint8_t *)descriptors[j] +
- sizeof(AvbHashtreeDescriptor);
+ desc_partition_name =
+ (const uint8_t*)descriptors[j] + sizeof(AvbHashtreeDescriptor);
if (!avb_hashtree_descriptor_validate_and_byteswap(
- (AvbHashtreeDescriptor *)descriptors[j],
- out_hashtree_desc)) {
+ (AvbHashtreeDescriptor*)descriptors[j], out_hashtree_desc)) {
continue;
}
- if (out_hashtree_desc->partition_name_len !=
- partition_name.length()) {
+ if (out_hashtree_desc->partition_name_len != partition_name.length()) {
continue;
}
// Notes that desc_partition_name is not NUL-terminated.
- std::string hashtree_partition_name(
- (const char *)desc_partition_name,
- out_hashtree_desc->partition_name_len);
+ std::string hashtree_partition_name((const char*)desc_partition_name,
+ out_hashtree_desc->partition_name_len);
if (hashtree_partition_name == partition_name) {
found = true;
}
@@ -472,18 +430,16 @@
return false;
}
- const uint8_t *desc_salt =
- desc_partition_name + out_hashtree_desc->partition_name_len;
+ const uint8_t* desc_salt = desc_partition_name + out_hashtree_desc->partition_name_len;
*out_salt = bytes_to_hex(desc_salt, out_hashtree_desc->salt_len);
- const uint8_t *desc_digest = desc_salt + out_hashtree_desc->salt_len;
+ const uint8_t* desc_digest = desc_salt + out_hashtree_desc->salt_len;
*out_digest = bytes_to_hex(desc_digest, out_hashtree_desc->root_digest_len);
return true;
}
-static bool init_is_avb_used()
-{
+static bool init_is_avb_used() {
// When AVB is used, boot loader should set androidboot.vbmeta.{hash_alg,
// size, digest} in kernel cmdline. They will then be imported by init
// process to system properties: ro.boot.vbmeta.{hash_alg, size, digest}.
@@ -493,8 +449,7 @@
// be done in fs_mgr_load_vbmeta_images() and FS_MGR_SETUP_AVB_FAIL will
// be returned when there is an error.
- std::string hash_alg =
- android::base::GetProperty("ro.boot.vbmeta.hash_alg", "");
+ std::string hash_alg = android::base::GetProperty("ro.boot.vbmeta.hash_alg", "");
if (hash_alg == "sha256" || hash_alg == "sha512") {
return true;
@@ -503,14 +458,12 @@
return false;
}
-bool fs_mgr_is_avb_used()
-{
+bool fs_mgr_is_avb_used() {
static bool result = init_is_avb_used();
return result;
}
-int fs_mgr_load_vbmeta_images(struct fstab *fstab)
-{
+int fs_mgr_load_vbmeta_images(struct fstab* fstab) {
FS_MGR_CHECK(fstab != nullptr);
// Gets the expected hash value of vbmeta images from
@@ -529,12 +482,11 @@
// Sets requested_partitions to nullptr as it's to copy the contents
// of HASH partitions into fs_mgr_avb_verify_data, which is not required as
// fs_mgr only deals with HASHTREE partitions.
- const char *requested_partitions[] = {nullptr};
- const char *ab_suffix =
- android::base::GetProperty("ro.boot.slot_suffix", "").c_str();
- AvbSlotVerifyResult verify_result = avb_slot_verify(
- fs_mgr_avb_ops, requested_partitions, ab_suffix,
- fs_mgr_vbmeta_prop.allow_verification_error, &fs_mgr_avb_verify_data);
+ const char* requested_partitions[] = {nullptr};
+ const char* ab_suffix = android::base::GetProperty("ro.boot.slot_suffix", "").c_str();
+ AvbSlotVerifyResult verify_result =
+ avb_slot_verify(fs_mgr_avb_ops, requested_partitions, ab_suffix,
+ fs_mgr_vbmeta_prop.allow_verification_error, &fs_mgr_avb_verify_data);
// Only allow two verify results:
// - AVB_SLOT_VERIFY_RESULT_OK.
@@ -557,12 +509,11 @@
// Checks whether FLAGS_HASHTREE_DISABLED is set.
AvbVBMetaImageHeader vbmeta_header;
avb_vbmeta_image_header_to_host_byte_order(
- (AvbVBMetaImageHeader *)fs_mgr_avb_verify_data->vbmeta_images[0]
- .vbmeta_data,
+ (AvbVBMetaImageHeader*)fs_mgr_avb_verify_data->vbmeta_images[0].vbmeta_data,
&vbmeta_header);
- bool hashtree_disabled = ((AvbVBMetaImageFlags)vbmeta_header.flags &
- AVB_VBMETA_IMAGE_FLAGS_HASHTREE_DISABLED);
+ bool hashtree_disabled =
+ ((AvbVBMetaImageFlags)vbmeta_header.flags & AVB_VBMETA_IMAGE_FLAGS_HASHTREE_DISABLED);
if (hashtree_disabled) {
return FS_MGR_SETUP_AVB_HASHTREE_DISABLED;
}
@@ -577,8 +528,7 @@
return FS_MGR_SETUP_AVB_FAIL;
}
-void fs_mgr_unload_vbmeta_images()
-{
+void fs_mgr_unload_vbmeta_images() {
if (fs_mgr_avb_verify_data != nullptr) {
avb_slot_verify_data_free(fs_mgr_avb_verify_data);
}
@@ -588,32 +538,27 @@
}
}
-int fs_mgr_setup_avb(struct fstab_rec *fstab_entry)
-{
- if (!fstab_entry || !fs_mgr_avb_verify_data ||
- fs_mgr_avb_verify_data->num_vbmeta_images < 1) {
+int fs_mgr_setup_avb(struct fstab_rec* fstab_entry) {
+ if (!fstab_entry || !fs_mgr_avb_verify_data || fs_mgr_avb_verify_data->num_vbmeta_images < 1) {
return FS_MGR_SETUP_AVB_FAIL;
}
std::string partition_name(basename(fstab_entry->mount_point));
- if (!avb_validate_utf8((const uint8_t *)partition_name.c_str(),
- partition_name.length())) {
- LERROR << "Partition name: " << partition_name.c_str()
- << " is not valid UTF-8.";
+ if (!avb_validate_utf8((const uint8_t*)partition_name.c_str(), partition_name.length())) {
+ LERROR << "Partition name: " << partition_name.c_str() << " is not valid UTF-8.";
return FS_MGR_SETUP_AVB_FAIL;
}
AvbHashtreeDescriptor hashtree_descriptor;
std::string salt;
std::string root_digest;
- if (!get_hashtree_descriptor(partition_name, *fs_mgr_avb_verify_data,
- &hashtree_descriptor, &salt, &root_digest)) {
+ if (!get_hashtree_descriptor(partition_name, *fs_mgr_avb_verify_data, &hashtree_descriptor,
+ &salt, &root_digest)) {
return FS_MGR_SETUP_AVB_FAIL;
}
// Converts HASHTREE descriptor to verity_table_params.
- if (!hashtree_dm_verity_setup(fstab_entry, hashtree_descriptor, salt,
- root_digest)) {
+ if (!hashtree_dm_verity_setup(fstab_entry, hashtree_descriptor, salt, root_digest)) {
return FS_MGR_SETUP_AVB_FAIL;
}
diff --git a/fs_mgr/fs_mgr_avb_ops.cpp b/fs_mgr/fs_mgr_avb_ops.cpp
index f96f124..dd8c7e7 100644
--- a/fs_mgr/fs_mgr_avb_ops.cpp
+++ b/fs_mgr/fs_mgr_avb_ops.cpp
@@ -39,15 +39,11 @@
#include "fs_mgr_avb_ops.h"
#include "fs_mgr_priv.h"
-static struct fstab *fs_mgr_fstab = nullptr;
+static struct fstab* fs_mgr_fstab = nullptr;
-static AvbIOResult read_from_partition(AvbOps *ops ATTRIBUTE_UNUSED,
- const char *partition,
- int64_t offset,
- size_t num_bytes,
- void *buffer,
- size_t *out_num_read)
-{
+static AvbIOResult read_from_partition(AvbOps* ops ATTRIBUTE_UNUSED, const char* partition,
+ int64_t offset, size_t num_bytes, void* buffer,
+ size_t* out_num_read) {
// The input |partition| name is with ab_suffix, e.g. system_a.
// Slot suffix (e.g. _a) will be appended to the device file path
// for partitions having 'slotselect' optin in fstab file, but it
@@ -62,8 +58,7 @@
// - /dev/block/platform/soc.0/7824900.sdhci/by-name/misc ->
// - /dev/block/platform/soc.0/7824900.sdhci/by-name/system_a
- struct fstab_rec *fstab_entry =
- fs_mgr_get_entry_for_mount_point(fs_mgr_fstab, "/misc");
+ struct fstab_rec* fstab_entry = fs_mgr_get_entry_for_mount_point(fs_mgr_fstab, "/misc");
if (fstab_entry == nullptr) {
LERROR << "/misc mount point not found in fstab";
@@ -86,8 +81,7 @@
return AVB_IO_RESULT_ERROR_IO;
}
- android::base::unique_fd fd(
- TEMP_FAILURE_RETRY(open(path.c_str(), O_RDONLY | O_CLOEXEC)));
+ android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(path.c_str(), O_RDONLY | O_CLOEXEC)));
if (fd < 0) {
PERROR << "Failed to open " << path.c_str();
@@ -112,12 +106,11 @@
// On Linux, we never get partial reads from block devices (except
// for EOF).
- ssize_t num_read =
- TEMP_FAILURE_RETRY(pread64(fd, buffer, num_bytes, offset));
+ ssize_t num_read = TEMP_FAILURE_RETRY(pread64(fd, buffer, num_bytes, offset));
if (num_read < 0 || (size_t)num_read != num_bytes) {
- PERROR << "Failed to read " << num_bytes << " bytes from "
- << path.c_str() << " offset " << offset;
+ PERROR << "Failed to read " << num_bytes << " bytes from " << path.c_str() << " offset "
+ << offset;
return AVB_IO_RESULT_ERROR_IO;
}
@@ -128,11 +121,9 @@
return AVB_IO_RESULT_OK;
}
-static AvbIOResult dummy_read_rollback_index(AvbOps *ops ATTRIBUTE_UNUSED,
- size_t rollback_index_location
- ATTRIBUTE_UNUSED,
- uint64_t *out_rollback_index)
-{
+static AvbIOResult dummy_read_rollback_index(AvbOps* ops ATTRIBUTE_UNUSED,
+ size_t rollback_index_location ATTRIBUTE_UNUSED,
+ uint64_t* out_rollback_index) {
// rollback_index has been checked in bootloader phase.
// In user-space, returns the smallest value 0 to pass the check.
*out_rollback_index = 0;
@@ -140,13 +131,9 @@
}
static AvbIOResult dummy_validate_vbmeta_public_key(
- AvbOps *ops ATTRIBUTE_UNUSED,
- const uint8_t *public_key_data ATTRIBUTE_UNUSED,
- size_t public_key_length ATTRIBUTE_UNUSED,
- const uint8_t *public_key_metadata ATTRIBUTE_UNUSED,
- size_t public_key_metadata_length ATTRIBUTE_UNUSED,
- bool *out_is_trusted)
-{
+ AvbOps* ops ATTRIBUTE_UNUSED, const uint8_t* public_key_data ATTRIBUTE_UNUSED,
+ size_t public_key_length ATTRIBUTE_UNUSED, const uint8_t* public_key_metadata ATTRIBUTE_UNUSED,
+ size_t public_key_metadata_length ATTRIBUTE_UNUSED, bool* out_is_trusted) {
// vbmeta public key has been checked in bootloader phase.
// In user-space, returns true to pass the check.
//
@@ -158,9 +145,8 @@
return AVB_IO_RESULT_OK;
}
-static AvbIOResult dummy_read_is_device_unlocked(AvbOps *ops ATTRIBUTE_UNUSED,
- bool *out_is_unlocked)
-{
+static AvbIOResult dummy_read_is_device_unlocked(AvbOps* ops ATTRIBUTE_UNUSED,
+ bool* out_is_unlocked) {
// The function is for bootloader to update the value into
// androidboot.vbmeta.device_state in kernel cmdline.
// In user-space, returns true as we don't need to update it anymore.
@@ -168,12 +154,9 @@
return AVB_IO_RESULT_OK;
}
-static AvbIOResult dummy_get_unique_guid_for_partition(
- AvbOps *ops ATTRIBUTE_UNUSED,
- const char *partition ATTRIBUTE_UNUSED,
- char *guid_buf,
- size_t guid_buf_size)
-{
+static AvbIOResult dummy_get_unique_guid_for_partition(AvbOps* ops ATTRIBUTE_UNUSED,
+ const char* partition ATTRIBUTE_UNUSED,
+ char* guid_buf, size_t guid_buf_size) {
// The function is for bootloader to set the correct UUID
// for a given partition in kernel cmdline.
// In user-space, returns a faking one as we don't need to update
@@ -182,14 +165,13 @@
return AVB_IO_RESULT_OK;
}
-AvbOps *fs_mgr_dummy_avb_ops_new(struct fstab *fstab)
-{
- AvbOps *ops;
+AvbOps* fs_mgr_dummy_avb_ops_new(struct fstab* fstab) {
+ AvbOps* ops;
// Assigns the fstab to the static variable for later use.
fs_mgr_fstab = fstab;
- ops = (AvbOps *)calloc(1, sizeof(AvbOps));
+ ops = (AvbOps*)calloc(1, sizeof(AvbOps));
if (ops == nullptr) {
LERROR << "Error allocating memory for AvbOps";
return nullptr;
@@ -207,7 +189,4 @@
return ops;
}
-void fs_mgr_dummy_avb_ops_free(AvbOps *ops)
-{
- free(ops);
-}
+void fs_mgr_dummy_avb_ops_free(AvbOps* ops) { free(ops); }
diff --git a/fs_mgr/fs_mgr_avb_ops.h b/fs_mgr/fs_mgr_avb_ops.h
index 9f99be8..bfdec9a 100644
--- a/fs_mgr/fs_mgr_avb_ops.h
+++ b/fs_mgr/fs_mgr_avb_ops.h
@@ -49,10 +49,10 @@
*
* Frees with fs_mgr_dummy_avb_ops_free().
*/
-AvbOps *fs_mgr_dummy_avb_ops_new(struct fstab *fstab);
+AvbOps* fs_mgr_dummy_avb_ops_new(struct fstab* fstab);
/* Frees an AvbOps instance previously allocated with fs_mgr_avb_ops_new(). */
-void fs_mgr_dummy_avb_ops_free(AvbOps *ops);
+void fs_mgr_dummy_avb_ops_free(AvbOps* ops);
__END_DECLS
diff --git a/fs_mgr/fs_mgr_dm_ioctl.cpp b/fs_mgr/fs_mgr_dm_ioctl.cpp
index 6012a39..4cbd5a8 100644
--- a/fs_mgr/fs_mgr_dm_ioctl.cpp
+++ b/fs_mgr/fs_mgr_dm_ioctl.cpp
@@ -23,10 +23,7 @@
#include "fs_mgr_priv.h"
#include "fs_mgr_priv_dm_ioctl.h"
-void fs_mgr_verity_ioctl_init(struct dm_ioctl *io,
- const std::string &name,
- unsigned flags)
-{
+void fs_mgr_verity_ioctl_init(struct dm_ioctl* io, const std::string& name, unsigned flags) {
memset(io, 0, DM_BUF_SIZE);
io->data_size = DM_BUF_SIZE;
io->data_start = sizeof(struct dm_ioctl);
@@ -39,10 +36,7 @@
}
}
-bool fs_mgr_create_verity_device(struct dm_ioctl *io,
- const std::string &name,
- int fd)
-{
+bool fs_mgr_create_verity_device(struct dm_ioctl* io, const std::string& name, int fd) {
fs_mgr_verity_ioctl_init(io, name, 1);
if (ioctl(fd, DM_DEV_CREATE, io)) {
PERROR << "Error creating device mapping";
@@ -51,10 +45,7 @@
return true;
}
-bool fs_mgr_destroy_verity_device(struct dm_ioctl *io,
- const std::string &name,
- int fd)
-{
+bool fs_mgr_destroy_verity_device(struct dm_ioctl* io, const std::string& name, int fd) {
fs_mgr_verity_ioctl_init(io, name, 0);
if (ioctl(fd, DM_DEV_REMOVE, io)) {
PERROR << "Error removing device mapping";
@@ -63,11 +54,8 @@
return true;
}
-bool fs_mgr_get_verity_device_name(struct dm_ioctl *io,
- const std::string &name,
- int fd,
- std::string *out_dev_name)
-{
+bool fs_mgr_get_verity_device_name(struct dm_ioctl* io, const std::string& name, int fd,
+ std::string* out_dev_name) {
FS_MGR_CHECK(out_dev_name != nullptr);
fs_mgr_verity_ioctl_init(io, name, 0);
@@ -82,10 +70,7 @@
return true;
}
-bool fs_mgr_resume_verity_table(struct dm_ioctl *io,
- const std::string &name,
- int fd)
-{
+bool fs_mgr_resume_verity_table(struct dm_ioctl* io, const std::string& name, int fd) {
fs_mgr_verity_ioctl_init(io, name, 0);
if (ioctl(fd, DM_DEV_SUSPEND, io)) {
PERROR << "Error activating verity device";
diff --git a/fs_mgr/fs_mgr_priv_avb.h b/fs_mgr/fs_mgr_priv_avb.h
index 6d0171c..dce9f61 100644
--- a/fs_mgr/fs_mgr_priv_avb.h
+++ b/fs_mgr/fs_mgr_priv_avb.h
@@ -45,11 +45,11 @@
* developers to make the filesystem writable to allow replacing
* binaries on the device.
*/
-int fs_mgr_load_vbmeta_images(struct fstab *fstab);
+int fs_mgr_load_vbmeta_images(struct fstab* fstab);
void fs_mgr_unload_vbmeta_images();
-int fs_mgr_setup_avb(struct fstab_rec *fstab_entry);
+int fs_mgr_setup_avb(struct fstab_rec* fstab_entry);
__END_DECLS
diff --git a/fs_mgr/fs_mgr_priv_dm_ioctl.h b/fs_mgr/fs_mgr_priv_dm_ioctl.h
index eeae4dd..a00a9c1 100644
--- a/fs_mgr/fs_mgr_priv_dm_ioctl.h
+++ b/fs_mgr/fs_mgr_priv_dm_ioctl.h
@@ -17,28 +17,18 @@
#ifndef __CORE_FS_MGR_PRIV_DM_IOCTL_H
#define __CORE_FS_MGR_PRIV_DM_IOCTL_H
-#include <string>
#include <linux/dm-ioctl.h>
+#include <string>
-void fs_mgr_verity_ioctl_init(struct dm_ioctl *io,
- const std::string &name,
- unsigned flags);
+void fs_mgr_verity_ioctl_init(struct dm_ioctl* io, const std::string& name, unsigned flags);
-bool fs_mgr_create_verity_device(struct dm_ioctl *io,
- const std::string &name,
- int fd);
+bool fs_mgr_create_verity_device(struct dm_ioctl* io, const std::string& name, int fd);
-bool fs_mgr_destroy_verity_device(struct dm_ioctl *io,
- const std::string &name,
- int fd);
+bool fs_mgr_destroy_verity_device(struct dm_ioctl* io, const std::string& name, int fd);
-bool fs_mgr_get_verity_device_name(struct dm_ioctl *io,
- const std::string &name,
- int fd,
- std::string *out_dev_name);
+bool fs_mgr_get_verity_device_name(struct dm_ioctl* io, const std::string& name, int fd,
+ std::string* out_dev_name);
-bool fs_mgr_resume_verity_table(struct dm_ioctl *io,
- const std::string &name,
- int fd);
+bool fs_mgr_resume_verity_table(struct dm_ioctl* io, const std::string& name, int fd);
#endif /* __CORE_FS_MGR_PRIV_DM_IOCTL_H */
diff --git a/fs_mgr/fs_mgr_priv_sha.h b/fs_mgr/fs_mgr_priv_sha.h
index 1abc273..882411b 100644
--- a/fs_mgr/fs_mgr_priv_sha.h
+++ b/fs_mgr/fs_mgr_priv_sha.h
@@ -19,8 +19,7 @@
#include <openssl/sha.h>
-class SHA256Hasher
-{
+class SHA256Hasher {
private:
SHA256_CTX sha256_ctx;
uint8_t hash[SHA256_DIGEST_LENGTH];
@@ -28,25 +27,17 @@
public:
enum { DIGEST_SIZE = SHA256_DIGEST_LENGTH };
- SHA256Hasher()
- {
- SHA256_Init(&sha256_ctx);
- }
+ SHA256Hasher() { SHA256_Init(&sha256_ctx); }
- void update(const void *data, size_t data_size)
- {
- SHA256_Update(&sha256_ctx, data, data_size);
- }
+ void update(const void* data, size_t data_size) { SHA256_Update(&sha256_ctx, data, data_size); }
- const uint8_t *finalize()
- {
+ const uint8_t* finalize() {
SHA256_Final(hash, &sha256_ctx);
return hash;
}
};
-class SHA512Hasher
-{
+class SHA512Hasher {
private:
SHA512_CTX sha512_ctx;
uint8_t hash[SHA512_DIGEST_LENGTH];
@@ -54,18 +45,13 @@
public:
enum { DIGEST_SIZE = SHA512_DIGEST_LENGTH };
- SHA512Hasher()
- {
- SHA512_Init(&sha512_ctx);
- }
+ SHA512Hasher() { SHA512_Init(&sha512_ctx); }
- void update(const uint8_t *data, size_t data_size)
- {
+ void update(const uint8_t* data, size_t data_size) {
SHA512_Update(&sha512_ctx, data, data_size);
}
- const uint8_t *finalize()
- {
+ const uint8_t* finalize() {
SHA512_Final(hash, &sha512_ctx);
return hash;
}
diff --git a/libcutils/Android.bp b/libcutils/Android.bp
index 8ba7452..cf31195 100644
--- a/libcutils/Android.bp
+++ b/libcutils/Android.bp
@@ -60,7 +60,7 @@
"native_handle.c",
"open_memstream.c",
"record_stream.c",
- "sched_policy.c",
+ "sched_policy.cpp",
"sockets.cpp",
"strdup16to8.c",
"strdup8to16.c",
@@ -141,14 +141,6 @@
header_libs: ["libcutils_headers"],
export_header_lib_headers: ["libcutils_headers"],
- product_variables: {
- cpusets: {
- cflags: ["-DUSE_CPUSETS"],
- },
- schedboost: {
- cflags: ["-DUSE_SCHEDBOOST"],
- },
- },
cflags: [
"-Werror",
"-Wall",
diff --git a/libcutils/include/cutils/sched_policy.h b/libcutils/include/cutils/sched_policy.h
index 591bd44..15391d9 100644
--- a/libcutils/include/cutils/sched_policy.h
+++ b/libcutils/include/cutils/sched_policy.h
@@ -17,10 +17,27 @@
#ifndef __CUTILS_SCHED_POLICY_H
#define __CUTILS_SCHED_POLICY_H
+#include <stdbool.h>
+
#ifdef __cplusplus
extern "C" {
#endif
+/*
+ * Check if Linux kernel enables CPUSETS feature.
+ *
+ * Return value: 1 if Linux kernel CONFIG_CPUSETS=y; 0 otherwise.
+ */
+extern bool cpusets_enabled();
+
+/*
+ * Check if Linux kernel enables SCHEDTUNE feature (only available in Android
+ * common kernel or Linaro LSK, not in mainline Linux as of v4.9)
+ *
+ * Return value: 1 if Linux kernel CONFIG_SCHEDTUNE=y; 0 otherwise.
+ */
+extern bool schedboost_enabled();
+
/* Keep in sync with THREAD_GROUP_* in frameworks/base/core/java/android/os/Process.java */
typedef enum {
SP_DEFAULT = -1,
diff --git a/libcutils/sched_policy.c b/libcutils/sched_policy.cpp
similarity index 73%
rename from libcutils/sched_policy.c
rename to libcutils/sched_policy.cpp
index 5c5f3a5..7e3ad59 100644
--- a/libcutils/sched_policy.c
+++ b/libcutils/sched_policy.cpp
@@ -58,13 +58,11 @@
static int bg_cgroup_fd = -1;
static int fg_cgroup_fd = -1;
-#ifdef USE_CPUSETS
// File descriptors open to /dev/cpuset/../tasks, setup by initialize, or -1 on error
static int system_bg_cpuset_fd = -1;
static int bg_cpuset_fd = -1;
static int fg_cpuset_fd = -1;
static int ta_cpuset_fd = -1; // special cpuset for top app
-#endif
// File descriptors open to /dev/stune/../tasks, setup by initialize, or -1 on error
static int bg_schedboost_fd = -1;
@@ -106,8 +104,53 @@
return 0;
}
-static void __initialize(void) {
- char* filename;
+/*
+ If CONFIG_CPUSETS for Linux kernel is set, "tasks" can be found under
+ /dev/cpuset mounted in init.rc; otherwise, that file does not exist
+ even though the directory, /dev/cpuset, is still created (by init.rc).
+
+ A couple of other candidates (under cpuset mount directory):
+ notify_on_release
+ release_agent
+
+ Yet another way to decide if cpuset is enabled is to parse
+ /proc/self/status and search for lines begin with "Mems_allowed".
+
+ If CONFIG_PROC_PID_CPUSET is set, the existence "/proc/self/cpuset" can
+ be used to decide if CONFIG_CPUSETS is set, so we don't have a dependency
+ on where init.rc mounts cpuset. That's why we'd better require this
+ configuration be set if CONFIG_CPUSETS is set.
+
+ With runtime check using the following function, build time
+ variables like ENABLE_CPUSETS (used in Android.mk) or cpusets (used
+ in Android.bp) are not needed.
+ */
+
+bool cpusets_enabled() {
+ static bool enabled = (access("/dev/cpuset/tasks", F_OK) == 0);
+
+ return enabled;
+}
+
+/*
+ Similar to CONFIG_CPUSETS above, but with a different configuration
+ CONFIG_SCHEDTUNE that's in Android common Linux kernel and Linaro
+ Stable Kernel (LSK), but not in mainline Linux as of v4.9.
+
+ With runtime check using the following function, build time
+ variables like ENABLE_SCHEDBOOST (used in Android.mk) or schedboost
+ (used in Android.bp) are not needed.
+
+ */
+
+bool schedboost_enabled() {
+ static bool enabled = (access("/dev/stune/tasks", F_OK) == 0);
+
+ return enabled;
+}
+
+static void __initialize() {
+ const char* filename;
if (!access("/dev/cpuctl/tasks", W_OK)) {
__sys_supports_schedgroups = 1;
@@ -126,28 +169,28 @@
__sys_supports_schedgroups = 0;
}
-#ifdef USE_CPUSETS
- if (!access("/dev/cpuset/tasks", W_OK)) {
+ if (cpusets_enabled()) {
+ if (!access("/dev/cpuset/tasks", W_OK)) {
- filename = "/dev/cpuset/foreground/tasks";
- fg_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC);
- filename = "/dev/cpuset/background/tasks";
- bg_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC);
- filename = "/dev/cpuset/system-background/tasks";
- system_bg_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC);
- filename = "/dev/cpuset/top-app/tasks";
- ta_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC);
+ filename = "/dev/cpuset/foreground/tasks";
+ fg_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC);
+ filename = "/dev/cpuset/background/tasks";
+ bg_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC);
+ filename = "/dev/cpuset/system-background/tasks";
+ system_bg_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC);
+ filename = "/dev/cpuset/top-app/tasks";
+ ta_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC);
-#ifdef USE_SCHEDBOOST
- filename = "/dev/stune/top-app/tasks";
- ta_schedboost_fd = open(filename, O_WRONLY | O_CLOEXEC);
- filename = "/dev/stune/foreground/tasks";
- fg_schedboost_fd = open(filename, O_WRONLY | O_CLOEXEC);
- filename = "/dev/stune/background/tasks";
- bg_schedboost_fd = open(filename, O_WRONLY | O_CLOEXEC);
-#endif
+ if (schedboost_enabled()) {
+ filename = "/dev/stune/top-app/tasks";
+ ta_schedboost_fd = open(filename, O_WRONLY | O_CLOEXEC);
+ filename = "/dev/stune/foreground/tasks";
+ fg_schedboost_fd = open(filename, O_WRONLY | O_CLOEXEC);
+ filename = "/dev/stune/background/tasks";
+ bg_schedboost_fd = open(filename, O_WRONLY | O_CLOEXEC);
+ }
+ }
}
-#endif
char buf[64];
snprintf(buf, sizeof(buf), "/proc/%d/timerslack_ns", getpid());
@@ -235,33 +278,34 @@
if (__sys_supports_schedgroups) {
char grpBuf[32];
-#ifdef USE_CPUSETS
- if (getCGroupSubsys(tid, "cpuset", grpBuf, sizeof(grpBuf)) < 0)
- return -1;
- if (grpBuf[0] == '\0') {
- *policy = SP_FOREGROUND;
- } else if (!strcmp(grpBuf, "foreground")) {
- *policy = SP_FOREGROUND;
- } else if (!strcmp(grpBuf, "background")) {
- *policy = SP_BACKGROUND;
- } else if (!strcmp(grpBuf, "top-app")) {
- *policy = SP_TOP_APP;
+
+ if (cpusets_enabled()) {
+ if (getCGroupSubsys(tid, "cpuset", grpBuf, sizeof(grpBuf)) < 0)
+ return -1;
+ if (grpBuf[0] == '\0') {
+ *policy = SP_FOREGROUND;
+ } else if (!strcmp(grpBuf, "foreground")) {
+ *policy = SP_FOREGROUND;
+ } else if (!strcmp(grpBuf, "background")) {
+ *policy = SP_BACKGROUND;
+ } else if (!strcmp(grpBuf, "top-app")) {
+ *policy = SP_TOP_APP;
+ } else {
+ errno = ERANGE;
+ return -1;
+ }
} else {
- errno = ERANGE;
- return -1;
+ if (getCGroupSubsys(tid, "cpu", grpBuf, sizeof(grpBuf)) < 0)
+ return -1;
+ if (grpBuf[0] == '\0') {
+ *policy = SP_FOREGROUND;
+ } else if (!strcmp(grpBuf, "bg_non_interactive")) {
+ *policy = SP_BACKGROUND;
+ } else {
+ errno = ERANGE;
+ return -1;
+ }
}
-#else
- if (getCGroupSubsys(tid, "cpu", grpBuf, sizeof(grpBuf)) < 0)
- return -1;
- if (grpBuf[0] == '\0') {
- *policy = SP_FOREGROUND;
- } else if (!strcmp(grpBuf, "bg_non_interactive")) {
- *policy = SP_BACKGROUND;
- } else {
- errno = ERANGE;
- return -1;
- }
-#endif
} else {
int rc = sched_getscheduler(tid);
if (rc < 0)
@@ -281,9 +325,10 @@
int set_cpuset_policy(int tid, SchedPolicy policy)
{
// in the absence of cpusets, use the old sched policy
-#ifndef USE_CPUSETS
- return set_sched_policy(tid, policy);
-#else
+ if (!cpusets_enabled()) {
+ return set_sched_policy(tid, policy);
+ }
+
if (tid == 0) {
tid = gettid();
}
@@ -320,15 +365,14 @@
return -errno;
}
-#ifdef USE_SCHEDBOOST
- if (boost_fd > 0 && add_tid_to_cgroup(tid, boost_fd) != 0) {
- if (errno != ESRCH && errno != ENOENT)
- return -errno;
+ if (schedboost_enabled()) {
+ if (boost_fd > 0 && add_tid_to_cgroup(tid, boost_fd) != 0) {
+ if (errno != ESRCH && errno != ENOENT)
+ return -errno;
+ }
}
-#endif
return 0;
-#endif
}
static void set_timerslack_ns(int tid, unsigned long long slack) {
@@ -420,18 +464,17 @@
break;
}
-
if (add_tid_to_cgroup(tid, fd) != 0) {
if (errno != ESRCH && errno != ENOENT)
return -errno;
}
-#ifdef USE_SCHEDBOOST
- if (boost_fd > 0 && add_tid_to_cgroup(tid, boost_fd) != 0) {
- if (errno != ESRCH && errno != ENOENT)
- return -errno;
+ if (schedboost_enabled()) {
+ if (boost_fd > 0 && add_tid_to_cgroup(tid, boost_fd) != 0) {
+ if (errno != ESRCH && errno != ENOENT)
+ return -errno;
+ }
}
-#endif
} else {
struct sched_param param;
diff --git a/libutils/include/utils/Vector.h b/libutils/include/utils/Vector.h
index 28a77b8..9a643f9 100644
--- a/libutils/include/utils/Vector.h
+++ b/libutils/include/utils/Vector.h
@@ -20,8 +20,6 @@
#include <stdint.h>
#include <sys/types.h>
-#include <new>
-
#include <log/log.h>
#include <utils/TypeHelpers.h>
#include <utils/VectorImpl.h>