Skip to content

initramfs: mark whole UFS disks read-only without an allowlist - #919

Open
quatrixone wants to merge 1 commit into
derekross:mainfrom
quatrixone:ufs-closed-disk-ro
Open

quatrixone wants to merge 1 commit into
derekross:mainfrom
quatrixone:ufs-closed-disk-ro

Conversation

@quatrixone

Copy link
Copy Markdown
Contributor

Summary

Make the initramfs mark every UFS whole disk read-only when its writable-partition allowlist is empty or rejected. The old guard removed /dev/sda but left the disk's ro flag at 0, so a RAM rescue boot did not meet its own read-only claim. The hand-over check now reports a disk reopened in that mode. Descriptors with a nonempty allowlist keep the existing Pixel behavior.

Checks

  • tests/storage-guard passes, including both Pixel slot layouts and missing, empty and malformed allowlists. The closed cases now require whole disks to report ro=1 and check that a reopened sda is detected.
  • tools/pr-check origin/main passes.
  • On Xiaomi Mi 8 (dipper), a RAM-only image built with this exact initramfs/init (SHA-256 06a8cc368ce86ae6ba570208d0291c642f143019283dd0a88d99ef2365d746b3) reached the rescue initramfs on kernel 7.3.0-rc6-omamobile-push1. All six UFS disks and all 85 partitions reported ro=1. The RAM-only reboot-to bootloader returned to fastboot; nothing was flashed.

This is independent of the Dipper package in #714 and the descriptor-aware smoke check in #916.

The guard removed the sda device node while leaving its whole-disk
read-only flag at 0 when UFS_RW was empty. A RAM rescue boot must leave
the whole disk read-only, and the hand-over check must detect a reopened
disk. Keep the existing Pixel path when an allowlist is present.

On Dipper, a RAM-only rescue image built with this init reported ro=1
for all six UFS disks and 85 partitions; root remained initramfs and
reboot-to returned to fastboot.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant