Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Doug Chapman and committed by
Tony Luck
88fc241f 0773a6cf

+14 -1
+5 -1
arch/ia64/kernel/unaligned.c
··· 59 59 * (i.e. don't allow attacker to fill up logs with unaligned accesses). 60 60 */ 61 61 int no_unaligned_warning; 62 + int unaligned_dump_stack; 62 63 static int noprint_warning; 63 64 64 65 /* ··· 1372 1371 } 1373 1372 } 1374 1373 } else { 1375 - if (within_logging_rate_limit()) 1374 + if (within_logging_rate_limit()) { 1376 1375 printk(KERN_WARNING "kernel unaligned access to 0x%016lx, ip=0x%016lx\n", 1377 1376 ifa, regs->cr_iip + ipsr->ri); 1377 + if (unaligned_dump_stack) 1378 + dump_stack(); 1379 + } 1378 1380 set_fs(KERNEL_DS); 1379 1381 } 1380 1382
+9
kernel/sysctl.c
··· 144 144 145 145 #ifdef CONFIG_IA64 146 146 extern int no_unaligned_warning; 147 + extern int unaligned_dump_stack; 147 148 #endif 148 149 149 150 #ifdef CONFIG_RT_MUTEXES ··· 780 779 .data = &no_unaligned_warning, 781 780 .maxlen = sizeof (int), 782 781 .mode = 0644, 782 + .proc_handler = &proc_dointvec, 783 + }, 784 + { 785 + .ctl_name = CTL_UNNUMBERED, 786 + .procname = "unaligned-dump-stack", 787 + .data = &unaligned_dump_stack, 788 + .maxlen = sizeof (int), 789 + .mode = 0644, 783 790 .proc_handler = &proc_dointvec, 784 791 }, 785 792 #endif