<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/x86/kernel/crash.c, branch linux-5.12.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.12.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.12.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2021-04-20T15:32:46Z</updated>
<entry>
<title>x86/crash: Fix crash_setup_memmap_entries() out-of-bounds access</title>
<updated>2021-04-20T15:32:46Z</updated>
<author>
<name>Mike Galbraith</name>
</author>
<published>2021-04-16T12:02:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5849cdf8c120e3979c57d34be55b92d90a77a47e'/>
<id>urn:sha1:5849cdf8c120e3979c57d34be55b92d90a77a47e</id>
<content type='text'>
Commit in Fixes: added support for kexec-ing a kernel on panic using a
new system call. As part of it, it does prepare a memory map for the new
kernel.

However, while doing so, it wrongly accesses memory it has not
allocated: it accesses the first element of the cmem-&gt;ranges[] array in
memmap_exclude_ranges() but it has not allocated the memory for it in
crash_setup_memmap_entries(). As KASAN reports:

  BUG: KASAN: vmalloc-out-of-bounds in crash_setup_memmap_entries+0x17e/0x3a0
  Write of size 8 at addr ffffc90000426008 by task kexec/1187

  (gdb) list *crash_setup_memmap_entries+0x17e
  0xffffffff8107cafe is in crash_setup_memmap_entries (arch/x86/kernel/crash.c:322).
  317                                      unsigned long long mend)
  318     {
  319             unsigned long start, end;
  320
  321             cmem-&gt;ranges[0].start = mstart;
  322             cmem-&gt;ranges[0].end = mend;
  323             cmem-&gt;nr_ranges = 1;
  324
  325             /* Exclude elf header region */
  326             start = image-&gt;arch.elf_load_addr;
  (gdb)

Make sure the ranges array becomes a single element allocated.

 [ bp: Write a proper commit message. ]

Fixes: dd5f726076cc ("kexec: support for kexec on panic using new system call")
Signed-off-by: Mike Galbraith &lt;efault@gmx.de&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Reviewed-by: Dave Young &lt;dyoung@redhat.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Link: https://lkml.kernel.org/r/725fa3dc1da2737f0f6188a1a9701bead257ea9d.camel@gmx.de
</content>
</entry>
<entry>
<title>x86/crash: Correct the address boundary of function parameters</title>
<updated>2020-08-06T23:32:00Z</updated>
<author>
<name>Lianbo Jiang</name>
</author>
<published>2020-08-04T04:49:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a3e1c3bb24e2ff2927af5e30c2bebe669bb84196'/>
<id>urn:sha1:a3e1c3bb24e2ff2927af5e30c2bebe669bb84196</id>
<content type='text'>
Let's carefully handle the boundary of the function parameter to make
sure that the arguments passed doesn't exceed the address range.

Signed-off-by: Lianbo Jiang &lt;lijiang@redhat.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Acked-by: Dave Young &lt;dyoung@redhat.com&gt;
Link: https://lore.kernel.org/r/20200804044933.1973-2-lijiang@redhat.com
</content>
</entry>
<entry>
<title>x86/crash: Use resource_size()</title>
<updated>2020-01-09T13:40:03Z</updated>
<author>
<name>Julia Lawall</name>
</author>
<published>2020-01-01T17:49:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1429b568ad71943a374aa4a8d3772d5a8816ddba'/>
<id>urn:sha1:1429b568ad71943a374aa4a8d3772d5a8816ddba</id>
<content type='text'>
Use resource_size() rather than a verbose computation on
the end and start fields.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

&lt;smpl&gt;
@@ struct resource ptr; @@
- (ptr.end - ptr.start + 1)
+ resource_size(&amp;ptr)
&lt;/smpl&gt;

Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Link: https://lkml.kernel.org/r/1577900990-8588-10-git-send-email-Julia.Lawall@inria.fr
</content>
</entry>
<entry>
<title>x86/crash: Align function arguments on opening braces</title>
<updated>2019-11-14T17:24:55Z</updated>
<author>
<name>Borislav Petkov</name>
</author>
<published>2019-11-14T15:11:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9eff303725da6530b615e9258f696149baa51df6'/>
<id>urn:sha1:9eff303725da6530b615e9258f696149baa51df6</id>
<content type='text'>
... or let function calls stick out and thus remain on a single line,
even if the 80 cols rule is violated by a couple of chars, for better
readability.

No functional changes.

Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Cc: x86@kernel.org
Link: https://lkml.kernel.org/r/20191114172200.19563-1-bp@alien8.de
</content>
</entry>
<entry>
<title>x86/kdump: Remove the backup region handling</title>
<updated>2019-11-14T17:24:43Z</updated>
<author>
<name>Lianbo Jiang</name>
</author>
<published>2019-11-08T09:00:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7c321eb2b843bf25946100b7e2de4054f71ec068'/>
<id>urn:sha1:7c321eb2b843bf25946100b7e2de4054f71ec068</id>
<content type='text'>
When the crashkernel kernel command line option is specified, the low
1M memory will always be reserved now. Therefore, it's not necessary to
create a backup region anymore and also no need to copy the contents of
the first 640k to it.

Remove all the code related to handling that backup region.

 [ bp: Massage commit message. ]

Signed-off-by: Lianbo Jiang &lt;lijiang@redhat.com&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Cc: bhe@redhat.com
Cc: Dave Young &lt;dyoung@redhat.com&gt;
Cc: d.hatayama@fujitsu.com
Cc: dhowells@redhat.com
Cc: ebiederm@xmission.com
Cc: horms@verge.net.au
Cc: "H. Peter Anvin" &lt;hpa@zytor.com&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Jürgen Gross &lt;jgross@suse.com&gt;
Cc: kexec@lists.infradead.org
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Tom Lendacky &lt;thomas.lendacky@amd.com&gt;
Cc: vgoyal@redhat.com
Cc: x86-ml &lt;x86@kernel.org&gt;
Link: https://lkml.kernel.org/r/20191108090027.11082-3-lijiang@redhat.com
</content>
</entry>
<entry>
<title>x86/kdump: Always reserve the low 1M when the crashkernel option is specified</title>
<updated>2019-11-14T12:54:33Z</updated>
<author>
<name>Lianbo Jiang</name>
</author>
<published>2019-11-08T09:00:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6f599d84231fd27e42f4ca2a786a6641e8cddf00'/>
<id>urn:sha1:6f599d84231fd27e42f4ca2a786a6641e8cddf00</id>
<content type='text'>
On x86, purgatory() copies the first 640K of memory to a backup region
because the kernel needs those first 640K for the real mode trampoline
during boot, among others.

However, when SME is enabled, the kernel cannot properly copy the old
memory to the backup area but reads only its encrypted contents. The
result is that the crash tool gets invalid pointers when parsing vmcore:

  crash&gt; kmem -s|grep -i invalid
  kmem: dma-kmalloc-512: slab:ffffd77680001c00 invalid freepointer:a6086ac099f0c5a4
  kmem: dma-kmalloc-512: slab:ffffd77680001c00 invalid freepointer:a6086ac099f0c5a4
  crash&gt;

So reserve the remaining low 1M memory when the crashkernel option is
specified (after reserving real mode memory) so that allocated memory
does not fall into the low 1M area and thus the copying of the contents
of the first 640k to a backup region in purgatory() can be avoided
altogether.

This way, it does not need to be included in crash dumps or used for
anything except the trampolines that must live in the low 1M.

 [ bp: Heavily rewrite commit message, flip check logic in
   crash_reserve_low_1M().]

Signed-off-by: Lianbo Jiang &lt;lijiang@redhat.com&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Cc: bhe@redhat.com
Cc: Dave Young &lt;dyoung@redhat.com&gt;
Cc: d.hatayama@fujitsu.com
Cc: dhowells@redhat.com
Cc: ebiederm@xmission.com
Cc: horms@verge.net.au
Cc: "H. Peter Anvin" &lt;hpa@zytor.com&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Jürgen Gross &lt;jgross@suse.com&gt;
Cc: kexec@lists.infradead.org
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Tom Lendacky &lt;thomas.lendacky@amd.com&gt;
Cc: vgoyal@redhat.com
Cc: x86-ml &lt;x86@kernel.org&gt;
Link: https://lkml.kernel.org/r/20191108090027.11082-2-lijiang@redhat.com
Link: https://bugzilla.kernel.org/show_bug.cgi?id=204793
</content>
</entry>
<entry>
<title>x86/crash: Remove unnecessary comparison</title>
<updated>2019-07-24T14:50:15Z</updated>
<author>
<name>Nikolas Nyby</name>
</author>
<published>2019-07-24T04:13:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4599c6671b8119ed5455e4ed6b967b461c27a9f7'/>
<id>urn:sha1:4599c6671b8119ed5455e4ed6b967b461c27a9f7</id>
<content type='text'>
The ret comparison and return are unnecessary as of commit f296f2634920
("x86/kexec: Remove walk_iomem_res() call with GART type")

elf_header_exclude_ranges() returns ret in any case, with or without this
comparison.

[ tglx: Use a proper commit reference instead of full SHA ]

Signed-off-by: Nikolas Nyby &lt;nikolas@gnu.org&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Link: https://lkml.kernel.org/r/20190724041337.8346-1-nikolas@gnu.org

</content>
</entry>
<entry>
<title>Merge branch 'x86-kdump-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip</title>
<updated>2019-07-09T18:52:34Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2019-07-09T18:52:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=565eb5f8c5d379b6a6a3134c76b2fcfecdd007d3'/>
<id>urn:sha1:565eb5f8c5d379b6a6a3134c76b2fcfecdd007d3</id>
<content type='text'>
Pull x865 kdump updates from Thomas Gleixner:
 "Yet more kexec/kdump updates:

   - Properly support kexec when AMD's memory encryption (SME) is
     enabled

   - Pass reserved e820 ranges to the kexec kernel so both PCI and SME
     can work"

* 'x86-kdump-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  fs/proc/vmcore: Enable dumping of encrypted memory when SEV was active
  x86/kexec: Set the C-bit in the identity map page table when SEV is active
  x86/kexec: Do not map kexec area as decrypted when SEV is active
  x86/crash: Add e820 reserved ranges to kdump kernel's e820 table
  x86/mm: Rework ioremap resource mapping determination
  x86/e820, ioport: Add a new I/O resource descriptor IORES_DESC_RESERVED
  x86/mm: Create a workarea in the kernel for SME early encryption
  x86/mm: Identify the end of the kernel area to be reserved
</content>
</entry>
<entry>
<title>Merge branch 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip</title>
<updated>2019-07-09T00:27:24Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2019-07-09T00:27:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5b7a2095232d026d4537c4be54040c0f10525b5b'/>
<id>urn:sha1:5b7a2095232d026d4537c4be54040c0f10525b5b</id>
<content type='text'>
Pull x86 cleanups from Ingo Molnar:
 "Misc small cleanups: removal of superfluous code and coding style
  cleanups mostly"

* 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/kexec: Make variable static and config dependent
  x86/defconfigs: Remove useless UEVENT_HELPER_PATH
  x86/amd_nb: Make hygon_nb_misc_ids static
  x86/tsc: Move inline keyword to the beginning of function declarations
  x86/io_delay: Define IO_DELAY macros in C instead of Kconfig
  x86/io_delay: Break instead of fallthrough in switch statement
</content>
</entry>
<entry>
<title>x86/kexec: Make variable static and config dependent</title>
<updated>2019-06-26T14:02:45Z</updated>
<author>
<name>Tiezhu Yang</name>
</author>
<published>2019-06-24T04:41:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=53b7607382b0b99d6ae1ef5b1b0fa042b00ac7f4'/>
<id>urn:sha1:53b7607382b0b99d6ae1ef5b1b0fa042b00ac7f4</id>
<content type='text'>
The following sparse warning is emitted:

  arch/x86/kernel/crash.c:59:15:
  warning: symbol 'crash_zero_bytes' was not declared. Should it be static?

The variable is only used in this compilation unit, but it is also only
used when CONFIG_KEXEC_FILE is enabled. Just making it static would result
in a 'defined but not used' warning for CONFIG_KEXEC_FILE=n.

Make it static and move it into the existing CONFIG_KEXEC_FILE section.

[ tglx: Massaged changelog and moved it into the existing ifdef ]

Fixes: dd5f726076cc ("kexec: support for kexec on panic using new system call")
Signed-off-by: Tiezhu Yang &lt;kernelpatch@126.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Acked-by: Dave Young &lt;dyoung@redhat.com&gt;
Cc: bp@alien8.de
Cc: hpa@zytor.com
Cc: kexec@lists.infradead.org
Cc: vgoyal@redhat.com
Cc: Vivek Goyal &lt;vgoyal@redhat.com&gt;
Link: https://lkml.kernel.org/r/117ef0c6.3d30.16b87c9cfbf.Coremail.kernelpatch@126.com
</content>
</entry>
</feed>
