Ship pstore contents off the board on boot #21
Labels
No labels
blocked-physical
cleanup
hardware
infra
kernel
P1-critical
P2-high
P3-normal
P4-later
reliability
security
upstream
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
tiagoagueda/a80#21
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
ramoopsis proven to survive a reset, andsystemd-pstorearchives records into/var/lib/systemd/pstore/. But they stay on the board, and the ring is small — a second crashoverwrites the evidence from the first.
Note the gotcha:
/sys/fs/pstorelooks empty after boot precisely because systemd has movedthe records; look in
/var/lib/systemd/pstore/.Done when
Done — records leave the board on boot, over a key that can do one thing
draco-pstore-shipruns at boot, aftersystemd-pstorehas moved records out of/sys/fs/pstore, and copies the archive to the build host. Verified on a real boot rather than by hand:The archive now holds three timestamped deliveries, so "compare two failures" is comparing two directories.
The transport decision
The board is the less trusted device here: it runs experimental kernels, it is the thing that crashes, and it is the thing most likely to be in a bad state. Giving it a general-purpose SSH key to the build host to solve a logging problem would be the wrong trade.
So the
authorized_keysentry carriesrestrictplus a forced command — no pty, no forwarding, no agent, and nothing but the receiver. Verified by attacking it rather than assuming:Records are never deleted locally — having them in two places is the point — and a checksum of names, sizes and mtimes means a board that reboots often does not fill the archive with identical copies.
Three bugs the testing found, all mine
The receiver silently failed every shipment. It passed
--no-absolute-names, which GNU tar does not have, and sent tar's stderr to/dev/null. So the flag error was invisible and every delivery reported "tar failed" with no way to see why. Same shape as the|| truemistake earlier today: hiding a diagnostic to keep output tidy costs more than it saves. The flag is gone — tar's default already strips leading slashes and refuses..— and stderr is no longer discarded.A path traversal, in the one place that explicitly handles untrusted input. The label taken from
SSH_ORIGINAL_COMMANDwent through a character blocklist that allowed dots, so a client sending".."would have produced$DEST/../$STAMPand written outside the archive entirely. Filtering a blocklist and hoping is the wrong shape; it now matches a whitelist pattern and rejects everything else. Attempting".."lands inpstore/unknown/.The build host's login banner was being logged line by line as though it were output from the shipment.
ssh -q.A note for whoever reads this next
The gotcha recorded in the issue is worth repeating because it is genuinely easy to get wrong:
/sys/fs/pstorelooks empty after boot precisely because systemd has already moved the records. Looking there and concluding nothing was captured is the mistake./var/lib/systemd/pstore/is where they are, and now alsoa80/pstore/<host>/<timestamp>/on the build host.Committed in
d49cb6b; the receiver lives attools/pstore-receivewith its one-time install instructions in the header.Done when