lkml.org 
[lkml]   [2013]   [Nov]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCHSET 00/13] tracing/uprobes: Add support for more fetch methods (v6)
Date
Hi Oleg,

On Tue, 12 Nov 2013 17:00:01 +0900, Namhyung Kim wrote:
> For @+addr syntax: user-space uses relative symbol address from a loaded
> base address and kernel calculates the base address
> using "current->utask->vaddr - tu->offset".

I tried this approach and realized that current->utask is not set or has
an invalid vaddr when handler_chain() is called. So I had to apply
following patch and it seems to work well for me. Could you confirm it?

Thanks,
Namhyung


diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index ad8e1bdca70e..e63748d3520e 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -1456,7 +1456,7 @@ static void prepare_uretprobe(struct uprobe *uprobe, struct pt_regs *regs)

/* Prepare to single-step probed instruction out of line. */
static int
-pre_ssout(struct uprobe *uprobe, struct pt_regs *regs, unsigned long bp_vaddr)
+pre_ssout(struct uprobe *uprobe, struct pt_regs *regs)
{
struct uprobe_task *utask;
unsigned long xol_vaddr;
@@ -1471,7 +1471,6 @@ pre_ssout(struct uprobe *uprobe, struct pt_regs *regs, unsigned long bp_vaddr)
return -ENOMEM;

utask->xol_vaddr = xol_vaddr;
- utask->vaddr = bp_vaddr;

err = arch_uprobe_pre_xol(&uprobe->arch, regs);
if (unlikely(err)) {
@@ -1701,6 +1700,7 @@ static bool handle_trampoline(struct pt_regs *regs)
static void handle_swbp(struct pt_regs *regs)
{
struct uprobe *uprobe;
+ struct uprobe_task *utask;
unsigned long bp_vaddr;
int uninitialized_var(is_swbp);

@@ -1744,11 +1744,17 @@ static void handle_swbp(struct pt_regs *regs)
if (unlikely(!test_bit(UPROBE_COPY_INSN, &uprobe->flags)))
goto out;

+ utask = get_utask();
+ if (!utask)
+ goto out;
+
+ utask->vaddr = bp_vaddr;
+
handler_chain(uprobe, regs);
if (can_skip_sstep(uprobe, regs))
goto out;

- if (!pre_ssout(uprobe, regs, bp_vaddr))
+ if (!pre_ssout(uprobe, regs))
return;

/* can_skip_sstep() succeeded, or restart if can't singlestep */

\
 
 \ /
  Last update: 2013-11-25 08:21    [W:0.113 / U:1.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site