* Re: [kbuild-all] drivers/media/dvb-frontends/cxd2841er.c:2393:1: warning: the frame size of 2992 bytes is larger than 2048 bytes [not found] <CAK3bHNWkeakZP0cEi+U=GjmPa0jN9qWC4seyS6+ih8inzvmbXQ@mail.gmail.com> @ 2015-10-05 11:09 ` Fengguang Wu 2015-10-05 12:10 ` Andrey Ryabinin 2015-10-16 16:02 ` [PATCH] Disable -Wframe-larger-than warnings with KASAN=y Andrey Ryabinin 0 siblings, 2 replies; 6+ messages in thread From: Fengguang Wu @ 2015-10-05 11:09 UTC (permalink / raw) To: Abylay Ospan Cc: Andrey Ryabinin, Mauro Carvalho Chehab, Kozlov Sergey, kbuild-all, linux-media, LKML Hi Abylay, > cause of this 'Kernel Address sanitizer (KASan)' is enabled in your > config. With gcc-4.9 kasan was disabled in compile time because of: > "scripts/Makefile.kasan:23: CONFIG_KASAN: compiler does not support > all options. Trying minimal configuration" > > but with gcc-5 it's enabled. > > and > objdump -d drivers/media/dvb-frontends/cxd2841er.o > > shows that KASan adds some instructions to 'cxd2841er_sleep_tc' which > writes necessary data to -fasan-shadow-offset=0xdffffc0000000000: > 1476: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax > ... > 14d3: c7 00 f1 f1 f1 f1 movl $0xf1f1f1f1,(%rax) > 14d9: c7 40 04 01 f4 f4 f4 movl $0xf4f4f401,0x4(%rax) > 14e0: c7 40 08 f2 f2 f2 f2 movl $0xf2f2f2f2,0x8(%rax) > 14e7: c7 40 0c 01 f4 f4 f4 movl $0xf4f4f401,0xc(%rax) > ... > > and function will grow and we get '-Wframe-larger-than=2048' warnings. > > So, this warning looks normal (until they less than 8K I think) for > configurations with KASan enabled. > > I can suggest: > * ignore this warning if KASan enabled Yes I can easily teach the kbuild robot to ignore this warning when KASan enabled. Thanks for the explanations! > * Increase -Wframe-larger-than=2048 to -Wframe-larger-than=8192 if > KASan enabled ( CONFIG_FRAME_WARN=8192 in kernel .config) Would it be possible to auto increase the threshold (in below Kconfig) when KASan is enabled, so that all other developers/testers won't get the warnings, too? lib/Kconfig.debug config FRAME_WARN int "Warn for stack frames larger than (needs gcc 4.4)" range 0 8192 default 1024 if !64BIT default 2048 if 64BIT Thanks, Fengguang > 2015-09-25 12:46 GMT+03:00 Fengguang Wu <fengguang.wu@intel.com>: > > Hi Abylay, > > > > This warning can be reproduced with gcc-5.2: > > > > =============== commit a6dc60ff1 =============== > > /home/wfg/linux > > HEAD is now at a6dc60ff... [media] cxd2841er: Sony CXD2841ER DVB-S/S2/T/T2/C demodulator driver > > /home/wfg/linux/obj-compiletest > > > > make ARCH=x86_64 drivers/media/dvb-frontends/cxd2841er.o > > > > grep -a -F drivers/media/dvb-frontends/cxd2841er.c /tmp/build-err-a6dc60ff1209df29ee4668024e93d31f31421932-wfg --color > > ../drivers/media/dvb-frontends/cxd2841er.c: In function 'cxd2841er_sleep_tc': > > ../drivers/media/dvb-frontends/cxd2841er.c:2393:1: warning: the frame size of 2992 bytes is larger than 2048 bytes [-Wframe-larger-than=] > > } > > ^ > > ../drivers/media/dvb-frontends/cxd2841er.c: In function 'cxd2841er_set_frontend_tc': > > ../drivers/media/dvb-frontends/cxd2841er.c:2274:1: warning: the frame size of 4336 bytes is larger than 2048 bytes [-Wframe-larger-than=] > > } > > ^ > > > > =============== PREV commit e025273b86fb4a6440192b809e05332777c3faa5 =============== > > /home/wfg/linux > > Previous HEAD position was a6dc60ff... [media] cxd2841er: Sony CXD2841ER DVB-S/S2/T/T2/C demodulator driver > > HEAD is now at e025273... [media] lnbh25: LNBH25 SEC controller driver > > /home/wfg/linux/obj-compiletest > > > > make ARCH=x86_64 drivers/media/dvb-frontends/cxd2841er.o > > > > !!! BUILD ERROR !!! > > grep -a -F drivers/media/dvb-frontends/cxd2841er.c /tmp/build-err-e025273b86fb4a6440192b809e05332777c3faa5-wfg --color > > > > =============== linus/master linus/master =============== > > /home/wfg/linux > > Previous HEAD position was e025273... [media] lnbh25: LNBH25 SEC controller driver > > HEAD is now at 8e64a73... Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client > > /home/wfg/linux/obj-compiletest > > > > make ARCH=x86_64 drivers/media/dvb-frontends/cxd2841er.o > > > > grep -a -F drivers/media/dvb-frontends/cxd2841er.c /tmp/build-err-8e64a7331702b7888ccf84b2b9ff46ab8e167c7f-wfg --color > > ../drivers/media/dvb-frontends/cxd2841er.c: In function 'cxd2841er_sleep_tc': > > ../drivers/media/dvb-frontends/cxd2841er.c:2401:1: warning: the frame size of 2984 bytes is larger than 2048 bytes [-Wframe-larger-than=] > > } > > ^ > > ../drivers/media/dvb-frontends/cxd2841er.c: In function 'cxd2841er_set_frontend_tc': > > ../drivers/media/dvb-frontends/cxd2841er.c:2282:1: warning: the frame size of 4336 bytes is larger than 2048 bytes [-Wframe-larger-than=] > > } > > ^ > > > > Thanks, > > Fengguang > > > > On Fri, Sep 25, 2015 at 12:21:57PM +0300, Abylay Ospan wrote: > >> Hello, > >> > >> I cannot reproduce this warning. I'm compiling with your config and > >> following commands: > >> > >> git checkout a6dc60ff1209df29ee4668024e93d31f31421932 > >> make ARCH=x86_64 > >> > >> my gcc version is 4.9.2 (Ubuntu 4.9.2-10ubuntu13) > >> > >> warning doesn't appear even if I set: > >> CONFIG_FRAME_WARN=128 > >> > >> Please point me if problem still exist. > >> > >> thanks ! > >> > >> > >> > >> 2015-09-17 9:05 GMT+03:00 kbuild test robot <fengguang.wu@intel.com>: > >> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master > >> > head: 72714841b705a5b9bccf37ee85a62352bee3a3ef > >> > commit: a6dc60ff1209df29ee4668024e93d31f31421932 [media] cxd2841er: Sony CXD2841ER DVB-S/S2/T/T2/C demodulator driver > >> > date: 5 weeks ago > >> > config: x86_64-randconfig-b0-09171322 (attached as .config) > >> > reproduce: > >> > git checkout a6dc60ff1209df29ee4668024e93d31f31421932 > >> > # save the attached .config to linux build tree > >> > make ARCH=x86_64 > >> > > >> > All warnings (new ones prefixed by >>): > >> > > >> > drivers/media/dvb-frontends/cxd2841er.c: In function 'cxd2841er_sleep_tc': > >> >>> drivers/media/dvb-frontends/cxd2841er.c:2393:1: warning: the frame size of 2992 bytes is larger than 2048 bytes [-Wframe-larger-than=] > >> > } > >> > ^ > >> > drivers/media/dvb-frontends/cxd2841er.c: In function 'cxd2841er_set_frontend_tc': > >> > drivers/media/dvb-frontends/cxd2841er.c:2274:1: warning: the frame size of 4336 bytes is larger than 2048 bytes [-Wframe-larger-than=] > >> > } > >> > ^ > >> > > >> > vim +2393 drivers/media/dvb-frontends/cxd2841er.c > >> > > >> > 2377 case SYS_DVBC_ANNEX_A: > >> > 2378 cxd2841er_active_c_to_sleep_tc(priv); > >> > 2379 break; > >> > 2380 default: > >> > 2381 dev_warn(&priv->i2c->dev, > >> > 2382 "%s(): unknown delivery system %d\n", > >> > 2383 __func__, priv->system); > >> > 2384 } > >> > 2385 } > >> > 2386 if (priv->state != STATE_SLEEP_TC) { > >> > 2387 dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", > >> > 2388 __func__, priv->state); > >> > 2389 return -EINVAL; > >> > 2390 } > >> > 2391 cxd2841er_sleep_tc_to_shutdown(priv); > >> > 2392 return 0; > >> >> 2393 } > >> > 2394 > >> > 2395 static int cxd2841er_send_burst(struct dvb_frontend *fe, > >> > 2396 enum fe_sec_mini_cmd burst) > >> > 2397 { > >> > 2398 u8 data; > >> > 2399 struct cxd2841er_priv *priv = fe->demodulator_priv; > >> > 2400 > >> > 2401 dev_dbg(&priv->i2c->dev, "%s(): burst mode %s\n", __func__, > >> > > >> > --- > >> > 0-DAY kernel test infrastructure Open Source Technology Center > >> > https://lists.01.org/pipermail/kbuild-all Intel Corporation > >> > >> > >> > >> -- > >> Abylay Ospan, > >> NetUP Inc. > >> http://www.netup.tv > >> _______________________________________________ > >> kbuild-all mailing list > >> kbuild-all@lists.01.org > >> https://lists.01.org/mailman/listinfo/kbuild-all > > > > -- > Abylay Ospan, > NetUP Inc. > http://www.netup.tv > _______________________________________________ > kbuild-all mailing list > kbuild-all@lists.01.org > https://lists.01.org/mailman/listinfo/kbuild-all ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [kbuild-all] drivers/media/dvb-frontends/cxd2841er.c:2393:1: warning: the frame size of 2992 bytes is larger than 2048 bytes 2015-10-05 11:09 ` [kbuild-all] drivers/media/dvb-frontends/cxd2841er.c:2393:1: warning: the frame size of 2992 bytes is larger than 2048 bytes Fengguang Wu @ 2015-10-05 12:10 ` Andrey Ryabinin 2015-10-16 16:02 ` [PATCH] Disable -Wframe-larger-than warnings with KASAN=y Andrey Ryabinin 1 sibling, 0 replies; 6+ messages in thread From: Andrey Ryabinin @ 2015-10-05 12:10 UTC (permalink / raw) To: Fengguang Wu Cc: Abylay Ospan, Mauro Carvalho Chehab, Kozlov Sergey, kbuild-all, linux-media, LKML 2015-10-05 14:09 GMT+03:00 Fengguang Wu <fengguang.wu@intel.com>: > Hi Abylay, > >> cause of this 'Kernel Address sanitizer (KASan)' is enabled in your >> config. With gcc-4.9 kasan was disabled in compile time because of: >> "scripts/Makefile.kasan:23: CONFIG_KASAN: compiler does not support >> all options. Trying minimal configuration" >> >> but with gcc-5 it's enabled. >> >> and >> objdump -d drivers/media/dvb-frontends/cxd2841er.o >> >> shows that KASan adds some instructions to 'cxd2841er_sleep_tc' which >> writes necessary data to -fasan-shadow-offset=0xdffffc0000000000: >> 1476: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax >> ... >> 14d3: c7 00 f1 f1 f1 f1 movl $0xf1f1f1f1,(%rax) >> 14d9: c7 40 04 01 f4 f4 f4 movl $0xf4f4f401,0x4(%rax) >> 14e0: c7 40 08 f2 f2 f2 f2 movl $0xf2f2f2f2,0x8(%rax) >> 14e7: c7 40 0c 01 f4 f4 f4 movl $0xf4f4f401,0xc(%rax) >> ... >> >> and function will grow and we get '-Wframe-larger-than=2048' warnings. >> >> So, this warning looks normal (until they less than 8K I think) for >> configurations with KASan enabled. >> >> I can suggest: >> * ignore this warning if KASan enabled > > Yes I can easily teach the kbuild robot to ignore this warning when > KASan enabled. Thanks for the explanations! > >> * Increase -Wframe-larger-than=2048 to -Wframe-larger-than=8192 if >> KASan enabled ( CONFIG_FRAME_WARN=8192 in kernel .config) > > Would it be possible to auto increase the threshold (in below Kconfig) when > KASan is enabled, so that all other developers/testers won't get the warnings, > too? > Makes sense, although 8K is too much, I think. 6K probably enough. > lib/Kconfig.debug > > config FRAME_WARN > int "Warn for stack frames larger than (needs gcc 4.4)" > range 0 8192 > default 1024 if !64BIT > default 2048 if 64BIT > > Thanks, > Fengguang > ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] Disable -Wframe-larger-than warnings with KASAN=y 2015-10-05 11:09 ` [kbuild-all] drivers/media/dvb-frontends/cxd2841er.c:2393:1: warning: the frame size of 2992 bytes is larger than 2048 bytes Fengguang Wu 2015-10-05 12:10 ` Andrey Ryabinin @ 2015-10-16 16:02 ` Andrey Ryabinin 2015-10-16 16:05 ` Abylay Ospan 2015-10-16 16:47 ` Andi Kleen 1 sibling, 2 replies; 6+ messages in thread From: Andrey Ryabinin @ 2015-10-16 16:02 UTC (permalink / raw) To: linux-kernel Cc: Ingo Molnar, Andi Kleen, Andrew Morton, Fengguang Wu, Mauro Carvalho Chehab, Kozlov Sergey, kbuild-all, linux-media, Abylay Ospan, Andrey Ryabinin When the kernel compiled with KASAN=y, GCC adds redzones for each variable on stack. This enlarges function's stack frame and causes: 'warning: the frame size of X bytes is larger than Y bytes' The worst case I've seen for now is following: ../net/wireless/nl80211.c: In function ‘nl80211_send_wiphy’: ../net/wireless/nl80211.c:1731:1: warning: the frame size of 5448 bytes is larger than 2048 bytes [-Wframe-larger-than=] } ^ That kind of warning becomes useless with KASAN=y. It doesn't necessarily indicate that there is some problem in the code, thus we should turn it off. Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com> --- lib/Kconfig.debug | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index ab76b99..1d1521c 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -197,6 +197,7 @@ config ENABLE_MUST_CHECK config FRAME_WARN int "Warn for stack frames larger than (needs gcc 4.4)" range 0 8192 + default 0 if KASAN default 1024 if !64BIT default 2048 if 64BIT help -- 2.4.9 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Disable -Wframe-larger-than warnings with KASAN=y 2015-10-16 16:02 ` [PATCH] Disable -Wframe-larger-than warnings with KASAN=y Andrey Ryabinin @ 2015-10-16 16:05 ` Abylay Ospan 2015-10-16 16:47 ` Andi Kleen 1 sibling, 0 replies; 6+ messages in thread From: Abylay Ospan @ 2015-10-16 16:05 UTC (permalink / raw) To: Andrey Ryabinin Cc: linux-kernel, Ingo Molnar, Andi Kleen, Andrew Morton, Fengguang Wu, Mauro Carvalho Chehab, Kozlov Sergey, kbuild-all, linux-media Hello, Acked-by: Abylay Ospan <aospan@netup.ru> 2015-10-16 19:02 GMT+03:00 Andrey Ryabinin <aryabinin@virtuozzo.com>: > When the kernel compiled with KASAN=y, GCC adds redzones > for each variable on stack. This enlarges function's stack > frame and causes: > 'warning: the frame size of X bytes is larger than Y bytes' > > The worst case I've seen for now is following: > ../net/wireless/nl80211.c: In function ‘nl80211_send_wiphy’: > ../net/wireless/nl80211.c:1731:1: warning: the frame size of 5448 bytes is larger than 2048 bytes [-Wframe-larger-than=] > } > ^ > That kind of warning becomes useless with KASAN=y. It doesn't necessarily > indicate that there is some problem in the code, thus we should turn it off. > > Reported-by: Fengguang Wu <fengguang.wu@intel.com> > Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com> > --- > lib/Kconfig.debug | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug > index ab76b99..1d1521c 100644 > --- a/lib/Kconfig.debug > +++ b/lib/Kconfig.debug > @@ -197,6 +197,7 @@ config ENABLE_MUST_CHECK > config FRAME_WARN > int "Warn for stack frames larger than (needs gcc 4.4)" > range 0 8192 > + default 0 if KASAN > default 1024 if !64BIT > default 2048 if 64BIT > help > -- > 2.4.9 > -- Abylay Ospan, NetUP Inc. http://www.netup.tv ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Disable -Wframe-larger-than warnings with KASAN=y 2015-10-16 16:02 ` [PATCH] Disable -Wframe-larger-than warnings with KASAN=y Andrey Ryabinin 2015-10-16 16:05 ` Abylay Ospan @ 2015-10-16 16:47 ` Andi Kleen 2015-10-16 17:19 ` Andrey Ryabinin 1 sibling, 1 reply; 6+ messages in thread From: Andi Kleen @ 2015-10-16 16:47 UTC (permalink / raw) To: Andrey Ryabinin Cc: linux-kernel, Ingo Molnar, Andrew Morton, Fengguang Wu, Mauro Carvalho Chehab, Kozlov Sergey, kbuild-all, linux-media, Abylay Ospan On Fri, Oct 16, 2015 at 07:02:10PM +0300, Andrey Ryabinin wrote: > When the kernel compiled with KASAN=y, GCC adds redzones > for each variable on stack. This enlarges function's stack > frame and causes: > 'warning: the frame size of X bytes is larger than Y bytes' > > The worst case I've seen for now is following: > ../net/wireless/nl80211.c: In function ‘nl80211_send_wiphy’: > ../net/wireless/nl80211.c:1731:1: warning: the frame size of 5448 bytes is larger than 2048 bytes [-Wframe-larger-than=] > } > ^ > That kind of warning becomes useless with KASAN=y. It doesn't necessarily > indicate that there is some problem in the code, thus we should turn it off. If KASAN is really bloating the stack that much you may need to consider increasing the stack size with KASAN on. We have 16K now, but even that may not be enough if you more than double it. Otherwise it may just crash with KASAN on in more complex setups. -Andi ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Disable -Wframe-larger-than warnings with KASAN=y 2015-10-16 16:47 ` Andi Kleen @ 2015-10-16 17:19 ` Andrey Ryabinin 0 siblings, 0 replies; 6+ messages in thread From: Andrey Ryabinin @ 2015-10-16 17:19 UTC (permalink / raw) To: Andi Kleen, Andrey Ryabinin Cc: linux-kernel, Ingo Molnar, Andrew Morton, Fengguang Wu, Mauro Carvalho Chehab, Kozlov Sergey, kbuild-all, linux-media, Abylay Ospan 16 октября 2015 г. 19:47:00 GMT+03:00, Andi Kleen <ak@linux.intel.com> пишет: >On Fri, Oct 16, 2015 at 07:02:10PM +0300, Andrey Ryabinin wrote: >> When the kernel compiled with KASAN=y, GCC adds redzones >> for each variable on stack. This enlarges function's stack >> frame and causes: >> 'warning: the frame size of X bytes is larger than Y bytes' >> >> The worst case I've seen for now is following: >> ../net/wireless/nl80211.c: In function ‘nl80211_send_wiphy’: >> ../net/wireless/nl80211.c:1731:1: warning: the frame size of 5448 >bytes is larger than 2048 bytes [-Wframe-larger-than=] >> } >> ^ >> That kind of warning becomes useless with KASAN=y. It doesn't >necessarily >> indicate that there is some problem in the code, thus we should turn >it off. > >If KASAN is really bloating the stack that much you may need to >consider >increasing the stack size with KASAN on. We have 16K now, but even that >may not be enough if you more than double it. > Such huge bloat only in a few places, anyway it's done already. Stack is 32k with kasan. >Otherwise it may just crash with KASAN on in more complex setups. > >-Andi >-- >To unsubscribe from this list: send the line "unsubscribe linux-kernel" >in >the body of a message to majordomo@vger.kernel.org >More majordomo info at http://vger.kernel.org/majordomo-info.html >Please read the FAQ at http://www.tux.org/lkml/ ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-10-16 17:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CAK3bHNWkeakZP0cEi+U=GjmPa0jN9qWC4seyS6+ih8inzvmbXQ@mail.gmail.com>
2015-10-05 11:09 ` [kbuild-all] drivers/media/dvb-frontends/cxd2841er.c:2393:1: warning: the frame size of 2992 bytes is larger than 2048 bytes Fengguang Wu
2015-10-05 12:10 ` Andrey Ryabinin
2015-10-16 16:02 ` [PATCH] Disable -Wframe-larger-than warnings with KASAN=y Andrey Ryabinin
2015-10-16 16:05 ` Abylay Ospan
2015-10-16 16:47 ` Andi Kleen
2015-10-16 17:19 ` Andrey Ryabinin
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®