Snap for 12397640 from 9d439d17701f02dd084f81717384253b91a64665 to 24Q4-release

Change-Id: I8c67f3dfffbc30a290c5f124d5acd656fc0ff772
diff --git a/fs_mgr/libfs_avb/tests/avb_util_test.cpp b/fs_mgr/libfs_avb/tests/avb_util_test.cpp
index 5dc26ac..85eeeb0 100644
--- a/fs_mgr/libfs_avb/tests/avb_util_test.cpp
+++ b/fs_mgr/libfs_avb/tests/avb_util_test.cpp
@@ -16,10 +16,11 @@
 
 #include <endian.h>
 
+#include <random>
+
 #include <android-base/strings.h>
 #include <android-base/unique_fd.h>
 #include <base/files/file_util.h>
-#include <base/rand_util.h>
 #include <libavb/libavb.h>
 
 #include "avb_util.h"
@@ -727,7 +728,10 @@
 
     // Introduces a new modification.
     if (length > 0) {
-        int modify_location = base::RandInt(offset, offset + length - 1);
+        // mersenne_twister_engine seeded with the default seed source.
+        static std::mt19937 gen(std::random_device{}());
+        std::uniform_int_distribution<> rand_distribution(offset, offset + length - 1);
+        int modify_location = rand_distribution(gen);
         file_content[modify_location] ^= 0x80;
         last_file_path = file_path.value();
         last_modified_location = modify_location;
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 63e3d06..4b3ad82 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -495,6 +495,14 @@
     start hwservicemanager
     start vndservicemanager
 
+    # Mount /mnt/vm ASAP to allow early VMs to run.
+    mkdir /mnt/vm 0755 root root
+    mount tmpfs tmpfs /mnt/vm nosuid nodev noexec rw
+    restorecon /mnt/vm
+    chown system system /mnt/vm
+    chmod 0770 /mnt/vm
+    mkdir /mnt/vm/early 0770 system system
+
 # Run boringssl self test for each ABI.  Any failures trigger reboot to firmware.
 import /system/etc/init/hw/init.boringssl.${ro.zygote}.rc
 
@@ -661,14 +669,6 @@
     chmod 0755 /sys/kernel/tracing
     chmod 0755 /sys/kernel/debug/tracing
 
-    # Early HALs may use early VM. Mount /mnt/vm before starting such HALs.
-    mkdir /mnt/vm 0755 root root
-    mount tmpfs tmpfs /mnt/vm nosuid nodev noexec rw
-    restorecon /mnt/vm
-    chown system system /mnt/vm
-    chmod 0770 /mnt/vm
-    mkdir /mnt/vm/early 0770 system system
-
     # HALs required before storage encryption can get unlocked (FBE)
     class_start early_hal