From 1446090da9003b23e3bd6c5b1552aafa4af029f2 Mon Sep 17 00:00:00 2001 From: Enginex0 Date: Tue, 19 May 2026 05:35:13 +0100 Subject: [PATCH] fix(spoof): propagate read errors out of mergedContents A read failure (partial-write race during user edit, SELinux denial, or any other IOException) used to fall through the runCatching and rewrite the file with only the global block, silently destroying every existing [pkg] override. Drop the runCatching so the failure bubbles to atomicWrite, where the M3 guard in updateTo logs and returns without applyToProps, leaving both file and props untouched. --- .../java/org/matrix/TEESimulator/config/PatchLevelManager.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/src/main/java/org/matrix/TEESimulator/config/PatchLevelManager.kt b/app/src/main/java/org/matrix/TEESimulator/config/PatchLevelManager.kt index c00bf7c..53c2ec2 100644 --- a/app/src/main/java/org/matrix/TEESimulator/config/PatchLevelManager.kt +++ b/app/src/main/java/org/matrix/TEESimulator/config/PatchLevelManager.kt @@ -146,9 +146,7 @@ object PatchLevelManager { private fun mergedContents(target: File, date: String): String { val globalBlock = "system=$date\nboot=$date\nvendor=$date\n" if (!target.exists()) return globalBlock - val tail = - runCatching { stripGlobalAssignments(target.readLines()) }.getOrNull() - ?: return globalBlock + val tail = stripGlobalAssignments(target.readLines()) if (tail.isEmpty()) return globalBlock return globalBlock + tail.joinToString("\n", prefix = "\n", postfix = "\n") }