diff mbox

default 0 if KASAN expression not working in kbuild

Message ID 18825051-61d0-e8a9-544a-4f7d89f30b3c@infradead.org (mailing list archive)
State New, archived
Headers show

Commit Message

Randy Dunlap Dec. 15, 2016, 9:32 p.m. UTC
On 12/15/16 10:09, Nikolay Borisov wrote:
> Hello,
> 
> I was doing some kasan-related debugging and when I enabled it I started
> getting warnings for large stackframes. So CONFIG_FRAME_WARN has :
> 
> int "Warn for stack frames larger than (needs gcc 4.4)"
>     range 0 8192
>     default 0 if KASAN
>     default 2048 if GCC_PLUGIN_LATENT_ENTROPY
>     default 1024 if !64BIT
>     default 2048 if 64BIT
> 
> This means that frame_warns should effectively be disabled when kasan is
> enabled. However in my case this is not the situation.
> http://sprunge.us/FiGf here is the config file. It does have
> CONFIG_KASAN=y and CONFIG_FRAME_WARN=1024 . And even this is erroneous
> since it's a 64bit kernel, so it should be 2k. I haven't manually set
> the limit to 1k either.

Yeah, it set FRAME_WARN=1024 for me also.

It seems to be dependent on order of kconfig symbols in
lib/Kconfig.debug.

If I move the line:
  source "lib/Kconfig.kasan"
to just after this line:
  menu "Compile-time checks and compiler options"
it seems to work for me.

Can you test the patch below?

Comments

Nikolay Borisov Dec. 16, 2016, 7:50 a.m. UTC | #1
On 15.12.2016 23:32, Randy Dunlap wrote:
> On 12/15/16 10:09, Nikolay Borisov wrote:
>> Hello,
>>
>> I was doing some kasan-related debugging and when I enabled it I started
>> getting warnings for large stackframes. So CONFIG_FRAME_WARN has :
>>
>> int "Warn for stack frames larger than (needs gcc 4.4)"
>>     range 0 8192
>>     default 0 if KASAN
>>     default 2048 if GCC_PLUGIN_LATENT_ENTROPY
>>     default 1024 if !64BIT
>>     default 2048 if 64BIT
>>
>> This means that frame_warns should effectively be disabled when kasan is
>> enabled. However in my case this is not the situation.
>> http://sprunge.us/FiGf here is the config file. It does have
>> CONFIG_KASAN=y and CONFIG_FRAME_WARN=1024 . And even this is erroneous
>> since it's a 64bit kernel, so it should be 2k. I haven't manually set
>> the limit to 1k either.
> 
> Yeah, it set FRAME_WARN=1024 for me also.
> 
> It seems to be dependent on order of kconfig symbols in
> lib/Kconfig.debug.
> 
> If I move the line:
>   source "lib/Kconfig.kasan"
> to just after this line:
>   menu "Compile-time checks and compiler options"
> it seems to work for me.
> 
> Can you test the patch below?

This patch has another problem that if I move the source line then I no
longer get the kasan option in Memory Debugging section, furthermore the
frame_warn wasn't changed either.


> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Nikolay Borisov Dec. 16, 2016, 7:53 a.m. UTC | #2
On 16.12.2016 09:50, Nikolay Borisov wrote:
> 
> 
> On 15.12.2016 23:32, Randy Dunlap wrote:
>> On 12/15/16 10:09, Nikolay Borisov wrote:
>>> Hello,
>>>
>>> I was doing some kasan-related debugging and when I enabled it I started
>>> getting warnings for large stackframes. So CONFIG_FRAME_WARN has :
>>>
>>> int "Warn for stack frames larger than (needs gcc 4.4)"
>>>     range 0 8192
>>>     default 0 if KASAN
>>>     default 2048 if GCC_PLUGIN_LATENT_ENTROPY
>>>     default 1024 if !64BIT
>>>     default 2048 if 64BIT
>>>
>>> This means that frame_warns should effectively be disabled when kasan is
>>> enabled. However in my case this is not the situation.
>>> http://sprunge.us/FiGf here is the config file. It does have
>>> CONFIG_KASAN=y and CONFIG_FRAME_WARN=1024 . And even this is erroneous
>>> since it's a 64bit kernel, so it should be 2k. I haven't manually set
>>> the limit to 1k either.
>>
>> Yeah, it set FRAME_WARN=1024 for me also.
>>
>> It seems to be dependent on order of kconfig symbols in
>> lib/Kconfig.debug.
>>
>> If I move the line:
>>   source "lib/Kconfig.kasan"
>> to just after this line:
>>   menu "Compile-time checks and compiler options"
>> it seems to work for me.
>>
>> Can you test the patch below?
> 
> This patch has another problem that if I move the source line then I no
> longer get the kasan option in Memory Debugging section, furthermore the
> frame_warn wasn't changed either.

So actually kasan is being moved to the "Compile-time checks" menu, yet
the frame size still isn't changed for me.

> 
> 
>>
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- lnx-49.orig/lib/Kconfig.debug
+++ lnx-49/lib/Kconfig.debug
@@ -117,6 +117,8 @@  endmenu # "printk and dmesg options"
 
 menu "Compile-time checks and compiler options"
 
+source "lib/Kconfig.kasan"
+
 config DEBUG_INFO
 	bool "Compile the kernel with debug info"
 	depends on DEBUG_KERNEL && !COMPILE_TEST
@@ -695,8 +697,6 @@  config DEBUG_STACKOVERFLOW
 
 source "lib/Kconfig.kmemcheck"
 
-source "lib/Kconfig.kasan"
-
 endmenu # "Memory Debugging"
 
 config ARCH_HAS_KCOV