From 1220d17108cb3b4af9c0fb440a9f9e8f5a9fe2a9 Mon Sep 17 00:00:00 2001 From: Nick Kralevich Date: Thu, 22 Aug 2024 13:56:36 -0700 Subject: [PATCH] init.rc: Fix entropy pool initialization Init is responsible for initializing the /dev/[u]random entropy pool, to ensure that high quality random numbers are available to all Android processes. Previously Android mixed in data from /system/etc/prop.default, which included properties which differed on a device-by-device basis. That file no longer exists, and init generates the following error at boot: init: Command 'copy /system/etc/prop.default /dev/urandom' action=init (/system/etc/init/hw/init.rc:106) took 0ms and failed: Could not read input file '/system/etc/prop.default': open() failed: No such file or directory Instead of reading a property file, this change modifies init.rc to read from /proc/bootconfig. The bootconfig file contains per-device data which was previously on the command line, such as androidboot.serialno. Additionally, it contains device-class information such as androidboot.hardware, androidboot.hardware.platform, and data which frequently churns such as androidboot.vbmeta.digest. These help ensure that the random number initialization is at least unique on a per device-class basis. Relying on /proc/bootconfig accomplishes the same goal that relying on /system/etc/prop.default was intended to accomplish. And /proc/bootconfig is in a more stable location than /system/etc/prop.default, hopefully preventing future regressions. Bug: 361624398 Test: Device boots and error above goes away Change-Id: Id5c891e871217d62ff6517c5804b4acc2d723622 --- rootdir/init.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rootdir/init.rc b/rootdir/init.rc index 7b2b96a7d..63e3d0646 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -103,7 +103,7 @@ on init # Mix device-specific information into the entropy pool copy /proc/cmdline /dev/urandom - copy /system/etc/prop.default /dev/urandom + copy /proc/bootconfig /dev/urandom symlink /proc/self/fd/0 /dev/stdin symlink /proc/self/fd/1 /dev/stdout