I've successfully set up LUKS encryption with CXL crypto accelerator support in your VM disk image (/root/CXLMemSim/build/qemu.img). Here's what was configured:
- cryptsetup 2.7.0 - LUKS encryption management
- dm-crypt - Device-mapper crypto target
- dmsetup - Device-mapper setup utility
- All dependencies and kernel modules
| Script | Purpose |
|---|---|
setup_luks_crypto.sh |
Main LUKS setup with hardware acceleration detection |
init_luks.sh |
Automatic initialization (runs on first boot) |
crypto_benchmark.sh |
Performance testing suite |
mount_luks.sh |
Quick mount/unmount utility |
verify_crypto_accel.sh |
Hardware acceleration verification |
LUKS_README.txt |
Complete usage documentation |
- setup-luks-crypto.service - Enabled to run on boot
- Will automatically initialize LUKS on next VM boot
cd /root/Drywall/build
bash ../launch.shOr if you want to start without GDB:
# Edit launch.sh and remove 'gdb --args' from line 15
./qemu-system-x86_64 --enable-kvm -cpu host ...The system will automatically:
- Load crypto kernel modules
- Create
/root/encrypted_volume.img(1GB) - Format it with LUKS encryption
- Mount it at
/mnt/encrypted - Create test data
Default Password: cxl_crypto_test
Password File: /root/.luks_password
Once inside the VM, check the setup:
# View the README
cat /root/LUKS_README.txt
# Verify hardware crypto
bash /root/verify_crypto_accel.sh
# Check the setup log
cat /root/luks_setup.log
# View encrypted volume
ls -lh /root/encrypted_volume.img
# Check mount
df -h /mnt/encrypted# Mount encrypted volume
bash /root/mount_luks.sh /root/encrypted_volume.img mount
# Unmount
bash /root/mount_luks.sh /root/encrypted_volume.img umount
# Check status
bash /root/mount_luks.sh /root/encrypted_volume.img status# Run comprehensive benchmark
bash /root/crypto_benchmark.sh
# Quick test
dd if=/dev/urandom of=/mnt/encrypted/testfile bs=1M count=100The VM has:
- PCI Bus: 0d:00.0
- Device: Intel CXL Type1 device (0d93)
- Features: VirtIO crypto acceleration
- Memory: 256MB CXL memory backend
The LUKS setup uses:
- Cipher: AES-XTS-Plain64
- Key Size: 512 bits (AES-256)
- Hash: SHA-256
- PBKDF: PBKDF2 (2000ms iteration time)
To verify hardware crypto acceleration is being used:
# Check for VirtIO crypto algorithms
cat /proc/crypto | grep virtio
# View crypto statistics
dmsetup table cxl_encrypted
# Monitor performance
iostat -x 1 /dev/mapper/cxl_encrypted- The default password is stored in
/root/.luks_password - This is for testing/development only
- For production use:
- Change the password:
cryptsetup luksChangeKey /root/encrypted_volume.img - Use proper key management
- Consider using TPM or other hardware security modules
- Change the password:
# Check service status
systemctl status setup-luks-crypto.service
# View logs
journalctl -u setup-luks-crypto.service
# Run manually
bash /root/init_luks.sh# Check PCI devices
lspci | grep CXL
# Load modules
modprobe virtio_crypto
modprobe dm-crypt
# Check available algorithms
cat /proc/crypto# Check if device is open
dmsetup ls
# Close and reopen
cryptsetup luksClose cxl_encrypted
cryptsetup luksOpen /root/encrypted_volume.img cxl_encrypted
mount /dev/mapper/cxl_encrypted /mnt/encryptedHost system (/root/Drywall/):
setup_luks_crypto.sh- Setup scriptcrypto_benchmark.sh- Benchmark scriptmount_luks.sh- Mount utilityverify_crypto_accel.sh- Verification scriptLUKS_SETUP_COMPLETE.md- This file
VM system (/root/CXLMemSim/build/qemu.img):
/root/setup_luks_crypto.sh/root/init_luks.sh/root/crypto_benchmark.sh/root/mount_luks.sh/root/verify_crypto_accel.sh/root/LUKS_README.txt/etc/systemd/system/setup-luks-crypto.service
-
Boot the VM
cd /root/Drywall/build bash ../launch.sh -
Wait for automatic setup (or press Enter to skip if systemd delays)
-
Verify the encrypted volume is mounted:
df -h /mnt/encrypted ls -la /mnt/encrypted
-
Test the crypto acceleration:
bash /root/crypto_benchmark.sh
-
Use the encrypted volume for your data
- The encrypted volume persists across reboots
- You'll need to mount it manually after each reboot (or configure auto-mount in /etc/fstab)
- The password is saved for convenience but should be changed for security
- All scripts have built-in help and error checking
Setup completed: November 3, 2025
VM Image: /root/CXLMemSim/build/qemu.img
Ready to use! 🎉