Skip to content

init/luks: extend ctx cancellation to FIDO2-PIN and TPM2-PIN prompts#356

Merged
anatol merged 1 commit into
anatol:masterfrom
pilotstew:pr/extend-ctx-to-pin-prompts
May 6, 2026
Merged

init/luks: extend ctx cancellation to FIDO2-PIN and TPM2-PIN prompts#356
anatol merged 1 commit into
anatol:masterfrom
pilotstew:pr/extend-ctx-to-pin-prompts

Conversation

@pilotstew
Copy link
Copy Markdown
Contributor

What this PR does

Threads ctx context.Context into recoverFido2Password, recoverSystemdFido2Password, and recoverSystemdTPM2Password. The PIN prompts in those functions previously called askPasswordWithFallback(context.Background(), ...) and could not be cancelled when a sibling unlock succeeded. With ctx propagated, every console password prompt — keyboard-passphrase, FIDO2-PIN, TPM2-PIN — now dismisses cleanly when a non-interactive token (TPM2 PCR-only, touchless FIDO2, or clevis) wins the unlock race.

Closes the gap acknowledged in #355: the keyboard-passphrase prompt cancellation that landed there now extends to PIN prompts as well.

Scope

Pure additive — no behavioural change beyond extending the cancellation reach:

Cleanup

Drops three stale comments left in #355 that referenced this upcoming work in internal-planning vocabulary. Reworded to factually describe the current state — most of them were already going to be edited by this PR (the context.Background() placeholders they accompanied are now gone), and one in console_input.go is fixed in passing.

Threads ctx context.Context into recoverFido2Password,
recoverSystemdFido2Password, and recoverSystemdTPM2Password. The
PIN prompts in those functions previously called askPasswordWithFallback
with context.Background() and could not be cancelled when a sibling
unlock succeeded. With ctx propagated, every console password prompt
— keyboard-passphrase, FIDO2-PIN, TPM2-PIN — now dismisses cleanly.

recoverTokenPassword (already ctx-aware after anatol#354) updates its two
systemd-token call sites to pass ctx through. Pure additive — no
behavioural change beyond extending the cancellation reach.

Also drops three stale comments left in anatol#355 that referenced this
upcoming work in internal-planning vocabulary; reworded to factually
describe the current state.
@anatol anatol merged commit 5dc4f69 into anatol:master May 6, 2026
anatol pushed a commit that referenced this pull request May 6, 2026
Two changes that together close out the console UX for booster's
concurrent unlock pipeline:

1. Prompt-aware statusMessage redraw. statusMessage now consults the
   active prompt before printing to console. If a passphrase prompt
   is on screen and its volume hasn't been unlocked yet, the current
   line is erased, the message prints, and the prompt is reprinted
   below — cursor stays at the bottom, asterisk count preserved.
   The new promptVolumeUnlocked helper lets statusMessage skip the
   redraw when the prompt's volume is already unlocked, avoiding
   reprinting a stale prompt that ctx-cancel hasn't yet torn down.
   readPasswordOn now sets consolePrompt.{active,text,done} during
   each prompt — fields declared in #355 that become load-bearing
   only now that statusMessage consumes them.

2. Token-unlock confirmation. recoverTokenPassword fires
   statusMessageTimed("X unlocked via Y", 3s) on success. After
   #355 and #356 cleanly dismiss prompts when a sibling token wins
   the race, the user previously saw nothing telling them what
   happened — boot just continued. This adds the missing
   confirmation. tokenFriendlyName provides the short label per
   token type; statusMessageTimed clears the message after 3s so
   it doesn't linger.
@pilotstew pilotstew deleted the pr/extend-ctx-to-pin-prompts branch May 9, 2026 02:53
pilotstew added a commit to pilotstew/booster that referenced this pull request May 14, 2026
Adds a new NOTES subsection covering the concurrent-unlock model that
landed across PRs anatol#350, anatol#353, anatol#355, anatol#356, anatol#357, anatol#358, and anatol#362:
PIN-token serialization in ascending LUKS2 token-ID order, cancel-on-win
semantics for keyboard/FIDO2-PIN/TPM2-PIN prompts on both the console
and the Plymouth splash (with the MR !393 caveat for older Plymouth
builds), and the per-token 3-attempt PIN cap with empty-PIN skip.

Trims two paragraphs from the existing 'Password entry' subsection
(auto-dismiss and PIN attempts) now that the new section covers them
in fuller context. 'Password entry' keeps the Ctrl+W / Ctrl+U / Tab
edit-key reference.
anatol pushed a commit that referenced this pull request May 14, 2026
Adds a new NOTES subsection covering the concurrent-unlock model that
landed across PRs #350, #353, #355, #356, #357, #358, and #362:
PIN-token serialization in ascending LUKS2 token-ID order, cancel-on-win
semantics for keyboard/FIDO2-PIN/TPM2-PIN prompts on both the console
and the Plymouth splash (with the MR !393 caveat for older Plymouth
builds), and the per-token 3-attempt PIN cap with empty-PIN skip.

Trims two paragraphs from the existing 'Password entry' subsection
(auto-dismiss and PIN attempts) now that the new section covers them
in fuller context. 'Password entry' keeps the Ctrl+W / Ctrl+U / Tab
edit-key reference.
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