Skip to contentSkip to conversation

ubsan-run-time-undefined-behavior-sanity-checker-fix-2

PATCH New Andrey Ryabinin 1 participant 1 message Dec 7, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ubsan-run-time-undefined-behavior-sanity-checker-fix-2

In GCC internals __ubsan_handle_builtin_unreachable() declared with "noreturn" attribute. Make it noreturn in-kernel too. Since we can't return from such function call panic() instead.

---
 lib/ubsan.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
lib/ubsan.c +4 -4
index 84e000f..479f582 100644
@@ -422,16 +422,16 @@ void __ubsan_handle_shift_out_of_bounds(struct shift_out_of_bounds_data *data,
 }
 EXPORT_SYMBOL(__ubsan_handle_shift_out_of_bounds);
 
-void __ubsan_handle_builtin_unreachable(struct unreachable_data *data)
+
+void __noreturn
+__ubsan_handle_builtin_unreachable(struct unreachable_data *data)
 {
 	unsigned long flags;
 
-	if (suppress_report(&data->location))
-		return;
-
 	ubsan_prologue(&data->location, &flags);
 	pr_err("calling __builtin_unreachable()\n");
 	ubsan_epilogue(&flags);
+	panic("can't return from __builtin_unreachable()");
 }
 EXPORT_SYMBOL(__ubsan_handle_builtin_unreachable);
 
Signature · 1 line
2.4.10