Skip to content
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

Successful wipe code triggers RSOD #1658

Closed
wendys-cats opened this issue Jun 9, 2021 · 6 comments · Fixed by #1676
Closed

Successful wipe code triggers RSOD #1658

wendys-cats opened this issue Jun 9, 2021 · 6 comments · Fixed by #1676
Assignees
Labels
bug Something isn't working as expected

Comments

@wendys-cats
Copy link

wendys-cats commented Jun 9, 2021

Describe the bug
After entering wipe code, device will successfully wipe, but will display RSOD. After reconnecting the device is wiped and functions. Applies only for TT device 2.4.0 firmware, T1 works as intended.

Text
FATAL ERROR
expr: drbg_initialized
file: embed/trezorhal/random&delays.c:81
func: drbg_generate
rev: revisbelow

Firmware version and revision
TT 2.4.0 usigned ea3596a
TT 2.4.0 signed ea3596a

Desktop/smartphone setup (please complete the following information):

  • Wallet software: Trezor Suite app and staging wallet 3a553b24e498c56a2e03897fded706dffb4a6d6b
  • OS: Windows 10 and NixOS 21.03
  • Browser none and Chromium
  • Version APP and Version 88.0.4324.182 (Official Build) (64-bit)

To Reproduce
Steps to reproduce the behavior:

  1. Enable PIN protection
  2. Enable wipe-code protection via trezorctl
  3. Enter wipe-code instead of PIN
  4. See error

Expected behavior
Device will wipe itself without displaying errors.

Screenshots

photo_2021-06-09_14-33-24

@wendys-cats wendys-cats added the bug Something isn't working as expected label Jun 9, 2021
@prusnak prusnak removed their assignment Jun 9, 2021
@prusnak prusnak added the P1 High label Jun 9, 2021
@prusnak prusnak modified the milestone: 21.07 Jun 9, 2021
@prusnak
Copy link
Member

prusnak commented Jun 9, 2021

This is a regression from 2.3.x, assigning P1

@STew790
Copy link

STew790 commented Jun 9, 2021

I was able to reproduce this with exactly the same setups.

Firmware version and revision
TT 2.4.0 usigned ea3596a
TT 2.4.0 signed ea3596a

Desktop/smartphone setup:

Wallet software: Trezor Suite app and staging wallet 3a553b24e498c56a2e03897fded706dffb4a6d6b
OS: Windows 10 and NixOS 21.03
Browser none and Chromium
Version APP and Version 88.0.4324.182 (Official Build) (64-bit)

@onvej-sl onvej-sl self-assigned this Jun 9, 2021
@andrewkozlik
Copy link
Contributor

This is happening because the shutdown() function defined in core/embed/trezorhal/util.s erases the RAM which causes the drbg_initialized static variable to be set to false while the random interrupts are running. drbg_generate() doesn't expect this, so it runs into a fatal error screen. The shutdown() function is called for all of the red screens on Trezor, so this means that any red screen will end up in the "FATAL ERROR drbg_initialized" screen shown in the screenshot. One of the red screens shown on Trezor is the one which states "You have entered the wipe code. All private data has been erased". So this is what's happening here. The Trezor gets wiped correctly but the information screen is then replaced by the FATAL ERROR screen.

@onvej-sl
Copy link
Contributor

What shutdown() does is:

  • It disables all exceptions (including interrupts) that can be disabled.
  • It erases the whole RAM and registers.
  • It ends up in an infinite loop.

Note that disabling all the exceptions is important, since an exception (for example the systick handler) could access memory that is already cleared which would lead to another exception.

The cause of this issue is that if shutdown() is called from the unprivileged mode, the function fails to disable all the exceptions.

@bosomt
Copy link

bosomt commented Jul 4, 2021

QA OK

Info:

  • Suite version: desktop 21.6.2 (290aab68e418b837f9bed8a8839143dddaefb81c)
  • Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_4_0) AppleWebKit/537.36 (KHTML, like Gecko) TrezorSuite/21.6.2 Chrome/89.0.4389.69 Electron/12.0.0 Safari/537.36
  • OS: MacIntel
  • Screen: 1680x1050
  • Device: model T 2.4.1 regular 0x01c1ae426fe911619f0312fa417ecdd7e102848c

@wendys-cats
Copy link
Author

QA OK

No more RSOD, yay! After successful wipe, device displays message about entering wipe code and not RSOD.

Suite: version APP 21.6.2 290aab68e418b837f9bed8a8839143dddaefb81c and APP 21.7.1 3d90909aa68da250490f474b2d4cab02c0aad272
OS: Windows 10
Device: TT 2.4.1 regular 01c1ae4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants