From: John Kacur <jkacur@redhat.com>
To: Kurt Kanzenbach <kurt@linutronix.de>
Cc: Clark Williams <williams@redhat.com>,
rt-users <linux-rt-users@vger.kernel.org>
Subject: Re: [PATCH 1/4] rt-tests: cyclicdeadline: fix segmentation fault on close
Date: Fri, 5 Apr 2019 16:33:33 +0200 (CEST) [thread overview]
Message-ID: <alpine.LFD.2.21.1904051633140.8480@planxty> (raw)
In-Reply-To: <20190404134814.13376-2-kurt@linutronix.de>
On Thu, 4 Apr 2019, Kurt Kanzenbach wrote:
> The current code generates a segmentation fault in the last free() call.
>
> $ sudo ./cyclicdeadline
> Using all CPUS
> /sys/kernel/debug/sched_features: Success
> interval: 600:1000
> Tested at 5us of 600us
> deadline thread 2963
> thread[2963] runtime=600us deadline=1000us
> main thread 2962
> fail 2 0
> T: 0 ( 2963) I:1000 C: 1268 Min: 7 Act: 55 Avg: 56 Max: 256
> [1] 2961 segmentation fault sudo ./cyclicdeadline
>
> This is caused by a buffer overflow in setup_ftrace_marker(). The appended
> string is 21 not 14 characters wide. Fix it by using strlen() like the other
> function do.
>
> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
> ---
> src/sched_deadline/cyclicdeadline.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
> index 08460107c464..303b5e96647a 100644
> --- a/src/sched_deadline/cyclicdeadline.c
> +++ b/src/sched_deadline/cyclicdeadline.c
> @@ -283,7 +283,7 @@ static void setup_ftrace_marker(void)
> {
> struct stat st;
> const char *debugfs = find_debugfs();
> - char files[strlen(debugfs) + 14];
> + char files[strlen(debugfs) + strlen("/tracing/trace_marker") + 1];
> int ret;
>
> if (strlen(debugfs) == 0)
> --
> 2.11.0
>
>
Signed-off-by: John Kacur <jkacur@redhat.com>
next prev parent reply other threads:[~2019-04-05 14:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-04 13:48 [PATCH 0/4] rt-tests: deadline: Fix segmentation faults Kurt Kanzenbach
2019-04-04 13:48 ` [PATCH 1/4] rt-tests: cyclicdeadline: fix segmentation fault on close Kurt Kanzenbach
2019-04-05 14:33 ` John Kacur [this message]
2019-04-04 13:48 ` [PATCH 2/4] rt-tests: cyclicdeadline: add missing free calls Kurt Kanzenbach
2019-04-05 14:34 ` John Kacur
2019-04-04 13:48 ` [PATCH 3/4] rt-tests: deadline_tests: fix stack buffer flow Kurt Kanzenbach
2019-04-05 14:35 ` John Kacur
2019-04-04 13:48 ` [PATCH 4/4] rt-tests: deadline_test: add missing frees Kurt Kanzenbach
2019-04-04 15:13 ` John Kacur
2019-04-04 15:19 ` Kurt Kanzenbach
2019-04-04 15:42 ` John Kacur
2019-04-05 14:36 ` John Kacur
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=alpine.LFD.2.21.1904051633140.8480@planxty \
--to=jkacur@redhat.com \
--cc=kurt@linutronix.de \
--cc=linux-rt-users@vger.kernel.org \
--cc=williams@redhat.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