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

Check risk of 24-bit snapshot time overflow with LVM Thin Provisioning #3244

Open
qubesuser opened this Issue Oct 28, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@qubesuser

LVM Thin Provisioning has a concept of "time", which is a 32-bit field in the thin pool superblock that is however stored in a 24-bit field in the block mapping btree, where it's used to determine if a block was changed after snapshotting where the remaining 40 bits of the 64-bit value indicate the block number a virtual block is mapped to.

This "time" field is incremented every time a snapshot is created in __create_snap in dm-thin-metadata.c, but I can't find any check for overflow at 16 million snapshot creations, and it also looks like that overflow would cause data corruption since the not-fitting-in-24-bits value would end up passed to pack_block_time where it would corrupt the block number field since it just uses an OR without masking to combine those values (and anyway, it would result in incorrect CoW behavior).

It's possible however that there is some mechanism that prevents this that I overlooked; I could not find any mention of this issue on the web.

It's currently probably not a problem in practice in Qubes, because with 2 snapshots created on each VM start, it would take around 460 VM starts per day to cause the overflow in 50 years, but it would become a problem if some new Qubes feature requires taking snapshots at a much higher rate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment