summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@chromium.org>2019-03-13 19:33:27 -0400
committerMike Frysinger <vapier@chromium.org>2019-03-13 23:36:14 +0000
commit98b9928b6aa2da5622cd84c5565a9debbf12be35 (patch)
treefa0f100e12cf2c1227b35ed04fedabb2bf75cab7
parent58c626a47675f1c8b2d85c3cc93b0b8473b9d683 (diff)
downloadvboot-98b9928b6aa2da5622cd84c5565a9debbf12be35.tar.gz
image_signing: avoid using mount -o rw,remount
The comments said remount was avoided due to loop offset usage which, while true, isn't the only reason. We can't remount rw without first calling enable_rw_mount to clear the invalid bits in the fs header. Update the comment to reflect that and switch to our mount helper as it will call that for us. BUG=chromium:938958 TEST=precq passes & signing unittests pass BRANCH=None Change-Id: I1063bc84befebddc942a3dec05e8f33ea834db30 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1522089 Reviewed-by: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
-rwxr-xr-xscripts/image_signing/set_chronos_password.sh9
-rwxr-xr-xscripts/image_signing/tag_image.sh6
2 files changed, 9 insertions, 6 deletions
diff --git a/scripts/image_signing/set_chronos_password.sh b/scripts/image_signing/set_chronos_password.sh
index 751f02b3..0b8bce80 100755
--- a/scripts/image_signing/set_chronos_password.sh
+++ b/scripts/image_signing/set_chronos_password.sh
@@ -42,11 +42,12 @@ main() {
echo "Password is already set [use --force if you'd like to update it]"
exit 1
fi
- # Prepare for remounting read/write.
- sudo mount -o remount,rw "${rootfs}"
- else
- mount_loop_image_partition "${loopdev}" 3 "${rootfs}"
+ # Prepare for remounting read/write. We can't use `mount -o rw,remount`
+ # because of the bits in the ext4 header we've set to block that. See
+ # enable_rw_mount for details.
+ sudo umount "${rootfs}"
fi
+ mount_loop_image_partition "${loopdev}" 3 "${rootfs}"
change_chronos_password "$rootfs" "$chronos_password"
touch "$image" # Updates the image modification time.
echo "Password Set."
diff --git a/scripts/image_signing/tag_image.sh b/scripts/image_signing/tag_image.sh
index 53afe788..b130fa19 100755
--- a/scripts/image_signing/tag_image.sh
+++ b/scripts/image_signing/tag_image.sh
@@ -206,8 +206,10 @@ process_all_tags "${rootfs}" ${FLAGS_FALSE}
process_all_lsb_mods "${rootfs}" ${FLAGS_FALSE}
if [ ${g_modified} = ${FLAGS_TRUE} ]; then
- # Remount as RW.
- sudo mount -o rw,remount "${rootfs}"
+ # Remount as RW. We can't use `mount -o rw,remount` because of the bits in
+ # the ext4 header we've set to block that. See enable_rw_mount for details.
+ sudo umount "${rootfs}"
+ mount_loop_image_partition "${loopdev}" 3 "${rootfs}"
# second round, apply the modification to image.
process_all_tags "${rootfs}" ${FLAGS_TRUE}