Skip to content

Commit 88c67cc

Browse files
committed
Linux: Remove ZFS_AC_KERNEL_SRC_MODULE_PARAM_CALL_CONST autotools check
On older kernels, the definition for `module_param_call()` typecasts function pointers to `(void *)`, which triggers -Werror, causing the check to return false when it should return true. Fixing this breaks the build process on some older kernels because they define a `__check_old_set_param()` function in their headers that checks for a non-constified `->set()`. We workaround that through the c preprocessor by defining `__check_old_set_param(set)` to `(set)`, which prevents the build failures. However, it is now apparent that all kernels that we support have adopted the GRSecurity change, so there is no need to have an explicit autotools check for it anymore. We therefore remove the autotools check, while adding the workaround to our headers for the build time non-constified `->set()` check done by older kernel headers. Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
1 parent 72c99dc commit 88c67cc

File tree

3 files changed

+9
-40
lines changed

3 files changed

+9
-40
lines changed

config/kernel-mod-param.m4

Lines changed: 0 additions & 33 deletions
This file was deleted.

config/kernel.m4

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
122122
ZFS_AC_KERNEL_SRC_FMODE_T
123123
ZFS_AC_KERNEL_SRC_KUIDGID_T
124124
ZFS_AC_KERNEL_SRC_KUID_HELPERS
125-
ZFS_AC_KERNEL_SRC_MODULE_PARAM_CALL_CONST
126125
ZFS_AC_KERNEL_SRC_RENAME
127126
ZFS_AC_KERNEL_SRC_CURRENT_TIME
128127
ZFS_AC_KERNEL_SRC_USERNS_CAPABILITIES
@@ -243,7 +242,6 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
243242
ZFS_AC_KERNEL_FMODE_T
244243
ZFS_AC_KERNEL_KUIDGID_T
245244
ZFS_AC_KERNEL_KUID_HELPERS
246-
ZFS_AC_KERNEL_MODULE_PARAM_CALL_CONST
247245
ZFS_AC_KERNEL_RENAME
248246
ZFS_AC_KERNEL_CURRENT_TIME
249247
ZFS_AC_KERNEL_USERNS_CAPABILITIES

include/os/linux/kernel/linux/mod_compat.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,16 @@
3030
#include <linux/module.h>
3131
#include <linux/moduleparam.h>
3232

33-
/* Grsecurity kernel API change */
34-
#ifdef MODULE_PARAM_CALL_CONST
33+
/*
34+
* Despite constifying struct kernel_param_ops, some older kernels define a
35+
* `__check_old_set_param()` function in their headers that checks for a
36+
* non-constified `->set()`. This has long been fixed in Linux mainline, but
37+
* since we support older kernels, we workaround it by using a preprocessor
38+
* definition to disable it.
39+
*/
40+
#define __check_old_set_param(set) (set)
41+
3542
typedef const struct kernel_param zfs_kernel_param_t;
36-
#else
37-
typedef struct kernel_param zfs_kernel_param_t;
38-
#endif
3943

4044
#define ZMOD_RW 0644
4145
#define ZMOD_RD 0444

0 commit comments

Comments
 (0)