Skip to content

Comments

blockdev: add support for dm-integrity's new UUID naming scheme#1681

Merged
nikita-dubrovskii merged 1 commit intocoreos:mainfrom
nikita-dubrovskii:dm-integrity
Jul 21, 2025
Merged

blockdev: add support for dm-integrity's new UUID naming scheme#1681
nikita-dubrovskii merged 1 commit intocoreos:mainfrom
nikita-dubrovskii:dm-integrity

Conversation

@nikita-dubrovskii
Copy link
Contributor

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

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 new CRYPT-SUBDEV- UUID naming scheme used by dm-integrity devices since cryptsetup-2.8.0. This ensures continued compatibility with newer cryptsetup versions while still supporting the older CRYPT-INTEGRITY- scheme.
  • Documentation: A new entry has been added to the release-notes.md file, documenting the support for cryptsetup-2.8.0's UUID naming of dm-integrity devices 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

  1. 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.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-"))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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))

Copy link
Member

@jlebon jlebon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gemini suggestion SGTM but also fine as is.
Thanks!

@jlebon
Copy link
Member

jlebon commented Jul 18, 2025

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
@nikita-dubrovskii nikita-dubrovskii merged commit 582c35b into coreos:main Jul 21, 2025
15 checks passed
@nikita-dubrovskii nikita-dubrovskii deleted the dm-integrity branch July 21, 2025 10:52
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.

2 participants