init: Remove legacy virtual-ab support

Bug: 304829384
Test: OTA on Pixel
Change-Id: I8463a1cc102379daa41fdade6820222a5e3bdd86
Signed-off-by: Akilesh Kailash <akailash@google.com>
This commit is contained in:
Akilesh Kailash 2024-03-28 09:51:52 -07:00
parent 283482bdd3
commit ec799183c8
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;