summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2020-11-10 15:07:40 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2020-11-10 15:07:40 +0100
commitdeec4486e84448bfd8937a3cd142f349c5d4f49b (patch)
tree2c37ae456f32a289d724a573171fd53c6db7dc2a
parent7b1d8b4b3561c043a79d5933a7c1eb9266dc328d (diff)
parentb5260d5134fd57b0b07edf2605b33047dc1406e0 (diff)
downloadbarebox-deec4486e84448bfd8937a3cd142f349c5d4f49b.tar.gz
barebox-deec4486e84448bfd8937a3cd142f349c5d4f49b.tar.xz
Merge branch 'for-next/sandbox'
-rw-r--r--Makefile3
-rw-r--r--lib/ubsan.c20
2 files changed, 3 insertions, 20 deletions
diff --git a/Makefile b/Makefile
index 1323512dd2..52e8704ed8 100644
--- a/Makefile
+++ b/Makefile
@@ -619,6 +619,9 @@ KBUILD_CFLAGS += $(call cc-disable-warning, trampolines)
KBUILD_CFLAGS += $(call cc-option, -fno-delete-null-pointer-checks,)
+# disable invalid "can't wrap" optimizations for signed / pointers
+KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
+
KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
# Align the bit size of userspace programs with the kernel
diff --git a/lib/ubsan.c b/lib/ubsan.c
index 085d470cf7..648c7cc48a 100644
--- a/lib/ubsan.c
+++ b/lib/ubsan.c
@@ -382,26 +382,6 @@ void __ubsan_handle_shift_out_of_bounds(struct shift_out_of_bounds_data *data,
if (suppress_report(&data->location))
return;
- /* This handler would be called for code shifting a one into the
- * sign bit like (1 << 31), which is all too common in barebox.
- * It's technically UB, but it's so prevalent that it's highly
- * unlikely to be treated by a compiler as anything else than the
- * standard-compliant (1U << 31). Thus check for this case here
- * and ignore it selectively
- */
- if (type_is_signed(lhs_type)) {
- s_max lhs_int, rhs_int;
-
- lhs_int = get_signed_val(lhs_type, lhs);
- rhs_int = get_signed_val(rhs_type, rhs);
-
- if (fls(lhs_int) + rhs_int == type_bit_width(lhs_type)) {
- pr_debug("signed left shift of %lld by %lld ignored.\n",
- (s64)lhs_int, (s64)rhs_int);
- return;
- }
- }
-
ubsan_prologue(&data->location, &flags);
val_to_string(rhs_str, sizeof(rhs_str), rhs_type, rhs);