aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Chapman <doug.chapman@hp.com>2009-01-15 13:38:56 -0500
committerTony Luck <tony.luck@intel.com>2009-01-15 13:38:56 -0500
commit88fc241f54459ac3d86c5e13b449730199f66061 (patch)
treed8148e145e9252b76b12b8d466ff3ecbfa4222ea
parent0773a6cf673316440999752e23f8c3d4f85e48b9 (diff)
[IA64] dump stack on kernel unaligned warnings
Often the cause of kernel unaligned access warnings is not obvious from just the ip displayed in the warning. This adds the option via proc to dump the stack in addition to the warning. The default is off (just display the 1 line warning). To enable the stack to be shown: echo 1 > /proc/sys/kernel/unaligned-dump-stack Signed-off-by: Doug Chapman <doug.chapman@hp.com> Signed-off-by: Tony Luck <tony.luck@intel.com>
-rw-r--r--arch/ia64/kernel/unaligned.c6
-rw-r--r--kernel/sysctl.c9
2 files changed, 14 insertions, 1 deletions
diff --git a/arch/ia64/kernel/unaligned.c b/arch/ia64/kernel/unaligned.c
index ff0e7c10faa7..6db08599ebbc 100644
--- a/arch/ia64/kernel/unaligned.c
+++ b/arch/ia64/kernel/unaligned.c
@@ -59,6 +59,7 @@ dump (const char *str, void *vp, size_t len)
59 * (i.e. don't allow attacker to fill up logs with unaligned accesses). 59 * (i.e. don't allow attacker to fill up logs with unaligned accesses).
60 */ 60 */
61int no_unaligned_warning; 61int no_unaligned_warning;
62int unaligned_dump_stack;
62static int noprint_warning; 63static int noprint_warning;
63 64
64/* 65/*
@@ -1371,9 +1372,12 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
1371 } 1372 }
1372 } 1373 }
1373 } else { 1374 } else {
1374 if (within_logging_rate_limit()) 1375 if (within_logging_rate_limit()) {
1375 printk(KERN_WARNING "kernel unaligned access to 0x%016lx, ip=0x%016lx\n", 1376 printk(KERN_WARNING "kernel unaligned access to 0x%016lx, ip=0x%016lx\n",
1376 ifa, regs->cr_iip + ipsr->ri); 1377 ifa, regs->cr_iip + ipsr->ri);
1378 if (unaligned_dump_stack)
1379 dump_stack();
1380 }
1377 set_fs(KERNEL_DS); 1381 set_fs(KERNEL_DS);
1378 } 1382 }
1379 1383
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 3e38b74b6124..368d1638ee78 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -144,6 +144,7 @@ extern int acct_parm[];
144 144
145#ifdef CONFIG_IA64 145#ifdef CONFIG_IA64
146extern int no_unaligned_warning; 146extern int no_unaligned_warning;
147extern int unaligned_dump_stack;
147#endif 148#endif
148 149
149#ifdef CONFIG_RT_MUTEXES 150#ifdef CONFIG_RT_MUTEXES
@@ -781,6 +782,14 @@ static struct ctl_table kern_table[] = {
781 .mode = 0644, 782 .mode = 0644,
782 .proc_handler = &proc_dointvec, 783 .proc_handler = &proc_dointvec,
783 }, 784 },
785 {
786 .ctl_name = CTL_UNNUMBERED,
787 .procname = "unaligned-dump-stack",
788 .data = &unaligned_dump_stack,
789 .maxlen = sizeof (int),
790 .mode = 0644,
791 .proc_handler = &proc_dointvec,
792 },
784#endif 793#endif
785#ifdef CONFIG_DETECT_SOFTLOCKUP 794#ifdef CONFIG_DETECT_SOFTLOCKUP
786 { 795 {