Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 217323 | Differences between
and this patch

Collapse All | Expand All

(-)src/arch/alpha/Kconfig.orig (+26 lines)
Lines 616-621 config VERBOSE_MCHECK_ON Link Here
616
616
617
	  Take the default (1) unless you want more control or more info.
617
	  Take the default (1) unless you want more control or more info.
618
618
619
config ALPHA_UAC_SYSCTL
620
	bool "Configure UAC policy via sysctl"
621
	depends on SYSCTL
622
	default y
623
	---help---
624
	  Configuring the UAC (unaligned access control) policy on a Linux
625
	  system usually involves setting a compile time define. If you say
626
	  Y here, you will be able to modify the UAC policy at runtime using
627
	  the /proc interface.
628
629
	  The UAC policy defines the action Linux should take when an
630
	  unaligned memory access occurs. The action can include printing a
631
	  warning message (NOPRINT), sending a signal to the offending
632
	  program to help developers debug their applications (SIGBUS), or
633
	  disabling the transparent fixing (NOFIX).
634
635
	  The sysctls will be initialized to the compile-time defined UAC
636
	  policy. You can change these manually, or with the sysctl(8)
637
	  userspace utility.
638
639
	  To disable the warning messages at runtime, you would use
640
641
	    echo 1 > /proc/sys/kernel/uac/noprint
642
643
	  This is pretty harmless. Say Y if you're not sure.
644
619
source "drivers/pci/Kconfig"
645
source "drivers/pci/Kconfig"
620
source "drivers/eisa/Kconfig"
646
source "drivers/eisa/Kconfig"
621
647
(-)src/arch/alpha/kernel/traps.c.orig (+50 lines)
Lines 14-19 Link Here
14
#include <linux/delay.h>
14
#include <linux/delay.h>
15
#include <linux/smp_lock.h>
15
#include <linux/smp_lock.h>
16
#include <linux/module.h>
16
#include <linux/module.h>
17
#include <linux/sysctl.h>
17
#include <linux/init.h>
18
#include <linux/init.h>
18
#include <linux/kallsyms.h>
19
#include <linux/kallsyms.h>
19
20
Lines 102-107 static char * ireg_name[] = {"v0", "t0", Link Here
102
			   "t10", "t11", "ra", "pv", "at", "gp", "sp", "zero"};
103
			   "t10", "t11", "ra", "pv", "at", "gp", "sp", "zero"};
