Re: [kbuild-all] drivers/media/dvb-frontends/cxd2841er.c:2393:1: warning: the frame size of 2992 bytes is larger than 2048 bytes

From: Andrey Ryabinin
Date: Mon Oct 05 2015 - 08:10:53 EST


2015-10-05 14:09 GMT+03:00 Fengguang Wu <fengguang.wu@xxxxxxxxx>:
> 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
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/