Skip to content

Commit 6b169ac

Browse files
heicarstMartin Schwidefsky
authored andcommitted
s390/kprobes: add support for compare and branch instructions
The compare and branch instructions (not relative) all need special handling when kprobed: - if a branch was taken, the instruction pointer should be left alone - if a branch was not taken, the instruction pointer must be adjusted The compare and branch instructions family was introduced with the general instruction extension facility (z10). Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
1 parent bee5c28 commit 6b169ac

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

‎arch/s390/kernel/kprobes.c‎

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,31 @@ static int __kprobes get_fixup_type(kprobe_opcode_t *insn)
105105
fixup |= FIXUP_RETURN_REGISTER;
106106
break;
107107
case 0xeb:
108-
if ((insn[2] & 0xff) == 0x44 || /* bxhg */
109-
(insn[2] & 0xff) == 0x45) /* bxleg */
108+
switch (insn[2] & 0xff) {
109+
case 0x44: /* bxhg */
110+
case 0x45: /* bxleg */
110111
fixup = FIXUP_BRANCH_NOT_TAKEN;
112+
break;
113+
}
111114
break;
112115
case 0xe3: /* bctg */
113116
if ((insn[2] & 0xff) == 0x46)
114117
fixup = FIXUP_BRANCH_NOT_TAKEN;
115118
break;
119+
case 0xec:
120+
switch (insn[2] & 0xff) {
121+
case 0xe5: /* clgrb */
122+
case 0xe6: /* cgrb */
123+
case 0xf6: /* crb */
124+
case 0xf7: /* clrb */
125+
case 0xfc: /* cgib */
126+
case 0xfd: /* cglib */
127+
case 0xfe: /* cib */
128+
case 0xff: /* clib */
129+
fixup = FIXUP_BRANCH_NOT_TAKEN;
130+
break;
131+
}
132+
break;
116133
}
117134
return fixup;
118135
}

0 commit comments

Comments
 (0)