From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 01/13] UBSAN: run-time undefined behavior sanity checker
Date: Mon, 27 Aug 2018 10:13:13 -0400 [thread overview]
Message-ID: <20180827141313.GO26633@bill-the-cat> (raw)
In-Reply-To: <20180826231332.2491-2-erosca@de.adit-jv.com>
On Mon, Aug 27, 2018 at 01:13:19AM +0200, Eugeniu Rosca wrote:
> Import Undefined Behavior SANitizer from Linux Kernel v4.18, as
> implemented by Andrey Ryabinin <aryabinin@virtuozzo.com>.
>
> Roughly, the UBSAN development history in Linux kernel looks like:
>
> v4.18 3ca17b1f3628 ("lib/ubsan: remove null-pointer checks")
> v4.17-rc1 317506009216 ("lib/test_ubsan.c: make test_ubsan_misaligned_access() static")
> v4.17-rc1 854686f4edf4 ("lib: add testing module for UBSAN")
> v4.16-rc1 bac7a1fff792 ("lib/ubsan: remove returns-nonnull-attribute checks")
> v4.16-rc1 42440c1f9911 ("lib/ubsan: add type mismatch handler for new GCC/Clang")
> v4.16-rc1 b8fe1120b4ba ("lib/ubsan.c: s/missaligned/misaligned/")
> v4.10-rc1 0462554707d6 ("Kconfig: lib/Kconfig.ubsan fix reference to ubsan documentation")
> v4.9-rc5 a76bcf557ef4 ("Kbuild: enable -Wmaybe-uninitialized warning for "make W=1"")
> v4.9-rc1 725c4d22bbc4 ("ubsan: allow to disable the null sanitizer")
> v4.9-rc1 1ead009cd622 ("docs: sphinxify ubsan.txt and move it to dev-tools")
> v4.8-rc1 901d805c33fc ("UBSAN: fix typo in format string")
> v4.8-rc1 6e8d666e9253 ("Disable "maybe-uninitialized" warning globally")
> v4.6-rc1 dde5cf39d4d2 ("ubsan: fix tree-wide -Wmaybe-uninitialized false positives")
> v4.5-rc4 7707535ab95e ("ubsan: cosmetic fix to Kconfig text")
> v4.5-rc1 bf76f73c5f65 ("powerpc: enable UBSAN support")
> v4.5-rc1 c6d308534aef ("UBSAN: run-time undefined behavior sanity checker")
>
> What's not interesting for U-Boot is:
> - 317506009216 ("lib/test_ubsan.c: make test_ubsan_misaligned_access() static")
> - 854686f4edf4 ("lib: add testing module for UBSAN")
> since they add a module-only test functionality.
> - any Documentation commits.
>
> Since dump_stack() evaluates to NOOP in U-Boot, the UBSAN report
> retains only the header from the original kernel report.
>
> As example, below is a UB found in U-Boot thanks to UBSAN:
>
> ====================================================================
> UBSAN: Undefined behaviour in drivers/net/phy/phy.c:728:19
> left shift of 1 by 31 places cannot be represented in type 'int'
> ====================================================================
>
> For comparison, below is a full-fledged kernel UBSAN report, based on
> v4.17-rc4 Linux commit 0dfc0c792d69 ("iommu/vt-d: fix shift-out-of-
> bounds in bug checking"):
>
> ================================================================================
> UBSAN: Undefined behaviour in drivers/iommu/dmar.c:1348:3
> shift exponent 64 is too large for 32-bit type 'int'
> CPU: 2 PID: 0 Comm: swapper/2 Tainted: G U 4.17.0-rc1+ #89
> Hardware name: Dell Inc. OptiPlex 7040/0Y7WYT, BIOS 1.2.8 01/26/2016
> Call Trace:
> <IRQ>
> dump_stack+0x90/0xfb
> ubsan_epilogue+0x9/0x40
> __ubsan_handle_shift_out_of_bounds+0x10e/0x170
> ? qi_flush_dev_iotlb+0x124/0x180
Reviewed-by: Tom Rini <trini@konsulko.com>
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180827/bef3dbb9/attachment.sig>
next prev parent reply other threads:[~2018-08-27 14:13 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-26 23:13 [U-Boot] [PATCH v2 00/13] Import Undefined Behavior Sanitizer Eugeniu Rosca
2018-08-26 23:13 ` [U-Boot] [PATCH v2 01/13] UBSAN: run-time undefined behavior sanity checker Eugeniu Rosca
2018-08-27 14:13 ` Tom Rini [this message]
2018-08-26 23:13 ` [U-Boot] [PATCH v2 02/13] mmc: Fix signed shift overflow Eugeniu Rosca
2018-08-26 23:13 ` [U-Boot] [PATCH v2 03/13] armv8: mmu: " Eugeniu Rosca
2018-08-27 14:13 ` Tom Rini
2018-08-26 23:13 ` [U-Boot] [PATCH v2 04/13] pinctrl: renesas: " Eugeniu Rosca
2018-08-26 23:13 ` [U-Boot] [PATCH v2 05/13] net: phy: " Eugeniu Rosca
2018-08-26 23:13 ` [U-Boot] [PATCH v2 06/13] net: ravb: " Eugeniu Rosca
2018-08-26 23:22 ` Marek Vasut
2018-08-27 20:24 ` Eugeniu Rosca
2018-08-27 23:55 ` Marek Vasut
2018-08-26 23:13 ` [U-Boot] [PATCH v2 07/13] x86: Fix signed shift overflow in MSR_IA32_APICBASE_BASE Eugeniu Rosca
2018-08-28 2:05 ` Bin Meng
2018-08-28 6:42 ` Eugeniu Rosca
2018-09-01 10:59 ` Eugeniu Rosca
2018-09-04 4:00 ` Bin Meng
2018-09-16 18:46 ` Eugeniu Rosca
2018-09-22 23:10 ` Eugeniu Rosca
2018-09-25 2:06 ` Bin Meng
2018-10-09 0:22 ` Eugeniu Rosca
2018-08-28 8:14 ` Andy Shevchenko
2018-08-26 23:13 ` [U-Boot] [PATCH v2 08/13] disk: part_dos: Fix signed shift overflow Eugeniu Rosca
2018-08-26 23:13 ` [U-Boot] [PATCH v2 09/13] common.h: Fix signed shift overflow in cpumask_next() Eugeniu Rosca
2018-08-26 23:13 ` [U-Boot] [PATCH v2 10/13] mmc: Fix read-past-end-of-array Eugeniu Rosca
2018-08-26 23:13 ` [U-Boot] [PATCH v2 11/13] hashtable: Fix zero-sized array Eugeniu Rosca
2018-08-27 14:13 ` Tom Rini
2018-08-26 23:13 ` [U-Boot] [PATCH v2 12/13] input: " Eugeniu Rosca
2018-08-27 14:13 ` Tom Rini
2018-08-26 23:13 ` [U-Boot] [PATCH v2 13/13] configs: sandbox*: Enable UBSAN Eugeniu Rosca
2018-08-30 2:51 ` Simon Glass
2018-09-17 21:10 ` Eugeniu Rosca
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=20180827141313.GO26633@bill-the-cat \
--to=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox