From: Andy Lutomirski <firstname.lastname@example.org> To: email@example.com Cc: David Howells <firstname.lastname@example.org>, Thomas Gleixner <email@example.com>, James Morris <firstname.lastname@example.org>, Ingo Molnar <email@example.com>, "H. Peter Anvin" <firstname.lastname@example.org>, Borislav Petkov <email@example.com>, Andrew Lutomirski <firstname.lastname@example.org>, Peter Zijlstra <email@example.com>, "Kirill A. Shutemov" <firstname.lastname@example.org>, Dave Hansen <email@example.com>, firstname.lastname@example.org, Jun Nakajima <email@example.com>, Dan Williams <firstname.lastname@example.org>, "Sakkinen, Jarkko" <email@example.com>, firstname.lastname@example.org, LSM List <email@example.com>, Linux-MM <firstname.lastname@example.org>, X86 ML <email@example.com> Subject: Re: [RFC v2 01/13] x86/mktme: Document the MKTME APIs Date: Wed, 5 Dec 2018 15:35:36 -0800 Message-ID: <CALCETrXsh6wAy9kE_m1L+0yW8a6bNOb6g2Tf9nwpQJnyMzdSuw@mail.gmail.com> (raw) In-Reply-To: <20181205192255.GA988@alison-desk.jf.intel.com> >> On Dec 5, 2018, at 11:22 AM, Alison Schofield <firstname.lastname@example.org> wrote: >> >> On Wed, Dec 05, 2018 at 10:11:18AM -0800, Andy Lutomirski wrote: >> >> >>> On Dec 3, 2018, at 11:39 PM, Alison Schofield <email@example.com> wrote: >> >> I realize you’re writing code to expose hardware behavior, but I’m not sure this >> really makes sense in this context. > > Your observation is accurate. The Usage defined here is very closely > aligned to the Intel MKTME Architecture spec. That's a starting point, > but not the ending point. We need to implement the feature set that > makes sense. More below... > >>> + >>> + type= >>> + *user* User will supply the encryption key data. Use this >>> + type to directly program a hardware encryption key. >>> + >> >> I think that “user” probably sense as a “key service” key, but I don’t think it is at all useful for non-persistent memory. Even if we take for granted that MKTME for anonymous memory is useful at all, “cpu” seems to be better in all respects. >> >> >> Perhaps support for “user” should be tabled until there’s a design for how to use this for pmem? I imagine it would look quite a bit like dm-crypt. Advanced pmem filesystems could plausibly use different keys for different files, I suppose. >> >> If “user” is dropped, I think a lot of the complexity goes away. Hotplug becomes automatic, right? > > Dropping 'user' type removes a great deal of complexity. > > Let me follow up in 2 ways: > 1) Find out when MKTME support for pmem is required. > 2) Go back to the the requirements and get the justification for user > type. > >> >>> + *cpu* User requests a CPU generated encryption key. >> >> Okay, maybe, but it’s still unclear to me exactly what the intended benefit is, though. > *cpu* is the RANDOM key generated by the cpu. If there were no other > options, then this would be default, and go away. > >>> + *clear* User requests that a hardware encryption key be >>> + cleared. This will clear the encryption key from >>> + the hardware. On execution this hardware key gets >>> + TME behavior. >>> + >> >> Why is this a key type? Shouldn’t the API to select a key just have an option to ask for no key to be used? > > The *clear* key has been requested in order to clear/erase the users > key data that has been programmed into a hardware slot. User does not > want to leave a slot programmed with their encryption data when they > are done with it. Can’t you just clear the key when the key is deleted by the user? Asking the user to allocate a *new* key and hope that it somehow ends up in the same spot seems like a poor design, especially if future hardware gains support for key slot virtualization in some way that makes the slot allocation more dynamic. > >>> + *no-encrypt* >>> + User requests that hardware does not encrypt >>> + memory when this key is in use. >> >> Same as above. If there’s a performance benefit, then there could be a way to ask for cleartext memory. Similarly, some pmem users may want a way to keep their pmem unencrypted. > > So, this is the way to ask for cleartext memory. > The entire system will be encrypted with the system wide TME Key. > A subset of that will be protected with MKTME Keys. > If user wants, no encrypt, this *no-encrypt* is the way to do it. > Understood. I’m saying that having a *key* (in the add_key sense) for it seems unnecessary. Whatever the final API for controlling the use of keys, adding an option to ask for clear text seems reasonable. This actually seems more useful for anonymous memory than the cpu-generates keys are IMO. I do think that, before you invest too much time in perfecting the series with the current design, you should identify the use cases, make sure the use cases are valid, and figure out whether your API design is appropriate. After considerable head-scratching, I haven’t thought of a reason that explicit CPU generated keys are any better than the default TME key, at least in the absence of additional hardware support for locking down what code can use what key. The sole exception is that a key can be removed, which is probably faster than directly zeroing large amounts of data. I understand that it would be very nice to say "hey, cloud customer, your VM has all its memory encrypted with a key that is unique to your VM", but that seems to be more or less just a platitude with no actual effect. Anyone who snoops the memory bus or steals a DIMM learns nothing unless they also take control of the CPU and can replay all the data into the CPU. On the other hand, anyone who can get the CPU to read from a given physical address (which seems like the most likely threat) can just get the CPU to decrypt any tenant's data. So, for example, if someone manages to write a couple of words to the EPT for one VM, then they can easily read another VM's data, MKTME or no MKTME, because the memory controller has no clue which VM initiated the access. I suppose there's some smallish value in rotating the key every now and then to make old data non-replayable, but an attack that compromises the memory bus and only later compromises the CPU is a strange threat model.
next prev parent reply index Thread overview: 91+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-12-04 7:39 [RFC v2 00/13] Multi-Key Total Memory Encryption API (MKTME) Alison Schofield 2018-12-04 7:39 ` [RFC v2 01/13] x86/mktme: Document the MKTME APIs Alison Schofield 2018-12-05 18:11 ` Andy Lutomirski 2018-12-05 19:22 ` Alison Schofield 2018-12-05 23:35 ` Andy Lutomirski [this message] 2018-12-06 8:04 ` Sakkinen, Jarkko 2018-12-04 7:39 ` [RFC v2 02/13] mm: Generalize the mprotect implementation to support extensions Alison Schofield 2018-12-06 8:08 ` Sakkinen, Jarkko 2018-12-04 7:39 ` [RFC v2 03/13] syscall/x86: Wire up a new system call for memory encryption keys Alison Schofield 2018-12-04 7:39 ` [RFC v2 04/13] x86/mm: Add helper functions for MKTME " Alison Schofield 2018-12-04 9:14 ` Peter Zijlstra 2018-12-05 5:49 ` Alison Schofield 2018-12-04 15:35 ` Andy Lutomirski 2018-12-05 5:52 ` Alison Schofield 2018-12-06 8:31 ` Sakkinen, Jarkko 2018-12-04 7:39 ` [RFC v2 05/13] x86/mm: Set KeyIDs in encrypted VMAs Alison Schofield 2018-12-06 8:37 ` Sakkinen, Jarkko 2018-12-04 7:39 ` [RFC v2 06/13] mm: Add the encrypt_mprotect() system call Alison Schofield 2018-12-06 8:38 ` Sakkinen, Jarkko 2018-12-04 7:39 ` [RFC v2 07/13] x86/mm: Add helpers for reference counting encrypted VMAs Alison Schofield 2018-12-04 8:58 ` Peter Zijlstra 2018-12-05 5:28 ` Alison Schofield 2018-12-04 7:39 ` [RFC v2 08/13] mm: Use reference counting for " Alison Schofield 2018-12-04 7:39 ` [RFC v2 09/13] mm: Restrict memory encryption to anonymous VMA's Alison Schofield 2018-12-04 9:10 ` Peter Zijlstra 2018-12-05 5:30 ` Alison Schofield 2018-12-05 9:07 ` Peter Zijlstra 2018-12-04 7:39 ` [RFC v2 10/13] keys/mktme: Add the MKTME Key Service type for memory encryption Alison Schofield 2018-12-06 8:51 ` Sakkinen, Jarkko 2018-12-06 8:54 ` Sakkinen, Jarkko 2018-12-06 15:11 ` Dave Hansen 2018-12-06 22:56 ` Sakkinen, Jarkko 2018-12-04 7:39 ` [RFC v2 11/13] keys/mktme: Program memory encryption keys on a system wide basis Alison Schofield 2018-12-04 9:21 ` Peter Zijlstra 2018-12-04 9:50 ` Kirill A. Shutemov 2018-12-05 5:44 ` Alison Schofield 2018-12-05 5:43 ` Alison Schofield 2018-12-05 9:10 ` Peter Zijlstra 2018-12-05 17:26 ` Alison Schofield 2018-12-04 7:39 ` [RFC v2 12/13] keys/mktme: Save MKTME data if kernel cmdline parameter allows Alison Schofield 2018-12-04 9:22 ` Peter Zijlstra 2018-12-07 2:14 ` Huang, Kai 2018-12-07 3:42 ` Alison Schofield 2018-12-07 6:39 ` Jarkko Sakkinen 2018-12-07 6:45 ` Jarkko Sakkinen 2018-12-07 11:47 ` Kirill A. Shutemov 2018-12-04 7:40 ` [RFC v2 13/13] keys/mktme: Support CPU Hotplug for MKTME keys Alison Schofield 2018-12-04 9:28 ` Peter Zijlstra 2018-12-05 5:32 ` Alison Schofield 2018-12-04 9:31 ` Peter Zijlstra 2018-12-05 5:36 ` Alison Schofield 2018-12-04 9:25 ` [RFC v2 00/13] Multi-Key Total Memory Encryption API (MKTME) Peter Zijlstra 2018-12-04 9:46 ` Kirill A. Shutemov 2018-12-05 20:32 ` Sakkinen, Jarkko 2018-12-06 11:22 ` Kirill A. Shutemov 2018-12-06 14:59 ` Dave Hansen 2018-12-07 10:12 ` Huang, Kai 2018-12-06 21:23 ` Sakkinen, Jarkko 2018-12-07 11:54 ` Kirill A. Shutemov 2018-12-04 19:19 ` Andy Lutomirski 2018-12-04 20:00 ` Andy Lutomirski 2018-12-04 20:32 ` Dave Hansen 2018-12-05 22:19 ` Sakkinen, Jarkko 2018-12-07 2:05 ` Huang, Kai 2018-12-07 6:48 ` Jarkko Sakkinen 2018-12-07 11:57 ` Kirill A. Shutemov 2018-12-07 21:59 ` Sakkinen, Jarkko 2018-12-07 23:45 ` Sakkinen, Jarkko 2018-12-07 23:48 ` Andy Lutomirski 2018-12-08 1:33 ` Huang, Kai 2018-12-08 3:53 ` Sakkinen, Jarkko 2018-12-12 15:31 ` Sakkinen, Jarkko 2018-12-12 16:29 ` Andy Lutomirski 2018-12-12 16:43 ` Sakkinen, Jarkko 2018-12-12 23:27 ` Huang, Kai 2018-12-13 5:49 ` Sakkinen, Jarkko 2018-12-13 5:52 ` Sakkinen, Jarkko 2018-12-12 23:24 ` Huang, Kai 2018-12-07 23:35 ` Eric Rannaud 2018-12-05 23:49 ` Dave Hansen 2018-12-06 1:09 ` Andy Lutomirski 2018-12-06 1:25 ` Dan Williams 2018-12-06 15:39 ` Dave Hansen 2018-12-06 19:10 ` Andy Lutomirski 2018-12-06 19:31 ` Dave Hansen 2018-12-07 1:55 ` Huang, Kai 2018-12-07 4:23 ` Dave Hansen 2018-12-07 23:53 ` Andy Lutomirski 2018-12-08 1:11 ` Dave Hansen 2018-12-08 2:07 ` Huang, Kai 2018-12-05 20:30 ` Sakkinen, Jarkko
Reply instructions: You may reply publically to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=CALCETrXsh6wAy9kE_m1L+0yW8a6bNOb6g2Tf9nwpQJnyMzdSuw@mail.gmail.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Linux-Security-Module Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/linux-security-module/0 linux-security-module/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 linux-security-module linux-security-module/ https://lore.kernel.org/linux-security-module \ email@example.com firstname.lastname@example.org public-inbox-index linux-security-module Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.linux-security-module AGPL code for this site: git clone https://public-inbox.org/ public-inbox