s390/nospec: Correct modules thunk offset calculation

JIRA: https://issues.redhat.com/browse/RHEL-86670

commit ea84f14d2a6b1a4fde17d2713dbdfdef7b84da87
Author: Vasily Gorbik <gor@linux.ibm.com>
Date:   Wed Jan 17 11:50:46 2024 +0100

    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>

Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Thomas Huth 2025-04-02 15:34:57 +02:00
parent 16949723e0
commit 17d3b90987
1 changed files with 2 additions and 2 deletions

View File

@ -114,10 +114,10 @@ static void __init_or_module __nospec_revert(s32 *start, s32 *end)
type = BRASL_EXPOLINE; /* brasl instruction */
else
continue;
thunk = instr + (*(int *)(instr + 2)) * 2;
thunk = instr + (long)(*(int *)(instr + 2)) * 2;
if (thunk[0] == 0xc6 && thunk[1] == 0x00)
/* exrl %r0,<target-br> */
br = thunk + (*(int *)(thunk + 2)) * 2;
br = thunk + (long)(*(int *)(thunk + 2)) * 2;
else
continue;
if (br[0] != 0x07 || (br[1] & 0xf0) != 0xf0)