lkml.org 
[lkml]   [2017]   [Jun]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v8 23/38] x86/realmode: Decrypt trampoline area if memory encryption is active
    Date
    When Secure Memory Encryption is enabled, the trampoline area must not
    be encrypted. A CPU running in real mode will not be able to decrypt
    memory that has been encrypted because it will not be able to use addresses
    with the memory encryption mask.

    Reviewed-by: Borislav Petkov <bp@suse.de>
    Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
    ---
    arch/x86/realmode/init.c | 8 ++++++++
    1 file changed, 8 insertions(+)

    diff --git a/arch/x86/realmode/init.c b/arch/x86/realmode/init.c
    index cd4be19..d6ddc7e 100644
    --- a/arch/x86/realmode/init.c
    +++ b/arch/x86/realmode/init.c
    @@ -1,6 +1,7 @@
    #include <linux/io.h>
    #include <linux/slab.h>
    #include <linux/memblock.h>
    +#include <linux/mem_encrypt.h>

    #include <asm/set_memory.h>
    #include <asm/pgtable.h>
    @@ -59,6 +60,13 @@ static void __init setup_real_mode(void)

    base = (unsigned char *)real_mode_header;

    + /*
    + * If SME is active, the trampoline area will need to be in
    + * decrypted memory in order to bring up other processors
    + * successfully.
    + */
    + set_memory_decrypted((unsigned long)base, size >> PAGE_SHIFT);
    +
    memcpy(base, real_mode_blob, size);

    phys_base = __pa(base);
    \
     
     \ /
      Last update: 2017-06-27 17:30    [W:3.245 / U:1.220 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site