• Lianbo Jiang's avatar
    fs/proc/vmcore: Enable dumping of encrypted memory when SEV was active · 4eb5fec3
    Lianbo Jiang authored
    In the kdump kernel, the memory of the first kernel gets to be dumped
    into a vmcore file.
    
    Similarly to SME kdump, if SEV was enabled in the first kernel, the old
    memory has to be remapped encrypted in order to access it properly.
    
    Commit
    
      992b649a ("kdump, proc/vmcore: Enable kdumping encrypted memory with SME enabled")
    
    took care of the SME case but it uses sme_active() which checks for SME
    only. Use mem_encrypt_active() instead, which returns true when either
    SME or SEV is active.
    
    Unlike SME, the second kernel images (kernel and initrd) are loaded into
    encrypted memory when SEV is active, hence the kernel elf header must be
    remapped as encrypted in order to access it properly.
    
     [ bp: Massage commit message. ]
    Co-developed-by: default avatarBrijesh Singh <brijesh.singh@amd.com>
    Signed-off-by: default avatarBrijesh Singh <brijesh.singh@amd.com>
    Signed-off-by: default avatarLianbo Jiang <lijiang@redhat.com>
    Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
    Cc: Alexey Dobriyan <adobriyan@gmail.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: bhe@redhat.com
    Cc: dyoung@redhat.com
    Cc: Ganesh Goudar <ganeshgr@chelsio.com>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: kexec@lists.infradead.org
    Cc: linux-fsdevel@vger.kernel.org
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
    Cc: mingo@redhat.com
    Cc: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
    Cc: Souptick Joarder <jrdr.linux@gmail.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Tom Lendacky <thomas.lendacky@amd.com>
    Cc: x86-ml <x86@kernel.org>
    Link: https://lkml.kernel.org/r/20190430074421.7852-4-lijiang@redhat.com
    4eb5fec3
vmcore.c 40 KB