mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
Linux compat: Grsecurity kernel
API Change: Module parameter set/get methods take const parameter in Grsecurity kernel v4.7.1 Signed-off-by: Gvozden Neskovic <neskovic@gmail.com> Signed-off-by: Jason Zaman <jason@perfinion.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #4997 Closes #5001
This commit is contained in:
parent
2bce8049c3
commit
9cc1844a1d
30
config/kernel-mod-param.m4
Normal file
30
config/kernel-mod-param.m4
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
dnl #
|
||||||
|
dnl # Grsecurity kernel API change
|
||||||
|
dnl # constified parameters of module_param_call() methods
|
||||||
|
dnl #
|
||||||
|
AC_DEFUN([ZFS_AC_KERNEL_MODULE_PARAM_CALL_CONST], [
|
||||||
|
AC_MSG_CHECKING([whether module_param_call() is hardened])
|
||||||
|
ZFS_LINUX_TRY_COMPILE([
|
||||||
|
#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_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(MODULE_PARAM_CALL_CONST, 1,
|
||||||
|
[hardened module_param_call])
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
|
])
|
@ -101,6 +101,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
|
|||||||
ZFS_AC_KERNEL_GENERIC_IO_ACCT
|
ZFS_AC_KERNEL_GENERIC_IO_ACCT
|
||||||
ZFS_AC_KERNEL_FPU
|
ZFS_AC_KERNEL_FPU
|
||||||
ZFS_AC_KERNEL_KUID_HELPERS
|
ZFS_AC_KERNEL_KUID_HELPERS
|
||||||
|
ZFS_AC_KERNEL_MODULE_PARAM_CALL_CONST
|
||||||
|
|
||||||
AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
|
AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
|
||||||
KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
|
KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
|
||||||
|
@ -7,7 +7,8 @@ KERNEL_H = \
|
|||||||
$(top_srcdir)/include/linux/blkdev_compat.h \
|
$(top_srcdir)/include/linux/blkdev_compat.h \
|
||||||
$(top_srcdir)/include/linux/utsname_compat.h \
|
$(top_srcdir)/include/linux/utsname_compat.h \
|
||||||
$(top_srcdir)/include/linux/kmap_compat.h \
|
$(top_srcdir)/include/linux/kmap_compat.h \
|
||||||
$(top_srcdir)/include/linux/simd_x86.h
|
$(top_srcdir)/include/linux/simd_x86.h \
|
||||||
|
$(top_srcdir)/include/linux/mod_compat.h
|
||||||
|
|
||||||
USER_H =
|
USER_H =
|
||||||
|
|
||||||
|
39
include/linux/mod_compat.h
Normal file
39
include/linux/mod_compat.h
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* CDDL HEADER START
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the terms of the
|
||||||
|
* Common Development and Distribution License (the "License").
|
||||||
|
* You may not use this file except in compliance with the License.
|
||||||
|
*
|
||||||
|
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||||
|
* or http://www.opensolaris.org/os/licensing.
|
||||||
|
* See the License for the specific language governing permissions
|
||||||
|
* and limitations under the License.
|
||||||
|
*
|
||||||
|
* When distributing Covered Code, include this CDDL HEADER in each
|
||||||
|
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||||
|
* If applicable, add the following below this CDDL HEADER, with the
|
||||||
|
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||||
|
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||||
|
*
|
||||||
|
* CDDL HEADER END
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Gvozden Neskovic <neskovic@gmail.com>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _MOD_COMPAT_H
|
||||||
|
#define _MOD_COMPAT_H
|
||||||
|
|
||||||
|
#include <linux/module.h>
|
||||||
|
#include <linux/moduleparam.h>
|
||||||
|
|
||||||
|
/* Grsecurity kernel API change */
|
||||||
|
#ifdef MODULE_PARAM_CALL_CONST
|
||||||
|
typedef const struct kernel_param zfs_kernel_param_t;
|
||||||
|
#else
|
||||||
|
typedef struct kernel_param zfs_kernel_param_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _MOD_COMPAT_H */
|
@ -653,9 +653,10 @@ fletcher_4_fini(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_KERNEL) && defined(HAVE_SPL)
|
#if defined(_KERNEL) && defined(HAVE_SPL)
|
||||||
|
#include <linux/mod_compat.h>
|
||||||
|
|
||||||
static int
|
static int
|
||||||
fletcher_4_param_get(char *buffer, struct kernel_param *unused)
|
fletcher_4_param_get(char *buffer, zfs_kernel_param_t *unused)
|
||||||
{
|
{
|
||||||
const uint32_t impl = IMPL_READ(fletcher_4_impl_chosen);
|
const uint32_t impl = IMPL_READ(fletcher_4_impl_chosen);
|
||||||
char *fmt;
|
char *fmt;
|
||||||
@ -676,7 +677,7 @@ fletcher_4_param_get(char *buffer, struct kernel_param *unused)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
fletcher_4_param_set(const char *val, struct kernel_param *unused)
|
fletcher_4_param_set(const char *val, zfs_kernel_param_t *unused)
|
||||||
{
|
{
|
||||||
return (fletcher_4_impl_set(val));
|
return (fletcher_4_impl_set(val));
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,6 @@ vdev_raidz_math_get_ops()
|
|||||||
ops = (raidz_impl_ops_t *) &vdev_raidz_scalar_impl;
|
ops = (raidz_impl_ops_t *) &vdev_raidz_scalar_impl;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ASSERT(raidz_math_initialized);
|
|
||||||
ASSERT3U(impl, <, raidz_supp_impl_cnt);
|
ASSERT3U(impl, <, raidz_supp_impl_cnt);
|
||||||
ASSERT3U(raidz_supp_impl_cnt, >, 0);
|
ASSERT3U(raidz_supp_impl_cnt, >, 0);
|
||||||
ops = raidz_supp_impl[impl];
|
ops = raidz_supp_impl[impl];
|
||||||
@ -556,8 +555,8 @@ static const struct {
|
|||||||
* @val Name of raidz implementation to use
|
* @val Name of raidz implementation to use
|
||||||
* @param Unused.
|
* @param Unused.
|
||||||
*/
|
*/
|
||||||
static int
|
int
|
||||||
zfs_vdev_raidz_impl_set(const char *val, struct kernel_param *kp)
|
vdev_raidz_impl_set(const char *val)
|
||||||
{
|
{
|
||||||
int err = -EINVAL;
|
int err = -EINVAL;
|
||||||
char req_name[RAIDZ_IMPL_NAME_MAX];
|
char req_name[RAIDZ_IMPL_NAME_MAX];
|
||||||
@ -605,17 +604,17 @@ zfs_vdev_raidz_impl_set(const char *val, struct kernel_param *kp)
|
|||||||
return (err);
|
return (err);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
#if defined(_KERNEL) && defined(HAVE_SPL)
|
||||||
vdev_raidz_impl_set(const char *val)
|
#include <linux/mod_compat.h>
|
||||||
{
|
|
||||||
ASSERT(raidz_math_initialized);
|
|
||||||
|
|
||||||
return (zfs_vdev_raidz_impl_set(val, NULL));
|
static int
|
||||||
|
zfs_vdev_raidz_impl_set(const char *val, zfs_kernel_param_t *kp)
|
||||||
|
{
|
||||||
|
return (vdev_raidz_impl_set(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_KERNEL) && defined(HAVE_SPL)
|
|
||||||
static int
|
static int
|
||||||
zfs_vdev_raidz_impl_get(char *buffer, struct kernel_param *kp)
|
zfs_vdev_raidz_impl_get(char *buffer, zfs_kernel_param_t *kp)
|
||||||
{
|
{
|
||||||
int i, cnt = 0;
|
int i, cnt = 0;
|
||||||
char *fmt;
|
char *fmt;
|
||||||
|
Loading…
Reference in New Issue
Block a user