[ only responding to the pmem side of things... ] On Wed, Dec 5, 2018 at 5:09 PM Andy Lutomirski <luto@xxxxxxxxxx> wrote: > > On Wed, Dec 5, 2018 at 3:49 PM Dave Hansen <dave.hansen@xxxxxxxxx> wrote: [..] > > We also haven't settled on the file-backed properties. For file-backed, > > my hope was that you could do: > > > > ptr = mmap(fd, size, prot); > > printf("ciphertext: %x\n", *ptr); > > mprotect_encrypt(ptr, len, prot, keyid); > > printf("plaintext: %x\n", *ptr); > > Why would you ever want the plaintext? Also, how does this work on a > normal fs, where relocation of the file would cause the ciphertext to > get lost? It really seems to be that it should look more like > dm-crypt where you encrypt a filesystem. Maybe you'd just configure > the pmem device to be encrypted before you mount it, or you'd get a > new pmem-mktme device node instead. This would also avoid some nasty > multiple-copies-of-the-direct-map issue, since you'd only ever have > one of them mapped. Yes, this is really the only way it can work. Otherwise you need to teach the filesystem that "these blocks can't move without the key because encryption", and have an fs-feature flag to say "you can't mount this legacy / encryption unaware filesystem from an older kernel because we're not sure you'll move something and break the encryption". So pmem namespaces (volumes) would be encrypted providing something similar to dm-crypt, although we're looking at following the lead of the fscrypt key management scheme.