linux/arch
Heiko Carstens 793d5cc701 s390/hibernate: fix save and restore of kernel text section
commit d744194956 upstream.

Sebastian reported a crash caused by a jump label mismatch after resume.
This happens because we do not save the kernel text section during suspend
and therefore also do not restore it during resume, but use the kernel image
that restores the old system.

This means that after a suspend/resume cycle we lost all modifications done
to the kernel text section.
The reason for this is the pfn_is_nosave() function, which incorrectly
returns that read-only pages don't need to be saved. This is incorrect since
we mark the kernel text section read-only.
We still need to make sure to not save and restore pages contained within
NSS and DCSS segment.
To fix this add an extra case for the kernel text section and only save
those pages if they are not contained within an NSS segment.

Fixes the following crash (and the above bugs as well):

Jump label code mismatch at netif_receive_skb_internal+0x28/0xd0
Found:    c0 04 00 00 00 00
Expected: c0 f4 00 00 00 11
New:      c0 04 00 00 00 00
Kernel panic - not syncing: Corrupted kernel text
CPU: 0 PID: 9 Comm: migration/0 Not tainted 3.19.0-01975-gb1b096e70f23 #4
Call Trace:
  [<0000000000113972>] show_stack+0x72/0xf0
  [<000000000081f15e>] dump_stack+0x6e/0x90
  [<000000000081c4e8>] panic+0x108/0x2b0
  [<000000000081be64>] jump_label_bug.isra.2+0x104/0x108
  [<0000000000112176>] __jump_label_transform+0x9e/0xd0
  [<00000000001121e6>] __sm_arch_jump_label_transform+0x3e/0x50
  [<00000000001d1136>] multi_cpu_stop+0x12e/0x170
  [<00000000001d1472>] cpu_stopper_thread+0xb2/0x168
  [<000000000015d2ac>] smpboot_thread_fn+0x134/0x1b0
  [<0000000000158baa>] kthread+0x10a/0x110
  [<0000000000824a86>] kernel_thread_starter+0x6/0xc

Reported-and-tested-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-06 21:56:21 +02:00
..
alpha vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
arc arc: mm: Fix build failure 2015-04-29 10:34:01 +02:00
arm ARM: at91: pm: fix at91rm9200 standby 2015-03-26 15:01:01 +01:00
arm64 arm64: compat Fix siginfo_t -> compat_siginfo_t conversion on big endian 2015-03-06 14:40:52 -08:00
avr32 vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
blackfin blackfin updates for Linux 3.10 2013-05-10 07:21:16 -07:00
c6x arch: c6x: mm: include "asm/uaccess.h" to pass compiling 2013-07-21 18:21:29 -07:00
cris vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
frv vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
h8300 We get rid of the general module prefix confusion with a binary config option, 2013-05-05 10:58:06 -07:00
hexagon arch: mm: pass userspace fault flag to generic fault handler 2014-11-21 09:22:56 -08:00
ia64 vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
m32r vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
m68k vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
metag vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
microblaze vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
mips vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
mn10300 vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
openrisc vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
parisc vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
powerpc vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
s390 s390/hibernate: fix save and restore of kernel text section 2015-05-06 21:56:21 +02:00
score vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
sh vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
sparc vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
tile vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
um vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
unicore32 arch: mm: pass userspace fault flag to generic fault handler 2014-11-21 09:22:56 -08:00
x86 x86: mm: move mmap_sem unlock from mm_fault_error() to caller 2015-04-29 10:34:01 +02:00
xtensa vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
.gitignore
Kconfig microblaze: fix clone syscall 2013-08-20 08:43:02 -07:00