diff mbox series

[U-Boot,v2,13/13] configs: sandbox*: Enable UBSAN

Message ID 20180826231332.2491-14-erosca@de.adit-jv.com
State Changes Requested
Delegated to: Tom Rini
Headers show
Series Import Undefined Behavior Sanitizer | expand

Commit Message

Eugeniu Rosca Aug. 26, 2018, 11:13 p.m. UTC
On Sun, Aug 19, 2018 at 09:51:32PM -0400, Tom Rini wrote:
> [..] we should be able to say more broadly that just about everyone
> can enable this, but only out of the box sandbox should.

Hence, turn UBSAN on for every available sandbox flavor.
Make sure the inserted line complies with `make savedefconfig`.

The size increase of sandbox_defconfig U-Boot (gcc 8.1.0):
$ size u-boot.sandbox.*
    text    data     bss     dec     hex filename
 1234958   80048  291472 1606478  18834e u-boot.sandbox.default
 1422710  272240  291472 1986422  1e4f76 u-boot.sandbox.ubsan
 +187752 +192192       0 +379944

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
---

Changes in v2:
 - None. Newly pushed.
---
 configs/sandbox64_defconfig        | 1 +
 configs/sandbox_defconfig          | 1 +
 configs/sandbox_flattree_defconfig | 1 +
 configs/sandbox_noblk_defconfig    | 1 +
 configs/sandbox_spl_defconfig      | 1 +
 5 files changed, 5 insertions(+)

Comments

Simon Glass Aug. 30, 2018, 2:51 a.m. UTC | #1
Hi,

On 26 August 2018 at 17:13, Eugeniu Rosca <roscaeugeniu@gmail.com> wrote:
> On Sun, Aug 19, 2018 at 09:51:32PM -0400, Tom Rini wrote:
>> [..] we should be able to say more broadly that just about everyone
>> can enable this, but only out of the box sandbox should.
>
> Hence, turn UBSAN on for every available sandbox flavor.
> Make sure the inserted line complies with `make savedefconfig`.
>
> The size increase of sandbox_defconfig U-Boot (gcc 8.1.0):
> $ size u-boot.sandbox.*
>     text    data     bss     dec     hex filename
>  1234958   80048  291472 1606478  18834e u-boot.sandbox.default
>  1422710  272240  291472 1986422  1e4f76 u-boot.sandbox.ubsan
>  +187752 +192192       0 +379944
>
> Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
> ---
>
> Changes in v2:
>  - None. Newly pushed.
> ---
>  configs/sandbox64_defconfig        | 1 +
>  configs/sandbox_defconfig          | 1 +
>  configs/sandbox_flattree_defconfig | 1 +
>  configs/sandbox_noblk_defconfig    | 1 +
>  configs/sandbox_spl_defconfig      | 1 +
>  5 files changed, 5 insertions(+)
>

Can you please do this with an 'imply' in arch/Kconfig?

Regards,
Simon
Eugeniu Rosca Sept. 17, 2018, 9:10 p.m. UTC | #2
Hi Simon,

On Wed, Aug 29, 2018 at 08:51:24PM -0600, Simon Glass wrote:
> Hi,
> 
> On 26 August 2018 at 17:13, Eugeniu Rosca <roscaeugeniu@gmail.com> wrote:
> > On Sun, Aug 19, 2018 at 09:51:32PM -0400, Tom Rini wrote:
> >> [..] we should be able to say more broadly that just about everyone
> >> can enable this, but only out of the box sandbox should.
> >
> > Hence, turn UBSAN on for every available sandbox flavor.
> > Make sure the inserted line complies with `make savedefconfig`.
> >
> > The size increase of sandbox_defconfig U-Boot (gcc 8.1.0):
> > $ size u-boot.sandbox.*
> >     text    data     bss     dec     hex filename
> >  1234958   80048  291472 1606478  18834e u-boot.sandbox.default
> >  1422710  272240  291472 1986422  1e4f76 u-boot.sandbox.ubsan
> >  +187752 +192192       0 +379944
> >
> > Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
> > ---
> >
> > Changes in v2:
> >  - None. Newly pushed.
> > ---
> >  configs/sandbox64_defconfig        | 1 +
> >  configs/sandbox_defconfig          | 1 +
> >  configs/sandbox_flattree_defconfig | 1 +
> >  configs/sandbox_noblk_defconfig    | 1 +
> >  configs/sandbox_spl_defconfig      | 1 +
> >  5 files changed, 5 insertions(+)
> >
> 
> Can you please do this with an 'imply' in arch/Kconfig?

Thanks for your review comment. I will incorporate the change in the
next patch revision, once we clarify how to deal with the "left-shifting
of 1 into the sign bit" UBSAN warnings, which is being discussed in
https://patchwork.ozlabs.org/patch/962305/#1991283 .

> Regards,
> Simon

Regards,
Eugeniu.
diff mbox series

Patch

diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig
index ebb3716e487a..006b0505edbf 100644
--- a/configs/sandbox64_defconfig
+++ b/configs/sandbox64_defconfig
@@ -195,6 +195,7 @@  CONFIG_TPM=y
 CONFIG_LZ4=y
 CONFIG_ERRNO_STR=y
 CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_UBSAN=y
 CONFIG_UNIT_TEST=y
 CONFIG_UT_TIME=y
 CONFIG_UT_DM=y
diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 96e951493698..1a8434f403cb 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -200,6 +200,7 @@  CONFIG_TPM=y
 CONFIG_LZ4=y
 CONFIG_ERRNO_STR=y
 CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_UBSAN=y
 CONFIG_UNIT_TEST=y
 CONFIG_UT_TIME=y
 CONFIG_UT_DM=y
diff --git a/configs/sandbox_flattree_defconfig b/configs/sandbox_flattree_defconfig
index ca70f0437e40..0bcee60c4d77 100644
--- a/configs/sandbox_flattree_defconfig
+++ b/configs/sandbox_flattree_defconfig
@@ -171,6 +171,7 @@  CONFIG_CMD_DHRYSTONE=y
 CONFIG_TPM=y
 CONFIG_LZ4=y
 CONFIG_ERRNO_STR=y
+CONFIG_UBSAN=y
 CONFIG_UNIT_TEST=y
 CONFIG_UT_TIME=y
 CONFIG_UT_DM=y
diff --git a/configs/sandbox_noblk_defconfig b/configs/sandbox_noblk_defconfig
index f70088ad7e9b..5da95a8a1726 100644
--- a/configs/sandbox_noblk_defconfig
+++ b/configs/sandbox_noblk_defconfig
@@ -172,6 +172,7 @@  CONFIG_CMD_DHRYSTONE=y
 CONFIG_TPM=y
 CONFIG_LZ4=y
 CONFIG_ERRNO_STR=y
+CONFIG_UBSAN=y
 CONFIG_UNIT_TEST=y
 CONFIG_UT_TIME=y
 CONFIG_UT_DM=y
diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig
index 315f721266e9..ab331cb5ae2a 100644
--- a/configs/sandbox_spl_defconfig
+++ b/configs/sandbox_spl_defconfig
@@ -191,6 +191,7 @@  CONFIG_CMD_DHRYSTONE=y
 CONFIG_TPM=y
 CONFIG_LZ4=y
 CONFIG_ERRNO_STR=y
+CONFIG_UBSAN=y
 CONFIG_UNIT_TEST=y
 CONFIG_UT_TIME=y
 CONFIG_UT_DM=y