[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170206.120318.1268240226202516488.davem@davemloft.net>
Date: Mon, 06 Feb 2017 12:03:18 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: arnd@...db.de
Cc: stable@...r.kernel.org, yisen.zhuang@...wei.com,
salil.mehta@...wei.com, huangdaode@...ilicon.com,
yankejian@...wei.com, lisheng011@...wei.com, oulijun@...wei.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] [net-next?] hns: avoid stack overflow with CONFIG_KASAN
From: Arnd Bergmann <arnd@...db.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@...r.kernel.org
> Fixes: 511e6bc ("net: add Hisilicon Network Subsystem DSAF support")
> Signed-off-by: Arnd Bergmann <arnd@...db.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.
Powered by blists - more mailing lists