Read / write data using mmap for encrypted filesystem

I am working on an encrypted filesystem that encrypts data just before it is written to disk and decrypts it as soon as it is read from disk. Any file on disk is useless unless it is decrypted first. so far I have changed the standard read and write methods that the filesystem returns.

the problem starts with the mmap

memory mapping used for files. for example, on ext4 filesystem, as far as I know, it does not use standard I / O, so it must be encrypted / decrypted just like read / write system calls. So how can I decrypt the data as it is read from disk and encrypted when the kernel wants to update the memory mapped files?

I want to stay in my filesystem specific module if possible.

UPDATE: read / write works fine in terminal. but:

  • I cannot execute binaries on the encrypted partition.
  • When copying files using a GUI based file system (eg pcmanfm), the result file is corrupted.

so should I edit any other system calls like what I did when reading / writing?

+3


source to share





All Articles