Changes for December 2021

This commit is contained in:
Andy CrossGate Yan
2021-12-06 16:19:39 +00:00
parent 211d0a69c8
commit 463b837c1b
102 changed files with 791 additions and 510 deletions

View File

@@ -1,7 +1,7 @@
From a4ae95a2de9f912a4e4aca075a28aa4d0ff886b9 Mon Sep 17 00:00:00 2001
From 990be9e3d37ce43afb37303b3503f0999bc82ca2 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sat, 17 Feb 2018 19:39:38 +0100
Subject: [PATCH 2/6] Allow deletion of symlink
Subject: [PATCH 1/7] Allow deletion of symlink
Change-Id: I9731895f88729072297f753088583aabbe6990f4
---
@@ -9,7 +9,7 @@ Change-Id: I9731895f88729072297f753088583aabbe6990f4
1 file changed, 1 insertion(+)
diff --git a/FsCrypt.cpp b/FsCrypt.cpp
index 04def5c..c7de48e 100644
index 04def5c4..c7de48e1 100644
--- a/FsCrypt.cpp
+++ b/FsCrypt.cpp
@@ -315,6 +315,7 @@ static bool prepare_dir(const std::string& dir, mode_t mode, uid_t uid, gid_t gi
@@ -21,5 +21,5 @@ index 04def5c..c7de48e 100644
return false;
}
--
2.29.2
2.25.1

View File

