From: David Laight <david.laight.linux@gmail.com>
To: "Arnd Bergmann" <arnd@arndb.de>
Cc: "Kent Overstreet" <kent.overstreet@linux.dev>,
"Naresh Kamboju" <naresh.kamboju@linaro.org>,
linux-bcache@vger.kernel.org,
"open list" <linux-kernel@vger.kernel.org>,
lkft-triage@lists.linaro.org,
"Linux Regressions" <regressions@lists.linux.dev>,
"Dan Carpenter" <dan.carpenter@linaro.org>,
"Anders Roxell" <anders.roxell@linaro.org>
Subject: Re: riscv gcc-13 allyesconfig error the frame size of 2064 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
Date: Sun, 25 May 2025 18:18:42 +0100 [thread overview]
Message-ID: <20250525181842.2e2c47fd@pumpkin> (raw)
In-Reply-To: <692e313d-ea31-45c0-8c66-36b25c9d955d@app.fastmail.com>
On Fri, 23 May 2025 20:01:33 +0200
"Arnd Bergmann" <arnd@arndb.de> wrote:
> On Fri, May 23, 2025, at 19:11, Kent Overstreet wrote:
> > On Fri, May 23, 2025 at 05:17:15PM +0200, Arnd Bergmann wrote:
> >>
> >> - KASAN_STACK adds extra redzones for each variable
> >> - KASAN_STACK further prevents stack slots from getting
> >> reused inside one function, in order to better pinpoint
> >> which instance caused problems like out-of-scope access
> >> - passing structures by value causes them to be put on
> >> the stack on some architectures, even when the structure
> >> size is only one or two registers
> >
> > We mainly do this with bkey_s_c, which is just two words: on x86_64,
> > that gets passed in registers. Is riscv different?
>
> Not sure, I think it's mostly older ABIs that are limited,
> either not passing structures in registers at all, or only
> possibly one but not two of them.
>
> >> - sanitizers turn off optimizations that lead to better
> >> stack usage
> >> - in some cases, the missed optimization ends up causing
> >> local variables to get spilled to the stack many times
> >> because of a combination of all the above.
> >
> > Yeesh.
> >
> > I suspect we should be running with a larger stack when the sanitizers
> > are running, and perhaps tweak the warnings accordingly. I did a bunch
> > of stack usage work after I found a kmsan build was blowing out the
> > stack, but then running with max stack usage tracing enabled showed it
> > to be a largely non issue on non-sanitizer builds, IIRC.
>
> Enabling KASAN does double the available stack space. However, I don't
> think we should use that as an excuse to raise the per-function
> warning limit, because
>
> - the majority of all function stacks do not grow that much when
> sanitizers are enabled
> - allmodconfig enables KASAN and should still catch mistakes
> where a driver accidentally puts a large structure on the stack
That is rather annoying when you want to look at the generated code :-(
> - 2KB on 64-bit targes is a really large limit. At some point
> in the past I had a series that lowered the limit to 1536 byte
> for 64-bit targets, but I never managed to get all the changes
> merged.
I've a cunning plan to do a proper static analysis of stack usage.
It is a 'simple' matter of getting objtool to output all calls with
the stack offset.
Indirect calls need the function hashes from fine-ibt, but also need
clang to support 'hash seeds' to disambiguate all the void (*)(void *)
functions.
That'll first barf at all recursion, and then, I expect, show a massive
stack use inside snprintf() in some error path.
Just need a big stack of 'round tuits'.
David
>
>
> Arnd
>
next prev parent reply other threads:[~2025-05-25 17:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-22 13:29 riscv gcc-13 allyesconfig error the frame size of 2064 bytes is larger than 2048 bytes [-Werror=frame-larger-than=] Naresh Kamboju
2025-05-22 16:48 ` Kent Overstreet
2025-05-23 13:19 ` Naresh Kamboju
2025-05-23 13:49 ` Arnd Bergmann
2025-05-23 14:08 ` Kent Overstreet
2025-05-23 15:17 ` Arnd Bergmann
2025-05-23 17:11 ` Kent Overstreet
2025-05-23 18:01 ` Arnd Bergmann
2025-05-25 17:18 ` David Laight [this message]
2025-05-25 17:36 ` Kent Overstreet
2025-05-25 17:47 ` David Laight
2025-05-25 18:10 ` Kent Overstreet
2025-05-25 19:25 ` Steven Rostedt
2025-05-25 20:04 ` Kent Overstreet
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=20250525181842.2e2c47fd@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=anders.roxell@linaro.org \
--cc=arnd@arndb.de \
--cc=dan.carpenter@linaro.org \
--cc=kent.overstreet@linux.dev \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkft-triage@lists.linaro.org \
--cc=naresh.kamboju@linaro.org \
--cc=regressions@lists.linux.dev \
/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