Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1972722

Summary: [RHEL9] integritysetup don't support parameter integrity-recalculate
Product: Red Hat Enterprise Linux 9 Reporter: guazhang <guazhang>
Component: cryptsetupAssignee: Ondrej Kozina <okozina>
Status: CLOSED CURRENTRELEASE QA Contact: guazhang <guazhang>
Severity: low Docs Contact:
Priority: low    
Version: 9.0CC: agk, jbrassow, okozina, prajnoha
Target Milestone: betaFlags: pm-rhel: mirror+
Target Release: 9.0 Beta   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: cryptsetup-2.4.0-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-12-07 21:35:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description guazhang@redhat.com 2021-06-16 13:45:07 UTC
Description of problem:
cryptsetup regression testing failed and found the error, please have a look if hit a bug 

Version-Release number of selected component (if applicable):

integritysetup-2.3.5-4.el9.x86_64
cryptsetup-2.3.5-4.el9.x86_64

How reproducible:
100%

Steps to Reproduce:
1. integritysetup -q format --debug  --progress-frequency '5'  --integrity 'hmac-sha256'  --tag-size '20'  --journal-size '4096'  --integrity-key-size '20'  --integrity-key-file '/home/mykeyfile3n8C'  --sector-size '4096'  /dev/loop1
2.integritysetup -q open --integrity-recalculate  --integrity 'hmac-sha256'  --integrity-key-size '20'  --integrity-key-file '/home/mykeyfile3n8C'  /dev/loop1 devloop1
device-mapper: reload ioctl on devloop1 (253:4) failed: Operation not supported
Kernel refuses to activate insecure recalculate option (see legacy activation options to override).



Jun 16 09:33:41 dell-r430-26 kernel: async_tx: api initialized (async)
Jun 16 09:33:41 dell-r430-26 kernel: xor: automatically using best checksumming function   avx
Jun 16 09:37:02 dell-r430-26 kernel: device-mapper: table: 253:4: integrity: Recalculating with HMAC is disabled for security reasons - if you really need it, use the argument "legacy_recalculate"
Jun 16 09:37:02 dell-r430-26 kernel: device-mapper: ioctl: error adding target to table



Actual results:
run cmd failed 

Expected results:
run pass 

Additional info:

Comment 1 Ondrej Kozina 2021-07-30 12:30:52 UTC
(In reply to guazhang from comment #0)

> Jun 16 09:37:02 dell-r430-26 kernel: device-mapper: table: 253:4: integrity:
> Recalculating with HMAC is disabled for security reasons - if you really
> need it, use the argument "legacy_recalculate"
> Jun 16 09:37:02 dell-r430-26 kernel: device-mapper: ioctl: error adding
> target to table
> 

Kernel provides pretty good hint here. Anyway, there was a security bug in dm-integrity with regard to integrity recalculate flag and HMAC. The referenced legacy_recalculate flag can be set with user's discretion in cryptsetup-2.3.6 and later.

Comment 2 guazhang@redhat.com 2021-08-19 12:35:07 UTC
Hi,

I tested the fixed package and found the parameter "integrity-recalculate" still don't support. 

Is it expected ?

cryptsetup-2.4.0-1.el9.x86_64

# integritysetup -q open --integrity-recalculate  --integrity 'hmac-sha256'  --integrity-key-size '20'  --integrity-key-file '/home/mykeyfile3n8C'  /dev/loop0  devloop0
device-mapper: reload ioctl on devloop0 (253:0) failed: Operation not supported
Kernel refuses to activate insecure recalculate option (see legacy activation options to override).

Comment 3 Ondrej Kozina 2021-08-19 13:02:17 UTC
You need to replace --integrity-recalculate with --integrity-legacy-recalculate.

But basically the recalculation with hmac is strongly discouraged for security reasons and you don't have to test recalculate scenario with hmac anymore. The legacy flag is there so that users can re-enable it temporarily if they need to migrate data away.

Comment 4 guazhang@redhat.com 2021-08-19 14:32:16 UTC
Hi,

the package cryptsetup-2.4.0-1.el9 has tested pass.

Comment 8 guazhang@redhat.com 2021-08-22 10:49:47 UTC
No regression found, move to verified.