lkml.org 
[lkml]   [2012]   [Dec]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [RFC PATCH 4/6] uretprobes: invoke return probe handlers
On 12/21, Anton Arapov wrote:
>
> +static unsigned long uretprobe_run_handlers(struct pt_regs *regs)
> +{
> + struct hlist_head *head;
> + struct hlist_node *r1, *r2;
> +
> + struct return_instance *ri;
> + struct uprobe_task *utask;
> +
> + struct xol_area *area;
> + unsigned long rp_trampoline_vaddr;
> + unsigned long orig_return_vaddr, cur_sp;
> +
> + cur_sp = (unsigned long)regs->sp;

This depends on arch/.

BTW, this series will break the compilation on powerpc, I guess.

> + hlist_for_each_entry_safe(ri, r1, r2, head, hlist) {
> + if (ri->uprobe

it should never be NULL, no?

> && ri->uprobe->return_consumers)
> + uretprobe_handler_chain(ri->uprobe, ri->orig_return_vaddr, regs);
^^^^^^^^^^^^^^^^^
->orig_return_vaddr can be rp_trampoline_vaddr. Not sure ->handler()
wants this value ;)

> @@ -1567,12 +1625,23 @@ static void handle_swbp(struct pt_regs *regs)
> {
> struct uprobe_task *utask;
> struct uprobe *uprobe;
> - unsigned long bp_vaddr;
> + struct xol_area *area;
> + unsigned long bp_vaddr, orig_return_vaddr;
> int uninitialized_var(is_swbp);
>
> bp_vaddr = uprobe_get_swbp_addr(regs);
> - uprobe = find_active_uprobe(bp_vaddr, &is_swbp);
> + area = get_xol_area(current->mm);
> + if (area) {
> + if (bp_vaddr == area->rp_trampoline_vaddr) {
> + orig_return_vaddr = uretprobe_run_handlers(regs);
> + instruction_pointer_set(regs, orig_return_vaddr);
> + if (current->utask->doomed)
> + send_sig(SIGSEGV, current, 0);

Just move this send_sig() into uretprobe_run_handlers() and kill
the ugly utask->doomed.

Oleg.



\
 
 \ /
  Last update: 2012-12-22 18:01    [W:0.084 / U:2.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site