+++ /dev/null
-dnl #
-dnl # Grsecurity kernel API change
-dnl # constified parameters of module_param_call() methods
-dnl #
-AC_DEFUN([ZFS_AC_KERNEL_SRC_MODULE_PARAM_CALL_CONST], [
- ZFS_LINUX_TEST_SRC([module_param_call], [
- #include <linux/module.h>
- #include <linux/moduleparam.h>
-
- int param_get(char *b, const struct kernel_param *kp)
- {
- return (0);
- }
-
- int param_set(const char *b, const struct kernel_param *kp)
- {
- return (0);
- }
-
- module_param_call(p, param_set, param_get, NULL, 0644);
- ],[])
-])
-
-AC_DEFUN([ZFS_AC_KERNEL_MODULE_PARAM_CALL_CONST], [
- AC_MSG_CHECKING([whether module_param_call() is hardened])
- ZFS_LINUX_TEST_RESULT([module_param_call], [
- AC_MSG_RESULT(yes)
- AC_DEFINE(MODULE_PARAM_CALL_CONST, 1,
- [hardened module_param_call])
- ],[
- AC_MSG_RESULT(no)
- ])
-])
ZFS_AC_KERNEL_SRC_FMODE_T
ZFS_AC_KERNEL_SRC_KUIDGID_T
ZFS_AC_KERNEL_SRC_KUID_HELPERS
- ZFS_AC_KERNEL_SRC_MODULE_PARAM_CALL_CONST
ZFS_AC_KERNEL_SRC_RENAME
ZFS_AC_KERNEL_SRC_CURRENT_TIME
ZFS_AC_KERNEL_SRC_USERNS_CAPABILITIES
ZFS_AC_KERNEL_FMODE_T
ZFS_AC_KERNEL_KUIDGID_T
ZFS_AC_KERNEL_KUID_HELPERS
- ZFS_AC_KERNEL_MODULE_PARAM_CALL_CONST
ZFS_AC_KERNEL_RENAME
ZFS_AC_KERNEL_CURRENT_TIME
ZFS_AC_KERNEL_USERNS_CAPABILITIES
#include <linux/module.h>
#include <linux/moduleparam.h>
-/* Grsecurity kernel API change */
-#ifdef MODULE_PARAM_CALL_CONST
+/*
+ * Despite constifying struct kernel_param_ops, some older kernels define a
+ * `__check_old_set_param()` function in their headers that checks for a
+ * non-constified `->set()`. This has long been fixed in Linux mainline, but
+ * since we support older kernels, we workaround it by using a preprocessor
+ * definition to disable it.
+ */
+#define __check_old_set_param(_) (0)
+
typedef const struct kernel_param zfs_kernel_param_t;
-#else
-typedef struct kernel_param zfs_kernel_param_t;
-#endif
#define ZMOD_RW 0644
#define ZMOD_RD 0444