Repository navigation
librbd: add crypto image dispatch layer - #37935
Merged
Merged
Conversation
dillaman
reviewed
Nov 10, 2020
orozery
force-pushed
the
librbd-image-address-remap
branch
from
November 13, 2020 08:26
325153f to
d4a744a
Compare
Contributor
Author
|
changes pushed |
Contributor
Author
|
jenkins test make check |
dillaman
approved these changes
Nov 16, 2020
There was a problem hiding this comment.
Nit: move up one line to keep in lexicographic order
This commit adds a crypto image dispatch layer, in addition to the existing crypto object dispatch layer. The single purpose of this layer is to translate logical image offset to "on-disk" offsets, given a crypto header which occupies the beginning of the image data. This calculation is done via a new remap_extents api, which is used in to wrap existing Striper translations between object and image extents. Signed-off-by: Or Ozeri <[email protected]>
orozery
force-pushed
the
librbd-image-address-remap
branch
from
November 17, 2020 06:40
d4a744a to
8d6a479
Compare
idryomov
added a commit
to idryomov/ceph
that referenced
this pull request
Jun 22, 2024
diff-iterate wasn't updated when librbd was being prepared to support encryption in commit 8d6a479 ("librbd: add crypto image dispatch layer"). This is even noted in [1]: > The two places I skipped for now are DiffIterate and TrimRequest. CryptoImageDispatch has since been removed, but diff-iterate in fast-diff mode is still unaware of encryption and just assumes that all offsets are raw. This means that the callback gets invoked with incorrect image offsets when encryption is loaded. For example, for a LUKS1-formatted image with some data at offsets 0 and 20971520, diff-iterate with encryption loaded reports 0~4194304 4194304~4194304 25165824~4194304 instead of 0~4194304 20971520~4194304 as "exists". For any piece of code that is using diff-iterate to optimize block-by-block processing (e.g. copy an encrypted source image to a differently-encrypted destination image), this is fatal: it would skip processing block 20971520 which has data and instead process block 25165824 which doesn't have any data and was to be skipped, producing a corrupted destination image. [1] ceph#37935 (comment) Fixes: https://tracker.ceph.com/issues/66570 Signed-off-by: Ilya Dryomov <[email protected]>
idryomov
added a commit
to idryomov/ceph
that referenced
this pull request
Jun 28, 2024
diff-iterate wasn't updated when librbd was being prepared to support encryption in commit 8d6a479 ("librbd: add crypto image dispatch layer"). This is even noted in [1]: > The two places I skipped for now are DiffIterate and TrimRequest. CryptoImageDispatch has since been removed, but diff-iterate in fast-diff mode is still unaware of encryption and just assumes that all offsets are raw. This means that the callback gets invoked with incorrect image offsets when encryption is loaded. For example, for a LUKS1-formatted image with some data at offsets 0 and 20971520, diff-iterate with encryption loaded reports 0~4194304 4194304~4194304 25165824~4194304 instead of 0~4194304 20971520~4194304 as "exists". For any piece of code that is using diff-iterate to optimize block-by-block processing (e.g. copy an encrypted source image to a differently-encrypted destination image), this is fatal: it would skip processing block 20971520 which has data and instead process block 25165824 which doesn't have any data and was to be skipped, producing a corrupted destination image. [1] ceph#37935 (comment) Fixes: https://tracker.ceph.com/issues/66570 Signed-off-by: Ilya Dryomov <[email protected]> (cherry picked from commit cdeb0ef)
idryomov
added a commit
to idryomov/ceph
that referenced
this pull request
Jun 28, 2024
diff-iterate wasn't updated when librbd was being prepared to support encryption in commit 8d6a479 ("librbd: add crypto image dispatch layer"). This is even noted in [1]: > The two places I skipped for now are DiffIterate and TrimRequest. CryptoImageDispatch has since been removed, but diff-iterate in fast-diff mode is still unaware of encryption and just assumes that all offsets are raw. This means that the callback gets invoked with incorrect image offsets when encryption is loaded. For example, for a LUKS1-formatted image with some data at offsets 0 and 20971520, diff-iterate with encryption loaded reports 0~4194304 4194304~4194304 25165824~4194304 instead of 0~4194304 20971520~4194304 as "exists". For any piece of code that is using diff-iterate to optimize block-by-block processing (e.g. copy an encrypted source image to a differently-encrypted destination image), this is fatal: it would skip processing block 20971520 which has data and instead process block 25165824 which doesn't have any data and was to be skipped, producing a corrupted destination image. [1] ceph#37935 (comment) Fixes: https://tracker.ceph.com/issues/66570 Signed-off-by: Ilya Dryomov <[email protected]> (cherry picked from commit cdeb0ef)
idryomov
added a commit
to idryomov/ceph
that referenced
this pull request
Jul 3, 2024
diff-iterate wasn't updated when librbd was being prepared to support encryption in commit 8d6a479 ("librbd: add crypto image dispatch layer"). This is even noted in [1]: > The two places I skipped for now are DiffIterate and TrimRequest. CryptoImageDispatch has since been removed, but diff-iterate in fast-diff mode is still unaware of encryption and just assumes that all offsets are raw. This means that the callback gets invoked with incorrect image offsets when encryption is loaded. For example, for a LUKS1-formatted image with some data at offsets 0 and 20971520, diff-iterate with encryption loaded reports 0~4194304 4194304~4194304 25165824~4194304 instead of 0~4194304 20971520~4194304 as "exists". For any piece of code that is using diff-iterate to optimize block-by-block processing (e.g. copy an encrypted source image to a differently-encrypted destination image), this is fatal: it would skip processing block 20971520 which has data and instead process block 25165824 which doesn't have any data and was to be skipped, producing a corrupted destination image. [1] ceph#37935 (comment) Fixes: https://tracker.ceph.com/issues/66570 Signed-off-by: Ilya Dryomov <[email protected]> (cherry picked from commit cdeb0ef) Conflicts: src/librbd/api/DiffIterate.cc [ ImageArea support not in quincy ] src/test/librbd/test_librbd.cc [ commit 4a5a0a5 ("librbd: add cloned images encryption API") not in quincy
idryomov
added a commit
to idryomov/ceph
that referenced
this pull request
Jul 8, 2024
diff-iterate wasn't updated when librbd was being prepared to support encryption in commit 8d6a479 ("librbd: add crypto image dispatch layer"). This is even noted in [1]: > The two places I skipped for now are DiffIterate and TrimRequest. CryptoImageDispatch has since been removed, but diff-iterate in fast-diff mode is still unaware of encryption and just assumes that all offsets are raw. This means that the callback gets invoked with incorrect image offsets when encryption is loaded. For example, for a LUKS1-formatted image with some data at offsets 0 and 20971520, diff-iterate with encryption loaded reports 0~4194304 4194304~4194304 25165824~4194304 instead of 0~4194304 20971520~4194304 as "exists". For any piece of code that is using diff-iterate to optimize block-by-block processing (e.g. copy an encrypted source image to a differently-encrypted destination image), this is fatal: it would skip processing block 20971520 which has data and instead process block 25165824 which doesn't have any data and was to be skipped, producing a corrupted destination image. [1] ceph#37935 (comment) Fixes: https://tracker.ceph.com/issues/66570 Signed-off-by: Ilya Dryomov <[email protected]> (cherry picked from commit cdeb0ef)
smanjara
pushed a commit
to smanjara/ceph
that referenced
this pull request
Jul 11, 2024
diff-iterate wasn't updated when librbd was being prepared to support encryption in commit 8d6a479 ("librbd: add crypto image dispatch layer"). This is even noted in [1]: > The two places I skipped for now are DiffIterate and TrimRequest. CryptoImageDispatch has since been removed, but diff-iterate in fast-diff mode is still unaware of encryption and just assumes that all offsets are raw. This means that the callback gets invoked with incorrect image offsets when encryption is loaded. For example, for a LUKS1-formatted image with some data at offsets 0 and 20971520, diff-iterate with encryption loaded reports 0~4194304 4194304~4194304 25165824~4194304 instead of 0~4194304 20971520~4194304 as "exists". For any piece of code that is using diff-iterate to optimize block-by-block processing (e.g. copy an encrypted source image to a differently-encrypted destination image), this is fatal: it would skip processing block 20971520 which has data and instead process block 25165824 which doesn't have any data and was to be skipped, producing a corrupted destination image. [1] ceph#37935 (comment) Fixes: https://tracker.ceph.com/issues/66570 Signed-off-by: Ilya Dryomov <[email protected]> (cherry picked from commit cdeb0ef) Resolves: rhbz#2295023
idryomov
added a commit
to idryomov/ceph
that referenced
this pull request
Jul 12, 2024
diff-iterate wasn't updated when librbd was being prepared to support encryption in commit 8d6a479 ("librbd: add crypto image dispatch layer"). This is even noted in [1]: > The two places I skipped for now are DiffIterate and TrimRequest. CryptoImageDispatch has since been removed, but diff-iterate in fast-diff mode is still unaware of encryption and just assumes that all offsets are raw. This means that the callback gets invoked with incorrect image offsets when encryption is loaded. For example, for a LUKS1-formatted image with some data at offsets 0 and 20971520, diff-iterate with encryption loaded reports 0~4194304 4194304~4194304 25165824~4194304 instead of 0~4194304 20971520~4194304 as "exists". For any piece of code that is using diff-iterate to optimize block-by-block processing (e.g. copy an encrypted source image to a differently-encrypted destination image), this is fatal: it would skip processing block 20971520 which has data and instead process block 25165824 which doesn't have any data and was to be skipped, producing a corrupted destination image. [1] ceph#37935 (comment) Fixes: https://tracker.ceph.com/issues/66570 Signed-off-by: Ilya Dryomov <[email protected]> (cherry picked from commit cdeb0ef) Conflicts: src/librbd/api/DiffIterate.cc [ ImageArea support not in quincy ] src/test/librbd/test_librbd.cc [ commit 4a5a0a5 ("librbd: add cloned images encryption API") not in quincy
idryomov
added a commit
to idryomov/ceph
that referenced
this pull request
Jul 15, 2024
diff-iterate wasn't updated when librbd was being prepared to support encryption in commit 8d6a479 ("librbd: add crypto image dispatch layer"). This is even noted in [1]: > The two places I skipped for now are DiffIterate and TrimRequest. CryptoImageDispatch has since been removed, but diff-iterate in fast-diff mode is still unaware of encryption and just assumes that all offsets are raw. This means that the callback gets invoked with incorrect image offsets when encryption is loaded. For example, for a LUKS1-formatted image with some data at offsets 0 and 20971520, diff-iterate with encryption loaded reports 0~4194304 4194304~4194304 25165824~4194304 instead of 0~4194304 20971520~4194304 as "exists". For any piece of code that is using diff-iterate to optimize block-by-block processing (e.g. copy an encrypted source image to a differently-encrypted destination image), this is fatal: it would skip processing block 20971520 which has data and instead process block 25165824 which doesn't have any data and was to be skipped, producing a corrupted destination image. [1] ceph#37935 (comment) Fixes: https://tracker.ceph.com/issues/66570 Signed-off-by: Ilya Dryomov <[email protected]> (cherry picked from commit cdeb0ef)
mkogan1
pushed a commit
to mkogan1/ceph
that referenced
this pull request
Jul 18, 2024
diff-iterate wasn't updated when librbd was being prepared to support encryption in commit 8d6a479 ("librbd: add crypto image dispatch layer"). This is even noted in [1]: > The two places I skipped for now are DiffIterate and TrimRequest. CryptoImageDispatch has since been removed, but diff-iterate in fast-diff mode is still unaware of encryption and just assumes that all offsets are raw. This means that the callback gets invoked with incorrect image offsets when encryption is loaded. For example, for a LUKS1-formatted image with some data at offsets 0 and 20971520, diff-iterate with encryption loaded reports 0~4194304 4194304~4194304 25165824~4194304 instead of 0~4194304 20971520~4194304 as "exists". For any piece of code that is using diff-iterate to optimize block-by-block processing (e.g. copy an encrypted source image to a differently-encrypted destination image), this is fatal: it would skip processing block 20971520 which has data and instead process block 25165824 which doesn't have any data and was to be skipped, producing a corrupted destination image. [1] ceph#37935 (comment) Fixes: https://tracker.ceph.com/issues/66570 Signed-off-by: Ilya Dryomov <[email protected]> (cherry picked from commit cdeb0ef) Resolves: rhbz#2295017
mkogan1
pushed a commit
to mkogan1/ceph
that referenced
this pull request
Aug 7, 2024
diff-iterate wasn't updated when librbd was being prepared to support encryption in commit 8d6a479 ("librbd: add crypto image dispatch layer"). This is even noted in [1]: > The two places I skipped for now are DiffIterate and TrimRequest. CryptoImageDispatch has since been removed, but diff-iterate in fast-diff mode is still unaware of encryption and just assumes that all offsets are raw. This means that the callback gets invoked with incorrect image offsets when encryption is loaded. For example, for a LUKS1-formatted image with some data at offsets 0 and 20971520, diff-iterate with encryption loaded reports 0~4194304 4194304~4194304 25165824~4194304 instead of 0~4194304 20971520~4194304 as "exists". For any piece of code that is using diff-iterate to optimize block-by-block processing (e.g. copy an encrypted source image to a differently-encrypted destination image), this is fatal: it would skip processing block 20971520 which has data and instead process block 25165824 which doesn't have any data and was to be skipped, producing a corrupted destination image. [1] ceph#37935 (comment) Fixes: https://tracker.ceph.com/issues/66570 Signed-off-by: Ilya Dryomov <[email protected]> (cherry picked from commit cdeb0ef) Resolves: rhbz#2292562
afreen23
pushed a commit
to rhcs-dashboard/ceph
that referenced
this pull request
Jul 29, 2026
diff-iterate wasn't updated when librbd was being prepared to support encryption in commit 4761bb2 ("librbd: add crypto image dispatch layer"). This is even noted in [1]: > The two places I skipped for now are DiffIterate and TrimRequest. CryptoImageDispatch has since been removed, but diff-iterate in fast-diff mode is still unaware of encryption and just assumes that all offsets are raw. This means that the callback gets invoked with incorrect image offsets when encryption is loaded. For example, for a LUKS1-formatted image with some data at offsets 0 and 20971520, diff-iterate with encryption loaded reports 0~4194304 4194304~4194304 25165824~4194304 instead of 0~4194304 20971520~4194304 as "exists". For any piece of code that is using diff-iterate to optimize block-by-block processing (e.g. copy an encrypted source image to a differently-encrypted destination image), this is fatal: it would skip processing block 20971520 which has data and instead process block 25165824 which doesn't have any data and was to be skipped, producing a corrupted destination image. [1] ceph#37935 (comment) Fixes: https://tracker.ceph.com/issues/66570 Signed-off-by: Ilya Dryomov <[email protected]> (cherry picked from commit f84621523954e71f44d139e4be0f80f8b262aeaa)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a new sync ImageDispatcher::remap_extents (similar to prepare_copyup).
This allows for "address translation" of image extents.
Specifically, for shifting offsets in encrypted images with a LUKS header preamble.
The new image dispatcher method is added to (almost) every call in librbd to Striper::file_to_extents/extents_to_file to correctly translates image to object extents, given the actual image data no longer starts at offset 0.
The two places I skipped for now are DiffIterate and TrimRequest. Let me know if this makes sense.
Other than that, any ideas for tests I should add?