This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Can we do Java probing without invoking stapbm from staprun?


David Smith wrote:
> On Sat, Sep 23, 2017 at 6:51 AM, Tetsuo Handa
> <penguin-kernel@i-love.sakura.ne.jp> wrote:
> > Hello.
> >
> > I'm using modified version of /usr/libexec/systemtap/stapbm in order to obtain more
> > specific values of an object which cannot be obtained by implicit .toString() conversion.
> > For example, passing $1.getRequestURI() instead of plain $1 when probing
> > service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
> > method of javax.servlet.http.HttpServlet class. There should be no problem for SystemTap
> > side as long as number of arguments matches, for all values are passed to SystemTap side
> > as string because of PR21020.
> >
> > Now, I'm trying to go further in order to make
> >
> >   "allow probing without giving permission to run staprun to the user who runs
> >    Java application (e.g. tomcat)"
> >
> >   "automatically start probing as soon as target java process starts (or restarts)
> >    as with normal userspace probing"
> >
> > possible by not invoking stapbm from staprun.
> >
> > Steps for demonstrating such usage is shown below. Can we legally support such usage?
> 
> I'm afraid I'm probably not the right person to comment on java
> issues, but I do have a question. In that last question there, you
> said "Can we legally support such usage?". Did you really mean
> "legally" (as in a matter of law) or did you mean something else?

I'm not talking about law. I consider that such usage is currently wacky abuse.
I want to know whether SystemTap can support such usage in future versions by allowing
staprun users not to call stapbm from staprun (via e.g. environment variable).

> 
> It also might help here if you went ahead and posted a patch of your
> modified version of stapbm.

Something like below.

function echo_bytemanrule()
{
    echo 'RULE stap_javaprobe_4113'
    echo 'CLASS javax.servlet.http.HttpServlet'
    echo 'METHOD service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)'
    echo 'HELPER org.systemtap.byteman.helper.HelperSDT'
    echo 'AT ENTRY'
    echo 'IF TRUE'
    echo 'DO METHOD_STAP31_PROBE4("stap_javaprobe_4113", $1, $1.getRequestURI(), $2, "")'
    echo 'ENDRULE'
    echo 'RULE stap_javaprobe_4114'
    echo 'CLASS javax.servlet.http.HttpServlet'
    echo 'METHOD service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)'
    echo 'HELPER org.systemtap.byteman.helper.HelperSDT'
    echo 'AT RETURN'
    echo 'IF TRUE'
    echo 'DO METHOD_STAP31_PROBE1("stap_javaprobe_4114", "done")")'
    echo 'ENDRULE'
}

> 
> -- 
> David Smith
> Principal Software Engineer
> Red Hat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]