aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-10-07 20:17:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-07 20:17:38 -0400
commitbdf428feb225229b1d4715b45bbdad4a934cd89c (patch)
tree9bc47e348c2081fd46c0f7d715780ce294a6953d
parenta40a7201a4584a66ab234ba1006472be952f20e0 (diff)
parent184c3fc3f52fb75800deb76deffb70907d1f76ea (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--Makefile15
-rw-r--r--drivers/gpu/drm/i915/i915_params.c8
-rw-r--r--drivers/tty/serial/8250/8250_core.c2
-rw-r--r--include/linux/moduleparam.h50
-rw-r--r--init/Kconfig43
-rw-r--r--kernel/module.c2
-rw-r--r--kernel/params.c17
-rw-r--r--scripts/Makefile.modinst7
-rw-r--r--scripts/Makefile.modsign2
-rw-r--r--scripts/mod/modpost.c25
-rw-r--r--security/apparmor/lsm.c4
11 files changed, 139 insertions, 36 deletions
diff --git a/Makefile b/Makefile
index b77de27e58fc..5826c02842c4 100644
--- a/Makefile
+++ b/Makefile
@@ -842,6 +842,21 @@ mod_strip_cmd = true
842endif # INSTALL_MOD_STRIP 842endif # INSTALL_MOD_STRIP
843export mod_strip_cmd 843export 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
849mod_compress_cmd = true
850ifdef 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
857endif # CONFIG_MODULE_COMPRESS
858export 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);
66MODULE_PARM_DESC(powersave, 66MODULE_PARM_DESC(powersave,
67 "Enable powersavings, fbc, downclocking, etc. (default: true)"); 67 "Enable powersavings, fbc, downclocking, etc. (default: true)");
68 68
69module_param_named(semaphores, i915.semaphores, int, 0400); 69module_param_named_unsafe(semaphores, i915.semaphores, int, 0400);
70MODULE_PARM_DESC(semaphores, 70MODULE_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
74module_param_named(enable_rc6, i915.enable_rc6, int, 0400); 74module_param_named_unsafe(enable_rc6, i915.enable_rc6, int, 0400);
75MODULE_PARM_DESC(enable_rc6, 75MODULE_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
82module_param_named(enable_fbc, i915.enable_fbc, int, 0600); 82module_param_named_unsafe(enable_fbc, i915.enable_fbc, int, 0600);
83MODULE_PARM_DESC(enable_fbc, 83MODULE_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
116module_param_named(enable_ppgtt, i915.enable_ppgtt, int, 0400); 116module_param_named_unsafe(enable_ppgtt, i915.enable_ppgtt, int, 0400);
117MODULE_PARM_DESC(enable_ppgtt, 117MODULE_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 &param_array_ops, .arr = &__param_arr_probe_rsa, 3589 &param_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 */
44enum { 44enum {
45 KERNEL_PARAM_FL_NOARG = (1 << 0) 45 KERNEL_PARAM_OPS_FL_NOARG = (1 << 0)
46}; 46};
47 47
48struct kernel_param_ops { 48struct 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 */
64enum {
65 KERNEL_PARAM_FL_UNSAFE = (1 << 0)
66};
67
59struct kernel_param { 68struct 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, &param_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