File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -106,14 +106,27 @@ kprobe_opcode_t *kprobe_lookup_name(const char *name, unsigned int offset)
106106int arch_prepare_kprobe (struct kprobe * p )
107107{
108108 int ret = 0 ;
109+ struct kprobe * prev ;
109110 struct ppc_inst insn = ppc_inst_read ((struct ppc_inst * )p -> addr );
111+ struct ppc_inst prefix = ppc_inst_read ((struct ppc_inst * )(p -> addr - 1 ));
110112
111113 if ((unsigned long )p -> addr & 0x03 ) {
112114 printk ("Attempt to register kprobe at an unaligned address\n" );
113115 ret = - EINVAL ;
114116 } else if (IS_MTMSRD (insn ) || IS_RFID (insn ) || IS_RFI (insn )) {
115117 printk ("Cannot register a kprobe on rfi/rfid or mtmsr[d]\n" );
116118 ret = - EINVAL ;
119+ } else if (ppc_inst_prefixed (prefix )) {
120+ printk ("Cannot register a kprobe on the second word of prefixed instruction\n" );
121+ ret = - EINVAL ;
122+ }
123+ preempt_disable ();
124+ prev = get_kprobe (p -> addr - 1 );
125+ preempt_enable_no_resched ();
126+ if (prev &&
127+ ppc_inst_prefixed (ppc_inst_read ((struct ppc_inst * )prev -> ainsn .insn ))) {
128+ printk ("Cannot register a kprobe on the second word of prefixed instruction\n" );
129+ ret = - EINVAL ;
117130 }
118131
119132 /* insn must be on a special executable page on ppc64. This is
You can’t perform that action at this time.
0 commit comments