/[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 4 - (hide annotations) (download)
Sat Jun 11 23:20:41 2005 UTC (13 years, 3 months ago) by dsd
Original Path: genpatches-2.6/trunk/2.6.12-pre/1315_alpha-sysctl-uac.patch
File size: 5980 byte(s)
Create 2.6.12 branch
1 dsd 3 diff -X dontdiff -urNp linux-2.6.11-rc1-bk8/arch/alpha/Kconfig linux-dsd/arch/alpha/Kconfig
2     --- linux-2.6.11-rc1-bk8/arch/alpha/Kconfig 2005-01-21 19:21:07.000000000 +0000
3     +++ linux-dsd/arch/alpha/Kconfig 2005-01-21 19:36:16.166878648 +0000
4     @@ -558,6 +558,32 @@ config VERBOSE_MCHECK_ON
5    
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     diff -X dontdiff -urNp linux-2.6.11-rc1-bk8/arch/alpha/kernel/traps.c linux-dsd/arch/alpha/kernel/traps.c
38     --- linux-2.6.11-rc1-bk8/arch/alpha/kernel/traps.c 2004-12-24 21:35:24.000000000 +0000
39     +++ linux-dsd/arch/alpha/kernel/traps.c 2005-01-21 19:36:16.357849616 +0000
40     @@ -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     diff -X dontdiff -urNp linux-2.6.11-rc1-bk8/include/linux/sysctl.h linux-dsd/include/linux/sysctl.h
125     --- linux-2.6.11-rc1-bk8/include/linux/sysctl.h 2005-01-21 19:21:45.000000000 +0000
126     +++ linux-dsd/include/linux/sysctl.h 2005-01-21 19:37:09.469775376 +0000
127     @@ -135,6 +135,9 @@ enum
128     KERN_HZ_TIMER=65, /* int: hz timer on or off */
129     KERN_UNKNOWN_NMI_PANIC=66, /* int: unknown nmi panic flag */
130     KERN_BOOTLOADER_TYPE=67, /* int: boot loader type */
131     +#ifdef CONFIG_ALPHA_UAC_SYSCTL
132     + KERN_UAC_POLICY=68, /* int: Alpha unaligned access control policy flags */
133     +#endif /* CONFIG_ALPHA_UAC_SYSCTL */
134     };
135    
136    
137     @@ -212,6 +215,17 @@ enum
138     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     diff -X dontdiff -urNp linux-2.6.11-rc1-bk8/kernel/sysctl.c linux-dsd/kernel/sysctl.c
156     --- linux-2.6.11-rc1-bk8/kernel/sysctl.c 2005-01-21 19:21:45.000000000 +0000
157     +++ linux-dsd/kernel/sysctl.c 2005-01-21 19:36:16.533822864 +0000
158     @@ -144,6 +144,9 @@ extern ctl_table random_table[];
159     #ifdef CONFIG_UNIX98_PTYS
160     extern ctl_table pty_table[];
161     #endif
162     +#ifdef CONFIG_ALPHA_UAC_SYSCTL
163     +extern ctl_table uac_table[];
164     +#endif
165    
166     #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
167     int sysctl_legacy_va_layout;
168     @@ -216,6 +219,14 @@ static ctl_table root_table[] = {
169     .mode = 0555,
170     .child = dev_table,
171     },
172     +#ifdef CONFIG_ALPHA_UAC_SYSCTL
173     + {
174     + .ctl_name = KERN_UAC_POLICY,
175     + .procname = "uac",
176     + .mode = 0555,
177     + .child = uac_table,
178     + },
179     +#endif /* CONFIG_ALPHA_UAC_SYSCTL */
180     { .ctl_name = 0 }
181     };
182    

  ViewVC Help
Powered by ViewVC 1.1.20