[PATCH v15 03/16] s390, kexec_file: drop arch_kexec_mem_walk()

2018-09-27 Thread AKASHI Takahiro
Since s390 already knows where to locate buffers, calling arch_kexec_mem_walk() has no sense. So we can just drop it as kbuf->mem indicates this while all other architectures sets it to 0 initially. This change is a preparatory work for the next patch, where all the variant memory walks, either on

[PATCH v15 02/16] kexec_file: make kexec_image_post_load_cleanup_default() global

2018-09-27 Thread AKASHI Takahiro
Change this function from static to global so that arm64 can implement its own arch_kimage_file_post_load_cleanup() later using kexec_image_post_load_cleanup_default(). Signed-off-by: AKASHI Takahiro Acked-by: Dave Young Cc: Vivek Goyal Cc: Baoquan He --- include/linux/kexec.h | 1 + kernel/k

[PATCH v15 04/16] powerpc, kexec_file: factor out memblock-based arch_kexec_walk_mem()

2018-09-27 Thread AKASHI Takahiro
Memblock list is another source for usable system memory layout. So move powerpc's arch_kexec_walk_mem() to common code so that other memblock-based architectures, particularly arm64, can also utilise it. A moved function is now renamed to kexec_walk_memblock() and integrated into kexec_locate_mem_

[PATCH v15 00/16] arm64: kexec: add kexec_file_load() support

2018-09-27 Thread AKASHI Takahiro
This is the fifteenth round of implementing kexec_file_load() support on arm64.[1] (See "Changes" below) Most of the code is based on kexec-tools. # Since v15, we need a few prerequisite patches; See "Changes." # You will find them in [1], too. This patch series enables us to * load the kerne

[PATCH v15 01/16] asm-generic: add kexec_file_load system call to unistd.h

2018-09-27 Thread AKASHI Takahiro
The initial user of this system call number is arm64. Signed-off-by: AKASHI Takahiro Acked-by: Arnd Bergmann --- include/uapi/asm-generic/unistd.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h index

Re: [PATCH 3/3] resource: Fix find_next_iomem_res() iteration issue

2018-09-27 Thread lijiang
在 2018年09月27日 22:03, Bjorn Helgaas 写道: > On Thu, Sep 27, 2018 at 01:27:41PM +0800, lijiang wrote: >> 在 2018年09月25日 06:15, Bjorn Helgaas 写道: >>> From: Bjorn Helgaas >>> >>> Previously find_next_iomem_res() used "*res" as both an input parameter for >>> the range to search and the type of resource

Re: [PATCH v7 RESEND 2/4] kexec: allocate unencrypted control pages for kdump in case SME is enabled

2018-09-27 Thread lijiang
在 2018年09月28日 00:53, Borislav Petkov 写道: > On Thu, Sep 27, 2018 at 03:19:52PM +0800, Lianbo Jiang wrote: >> When SME is enabled in the first kernel, we will allocate unencrypted pages >> for kdump in order to be able to boot the kdump kernel like kexec. > > This is not what the commit does - it ma

Re: [PATCH v7 RESEND 1/4] x86/ioremap: add a function ioremap_encrypted() to remap kdump old memory

2018-09-27 Thread lijiang
在 2018年09月28日 00:10, Borislav Petkov 写道: > On Thu, Sep 27, 2018 at 10:53:47PM +0800, lijiang wrote: >> If no need to break this line, it will cause a warning of exceeding 80 >> characters per line. > > That's fine - we don't take the 80 cols rule blindly but apply common > sense. In this particul

Re: [PATCH v7 RESEND 2/4] kexec: allocate unencrypted control pages for kdump in case SME is enabled

2018-09-27 Thread Borislav Petkov
On Thu, Sep 27, 2018 at 03:19:52PM +0800, Lianbo Jiang wrote: > When SME is enabled in the first kernel, we will allocate unencrypted pages > for kdump in order to be able to boot the kdump kernel like kexec. This is not what the commit does - it marks the control pages as decrypted when SME. Why

