[PATCH v3 1/3] rtla: fix buffer overflow in actions_parse

Ivan Pravdin posted 3 patches 3 weeks, 4 days ago
[PATCH v3 1/3] rtla: fix buffer overflow in actions_parse
Posted by Ivan Pravdin 3 weeks, 4 days ago
Currently, tests 3 and 13-22 in tests/timerlat.t fail with error:

    *** buffer overflow detected ***: terminated
    timeout: the monitored command dumped core

The result of running `sudo make check` is

    tests/timerlat.t (Wstat: 0 Tests: 22 Failed: 11)
      Failed tests:  3, 13-22
    Files=3, Tests=34, 140 wallclock secs ( 0.07 usr  0.01 sys + 27.63 cusr
    27.96 csys = 55.67 CPU)
    Result: FAIL

Fix buffer overflow in actions_parse to avoid this error. After this
change, the tests results are

    tests/hwnoise.t ... ok
    tests/osnoise.t ... ok
    tests/timerlat.t .. ok
    All tests successful.
    Files=3, Tests=34, 186 wallclock secs ( 0.06 usr  0.01 sys + 41.10 cusr
    44.38 csys = 85.55 CPU)
    Result: PASS

Fixes: 6ea082b171e0 ("rtla/timerlat: Add action on threshold feature")
Signed-off-by: Ivan Pravdin <ipravdin.official@gmail.com>
Reviewed-by: Tomas Glozar <tglozar@redhat.com>
---
 tools/tracing/rtla/src/actions.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/tracing/rtla/src/actions.c b/tools/tracing/rtla/src/actions.c
index aaf0808125d7..eab51c0c0ce2 100644
--- a/tools/tracing/rtla/src/actions.c
+++ b/tools/tracing/rtla/src/actions.c
@@ -131,7 +131,7 @@ actions_parse(struct actions *self, const char *trigger)
 {
 	enum action_type type = ACTION_NONE;
 	char *token;
-	char trigger_c[strlen(trigger)];
+	char trigger_c[strlen(trigger) + 1];
 
 	/* For ACTION_SIGNAL */
 	int signal = 0, pid = 0;
-- 
2.48.1
Re: [PATCH v3 1/3] rtla: fix buffer overflow in actions_parse
Posted by Tomas Glozar 6 days, 11 hours ago
Steven,

po 8. 9. 2025 v 4:06 odesílatel Ivan Pravdin
<ipravdin.official@gmail.com> napsal:
>
> Currently, tests 3 and 13-22 in tests/timerlat.t fail with error:
>
>     *** buffer overflow detected ***: terminated
>     timeout: the monitored command dumped core
>
> The result of running `sudo make check` is
>
>     tests/timerlat.t (Wstat: 0 Tests: 22 Failed: 11)
>       Failed tests:  3, 13-22
>     Files=3, Tests=34, 140 wallclock secs ( 0.07 usr  0.01 sys + 27.63 cusr
>     27.96 csys = 55.67 CPU)
>     Result: FAIL
>
> Fix buffer overflow in actions_parse to avoid this error. After this
> change, the tests results are
>
>     tests/hwnoise.t ... ok
>     tests/osnoise.t ... ok
>     tests/timerlat.t .. ok
>     All tests successful.
>     Files=3, Tests=34, 186 wallclock secs ( 0.06 usr  0.01 sys + 41.10 cusr
>     44.38 csys = 85.55 CPU)
>     Result: PASS
>
> Fixes: 6ea082b171e0 ("rtla/timerlat: Add action on threshold feature")
> Signed-off-by: Ivan Pravdin <ipravdin.official@gmail.com>
> Reviewed-by: Tomas Glozar <tglozar@redhat.com>
> ---
>  tools/tracing/rtla/src/actions.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Could you take this simple fix? (Might require tweaking the starting
letter "fix" -> "Fix", I don't care that much about it, but as you
said, tracing requires capital letters there :) )

The rest of the patchset conflicts with [1] but this one doesn't and
is also more important.

[1] https://patchwork.kernel.org/project/linux-trace-kernel/list/?series=999703

Tomas
Re: [PATCH v3 1/3] rtla: fix buffer overflow in actions_parse
Posted by Ivan Pravdin 3 days, 11 hours ago
On Fri, Sep 26, 2025 at 04:32:52PM +0200, Tomas Glozar wrote:
> Steven,
> 
> po 8. 9. 2025 v 4:06 odesílatel Ivan Pravdin
> <ipravdin.official@gmail.com> napsal:
> >
> > Currently, tests 3 and 13-22 in tests/timerlat.t fail with error:
> >
> >     *** buffer overflow detected ***: terminated
> >     timeout: the monitored command dumped core
> >
> > The result of running `sudo make check` is
> >
> >     tests/timerlat.t (Wstat: 0 Tests: 22 Failed: 11)
> >       Failed tests:  3, 13-22
> >     Files=3, Tests=34, 140 wallclock secs ( 0.07 usr  0.01 sys + 27.63 cusr
> >     27.96 csys = 55.67 CPU)
> >     Result: FAIL
> >
> > Fix buffer overflow in actions_parse to avoid this error. After this
> > change, the tests results are
> >
> >     tests/hwnoise.t ... ok
> >     tests/osnoise.t ... ok
> >     tests/timerlat.t .. ok
> >     All tests successful.
> >     Files=3, Tests=34, 186 wallclock secs ( 0.06 usr  0.01 sys + 41.10 cusr
> >     44.38 csys = 85.55 CPU)
> >     Result: PASS
> >
> > Fixes: 6ea082b171e0 ("rtla/timerlat: Add action on threshold feature")
> > Signed-off-by: Ivan Pravdin <ipravdin.official@gmail.com>
> > Reviewed-by: Tomas Glozar <tglozar@redhat.com>
> > ---
> >  tools/tracing/rtla/src/actions.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Could you take this simple fix? (Might require tweaking the starting
> letter "fix" -> "Fix", I don't care that much about it, but as you
> said, tracing requires capital letters there :) )
> 
> The rest of the patchset conflicts with [1] but this one doesn't and
> is also more important.
> 
> [1] https://patchwork.kernel.org/project/linux-trace-kernel/list/?series=999703

Thanks Tomas. I will monitor it and rebase my patches once it is merged.

> 
> Tomas
> 

	Ivan Pravdin
Re: [PATCH v3 1/3] rtla: fix buffer overflow in actions_parse
Posted by Steven Rostedt 5 days, 16 hours ago
On Fri, 26 Sep 2025 16:32:52 +0200
Tomas Glozar <tglozar@redhat.com> wrote:


> Could you take this simple fix? (Might require tweaking the starting
> letter "fix" -> "Fix", I don't care that much about it, but as you
> said, tracing requires capital letters there :) )

Yeah, I can update it.

> 
> The rest of the patchset conflicts with [1] but this one doesn't and
> is also more important.
> 
> [1] https://patchwork.kernel.org/project/linux-trace-kernel/list/?series=999703

Should I expect a v4 on patches 2 and 3?

-- Steve