From: Masami Hiramatsu <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Shuah Khan <shuah@kernel.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Peter Zijlstra <peterz@infradead.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>,
Joel Fernandes <joel@joelfernandes.org>,
yhs@fb.com
Subject: Re: [RFC PATCH v6 4/6] tracing/probe: Support user-space dereference
Date: Mon, 13 May 2019 21:11:30 +0900 [thread overview]
Message-ID: <20190513211130.24735357a329cfdc25fcecf9@kernel.org> (raw)
In-Reply-To: <20190508112237.76bd0e6b@gandalf.local.home>
On Wed, 8 May 2019 11:22:37 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:
> > > > Per-Probe Event Filtering
> > > > -------------------------
> > > > diff --git a/Documentation/trace/uprobetracer.rst b/Documentation/trace/uprobetracer.rst
> > > > index 4346e23e3ae7..de8812c932bc 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.
> > >
> > > Hmm, shouldn't uprobes default to userspace. Isn't the purpose mostly
> > > to find out what's going on in userspace. Perhaps we should add a 'k'
> > > annotation to uprobes to denote that it's for kernel space, as that
> > > should be the exception and not the norm.
> >
> > No, uprobe can not access kernel space, because it doesn't have the
> > current kernel context. Note that all registers, stacks which
> > can be accessed from uprobe handler are user-space. We can not access
> > kernel context from that. See below
> >
> > > > - (*) 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 just be ignored.
> >
> > Thus the 'u' is just ignored on uprobe event.
>
> I totally missed the footnote here. Can we stress this point more up in
> the "User Memory Access" section. Specifically state something like:
> "Uprobes only access userspace memory, thus the 'u' is not required,
> and if it is added to a uprobe, it will simply be ignored".
Sorry, I missed this mail.
Since the "User Memory Access" section is only in kprobetrace.rst, I think
mentioning uprobe-events in kprobetrace.rst is meaningless. Uprobe user
might read uprobetracer.rst instead of kprobetrace.rst.
So I think it is enough to mention it as a footnote in uprobetracer.rst.
Thank you,
--
Masami Hiramatsu <mhiramat@kernel.org>
next prev parent reply other threads:[~2019-05-13 12:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-18 6:42 [RFC PATCH v6 0/6] tracing/probes: uaccess: Add support user-space access Masami Hiramatsu
2019-03-18 6:43 ` [RFC PATCH v6 1/6] x86/uaccess: Allow access_ok() in irq context if pagefault_disabled Masami Hiramatsu
2019-03-22 2:46 ` Steven Rostedt
2019-05-06 15:22 ` Masami Hiramatsu
2019-05-06 15:39 ` Steven Rostedt
2019-03-18 6:43 ` [RFC PATCH v6 2/6] uaccess: Add non-pagefault user-space read functions Masami Hiramatsu
2019-03-18 6:43 ` [RFC PATCH v6 3/6] tracing/probe: Add ustring type for user-space string Masami Hiramatsu
2019-03-18 6:43 ` [RFC PATCH v6 4/6] tracing/probe: Support user-space dereference Masami Hiramatsu
2019-05-06 15:52 ` Steven Rostedt
2019-05-08 4:11 ` Masami Hiramatsu
2019-05-08 15:22 ` Steven Rostedt
2019-05-13 12:11 ` Masami Hiramatsu [this message]
2019-03-18 6:44 ` [RFC PATCH v6 5/6] selftests/ftrace: Add user-memory access syntax testcase Masami Hiramatsu
2019-03-18 6:44 ` [RFC PATCH v6 6/6] perf-probe: Add user memory access attribute support 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=20190513211130.24735357a329cfdc25fcecf9@kernel.org \
--to=mhiramat@kernel.org \
--cc=acme@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=alexei.starovoitov@gmail.com \
--cc=changbin.du@gmail.com \
--cc=jannh@google.com \
--cc=joel@joelfernandes.org \
--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=shuah@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=yhs@fb.com \
/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