lkml.org 
[lkml]   [2017]   [Jan]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] uprobe: Find last occurrence of ':' when parsing uprobe PATH:OFFSET
    On Fri, 13 Jan 2017 08:58:34 -0800
    Kenny Yu <kennyyu@fb.com> wrote:

    > Previously, `create_trace_uprobe` found the *first* occurence
    > of the ':' character when parsing `PATH:OFFSET` for a uprobe.
    > However, if the path contains a ':' character, then the function
    > would parse the path incorrectly. Even worse, if the path does not
    > exist, the subsequent call to `kern_path()` would set `ret` to
    > `ENOENT`, leading to very cryptic errno values in user space.
    >
    > The fix is to find the *last* occurence of ':'.
    >
    > How to repro:: The write fails with "No such file or directory", suggesting
    > incorrectly that the `uprobe_events` file does not exist.
    >
    > $ mkdir testing && cd testing
    > $ cp /bin/bash .
    > $ cp /bin/bash ./bash:with:colon
    > $ echo "p:uprobes/p__root_testing_bash_0x6 /root/testing/bash:0x6" > /sys/kernel/debug/tracing/uprobe_events # this works
    > $ echo "p:uprobes/p__root_testing_bash_with_colon_0x6 /root/testing/bash:with:colon:0x6" >> /sys/kernel/debug/tracing/uprobe_events # this doesn't
    > -bash: echo: write error: No such file or directory
    >
    > With the patch:
    >
    > $ echo "p:uprobes/p__root_testing_bash_0x6 /root/testing/bash:0x6" > /sys/kernel/debug/tracing/uprobe_events # this still works
    > $ echo "p:uprobes/p__root_testing_bash_with_colon_0x6 /root/testing/bash:with:colon:0x6" >> /sys/kernel/debug/tracing/uprobe_events # this works now too!
    > $ cat /sys/kernel/debug/tracing/uprobe_events
    > p:uprobes/p__root_testing_bash_0x6 /root/testing/bash:0x0000000000000006
    > p:uprobes/p__root_testing_bash_with_colon_0x6 /root/testing/bash:with:colon:0x0000000000000006
    >

    Thanks! I'll add this to my queue.

    -- Steve

    \
     
     \ /
      Last update: 2017-01-13 18:16    [W:4.123 / U:3.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site