Re: [PATCH v7 RESEND 1/4] x86/ioremap: add a function ioremap_encrypted() to remap kdump old memory

2018-09-27 Thread Borislav Petkov
On Thu, Sep 27, 2018 at 10:53:47PM +0800, lijiang wrote: > If no need to break this line, it will cause a warning of exceeding 80 > characters per line. That's fine - we don't take the 80 cols rule blindly but apply common sense. In this particular case the lines can stick out because they're sim

Re: [PATCH v7 RESEND 1/4] x86/ioremap: add a function ioremap_encrypted() to remap kdump old memory

2018-09-27 Thread lijiang
在 2018年09月27日 21:17, Borislav Petkov 写道: > On Thu, Sep 27, 2018 at 03:19:51PM +0800, Lianbo Jiang wrote: >> diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h >> index 6de64840dd22..f8795f9581c7 100644 >> --- a/arch/x86/include/asm/io.h >> +++ b/arch/x86/include/asm/io.h >> @@ -192,

[PATCH 3/3] resource: Fix find_next_iomem_res() iteration issue

2018-09-27 Thread Bjorn Helgaas
From: Bjorn Helgaas Previously find_next_iomem_res() used "*res" as both an input parameter for the range to search and the type of resource to search for, and an output parameter for the resource we found, which makes the interface confusing. The current callers use find_next_iomem_res() incorr

[PATCH 2/3] resource: Include resource end in walk_*() interfaces

2018-09-27 Thread Bjorn Helgaas
From: Bjorn Helgaas find_next_iomem_res() finds an iomem resource that covers part of a range described by "start, end". All callers expect that range to be inclusive, i.e., both start and end are included, but find_next_iomem_res() doesn't handle the end address correctly. If it finds an iomem

[PATCH 0/3] find_next_iomem_res() fixes

