/[linux-patches]/genpatches-2.6/tags/2.6.28-1/4400_alpha-sysctl-uac.patch
Gentoo

Contents of /genpatches-2.6/tags/2.6.28-1/4400_alpha-sysctl-uac.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1451 - (show annotations) (download)
Thu Dec 25 01:56:17 2008 UTC (5 years, 11 months ago) by dsd
File size: 4916 byte(s)
2.6.28-1 release
1 Index: linux-2.6.26-gentoo/arch/alpha/Kconfig
2 ===================================================================
3 --- linux-2.6.26-gentoo.orig/arch/alpha/Kconfig
4 +++ linux-2.6.26-gentoo/arch/alpha/Kconfig
5 @@ -624,6 +624,32 @@ config HZ
6 default 1200 if ALPHA_RAWHIDE
7 default 1024
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 Index: linux-2.6.26-gentoo/arch/alpha/kernel/traps.c
39 ===================================================================
40 --- linux-2.6.26-gentoo.orig/arch/alpha/kernel/traps.c
41 +++ linux-2.6.26-gentoo/arch/alpha/kernel/traps.c
42 @@ -103,6 +103,52 @@ static char * ireg_name[] = {"v0", "t0",
43 "t10", "t11", "ra", "pv", "at", "gp", "sp", "zero"};
44 #endif
45
46 +#ifdef CONFIG_ALPHA_UAC_SYSCTL
47 +
48 +#include <linux/sysctl.h>
49 +
50 +static int enabled_noprint = 0;
51 +static int enabled_sigbus = 0;
52 +static int enabled_nofix = 0;
53 +
54 +ctl_table uac_table[] = {
55 + {
56 + .ctl_name = CTL_UNNUMBERED,
57 + .procname = "noprint",
58 + .data = &enabled_noprint,
59 + .maxlen = sizeof (int),
60 + .mode = 0644,
61 + .proc_handler = &proc_dointvec,
62 + },
63 + {
64 + .ctl_name = CTL_UNNUMBERED,
65 + .procname = "sigbus",
66 + .data = &enabled_sigbus,
67 + .maxlen = sizeof (int),
68 + .mode = 0644,
69 + .proc_handler = &proc_dointvec,
70 + },
71 + {
72 + .ctl_name = CTL_UNNUMBERED,
73 + .procname = "nofix",
74 + .data = &enabled_nofix,
75 + .maxlen = sizeof (int),
76 + .mode = 0644,
77 + .proc_handler = &proc_dointvec,
78 + },
79 + { .ctl_name = 0 }
80 +};
81 +
82 +static int __init init_uac_sysctl(void)
83 +{
84 + /* Initialize sysctls with the #defined UAC policy */
85 + enabled_noprint = (test_thread_flag (TIF_UAC_NOPRINT)) ? 1 : 0;
86 + enabled_sigbus = (test_thread_flag (TIF_UAC_SIGBUS)) ? 1 : 0;
87 + enabled_nofix = (test_thread_flag (TIF_UAC_NOFIX)) ? 1 : 0;
88 + return 0;
89 +}
90 +#endif
91 +
92 static void
93 dik_show_code(unsigned int *pc)
94 {
95 @@ -782,7 +828,11 @@ do_entUnaUser(void __user * va, unsigned
96 /* Check the UAC bits to decide what the user wants us to do
97 with the unaliged access. */
98
99 +#ifndef CONFIG_ALPHA_UAC_SYSCTL
100 if (!test_thread_flag (TIF_UAC_NOPRINT)) {
101 +#else /* CONFIG_ALPHA_UAC_SYSCTL */
102 + if (!(enabled_noprint)) {
103 +#endif /* CONFIG_ALPHA_UAC_SYSCTL */
104 if (cnt >= 5 && time_after(jiffies, last_time + 5 * HZ)) {
105 cnt = 0;
106 }
107 @@ -793,10 +843,18 @@ do_entUnaUser(void __user * va, unsigned
108 }
109 last_time = jiffies;
110 }
111 +#ifndef CONFIG_ALPHA_UAC_SYSCTL
112 if (test_thread_flag (TIF_UAC_SIGBUS))
113 +#else /* CONFIG_ALPHA_UAC_SYSCTL */
114 + if (enabled_sigbus)
115 +#endif /* CONFIG_ALPHA_UAC_SYSCTL */
116 goto give_sigbus;
117 /* Not sure why you'd want to use this, but... */
118 +#ifndef CONFIG_ALPHA_UAC_SYSCTL
119 if (test_thread_flag (TIF_UAC_NOFIX))
120 +#else /* CONFIG_ALPHA_UAC_SYSCTL */
121 + if (enabled_nofix)
122 +#endif /* CONFIG_ALPHA_UAC_SYSCTL */
123 return;
124
125 /* Don't bother reading ds in the access check since we already
126 @@ -1091,3 +1149,7 @@ trap_init(void)
127 wrent(entSys, 5);
128 wrent(entDbg, 6);
129 }
130 +
131 +#ifdef CONFIG_ALPHA_UAC_SYSCTL
132 + __initcall(init_uac_sysctl);
133 +#endif
134 Index: linux-2.6.26-gentoo/kernel/sysctl.c
135 ===================================================================
136 --- linux-2.6.26-gentoo.orig/kernel/sysctl.c
137 +++ linux-2.6.26-gentoo/kernel/sysctl.c
138 @@ -177,6 +177,9 @@ extern struct ctl_table random_table[];
139 #ifdef CONFIG_INOTIFY_USER
140 extern struct ctl_table inotify_table[];
141 #endif
142 +#ifdef CONFIG_ALPHA_UAC_SYSCTL
143 +extern struct ctl_table uac_table[];
144 +#endif
145
146 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
147 int sysctl_legacy_va_layout;
148 @@ -832,6 +835,14 @@ static struct ctl_table kern_table[] = {
149 * NOTE: do not add new entries to this table unless you have read
150 * Documentation/sysctl/ctl_unnumbered.txt
151 */
152 +#ifdef CONFIG_ALPHA_UAC_SYSCTL
153 + {
154 + .ctl_name = CTL_UNNUMBERED,
155 + .procname = "uac",
156 + .mode = 0555,
157 + .child = uac_table,
158 + },
159 +#endif /* CONFIG_ALPHA_UAC_SYSCTL */
160 { .ctl_name = 0 }
161 };
162

  ViewVC Help
Powered by ViewVC 1.1.20