All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Colin Ian King <colin.king@canonical.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@redhat.com>, Shuah Khan <shuah@kernel.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Tom Zanussi <zanussi@kernel.org>,
	linux-kselftest@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] selftests/ftrace: check for do_sys_openat2 in user-memory test
Date: Fri, 2 Oct 2020 16:32:53 +0900	[thread overview]
Message-ID: <20201002163253.13feb38f8a1e4f148afca5de@kernel.org> (raw)
In-Reply-To: <80cee321-d8ed-31fd-2f53-d9306b1d9545@canonical.com>

On Thu, 1 Oct 2020 16:40:33 +0100
Colin Ian King <colin.king@canonical.com> wrote:

> On 01/10/2020 15:44, Steven Rostedt wrote:
> > On Thu,  1 Oct 2020 09:56:41 +0100
> > Colin King <colin.king@canonical.com> wrote:
> > 
> >> From: Colin Ian King <colin.king@canonical.com>
> >>
> >> More recent libc implementations are now using openat/openat2 system
> >> calls so also add do_sys_openat2 to the tracing so that the test
> >> passes on these systems because do_sys_open may not be called.
> >>
> >> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> >> ---
> >>  .../testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc  | 2 ++
> >>  1 file changed, 2 insertions(+)
> >>
> >> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc
> >> index a30a9c07290d..cf1b4c3e9e6b 100644
> >> --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc
> >> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc
> >> @@ -9,6 +9,8 @@ grep -A10 "fetcharg:" README | grep -q '\[u\]<offset>' || exit_unsupported
> >>  :;: "user-memory access syntax and ustring working on user memory";:
> >>  echo 'p:myevent do_sys_open path=+0($arg2):ustring path2=+u0($arg2):string' \
> >>  	> kprobe_events  
> >> +echo 'p:myevent2 do_sys_openat2 path=+0($arg2):ustring path2=+u0($arg2):string' \
> >> +	> kprobe_events
> >>
> > 
> > This still wont work, because the rest of the code only enables the myevent
> > event, and not the one you just added.
> 
> Yep, I botched this and tested the wrong fix.
> 
> > 
> > Did you see this broken before, and this patch fixes it?
> 
> So this test breaks with a recent libc and support tools built against
> libc.  I believe the do_sys_open is not being detected because
> do_sys_openat2 is being called instead.
> 
> Not sure now of the correct way to fix this.

Hmm, this actually just try to catch the user-string. So the another
function which accepts any user-string, is OK.
Let me try to use another one. 

Thank you for reporting!


> 
> > 
> > -- Steve
> > 
> >  
> >>  grep myevent kprobe_events | \
> >>  	grep -q 'path=+0($arg2):ustring path2=+u0($arg2):string'
> > 
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

WARNING: multiple messages have this Message-ID (diff)
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Colin Ian King <colin.king@canonical.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@redhat.com>, Shuah Khan <shuah@kernel.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Tom Zanussi <zanussi@kernel.org>,
	linux-kselftest@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] selftests/ftrace: check for do_sys_openat2 in user-memory test
Date: Fri, 02 Oct 2020 07:32:53 +0000	[thread overview]
Message-ID: <20201002163253.13feb38f8a1e4f148afca5de@kernel.org> (raw)
In-Reply-To: <80cee321-d8ed-31fd-2f53-d9306b1d9545@canonical.com>

On Thu, 1 Oct 2020 16:40:33 +0100
Colin Ian King <colin.king@canonical.com> wrote:

> On 01/10/2020 15:44, Steven Rostedt wrote:
> > On Thu,  1 Oct 2020 09:56:41 +0100
> > Colin King <colin.king@canonical.com> wrote:
> > 
> >> From: Colin Ian King <colin.king@canonical.com>
> >>
> >> More recent libc implementations are now using openat/openat2 system
> >> calls so also add do_sys_openat2 to the tracing so that the test
> >> passes on these systems because do_sys_open may not be called.
> >>
> >> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> >> ---
> >>  .../testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc  | 2 ++
> >>  1 file changed, 2 insertions(+)
> >>
> >> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc
> >> index a30a9c07290d..cf1b4c3e9e6b 100644
> >> --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc
> >> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc
> >> @@ -9,6 +9,8 @@ grep -A10 "fetcharg:" README | grep -q '\[u\]<offset>' || exit_unsupported
> >>  :;: "user-memory access syntax and ustring working on user memory";:
> >>  echo 'p:myevent do_sys_open path=+0($arg2):ustring path2=+u0($arg2):string' \
> >>  	> kprobe_events  
> >> +echo 'p:myevent2 do_sys_openat2 path=+0($arg2):ustring path2=+u0($arg2):string' \
> >> +	> kprobe_events
> >>
> > 
> > This still wont work, because the rest of the code only enables the myevent
> > event, and not the one you just added.
> 
> Yep, I botched this and tested the wrong fix.
> 
> > 
> > Did you see this broken before, and this patch fixes it?
> 
> So this test breaks with a recent libc and support tools built against
> libc.  I believe the do_sys_open is not being detected because
> do_sys_openat2 is being called instead.
> 
> Not sure now of the correct way to fix this.

Hmm, this actually just try to catch the user-string. So the another
function which accepts any user-string, is OK.
Let me try to use another one. 

Thank you for reporting!


> 
> > 
> > -- Steve
> > 
> >  
> >>  grep myevent kprobe_events | \
> >>  	grep -q 'path=+0($arg2):ustring path2=+u0($arg2):string'
> > 
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

  parent reply	other threads:[~2020-10-02  7:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01  8:56 [PATCH] selftests/ftrace: check for do_sys_openat2 in user-memory test Colin King
2020-10-01  8:56 ` Colin King
2020-10-01 14:44 ` Steven Rostedt
2020-10-01 14:44   ` Steven Rostedt
2020-10-01 15:40   ` Colin Ian King
2020-10-01 15:40     ` Colin Ian King
2020-10-01 15:56     ` Steven Rostedt
2020-10-01 15:56       ` Steven Rostedt
2020-10-02  7:32     ` Masami Hiramatsu [this message]
2020-10-02  7:32       ` Masami Hiramatsu
2020-10-02 13:07 ` Masami Hiramatsu
2020-10-02 13:07   ` Masami Hiramatsu
2020-10-02 13:20   ` Colin Ian King
2020-10-02 13:20     ` Colin Ian King

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=20201002163253.13feb38f8a1e4f148afca5de@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=colin.king@canonical.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=shuah@kernel.org \
    --cc=zanussi@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.