Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Vasily Gorbik and committed by
Alexander Gordeev
ea84f14d 236d70f8

+2 -2
+2 -2
arch/s390/kernel/nospec-branch.c
··· 114 114 type = BRASL_EXPOLINE; /* brasl instruction */ 115 115 else 116 116 continue; 117 - thunk = instr + (*(int *)(instr + 2)) * 2; 117 + thunk = instr + (long)(*(int *)(instr + 2)) * 2; 118 118 if (thunk[0] == 0xc6 && thunk[1] == 0x00) 119 119 /* exrl %r0,<target-br> */ 120 - br = thunk + (*(int *)(thunk + 2)) * 2; 120 + br = thunk + (long)(*(int *)(thunk + 2)) * 2; 121 121 else 122 122 continue; 123 123 if (br[0] != 0x07 || (br[1] & 0xf0) != 0xf0)