summaryrefslogtreecommitdiffstats
path: root/adb
diff options
context:
space:
mode:
authorPaul Lawrence <paullawrence@google.com>2014-10-28 00:25:30 +0000
committerandroid-build-merger <android-build-merger@google.com>2014-10-28 00:25:30 +0000
commit6331781a7507c4c3f86c37781cc715baaaa9814c (patch)
tree1d4ee3a2fcb1c5855cfbeb48699487548a735c6d /adb
parent343e66d6e04093e805c3b9d683dc5a73d9a64696 (diff)
parent3dbcc8b9332cdbaa0dae47a6cae3a043f96262fe (diff)
downloadsystem_core-6331781a7507c4c3f86c37781cc715baaaa9814c.zip
system_core-6331781a7507c4c3f86c37781cc715baaaa9814c.tar.gz
system_core-6331781a7507c4c3f86c37781cc715baaaa9814c.tar.bz2
Merge "adb warns on remount when verity is enabled" into lmp-mr1-dev
automerge: 3dbcc8b * commit '3dbcc8b9332cdbaa0dae47a6cae3a043f96262fe': adb warns on remount when verity is enabled
Diffstat (limited to 'adb')
-rw-r--r--adb/remount_service.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/adb/remount_service.c b/adb/remount_service.c
index 72d15a1..36367a7 100644
--- a/adb/remount_service.c
+++ b/adb/remount_service.c
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#include "sysdeps.h"
+
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
@@ -22,7 +24,7 @@
#include <sys/mount.h>
#include <unistd.h>
-#include "sysdeps.h"
+#include "cutils/properties.h"
#define TRACE_TAG TRACE_ADB
#include "adb.h"
@@ -115,6 +117,36 @@ static void write_string(int fd, const char* str)
void remount_service(int fd, void *cookie)
{
char buffer[200];
+ char prop_buf[PROPERTY_VALUE_MAX];
+
+ bool system_verified = false, vendor_verified = false;
+ property_get("partition.system.verified", prop_buf, "0");
+ if (!strcmp(prop_buf, "1")) {
+ system_verified = true;
+ }
+
+ property_get("partition.vendor.verified", prop_buf, "0");
+ if (!strcmp(prop_buf, "1")) {
+ vendor_verified = true;
+ }
+
+ if (system_verified || vendor_verified) {
+ // Allow remount but warn of likely bad effects
+ bool both = system_verified && vendor_verified;
+ snprintf(buffer, sizeof(buffer),
+ "dm_verity is enabled on the %s%s%s partition%s.\n",
+ system_verified ? "system" : "",
+ both ? " and " : "",
+ vendor_verified ? "vendor" : "",
+ both ? "s" : "");
+ write_string(fd, buffer);
+ snprintf(buffer, sizeof(buffer),
+ "Use \"adb disable-verity\" to disable verity.\n"
+ "If you do not, remount may succeed, however, you will still "
+ "not be able to write to these volumes.\n");
+ write_string(fd, buffer);
+ }
+
if (remount("/system", &system_ro)) {
snprintf(buffer, sizeof(buffer), "remount of system failed: %s\n",strerror(errno));
write_string(fd, buffer);