Skip to content

Commit ea84f14

Browse files
Vasily GorbikAlexander Gordeev
authored andcommitted
s390/nospec: Correct modules thunk offset calculation
Fix offset calculation when branch target is more then 2Gb away. Signed-off-by: Vasily Gorbik <gor@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
1 parent 236d70f commit ea84f14

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

arch/s390/kernel/nospec-branch.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ static void __init_or_module __nospec_revert(s32 *start, s32 *end)
114114
type = BRASL_EXPOLINE; /* brasl instruction */
115115
else
116116
continue;
117-
thunk = instr + (*(int *)(instr + 2)) * 2;
117+
thunk = instr + (long)(*(int *)(instr + 2)) * 2;
118118
if (thunk[0] == 0xc6 && thunk[1] == 0x00)
119119
/* exrl %r0,<target-br> */
120-
br = thunk + (*(int *)(thunk + 2)) * 2;
120+
br = thunk + (long)(*(int *)(thunk + 2)) * 2;
121121
else
122122
continue;
123123
if (br[0] != 0x07 || (br[1] & 0xf0) != 0xf0)

0 commit comments

Comments
 (0)