<feed xmlns='http://www.w3.org/2005/Atom'>
<title>lwn.git/arch/x86/kernel/kexec-bzimage64.c, branch automarkup</title>
<subtitle>Linux kernel documentation tree maintained by Jonathan Corbet</subtitle>
<id>http://mirrors.hust.edu.cn/git/lwn.git/atom?h=automarkup</id>
<link rel='self' href='http://mirrors.hust.edu.cn/git/lwn.git/atom?h=automarkup'/>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/'/>
<updated>2019-03-11T00:32:04+00:00</updated>
<entry>
<title>Merge branch 'next-integrity' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security</title>
<updated>2019-03-11T00:32:04+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2019-03-11T00:32:04+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=c3665a6be5de16cf6670a00003642114c44d8a70'/>
<id>urn:sha1:c3665a6be5de16cf6670a00003642114c44d8a70</id>
<content type='text'>
Pull integrity updates from James Morris:
 "Mimi Zohar says:

   'Linux 5.0 introduced the platform keyring to allow verifying the IMA
    kexec kernel image signature using the pre-boot keys. This pull
    request similarly makes keys on the platform keyring accessible for
    verifying the PE kernel image signature.

    Also included in this pull request is a new IMA hook that tags tmp
    files, in policy, indicating the file hash needs to be calculated.
    The remaining patches are cleanup'"

* 'next-integrity' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
  evm: Use defined constant for UUID representation
  ima: define ima_post_create_tmpfile() hook and add missing call
  evm: remove set but not used variable 'xattr'
  encrypted-keys: fix Opt_err/Opt_error = -1
  kexec, KEYS: Make use of platform keyring for signature verify
  integrity, KEYS: add a reference to platform keyring
</content>
</entry>
<entry>
<title>Merge branch 'x86-boot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip</title>
<updated>2019-03-07T21:35:41+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2019-03-07T21:35:41+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=37d18565e4c2d691286b88a5a4e70bcf563768f4'/>
<id>urn:sha1:37d18565e4c2d691286b88a5a4e70bcf563768f4</id>
<content type='text'>
Pull x86 boot updates from Ingo Molnar:
 "Most of the changes center around the difficult problem of KASLR
  pinning down hot-removable memory regions. At the very early stage
  KASRL is making irreversible kernel address layout decisions we don't
  have full knowledge about the memory maps yet.

  So the changes from Chao Fan add this (parsing the RSDP table early),
  together with fixes from Borislav Petkov"

* 'x86-boot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/boot/compressed/64: Do not read legacy ROM on EFI system
  x86/boot: Correct RSDP parsing with 32-bit EFI
  x86/kexec: Fill in acpi_rsdp_addr from the first kernel
  x86/boot: Fix randconfig build error due to MEMORY_HOTREMOVE
  x86/boot: Fix cmdline_find_option() prototype visibility
  x86/boot/KASLR: Limit KASLR to extract the kernel in immovable memory only
  x86/boot: Parse SRAT table and count immovable memory regions
  x86/boot: Early parse RSDP and save it in boot_params
  x86/boot: Search for RSDP in memory
  x86/boot: Search for RSDP in the EFI tables
  x86/boot: Add "acpi_rsdp=" early parsing
  x86/boot: Copy kstrtoull() to boot/string.c
  x86/boot: Build the command line parsing code unconditionally
</content>
</entry>
<entry>
<title>x86/kexec: Fill in acpi_rsdp_addr from the first kernel</title>
<updated>2019-02-06T14:29:03+00:00</updated>
<author>
<name>Kairui Song</name>
<email>kasong@redhat.com</email>
</author>
<published>2019-02-04T17:38:52+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=ccec81e4251f5a5421e02874e394338a897056ca'/>
<id>urn:sha1:ccec81e4251f5a5421e02874e394338a897056ca</id>
<content type='text'>
When efi=noruntime or efi=oldmap is used on the kernel command line, EFI
services won't be available in the second kernel, therefore the second
kernel will not be able to get the ACPI RSDP address from firmware by
calling EFI services and so it won't boot.

Commit

  e6e094e053af ("x86/acpi, x86/boot: Take RSDP address from boot params if available")

added an acpi_rsdp_addr field to boot_params which stores the RSDP
address for other kernel users.

Recently, after

  3a63f70bf4c3 ("x86/boot: Early parse RSDP and save it in boot_params")

the acpi_rsdp_addr will always be filled with a valid RSDP address.

So fill in that value into the second kernel's boot_params thus ensuring
that the second kernel receives the RSDP value from the first kernel.

 [ bp: massage commit message. ]

