diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-07 20:17:38 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-07 20:17:38 -0400 |
commit | bdf428feb225229b1d4715b45bbdad4a934cd89c (patch) | |
tree | 9bc47e348c2081fd46c0f7d715780ce294a6953d | |
parent | a40a7201a4584a66ab234ba1006472be952f20e0 (diff) | |
parent | 184c3fc3f52fb75800deb76deffb70907d1f76ea (diff) |
Merge tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux
Pull module update from Rusty Russell:
"Nothing major: support for compressing modules, and auto-tainting
params.
PS. My virtio-next tree is empty: DaveM took the patches I had. There
might be a virtio-rng starvation fix, but so far it's a bit voodoo
so I will get to that in the next two days or it will wait"
* tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
moduleparam: Resolve missing-field-initializer warning
kbuild: handle module compression while running 'make modules_install'.
modinst: wrap long lines in order to enhance cmd_modules_install
modsign: lookup lines ending in .ko in .mod files
modpost: simplify file name generation of *.mod.c files
modpost: reduce visibility of symbols and constify r/o arrays
param: check for tainting before calling set op.
drm/i915: taint the kernel if unsafe module parameters are set
module: add module_param_unsafe and module_param_named_unsafe
module: make it possible to have unsafe, tainting module params
module: rename KERNEL_PARAM_FL_NOARG to avoid confusion
-rw-r--r-- | Makefile | 15 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_params.c | 8 | ||||
-rw-r--r-- | drivers/tty/serial/8250/8250_core.c | 2 | ||||
-rw-r--r-- | include/linux/moduleparam.h | 50 | ||||
-rw-r--r-- | init/Kconfig | 43 | ||||
-rw-r--r-- | kernel/module.c | 2 | ||||
-rw-r--r-- | kernel/params.c | 17 | ||||
-rw-r--r-- | scripts/Makefile.modinst | 7 | ||||
-rw-r--r-- | scripts/Makefile.modsign | 2 | ||||
-rw-r--r-- | scripts/mod/modpost.c | 25 | ||||
-rw-r--r-- | security/apparmor/lsm.c | 4 |
11 files changed, 139 insertions, 36 deletions
@@ -842,6 +842,21 @@ mod_strip_cmd = true | |||
842 | endif # INSTALL_MOD_STRIP | 842 | endif # INSTALL_MOD_STRIP |
843 | export mod_strip_cmd | 843 | export mod_strip_cmd |
844 | 844 | ||
845 | # CONFIG_MODULE_COMPRESS, if defined, will cause module to be compressed | ||
846 | # after they are installed in agreement with CONFIG_MODULE_COMPRESS_GZIP | ||
847 | # or CONFIG_MODULE_COMPRESS_XZ. | ||
848 | |||
849 | mod_compress_cmd = true | ||
850 | ifdef CONFIG_MODULE_COMPRESS | ||
851 | ifdef CONFIG_MODULE_COMPRESS_GZIP | ||
852 | mod_compress_cmd = gzip -n | ||
853 | endif # CONFIG_MODULE_COMPRESS_GZIP | ||
854 | ifdef CONFIG_MODULE_COMPRESS_XZ | ||
855 | mod_compress_cmd = xz | ||
856 | endif # CONFIG_MODULE_COMPRESS_XZ | ||
857 | endif # CONFIG_MODULE_COMPRESS | ||
858 | export mod_compress_cmd | ||
859 | |||
845 | # Select initial ramdisk compression format, default is gzip(1). | 860 | # Select initial ramdisk compression format, default is gzip(1). |
846 | # This shall be used by the dracut(8) tool while creating an initramfs image. | 861 | # This shall be used by the dracut(8) tool while creating an initramfs image. |
847 | # | 862 | # |
diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c index 7f84dd263ee8..9842fd2e742a 100644 --- a/drivers/gpu/drm/i915/i915_params.c +++ b/drivers/gpu/drm/i915/i915_params.c | |||
@@ -66,12 +66,12 @@ module_param_named(powersave, i915.powersave, int, 0600); | |||
66 | MODULE_PARM_DESC(powersave, | 66 | MODULE_PARM_DESC(powersave, |
67 | "Enable powersavings, fbc, downclocking, etc. (default: true)"); | 67 | "Enable powersavings, fbc, downclocking, etc. (default: true)"); |
68 | 68 | ||
69 | module_param_named(semaphores, i915.semaphores, int, 0400); | 69 | module_param_named_unsafe(semaphores, i915.semaphores, int, 0400); |
70 | MODULE_PARM_DESC(semaphores, | 70 | MODULE_PARM_DESC(semaphores, |
71 | "Use semaphores for inter-ring sync " | 71 | "Use semaphores for inter-ring sync " |
72 | "(default: -1 (use per-chip defaults))"); | 72 | "(default: -1 (use per-chip defaults))"); |
73 | 73 | ||
74 | module_param_named(enable_rc6, i915.enable_rc6, int, 0400); | 74 | module_param_named_unsafe(enable_rc6, i915.enable_rc6, int, 0400); |
75 | MODULE_PARM_DESC(enable_rc6, | 75 | MODULE_PARM_DESC(enable_rc6, |
76 | "Enable power-saving render C-state 6. " | 76 | "Enable power-saving render C-state 6. " |
77 | "Different stages can be selected via bitmask values " | 77 | "Different stages can be selected via bitmask values " |
@@ -79,7 +79,7 @@ MODULE_PARM_DESC(enable_rc6, | |||
79 | "For example, 3 would enable rc6 and deep rc6, and 7 would enable everything. " | 79 | "For example, 3 would enable rc6 and deep rc6, and 7 would enable everything. " |
80 | "default: -1 (use per-chip default)"); | 80 | "default: -1 (use per-chip default)"); |
81 | 81 | ||
82 | module_param_named(enable_fbc, i915.enable_fbc, int, 0600); | 82 | module_param_named_unsafe(enable_fbc, i915.enable_fbc, int, 0600); |
83 | MODULE_PARM_DESC(enable_fbc, | 83 | MODULE_PARM_DESC(enable_fbc, |
84 | "Enable frame buffer compression for power savings " | 84 | "Enable frame buffer compression for power savings " |
85 | "(default: -1 (use per-chip default))"); | 85 | "(default: -1 (use per-chip default))"); |
@@ -113,7 +113,7 @@ MODULE_PARM_DESC(enable_hangcheck, | |||
113 | "WARNING: Disabling this can cause system wide hangs. " | 113 | "WARNING: Disabling this can cause system wide hangs. " |
114 | "(default: true)"); | 114 | "(default: true)"); |
115 | 115 | ||
116 | module_param_named(enable_ppgtt, i915.enable_ppgtt, int, 0400); | 116 | module_param_named_unsafe(enable_ppgtt, i915.enable_ppgtt, int, 0400); |
117 | MODULE_PARM_DESC(enable_ppgtt, | 117 | MODULE_PARM_DESC(enable_ppgtt, |
118 | "Override PPGTT usage. " | 118 | "Override PPGTT usage. " |
119 | "(-1=auto [default], 0=disabled, 1=aliasing, 2=full)"); | 119 | "(-1=auto [default], 0=disabled, 1=aliasing, 2=full)"); |
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index 1d42dba6121d..bd672948f2f1 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c | |||
@@ -3587,7 +3587,7 @@ static void __used s8250_options(void) | |||
3587 | #ifdef CONFIG_SERIAL_8250_RSA | 3587 | #ifdef CONFIG_SERIAL_8250_RSA |
3588 | __module_param_call(MODULE_PARAM_PREFIX, probe_rsa, | 3588 | __module_param_call(MODULE_PARAM_PREFIX, probe_rsa, |
3589 | ¶m_array_ops, .arr = &__param_arr_probe_rsa, | 3589 | ¶m_array_ops, .arr = &__param_arr_probe_rsa, |
3590 | 0444, -1); | 3590 | 0444, -1, 0); |
3591 | #endif | 3591 | #endif |
3592 | } | 3592 | } |
3593 | #else | 3593 | #else |
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index 494f99e852da..b43f4752304e 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h | |||
@@ -42,7 +42,7 @@ struct kernel_param; | |||
42 | * NOARG - the parameter allows for no argument (foo instead of foo=1) | 42 | * NOARG - the parameter allows for no argument (foo instead of foo=1) |
43 | */ | 43 | */ |
44 | enum { | 44 | enum { |
45 | KERNEL_PARAM_FL_NOARG = (1 << 0) | 45 | KERNEL_PARAM_OPS_FL_NOARG = (1 << 0) |
46 | }; | 46 | }; |
47 | 47 | ||
48 | struct kernel_param_ops { | 48 | struct kernel_param_ops { |
@@ -56,11 +56,21 @@ struct kernel_param_ops { | |||
56 | void (*free)(void *arg); | 56 | void (*free)(void *arg); |
57 | }; | 57 | }; |
58 | 58 | ||
59 | /* | ||
60 | * Flags available for kernel_param | ||
61 | * | ||
62 | * UNSAFE - the parameter is dangerous and setting it will taint the kernel | ||
63 | */ | ||
64 | enum { | ||
65 | KERNEL_PARAM_FL_UNSAFE = (1 << 0) | ||
66 | }; | ||
67 | |||
59 | struct kernel_param { | 68 | struct kernel_param { |
60 | const char *name; | 69 | const char *name; |
61 | const struct kernel_param_ops *ops; | 70 | const struct kernel_param_ops *ops; |
62 | u16 perm; | 71 | u16 perm; |
63 | s16 level; | 72 | s8 level; |
73 | u8 flags; | ||
64 | union { | 74 | union { |
65 | void *arg; | 75 | void *arg; |
66 | const struct kparam_string *str; | 76 | const struct kparam_string *str; |
@@ -113,6 +123,12 @@ struct kparam_array | |||
113 | module_param_named(name, name, type, perm) | 123 | module_param_named(name, name, type, perm) |
114 | 124 | ||
115 | /** | 125 | /** |
126 | * module_param_unsafe - same as module_param but taints kernel | ||
127 | */ | ||
128 | #define module_param_unsafe(name, type, perm) \ | ||
129 | module_param_named_unsafe(name, name, type, perm) | ||
130 | |||
131 | /** | ||
116 | * module_param_named - typesafe helper for a renamed module/cmdline parameter | 132 | * module_param_named - typesafe helper for a renamed module/cmdline parameter |
117 | * @name: a valid C identifier which is the parameter name. | 133 | * @name: a valid C identifier which is the parameter name. |
118 | * @value: the actual lvalue to alter. | 134 | * @value: the actual lvalue to alter. |
@@ -129,6 +145,14 @@ struct kparam_array | |||
129 | __MODULE_PARM_TYPE(name, #type) | 145 | __MODULE_PARM_TYPE(name, #type) |
130 | 146 | ||
131 | /** | 147 | /** |
148 | * module_param_named_unsafe - same as module_param_named but taints kernel | ||
149 | */ | ||
150 | #define module_param_named_unsafe(name, value, type, perm) \ | ||
151 | param_check_##type(name, &(value)); \ | ||
152 | module_param_cb_unsafe(name, ¶m_ops_##type, &value, perm); \ | ||
153 | __MODULE_PARM_TYPE(name, #type) | ||
154 | |||
155 | /** | ||
132 | * module_param_cb - general callback for a module/cmdline parameter | 156 | * module_param_cb - general callback for a module/cmdline parameter |
133 | * @name: a valid C identifier which is the parameter name. | 157 | * @name: a valid C identifier which is the parameter name. |
134 | * @ops: the set & get operations for this parameter. | 158 | * @ops: the set & get operations for this parameter. |
@@ -137,7 +161,11 @@ struct kparam_array | |||
137 | * The ops can have NULL set or get functions. | 161 | * The ops can have NULL set or get functions. |
138 | */ | 162 | */ |
139 | #define module_param_cb(name, ops, arg, perm) \ | 163 | #define module_param_cb(name, ops, arg, perm) \ |
140 | __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1) | 164 | __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, 0) |
165 | |||
166 | #define module_param_cb_unsafe(name, ops, arg, perm) \ | ||
167 | __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, \ | ||
168 | KERNEL_PARAM_FL_UNSAFE) | ||
141 | 169 | ||
142 | /** | 170 | /** |
143 | * <level>_param_cb - general callback for a module/cmdline parameter | 171 | * <level>_param_cb - general callback for a module/cmdline parameter |
@@ -149,7 +177,7 @@ struct kparam_array | |||
149 | * The ops can have NULL set or get functions. | 177 | * The ops can have NULL set or get functions. |
150 | */ | 178 | */ |
151 | #define __level_param_cb(name, ops, arg, perm, level) \ | 179 | #define __level_param_cb(name, ops, arg, perm, level) \ |
152 | __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, level) | 180 | __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, level, 0) |
153 | 181 | ||
154 | #define core_param_cb(name, ops, arg, perm) \ | 182 | #define core_param_cb(name, ops, arg, perm) \ |
155 | __level_param_cb(name, ops, arg, perm, 1) | 183 | __level_param_cb(name, ops, arg, perm, 1) |
@@ -184,22 +212,22 @@ struct kparam_array | |||
184 | 212 | ||
185 | /* This is the fundamental function for registering boot/module | 213 | /* This is the fundamental function for registering boot/module |
186 | parameters. */ | 214 | parameters. */ |
187 | #define __module_param_call(prefix, name, ops, arg, perm, level) \ | 215 | #define __module_param_call(prefix, name, ops, arg, perm, level, flags) \ |
188 | /* Default value instead of permissions? */ \ | 216 | /* Default value instead of permissions? */ \ |
189 | static const char __param_str_##name[] = prefix #name; \ | 217 | static const char __param_str_##name[] = prefix #name; \ |
190 | static struct kernel_param __moduleparam_const __param_##name \ | 218 | static struct kernel_param __moduleparam_const __param_##name \ |
191 | __used \ | 219 | __used \ |
192 | __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ | 220 | __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ |
193 | = { __param_str_##name, ops, VERIFY_OCTAL_PERMISSIONS(perm), \ | 221 | = { __param_str_##name, ops, VERIFY_OCTAL_PERMISSIONS(perm), \ |
194 | level, { arg } } | 222 | level, flags, { arg } } |
195 | 223 | ||
196 | /* Obsolete - use module_param_cb() */ | 224 | /* Obsolete - use module_param_cb() */ |
197 | #define module_param_call(name, set, get, arg, perm) \ | 225 | #define module_param_call(name, set, get, arg, perm) \ |
198 | static struct kernel_param_ops __param_ops_##name = \ | 226 | static struct kernel_param_ops __param_ops_##name = \ |
199 | { 0, (void *)set, (void *)get }; \ | 227 | { .flags = 0, (void *)set, (void *)get }; \ |
200 | __module_param_call(MODULE_PARAM_PREFIX, \ | 228 | __module_param_call(MODULE_PARAM_PREFIX, \ |
201 | name, &__param_ops_##name, arg, \ | 229 | name, &__param_ops_##name, arg, \ |
202 | (perm) + sizeof(__check_old_set_param(set))*0, -1) | 230 | (perm) + sizeof(__check_old_set_param(set))*0, -1, 0) |
203 | 231 | ||
204 | /* We don't get oldget: it's often a new-style param_get_uint, etc. */ | 232 | /* We don't get oldget: it's often a new-style param_get_uint, etc. */ |
205 | static inline int | 233 | static inline int |
@@ -279,7 +307,7 @@ static inline void __kernel_param_unlock(void) | |||
279 | */ | 307 | */ |
280 | #define core_param(name, var, type, perm) \ | 308 | #define core_param(name, var, type, perm) \ |
281 | param_check_##type(name, &(var)); \ | 309 | param_check_##type(name, &(var)); \ |
282 | __module_param_call("", name, ¶m_ops_##type, &var, perm, -1) | 310 | __module_param_call("", name, ¶m_ops_##type, &var, perm, -1, 0) |
283 | #endif /* !MODULE */ | 311 | #endif /* !MODULE */ |
284 | 312 | ||
285 | /** | 313 | /** |
@@ -297,7 +325,7 @@ static inline void __kernel_param_unlock(void) | |||
297 | = { len, string }; \ | 325 | = { len, string }; \ |
298 | __module_param_call(MODULE_PARAM_PREFIX, name, \ | 326 | __module_param_call(MODULE_PARAM_PREFIX, name, \ |
299 | ¶m_ops_string, \ | 327 | ¶m_ops_string, \ |
300 | .str = &__param_string_##name, perm, -1); \ | 328 | .str = &__param_string_##name, perm, -1, 0);\ |
301 | __MODULE_PARM_TYPE(name, "string") | 329 | __MODULE_PARM_TYPE(name, "string") |
302 | 330 | ||
303 | /** | 331 | /** |
@@ -444,7 +472,7 @@ extern int param_set_bint(const char *val, const struct kernel_param *kp); | |||
444 | __module_param_call(MODULE_PARAM_PREFIX, name, \ | 472 | __module_param_call(MODULE_PARAM_PREFIX, name, \ |
445 | ¶m_array_ops, \ | 473 | ¶m_array_ops, \ |
446 | .arr = &__param_arr_##name, \ | 474 | .arr = &__param_arr_##name, \ |
447 | perm, -1); \ | 475 | perm, -1, 0); \ |
448 | __MODULE_PARM_TYPE(name, "array of " #type) | 476 | __MODULE_PARM_TYPE(name, "array of " #type) |
449 | 477 | ||
450 | extern struct kernel_param_ops param_array_ops; | 478 | extern struct kernel_param_ops param_array_ops; |
diff --git a/init/Kconfig b/init/Kconfig index b48917717bae..e25a82a291a6 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -1919,6 +1919,49 @@ config MODULE_SIG_HASH | |||
1919 | default "sha384" if MODULE_SIG_SHA384 | 1919 | default "sha384" if MODULE_SIG_SHA384 |
1920 | default "sha512" if MODULE_SIG_SHA512 | 1920 | default "sha512" if MODULE_SIG_SHA512 |
1921 | 1921 | ||
1922 | config MODULE_COMPRESS | ||
1923 | bool "Compress modules on installation" | ||
1924 | depends on MODULES | ||
1925 | help | ||
1926 | This option compresses the kernel modules when 'make | ||
1927 | modules_install' is run. | ||
1928 | |||
1929 | The modules will be compressed either using gzip or xz depend on the | ||
1930 | choice made in "Compression algorithm". | ||
1931 | |||
1932 | module-init-tools has support for gzip format while kmod handle gzip | ||
1933 | and xz compressed modules. | ||
1934 | |||
1935 | When a kernel module is installed from outside of the main kernel | ||
1936 | source and uses the Kbuild system for installing modules then that | ||
1937 | kernel module will also be compressed when it is installed. | ||
1938 | |||
1939 | This option provides little benefit when the modules are to be used inside | ||
1940 | an initrd or initramfs, it generally is more efficient to compress the whole | ||
1941 | initrd or initramfs instead. | ||
1942 | |||
1943 | This is fully compatible with signed modules while the signed module is | ||
1944 | compressed. module-init-tools or kmod handles decompression and provide to | ||
1945 | other layer the uncompressed but signed payload. | ||
1946 | |||
1947 | choice | ||
1948 | prompt "Compression algorithm" | ||
1949 | depends on MODULE_COMPRESS | ||
1950 | default MODULE_COMPRESS_GZIP | ||
1951 | help | ||
1952 | This determines which sort of compression will be used during | ||
1953 | 'make modules_install'. | ||
1954 | |||
1955 | GZIP (default) and XZ are supported. | ||
1956 | |||
1957 | config MODULE_COMPRESS_GZIP | ||
1958 | bool "GZIP" | ||
1959 | |||
1960 | config MODULE_COMPRESS_XZ | ||
1961 | bool "XZ" | ||
1962 | |||
1963 | endchoice | ||
1964 | |||
1922 | endif # MODULES | 1965 | endif # MODULES |
1923 | 1966 | ||
1924 | config INIT_ALL_POSSIBLE | 1967 | config INIT_ALL_POSSIBLE |
diff --git a/kernel/module.c b/kernel/module.c index 03214bd288e9..8a0dc91eddbc 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -135,7 +135,7 @@ static int param_set_bool_enable_only(const char *val, | |||
135 | } | 135 | } |
136 | 136 | ||
137 | static const struct kernel_param_ops param_ops_bool_enable_only = { | 137 | static const struct kernel_param_ops param_ops_bool_enable_only = { |
138 | .flags = KERNEL_PARAM_FL_NOARG, | 138 | .flags = KERNEL_PARAM_OPS_FL_NOARG, |
139 | .set = param_set_bool_enable_only, | 139 | .set = param_set_bool_enable_only, |
140 | .get = param_get_bool, | 140 | .get = param_get_bool, |
141 | }; | 141 | }; |
diff --git a/kernel/params.c b/kernel/params.c index 34f527023794..041b5899d5e2 100644 --- a/kernel/params.c +++ b/kernel/params.c | |||
@@ -83,6 +83,15 @@ bool parameq(const char *a, const char *b) | |||
83 | return parameqn(a, b, strlen(a)+1); | 83 | return parameqn(a, b, strlen(a)+1); |
84 | } | 84 | } |
85 | 85 | ||
86 | static void param_check_unsafe(const struct kernel_param *kp) | ||
87 | { | ||
88 | if (kp->flags & KERNEL_PARAM_FL_UNSAFE) { | ||
89 | pr_warn("Setting dangerous option %s - tainting kernel\n", | ||
90 | kp->name); | ||
91 | add_taint(TAINT_USER, LOCKDEP_STILL_OK); | ||
92 | } | ||
93 | } | ||
94 | |||
86 | static int parse_one(char *param, | 95 | static int parse_one(char *param, |
87 | char *val, | 96 | char *val, |
88 | const char *doing, | 97 | const char *doing, |
@@ -104,11 +113,12 @@ static int parse_one(char *param, | |||
104 | return 0; | 113 | return 0; |
105 | /* No one handled NULL, so do it here. */ | 114 | /* No one handled NULL, so do it here. */ |
106 | if (!val && | 115 | if (!val && |
107 | !(params[i].ops->flags & KERNEL_PARAM_FL_NOARG)) | 116 | !(params[i].ops->flags & KERNEL_PARAM_OPS_FL_NOARG)) |
108 | return -EINVAL; | 117 | return -EINVAL; |
109 | pr_debug("handling %s with %p\n", param, | 118 | pr_debug("handling %s with %p\n", param, |
110 | params[i].ops->set); | 119 | params[i].ops->set); |
111 | mutex_lock(¶m_lock); | 120 | mutex_lock(¶m_lock); |
121 | param_check_unsafe(¶ms[i]); | ||
112 | err = params[i].ops->set(val, ¶ms[i]); | 122 | err = params[i].ops->set(val, ¶ms[i]); |
113 | mutex_unlock(¶m_lock); | 123 | mutex_unlock(¶m_lock); |
114 | return err; | 124 | return err; |
@@ -318,7 +328,7 @@ int param_get_bool(char *buffer, const struct kernel_param *kp) | |||
318 | EXPORT_SYMBOL(param_get_bool); | 328 | EXPORT_SYMBOL(param_get_bool); |
319 | 329 | ||
320 | struct kernel_param_ops param_ops_bool = { | 330 | struct kernel_param_ops param_ops_bool = { |
321 | .flags = KERNEL_PARAM_FL_NOARG, | 331 | .flags = KERNEL_PARAM_OPS_FL_NOARG, |
322 | .set = param_set_bool, | 332 | .set = param_set_bool, |
323 | .get = param_get_bool, | 333 | .get = param_get_bool, |
324 | }; | 334 | }; |
@@ -369,7 +379,7 @@ int param_set_bint(const char *val, const struct kernel_param *kp) | |||
369 | EXPORT_SYMBOL(param_set_bint); | 379 | EXPORT_SYMBOL(param_set_bint); |
370 | 380 | ||
371 | struct kernel_param_ops param_ops_bint = { | 381 | struct kernel_param_ops param_ops_bint = { |
372 | .flags = KERNEL_PARAM_FL_NOARG, | 382 | .flags = KERNEL_PARAM_OPS_FL_NOARG, |
373 | .set = param_set_bint, | 383 | .set = param_set_bint, |
374 | .get = param_get_int, | 384 | .get = param_get_int, |
375 | }; | 385 | }; |
@@ -552,6 +562,7 @@ static ssize_t param_attr_store(struct module_attribute *mattr, | |||
552 | return -EPERM; | 562 | return -EPERM; |
553 | 563 | ||
554 | mutex_lock(¶m_lock); | 564 | mutex_lock(¶m_lock); |
565 | param_check_unsafe(attribute->param); | ||
555 | err = attribute->param->ops->set(buf, attribute->param); | 566 | err = attribute->param->ops->set(buf, attribute->param); |
556 | mutex_unlock(¶m_lock); | 567 | mutex_unlock(¶m_lock); |
557 | if (!err) | 568 | if (!err) |
diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst index 95ec7b35e8b6..e48a4e9d8868 100644 --- a/scripts/Makefile.modinst +++ b/scripts/Makefile.modinst | |||
@@ -18,7 +18,12 @@ __modinst: $(modules) | |||
18 | 18 | ||
19 | # Don't stop modules_install if we can't sign external modules. | 19 | # Don't stop modules_install if we can't sign external modules. |
20 | quiet_cmd_modules_install = INSTALL $@ | 20 | quiet_cmd_modules_install = INSTALL $@ |
21 | cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@) ; $(mod_sign_cmd) $(2)/$(notdir $@) $(patsubst %,|| true,$(KBUILD_EXTMOD)) | 21 | cmd_modules_install = \ |
22 | mkdir -p $(2) ; \ | ||
23 | cp $@ $(2) ; \ | ||
24 | $(mod_strip_cmd) $(2)/$(notdir $@) ; \ | ||
25 | $(mod_sign_cmd) $(2)/$(notdir $@) $(patsubst %,|| true,$(KBUILD_EXTMOD)) ; \ | ||
26 | $(mod_compress_cmd) $(2)/$(notdir $@) | ||
22 | 27 | ||
23 | # Modules built outside the kernel source tree go into extra by default | 28 | # Modules built outside the kernel source tree go into extra by default |
24 | INSTALL_MOD_DIR ?= extra | 29 | INSTALL_MOD_DIR ?= extra |
diff --git a/scripts/Makefile.modsign b/scripts/Makefile.modsign index abfda626dbad..b6ac7084da79 100644 --- a/scripts/Makefile.modsign +++ b/scripts/Makefile.modsign | |||
@@ -7,7 +7,7 @@ __modsign: | |||
7 | 7 | ||
8 | include scripts/Kbuild.include | 8 | include scripts/Kbuild.include |
9 | 9 | ||
10 | __modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod))) | 10 | __modules := $(sort $(shell grep -h '\.ko$$' /dev/null $(wildcard $(MODVERDIR)/*.mod))) |
11 | modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o))) | 11 | modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o))) |
12 | 12 | ||
13 | PHONY += $(modules) | 13 | PHONY += $(modules) |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 091d90573b63..3b405c726ec5 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -24,9 +24,9 @@ | |||
24 | #include "../../include/linux/export.h" | 24 | #include "../../include/linux/export.h" |
25 | 25 | ||
26 | /* Are we using CONFIG_MODVERSIONS? */ | 26 | /* Are we using CONFIG_MODVERSIONS? */ |
27 | int modversions = 0; | 27 | static int modversions = 0; |
28 | /* Warn about undefined symbols? (do so if we have vmlinux) */ | 28 | /* Warn about undefined symbols? (do so if we have vmlinux) */ |
29 | int have_vmlinux = 0; | 29 | static int have_vmlinux = 0; |
30 | /* Is CONFIG_MODULE_SRCVERSION_ALL set? */ | 30 | /* Is CONFIG_MODULE_SRCVERSION_ALL set? */ |
31 | static int all_versions = 0; | 31 | static int all_versions = 0; |
32 | /* If we are modposting external module set to 1 */ | 32 | /* If we are modposting external module set to 1 */ |
@@ -229,7 +229,7 @@ static struct symbol *find_symbol(const char *name) | |||
229 | return NULL; | 229 | return NULL; |
230 | } | 230 | } |
231 | 231 | ||
232 | static struct { | 232 | static const struct { |
233 | const char *str; | 233 | const char *str; |
234 | enum export export; | 234 | enum export export; |
235 | } export_list[] = { | 235 | } export_list[] = { |
@@ -805,7 +805,7 @@ static int match(const char *sym, const char * const pat[]) | |||
805 | } | 805 | } |
806 | 806 | ||
807 | /* sections that we do not want to do full section mismatch check on */ | 807 | /* sections that we do not want to do full section mismatch check on */ |
808 | static const char *section_white_list[] = | 808 | static const char *const section_white_list[] = |
809 | { | 809 | { |
810 | ".comment*", | 810 | ".comment*", |
811 | ".debug*", | 811 | ".debug*", |
@@ -882,17 +882,18 @@ static void check_section(const char *modname, struct elf_info *elf, | |||
882 | #define MEM_EXIT_SECTIONS ".memexit.*" | 882 | #define MEM_EXIT_SECTIONS ".memexit.*" |
883 | 883 | ||
884 | /* init data sections */ | 884 | /* init data sections */ |
885 | static const char *init_data_sections[] = { ALL_INIT_DATA_SECTIONS, NULL }; | 885 | static const char *const init_data_sections[] = |
886 | { ALL_INIT_DATA_SECTIONS, NULL }; | ||
886 | 887 | ||
887 | /* all init sections */ | 888 | /* all init sections */ |
888 | static const char *init_sections[] = { ALL_INIT_SECTIONS, NULL }; | 889 | static const char *const init_sections[] = { ALL_INIT_SECTIONS, NULL }; |
889 | 890 | ||
890 | /* All init and exit sections (code + data) */ | 891 | /* All init and exit sections (code + data) */ |
891 | static const char *init_exit_sections[] = | 892 | static const char *const init_exit_sections[] = |
892 | {ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS, NULL }; | 893 | {ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS, NULL }; |
893 | 894 | ||
894 | /* data section */ | 895 | /* data section */ |
895 | static const char *data_sections[] = { DATA_SECTIONS, NULL }; | 896 | static const char *const data_sections[] = { DATA_SECTIONS, NULL }; |
896 | 897 | ||
897 | 898 | ||
898 | /* symbols in .data that may refer to init/exit sections */ | 899 | /* symbols in .data that may refer to init/exit sections */ |
@@ -906,8 +907,8 @@ static const char *data_sections[] = { DATA_SECTIONS, NULL }; | |||
906 | "*_probe_one", \ | 907 | "*_probe_one", \ |
907 | "*_console" | 908 | "*_console" |
908 | 909 | ||
909 | static const char *head_sections[] = { ".head.text*", NULL }; | 910 | static const char *const head_sections[] = { ".head.text*", NULL }; |
910 | static const char *linker_symbols[] = | 911 | static const char *const linker_symbols[] = |
911 | { "__init_begin", "_sinittext", "_einittext", NULL }; | 912 | { "__init_begin", "_sinittext", "_einittext", NULL }; |
912 | 913 | ||
913 | enum mismatch { | 914 | enum mismatch { |
@@ -929,7 +930,7 @@ struct sectioncheck { | |||
929 | const char *symbol_white_list[20]; | 930 | const char *symbol_white_list[20]; |
930 | }; | 931 | }; |
931 | 932 | ||
932 | const struct sectioncheck sectioncheck[] = { | 933 | static const struct sectioncheck sectioncheck[] = { |
933 | /* Do not reference init/exit code/data from | 934 | /* Do not reference init/exit code/data from |
934 | * normal code and data | 935 | * normal code and data |
935 | */ | 936 | */ |
@@ -2211,7 +2212,7 @@ int main(int argc, char **argv) | |||
2211 | err = 0; | 2212 | err = 0; |
2212 | 2213 | ||
2213 | for (mod = modules; mod; mod = mod->next) { | 2214 | for (mod = modules; mod; mod = mod->next) { |
2214 | char fname[strlen(mod->name) + 10]; | 2215 | char fname[PATH_MAX]; |
2215 | 2216 | ||
2216 | if (mod->skip) | 2217 | if (mod->skip) |
2217 | continue; | 2218 | continue; |
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c index 998100093332..65ca451a764d 100644 --- a/security/apparmor/lsm.c +++ b/security/apparmor/lsm.c | |||
@@ -668,7 +668,7 @@ static int param_set_aabool(const char *val, const struct kernel_param *kp); | |||
668 | static int param_get_aabool(char *buffer, const struct kernel_param *kp); | 668 | static int param_get_aabool(char *buffer, const struct kernel_param *kp); |
669 | #define param_check_aabool param_check_bool | 669 | #define param_check_aabool param_check_bool |
670 | static struct kernel_param_ops param_ops_aabool = { | 670 | static struct kernel_param_ops param_ops_aabool = { |
671 | .flags = KERNEL_PARAM_FL_NOARG, | 671 | .flags = KERNEL_PARAM_OPS_FL_NOARG, |
672 | .set = param_set_aabool, | 672 | .set = param_set_aabool, |
673 | .get = param_get_aabool | 673 | .get = param_get_aabool |
674 | }; | 674 | }; |
@@ -685,7 +685,7 @@ static int param_set_aalockpolicy(const char *val, const struct kernel_param *kp | |||
685 | static int param_get_aalockpolicy(char *buffer, const struct kernel_param *kp); | 685 | static int param_get_aalockpolicy(char *buffer, const struct kernel_param *kp); |
686 | #define param_check_aalockpolicy param_check_bool | 686 | #define param_check_aalockpolicy param_check_bool |
687 | static struct kernel_param_ops param_ops_aalockpolicy = { | 687 | static struct kernel_param_ops param_ops_aalockpolicy = { |
688 | .flags = KERNEL_PARAM_FL_NOARG, | 688 | .flags = KERNEL_PARAM_OPS_FL_NOARG, |
689 | .set = param_set_aalockpolicy, | 689 | .set = param_set_aalockpolicy, |
690 | .get = param_get_aalockpolicy | 690 | .get = param_get_aalockpolicy |
691 | }; | 691 | }; |