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

Enable dm_verity panic on corruption #445

Merged
merged 1 commit into from
Oct 21, 2019
Merged

Enable dm_verity panic on corruption #445

merged 1 commit into from
Oct 21, 2019

Conversation

tjkirch
Copy link
Contributor

@tjkirch tjkirch commented Oct 21, 2019

dm_verity.error_behavior doesn't seem to be a current setting; documentation
describes restart_on_corruption which does indeed restart when it detects a
changed block.


Fixes #441

Not the same version, but docs are here: https://github.com/torvalds/linux/blob/master/Documentation/admin-guide/device-mapper/verity.rst

Testing done:

Played with error_behavior and discovered that neither =1 nor =3 did anything other than log corruption to dmesg.

After setting restart_on_corruption and letting an evil dd run for a bit, a read from disk causes a hang:

bash-5.0# dd if=/dev/zero of=/dev/xvda3 conv=fsync
^C1129545+0 records in
1129545+0 records out
578327040 bytes (578 MB, 552 MiB) copied, 67.6888 s, 8.5 MB/s
bash-5.0# md5sum /usr/bin/*

And I see the dm-verity restart in the instance screenshot, and the console system log shows things like this from then on; I also confirmed outside that the instance is in a reboot loop (as intended).

    1.666312] device-mapper: verity: 202:3: data block 0 is corrupted
[    2.225755] tsc: Refined TSC clocksource calibration: 2793.269 MHz
[    2.230391] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x284369f366d, max_idle_ns: 440795234812 ns
[    2.663507] xenbus: xenbus_dev_shutdown: device/pci/0: Initialising != Connected, skipping
[    2.677514] reboot: Restarting system with command 'dm-verity device corrupted'
[    2.686382] reboot: machine restart

...and the instance screenshot either shows grub or has a fun "Error getting console screenshot - An unknown error occurred" error from then on.

dm_verity.error_behavior doesn't seem to be a current setting; documentation
describes restart_on_corruption which does indeed restart when it detects a
changed block.
@tjkirch tjkirch requested review from iliana and bcressey October 21, 2019 21:15
@tjkirch tjkirch merged commit a890f5f into develop Oct 21, 2019
@tjkirch tjkirch deleted the verity-panic branch October 21, 2019 21:28
@iliana iliana added this to the v0.2.0 milestone Nov 19, 2019
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.

dm_verity should panic on error
3 participants