Skip to content

Commit 7805a8c

Browse files
jpoimboethangqn-ampere
authored andcommitted
s390: fix nospec table alignments
commit c9305b6 upstream. Add proper alignment for .nospec_call_table and .nospec_return_table in vmlinux. [[email protected]]: The problem with the missing alignment of the nospec tables exist since a long time, however only since commit e6ed91f ("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: f19fbd5 ("s390: introduce execute-trampolines for branches") Signed-off-by: Josh Poimboeuf <[email protected]> Link: https://lore.kernel.org/r/8719bf1ce4a72ebdeb575200290094e9ce047bcc.1661557333.git.jpoimboe@kernel.org Cc: <[email protected]> # 4.16 Reviewed-by: Heiko Carstens <[email protected]> Signed-off-by: Heiko Carstens <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent bd21dee commit 7805a8c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

arch/s390/kernel/vmlinux.lds.S

+1
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ SECTIONS
132132
/*
133133
* Table with the patch locations to undo expolines
134134
*/
135+
. = ALIGN(4);
135136
.nospec_call_table : {
136137
__nospec_call_start = . ;
137138
*(.s390_indirect*)

0 commit comments

Comments
 (0)