s390/noexec: execute kexec datamover without DAT
Rebooting into a new kernel with kexec fails (system dies) if tried on
a machine that has no-execute support. Reason for this is that the so
called datamover code gets executed with DAT on (MMU is active) and
the page that contains the datamover is marked as non-executable.
Therefore when branching into the datamover an unexpected program
check happens and afterwards the machine is dead.
This can be simply avoided by disabling DAT, which also disables any
no-execute checks, just before the datamover gets executed.
In fact the first thing done by the datamover is to disable DAT. The
code in the datamover that disables DAT can be removed as well.
Thanks to Michael Holzheu and Gerald Schaefer for tracking this down.
Reviewed-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Reviewed-by: Philipp Rudo <prudo@linux.vnet.ibm.com>
Cc: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Fixes: 57d7f939e7
("s390: add no-execute support")
Cc: <stable@vger.kernel.org> # v4.11+
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
This commit is contained in:
parent
a1c5befc1c
commit
d0e810eeb3
|
@ -265,6 +265,7 @@ static void __do_machine_kexec(void *data)
|
||||||
s390_reset_system();
|
s390_reset_system();
|
||||||
data_mover = (relocate_kernel_t) page_to_phys(image->control_code_page);
|
data_mover = (relocate_kernel_t) page_to_phys(image->control_code_page);
|
||||||
|
|
||||||
|
__arch_local_irq_stnsm(0xfb); /* disable DAT - avoid no-execute */
|
||||||
/* Call the moving routine */
|
/* Call the moving routine */
|
||||||
(*data_mover)(&image->head, image->start);
|
(*data_mover)(&image->head, image->start);
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
ENTRY(relocate_kernel)
|
ENTRY(relocate_kernel)
|
||||||
basr %r13,0 # base address
|
basr %r13,0 # base address
|
||||||
.base:
|
.base:
|
||||||
stnsm sys_msk-.base(%r13),0xfb # disable DAT
|
|
||||||
stctg %c0,%c15,ctlregs-.base(%r13)
|
stctg %c0,%c15,ctlregs-.base(%r13)
|
||||||
stmg %r0,%r15,gprregs-.base(%r13)
|
stmg %r0,%r15,gprregs-.base(%r13)
|
||||||
lghi %r0,3
|
lghi %r0,3
|
||||||
|
@ -102,8 +101,6 @@ ENTRY(relocate_kernel)
|
||||||
.align 8
|
.align 8
|
||||||
load_psw:
|
load_psw:
|
||||||
.long 0x00080000,0x80000000
|
.long 0x00080000,0x80000000
|
||||||
sys_msk:
|
|
||||||
.quad 0
|
|
||||||
ctlregs:
|
ctlregs:
|
||||||
.rept 16
|
.rept 16
|
||||||
.quad 0
|
.quad 0
|
||||||
|
|
Loading…
Reference in New Issue