Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1542959 > unrolled thread

default 0 if KASAN expression not working in kbuild

Started byNikolay Borisov <n.borisov.lkml@gmail.com>
First post2016-12-15 19:20 +0100
Last post2016-12-19 12:00 +0100
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  default 0 if KASAN expression not working in kbuild Nikolay Borisov <n.borisov.lkml@gmail.com> - 2016-12-15 19:20 +0100
    Re: default 0 if KASAN expression not working in kbuild Randy Dunlap <rdunlap@infradead.org> - 2016-12-15 22:40 +0100
      Re: default 0 if KASAN expression not working in kbuild Nikolay Borisov <n.borisov.lkml@gmail.com> - 2016-12-16 09:00 +0100
      Re: default 0 if KASAN expression not working in kbuild Nikolay Borisov <n.borisov.lkml@gmail.com> - 2016-12-16 09:00 +0100
    Re: default 0 if KASAN expression not working in kbuild Michal Marek <mmarek@suse.com> - 2016-12-19 12:00 +0100

#1542959 — default 0 if KASAN expression not working in kbuild

FromNikolay Borisov <n.borisov.lkml@gmail.com>
Date2016-12-15 19:20 +0100
Subjectdefault 0 if KASAN expression not working in kbuild
Message-ID<sOINk-G7-3@gated-at.bofh.it>
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.

Regards,
Nikolay

[toc] | [next] | [standalone]


#1543079

FromRandy Dunlap <rdunlap@infradead.org>
Date2016-12-15 22:40 +0100
Message-ID<sOLUR-2xu-9@gated-at.bofh.it>
In reply to#1542959
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?
-- 
~Randy



From: Randy Dunlap <rdunlap@infradead.org>

Move the KASAN kconfig symbols to above where they are used
so that their chosen values are used later.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
---
 lib/Kconfig.debug |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- 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

[toc] | [prev] | [next] | [standalone]


#1543233

FromNikolay Borisov <n.borisov.lkml@gmail.com>
Date2016-12-16 09:00 +0100
Message-ID<sOVAR-ya-1@gated-at.bofh.it>
In reply to#1543079

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.

> 
> 
>>

[toc] | [prev] | [next] | [standalone]


#1543234

FromNikolay Borisov <n.borisov.lkml@gmail.com>
Date2016-12-16 09:00 +0100
Message-ID<sOVAR-ya-3@gated-at.bofh.it>
In reply to#1543079

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.


> 

[toc] | [prev] | [next] | [standalone]


#1544455

FromMichal Marek <mmarek@suse.com>
Date2016-12-19 12:00 +0100
Message-ID<sQ3PI-6CU-27@gated-at.bofh.it>
In reply to#1542959
On 2016-12-15 19: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.

I guess the problem is that it's an option with a propt, so deviating
from the default value is legitimate. And most likely the
value is computed during menuconfig startup and a subsequent change of
CONFIG_KASAN does not change it (because 2048 or 1048 are also valid).

Michal

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web