On 02/28, Anton Arapov wrote: > > +static void prepare_uretprobe(struct uprobe *uprobe, struct pt_regs *regs) > +{ > + struct return_uprobe_i *ri; > + struct uprobe_task *utask; > + struct xol_area *area; > + unsigned long rp_trampoline_vaddr = 0; > + uprobe_opcode_t insn = UPROBE_SWBP_INSN; > + > + area = get_xol_area(); > + if (area) > + rp_trampoline_vaddr = area->rp_trampoline_vaddr; > + if (!rp_trampoline_vaddr) { > + rp_trampoline_vaddr = xol_get_insn_slot(&insn); > + if (!rp_trampoline_vaddr) > + return; > + } > + area->rp_trampoline_vaddr = rp_trampoline_vaddr; > + > + ri = kzalloc(sizeof(struct return_uprobe_i), GFP_KERNEL); > + if (!ri) > + return; > + > + utask = get_utask(); > + ri->orig_ret_vaddr = > arch_uretprobe_hijack_return_addr(rp_trampoline_vaddr, regs); > + if (likely(ri->orig_ret_vaddr)) { > + /* TODO: uretprobe bypass logic */ > + atomic_inc(&uprobe->ref);
OK, but even this is not enough. Once we inserted "int3" we must ensure that handle_swbp() will be called even if this uprobe goes away. We have the reference but it only protects uprobe itself, it can't protect agains delete_uprobe(). IOW, we must ensure that uprobe_pre_sstep_notifier() can't return 0. So this patch needs the additional change in find_active_uprobe(), - if (!uprobe && test_and_clear_bit(MMF_RECALC_UPROBES, &mm->flags)) + if (!uprobe && hlist_empty(->return_uprobes) && + test_and_clear_bit(MMF_RECALC_UPROBES, &mm->flags)) Oleg. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/