From: Arnd Bergmann <arnd@xxxxxxxx> 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@xxxxxxxxxxxxxxx > Fixes: 511e6bc ("net: add Hisilicon Network Subsystem DSAF support") > Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx> 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. -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html