Persist the RKP-only knobs so a toggle survives a reboot - #270
Open
JingMatrix wants to merge 1 commit into
Open
Conversation
The two remote_provisioning.*.rkp_only properties gate whether keystore2 provisions attestation keys only through RKP or may fall back to a batch key; turning them off is what restores Strong Integrity on a device that ships them on. They are plain system properties, not persist.*, so a live resetprop is gone on the next boot -- and a vendor .prop that init re-applies each boot can even reassert the on default (#236). The WebUI toggle therefore reverted on every reboot, and integrity had to be won back by toggling again (#244). The chosen values are now kept in /data/adb/teesim/rkp.json and re-forced onto their properties at daemon start, in applyRkpProps, right after the verified-boot props -- overwriting only on a live-vs-stored mismatch, so a steady state does no work. enable_rkpd is persist.device_config and already survives, so re-forcing it is a no-op. Only the three known knob names are ever loaded or forced, so a stale or hand-edited rkp.json can never steer resetprop at an arbitrary property. The toggle itself moved into the daemon. It used to shell out resetprop and write rkp.json from the WebUI, two out-of-process steps the daemon re-read on an unrelated schedule; a re-push landing between them could read the old file and force the old value back, undoing the toggle the user just made. A new POST /rkp sets the property live and persists the choice as one step under the same lock as the boot re-force (resolveAndPush), so the two can no longer interleave and every write to rkp.json serializes through the daemon. The live set now goes through the same resetprop -n path as the boot re-force; keystore2 reads the knob on demand when it provisions, so the value still takes effect without a property retrigger.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The two
remote_provisioning.*.rkp_onlyproperties gate whether keystore2 provisions attestation keys only through RKP or may fall back to a batch key; turning them off is what restores Strong Integrity on a device that ships them on. They are plain system properties, notpersist.*, so a liveresetpropis gone on the next boot — and a vendor.propthat init re-applies each boot can even reassert theondefault (#236). The WebUI toggle therefore reverted on every reboot, and integrity had to be won back by toggling again.The chosen values are now kept in
/data/adb/teesim/rkp.jsonand re-forced onto their properties at daemon start, inapplyRkpProps, right after the verified-boot props — overwriting only on a live-vs-stored mismatch, so a steady state does no work.enable_rkpdispersist.device_configand already survives, so re-forcing it is a no-op. Only the three known knob names are ever loaded or forced, so a stale or hand-editedrkp.jsoncan never steerresetpropat an arbitrary property.The toggle itself moved into the daemon. It used to shell out
resetpropand writerkp.jsonfrom the WebUI, two out-of-process steps the daemon re-read on an unrelated schedule; a re-push landing between them could read the old file and force the old value back, undoing the toggle the user just made. A newPOST /rkpsets the property live and persists the choice as one step under the same lock as the boot re-force (resolveAndPush), so the two can no longer interleave and every write torkp.jsonserializes through the daemon. The live set now goes through the sameresetprop -npath as the boot re-force; keystore2 reads the knob on demand when it provisions, so the value still takes effect without a property retrigger.Closes #244.