Signed-off-by: Kairui Song &lt;kasong@redhat.com&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Cc: AKASHI Takahiro &lt;takahiro.akashi@linaro.org&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Baoquan He &lt;bhe@redhat.com&gt;
Cc: Chao Fan &lt;fanc.fnst@cn.fujitsu.com&gt;
Cc: Dave Young &lt;dyoung@redhat.com&gt;
Cc: David Howells &lt;dhowells@redhat.com&gt;
Cc: "H. Peter Anvin" &lt;hpa@zytor.com&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: kexec@lists.infradead.org
Cc: Philipp Rudo &lt;prudo@linux.vnet.ibm.com&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: x86-ml &lt;x86@kernel.org&gt;
Cc: Yannik Sembritzki &lt;yannik@sembritzki.me&gt;
Link: https://lkml.kernel.org/r/20190204173852.4863-1-kasong@redhat.com
</content>
</entry>
<entry>
<title>kexec, KEYS: Make use of platform keyring for signature verify</title>
<updated>2019-02-04T22:34:07+00:00</updated>
<author>
<name>Kairui Song</name>
<email>kasong@redhat.com</email>
</author>
<published>2019-01-21T09:59:29+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=278311e417be60f7caef6fcb12bda4da2711ceff'/>
<id>urn:sha1:278311e417be60f7caef6fcb12bda4da2711ceff</id>
<content type='text'>
This patch allows the kexec_file_load syscall to verify the PE signed
kernel image signature based on the preboot keys stored in the .platform
keyring, as fall back, if the signature verification failed due to not
finding the public key in the secondary or builtin keyrings.

This commit adds a VERIFY_USE_PLATFORM_KEYRING similar to previous
VERIFY_USE_SECONDARY_KEYRING indicating that verify_pkcs7_signature
should verify the signature using platform keyring.  Also, decrease
the error message log level when verification failed with -ENOKEY,
so that if called tried multiple time with different keyring it
won't generate extra noises.

Signed-off-by: Kairui Song &lt;kasong@redhat.com&gt;
Cc: David Howells &lt;dhowells@redhat.com&gt;
Acked-by: Dave Young &lt;dyoung@redhat.com&gt; (for kexec_file_load part)
[zohar@linux.ibm.com: tweaked the first paragraph of the patch description,
 and fixed checkpatch warning.]
Signed-off-by: Mimi Zohar &lt;zohar@linux.ibm.com&gt;
</content>
</entry>
<entry>
<title>x86/kexec: Don't setup EFI info if EFI runtime is not enabled</title>
<updated>2019-02-01T17:18:54+00:00</updated>
<author>
<name>Kairui Song</name>
<email>kasong@redhat.com</email>
</author>
<published>2019-01-18T11:13:08+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=2aa958c99c7fd3162b089a1a56a34a0cdb778de1'/>
<id>urn:sha1:2aa958c99c7fd3162b089a1a56a34a0cdb778de1</id>
<content type='text'>
Kexec-ing a kernel with "efi=noruntime" on the first kernel's command
line causes the following null pointer dereference:

  BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
  #PF error: [normal kernel read fault]
  Call Trace:
   efi_runtime_map_copy+0x28/0x30
   bzImage64_load+0x688/0x872
   arch_kexec_kernel_image_load+0x6d/0x70
   kimage_file_alloc_init+0x13e/0x220
   __x64_sys_kexec_file_load+0x144/0x290
   do_syscall_64+0x55/0x1a0
   entry_SYSCALL_64_after_hwframe+0x44/0xa9

Just skip the EFI info setup if EFI runtime services are not enabled.

 [ bp: Massage commit message. ]

