| .. | .. |
|---|
| 47 | 47 | #include <linux/bug.h> |
|---|
| 48 | 48 | #include <linux/sched.h> |
|---|
| 49 | 49 | #include <linux/rculist.h> |
|---|
| 50 | +#include <linux/ftrace.h> |
|---|
| 51 | + |
|---|
| 52 | +#include <trace/hooks/bug.h> |
|---|
| 50 | 53 | |
|---|
| 51 | 54 | extern struct bug_entry __start___bug_table[], __stop___bug_table[]; |
|---|
| 52 | 55 | |
|---|
| .. | .. |
|---|
| 153 | 156 | if (!bug) |
|---|
| 154 | 157 | return BUG_TRAP_TYPE_NONE; |
|---|
| 155 | 158 | |
|---|
| 159 | + disable_trace_on_warning(); |
|---|
| 160 | + |
|---|
| 156 | 161 | file = NULL; |
|---|
| 157 | 162 | line = 0; |
|---|
| 158 | 163 | |
|---|
| .. | .. |
|---|
| 178 | 183 | bug->flags |= BUGFLAG_DONE; |
|---|
| 179 | 184 | } |
|---|
| 180 | 185 | |
|---|
| 186 | + /* |
|---|
| 187 | + * BUG() and WARN_ON() families don't print a custom debug message |
|---|
| 188 | + * before triggering the exception handler, so we must add the |
|---|
| 189 | + * "cut here" line now. WARN() issues its own "cut here" before the |
|---|
| 190 | + * extra debugging message it writes before triggering the handler. |
|---|
| 191 | + */ |
|---|
| 192 | + if ((bug->flags & BUGFLAG_NO_CUT_HERE) == 0) |
|---|
| 193 | + printk(KERN_DEFAULT CUT_HERE); |
|---|
| 194 | + |
|---|
| 181 | 195 | if (warning) { |
|---|
| 182 | 196 | /* this is a WARN_ON rather than BUG/BUG_ON */ |
|---|
| 183 | 197 | __warn(file, line, (void *)bugaddr, BUG_GET_TAINT(bug), regs, |
|---|
| .. | .. |
|---|
| 185 | 199 | return BUG_TRAP_TYPE_WARN; |
|---|
| 186 | 200 | } |
|---|
| 187 | 201 | |
|---|
| 188 | | - printk(KERN_DEFAULT CUT_HERE); |
|---|
| 189 | | - |
|---|
| 190 | 202 | if (file) |
|---|
| 191 | 203 | pr_crit("kernel BUG at %s:%u!\n", file, line); |
|---|
| 192 | 204 | else |
|---|
| 193 | 205 | pr_crit("Kernel BUG at %pB [verbose debug info unavailable]\n", |
|---|
| 194 | 206 | (void *)bugaddr); |
|---|
| 195 | 207 | |
|---|
| 208 | + trace_android_rvh_report_bug(file, line, bugaddr); |
|---|
| 209 | + |
|---|
| 196 | 210 | return BUG_TRAP_TYPE_BUG; |
|---|
| 197 | 211 | } |
|---|
| 198 | 212 | |
|---|