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

  ViewVC Help
Powered by ViewVC 1.1.20