From: Steven Rostedt <srostedt@redhat.com>
To: Christopher Li <sparse@chrisli.org>
Cc: Jaswinder Singh Rajput <jaswinder@kernel.org>,
Ingo Molnar <mingo@elte.hu>,
Stephen Rothwell <sfr@canb.auug.org.au>,
Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>,
Peter Zijlstra <peterz@infradead.org>,
linux-next@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-sparse@vger.kernel.org,
Josh Triplett <josh@freedesktop.org>,
Frederic Weisbecker <fweisbec@gmail.com>
Subject: Re: Warning from ring buffer code (Was: Re: linux-next: tip tree build warning)
Date: Mon, 14 Sep 2009 14:17:18 -0400 [thread overview]
Message-ID: <1252952238.2964.154.camel@localhost.localdomain> (raw)
In-Reply-To: <70318cbf0909141009v46581785m4c70edf31fcb79fa@mail.gmail.com>
On Mon, 2009-09-14 at 10:09 -0700, Christopher Li wrote:
> On Mon, Sep 14, 2009 at 8:16 AM, Steven Rostedt <srostedt@redhat.com> wrote:
> > static void func(int size_me) {
> > char array[size_me];
> >
> > memcpy(array, "hello", size);
> > };
> >
> > and sparse failed on it as well. Note, you need to have something call
> > func, or sparse will ignore it.
>
> Gcc allows variable size. Sparse expects the size of an array is constant.
> For the kernel using variable array size is consider bad. Because the kernel
> has very limited stack size. (8K if I remember correctly). Using dynamic array
> is very easy to overflow the stack without realizing it.
>
> It deserves a warning. I agree the warning message can use a better description
> though.
Good point!
I've added Frederic to the Cc list, since he wrote the code.
Frederic, how big can one of those events get. The ring buffer (and
TRACE_EVENT) allow up to almost a page size, which is very hefty for the
stack. This code needs to either be rewritten or we need to set a limit
to the size of a profile entry.
We could add:
if (__entry_size > 256)
return;
Thoughts?
-- Steve
WARNING: multiple messages have this Message-ID (diff)
From: Steven Rostedt <srostedt@redhat.com>
To: Christopher Li <sparse@chrisli.org>
Cc: Jaswinder Singh Rajput <jaswinder@kernel.org>,
Ingo Molnar <mingo@elte.hu>,
Stephen Rothwell <sfr@canb.auug.org.au>,
Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>,
Peter Zijlstra <peterz@infradead.org>,
linux-next@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-sparse@vger.kernel.org,
Josh Triplett <josh@freedesktop.org>,
Frederic Weisbecker <fweisbec@gmail.com>
Subject: Re: Warning from ring buffer code (Was: Re: linux-next: tip tree build warning)
Date: Mon, 14 Sep 2009 14:17:18 -0400 [thread overview]
Message-ID: <1252952238.2964.154.camel@localhost.localdomain> (raw)
In-Reply-To: <70318cbf0909141009v46581785m4c70edf31fcb79fa@mail.gmail.com>
On Mon, 2009-09-14 at 10:09 -0700, Christopher Li wrote:
> On Mon, Sep 14, 2009 at 8:16 AM, Steven Rostedt <srostedt@redhat.com> wrote:
> > static void func(int size_me) {
> > char array[size_me];
> >
> > memcpy(array, "hello", size);
> > };
> >
> > and sparse failed on it as well. Note, you need to have something call
> > func, or sparse will ignore it.
>
> Gcc allows variable size. Sparse expects the size of an array is constant.
> For the kernel using variable array size is consider bad. Because the kernel
> has very limited stack size. (8K if I remember correctly). Using dynamic array
> is very easy to overflow the stack without realizing it.
>
> It deserves a warning. I agree the warning message can use a better description
> though.
Good point!
I've added Frederic to the Cc list, since he wrote the code.
Frederic, how big can one of those events get. The ring buffer (and
TRACE_EVENT) allow up to almost a page size, which is very hefty for the
stack. This code needs to either be rewritten or we need to set a limit
to the size of a profile entry.
We could add:
if (__entry_size > 256)
return;
Thoughts?
-- Steve
next prev parent reply other threads:[~2009-09-14 18:17 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-04 6:16 linux-next: tip tree build warning Stephen Rothwell
2009-08-04 16:24 ` Steven Rostedt
2009-09-12 6:53 ` Warning from ring buffer code (Was: Re: linux-next: tip tree build warning) Stephen Rothwell
2009-09-12 7:39 ` Ingo Molnar
2009-09-12 10:46 ` Stephen Rothwell
2009-09-12 11:12 ` Jaswinder Singh Rajput
2009-09-14 15:16 ` Steven Rostedt
2009-09-14 17:09 ` Christopher Li
2009-09-14 17:09 ` Christopher Li
2009-09-14 18:17 ` Steven Rostedt [this message]
2009-09-14 18:17 ` Steven Rostedt
2009-09-14 18:23 ` Peter Zijlstra
2009-09-14 18:23 ` Peter Zijlstra
2009-09-14 18:31 ` Steven Rostedt
2009-09-14 18:31 ` Steven Rostedt
2009-09-14 18:41 ` Frederic Weisbecker
2009-09-15 7:16 ` Peter Zijlstra
2009-09-15 9:01 ` Frédéric Weisbecker
2009-09-15 9:01 ` Frédéric Weisbecker
2009-09-14 18:38 ` Frederic Weisbecker
2009-09-14 13:50 ` Steven Rostedt
2009-09-14 13:53 ` Ingo Molnar
2009-09-14 22:36 ` Stephen Rothwell
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=1252952238.2964.154.camel@localhost.localdomain \
--to=srostedt@redhat.com \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=jaswinder@kernel.org \
--cc=josh@freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=linux-sparse@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=sfr@canb.auug.org.au \
--cc=sparse@chrisli.org \
--cc=tglx@linutronix.de \
/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.