[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <acb5af81e9ab220d5567c853f8cee5f1333af641.1407764272.git.jani.nikula@intel.com>
Date: Mon, 11 Aug 2014 16:52:21 +0300
From: Jani Nikula <jani.nikula@...el.com>
To: linux-kernel@...r.kernel.org, intel-gfx@...ts.freedesktop.org
Cc: Rusty Russell <rusty@...tcorp.com.au>,
Jean Delvare <khali@...ux-fr.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Li Zhong <zhong@...ux.vnet.ibm.com>,
Jon Mason <jon.mason@...el.com>,
Daniel Vetter <daniel.vetter@...ll.ch>, jani.nikula@...el.com
Subject: [PATCH 3/4] module: add module_param_unsafe and module_param_named_unsafe
Add the helpers to be used by modules wishing to expose unsafe debugging
or testing module parameters that taint the kernel when set.
Cc: Rusty Russell <rusty@...tcorp.com.au>
Cc: Jean Delvare <khali@...ux-fr.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Li Zhong <zhong@...ux.vnet.ibm.com>
Cc: Jon Mason <jon.mason@...el.com>
Cc: Daniel Vetter <daniel.vetter@...ll.ch>
Signed-off-by: Jani Nikula <jani.nikula@...el.com>
---
include/linux/moduleparam.h | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 1e3ffb839daa..9531f9f9729e 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -123,6 +123,12 @@ struct kparam_array
module_param_named(name, name, type, perm)
/**
+ * module_param_unsafe - same as module_param but taints kernel
+ */
+#define module_param_unsafe(name, type, perm) \
+ module_param_named_unsafe(name, name, type, perm)
+
+/**
* module_param_named - typesafe helper for a renamed module/cmdline parameter
* @name: a valid C identifier which is the parameter name.
* @value: the actual lvalue to alter.
@@ -139,6 +145,14 @@ struct kparam_array
__MODULE_PARM_TYPE(name, #type)
/**
+ * module_param_named_unsafe - same as module_param_named but taints kernel
+ */
+#define module_param_named_unsafe(name, value, type, perm) \
+ param_check_##type(name, &(value)); \
+ module_param_cb_unsafe(name, ¶m_ops_##type, &value, perm); \
+ __MODULE_PARM_TYPE(name, #type)
+
+/**
* module_param_cb - general callback for a module/cmdline parameter
* @name: a valid C identifier which is the parameter name.
* @ops: the set & get operations for this parameter.
@@ -149,6 +163,10 @@ struct kparam_array
#define module_param_cb(name, ops, arg, perm) \
__module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, 0)
+#define module_param_cb_unsafe(name, ops, arg, perm) \
+ __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, \
+ KERNEL_PARAM_FL_UNSAFE)
+
/**
* <level>_param_cb - general callback for a module/cmdline parameter
* to be evaluated before certain initcall level
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists