Skip to content

omamobile-fingerprint 0.1.10: map Trusty's tamper-detect stores as block devices - #101

Merged
derekross merged 8 commits into
derekross:mainfrom
W4HO-ham:tegu-fp-td-tdp
Oct 28, 2026
Merged

derekross merged 8 commits into
derekross:mainfrom
W4HO-ham:tegu-fp-td-tdp

Conversation

@W4HO-ham

Copy link
Copy Markdown
Contributor

Stock storageproxyd maps Trusty's TD and TDP stores to trusty_userdata and trusty_persist, and takes its size limit (-m) from the TD block device. On the palmtop without that mapping every TA write failed with "transaction would leave fs too full".

When $STATE/td.img or $STATE/tdp.img exists, the runner now loop-mounts it into the chroot as /dev/block/ss-td or ss-tdp, passes -f 0:… -m … and -f persist/0:… as stock does, and creates the store links (ss/0, persist/0) before storageproxyd starts. Without them storageproxyd answers "pending symlink" and Trusty reads the store as empty. With no images nothing changes, so cheetah is unaffected.

Tested on the palmtop: omamobile-fp-chroot start storage reports secure storage ready with both stores mapped (128 MiB max file size from the TD device). tools/pr-check and test/all pass.

Enrollment still waits on the 9a's factory calibration (FINGERPRINT-PLAN F6c); this is the storage half.

…ock devices

Stock storageproxyd maps Trusty's TD and TDP stores to trusty_userdata and trusty_persist and takes its size limit from the TD block device. On the 9a without that mapping every TA write failed with "transaction would leave fs too full". When $STATE/td.img or tdp.img exists, the runner now loop-mounts it into the chroot, passes -f and -m as stock does, and creates the store links first, since without them storageproxyd answers "pending symlink" and Trusty sees an empty store. Without the images nothing changes. Tested on the palmtop: secure storage ready with both stores mapped.
…or the HAL

The runner gave every phone the Pixel 7 Pro's panel name. The 9a's is google-tg4c, the bootloader's name for its panel, which is what Google's driver reports; OMAMOBILE_FP_PANEL_NAME overrides it. The HAL also reads the panel's id from the backlight's device (serial_number): when the panel driver exposes one, the runner now passes it into the chroot.
@W4HO-ham

Copy link
Copy Markdown
Contributor Author

Added a second commit: the 9a's panel name (google-tg4c instead of the Pixel 7 Pro's, overridable with OMAMOBILE_FP_PANEL_NAME) and the panel id passed through as serial_number when the panel driver exposes it. The HAL reads that id, and it looks like the key for the 9a's factory calibration. This commit hasn't run on the palmtop yet (it's waiting for a hand restart); I'll post the result before you merge.

…atomically

The watchdog's jump test changes a control from a background job while the watchdog reads the fake mixer's state file, and CI once caught the read halfway through the write (JSONDecodeError, the test failed). Both fakes now write a temporary file and rename it over the state.
…aps only with their images

The runner's static checks now cover what this pull request added: each phone has its own panel name and the override exists, and storageproxyd maps TD and TDP only when their images are there.
The flake had a second writer: JsonCtl, the json: control backend the tests run the speaker code against, rewrites the fake mixer's state on every heartbeat read, in place. The fake mixer reading at that moment saw an empty file. JsonCtl now writes a temporary file and renames it, as the fakes do. Nothing changes on the palmtop: JsonCtl is used only with OMAMOBILE_CTL_BACKEND=json:.
…s first reading

The jump tests changed the estimate 0.4 s after starting the watchdog. On a slow CI runner the watchdog wasn't reading yet, took the raised value as its baseline, saw no jump and didn't mute. The jump now waits for the watchdog's start line and a few intervals, and the watchdog runs 60 iterations.
@derekross

Copy link
Copy Markdown
Owner

Thanks, @W4HO-ham. Mapping the stores as block devices so storageproxyd gets its -m limit, and creating the links before it starts, is careful work, and it's good that it keeps everything inside userdata: loop devices of Linux-owned images, no real partition, no change to the storage guard. With no images present, the 7 Pro's command line and chroot are unchanged.

Before it merges, I need three things:

  1. Record F4 and the D1 decision in FINGERPRINT-PLAN, in this PR. "Secure storage ready with both stores mapped" means storageproxyd has run against the RPMB, which is the plan's F4, the step its own rules keep as "recorded here with the date" because it can't be undone. At this head the plan still says "F3-F5 and F6c wait for D1" and "Decision: not taken yet". Please add which D1 option you took (this looks like option A with the images as block devices, which is fine), who gave the go and when, the backup check before it, uname -r and the result. Please also add a runbook step for making td.img and tdp.img: their size, what's in them (empty, or a read-only copy of trusty_persist), and that they're never committed. Nothing in the package creates them today.
  2. Don't let ln -sfn delete an existing store. setup_data links over $STATE/data/vendor/ss/0 and $STATE/persist-ss/0, and if either is a regular file, -f removes it. On the 7 Pro, persist-ss/0 is the copy of stock's tamper-detect-persistent store that tools/phone-provision restores from the backup, and the working fingerprint depends on it. On the 9a, a 0 from an earlier unmapped run would go the same way. It only happens when an image exists, but losing Trusty's state should never be a side effect. Please stop with a clear message when the path exists and isn't already that link (or move it aside with a timestamp and log it), and turn the mapping on only for the 9a: a flag in the tegu) case, so a 7 Pro state directory can never take this path.
  3. The second commit: please post the run first, or split it out. You offered to post the result before merge, thank you. Two questions to answer with it. No panel driver in our kernel or the open kernel PRs exposes serial_number yet, so sn is always empty today: which kernel change will provide it? And which path does the 9a's HAL actually open? Our notes on the 7 Pro's HAL read the panel serial from primary-panel/serial_number, but this writes class/backlight/panel0-backlight/device/serial_number, and in the fake sysfs those are separate directories.

The panel-name part of that commit is fine: the 7 Pro gets the same sdc-s6e3hc4 it always had.

…er a store, and record F4 and D1

Review of the store mapping: it now runs only on the 9a (MAP_STORES in the tegu case), so a Pixel 7 Pro state directory can never take this path, and a store already at ss/0 or persist-ss/0 is moved aside with a timestamp instead of being removed by a forced link. FINGERPRINT-PLAN records D1 = A with the stores as block devices (the owner's call on 2026-10-27), F3 and F4 with their results, and a step for making td.img and tdp.img. The panel id passthrough is dropped from this pull request until a kernel change provides serial_number.
@W4HO-ham

Copy link
Copy Markdown
Contributor Author

Thanks, all three handled in 27c2aac.

  1. FINGERPRINT-PLAN now records D1 = A, with the stores as block devices. The owner (me) took it at the console on 2026-10-27: I never run stock Android, so nothing is written outside userdata. It also records F3 (the reads matched the 10-27 backup's sha256, which was the backup check before F4), F4 ("secure storage ready", no RPMB errors, on 7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty) and the later results. There's a new step, F4b, for making td.img (an empty 128 MiB file) and tdp.img (the F3 copy of trusty_persist), with a rollback and the rule that they're never committed or copied off the phone.
  2. No forced link over a store. ln -sfn is gone. link_store leaves a correct link alone. Anything else at ss/0 or persist-ss/0 is moved aside with a timestamp and logged, never removed (I checked both cases in a sandbox). The mapping is on only in the tegu) case (MAP_STORES=1; the 7 Pro's is 0), and that gates the loop devices, the links and the storageproxyd arguments. A 7 Pro state directory can't take this path even with images present. The tests check both flags and that no forced link is left.
  3. Panel id: split out. The passthrough is gone from this PR, and the panel-name part stays. Your two questions: no kernel change provides serial_number yet (a variant of the tg4c panel driver that reads the DDIC id ran on the palmtop this morning, but the read didn't return an id). The 9a's HAL opens /sys/class/backlight/panel0-backlight/device/serial_number (that path is in the 9a's libgf_hal.so, not the 7 Pro's primary-panel one). It turned out not to be the calibration key anyway: fastboot oem udfps get-cal-url names the file directly, and I fetched it this morning. So the passthrough comes back only if the HAL needs it for something else.

I'll post the storage stage's run of this head from the palmtop here next.

@W4HO-ham

Copy link
Copy Markdown
Contributor Author

Run of this head (27c2aac's runner) on the palmtop, 7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty: omamobile-fp-chroot start storage gives "secure storage ready", with storageproxyd taking its limit from the TD device ("Using 0x8000000 as max file size"). The two store links were already the right ones (ss/0 -> /dev/block/ss-td, persist-ss/0 -> /dev/block/ss-tdp), so link_store left them as they were and moved nothing aside.

@W4HO-ham W4HO-ham mentioned this pull request Oct 28, 2026
10 of 14 tasks
@derekross

Copy link
Copy Markdown
Owner

Thanks, @W4HO-ham, this is what I hoped for. D1 and F4 are on record with the backup check and the release, and F4b says what the images are and that they never leave the phone. link_store is careful: I ran it in a scratch directory against a regular file, the right link, a wrong link and an empty path, and it moved the first and third aside, left the second alone and linked the fourth. With MAP_STORES set only for the 9a, the 7 Pro's state directory can't reach any of it. Splitting the panel id out was the right call too.

Two lines in the plan before it merges, and a small third:

  1. F4b's rollback leaves the links behind. Stopping the runner, detaching the loops and deleting the images leaves ss/0 and persist-ss/0 pointing at /dev/block/ss-td and ss-tdp. The next run without images passes no -f or -m and puts no device there, so storageproxyd finds links to nothing: the "pending symlink" case from your 10-27 night entry, where Trusty sees an empty store. Please make the rollback remove both links and move any *.before-map.* file back.
  2. oem udfps update-cal writes mfg_data. The 10-28 entry offers it as one way to load the calibration ("or let ABL's update-cal write mfg_data"). That partition is outside slot B and userdata, so it isn't a step anyone can take without my explicit go and a named exception. Your last line already picks the Linux route, thank you. Please add a line to the plan's safety rules saying update-cal (or any oem command that writes) doesn't run without that, and that any fastboot oem step in a runbook pins the serial with -s.
  3. F4b copies persist-ss/0 into tdp.img, but after the first mapped run persist-ss/0 is the link, and the F3 copy has become persist-ss/0.before-map.<time>. Please name the F3 copy's own path there, or say "before the first mapped run".

@W4HO-ham

Copy link
Copy Markdown
Contributor Author

All three are in FINGERPRINT-PLAN:

  1. F4b's rollback now also removes both links (data/vendor/ss/0, persist-ss/0) and moves any *.before-map.* file back, so an unmapped run doesn't find links to nothing.
  2. Section 5 has the rule: oem udfps update-cal, or any oem command that writes, needs your explicit go and a named exception (it writes mfg_data), and every fastboot oem step pins the serial with -s. The 10-28 entry no longer offers update-cal as an option.
  3. F4b names the F3 copy's path: persist-ss/0 before the first mapped run, persist-ss/0.before-map.<time> after it.

@derekross

Copy link
Copy Markdown
Owner

Thanks, @W4HO-ham. All three points from my last comment are in 932ff8f:

  1. F4b's rollback now removes both links and moves any *.before-map.* file back, so a run without images doesn't find links that point nowhere.
  2. Section 5 has the rule for oem udfps update-cal and any other oem command that writes: it needs my explicit go and a named exception, and every fastboot oem step pins the serial with -s. The 10-28 entry no longer offers update-cal as an option.
  3. F4b names the F3 copy's path both before and after the first mapped run.

The newest commit only touches the plan, so the runner you ran on the palmtop at 16:04 is the runner at this head. I checked these again:

  • On the Pixel 7 Pro, MAP_STORES=0 gives the same storageproxyd command line as main (-d … -r … -p … -t ufs, nothing added), and no loop device or store link is ever created. The panel name stays sdc-s6e3hc4, and the bridge command is unchanged.
  • Nothing here touches the storage guard. The stores are loop devices of image files in /var/lib/omamobile-fp on userdata, and trusty_userdata and trusty_persist themselves never enter the chroot. omamobile-fp.service is unchanged and still ships disabled.
  • On today's main it merges cleanly, and its audio commits are already there from omamobile-audio 0.5.5: the tests' state files are written atomically #107, so the squash brings only the fingerprint package and the plan. It also merges cleanly with omamobile-fingerprint: the prebuilt bridge must know the runner's options #129, the new prebuilt-bridge check. You add no bridge options, and the combined test passes with a current bridge.
  • tools/pr-check and the package test pass, with and without the prebuilts, and CI is green.

One small question, which doesn't hold up the merge: the 10-27 "night, later" entry says the live runner's td.img is "now the stock copy" of trusty_userdata, while F4b makes td.img an empty 128 MiB file and an earlier line says you went back to that. Which one does the palmtop run now? If it's the stock copy, a line in F4b saying so would let the next person reproduce your setup. It can come with the F6c results.

I'll squash-merge this as "omamobile-fingerprint 0.1.10: map Trusty's tamper-detect stores as block devices". In the squash body I'll mention the 9a's panel name and leave out the audio commits and the panel-id commit you dropped. Thanks for the careful work and the quick turnarounds.

derekross added a commit that referenced this pull request Oct 28, 2026
L-279 to L-293: the 9a's slot B hold and what made devinfo writable
(#125), per-device flags checked by building both command lines
(#101), env defaults in the shared build library and CI waiting for
approval (#79), GLib retry paths and radio stops checked at the
controller (#99), silent re-pushes and stacks with several tops (the
tegu stack), and two of our own: merge only after every check has
finished (#126), and an empty diff is checked for empty inputs
(kernel #123).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
derekross added a commit that referenced this pull request Oct 28, 2026
…wenty-sixth rounds (#127)

* docs/review: 19 lessons and 3 corrections from the twenty-fifth round

The confirmed candidates from round 25 (L-260 to L-278): the 9a slot B
marking as a devinfo question, cross-repository links, squash-merged
stacks and version files, stale hand-built prebuilts, and before-merge
Pixel 7 Pro runs on omamobile-int. C-16 to C-18 correct our own earlier
comments on kernel #98, kernel #80 and #74; L-241 is corrected in place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs/review: 15 lessons from the twenty-sixth round

L-279 to L-293: the 9a's slot B hold and what made devinfo writable
(#125), per-device flags checked by building both command lines
(#101), env defaults in the shared build library and CI waiting for
approval (#79), GLib retry paths and radio stops checked at the
controller (#99), silent re-pushes and stacks with several tops (the
tegu stack), and two of our own: merge only after every check has
finished (#126), and an empty diff is checked for empty inputs
(kernel #123).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@derekross
derekross merged commit e188efa into derekross:main Oct 28, 2026
2 checks passed
@W4HO-ham

Copy link
Copy Markdown
Contributor Author

Thanks for merging. To your question: right now the palmtop runs the F4b setup, td.img an empty 128 MiB file and tdp.img the F3 copy of trusty_persist. The root was restored today, and I recreated both by F4b. The "now the stock copy" line describes the setup before the restore. I'll put that in F4b with the F6c results. Also from today: the HAL takes the factory calibration from offset 0 of /dev/block/by-name/mfg_data (injectMtCali, a 112-byte header), and the file get-cal-url names has exactly that header. With it written into the chroot's private mfg_data.img copy, the HAL accepts it (vendor.gf.cali.state = 1). The real mfg_data is untouched. Enrollment is next.

derekross added a commit that referenced this pull request Oct 29, 2026
The matrix after the merges since #118, with each cell going by the
merged notes:

- Pixel 7 (panther): the board file (derekross/linux-omarchy-mobile#108) and the
  FT3658 touch driver (derekross/linux-omarchy-mobile#109) have merged
  into the published kernel, so Boot, Storage, Buttons and USB net say
  "in the published kernel" instead of "in review". Touch stays "no":
  the driver and the touch rails are published, but the board file has
  no touch node, and panther's notes end at boot 8 with the controller
  not answering. BRINGUP-M1's status and NOTES' header say the same.
- Pixel 6 Pro (raven), Charging: no -> works. device-raven 0.1.26 (#112,
  #126) loads the MAX77759 charger at boot with its temperature guard;
  USB-PLAN section 4 records C0-C5 passed on 2026-10-28, a full charge to
  100 % included. The battery node is derekross/linux-omarchy-mobile#112;
  the runs were on an unpublished integration kernel, and the cell says so.
- raven, Torch: still works; the LED's node is now in the published
  kernel (derekross/linux-omarchy-mobile#113), tested on
  omamobile-gs101-torch and not yet run from the published kernel.
- Pixel 9a (tegu), Fingerprint: no -> WIP. FINGERPRINT-PLAN records F0
  and F2-F6b passed on an unpublished kernel: Trusty's TA runs and the HAL
  sees the sensor; enrollment waits for the factory calibration (F6c).
  omamobile-fingerprint 0.1.10 (#101) maps Trusty's stores for it.

Left as they were: tegu's Charging (the MAX77779 charger driver,
derekross/linux-omarchy-mobile#92, is published, but tegu's notes record
no run of it), the gs201 HSI2 pin controller
(derekross/linux-omarchy-mobile#123, no cell), felix (#35 is a plan) and
cheetah (nothing merged for it).

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants