diff options
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/include/asm/dis.h | 6 | ||||
-rw-r--r-- | arch/s390/kernel/dis.c | 2 | ||||
-rw-r--r-- | arch/s390/kernel/kprobes.c | 2 |
3 files changed, 9 insertions, 1 deletions
diff --git a/arch/s390/include/asm/dis.h b/arch/s390/include/asm/dis.h index 4d0dffc68221..04a83f5773cd 100644 --- a/arch/s390/include/asm/dis.h +++ b/arch/s390/include/asm/dis.h @@ -42,5 +42,11 @@ static inline int insn_length(unsigned char code) void show_code(struct pt_regs *regs); void print_fn_code(unsigned char *code, unsigned long len); int insn_to_mnemonic(unsigned char *instruction, char *buf, unsigned int len); +struct s390_insn *find_insn(unsigned char *code); + +static inline int is_known_insn(unsigned char *code) +{ + return !!find_insn(code); +} #endif /* __ASM_S390_DIS_H__ */ diff --git a/arch/s390/kernel/dis.c b/arch/s390/kernel/dis.c index ce554f3ec445..993efe6a887c 100644 --- a/arch/s390/kernel/dis.c +++ b/arch/s390/kernel/dis.c @@ -1586,7 +1586,7 @@ static unsigned int extract_operand(unsigned char *code, return val; } -static struct s390_insn *find_insn(unsigned char *code) +struct s390_insn *find_insn(unsigned char *code) { unsigned char opfrag = code[1]; unsigned char opmask; diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c index c52fdf290301..59a9c35c4598 100644 --- a/arch/s390/kernel/kprobes.c +++ b/arch/s390/kernel/kprobes.c @@ -60,6 +60,8 @@ struct kprobe_insn_cache kprobe_dmainsn_slots = { static int __kprobes is_prohibited_opcode(kprobe_opcode_t *insn) { + if (!is_known_insn((unsigned char *)insn)) + return -EINVAL; switch (insn[0] >> 8) { case 0x0c: /* bassm */ case 0x0b: /* bsm */ |