Merge "init: Remove legacy virtual-ab support" into main am: cd4b579ef4

Original change: https://android-review.googlesource.com/c/platform/system/core/+/3019245

Change-Id: Ie3721305731fdb82070dc63746ed2045d916f2b6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Akilesh Kailash 2024-03-29 01:35:45 +00:00 committed by Automerger Merge Worker
commit b2270a5ce3
3 changed files with 11 additions and 24 deletions

View file

@ -396,9 +396,10 @@ bool FirstStageMountVBootV2::CreateSnapshotPartitions(SnapshotManager* sm) {
use_snapuserd_ = sm->IsSnapuserdRequired();
if (use_snapuserd_) {
if (sm->UpdateUsesUserSnapshots()) {
LaunchFirstStageSnapuserd(SnapshotDriver::DM_USER);
LaunchFirstStageSnapuserd();
} else {
LaunchFirstStageSnapuserd(SnapshotDriver::DM_SNAPSHOT);
LOG(FATAL) << "legacy virtual-ab is no longer supported";
return false;
}
}

View file

@ -62,7 +62,7 @@ static constexpr char kSnapuserdFirstStageInfoVar[] = "FIRST_STAGE_SNAPUSERD_INF
static constexpr char kSnapuserdLabel[] = "u:object_r:snapuserd_exec:s0";
static constexpr char kSnapuserdSocketLabel[] = "u:object_r:snapuserd_socket:s0";
void LaunchFirstStageSnapuserd(SnapshotDriver driver) {
void LaunchFirstStageSnapuserd() {
SocketDescriptor socket_desc;
socket_desc.name = android::snapshot::kSnapuserdSocket;
socket_desc.type = SOCK_STREAM;
@ -85,22 +85,13 @@ void LaunchFirstStageSnapuserd(SnapshotDriver driver) {
if (pid == 0) {
socket->Publish();
if (driver == SnapshotDriver::DM_USER) {
char arg0[] = "/system/bin/snapuserd";
char arg1[] = "-user_snapshot";
char* const argv[] = {arg0, arg1, nullptr};
if (execv(arg0, argv) < 0) {
PLOG(FATAL) << "Cannot launch snapuserd; execv failed";
}
_exit(127);
} else {
char arg0[] = "/system/bin/snapuserd";
char* const argv[] = {arg0, nullptr};
if (execv(arg0, argv) < 0) {
PLOG(FATAL) << "Cannot launch snapuserd; execv failed";
}
_exit(127);
char arg0[] = "/system/bin/snapuserd";
char arg1[] = "-user_snapshot";
char* const argv[] = {arg0, arg1, nullptr};
if (execv(arg0, argv) < 0) {
PLOG(FATAL) << "Cannot launch snapuserd; execv failed";
}
_exit(127);
}
auto client = SnapuserdClient::Connect(android::snapshot::kSnapuserdSocket, 10s);

View file

@ -29,13 +29,8 @@
namespace android {
namespace init {
enum class SnapshotDriver {
DM_SNAPSHOT,
DM_USER,
};
// Fork and exec a new copy of snapuserd.
void LaunchFirstStageSnapuserd(SnapshotDriver driver);
void LaunchFirstStageSnapuserd();
class SnapuserdSelinuxHelper final {
using SnapshotManager = android::snapshot::SnapshotManager;