From: David Miller <davem@davemloft.net>
To: arnd@arndb.de
Cc: stable@vger.kernel.org, yisen.zhuang@huawei.com,
salil.mehta@huawei.com, huangdaode@hisilicon.com,
yankejian@huawei.com, lisheng011@huawei.com, oulijun@huawei.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [net-next?] hns: avoid stack overflow with CONFIG_KASAN
Date: Mon, 06 Feb 2017 12:03:18 -0500 (EST) [thread overview]
Message-ID: <20170206.120318.1268240226202516488.davem@davemloft.net> (raw)
In-Reply-To: <20170203163607.3488037-1-arnd@arndb.de>
From: Arnd Bergmann <arnd@arndb.de>
Date: Fri, 3 Feb 2017 17:35:46 +0100
> The use of ACCESS_ONCE() looks like a micro-optimization to force gcc to use
> an indexed load for the register address, but it has an absolutely detrimental
> effect on builds with gcc-5 and CONFIG_KASAN=y, leading to a very likely
> kernel stack overflow aside from very complex object code:
...
> This does not seem to happen any more with gcc-7, but removing the ACCESS_ONCE
> seems safe anyway and it avoids a serious issue for some people. I have verified
> that with gcc-5.3.1, the object code we get is better in the new version
> both with and without CONFIG_KASAN, as we no longer allocate a 1344 byte
> stack frame for hns_dsaf_get_regs() but otherwise have practically identical
> object code.
>
> With gcc-7.0.0, removing ACCESS_ONCE has no effect, the object code is already
> good either way.
>
> This patch is probably not urgent to get into 4.11 as only KASAN=y builds
> with certain compilers are affected, but I still think it makes sense to
> backport into older kernels.
>
> Cc: stable@vger.kernel.org
> Fixes: 511e6bc ("net: add Hisilicon Network Subsystem DSAF support")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This is really terrible for the compiler to do, but what can we do about it.
I'll apply this to 'net' and queue it up for -stable, thanks.
next prev parent reply other threads:[~2017-02-06 17:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-03 16:35 Arnd Bergmann
2017-02-06 17:03 ` David Miller [this message]
2017-02-08 12:03 ` KASAN+netlink, was: " Arnd Bergmann
2017-02-08 12:24 ` Johannes Berg
2017-02-08 13:10 ` Arnd Bergmann
2017-02-08 14:58 ` Andrey Ryabinin
2017-02-08 16:00 ` David Laight
2017-02-08 16:27 ` David Miller
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=20170206.120318.1268240226202516488.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=arnd@arndb.de \
--cc=huangdaode@hisilicon.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lisheng011@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=oulijun@huawei.com \
--cc=salil.mehta@huawei.com \
--cc=stable@vger.kernel.org \
--cc=yankejian@huawei.com \
--cc=yisen.zhuang@huawei.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®