]> git.baikalelectronics.ru Git - kernel.git/commit
s390/kdump: Add final note
authorMichael Holzheu <holzheu@linux.vnet.ibm.com>
Thu, 23 Mar 2017 20:02:54 +0000 (21:02 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 28 Mar 2017 14:54:31 +0000 (16:54 +0200)
commitd7d1f371f7ad959d0c7f47fdf0744298edbaf561
tree32c979eaa52f47e762f28cba9e1853830ede0649
parent2b8d757667dba8c52b6a919e25bc9a9e9976511b
s390/kdump: Add final note

Since linux v3.14 with commit 42ef7b70f76fb9c14 ("vmcore: prevent PT_NOTE
p_memsz overflow during header update") on s390 we get the following
message in the kdump kernel:

  Warning: Exceeded p_memsz, dropping PT_NOTE entry n_namesz=0x6b6b6b6b,
  n_descsz=0x6b6b6b6b

The reason for this is that we don't create a final zero note in
the ELF header which the proc/vmcore code uses to find out the end
of the notes section (see also kernel/kexec_core.c:final_note()).

It still worked on s390 by chance because we (most of the time?) have the
byte pattern 0x6b6b6b6b after the notes section which also makes the notes
parsing code stop in update_note_header_size_elf64() because 0x6b6b6b6b is
interpreded as note size:

  if ((real_sz + sz) > max_sz) {
          pr_warn("Warning: Exceeded p_memsz, dropping P ...);
          break;
  }

So fix this and add the missing final note to the ELF header.
We don't have to adjust the memory size for ELF header ("alloc_size")
because the new ELF note still fits into the 0x1000 base memory.

Cc: stable@vger.kernel.org # v4.4+
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/kernel/crash_dump.c