diff options
-rw-r--r-- | common/platform_constants.h | 4 | ||||
-rw-r--r-- | common/platform_constants_android.cc | 2 | ||||
-rw-r--r-- | common/platform_constants_chromeos.cc | 1 | ||||
-rw-r--r-- | common/test_utils.cc | 2 | ||||
-rw-r--r-- | common/utils.cc | 5 | ||||
-rw-r--r-- | common/utils.h | 3 | ||||
-rw-r--r-- | payload_consumer/postinstall_runner_action.cc | 4 |
7 files changed, 16 insertions, 5 deletions
diff --git a/common/platform_constants.h b/common/platform_constants.h index d1786ff2..6eaa940e 100644 --- a/common/platform_constants.h +++ b/common/platform_constants.h @@ -50,6 +50,10 @@ extern const char kOmahaResponseDeadlineFile[]; // The stateful directory used by update_engine. extern const char kNonVolatileDirectory[]; +// Options passed to the filesystem when mounting the new partition during +// postinstall. +extern const char kPostinstallMountOptions[]; + } // namespace constants } // namespace chromeos_update_engine diff --git a/common/platform_constants_android.cc b/common/platform_constants_android.cc index 4f55106b..371fe265 100644 --- a/common/platform_constants_android.cc +++ b/common/platform_constants_android.cc @@ -31,6 +31,8 @@ const char kCACertificatesPath[] = "/system/etc/security/cacerts_google"; // No deadline file API support on Android. const char kOmahaResponseDeadlineFile[] = ""; const char kNonVolatileDirectory[] = "/data/misc/update_engine"; +const char kPostinstallMountOptions[] = + "context=u:object_r:postinstall_file:s0"; } // namespace constants } // namespace chromeos_update_engine diff --git a/common/platform_constants_chromeos.cc b/common/platform_constants_chromeos.cc index d8587ca0..7c1d627d 100644 --- a/common/platform_constants_chromeos.cc +++ b/common/platform_constants_chromeos.cc @@ -32,6 +32,7 @@ const char kOmahaResponseDeadlineFile[] = "/tmp/update-check-response-deadline"; // This directory is wiped during powerwash. const char kNonVolatileDirectory[] = "/var/lib/update_engine"; +const char kPostinstallMountOptions[] = nullptr; } // namespace constants } // namespace chromeos_update_engine diff --git a/common/test_utils.cc b/common/test_utils.cc index a574863f..77a91419 100644 --- a/common/test_utils.cc +++ b/common/test_utils.cc @@ -260,7 +260,7 @@ ScopedLoopMounter::ScopedLoopMounter(const string& file_path, string loop_dev; loop_binder_.reset(new ScopedLoopbackDeviceBinder(file_path, &loop_dev)); - EXPECT_TRUE(utils::MountFilesystem(loop_dev, *mnt_path, flags, "")); + EXPECT_TRUE(utils::MountFilesystem(loop_dev, *mnt_path, flags, "", nullptr)); unmounter_.reset(new ScopedFilesystemUnmounter(*mnt_path)); } diff --git a/common/utils.cc b/common/utils.cc index b4956e78..912bc966 100644 --- a/common/utils.cc +++ b/common/utils.cc @@ -614,7 +614,8 @@ bool MakeTempDirectory(const string& base_dirname_template, bool MountFilesystem(const string& device, const string& mountpoint, unsigned long mountflags, // NOLINT(runtime/int) - const string& type) { + const string& type, + const string& fs_mount_options) { vector<const char*> fstypes; if (type.empty()) { fstypes = {"ext2", "ext3", "ext4", "squashfs"}; @@ -623,7 +624,7 @@ bool MountFilesystem(const string& device, } for (const char* fstype : fstypes) { int rc = mount(device.c_str(), mountpoint.c_str(), fstype, mountflags, - nullptr); + fs_mount_options.c_str()); if (rc == 0) return true; diff --git a/common/utils.h b/common/utils.h index 8da0726c..df06ef19 100644 --- a/common/utils.h +++ b/common/utils.h @@ -177,7 +177,8 @@ std::string MakePartitionNameForMount(const std::string& part_name); bool MountFilesystem(const std::string& device, const std::string& mountpoint, unsigned long flags, // NOLINT(runtime/int) - const std::string& type); + const std::string& type, + const std::string& fs_mount_options); bool UnmountFilesystem(const std::string& mountpoint); // Returns the block count and the block byte size of the file system on diff --git a/payload_consumer/postinstall_runner_action.cc b/payload_consumer/postinstall_runner_action.cc index fe468cc6..d57ef4e8 100644 --- a/payload_consumer/postinstall_runner_action.cc +++ b/payload_consumer/postinstall_runner_action.cc @@ -27,6 +27,7 @@ #include "update_engine/common/action_processor.h" #include "update_engine/common/boot_control_interface.h" +#include "update_engine/common/platform_constants.h" #include "update_engine/common/subprocess.h" #include "update_engine/common/utils.h" @@ -99,7 +100,8 @@ void PostinstallRunnerAction::PerformPartitionPostinstall() { if (!utils::MountFilesystem(mountable_device, fs_mount_dir_, MS_RDONLY, - partition.filesystem_type)) { + partition.filesystem_type, + constants::kPostinstallMountOptions)) { return CompletePartitionPostinstall( 1, "Error mounting the device " + mountable_device); } |