Bug #73825
closedclient: ceph_set_fscrypt_policy_v2 ret EEXIST when kernel headers differ
0%
Description
For instance, on centos stream 9, fscrypt_policy struct has an int array named "reserved" which is size of 4, while centos stream 10, decrements the size to 3 as log2_data_unit_size was added.
During ll_set_fscrypt_policy_v2, it checks to see if same policy already exists or not. It does this using fscrypt_ctx->convert_to. It then does a bit by bit comparison (memcpy) between provided policy and the existing one.
As shown below, it doesn't take into account the log2_data_unit_size
void convert_to(struct fscrypt_policy_v2 *dest) {
dest->version = version;
dest->contents_encryption_mode = contents_encryption_mode;
dest->filenames_encryption_mode = filenames_encryption_mode;
dest->flags = flags;
memset(dest->__reserved, 0, sizeof(dest->__reserved));
memcpy(dest->master_key_identifier, master_key_identifier.raw, sizeof(master_key_identifier.raw));
}
This can cause the int between flags and reserved to be uninitialized and causes the policy exist check to not work as intended.
1- https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/blob/main/include/uapi/linux/fscrypt.h#L74
2- https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/blob/main/include/uapi/linux/fscrypt.h#L74
CH Updated by Christopher Hoffman about 1 year ago
- Description updated (diff)
CH Updated by Christopher Hoffman about 1 year ago
- Pull request ID set to 66288
CH Updated by Christopher Hoffman about 1 year ago
- Status changed from In Progress to Fix Under Review
UB Updated by Upkeep Bot 9 months ago
- Status changed from Fix Under Review to Resolved
- Merge Commit set to d6c9a08b3680669a32b13cbde4ae2aef57e588ef
- Fixed In set to v20.3.0-5710-gd6c9a08b36
- Upkeep Timestamp set to 2026-03-02T06:28:10+00:00
UB Updated by Upkeep Bot about 1 month ago
- Released In set to v21.2.0~1142
- Upkeep Timestamp changed from 2026-03-02T06:28:10+00:00 to 2026-10-24T01:43:18+00:00