From: "Arnd Bergmann" <arnd@arndb.de>
To: "Tudor Ambarus" <tudor.ambarus@linaro.org>,
"Nathan Chancellor" <nathan@kernel.org>,
"Nick Desaulniers" <ndesaulniers@google.com>,
"Tom Rix" <trix@redhat.com>,
"Andrew Morton" <akpm@linux-foundation.org>
Cc: joneslee@google.com, "Peter Zijlstra" <peterz@infradead.org>,
"Kees Cook" <keescook@chromium.org>,
"Josh Poimboeuf" <jpoimboe@kernel.org>,
zhaoyang.huang@unisoc.com,
"Liam R. Howlett" <liam.howlett@oracle.com>,
"Randy Dunlap" <rdunlap@infradead.org>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
"Mark Brown" <broonie@kernel.org>,
"Dmitry Vyukov" <dvyukov@google.com>,
nogikh@google.com
Subject: Re: [PATCH] Kconfig.debug: disable CONFIG_FRAME_WARN for KASAN_STACK && CC_IS_CLANG by default
Date: Fri, 21 Apr 2023 17:28:28 +0200 [thread overview]
Message-ID: <b6341f73-3ad2-4fcf-8612-e026751019b5@app.fastmail.com> (raw)
In-Reply-To: <e46dd2bb-16d1-0c99-56f0-f8c2c4bbc79b@linaro.org>
On Fri, Apr 21, 2023, at 17:10, Tudor Ambarus wrote:
> On 4/21/23 15:30, Arnd Bergmann wrote:
>> On Fri, Apr 21, 2023, at 15:01, Tudor Ambarus wrote:
>>
>>> The conclusion is that when KASAN is enabled the stack usage increases a
>>> bit, but nothing unmanageable ~30-70 bytes, whereas when enabling
>>> KASAN_STACK the stack usage is excessive, from ~1.7K to ~5.8K for these
>>> cases.
>>>
>>> Disable CONFIG_FRAME_WARN for KASAN_STACK && CC_IS_CLANG by default.
>>> Adventurers can still override the default value by input prompt or
>>> explicit values in defconfigs in case they feel that some real warnings
>>> are missed.
>>>
>>> Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
>>
>> I think we are still better off with the warning enabled. When someone
>> really wants to run a kernel with KASAN_STACK enabled, they should have
>> a chance to see what they are getting into and not report any runtime
>> bugs that come from stack overflow.
>>
>
> Are such stack overflows warnings reliable when we know that stack
> instrumentation causes excessive stack usage? Until clang is fixed one
> shall hunt frame-larger-than warnings with KASAN_STACK disabled.
The main problem with stack frame usage is that the compiler cannot know
during compile time what the other functions are going to use, so it's
always a bit of guesswork, and we just try to make the limit as small
as possible without causing too much work addressing the warnings.
Only if the frame usage grows beyond the actual available stack size,
it's guaranteed to crash (I've seen 80KB for a single function, clearly
larger than 16kb of total stack size), but the larger it gets, the
more problems you'll run into.
We already discussed years ago how clang can improve a lot of the
cases here by reworking the amount of padding between variables
similar to how gcc does it. This won't work for all files, but for
a lot of them, and once clang gets fixed, we can address the
remaining ones by working around them in the kernel.
Arnd
next prev parent reply other threads:[~2023-04-21 15:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-21 13:01 Tudor Ambarus
2023-04-21 14:30 ` Arnd Bergmann
2023-04-21 15:10 ` Tudor Ambarus
2023-04-21 15:28 ` Arnd Bergmann [this message]
2023-04-29 22:03 ` Arnd Bergmann
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=b6341f73-3ad2-4fcf-8612-e026751019b5@app.fastmail.com \
--to=arnd@arndb.de \
--cc=akpm@linux-foundation.org \
--cc=broonie@kernel.org \
--cc=dvyukov@google.com \
--cc=geert+renesas@glider.be \
--cc=joneslee@google.com \
--cc=jpoimboe@kernel.org \
--cc=keescook@chromium.org \
--cc=liam.howlett@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=nogikh@google.com \
--cc=peterz@infradead.org \
--cc=rdunlap@infradead.org \
--cc=trix@redhat.com \
--cc=tudor.ambarus@linaro.org \
--cc=zhaoyang.huang@unisoc.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
all inboxes | Powered by JetHome®