aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/asm-generic/bug.h10
-rw-r--r--kernel/panic.c15
2 files changed, 20 insertions, 5 deletions
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 1a0e1a7684bd..2632328d8646 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -32,11 +32,11 @@ struct bug_entry {
32#endif 32#endif
33 33
34#ifndef __WARN 34#ifndef __WARN
35#define __WARN() do { \ 35#ifndef __ASSEMBLY__
36 printk("WARNING: at %s:%d %s()\n", __FILE__, \ 36extern void warn_on_slowpath(const char *file, const int line);
37 __LINE__, __FUNCTION__); \ 37#define WANT_WARN_ON_SLOWPATH
38 dump_stack(); \ 38#endif
39} while (0) 39#define __WARN() warn_on_slowpath(__FILE__, __LINE__)
40#endif 40#endif
41 41
42#ifndef WARN_ON 42#ifndef WARN_ON
diff --git a/kernel/panic.c b/kernel/panic.c
index da4d6bac270e..0ebea438278a 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -20,6 +20,7 @@
20#include <linux/kexec.h> 20#include <linux/kexec.h>
21#include <linux/debug_locks.h> 21#include <linux/debug_locks.h>
22#include <linux/random.h> 22#include <linux/random.h>
23#include <linux/kallsyms.h>
23 24
24int panic_on_oops; 25int panic_on_oops;
25int tainted; 26int tainted;
@@ -292,6 +293,20 @@ void oops_exit(void)
292 (unsigned long long)oops_id); 293 (unsigned long long)oops_id);
293} 294}
294 295
296#ifdef WANT_WARN_ON_SLOWPATH
297void warn_on_slowpath(const char *file, int line)
298{
299 char function[KSYM_SYMBOL_LEN];
300 unsigned long caller = (unsigned long) __builtin_return_address(0);
301
302 sprint_symbol(function, caller);
303 printk(KERN_WARNING "WARNING: at %s:%d %s()\n", file,
304 line, function);
305 dump_stack();
306}
307EXPORT_SYMBOL(warn_on_slowpath);
308#endif
309
295#ifdef CONFIG_CC_STACKPROTECTOR 310#ifdef CONFIG_CC_STACKPROTECTOR
296/* 311/*
297 * Called when gcc's -fstack-protector feature is used, and 312 * Called when gcc's -fstack-protector feature is used, and