/[linux-patches]/genpatches-2.6/tags/2.6.19-3/4405_alpha-sysctl-uac.patch
Gentoo

Contents of /genpatches-2.6/tags/2.6.19-3/4405_alpha-sysctl-uac.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 651 - (hide annotations) (download)
Wed Sep 20 07:20:37 2006 UTC (11 years, 9 months ago) by phreak
Original Path: genpatches-2.6/trunk/2.6.18/4405_alpha-sysctl-uac.patch
File size: 5695 byte(s)
Linux 2.6.18 should be ready now.
1 phreak 574 Index: linux-2.6.18/arch/alpha/Kconfig
2 phreak 280 ===================================================================
3 phreak 574 --- linux-2.6.18.orig/arch/alpha/Kconfig
4     +++ linux-2.6.18/arch/alpha/Kconfig
5 phreak 376 @@ -590,6 +590,32 @@ config VERBOSE_MCHECK_ON
6 dsd 3
7     Take the default (1) unless you want more control or more info.
8    
9     +config ALPHA_UAC_SYSCTL
10     + bool "Configure UAC policy via sysctl"
11     + depends on SYSCTL
12     + default y
13     + ---help---
14     + Configuring the UAC (unaligned access control) policy on a Linux
15     + system usually involves setting a compile time define. If you say
16     + Y here, you will be able to modify the UAC policy at runtime using
17     + the /proc interface.
18     +
19     + The UAC policy defines the action Linux should take when an
20     + unaligned memory access occurs. The action can include printing a
21     + warning message (NOPRINT), sending a signal to the offending
22     + program to help developers debug their applications (SIGBUS), or
23     + disabling the transparent fixing (NOFIX).
24     +
25     + The sysctls will be initialized to the compile-time defined UAC
26     + policy. You can change these manually, or with the sysctl(8)
27     + userspace utility.
28     +
29     + To disable the warning messages at runtime, you would use
30     +
31     + echo 1 > /proc/sys/kernel/uac/noprint
32     +
33     + This is pretty harmless. Say Y if you're not sure.
34     +
35     source "drivers/pci/Kconfig"
36     source "drivers/eisa/Kconfig"
37    
38 phreak 574 Index: linux-2.6.18/arch/alpha/kernel/traps.c
39 phreak 280 ===================================================================
40 phreak 574 --- linux-2.6.18.orig/arch/alpha/kernel/traps.c
41     +++ linux-2.6.18/arch/alpha/kernel/traps.c
42 phreak 528 @@ -14,6 +14,7 @@
43 dsd 3 #include <linux/delay.h>
44     #include <linux/smp_lock.h>
45     #include <linux/module.h>
46     +#include <linux/sysctl.h>
47     #include <linux/init.h>
48     #include <linux/kallsyms.h>
49    
50 phreak 528 @@ -102,6 +103,38 @@ static char * ireg_name[] = {"v0", "t0",
51 dsd 3 "t10", "t11", "ra", "pv", "at", "gp", "sp", "zero"};
52     #endif
53    
54     +#ifdef CONFIG_ALPHA_UAC_SYSCTL
55     +static struct ctl_table_header *uac_sysctl_header;
56     +
57     +static int enabled_noprint = 0;
58     +static int enabled_sigbus = 0;
59     +static int enabled_nofix = 0;
60     +
61     +ctl_table uac_table[] = {
62     + {KERN_UAC_NOPRINT, "noprint", &enabled_noprint, sizeof (int), 0644, NULL, &proc_dointvec},
63     + {KERN_UAC_SIGBUS, "sigbus", &enabled_sigbus, sizeof (int), 0644, NULL, &proc_dointvec},
64     + {KERN_UAC_NOFIX, "nofix", &enabled_nofix, sizeof (int), 0644, NULL, &proc_dointvec},
65     + {0}
66     +};
67     +
68     +static int __init init_uac_sysctl(void)
69     +{
70     + /* Initialize sysctls with the #defined UAC policy */
71     + enabled_noprint = (test_thread_flag (TIF_UAC_NOPRINT)) ? 1 : 0;
72     + enabled_sigbus = (test_thread_flag (TIF_UAC_SIGBUS)) ? 1 : 0;
73     + enabled_nofix = (test_thread_flag (TIF_UAC_NOFIX)) ? 1 : 0;
74     +
75 phreak 280 + /* save this for later so we can clean up */
76 dsd 3 + uac_sysctl_header = register_sysctl_table(uac_table, 0);
77     + return 0;
78     +}
79     +
80     +static void __exit exit_uac_sysctl(void)
81     +{
82     + unregister_sysctl_table(uac_sysctl_header);
83     +}
84     +#endif
85     +
86     static void
87     dik_show_code(unsigned int *pc)
88     {
89 phreak 528 @@ -779,7 +812,11 @@ do_entUnaUser(void __user * va, unsigned
90 dsd 3 /* Check the UAC bits to decide what the user wants us to do
91     with the unaliged access. */
92    
93     +#ifndef CONFIG_ALPHA_UAC_SYSCTL
94     if (!test_thread_flag (TIF_UAC_NOPRINT)) {
95     +#else /* CONFIG_ALPHA_UAC_SYSCTL */
96     + if (!(enabled_noprint)) {
97     +#endif /* CONFIG_ALPHA_UAC_SYSCTL */
98     if (cnt >= 5 && jiffies - last_time > 5*HZ) {
99     cnt = 0;
100     }
101 phreak 528 @@ -790,10 +827,18 @@ do_entUnaUser(void __user * va, unsigned
102 dsd 3 }
103     last_time = jiffies;
104     }
105     +#ifndef CONFIG_ALPHA_UAC_SYSCTL
106     if (test_thread_flag (TIF_UAC_SIGBUS))
107     +#else /* CONFIG_ALPHA_UAC_SYSCTL */
108     + if (enabled_sigbus)
109     +#endif /* CONFIG_ALPHA_UAC_SYSCTL */
110     goto give_sigbus;
111     /* Not sure why you'd want to use this, but... */
112     +#ifndef CONFIG_ALPHA_UAC_SYSCTL
113     if (test_thread_flag (TIF_UAC_NOFIX))
114     +#else /* CONFIG_ALPHA_UAC_SYSCTL */
115     + if (enabled_nofix)
116     +#endif /* CONFIG_ALPHA_UAC_SYSCTL */
117     return;
118    
119     /* Don't bother reading ds in the access check since we already
120 phreak 528 @@ -1088,3 +1133,5 @@ trap_init(void)
121 dsd 3 wrent(entSys, 5);
122     wrent(entDbg, 6);
123     }
124     +
125     +__initcall(init_uac_sysctl);
126 phreak 574 Index: linux-2.6.18/include/linux/sysctl.h
127 phreak 280 ===================================================================
128 phreak 574 --- linux-2.6.18.orig/include/linux/sysctl.h
129     +++ linux-2.6.18/include/linux/sysctl.h
130 phreak 528 @@ -151,6 +151,9 @@ enum
131     KERN_COMPAT_LOG=73, /* int: print compat layer messages */
132     KERN_MAX_LOCK_DEPTH=74,
133     KERN_FBSPLASH=75, /* string: path to fbsplash helper */
134 dsd 3 +#ifdef CONFIG_ALPHA_UAC_SYSCTL
135 phreak 528 + KERN_UAC_POLICY=76, /* int: Alpha unaligned access control policy flags */
136 dsd 3 +#endif /* CONFIG_ALPHA_UAC_SYSCTL */
137     };
138    
139    
140 phreak 528 @@ -238,6 +241,17 @@ enum
141 dsd 3 PTY_NR=2
142     };
143    
144     +#ifdef CONFIG_ALPHA_UAC_SYSCTL
145     +/* /proc/sys/kernel/uac */
146     +enum
147     +{
148     + /* UAC policy on Alpha */
149     + KERN_UAC_NOPRINT=1, /* int: printk() on unaligned access */
150     + KERN_UAC_SIGBUS=2, /* int: send SIGBUS on unaligned access */
151     + KERN_UAC_NOFIX=3, /* int: don't fix the unaligned access */
152     +};
153     +#endif /* CONFIG_ALPHA_UAC_SYSCTL */
154     +
155     /* /proc/sys/bus/isa */
156     enum
157     {
158 phreak 574 Index: linux-2.6.18/kernel/sysctl.c
159 phreak 280 ===================================================================
160 phreak 574 --- linux-2.6.18.orig/kernel/sysctl.c
161     +++ linux-2.6.18/kernel/sysctl.c
162 phreak 528 @@ -164,6 +164,9 @@ extern ctl_table inotify_table[];
163 dsd 124 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
164     int sysctl_legacy_va_layout;
165 dsd 3 #endif
166     +#ifdef CONFIG_ALPHA_UAC_SYSCTL
167     +extern ctl_table uac_table[];
168     +#endif
169    
170 dsd 124 /* /proc declarations: */
171    
172 phreak 528 @@ -226,7 +229,14 @@ static ctl_table root_table[] = {
173 dsd 3 .mode = 0555,
174     .child = dev_table,
175     },
176 dsd 98 -
177 dsd 3 +#ifdef CONFIG_ALPHA_UAC_SYSCTL
178     + {
179     + .ctl_name = KERN_UAC_POLICY,
180     + .procname = "uac",
181     + .mode = 0555,
182     + .child = uac_table,
183     + },
184     +#endif /* CONFIG_ALPHA_UAC_SYSCTL */
185     { .ctl_name = 0 }
186     };
187    

  ViewVC Help
Powered by ViewVC 1.1.20