-
-
Notifications
You must be signed in to change notification settings - Fork 665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix erroneous shutdown when rejecting firmware upload #3122
Conversation
this doesn't look right first off you're repeatedly erasing flash in the while-true loop, that's not great second, we probably shouldn't infinite-loop in the first place:
|
(while we're here, maybe rename |
As suggested: dfe5ded Note that Also. When user cancels the upload now, he is taken to Intro screen, where he can go to menu and 'restart' from there: which will then show fatal error with "firmware corrupted" message. This is also case when there is firmware header but corrupted fw and user chooses in the Even worse probably is that if there is no firmware header, user does the wipe command, cancels, there is crash with |
maybe we should fold the "go to trezor.io/start" screen into the main thing? like, if there is a fw header, we show the blue intro, and if there isn't, we connect to host directly and show the black welcome? |
trying that in 22ca85e Seems to be working fine, one thing is that when this (corrupted fw with valid header) happens, we now go directly to bootloader menu and user has no clue why. Maybe we should in the "blue intro" screen show some warning that fw is corrupted? Another thing, "header present" is evaluated with same logic as when deciding whether to ask user for confirmation, but at least theoretically more things can happen, like having valid header for different model will be evaluated as no-header in this context. This is probably fine, just something to be aware of. |
it turns out that this PR incidentally implements a variant of #2794, right? Tagging @andrewkozlik and @prusnak for a careful review of the logic here. It looks perfectly sensible to me: determine header validity separate from firmware validity, and only erase seed if the header is missing. wrt merging, let's wait with this until #2919 is ready and rebase on top of that. When that is ready, we'll need to carefully review the resulting code, hopefully with notes about what to look out for from here. |
22ca85e
to
ea96641
Compare
rebased on current master. |
What has to be done here in order to merge it? |
as said in the comment above, this is waiting for #2919 and it needs a review after rebasing. |
Ahh, sorry, didn't notice the comment. |
0a7bed6
to
650ff96
Compare
desired modifications:
|
Part of the hardening done here: c5e7395 |
Ahh, this. I saw it yesterday. It seems to be ok as this should be visible only is case of something wrong happens. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the glitching protection part @hiviah , just two minor things, otherwise it looks reasonable to me
added a thing in f286ca8, @TychoVrahe @hiviah please review |
ad "a thing" : this does not seem to work when checking bootloader image (in boardloader). When updating the bootloader the sector is padded with zeroes (not sure what combined image contains). Also it does not count with checking images with only one chunk (=bootloader again) - as the remaining partial chunk is checked beyond the first chuck. @matejcik |
thanks, didn't realize that boardloader also uses this code. |
f286ca8
to
84aa673
Compare
tried to handle remaining issues. |
and one more fix 7f93d97 |
985393b
to
97ea3be
Compare
97ea3be
to
77061a8
Compare
QA OK |
this was only triggered when bootloader does not detect valid firmware, therefore shows "get started with your trezor" screen, but at least firmware header is valid so bootloader asks for confirmation.