Skip to contentSkip to conversation

2.4 and cryptofs on raid1 - what will be cached and how many times

DISCUSSION Vlad Harchev 4 participants 7 messages Mar 2, 2003 – Mar 4, 2003

lore
Share & tools
lore
#0 lore raw

Hello,

Could you please answer the following question:

Suppose we have a crypto filesystem on a raid1 array of 2 devices. What will the kernel cache of fileystem data contain - encrypted data or not? Will is be 2 copies of the same data in the cache or not?

Is there any way to force kernel to cache the same file data only once, and keep it unencrypted (in cache)?

Thanks in advance.

Signature · 2 lines
 Best regards,
  -Vlad
#1 lore raw
Quoted 7 lines · Vlad Harchev

Hello,

Could you please answer the following question:

Suppose we have a crypto filesystem on a raid1 array of 2 devices. What will the kernel cache of fileystem data contain - encrypted data or not? Will is be 2 copies of the same data in the cache or not?

Sorry for confusion - of course I meant linux software raid here..

Quoted 3 lines

Is there any way to force kernel to cache the same file data only once, and keep it unencrypted (in cache)?

Signature · 2 lines
 Best regards,
  -Vlad
#2 lore raw
Quoted 10 lines · On Monday March 3, [email protected] wrote:
Quoted 7 lines · Vlad Harchev

Hello,

Could you please answer the following question:

Suppose we have a crypto filesystem on a raid1 array of 2 devices. What will the kernel cache of fileystem data contain - encrypted data or not? Will is be 2 copies of the same data in the cache or not?

Sorry for confusion - of course I meant linux software raid here..

With raid1 has no effect on caching. Exactly the same data is cached with raid1 as with as plain SCSI or IDE drive.

Raid5 is different. It has an extra cache of some of the data that has been written-to or read-from the devices.

Quoted 4 lines
Quoted 4 lines

Is there any way to force kernel to cache the same file data only once, and keep it unencrypted (in cache)?

I suspect that depends of the details of the implementation of you "crypto filesystem".

NeilBrown

#3 lore raw
Quoted 6 lines · Neil Brown
Quoted 5 lines · On Monday March 3, [email protected] wrote:
Quoted 4 lines · Vlad Harchev

Hello,

Could you please answer the following question:

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Suppose we have a crypto filesystem on a raid1 array of 2 devices. What will the kernel cache of fileystem data contain - encrypted data or not? Will is be 2 copies of the same data in the cache or not?

Sorry for confusion - of course I meant linux software raid here..

With raid1 has no effect on caching. Exactly the same data is cached with raid1 as with as plain SCSI or IDE drive.

The question I asked is - will under the active usage there be exactly one
copy of a file's data, or there will be N (where N is number of disks in raid1 array) copies in the cache? I.e. how optimal caching is performed?

Quoted 2 lines

Raid5 is different. It has an extra cache of some of the data that has been written-to or read-from the devices.

OK, thank you for pointing this.

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

Is there any way to force kernel to cache the same file data only once, and keep it unencrypted (in cache)?

I suspect that depends of the details of the implementation of you "crypto filesystem".

Sorry for confusion - I meant loopback-based crypto filesystem - e.g. loop-aes
based (loop-aes.sourceforge.net) or CryptoAPI-based (www.kerneli.org) - both are loopback-based filesystem (one has to call losetup(8) to point out chipher, a password..) I'm getting an impression that the kernel cache will contain encrypted data in case loopback-based crypto filesystems are used just observing performance..

Thank you for the anwser!

Signature · 2 lines
 Best regards,
  -Vlad
#4 lore raw
Quoted 5 lines · Vlad Harchev

Sorry for confusion - I meant loopback-based crypto filesystem - e.g. loop-aes
based (loop-aes.sourceforge.net) or CryptoAPI-based (www.kerneli.org) - both are loopback-based filesystem (one has to call losetup(8) to point out chipher, a password..)

Loopback with encryption is not the same as a crypto filesystem. Loopback encryption works transparently with any (non-)crypto fs.

A potential attacker can use this to look for the ext2 superblock, which gives him the same data both encrypted an unencrypted. A real cryptofs would go through great pains to take such advantages away.

Jörn

Signature · 2 lines
Invincibility is in oneself, vulnerability is in the opponent.
-- Sun Tzu
#5 lore raw
Quoted 9 lines · J?rn Engel
Quoted 5 lines · Vlad Harchev

Sorry for confusion - I meant loopback-based crypto filesystem - e.g. loop-aes
based (loop-aes.sourceforge.net) or CryptoAPI-based (www.kerneli.org) - both are loopback-based filesystem (one has to call losetup(8) to point out chipher, a password..)

Loopback with encryption is not the same as a crypto filesystem. Loopback encryption works transparently with any (non-)crypto fs.

Yes, you are right.

Quoted 2 lines

A potential attacker can use this to look for the ext2 superblock, which gives him the same data both encrypted an unencrypted. A real

I've got an impression that in case of loopback with encryption the
superblock will also be encrypted.
If one forgets known cleartext attacks, one can place the filesystem at
some offset.

Quoted 2 lines

cryptofs would go through great pains to take such advantages away.

Signature · 2 lines
 Best regards,
  -Vlad
#6 lore raw
Quoted 8 lines · Vlad Harchev
Quoted 2 lines

A potential attacker can use this to look for the ext2 superblock, which gives him the same data both encrypted an unencrypted. A real

I've got an impression that in case of loopback with encryption the
superblock will also be encrypted.
If one forgets known cleartext attacks, one can place the filesystem at
some offset.

Yes it would be encrypted. Unfortunately it is predictable data and as such it is much easier to crack. Better set that offset at a location computed from the encryption key.

On a side note I find it interesting that many people sugest compressing a file before encrypting it. Take a look at the first few bytes of every compressed file. Unless your going to get rid of that header...

Quoted 1 line
Quoted 1 line

cryptofs would go through great pains to take such advantages away.

- Bryan