blockdev: add support for dm-integrity's new UUID naming scheme#1681
blockdev: add support for dm-integrity's new UUID naming scheme#1681nikita-dubrovskii merged 1 commit intocoreos:mainfrom
Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @nikita-dubrovskii, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request enhances the system's ability to correctly identify LUKS integrity-protected devices by adapting to a recent change in cryptsetup's UUID naming convention. It ensures that the blockdev module can seamlessly recognize devices created with both the older and newer dm-integrity UUID formats, preventing potential detection failures.
Highlights
- Compatibility Update: The
is_luks_integrity()function has been updated to recognize the newCRYPT-SUBDEV-UUID naming scheme used bydm-integritydevices sincecryptsetup-2.8.0. This ensures continued compatibility with newercryptsetupversions while still supporting the olderCRYPT-INTEGRITY-scheme. - Documentation: A new entry has been added to the
release-notes.mdfile, documenting the support forcryptsetup-2.8.0's UUID naming ofdm-integritydevices under 'Internal changes'.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request updates the is_luks_integrity function to support a new UUID naming scheme for dm-integrity devices introduced in cryptsetup-2.8.0. The change correctly identifies both the old CRYPT-INTEGRITY- prefix and the new CRYPT-SUBDEV- prefix. The release notes are also updated to reflect this change. My review includes a minor correction for a typo in the release notes and a suggestion to improve maintainability in the Rust code by using constants for the UUID prefixes.
|
|
||
| let uuid = dminfo.trim(); | ||
| // since cryptsetup-2.8.0 SUBDEV is used | ||
| Ok(uuid.starts_with("CRYPT-INTEGRITY-") || uuid.starts_with("CRYPT-SUBDEV-")) |
There was a problem hiding this comment.
Using magic strings like "CRYPT-INTEGRITY-" and "CRYPT-SUBDEV-" can make the code harder to read and maintain. It's a good practice to define them as named constants. This improves clarity and makes it easier to manage these values if they need to be changed or referenced elsewhere in the future.
For example:
const OLD_CRYPT_INTEGRITY_PREFIX: &str = "CRYPT-INTEGRITY-";
const NEW_CRYPT_INTEGRITY_PREFIX: &str = "CRYPT-SUBDEV-";
// ...
Ok(uuid.starts_with(OLD_CRYPT_INTEGRITY_PREFIX) || uuid.starts_with(NEW_CRYPT_INTEGRITY_PREFIX))d26f40a to
040f9ba
Compare
jlebon
left a comment
There was a problem hiding this comment.
Gemini suggestion SGTM but also fine as is.
Thanks!
|
Annnd nice, this is also failing on coreos/fedora-coreos-tracker#1984. |
Cryptsetup commit 12eb040 ("Create dm-integrity with CRYPT_SUBDEV prefix.") changed
UUID naming scheme for integrity-protected devices:
```
$ dmsetup info --columns --noheadings -o UUID /dev/dm-2
CRYPT-SUBDEV-ef0561fda2cf4f8eb9fd729f4cd3e0c7-root_dif
```
Before crytsetup-2.8.0:
```
$ dmsetup info --columns --noheadings -o UUID /dev/dm-2
CRYPT-INTEGRITY-bec07f15a1c540b0833fcccd6ac2459d-root_dif
```
This PR updates `is_luks_integrity()` to recognize both schemes.
https://gitlab.com/cryptsetup/cryptsetup/-/commit/12eb04094304467232348e99df0fbf95074d35b3
040f9ba to
f5d4226
Compare
Cryptsetup commit 12eb040 ("Create dm-integrity with CRYPT_SUBDEV prefix.") changed UUID naming scheme for integrity-protected devices:
Before crytsetup-2.8.0:
This PR updates
is_luks_integrity()to recognize both schemes.https://gitlab.com/cryptsetup/cryptsetup/-/commit/12eb04094304467232348e99df0fbf95074d35b3