Actions
Tasks #71602
closedTasks #63293: Implement fscrypt in libcephfs and cephfs-fuse
kernel defconfig build fails in encrypted dir
% Done:
0%
Reviewed:
Affected Versions:
Component(FS):
Labels (FS):
Pull request ID:
Tags (freeform):
Merge Commit:
Fixed In:
Released In:
Upkeep Timestamp:
Description
Here's the steps to reproduce:
Inside an encrypted/unlocked dir:
wget -O linux.tar.xz http://download.ceph.com/qa/linux-6.5.11.tar.xz make defconfig make -j`grep -c processor /proc/cpuinfo`
The error:
UPD include/generated/utsversion.h CC init/version-timestamp.o LD .tmp_vmlinux.kallsyms1 NM .tmp_vmlinux.kallsyms1.syms nm: .tmp_vmlinux.kallsyms1: file format not recognized KSYMS .tmp_vmlinux.kallsyms1.S No valid symbol. make[2]: *** [scripts/Makefile.vmlinux:36: vmlinux] Error 1 make[1]: *** [/mnt/mycephfs/enc1/linux-6.5.11/Makefile:1250: vmlinux] Error 2 make: *** [Makefile:234: __sub-make] Error 2
Updated by Christopher Hoffman 9 months ago
Here's a simplified reproducer:
import os
file = "test_file"
fd = os.open(file, os.O_CREAT | os.O_RDWR, 0o644)
os.lseek(fd, 46374912, os.SEEK_SET)
os.write(fd, b"bar")
os.lseek(fd, 4190203, os.SEEK_SET)
os.write(fd, b"foo!!")
os.close(fd)
with open(file, 'r') as f:
print(f.read())
Updated by Christopher Hoffman 9 months ago
Author: Christopher Hoffman <choffman@redhat.com>
Date: Tue Jun 17 16:44:08 2025 +0000
client: Fix logic in fscrypt hole optimization
In fscrypt decryption code path, ensure if a data block
is hit when there are holes present in adjacent blocks,
that we exit hole traversal and continue on to decrypt the block.
Fixes: https://tracker.ceph.com/issues/71602
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
diff --git a/src/client/FSCrypt.cc b/src/client/FSCrypt.cc
index d3f162c8af2..edb38898aff 100644
--- a/src/client/FSCrypt.cc
+++ b/src/client/FSCrypt.cc
@@ -898,11 +898,25 @@ int FSCryptFDataDenc::decrypt_bl(uint64_t off, uint64_t len, uint64_t pos, const
while (pos < target_end) {
bool has_hole = false;
+ /*
+ * Check to see if cur_block is part of a
+ * hole. We expect holes to ordered by offset.
+ *
+ * There is four states it can be in
+ * 1. If position is before hole offset, it cannot be part of a hole
+ * 2. If hole end is less than position, hole occurs completely before
+ * 3. If hole starts after target_end, hole occurs completely after
+ * 4. No conditionals are met, is a hole
+ */
+
while (hiter != holes.end()) {
uint64_t hofs = hiter->first;
uint64_t hlen = hiter->second;
uint64_t hend = hofs + hlen - 1;
+ if (pos < hofs)
+ break;
+
if (hend < pos) {
++hiter;
continue;
Updated by Christopher Hoffman 9 months ago
- Status changed from In Progress to Resolved
Actions