@@ -1,54 +0,0 @@
From 30e1b738f07d636015d0a4f6b4c3fd214b7b474f Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 5 Oct 2021 16:17:15 -0400
Subject: [PATCH 1/6] Fallback to non-rollback resistant keys if not available
Boot on Mediatek devices was broken with:
~ Add ROLLBACK_RESISTANCE tag to key usage
Change-Id: I0ab7103c317c70779dee03dce25ba9c9da1629f4
---
KeyStorage.cpp | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/KeyStorage.cpp b/KeyStorage.cpp
index 93c5c29..ef089ad 100644
--- a/KeyStorage.cpp
+++ b/KeyStorage.cpp
@@ -378,12 +378,15 @@ static KeymasterOperation BeginKeymasterOp(Keymaster& keymaster, const std::stri
static bool encryptWithKeymasterKey(Keymaster& keymaster, const std::string& dir,
const km::AuthorizationSet& keyParams,
const KeyBuffer& message, std::string* ciphertext) {
- km::AuthorizationSet opParams =
+ auto opParams =
km::AuthorizationSetBuilder()
- .Authorization(km::TAG_ROLLBACK_RESISTANCE)
.Authorization(km::TAG_PURPOSE, km::KeyPurpose::ENCRYPT);
+ auto opParamsWithRollback = opParams;
+ opParamsWithRollback.Authorization(km::TAG_ROLLBACK_RESISTANCE);
+
km::AuthorizationSet outParams;
- auto opHandle = BeginKeymasterOp(keymaster, dir, keyParams, opParams, &outParams);
+ auto opHandle = BeginKeymasterOp(keymaster, dir, keyParams, opParamsWithRollback, &outParams);
+ if (!opHandle) opHandle = BeginKeymasterOp(keymaster, dir, keyParams, opParams, &outParams);
if (!opHandle) return false;
auto nonceBlob = outParams.GetTagValue(km::TAG_NONCE);
if (!nonceBlob) {
@@ -410,9 +413,12 @@ static bool decryptWithKeymasterKey(Keymaster& keymaster, const std::string& dir
auto bodyAndMac = ciphertext.substr(GCM_NONCE_BYTES);
auto opParams = km::AuthorizationSetBuilder()
.Authorization(km::TAG_NONCE, nonce)
- .Authorization(km::TAG_ROLLBACK_RESISTANCE)
.Authorization(km::TAG_PURPOSE, km::KeyPurpose::DECRYPT);
- auto opHandle = BeginKeymasterOp(keymaster, dir, keyParams, opParams, nullptr);
+ auto opParamsWithRollback = opParams;
+ opParamsWithRollback.Authorization(km::TAG_ROLLBACK_RESISTANCE);
+
+ auto opHandle = BeginKeymasterOp(keymaster, dir, keyParams, opParamsWithRollback, nullptr);
+ if (!opHandle) opHandle = BeginKeymasterOp(keymaster, dir, keyParams, opParams, nullptr);
if (!opHandle) return false;
if (!opHandle.updateCompletely(bodyAndMac, message)) return false;
if (!opHandle.finish(nullptr)) return false;
--
2.29.2

View File

@@ -1,14 +1,14 @@
From 07bbca4e931e960e25f714079f176f31ca218b41 Mon Sep 17 00:00:00 2001
From c31e214cb0f52671514b06ebc6b4e03bddf491bf Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 20 Aug 2018 22:37:54 +0200
Subject: [PATCH 3/6] Support Samsung's implementation of exfat, called sdfat
Subject: [PATCH 2/7] Support Samsung's implementation of exfat, called sdfat
---
fs/Exfat.cpp | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/fs/Exfat.cpp b/fs/Exfat.cpp
index 7782dd3..91a4c50 100644
index 7782dd3b..91a4c50d 100644
--- a/fs/Exfat.cpp
+++ b/fs/Exfat.cpp
@@ -35,7 +35,7 @@ static const char* kFsckPath = "/system/bin/fsck.exfat";
@@ -40,5 +40,5 @@ index 7782dd3..91a4c50 100644
}
--
2.29.2
2.25.1

View File

@@ -1,14 +1,14 @@
From 33b5d2f1da3e8c775baf042f734c899af68a8a75 Mon Sep 17 00:00:00 2001
From 457e5c667aa50a8e944a5a20dadb6e0c4cefd7b4 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 28 Jan 2020 00:27:17 +0100
Subject: [PATCH 4/6] Sony has `texfat` exfat fs
Subject: [PATCH 3/7] Sony has `texfat` exfat fs
---
fs/Exfat.cpp | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/fs/Exfat.cpp b/fs/Exfat.cpp
index 91a4c50..6c49c10 100644
index 91a4c50d..6c49c10c 100644
--- a/fs/Exfat.cpp
+++ b/fs/Exfat.cpp
@@ -35,7 +35,11 @@ static const char* kFsckPath = "/system/bin/fsck.exfat";
@@ -34,5 +34,5 @@ index 91a4c50..6c49c10 100644
return 0;
}
--
2.29.2
2.25.1

View File

@@ -1,7 +1,7 @@
From c8c2f84551ba8cf706b5ca1e880f216261f78100 Mon Sep 17 00:00:00 2001
From 5684e411afc3cdcf5e66e9bade31fde768c3373b Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sat, 7 Mar 2020 14:49:09 +0100
Subject: [PATCH 5/6] Failing to create facedata shouldn't be fatal
Subject: [PATCH 4/7] Failing to create facedata shouldn't be fatal
Some Pie vendors create it on their own, so SELinux would deny that
Also not all devices have face unlock anyway
@@ -12,7 +12,7 @@ See https://github.com/phhusson/treble_experimentations/issues/1119
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/vold_prepare_subdirs.cpp b/vold_prepare_subdirs.cpp
index e2afb81..de863ff 100644
index e2afb815..de863ffc 100644
--- a/vold_prepare_subdirs.cpp
+++ b/vold_prepare_subdirs.cpp
@@ -193,7 +193,7 @@ static bool prepare_subdirs(const std::string& volume_uuid, int user_id, int fla
@@ -34,5 +34,5 @@ index e2afb81..de863ff 100644
}
}
--
2.29.2
2.25.1

View File

@@ -1,14 +1,14 @@
From 425cd7837ca789af3eb79e659851b67edb87d431 Mon Sep 17 00:00:00 2001
From 37b7e342b023af7f1c39335ab61e64e446057234 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Wed, 11 Mar 2020 14:02:35 +0100
Subject: [PATCH 6/6] Every voldmanaged storage is adoptable
Subject: [PATCH 5/7] Every voldmanaged storage is adoptable
---
main.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/main.cpp b/main.cpp
index 1f85fb5..52aa896 100644
index 1f85fb53..52aa896d 100644
--- a/main.cpp
+++ b/main.cpp
@@ -257,7 +257,7 @@ static int process_config(VolumeManager* vm, VoldConfigs* configs) {
@@ -21,5 +21,5 @@ index 1f85fb5..52aa896 100644
configs->has_adoptable = true;
}
--
2.29.2
2.25.1

View File

@@ -0,0 +1,28 @@
From 02318d958b630413efe73d0454a277f1b9d8e020 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Wed, 24 Nov 2021 15:50:30 -0500
Subject: [PATCH 6/7] Log support for exfat/texfat FS driver names
Change-Id: I5ae38741374b25b84595a9eae9bdda7afe2cac05
---
main.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/main.cpp b/main.cpp
index 52aa896d..86e0aa52 100644
--- a/main.cpp
+++ b/main.cpp
@@ -69,7 +69,9 @@ int main(int argc, char** argv) {
LOG(DEBUG) << "Detected support for:"
<< (android::vold::IsFilesystemSupported("ext4") ? " ext4" : "")
<< (android::vold::IsFilesystemSupported("f2fs") ? " f2fs" : "")
- << (android::vold::IsFilesystemSupported("vfat") ? " vfat" : "");
+ << (android::vold::IsFilesystemSupported("vfat") ? " vfat" : "")
+ << (android::vold::IsFilesystemSupported("exfat") ? " exfat" : "")
+ << (android::vold::IsFilesystemSupported("texfat") ? " texfat" : "");
VolumeManager* vm;
NetlinkManager* nm;
--
2.25.1

View File

@@ -0,0 +1,25 @@
From 9612422f1e17dffdf5ed00c4c3abd1c2f3a17656 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 29 Nov 2021 17:49:13 -0500
Subject: [PATCH 7/7] Don't unmount rw-system.sh binds
Change-Id: If9132c21defa8b09879b79a70794c5275d6852d0
---
VolumeManager.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index 2697f672..d592c7f5 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -957,6 +957,7 @@ int VolumeManager::unmountAll() {
while ((mentry = getmntent(fp)) != NULL) {
auto test = std::string(mentry->mnt_dir);
if ((StartsWith(test, "/mnt/") &&
+ !StartsWith(test, "/mnt/phh") &&
#ifdef __ANDROID_DEBUGGABLE__
!StartsWith(test, "/mnt/scratch") &&
#endif
--
2.25.1