summaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2015-01-29 14:10:22 +0100
committerBen Hutchings <ben@decadent.org.uk>2019-05-22 23:15:02 +0100
commit5df2fdb4502bbd0b99837b49f3e8207d71b238bd (patch)
treef2bdd196f0a0d163fc2eb6557158076f43d6606e /arch/s390/kernel
parent702c8fb2fd8004dc906f86fdbbe004c292755b2b (diff)
downloadlinux-stable-5df2fdb4502bbd0b99837b49f3e8207d71b238bd.tar.gz
linux-stable-5df2fdb4502bbd0b99837b49f3e8207d71b238bd.tar.bz2
linux-stable-5df2fdb4502bbd0b99837b49f3e8207d71b238bd.zip
s390/jump label: use different nop instruction
commit d5caa4dbf9bd2ad8cd7f6be0ca76722be947182b upstream. Use a brcl 0,2 instruction for jump label nops during compile time, so we don't mix up the different nops during mcount/hotpatch call site detection. The initial jump label code instruction replacement will exchange these instructions with either a branch or a brcl 0,0 instruction. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'arch/s390/kernel')
-rw-r--r--arch/s390/kernel/jump_label.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/arch/s390/kernel/jump_label.c b/arch/s390/kernel/jump_label.c
index 25aef40584f7..cb2d51e779df 100644
--- a/arch/s390/kernel/jump_label.c
+++ b/arch/s390/kernel/jump_label.c
@@ -49,6 +49,11 @@ static void jump_label_bug(struct jump_entry *entry, struct insn *insn)
panic("Corrupted kernel text");
}
+static struct insn orignop = {
+ .opcode = 0xc004,
+ .offset = JUMP_LABEL_NOP_OFFSET >> 1,
+};
+
static void __jump_label_transform(struct jump_entry *entry,
enum jump_label_type type,
int init)
@@ -59,14 +64,16 @@ static void __jump_label_transform(struct jump_entry *entry,
jump_label_make_nop(entry, &old);
jump_label_make_branch(entry, &new);
} else {
- if (init)
- jump_label_make_nop(entry, &old);
- else
- jump_label_make_branch(entry, &old);
+ jump_label_make_branch(entry, &old);
jump_label_make_nop(entry, &new);
}
- if (memcmp((void *)entry->code, &old, sizeof(old)))
- jump_label_bug(entry, &old);
+ if (init) {
+ if (memcmp((void *)entry->code, &orignop, sizeof(orignop)))
+ jump_label_bug(entry, &old);
+ } else {
+ if (memcmp((void *)entry->code, &old, sizeof(old)))
+ jump_label_bug(entry, &old);
+ }
probe_kernel_write((void *)entry->code, &new, sizeof(new));
}