linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	Andy Lutomirski <luto@amacapital.net>,
	Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Changbin Du <changbin.du@gmail.com>, Jann Horn <jannh@google.com>,
	Kees Cook <keescook@chromium.org>,
	Andy Lutomirski <luto@kernel.org>,
	Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	Nadav Amit <namit@vmware.com>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH v3 5/5] tracing/probe: Support user-space dereference
Date: Thu, 28 Feb 2019 16:00:55 +0900	[thread overview]
Message-ID: <20190228160055.92841d1b482be8c10a50b24b@kernel.org> (raw)
In-Reply-To: <20190227213132.50f3cef1@vmware.local.home>

Hi Steve,

Thank you for the review.

On Wed, 27 Feb 2019 21:31:32 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Wed, 27 Feb 2019 23:44:42 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
> 
> >  
> > +.. _user_mem_access:
> > +User Memory Access
> > +------------------
> > +Kprobe events supports user-space memory access. For that purpose, you can use
> > +either user-space dereference syntax or 'ustring' type.
> > +
> > +user-space dereference syntax allows you to access a field of a data structure
> 
>   "The user-space"
> 
> > +n user-space. This is done by "u" prefix with dereference syntax. For example,
> 
>  in user-space?   "This is done by adding the "u" prefix to the dereference syntax"

Oops, it maybe a typo. yes "in user-space".
OK, I'll fix that.

> 
> 
> > ++u4(%si) means read a user memory from the user-space address %si+4. You can
> 
>  "means it will read memory from the address in the register %si offset
>  by 4, and that memory is expected to be in user-space."

OK,

> 
> 
> > +use this for string too, e.g. +u0(%si):string means that the read a user space
> 
> 	"for strings too"

OK,

> 
> > +string from the address where %si register points. 'ustring' is a kind of
> > +short-cut. You can use +0(%si):ustring instead of that.
> 
> "+u0(%si):string will read a string from the address in the register
>  %si that is expected to be in user-space. 'ustring' is a shortcut way
>  off performing the same task. That is, +0(%si):ustring is equivalent
>  to +u0(%si):string."

Would you mean "of performing"?

> 
> 
> > +
> > +Note that kprobe-event provides user-memory access syntax, but it
> > doesn't +use it transparently. This means if you use normal
> > dereference or string type +for user memory, it might fail, and
> > always fails on some arch. So user has to +check if the targe data is
> > in kernel or in user space carefully. 
> >  Per-Probe Event Filtering
> >  -------------------------
> > diff --git a/Documentation/trace/uprobetracer.rst
> > b/Documentation/trace/uprobetracer.rst index
> > 4c3bfde2ba47..6144423b2368 100644 ---
> > a/Documentation/trace/uprobetracer.rst +++
> > b/Documentation/trace/uprobetracer.rst @@ -42,16 +42,17 @@ Synopsis
> > of uprobe_tracer @+OFFSET	: Fetch memory at OFFSET (OFFSET
> > from same file as PATH) $stackN	: Fetch Nth entry of stack (N
> > >= 0) $stack	: Fetch stack address.
> > -   $retval	: Fetch return value.(*)
> > +   $retval	: Fetch return value.(\*1)
> >     $comm	: Fetch current task comm.
> > -   +|-offs(FETCHARG) : Fetch memory at FETCHARG +|- offs address.(**)
> > +   +|-[u]OFFS(FETCHARG) : Fetch memory at FETCHARG +|- OFFS
> > address.(\*2)(\*3) NAME=FETCHARG     : Set NAME as the argument name
> > of FETCHARG. FETCHARG:TYPE     : Set TYPE as the type of FETCHARG.
> > Currently, basic types (u8/u16/u32/u64/s8/s16/s32/s64), hexadecimal
> > types (x8/x16/x32/x64), "string" and bitfield are supported.
> >  
> > -  (*) only for return probe.
> > -  (**) this is useful for fetching a field of data structures.
> > +  (\*1) only for return probe.
> > +  (\*2) this is useful for fetching a field of data structures.
> > +  (\*3) Unlike kprobe event, "u" prefix will be just ignored.
> 
> 					"will just be ignored."

OK. 

Thank you!

> 
> >  
> >  Types
> >  -----
> > diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> > index 4cacbb0e1538..5408a82a015d 100644
> 
> 
> -- Steve


-- 
Masami Hiramatsu <mhiramat@kernel.org>

  reply	other threads:[~2019-02-28  7:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-27 14:42 [PATCH v3 0/5] tracing/probes: uaccess: Add support user-space access Masami Hiramatsu
2019-02-27 14:42 ` [PATCH v3 1/5] uaccess: Add user_access_ok() Masami Hiramatsu
2019-02-27 14:43 ` [PATCH v3 2/5] uaccess: Use user_access_ok() in user_access_begin() Masami Hiramatsu
2019-02-27 14:43 ` [PATCH v3 3/5] uaccess: Add non-pagefault user-space read functions Masami Hiramatsu
2019-02-27 14:44 ` [PATCH v3 4/5] tracing/probe: Add ustring type for user-space string Masami Hiramatsu
2019-02-28  2:20   ` Steven Rostedt
2019-02-27 14:44 ` [PATCH v3 5/5] tracing/probe: Support user-space dereference Masami Hiramatsu
2019-02-28  2:31   ` Steven Rostedt
2019-02-28  7:00     ` Masami Hiramatsu [this message]
2019-02-28 16:20       ` Steven Rostedt
2019-02-28  2:42   ` Steven Rostedt
2019-02-28  6:08     ` Masami Hiramatsu
2019-02-27 22:32 ` [PATCH v3 0/5] tracing/probes: uaccess: Add support user-space access Alexei Starovoitov
2019-02-28  1:54   ` Masami Hiramatsu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190228160055.92841d1b482be8c10a50b24b@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=alexei.starovoitov@gmail.com \
    --cc=changbin.du@gmail.com \
    --cc=jannh@google.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=namit@vmware.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).