Suggested-by: Dave Young &lt;dyoung@redhat.com&gt;
Signed-off-by: Kairui Song &lt;kasong@redhat.com&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Acked-by: Dave Young &lt;dyoung@redhat.com&gt;
Cc: AKASHI Takahiro &lt;takahiro.akashi@linaro.org&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Ard Biesheuvel &lt;ard.biesheuvel@linaro.org&gt;
Cc: bhe@redhat.com
Cc: David Howells &lt;dhowells@redhat.com&gt;
Cc: erik.schmauss@intel.com
Cc: fanc.fnst@cn.fujitsu.com
Cc: "H. Peter Anvin" &lt;hpa@zytor.com&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: kexec@lists.infradead.org
Cc: lenb@kernel.org
Cc: linux-acpi@vger.kernel.org
Cc: Philipp Rudo &lt;prudo@linux.vnet.ibm.com&gt;
Cc: rafael.j.wysocki@intel.com
Cc: robert.moore@intel.com
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: x86-ml &lt;x86@kernel.org&gt;
Cc: Yannik Sembritzki &lt;yannik@sembritzki.me&gt;
Link: https://lkml.kernel.org/r/20190118111310.29589-2-kasong@redhat.com
</content>
</entry>
<entry>
<title>x86/kexec: Fix a kexec_file_load() failure</title>
<updated>2019-01-15T11:12:50+00:00</updated>
<author>
<name>Dave Young</name>
<email>dyoung@redhat.com</email>
</author>
<published>2018-12-28T01:12:47+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=993a110319a4a60aadbd02f6defdebe048f7773b'/>
<id>urn:sha1:993a110319a4a60aadbd02f6defdebe048f7773b</id>
<content type='text'>
Commit

  b6664ba42f14 ("s390, kexec_file: drop arch_kexec_mem_walk()")

changed the behavior of kexec_locate_mem_hole(): it will try to allocate
free memory only when kbuf.mem is initialized to zero.

However, x86's kexec_file_load() implementation reuses a struct
kexec_buf allocated on the stack and its kbuf.mem member gets set by
each kexec_add_buffer() invocation.

The second kexec_add_buffer() will reuse the same kbuf but not
reinitialize kbuf.mem.

Therefore, explictily reset kbuf.mem each time in order for
kexec_locate_mem_hole() to locate a free memory region each time.

 [ bp: massage commit message. ]

Fixes: b6664ba42f14 ("s390, kexec_file: drop arch_kexec_mem_walk()")
Signed-off-by: Dave Young &lt;dyoung@redhat.com&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Acked-by: Baoquan He &lt;bhe@redhat.com&gt;
Cc: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Cc: "H. Peter Anvin" &lt;hpa@zytor.com&gt;
Cc: AKASHI Takahiro &lt;takahiro.akashi@linaro.org&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Martin Schwidefsky &lt;schwidefsky@de.ibm.com&gt;
Cc: Philipp Rudo &lt;prudo@linux.vnet.ibm.com&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Vivek Goyal &lt;vgoyal@redhat.com&gt;
Cc: Yannik Sembritzki &lt;yannik@sembritzki.me&gt;
Cc: Yi Wang &lt;wang.yi59@zte.com.cn&gt;
Cc: kexec@lists.infradead.org
Cc: x86-ml &lt;x86@kernel.org&gt;
Link: https://lkml.kernel.org/r/20181228011247.GA9999@dhcp-128-65.nay.redhat.com
</content>
</entry>
<entry>
<title>Fix kexec forbidding kernels signed with keys in the secondary keyring to boot</title>
<updated>2018-08-16T16:57:20+00:00</updated>
<author>
<name>Yannik Sembritzki</name>
<email>yannik@sembritzki.me</email>
</author>
<published>2018-08-16T13:05:23+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=ea93102f32244e3f45c8b26260be77ed0cc1d16c'/>
<id>urn:sha1:ea93102f32244e3f45c8b26260be77ed0cc1d16c</id>
<content type='text'>
The split of .system_keyring into .builtin_trusted_keys and
.secondary_trusted_keys broke kexec, thereby preventing kernels signed by
keys which are now in the secondary keyring from being kexec'd.

Fix this by passing VERIFY_USE_SECONDARY_KEYRING to
verify_pefile_signature().

Fixes: d3bfe84129f6 ("certs: Add a secondary system keyring that can be added to dynamically")
Signed-off-by: Yannik Sembritzki &lt;yannik@sembritzki.me&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Cc: kexec@lists.infradead.org
Cc: keyrings@vger.kernel.org
Cc: linux-security-module@vger.kernel.org
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>kexec_file: do not add extra alignment to efi memmap</title>
<updated>2018-04-21T00:18:36+00:00</updated>
<author>
<name>Dave Young</name>
<email>dyoung@redhat.com</email>
</author>
<published>2018-04-20T21:56:10+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=a841aa83dff0af75c88aa846ba610a8af4c5ee21'/>
<id>urn:sha1:a841aa83dff0af75c88aa846ba610a8af4c5ee21</id>
<content type='text'>
Chun-Yi reported a kernel warning message below:

  WARNING: CPU: 0 PID: 0 at ../mm/early_ioremap.c:182 early_iounmap+0x4f/0x12c()
  early_iounmap(ffffffffff200180, 00000118) [0] size not consistent 00000120

