summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Merger <noreply-android-build-merger@google.com>2019-02-11 23:08:34 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2019-02-11 23:08:34 +0000
commit9156533bc75e06dfc1676516b57e83800e63ff14 (patch)
tree4e6f8daf58332069fde6f7fb36204ecbc2d862ed
parent4d2908ece9a9241832ef0c89d6c2c25965e05988 (diff)
parent93529b850d07d648373cde49206a3c589e3a7dfc (diff)
downloadextras-pie-cuttlefish-testing.tar.gz
Merge "Snap for 5180536 from 9ec7ba8443caa905c2ebdf6eadd5e6148a348d37 to pi-platform-release am: 971f83995e" into pie-cuttlefish-testingpie-cuttlefish-testing
-rw-r--r--ext4_utils/ext4_crypt.cpp11
-rw-r--r--libperfmgr/Node.cc8
-rw-r--r--libperfmgr/NodeLooperThread.cc10
-rw-r--r--libperfmgr/include/perfmgr/Node.h2
4 files changed, 14 insertions, 17 deletions
diff --git a/ext4_utils/ext4_crypt.cpp b/ext4_utils/ext4_crypt.cpp
index 95b67a1c..36fe11f7 100644
--- a/ext4_utils/ext4_crypt.cpp
+++ b/ext4_utils/ext4_crypt.cpp
@@ -52,7 +52,6 @@ struct ext4_encryption_policy {
#define EXT4_ENCRYPTION_MODE_AES_256_XTS 1
#define EXT4_ENCRYPTION_MODE_AES_256_CTS 4
-#define EXT4_ENCRYPTION_MODE_ADIANTUM 9
#define EXT4_ENCRYPTION_MODE_AES_256_HEH 126
#define EXT4_ENCRYPTION_MODE_PRIVATE 127
@@ -62,7 +61,6 @@ struct ext4_encryption_policy {
#define EXT4_POLICY_FLAGS_PAD_32 0x03
#define EXT4_POLICY_FLAGS_PAD_MASK 0x03
#define EXT4_POLICY_FLAGS_VALID 0x03
-#define EXT4_POLICY_FLAG_DIRECT_KEY 0x04
// ext4enc:TODO Get value from somewhere sensible
#define EXT4_IOC_SET_ENCRYPTION_POLICY _IOR('f', 19, struct ext4_encryption_policy)
@@ -139,11 +137,6 @@ static uint8_t e4crypt_get_policy_flags(int filenames_encryption_mode) {
if (filenames_encryption_mode == EXT4_ENCRYPTION_MODE_AES_256_CTS) {
// Use legacy padding with our original filenames encryption mode.
return EXT4_POLICY_FLAGS_PAD_4;
- } else if (filenames_encryption_mode == EXT4_ENCRYPTION_MODE_ADIANTUM) {
- // Use DIRECT_KEY for Adiantum, since it's much more efficient but just
- // as secure since Android doesn't reuse the same master key for
- // multiple encryption modes
- return (EXT4_POLICY_FLAGS_PAD_16 | EXT4_POLICY_FLAG_DIRECT_KEY);
}
// With a new mode we can use the better padding flag without breaking existing devices: pad
// filenames with zeroes to the next 16-byte boundary. This is more secure (helps hide the
@@ -265,8 +258,6 @@ int e4crypt_policy_ensure(const char *directory, const char *policy,
if (!strcmp(contents_encryption_mode, "software") ||
!strcmp(contents_encryption_mode, "aes-256-xts")) {
contents_mode = EXT4_ENCRYPTION_MODE_AES_256_XTS;
- } else if (!strcmp(contents_encryption_mode, "adiantum")) {
- contents_mode = EXT4_ENCRYPTION_MODE_ADIANTUM;
} else if (!strcmp(contents_encryption_mode, "ice")) {
contents_mode = EXT4_ENCRYPTION_MODE_PRIVATE;
} else {
@@ -279,8 +270,6 @@ int e4crypt_policy_ensure(const char *directory, const char *policy,
filenames_mode = EXT4_ENCRYPTION_MODE_AES_256_CTS;
} else if (!strcmp(filenames_encryption_mode, "aes-256-heh")) {
filenames_mode = EXT4_ENCRYPTION_MODE_AES_256_HEH;
- } else if (!strcmp(filenames_encryption_mode, "adiantum")) {
- filenames_mode = EXT4_ENCRYPTION_MODE_ADIANTUM;
} else {
LOG(ERROR) << "Invalid file names encryption mode: "
<< filenames_encryption_mode;
diff --git a/libperfmgr/Node.cc b/libperfmgr/Node.cc
index 63cf8aaa..c35c3ca1 100644
--- a/libperfmgr/Node.cc
+++ b/libperfmgr/Node.cc
@@ -66,7 +66,7 @@ bool Node::RemoveRequest(const std::string& hint_type) {
return ret;
}
-std::chrono::milliseconds Node::Update() {
+std::chrono::milliseconds Node::Update(bool log_error) {
std::size_t value_index = default_val_index_;
std::chrono::milliseconds expire_time = std::chrono::milliseconds::max();
@@ -86,8 +86,10 @@ std::chrono::milliseconds Node::Update() {
open(node_path_.c_str(), O_WRONLY | O_CLOEXEC | O_TRUNC)));
if (fd_ == -1 || !android::base::WriteStringToFd(req_value, fd_)) {
- LOG(ERROR) << "Failed to write to node: " << node_path_
- << " with value: " << req_value << ", fd: " << fd_;
+ if (log_error) {
+ LOG(WARNING) << "Failed to write to node: " << node_path_
+ << " with value: " << req_value << ", fd: " << fd_;
+ }
// Retry in 500ms or sooner
expire_time = std::min(expire_time, std::chrono::milliseconds(500));
} else {
diff --git a/libperfmgr/NodeLooperThread.cc b/libperfmgr/NodeLooperThread.cc
index e7a63cc5..b4a27a96 100644
--- a/libperfmgr/NodeLooperThread.cc
+++ b/libperfmgr/NodeLooperThread.cc
@@ -98,9 +98,15 @@ void NodeLooperThread::DumpToFd(int fd) {
bool NodeLooperThread::threadLoop() {
::android::AutoMutex _l(lock_);
std::chrono::milliseconds timeout_ms = kMaxUpdatePeriod;
+
+ // Update 2 passes: some node may have dependency in other node
+ // e.g. update cpufreq min to VAL while cpufreq max still set to
+ // a value lower than VAL, is expected to fail in first pass
+ for (auto& n : nodes_) {
+ n->Update(false);
+ }
for (auto& n : nodes_) {
- auto t = n->Update();
- timeout_ms = std::min(t, timeout_ms);
+ timeout_ms = std::min(n->Update(), timeout_ms);
}
nsecs_t sleep_timeout_ns = std::numeric_limits<nsecs_t>::max();
diff --git a/libperfmgr/include/perfmgr/Node.h b/libperfmgr/include/perfmgr/Node.h
index ea4c3e34..560979b0 100644
--- a/libperfmgr/include/perfmgr/Node.h
+++ b/libperfmgr/include/perfmgr/Node.h
@@ -61,7 +61,7 @@ class Node {
// std::chrono::milliseconds::max() if no active request on Node; update
// node's controlled file node value and the current value index based on
// active request.
- std::chrono::milliseconds Update();
+ std::chrono::milliseconds Update(bool log_error = true);
std::string GetName() const;
std::string GetPath() const;