From: aryabinin@virtuozzo.com (Andrey Ryabinin)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC][PATCH] arm: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL
Date: Tue, 21 Jun 2016 19:34:03 +0300 [thread overview]
Message-ID: <57696C7B.8050109@virtuozzo.com> (raw)
In-Reply-To: <3804659.HRLf903cuS@wuerfel>
On 06/21/2016 02:44 PM, Arnd Bergmann wrote:
> On Tuesday, June 21, 2016 10:43:19 AM CEST Arnd Bergmann wrote:
>> On Tuesday, June 21, 2016 2:39:05 PM CEST Seung-Woo Kim wrote:
>>> To enable UBSAN on arm, this patch enables ARCH_HAS_UBSAN_SANITIZE_ALL
>>> from arm confiuration. Basic kernel booting is tested on arm kernel
>>> enabled CONFIG_UBSAN_SANITIZE_ALL from Exynos5422 based Odroid-XU3
>>> board.
>>>
>>> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
>>> ---
>>> Because I tested only with specific soc board, so I am not sure the ubsan is
>>> fine for all other cases. So, I send this patch as a RFC.
>>>
>>
>> I've tried this out on my build test box in the past, but ran into
>> some problems. In particular I ended up disabling
>> -fsanitize=signed-integer-overflow and -fsanitize=object-size
>> and later reverting the whole thing, but don't remember exactly
>> why (possibly I was hitting internal compiler errors?).'
>>
>> Let me re-enable it with your patch locally and report back
>> with whatever build problems I run into.
>
> This is what I have run into so far, during a few dozen randconfig builds,
> this is with "arm-linux-gnueabi-gcc (GCC) 6.0.0 20160323 (experimental)"
> and I can try building a newer version if you think that helps.
>
Unlikely newer compiler will change anything. Ubsan causes register pressure and bloats code and stack.
We could workaround most of the build errors bellow by bumping CONFIG_FRAME_WARN limit.
> I left the duplicates in to show what happens how often:
>
> ../crypto/serpent_generic.c: In function '__serpent_setkey':
> ../crypto/serpent_generic.c:436:1: error: the frame size of 1080 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> ../drivers/media/dvb-frontends/mb86a16.c: In function 'mb86a16_set_fe':
> ../drivers/media/dvb-frontends/mb86a16.c:1522:1: error: the frame size of 1096 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> ../drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c: In function '_rtl8723be_read_adapter_info.constprop':
> ../drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c:2243:1: error: the frame size of 1032 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> ../drivers/gpu/drm/radeon/si_dpm.c: In function 'si_init_dte_leakage_table.constprop':
> ../drivers/gpu/drm/radeon/si_dpm.c:2614:1: error: the frame size of 1096 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> ../crypto/serpent_generic.c: In function '__serpent_setkey':
> ../crypto/serpent_generic.c:436:1: error: the frame size of 1072 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> ../crypto/serpent_generic.c: In function '__serpent_setkey':
> ../crypto/serpent_generic.c:436:1: error: the frame size of 1072 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> ../crypto/serpent_generic.c: In function '__serpent_setkey':
> ../crypto/serpent_generic.c:436:1: error: the frame size of 1072 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> drivers/media/built-in.o: In function `zl10353_calc_nominal_rate':
> tea575x.c:(.text+0x1caa94): undefined reference to `____ilog2_NaN'
> tea575x.c:(.text+0x1cafc8): undefined reference to `__aeabi_uldivmod'
> tea575x.c:(.text+0x1cb02c): undefined reference to `__aeabi_uldivmod'
> tea575x.c:(.text+0x1cb09c): undefined reference to `__aeabi_uldivmod'
> tea575x.c:(.text+0x1cb2d4): undefined reference to `__aeabi_uldivmod'
> tea575x.c:(.text+0x1cb3a8): undefined reference to `__aeabi_uldivmod'
> drivers/media/built-in.o:tea575x.c:(.text+0x1cb410): more undefined references to `__aeabi_uldivmod' follow
> ../drivers/video/fbdev/aty/atyfb_base.c: In function 'aty_bl_update_status':
> ../drivers/video/fbdev/aty/atyfb_base.c:167:33: error: array subscript is above array bounds [-Werror=array-bounds]
> return aty_ld_le32(lt_lcd_regs[index], par);
> ~~~~~~~~~~~^~~~~~~
This is just a bug in code. lt_lcd_regs[] has only 9 elements, while:
#define LCD_MISC_CNTL 0x14
....
aty_bl_update_status():
unsigned int reg = aty_ld_lcd(LCD_MISC_CNTL, par);
> ../drivers/video/fbdev/aty/atyfb_base.c:152:26: error: array subscript is above array bounds [-Werror=array-bounds]
> aty_st_le32(lt_lcd_regs[index], val, par);
> ../drivers/gpu/drm/radeon/si_dpm.c: In function 'si_init_dte_leakage_table.constprop':
> ../drivers/gpu/drm/radeon/si_dpm.c:2614:1: error: the frame size of 1096 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> ../crypto/serpent_generic.c: In function '__serpent_setkey':
> ../crypto/serpent_generic.c:436:1: error: the frame size of 1072 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> ../drivers/video/fbdev/aty/atyfb_base.c: In function 'aty_bl_update_status':
> ../drivers/video/fbdev/aty/atyfb_base.c:167:33: error: array subscript is above array bounds [-Werror=array-bounds]
> return aty_ld_le32(lt_lcd_regs[index], par);
> ~~~~~~~~~~~^~~~~~~
> ../drivers/video/fbdev/aty/atyfb_base.c:152:26: error: array subscript is above array bounds [-Werror=array-bounds]
> aty_st_le32(lt_lcd_regs[index], val, par);
> ../crypto/serpent_generic.c: In function '__serpent_setkey':
> ../crypto/serpent_generic.c:436:1: error: the frame size of 1080 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
>
>
> Some warnings go away after I turn off -fsanitize=signed-integer-overflow and
> -fsanitize=object-size, but the one in crypto/serpent_generic.c remains
> unchanged.
__serpent_setkey() bloat caused by alignment checks, i.e. -fsanitize=alignment
>
> Arnd
>
WARNING: multiple messages have this Message-ID (diff)
From: Andrey Ryabinin <aryabinin@virtuozzo.com>
To: Arnd Bergmann <arnd@arndb.de>, <linux-arm-kernel@lists.infradead.org>
Cc: Seung-Woo Kim <sw0312.kim@samsung.com>, <linux@armlinux.org.uk>,
<linux-kernel@vger.kernel.org>
Subject: Re: [RFC][PATCH] arm: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL
Date: Tue, 21 Jun 2016 19:34:03 +0300 [thread overview]
Message-ID: <57696C7B.8050109@virtuozzo.com> (raw)
In-Reply-To: <3804659.HRLf903cuS@wuerfel>
On 06/21/2016 02:44 PM, Arnd Bergmann wrote:
> On Tuesday, June 21, 2016 10:43:19 AM CEST Arnd Bergmann wrote:
>> On Tuesday, June 21, 2016 2:39:05 PM CEST Seung-Woo Kim wrote:
>>> To enable UBSAN on arm, this patch enables ARCH_HAS_UBSAN_SANITIZE_ALL
>>> from arm confiuration. Basic kernel booting is tested on arm kernel
>>> enabled CONFIG_UBSAN_SANITIZE_ALL from Exynos5422 based Odroid-XU3
>>> board.
>>>
>>> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
>>> ---
>>> Because I tested only with specific soc board, so I am not sure the ubsan is
>>> fine for all other cases. So, I send this patch as a RFC.
>>>
>>
>> I've tried this out on my build test box in the past, but ran into
>> some problems. In particular I ended up disabling
>> -fsanitize=signed-integer-overflow and -fsanitize=object-size
>> and later reverting the whole thing, but don't remember exactly
>> why (possibly I was hitting internal compiler errors?).'
>>
>> Let me re-enable it with your patch locally and report back
>> with whatever build problems I run into.
>
> This is what I have run into so far, during a few dozen randconfig builds,
> this is with "arm-linux-gnueabi-gcc (GCC) 6.0.0 20160323 (experimental)"
> and I can try building a newer version if you think that helps.
>
Unlikely newer compiler will change anything. Ubsan causes register pressure and bloats code and stack.
We could workaround most of the build errors bellow by bumping CONFIG_FRAME_WARN limit.
> I left the duplicates in to show what happens how often:
>
> ../crypto/serpent_generic.c: In function '__serpent_setkey':
> ../crypto/serpent_generic.c:436:1: error: the frame size of 1080 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> ../drivers/media/dvb-frontends/mb86a16.c: In function 'mb86a16_set_fe':
> ../drivers/media/dvb-frontends/mb86a16.c:1522:1: error: the frame size of 1096 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> ../drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c: In function '_rtl8723be_read_adapter_info.constprop':
> ../drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c:2243:1: error: the frame size of 1032 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> ../drivers/gpu/drm/radeon/si_dpm.c: In function 'si_init_dte_leakage_table.constprop':
> ../drivers/gpu/drm/radeon/si_dpm.c:2614:1: error: the frame size of 1096 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> ../crypto/serpent_generic.c: In function '__serpent_setkey':
> ../crypto/serpent_generic.c:436:1: error: the frame size of 1072 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> ../crypto/serpent_generic.c: In function '__serpent_setkey':
> ../crypto/serpent_generic.c:436:1: error: the frame size of 1072 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> ../crypto/serpent_generic.c: In function '__serpent_setkey':
> ../crypto/serpent_generic.c:436:1: error: the frame size of 1072 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> drivers/media/built-in.o: In function `zl10353_calc_nominal_rate':
> tea575x.c:(.text+0x1caa94): undefined reference to `____ilog2_NaN'
> tea575x.c:(.text+0x1cafc8): undefined reference to `__aeabi_uldivmod'
> tea575x.c:(.text+0x1cb02c): undefined reference to `__aeabi_uldivmod'
> tea575x.c:(.text+0x1cb09c): undefined reference to `__aeabi_uldivmod'
> tea575x.c:(.text+0x1cb2d4): undefined reference to `__aeabi_uldivmod'
> tea575x.c:(.text+0x1cb3a8): undefined reference to `__aeabi_uldivmod'
> drivers/media/built-in.o:tea575x.c:(.text+0x1cb410): more undefined references to `__aeabi_uldivmod' follow
> ../drivers/video/fbdev/aty/atyfb_base.c: In function 'aty_bl_update_status':
> ../drivers/video/fbdev/aty/atyfb_base.c:167:33: error: array subscript is above array bounds [-Werror=array-bounds]
> return aty_ld_le32(lt_lcd_regs[index], par);
> ~~~~~~~~~~~^~~~~~~
This is just a bug in code. lt_lcd_regs[] has only 9 elements, while:
#define LCD_MISC_CNTL 0x14
....
aty_bl_update_status():
unsigned int reg = aty_ld_lcd(LCD_MISC_CNTL, par);
> ../drivers/video/fbdev/aty/atyfb_base.c:152:26: error: array subscript is above array bounds [-Werror=array-bounds]
> aty_st_le32(lt_lcd_regs[index], val, par);
> ../drivers/gpu/drm/radeon/si_dpm.c: In function 'si_init_dte_leakage_table.constprop':
> ../drivers/gpu/drm/radeon/si_dpm.c:2614:1: error: the frame size of 1096 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> ../crypto/serpent_generic.c: In function '__serpent_setkey':
> ../crypto/serpent_generic.c:436:1: error: the frame size of 1072 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> ../drivers/video/fbdev/aty/atyfb_base.c: In function 'aty_bl_update_status':
> ../drivers/video/fbdev/aty/atyfb_base.c:167:33: error: array subscript is above array bounds [-Werror=array-bounds]
> return aty_ld_le32(lt_lcd_regs[index], par);
> ~~~~~~~~~~~^~~~~~~
> ../drivers/video/fbdev/aty/atyfb_base.c:152:26: error: array subscript is above array bounds [-Werror=array-bounds]
> aty_st_le32(lt_lcd_regs[index], val, par);
> ../crypto/serpent_generic.c: In function '__serpent_setkey':
> ../crypto/serpent_generic.c:436:1: error: the frame size of 1080 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
>
>
> Some warnings go away after I turn off -fsanitize=signed-integer-overflow and
> -fsanitize=object-size, but the one in crypto/serpent_generic.c remains
> unchanged.
__serpent_setkey() bloat caused by alignment checks, i.e. -fsanitize=alignment
>
> Arnd
>
next prev parent reply other threads:[~2016-06-21 16:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-21 5:39 [RFC][PATCH] arm: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL Seung-Woo Kim
2016-06-21 5:39 ` Seung-Woo Kim
2016-06-21 8:43 ` Arnd Bergmann
2016-06-21 8:43 ` Arnd Bergmann
2016-06-21 11:44 ` Arnd Bergmann
2016-06-21 11:44 ` Arnd Bergmann
2016-06-21 16:34 ` Andrey Ryabinin [this message]
2016-06-21 16:34 ` Andrey Ryabinin
2016-06-21 20:11 ` Arnd Bergmann
2016-06-21 20:11 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=57696C7B.8050109@virtuozzo.com \
--to=aryabinin@virtuozzo.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.