2023-06-25 12:38:13

by Zheng Yejian

[permalink] [raw]
Subject: [PATCH] selftests/ftrace: Correctly enable event in instance-event.tc

Function instance_set() expects to enable event 'sched_switch', so we
should set 1 to its 'enable' file.

Testcase passed after this patch:
# ./ftracetest test.d/instances/instance-event.tc
=== Ftrace unit tests ===
[1] Test creation and deletion of trace instances while setting an event
[PASS]

# of passed: 1
# of failed: 0
# of unresolved: 0
# of untested: 0
# of unsupported: 0
# of xfailed: 0
# of undefined(test bug): 0

Signed-off-by: Zheng Yejian <[email protected]>
---
.../testing/selftests/ftrace/test.d/instances/instance-event.tc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc b/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc
index 0eb47fbb3f44..42422e425107 100644
--- a/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc
+++ b/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc
@@ -39,7 +39,7 @@ instance_read() {

instance_set() {
while :; do
- echo 1 > foo/events/sched/sched_switch
+ echo 1 > foo/events/sched/sched_switch/enable
done 2> /dev/null
}

--
2.25.1



2023-06-26 10:22:59

by Masami Hiramatsu

[permalink] [raw]
Subject: Re: [PATCH] selftests/ftrace: Correctly enable event in instance-event.tc

On Mon, 26 Jun 2023 19:11:14 +0900
Masami Hiramatsu (Google) <[email protected]> wrote:

> On Mon, 26 Jun 2023 08:11:44 +0800
> Zheng Yejian <[email protected]> wrote:
>
> > Function instance_set() expects to enable event 'sched_switch', so we
> > should set 1 to its 'enable' file.
> >
> > Testcase passed after this patch:
> > # ./ftracetest test.d/instances/instance-event.tc
> > === Ftrace unit tests ===
> > [1] Test creation and deletion of trace instances while setting an event
> > [PASS]
> >
> > # of passed: 1
> > # of failed: 0
> > # of unresolved: 0
> > # of untested: 0
> > # of unsupported: 0
> > # of xfailed: 0
> > # of undefined(test bug): 0
> >
>
> Good catch!
>
> Fixes: 91e6f1ce8657 ("ftracetest: Add instance created, delete, read and enable event test")
>
> It seems this tests internally broken but the result is same because this disabled
> error checking ('set +e').

And

Acked-by: Masami Hiramatsu (Google) <[email protected]>

Thanks!

>
>
> > Signed-off-by: Zheng Yejian <[email protected]>
> > ---
> > .../testing/selftests/ftrace/test.d/instances/instance-event.tc | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc b/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc
> > index 0eb47fbb3f44..42422e425107 100644
> > --- a/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc
> > +++ b/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc
> > @@ -39,7 +39,7 @@ instance_read() {
> >
> > instance_set() {
> > while :; do
> > - echo 1 > foo/events/sched/sched_switch
> > + echo 1 > foo/events/sched/sched_switch/enable
> > done 2> /dev/null
> > }
> >
> > --
> > 2.25.1
> >
>
>
> --
> Masami Hiramatsu (Google) <[email protected]>


--
Masami Hiramatsu (Google) <[email protected]>

2023-06-26 10:50:40

by Masami Hiramatsu

[permalink] [raw]
Subject: Re: [PATCH] selftests/ftrace: Correctly enable event in instance-event.tc

On Mon, 26 Jun 2023 08:11:44 +0800
Zheng Yejian <[email protected]> wrote:

> Function instance_set() expects to enable event 'sched_switch', so we
> should set 1 to its 'enable' file.
>
> Testcase passed after this patch:
> # ./ftracetest test.d/instances/instance-event.tc
> === Ftrace unit tests ===
> [1] Test creation and deletion of trace instances while setting an event
> [PASS]
>
> # of passed: 1
> # of failed: 0
> # of unresolved: 0
> # of untested: 0
> # of unsupported: 0
> # of xfailed: 0
> # of undefined(test bug): 0
>

Good catch!

Fixes: 91e6f1ce8657 ("ftracetest: Add instance created, delete, read and enable event test")

It seems this tests internally broken but the result is same because this disabled
error checking ('set +e').


> Signed-off-by: Zheng Yejian <[email protected]>
> ---
> .../testing/selftests/ftrace/test.d/instances/instance-event.tc | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc b/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc
> index 0eb47fbb3f44..42422e425107 100644
> --- a/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc
> +++ b/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc
> @@ -39,7 +39,7 @@ instance_read() {
>
> instance_set() {
> while :; do
> - echo 1 > foo/events/sched/sched_switch
> + echo 1 > foo/events/sched/sched_switch/enable
> done 2> /dev/null
> }
>
> --
> 2.25.1
>


--
Masami Hiramatsu (Google) <[email protected]>

2023-07-10 22:48:12

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH] selftests/ftrace: Correctly enable event in instance-event.tc


Shuah, can you take this?

On Mon, 26 Jun 2023 19:12:55 +0900
Masami Hiramatsu (Google) <[email protected]> wrote:

> On Mon, 26 Jun 2023 19:11:14 +0900
> Masami Hiramatsu (Google) <[email protected]> wrote:
>
> > On Mon, 26 Jun 2023 08:11:44 +0800
> > Zheng Yejian <[email protected]> wrote:
> >
> > > Function instance_set() expects to enable event 'sched_switch', so we
> > > should set 1 to its 'enable' file.
> > >
> > > Testcase passed after this patch:
> > > # ./ftracetest test.d/instances/instance-event.tc
> > > === Ftrace unit tests ===
> > > [1] Test creation and deletion of trace instances while setting an event
> > > [PASS]
> > >
> > > # of passed: 1
> > > # of failed: 0
> > > # of unresolved: 0
> > > # of untested: 0
> > > # of unsupported: 0
> > > # of xfailed: 0
> > > # of undefined(test bug): 0
> > >
> >
> > Good catch!
> >
> > Fixes: 91e6f1ce8657 ("ftracetest: Add instance created, delete, read and enable event test")
> >
> > It seems this tests internally broken but the result is same because this disabled
> > error checking ('set +e').
>
> And
>
> Acked-by: Masami Hiramatsu (Google) <[email protected]>

Acked-by: Steven Rostedt (Google) <[email protected]>


-- Steve

>
> Thanks!
>
> >
> >
> > > Signed-off-by: Zheng Yejian <[email protected]>
> > > ---
> > > .../testing/selftests/ftrace/test.d/instances/instance-event.tc | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc b/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc
> > > index 0eb47fbb3f44..42422e425107 100644
> > > --- a/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc
> > > +++ b/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc
> > > @@ -39,7 +39,7 @@ instance_read() {
> > >
> > > instance_set() {
> > > while :; do
> > > - echo 1 > foo/events/sched/sched_switch
> > > + echo 1 > foo/events/sched/sched_switch/enable
> > > done 2> /dev/null
> > > }
> > >
> > > --
> > > 2.25.1
> > >
> >
> >
> > --
> > Masami Hiramatsu (Google) <[email protected]>
>
>


2023-09-06 00:22:57

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH] selftests/ftrace: Correctly enable event in instance-event.tc

On Tue, 5 Sep 2023 20:54:40 +0800
Zheng Yejian <[email protected]> wrote:

> Hi, Steve, Ajay,
>
> After this patch and run this testcase, I got an use-after-free report
> by KASAN. Short log see [1], full logs see attach "panic.log".
>
> And by simple bisect, I found it may be introduced by:
>
> 27152bceea1d ("eventfs: Move tracing/events to eventfs")
>
> Link:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=27152bceea1df27ffebb12ac9cd9adbf2c4c3f35

Hi Zheng,

Can you test:

https://lore.kernel.org/all/[email protected]/

and see if it fixes the KASAN issue for you?

Thanks!

-- Steve

2023-09-06 03:24:36

by Zheng Yejian

[permalink] [raw]
Subject: Re: [PATCH] selftests/ftrace: Correctly enable event in instance-event.tc

On 2023/9/6 02:45, Steven Rostedt wrote:
> On Tue, 5 Sep 2023 20:54:40 +0800
> Zheng Yejian <[email protected]> wrote:
>
>> Hi, Steve, Ajay,
>>
>> After this patch and run this testcase, I got an use-after-free report
>> by KASAN. Short log see [1], full logs see attach "panic.log".
>>
>> And by simple bisect, I found it may be introduced by:
>>
>> 27152bceea1d ("eventfs: Move tracing/events to eventfs")
>
> Can you send me your config?

My config is the attachment "x86_64_config".

--

Thanks,
Zheng Yejian

>
> -- Steve
>


Attachments:
x86_64_config (144.78 kB)

2023-09-06 08:17:44

by Zheng Yejian

[permalink] [raw]
Subject: Re: [PATCH] selftests/ftrace: Correctly enable event in instance-event.tc

On 2023/9/6 06:43, Shuah Khan wrote:
> On 9/5/23 06:54, Zheng Yejian wrote:
>> On 2023/7/11 06:37, Steven Rostedt wrote:
>>>
>>> Shuah, can you take this?
>>>
>>
>> Kindly ping and bug report :)
>>
>
> I am sorry for the delay. Looks this one got buried deep
> when I was away on vacation.
>
> Applied now for my next Linux 6.6 update.
>

Thanks!

-- Zheng Yejian

> thanks,
> -- Shuah
>
>

2023-09-06 15:09:03

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH] selftests/ftrace: Correctly enable event in instance-event.tc

On Wed, 6 Sep 2023 09:42:44 +0800
Zheng Yejian <[email protected]> wrote:

> Hi, Steve, your new patch seems not fixes the KASAN issue.
>
> I run the instance-event.tc with your patch again and get same KASAN
> report.
>
> My config is in:
>
> https://lore.kernel.org/all/[email protected]/

I'm not able to reproduce it.

Can you send me the full dmesg.

Thanks,

-- Steve