@@ -44,9 +44,10 @@ const char *report_ubsan_failure(struct pt_regs *regs, u32 check_type)
44
44
case ubsan_shift_out_of_bounds :
45
45
return "UBSAN: shift out of bounds" ;
46
46
#endif
47
- #ifdef CONFIG_UBSAN_DIV_ZERO
47
+ #if defined( CONFIG_UBSAN_DIV_ZERO ) || defined( CONFIG_UBSAN_SIGNED_WRAP )
48
48
/*
49
- * SanitizerKind::IntegerDivideByZero emits
49
+ * SanitizerKind::IntegerDivideByZero and
50
+ * SanitizerKind::SignedIntegerOverflow emit
50
51
* SanitizerHandler::DivremOverflow.
51
52
*/
52
53
case ubsan_divrem_overflow :
@@ -77,6 +78,19 @@ const char *report_ubsan_failure(struct pt_regs *regs, u32 check_type)
77
78
return "UBSAN: alignment assumption" ;
78
79
case ubsan_type_mismatch :
79
80
return "UBSAN: type mismatch" ;
81
+ #endif
82
+ #ifdef CONFIG_UBSAN_SIGNED_WRAP
83
+ /*
84
+ * SanitizerKind::SignedIntegerOverflow emits
85
+ * SanitizerHandler::AddOverflow, SanitizerHandler::SubOverflow,
86
+ * or SanitizerHandler::MulOverflow.
87
+ */
88
+ case ubsan_add_overflow :
89
+ return "UBSAN: integer addition overflow" ;
90
+ case ubsan_sub_overflow :
91
+ return "UBSAN: integer subtraction overflow" ;
92
+ case ubsan_mul_overflow :
93
+ return "UBSAN: integer multiplication overflow" ;
80
94
#endif
81
95
default :
82
96
return "UBSAN: unrecognized failure code" ;
0 commit comments