103
#endif
104
#endif
104
105
106
#ifdef CONFIG_ALPHA_UAC_SYSCTL
107
static struct ctl_table_header *uac_sysctl_header;
108
109
/* /proc/sys/kernel/uac */
110
enum
111
{
112
   /* UAC policy on Alpha */
113
   KERN_UAC_NOPRINT=1, /* int: printk() on unaligned access */
114
   KERN_UAC_SIGBUS=2,  /* int: send SIGBUS on unaligned access */
115
   KERN_UAC_NOFIX=3,   /* int: don't fix the unaligned access */
116
};
117
118
static int enabled_noprint = 0;
119
static int enabled_sigbus = 0;
120
static int enabled_nofix = 0;
121
122
ctl_table uac_table[] = {
123
	{KERN_UAC_NOPRINT, "noprint", &enabled_noprint, sizeof (int), 0644, NULL, NULL, &proc_dointvec},
124
	{KERN_UAC_SIGBUS, "sigbus", &enabled_sigbus, sizeof (int), 0644, NULL, NULL, &proc_dointvec},
125
	{KERN_UAC_NOFIX, "nofix", &enabled_nofix, sizeof (int), 0644, NULL, NULL, &proc_dointvec},
126
        {0}
127
};
128
129
static int __init init_uac_sysctl(void)
130
{
131
	/* Initialize sysctls with the #defined UAC policy */
132
	enabled_noprint = (test_thread_flag (TIF_UAC_NOPRINT)) ? 1 : 0;
133
	enabled_sigbus = (test_thread_flag (TIF_UAC_SIGBUS)) ? 1 : 0;
134
	enabled_nofix = (test_thread_flag (TIF_UAC_NOFIX)) ? 1 : 0;
135
	return 0;
136
}
137
#endif
138
105
static void
139
static void
106
dik_show_code(unsigned int *pc)
140
dik_show_code(unsigned int *pc)
107
{
141
{
Lines 780-786 do_entUnaUser(void __user * va, unsigned Link Here
780
	/* Check the UAC bits to decide what the user wants us to do
814
	/* Check the UAC bits to decide what the user wants us to do
781
	   with the unaliged access.  */
815
	   with the unaliged access.  */
782
816
817
#ifndef CONFIG_ALPHA_UAC_SYSCTL
783
	if (!test_thread_flag (TIF_UAC_NOPRINT)) {
818
	if (!test_thread_flag (TIF_UAC_NOPRINT)) {
819
#else  /* CONFIG_ALPHA_UAC_SYSCTL */
820
	if (!(enabled_noprint)) {
821
#endif /* CONFIG_ALPHA_UAC_SYSCTL */
784
		if (cnt >= 5 && jiffies - last_time > 5*HZ) {
822
		if (cnt >= 5 && jiffies - last_time > 5*HZ) {
785
			cnt = 0;
823
			cnt = 0;
786
		}
824
		}
Lines 791-800 do_entUnaUser(void __user * va, unsigned Link Here
791
		}
829
		}
792
		last_time = jiffies;
830
		last_time = jiffies;
793
	}
831
	}
832
#ifndef CONFIG_ALPHA_UAC_SYSCTL
794
	if (test_thread_flag (TIF_UAC_SIGBUS))
833
	if (test_thread_flag (TIF_UAC_SIGBUS))
834
#else  /* CONFIG_ALPHA_UAC_SYSCTL */
835
	if (enabled_sigbus)
836
#endif /* CONFIG_ALPHA_UAC_SYSCTL */
795
		goto give_sigbus;
837
		goto give_sigbus;
796
	/* Not sure why you'd want to use this, but... */
838
	/* Not sure why you'd want to use this, but... */
839
#ifndef CONFIG_ALPHA_UAC_SYSCTL
797
	if (test_thread_flag (TIF_UAC_NOFIX))
840
	if (test_thread_flag (TIF_UAC_NOFIX))
841
#else  /* CONFIG_ALPHA_UAC_SYSCTL */
842
	if (enabled_nofix)
843
#endif /* CONFIG_ALPHA_UAC_SYSCTL */
798
		return;
844
		return;
799
845
800
	/* Don't bother reading ds in the access check since we already
846
	/* Don't bother reading ds in the access check since we already
Lines 1089-1091 trap_init(void) Link Here
1089
	wrent(entSys, 5);
1135
	wrent(entSys, 5);
1090
	wrent(entDbg, 6);
1136
	wrent(entDbg, 6);
1091
}
1137
}
1138
1139
#ifdef CONFIG_ALPHA_UAC_SYSCTL
1140
__initcall(init_uac_sysctl);
1141
#endif
(-)src/kernel/sysctl.c.orig (+12 lines)
Lines 155-160 static int proc_dointvec_taint(struct ct Link Here
155
			       void __user *buffer, size_t *lenp, loff_t *ppos);
155
			       void __user *buffer, size_t *lenp, loff_t *ppos);
156
#endif
156
#endif
157
157
158
#ifdef CONFIG_ALPHA_UAC_SYSCTL
159
extern ctl_table uac_table[];
160
#endif
161
158
static struct ctl_table root_table[];
162
static struct ctl_table root_table[];
159
static struct ctl_table_header root_table_header =
163
static struct ctl_table_header root_table_header =
160
	{ root_table, LIST_HEAD_INIT(root_table_header.ctl_entry) };
164
	{ root_table, LIST_HEAD_INIT(root_table_header.ctl_entry) };
Lines 221-226 static struct ctl_table root_table[] = { Link Here
221
 * NOTE: do not add new entries to this table unless you have read
225
 * NOTE: do not add new entries to this table unless you have read
222
 * Documentation/sysctl/ctl_unnumbered.txt
226
 * Documentation/sysctl/ctl_unnumbered.txt
223
 */
227
 */
228
#ifdef CONFIG_ALPHA_UAC_SYSCTL
229
	{
230
		.ctl_name	= CTL_UNNUMBERED,
231
		.procname	= "uac",
232
		.mode		= 0555,
233
		.child		= uac_table,
234
	},
235
#endif /* CONFIG_ALPHA_UAC_SYSCTL */
224
	{ .ctl_name = 0 }
236
	{ .ctl_name = 0 }
225
};
237
};
226
238

Return to bug 217323