2018-09-27 Thread Bjorn Helgaas
These fix: - A kexec off-by-one error that we probably never see in practice (only affects a resource starting at exactly 640KB). - A corner case in walk_iomem_res_desc(), walk_system_ram_res(), etc that we probably also never see in practice (only affects a single byte resource a

[PATCH 1/3] x86/kexec: Correct KEXEC_BACKUP_SRC_END off-by-one error

2018-09-27 Thread Bjorn Helgaas
From: Bjorn Helgaas The only use of KEXEC_BACKUP_SRC_END is as an argument to walk_system_ram_res(): int crash_load_segments(struct kimage *image) { ... walk_system_ram_res(KEXEC_BACKUP_SRC_START, KEXEC_BACKUP_SRC_END, image, determine_backup_region); walk_sy

Re: [PATCH 3/3] resource: Fix find_next_iomem_res() iteration issue

2018-09-27 Thread Bjorn Helgaas
On Thu, Sep 27, 2018 at 01:27:41PM +0800, lijiang wrote: > 在 2018年09月25日 06:15, Bjorn Helgaas 写道: > > From: Bjorn Helgaas > > > > Previously find_next_iomem_res() used "*res" as both an input parameter for > > the range to search and the type of resource to search for, and an output > > parameter

Re: [PATCH v7 RESEND 1/4] x86/ioremap: add a function ioremap_encrypted() to remap kdump old memory

2018-09-27 Thread Borislav Petkov
On Thu, Sep 27, 2018 at 03:19:51PM +0800, Lianbo Jiang wrote: > diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h > index 6de64840dd22..f8795f9581c7 100644 > --- a/arch/x86/include/asm/io.h > +++ b/arch/x86/include/asm/io.h > @@ -192,6 +192,9 @@ extern void __iomem *ioremap_cache(r

Re: [PATCH] x86/boot: Fix kexec booting failure after SEV early boot support

2018-09-27 Thread Lendacky, Thomas
On 09/27/2018 07:38 AM, Kairui Song wrote: > Commit 1958b5fc4010 ("x86/boot: Add early boot support when running > with SEV active") is causing kexec becomes sometimes unstable even if > SEV is not active. kexec reboot won't start a second kernel bypassing > BIOS boot process, instead, the system g

[PATCH] x86/boot: Fix kexec booting failure after SEV early boot support

2018-09-27 Thread Kairui Song
Commit 1958b5fc4010 ("x86/boot: Add early boot support when running with SEV active") is causing kexec becomes sometimes unstable even if SEV is not active. kexec reboot won't start a second kernel bypassing BIOS boot process, instead, the system got reset. That's because, in get_sev_encryption_bi

Re: [PATCH v4 2/6] ima: prevent kexec_load syscall based on runtime secureboot flag

2018-09-27 Thread Mimi Zohar
[Cc'ing the kexec mailing list, and Seth] On Wed, 2018-09-26 at 17:52 +0530, Nayna Jain wrote: > When CONFIG_KEXEC_VERIFY_SIG is enabled, the kexec_file_load syscall > requires the kexec'd kernel image to be signed. Distros are concerned > about totally disabling the kexec_load syscall. As a compr

Re: [PATCH v4 1/6] x86/ima: define arch_ima_get_secureboot

2018-09-27 Thread Mimi Zohar
[Cc'ing the kexec mailing list, and Seth] On Wed, 2018-09-26 at 17:52 +0530, Nayna Jain wrote: > Distros are concerned about totally disabling the kexec_load syscall. > As a compromise, the kexec_load syscall will only be disabled when > CONFIG_KEXEC_VERIFY_SIG is configured and the system is boot

[PATCH v7 RESEND 4/4] kdump/vmcore: support encrypted old memory with SME enabled

2018-09-27 Thread Lianbo Jiang
In kdump kernel, we need to dump the old memory into vmcore file,if SME is enabled in the first kernel, we have to remap the old memory with the memory encryption mask, which will be automatically decrypted when we read from DRAM. For SME kdump, there are two cases that doesn't support:

[PATCH v7 RESEND 3/4] iommu/amd: Remap the device table of IOMMU with the memory encryption mask for kdump

2018-09-27 Thread Lianbo Jiang
In kdump kernel, it will copy the device table of IOMMU from the old device table, which is encrypted when SME is enabled in the first kernel. So we have to remap the old device table with the memory encryption mask. Signed-off-by: Lianbo Jiang Reviewed-by: Tom Lendacky Acked-by: Joerg Roedel -

[PATCH v7 RESEND 2/4] kexec: allocate unencrypted control pages for kdump in case SME is enabled

2018-09-27 Thread Lianbo Jiang
When SME is enabled in the first kernel, we will allocate unencrypted pages for kdump in order to be able to boot the kdump kernel like kexec. Signed-off-by: Lianbo Jiang Reviewed-by: Tom Lendacky --- kernel/kexec_core.c | 12 1 file changed, 12 insertions(+) diff --git a/kernel/k

[PATCH v7 RESEND 1/4] x86/ioremap: add a function ioremap_encrypted() to remap kdump old memory

2018-09-27 Thread Lianbo Jiang
When SME is enabled on AMD machine, the memory is encrypted in the first kernel. In this case, SME also needs to be enabled in kdump kernel, and we have to remap the old memory with the memory encryption mask. Here we only talk about the case that SME is active in the first kernel, and only care i

[PATCH v7 RESEND 0/4] Support kdump for AMD secure memory encryption(SME)

2018-09-27 Thread Lianbo Jiang
When SME is enabled on AMD machine, we also need to support kdump. Because the memory is encrypted in the first kernel, we will remap the old memory to the kdump kernel for dumping data, and SME is also enabled in the kdump kernel, otherwise the old memory can not be decrypted. For the kdump, it i