summaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel/vmlinux.lds.S
diff options
context:
space:
mode:
authorJosh Poimboeuf <jpoimboe@kernel.org>2022-08-26 16:55:44 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-09-15 12:17:04 +0200
commitd20c47333b7a3ea8001ae7a48610a8aa04d9663a (patch)
tree78e53d5ce909501fa908c577a4a7d4ee8ba60c90 /arch/s390/kernel/vmlinux.lds.S
parent87286f9ab923a9f0b929f80decd9f4491e10092e (diff)
downloadlinux-stable-d20c47333b7a3ea8001ae7a48610a8aa04d9663a.tar.gz
linux-stable-d20c47333b7a3ea8001ae7a48610a8aa04d9663a.tar.bz2
linux-stable-d20c47333b7a3ea8001ae7a48610a8aa04d9663a.zip
s390: fix nospec table alignments
commit c9305b6c1f52060377c72aebe3a701389e9f3172 upstream. Add proper alignment for .nospec_call_table and .nospec_return_table in vmlinux. [hca@linux.ibm.com]: The problem with the missing alignment of the nospec tables exist since a long time, however only since commit e6ed91fd0768 ("s390/alternatives: remove padding generation code") and with CONFIG_RELOCATABLE=n the kernel may also crash at boot time. The above named commit reduced the size of struct alt_instr by one byte, so its new size is 11 bytes. Therefore depending on the number of cpu alternatives the size of the __alt_instructions array maybe odd, which again also causes that the addresses of the nospec tables will be odd. If the address of __nospec_call_start is odd and the kernel is compiled With CONFIG_RELOCATABLE=n the compiler may generate code that loads the address of __nospec_call_start with a 'larl' instruction. This will generate incorrect code since the 'larl' instruction only works with even addresses. In result the members of the nospec tables will be accessed with an off-by-one offset, which subsequently may lead to addressing exceptions within __nospec_revert(). Fixes: f19fbd5ed642 ("s390: introduce execute-trampolines for branches") Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org> Link: https://lore.kernel.org/r/8719bf1ce4a72ebdeb575200290094e9ce047bcc.1661557333.git.jpoimboe@kernel.org Cc: <stable@vger.kernel.org> # 4.16 Reviewed-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/s390/kernel/vmlinux.lds.S')
-rw-r--r--arch/s390/kernel/vmlinux.lds.S1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S
index 18ede6e806b9..160a05c6ce88 100644
--- a/arch/s390/kernel/vmlinux.lds.S
+++ b/arch/s390/kernel/vmlinux.lds.S
@@ -121,6 +121,7 @@ SECTIONS
/*
* Table with the patch locations to undo expolines
*/
+ . = ALIGN(4);
.nospec_call_table : {
__nospec_call_start = . ;
*(.s390_indirect*)