4

I am working on an encrypted filesystem that encrypts data just before writing it to disk and decrypts it right after reading from disk. Any file in disk is useless if not decrypted first. so far I changed standard read and write methods that filesystem reperesents.

the problem begins with mmap used for memory mapping files. for example in ext4 filesystem, as far as I know it does not use standard I/O so should be encrypted/decrypted just like read/write system calls. So how can I decrypt data when its being read from disk and encrypt it when kernel wants to update memory mapped files?

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

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

  • I can not execute binary files in encrypted partition.
  • when I copy files using a GUI based filesystem (pcmanfm for example), result file is corrupted.

so should I edit any other system calls like I did with read/write?

Amir H
  • 482
  • 4
  • 10
  • 4
    What are you asking about? When mapped file will be read page_fault will occur, which will lead to real read, when you will decrypt. On sync changed page cache data will be writen to disk, when it will be encrypted. – Alex Hoppus May 24 '15 at 13:56
  • @AlexHoppus so.. are you saying that I simply don't need to worry about how mmaped data is read/written? – Amir H May 25 '15 at 09:11
  • I suggest, correct me if this wouldn't work – Alex Hoppus May 25 '15 at 13:23
  • @AlexHoppus ok thank you. I think I need to run a long test. I will post the results. – Amir H May 25 '15 at 13:59
  • @AlexHoppus after running some tests. I noticed copying files in terminal is OK. But in a file manager it will corrupt the file. – Amir H Jun 30 '15 at 14:35

0 Answers0