The problem is x86 kexec_file_load adds extra alignment to the efi
memmap: in bzImage64_load():

        efi_map_sz = efi_get_runtime_map_size();
        efi_map_sz = ALIGN(efi_map_sz, 16);

And __efi_memmap_init maps with the size including the alignment bytes
but efi_memmap_unmap use nr_maps * desc_size which does not include the
extra bytes.

The alignment in kexec code is only needed for the kexec buffer internal
use Actually kexec should pass exact size of the efi memmap to 2nd
kernel.

Link: http://lkml.kernel.org/r/20180417083600.GA1972@dhcp-128-65.nay.redhat.com
Signed-off-by: Dave Young &lt;dyoung@redhat.com&gt;
Reported-by: joeyli &lt;jlee@suse.com&gt;
Tested-by: Randy Wright &lt;rwright@hpe.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>kernel/kexec_file.c: allow archs to set purgatory load address</title>
<updated>2018-04-14T00:10:28+00:00</updated>
<author>
<name>Philipp Rudo</name>
<email>prudo@linux.vnet.ibm.com</email>
</author>
<published>2018-04-13T22:36:43+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=3be3f61d25e04ecf90d65d52fad632af5ba8805b'/>
<id>urn:sha1:3be3f61d25e04ecf90d65d52fad632af5ba8805b</id>
<content type='text'>
For s390 new kernels are loaded to fixed addresses in memory before they
are booted.  With the current code this is a problem as it assumes the
kernel will be loaded to an 'arbitrary' address.  In particular,
kexec_locate_mem_hole searches for a large enough memory region and sets
the load address (kexec_bufer-&gt;mem) to it.

Luckily there is a simple workaround for this problem.  By returning 1
in arch_kexec_walk_mem, kexec_locate_mem_hole is turned off.  This
allows the architecture to set kbuf-&gt;mem by hand.  While the trick works
fine for the kernel it does not for the purgatory as here the
architectures don't have access to its kexec_buffer.

Give architectures access to the purgatories kexec_buffer by changing
kexec_load_purgatory to take a pointer to it.  With this change
architectures have access to the buffer and can edit it as they need.

A nice side effect of this change is that we can get rid of the
purgatory_info-&gt;purgatory_load_address field.  As now the information
stored there can directly be accessed from kbuf-&gt;mem.

Link: http://lkml.kernel.org/r/20180321112751.22196-11-prudo@linux.vnet.ibm.com
Signed-off-by: Philipp Rudo &lt;prudo@linux.vnet.ibm.com&gt;
Reviewed-by: Martin Schwidefsky &lt;schwidefsky@de.ibm.com&gt;
Acked-by: Dave Young &lt;dyoung@redhat.com&gt;
Cc: AKASHI Takahiro &lt;takahiro.akashi@linaro.org&gt;
Cc: Eric Biederman &lt;ebiederm@xmission.com&gt;
Cc: Heiko Carstens &lt;heiko.carstens@de.ibm.com&gt;
Cc: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Cc: Thiago Jung Bauermann &lt;bauerman@linux.vnet.ibm.com&gt;
Cc: Vivek Goyal &lt;vgoyal@redhat.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>kexec_file,x86,powerpc: factor out kexec_file_ops functions</title>
<updated>2018-04-14T00:10:27+00:00</updated>
<author>
<name>AKASHI Takahiro</name>
<email>takahiro.akashi@linaro.org</email>
</author>
<published>2018-04-13T22:35:49+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=9ec4ecef0af7790551109283ca039a7c52de343c'/>
<id>urn:sha1:9ec4ecef0af7790551109283ca039a7c52de343c</id>
<content type='text'>
As arch_kexec_kernel_image_{probe,load}(),
arch_kimage_file_post_load_cleanup() and arch_kexec_kernel_verify_sig()
are almost duplicated among architectures, they can be commonalized with
an architecture-defined kexec_file_ops array.  So let's factor them out.

Link: http://lkml.kernel.org/r/20180306102303.9063-3-takahiro.akashi@linaro.org
Signed-off-by: AKASHI Takahiro &lt;takahiro.akashi@linaro.org&gt;
Acked-by: Dave Young &lt;dyoung@redhat.com&gt;
Tested-by: Dave Young &lt;dyoung@redhat.com&gt;
Cc: Vivek Goyal &lt;vgoyal@redhat.com&gt;
Cc: Baoquan He &lt;bhe@redhat.com&gt;
Cc: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Cc: Thiago Jung Bauermann &lt;bauerman@linux.vnet.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
