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


Groups > linux.kernel > #1248945 > unrolled thread

[PATCH] Disable -Wframe-larger-than warnings with KASAN=y

Started byAndrey Ryabinin <aryabinin@virtuozzo.com>
First post2015-10-16 18:10 +0200
Last post2015-10-16 19:20 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH] Disable -Wframe-larger-than warnings with KASAN=y Andrey Ryabinin <aryabinin@virtuozzo.com> - 2015-10-16 18:10 +0200
    Re: [PATCH] Disable -Wframe-larger-than warnings with KASAN=y Andi Kleen <ak@linux.intel.com> - 2015-10-16 18:50 +0200
      Re: [PATCH] Disable -Wframe-larger-than warnings with KASAN=y Andrey Ryabinin <ryabinin.a.a@gmail.com> - 2015-10-16 19:20 +0200

#1248945 — [PATCH] Disable -Wframe-larger-than warnings with KASAN=y

FromAndrey Ryabinin <aryabinin@virtuozzo.com>
Date2015-10-16 18:10 +0200
Subject[PATCH] Disable -Wframe-larger-than warnings with KASAN=y
Message-ID<qkfJU-2V2-13@gated-at.bofh.it>
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

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

[toc] | [next] | [standalone]


#1248970

FromAndi Kleen <ak@linux.intel.com>
Date2015-10-16 18:50 +0200
Message-ID<qkgmB-3Fg-1@gated-at.bofh.it>
In reply to#1248945
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
--
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/

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


#1249010

FromAndrey Ryabinin <ryabinin.a.a@gmail.com>
Date2015-10-16 19:20 +0200
Message-ID<qkgPE-4tv-13@gated-at.bofh.it>
In reply to#1248970

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/

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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web