mirror of
https://github.com/torvalds/linux.git
synced 2024-11-17 17:41:44 +00:00
s390/kprobes: allow kprobes only on known instructions
Since we have an in-kernel disassembler we can make sure that there won't be any kprobes set on random data. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
parent
a882b3b067
commit
1ffa11abfe
@ -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__ */
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user