aboutsummaryrefslogtreecommitdiffstats
path: root/testing/zfs-grsec
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2014-07-24 12:11:54 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2014-07-24 13:59:53 +0000
commit02bed2db1a83ab11d617660b711625d44e376ff6 (patch)
tree6ce873d3a57d8bca201fca430f19486d2bad37cf /testing/zfs-grsec
parent64f9aa90210e98f1140f409487c65b0dda3e2c7d (diff)
downloadaports-02bed2db1a83ab11d617660b711625d44e376ff6.tar.bz2
aports-02bed2db1a83ab11d617660b711625d44e376ff6.tar.xz
testing/zfs-grsec: rebuild against kernel 3.14.13-r0
Diffstat (limited to 'testing/zfs-grsec')
-rw-r--r--testing/zfs-grsec/APKBUILD25
-rw-r--r--testing/zfs-grsec/linux-3.11-lz4-compat.patch72
-rw-r--r--testing/zfs-grsec/musl-fixes.patch467
-rw-r--r--testing/zfs-grsec/timestruct.patch32
4 files changed, 513 insertions, 83 deletions
diff --git a/testing/zfs-grsec/APKBUILD b/testing/zfs-grsec/APKBUILD
index d848a79318..b892202817 100644
--- a/testing/zfs-grsec/APKBUILD
+++ b/testing/zfs-grsec/APKBUILD
@@ -6,10 +6,10 @@ _realname=zfs
_name=$_realname-$_flavor
_kpkg=linux-$_flavor
-_kver=3.14.12
-_kpkgrel=1
+_kver=3.14.13
+_kpkgrel=0
-_realver=0.6.2
+_realver=0.6.3
_mypkgrel=0
# source the kernel version
@@ -37,8 +37,9 @@ makedepends="$depends_dev automake autoconf libtool"
install=""
subpackages="$pkgname-dev $pkgname-utils"
source="http://archive.zfsonlinux.org/downloads/zfsonlinux/zfs/zfs-$_realver.tar.gz
+ musl-fixes.patch
timestamp.patch
- linux-3.11-lz4-compat.patch
+ timestruct.patch
"
_builddir="$srcdir/$_realname-$_realver"
@@ -56,7 +57,6 @@ prepare() {
build() {
cd "$_builddir"
./autogen.sh || return 1
- export LIBS="$LIBS -lintl"
./configure --prefix=/usr \
--sysconfdir=/etc \
--mandir=/usr/share/man \
@@ -102,12 +102,15 @@ utils() {
"$subpkgdir"/etc/init.d/zfs || return 1
}
-md5sums="0b183b0abdd5be287046ad9ce4f899fd zfs-0.6.2.tar.gz
+md5sums="5bcc32c122934d421eba68e16826637d zfs-0.6.3.tar.gz
+58992bd34b25f894f2da802d4000b07d musl-fixes.patch
9621735b802e34d792b03ef89727f6ea timestamp.patch
-6b7ba7ef84f80e3ea18d5bbc7006f15d linux-3.11-lz4-compat.patch"
-sha256sums="6b8cd79486b3a51204fac07297b8c45aa8702b8dfade58f2098b5734517065a1 zfs-0.6.2.tar.gz
+178af5841df53424ca0539028f318ad7 timestruct.patch"
+sha256sums="29bcfdd4161521692d2ca2515ad27a9edd9491c9cb5c6fb1e923d8eed28d391b zfs-0.6.3.tar.gz
+524cd01790837c025b1caf0fa7706bb7925723128649771f5e0bc2a0ebc1775b musl-fixes.patch
74924b471c2a83831f274b876c1d4f293f1e142089f34fccd19ae60b59066661 timestamp.patch
-2c1b9c509b8cbf71cc28b77758b290ddef547e0499876cb3103f0b2331409ec3 linux-3.11-lz4-compat.patch"
-sha512sums="bb0615ce3407bf3457bdc6843d444bb38dea978709b10dae892279a9608ca964c4f8f37a18c21b059c84b67973f2be9a41b1dac2e3c6b0cdbbd577b62d3e9916 zfs-0.6.2.tar.gz
+f70680c25f78e501d676af7260f024fba02847c6176d4e00cc9659c9e3a4c1a5 timestruct.patch"
+sha512sums="fdeaa6ad4a899196b165473eb3b33b30f1a6020ab112331a3f92ff2f15fd3438b1ef3908b2c445ba2c114be0f96e73797f8985c9c6738f49980410e7e2a4d2cd zfs-0.6.3.tar.gz
+5a940776ba2a69ba072d9a2d223b9ac09fe7e5fd0a6356ecf1cb384e7f91943cdbdd095ec3ca9951e3c20e9eb92f65a1398883324d4544e115f18c8506bd53aa musl-fixes.patch
2cb675e4603ea4aa951c7da2c57374bb404d52ee4fd04c719479ff07a3cf50c1d6f4b7cd2398c20327127fe81d47fcfa2ed95d18f05acd59f1ee8115334aabd2 timestamp.patch
-59569dd5cdc04a2aa9cb48a8533cf63b0e07ff348cb6a1291a8acd03a75058ca0af23837416d0cfb214edc4fde40ed2e3d0bea2e1b94dad1457e86e95cec6b11 linux-3.11-lz4-compat.patch"
+32346cdce1f52db36c469682718368c47b3f5b9acf40d3a27444f9dc69b29f512a385881bb92f8fade670eb71ce4d55fe914f33c025534a0e31773905229d019 timestruct.patch"
diff --git a/testing/zfs-grsec/linux-3.11-lz4-compat.patch b/testing/zfs-grsec/linux-3.11-lz4-compat.patch
deleted file mode 100644
index 88d415e885..0000000000
--- a/testing/zfs-grsec/linux-3.11-lz4-compat.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From b3c49d3df82466646bde9beebce7bbf0b3c41853 Mon Sep 17 00:00:00 2001
-From: Richard Yao <ryao@gentoo.org>
-Date: Sat, 5 Oct 2013 17:55:24 -0400
-Subject: [PATCH] Linux 3.11 compat: Rename LZ4 symbols
-
-Linus Torvalds merged LZ4 into Linux 3.11. This causes a conflict
-whenever CONFIG_LZ4_DECOMPRESS=y or CONFIG_LZ4_COMPRESS=y are set in the
-kernel's .config. We rename the symbols to avoid the conflict.
-
-Signed-off-by: Richard Yao <ryao@gentoo.org>
-Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
-Closes #1789
----
- include/sys/zio_compress.h | 4 ++--
- module/zfs/lz4.c | 4 ++--
- module/zfs/zio_compress.c | 2 +-
- 3 files changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/include/sys/zio_compress.h b/include/sys/zio_compress.h
-index bd051f1..e4b565d 100644
---- a/include/sys/zio_compress.h
-+++ b/include/sys/zio_compress.h
-@@ -74,9 +74,9 @@ extern size_t zle_compress(void *src, void *dst, size_t s_len, size_t d_len,
- int level);
- extern int zle_decompress(void *src, void *dst, size_t s_len, size_t d_len,
- int level);
--extern size_t lz4_compress(void *src, void *dst, size_t s_len, size_t d_len,
-+extern size_t lz4_compress_zfs(void *src, void *dst, size_t s_len, size_t d_len,
- int level);
--extern int lz4_decompress(void *src, void *dst, size_t s_len, size_t d_len,
-+extern int lz4_decompress_zfs(void *src, void *dst, size_t s_len, size_t d_len,
- int level);
-
- /*
-diff --git a/module/zfs/lz4.c b/module/zfs/lz4.c
-index 8afaad1..ae5d5a2 100644
---- a/module/zfs/lz4.c
-+++ b/module/zfs/lz4.c
-@@ -47,7 +47,7 @@ static int LZ4_compress64kCtx(void *ctx, const char *source, char *dest,
-
- /*ARGSUSED*/
- size_t
--lz4_compress(void *s_start, void *d_start, size_t s_len, size_t d_len, int n)
-+lz4_compress_zfs(void *s_start, void *d_start, size_t s_len, size_t d_len, int n)
- {
- uint32_t bufsiz;
- char *dest = d_start;
-@@ -74,7 +74,7 @@ static int LZ4_compress64kCtx(void *ctx, const char *source, char *dest,
-
- /*ARGSUSED*/
- int
--lz4_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len, int n)
-+lz4_decompress_zfs(void *s_start, void *d_start, size_t s_len, size_t d_len, int n)
- {
- const char *src = s_start;
- uint32_t bufsiz = BE_IN32(src);
-diff --git a/module/zfs/zio_compress.c b/module/zfs/zio_compress.c
-index 1dc780d..5864d5c 100644
---- a/module/zfs/zio_compress.c
-+++ b/module/zfs/zio_compress.c
-@@ -53,7 +53,7 @@
- {gzip_compress, gzip_decompress, 8, "gzip-8"},
- {gzip_compress, gzip_decompress, 9, "gzip-9"},
- {zle_compress, zle_decompress, 64, "zle"},
-- {lz4_compress, lz4_decompress, 0, "lz4"},
-+ {lz4_compress_zfs, lz4_decompress_zfs, 0, "lz4"},
- };
-
- enum zio_compress
---
-1.8.5.1
-
diff --git a/testing/zfs-grsec/musl-fixes.patch b/testing/zfs-grsec/musl-fixes.patch
new file mode 100644
index 0000000000..702741beeb
--- /dev/null
+++ b/testing/zfs-grsec/musl-fixes.patch
@@ -0,0 +1,467 @@
+diff --git a/cmd/mount_zfs/mount_zfs.c b/cmd/mount_zfs/mount_zfs.c
+index 6cb23d1..cf92b86 100644
+--- a/cmd/mount_zfs/mount_zfs.c
++++ b/cmd/mount_zfs/mount_zfs.c
+@@ -31,6 +31,7 @@
+ #include <sys/stat.h>
+ #include <libzfs.h>
+ #include <locale.h>
++#include <fcntl.h>
+
+ libzfs_handle_t *g_zfs;
+
+diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h
+index ec2a7de..6424ae5 100644
+--- a/include/sys/zfs_context.h
++++ b/include/sys/zfs_context.h
+@@ -1,31 +1,30 @@
+ /*
+ * 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.
++ * 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.
++ * 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]
++ * 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 2009 Sun Microsystems, Inc. All rights reserved.
+- * Use is subject to license terms.
++ * Copyright 2009 Sun Microsystems, Inc. All rights reserved. Use is subject
++ * to license terms.
+ */
+ /*
+- * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+- * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+- * Copyright (c) 2013 by Delphix. All rights reserved.
++ * Copyright 2011 Nexenta Systems, Inc. All rights reserved. Copyright (c)
++ * 2012, Joyent, Inc. All rights reserved. Copyright (c) 2013 by Delphix. All
++ * rights reserved.
+ */
+
+ #ifndef _SYS_ZFS_CONTEXT_H
+@@ -614,12 +613,12 @@ extern void delay(clock_t ticks);
+ #define minclsyspri 60
+ #define maxclsyspri 99
+
+-#define CPU_SEQID (pthread_self() & (max_ncpus - 1))
++#define CPU_SEQID ((long long)pthread_self() & (max_ncpus - 1))
+
+ #define kcred NULL
+ #define CRED() NULL
+
+-#define ptob(x) ((x) * PAGESIZE)
++#define ptob(x) ((x) * SPL_PAGESIZE)
+
+ extern uint64_t physmem;
+
+diff --git a/lib/libspl/include/assert.h b/lib/libspl/include/assert.h
+index d749d1e..4791dcf 100644
+--- a/lib/libspl/include/assert.h
++++ b/lib/libspl/include/assert.h
+@@ -42,6 +42,17 @@ __assert_c99(const char *expr, const char *file, int line, const char *func)
+ }
+ #endif /* __assert_c99 */
+
++#ifndef __assert
++static inline void
++__assert(const char *expr, const char *file, int line)
++{
++ fprintf(stderr, "%s:%i: %s: Assertion failed.\n", file, line, expr);
++ abort();
++}
++#else
++extern void __assert(const char *, const char *, int);
++#endif
++
+ #ifndef verify
+ #if defined(__STDC__)
+ #if __STDC_VERSION__ - 0 >= 199901L
+@@ -61,8 +72,6 @@ __assert_c99(const char *expr, const char *file, int line, const char *func)
+ #define VERIFY verify
+ #define ASSERT assert
+
+-extern void __assert(const char *, const char *, int);
+-
+ /* BEGIN CSTYLED */
+ #define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE) do { \
+ const TYPE __left = (TYPE)(LEFT); \
+diff --git a/lib/libspl/include/devid.h b/lib/libspl/include/devid.h
+index 5406c33..1675cfd 100644
+--- a/lib/libspl/include/devid.h
++++ b/lib/libspl/include/devid.h
+@@ -29,6 +29,11 @@
+
+ #include <stdlib.h>
+
++#if !defined(__DEFINED_dev_t)
++#define __NEED_dev_t
++#include <bits/alltypes.h>
++#endif
++
+ typedef int ddi_devid_t;
+
+ typedef struct devid_nmlist {
+diff --git a/lib/libspl/include/rpc/xdr.h b/lib/libspl/include/rpc/xdr.h
+index 99500d6..27e7590 100644
+--- a/lib/libspl/include/rpc/xdr.h
++++ b/lib/libspl/include/rpc/xdr.h
+@@ -60,6 +60,8 @@ typedef struct xdr_bytesrec {
+ #define XDR_RDMAGET 4
+ #define XDR_RDMASET 5
+
++#ifndef HAVE_TIRPC
+ extern bool_t xdr_control(XDR *xdrs, int request, void *info);
++#endif
+
+ #endif
+diff --git a/lib/libspl/include/sys/inttypes.h b/lib/libspl/include/sys/inttypes.h
+index d7d0639..9707fa2 100644
+--- a/lib/libspl/include/sys/inttypes.h
++++ b/lib/libspl/include/sys/inttypes.h
+@@ -30,5 +30,9 @@
+ #include <inttypes.h>
+
+ #define _INT64_TYPE
++#ifndef RLIM64_INFINITY
++#define RLIM64_INFINITY (~0ULL)
++#endif
++
+
+ #endif
+diff --git a/lib/libspl/include/sys/param.h b/lib/libspl/include/sys/param.h
+index 4090cef..de408e2 100644
+--- a/lib/libspl/include/sys/param.h
++++ b/lib/libspl/include/sys/param.h
+@@ -57,6 +57,6 @@
+ #define MAXUID UINT32_MAX /* max user id */
+ #define MAXPROJID MAXUID /* max project id */
+
+-#define PAGESIZE (sysconf(_SC_PAGESIZE))
++#define SPL_PAGESIZE (sysconf(_SC_PAGESIZE))
+
+ #endif
+diff --git a/lib/libspl/include/sys/sysmacros.h b/lib/libspl/include/sys/sysmacros.h
+index 698b0a7..1530177 100644
+--- a/lib/libspl/include/sys/sysmacros.h
++++ b/lib/libspl/include/sys/sysmacros.h
+@@ -66,11 +66,11 @@
+ * that the result is correctly calculated based on the data type of (x),
+ * which is passed in as the last argument, regardless of the data
+ * type of the alignment. For example, if (x) is of type uint64_t,
+- * and we want to round it up to a page boundary using "PAGESIZE" as
++ * and we want to round it up to a page boundary using "SPL_PAGESIZE" as
+ * the alignment, we can do either
+- * P2ROUNDUP(x, (uint64_t)PAGESIZE)
++ * P2ROUNDUP(x, (uint64_t)SPL_PAGESIZE)
+ * or
+- * P2ROUNDUP_TYPED(x, PAGESIZE, uint64_t)
++ * P2ROUNDUP_TYPED(x, SPL_PAGESIZE, uint64_t)
+ */
+ #define P2ALIGN_TYPED(x, align, type) \
+ ((type)(x) & -(type)(align))
+diff --git a/lib/libspl/include/sys/time.h b/lib/libspl/include/sys/time.h
+index f0da440..aa96c39 100644
+--- a/lib/libspl/include/sys/time.h
++++ b/lib/libspl/include/sys/time.h
+@@ -58,6 +58,11 @@
+ #define NSEC2MSEC(n) ((n) / (NANOSEC / MILLISEC))
+ #endif
+
++#ifndef HAVE_HR_TYPES
++typedef long long longlong_t;
++typedef longlong_t hrtime_t;
++typedef struct timespec timestruc_t;
++#endif
+ extern hrtime_t gethrtime(void);
+ extern void gethrestime(timestruc_t *);
+
+diff --git a/lib/libspl/include/sys/types.h b/lib/libspl/include/sys/types.h
+index bd34dec..e7e1e13 100644
+--- a/lib/libspl/include/sys/types.h
++++ b/lib/libspl/include/sys/types.h
+@@ -60,6 +60,7 @@ typedef long spgcnt_t; /* signed number of pages */
+ typedef longlong_t hrtime_t;
+ typedef struct timespec timestruc_t;
+ typedef struct timespec timespec_t;
++#define HAVE_HR_TYPES
+
+ typedef short pri_t;
+
+diff --git a/lib/libspl/include/sys/va_list.h b/lib/libspl/include/sys/va_list.h
+index 04ad148..bb011ba 100644
+--- a/lib/libspl/include/sys/va_list.h
++++ b/lib/libspl/include/sys/va_list.h
+@@ -29,7 +29,9 @@
+
+ #include <stdarg.h>
+
+-#ifndef __va_list
++#ifdef HAVE_MUSL
++typedef void* __va_list;
++#else
+ typedef __gnuc_va_list __va_list;
+ #endif
+
+diff --git a/lib/libspl/timestamp.c b/lib/libspl/timestamp.c
+index a4f4cf4..a177270 100644
+--- a/lib/libspl/timestamp.c
++++ b/lib/libspl/timestamp.c
+@@ -28,6 +28,10 @@
+ #include <langinfo.h>
+ #include "statcommon.h"
+
++#ifndef _DATE_FMT
++#define _DATE_FMT D_FMT
++#endif
++
+ /*
+ * Print timestamp as decimal reprentation of time_t value (-T u was specified)
+ * or in date(1) format (-T d was specified).
+diff --git a/lib/libspl/xdr.c b/lib/libspl/xdr.c
+index 288a338..c8a6fe3 100644
+--- a/lib/libspl/xdr.c
++++ b/lib/libspl/xdr.c
+@@ -29,6 +29,7 @@
+ * under license from the Regents of the University of California.
+ */
+
++#ifndef HAVE_TIRPC
+ #include <rpc/xdr.h>
+
+ /*
+@@ -76,3 +77,4 @@ xdr_control(XDR *xdrs, int request, void *info)
+ }
+ return (FALSE);
+ }
++#endif
+diff --git a/lib/libzpool/kernel.c b/lib/libzpool/kernel.c
+index 05bbd06..32e9607 100644
+--- a/lib/libzpool/kernel.c
++++ b/lib/libzpool/kernel.c
+@@ -180,7 +180,7 @@ zk_thread_create(caddr_t stk, size_t stksize, thread_func_t func, void *arg,
+
+ VERIFY3S(pthread_attr_init(&attr), ==, 0);
+ VERIFY3S(pthread_attr_setstacksize(&attr, stack), ==, 0);
+- VERIFY3S(pthread_attr_setguardsize(&attr, PAGESIZE), ==, 0);
++ VERIFY3S(pthread_attr_setguardsize(&attr, SPL_PAGESIZE), ==, 0);
+ VERIFY3S(pthread_attr_setdetachstate(&attr, detachstate), ==, 0);
+
+ VERIFY3S(pthread_create(&kt->t_tid, &attr, &zk_thread_helper, kt),
+@@ -901,7 +901,7 @@ static char ce_prefix[CE_IGNORE][10] = { "", "NOTICE: ", "WARNING: ", "" };
+ static char ce_suffix[CE_IGNORE][2] = { "", "\n", "\n", "" };
+
+ void
+-vpanic(const char *fmt, va_list adx)
++vpanic(const char *fmt, __va_list adx)
+ {
+ (void) fprintf(stderr, "error: ");
+ (void) vfprintf(stderr, fmt, adx);
+@@ -921,7 +921,7 @@ panic(const char *fmt, ...)
+ }
+
+ void
+-vcmn_err(int ce, const char *fmt, va_list adx)
++vcmn_err(int ce, const char *fmt, __va_list adx)
+ {
+ if (ce == CE_PANIC)
+ vpanic(fmt, adx);
+diff --git a/module/nvpair/nvpair.c b/module/nvpair/nvpair.c
+index f5c3166..750556b 100644
+--- a/module/nvpair/nvpair.c
++++ b/module/nvpair/nvpair.c
+@@ -3251,8 +3251,12 @@ nvs_xdr_nvpair(nvstream_t *nvs, nvpair_t *nvp, size_t *size)
+ return (0);
+
+ /* sanity check the size parameter */
++#ifndef HAVE_TIRPC
+ if (!xdr_control(xdr, XDR_GET_BYTES_AVAIL, &bytesrec))
+ return (EFAULT);
++#else
++ xdr_control(xdr, XDR_GET_BYTES_AVAIL, &bytesrec);
++#endif
+
+ if (*size > NVS_XDR_MAX_LEN(bytesrec.xc_num_avail))
+ return (EFAULT);
+diff --git a/module/zcommon/zfs_uio.c b/module/zcommon/zfs_uio.c
+index 90376f2..6eabecf 100644
+--- a/module/zcommon/zfs_uio.c
++++ b/module/zcommon/zfs_uio.c
+@@ -44,6 +44,7 @@
+ */
+ #ifdef _KERNEL
+
++#include <sys/param.h>
+ #include <sys/types.h>
+ #include <sys/uio_impl.h>
+
+@@ -144,7 +145,7 @@ uio_prefaultpages(ssize_t n, struct uio *uio)
+ bcopy(p, &tmp, 1);
+ break;
+ }
+- incr = MIN(cnt, PAGESIZE);
++ incr = MIN(cnt, SPL_PAGESIZE);
+ p += incr;
+ cnt -= incr;
+ }
+diff --git a/module/zfs/arc.c b/module/zfs/arc.c
+index 387faaf..e2aa10d 100644
+--- a/module/zfs/arc.c
++++ b/module/zfs/arc.c
+@@ -135,6 +135,7 @@
+ #include <sys/vdev.h>
+ #include <sys/vdev_impl.h>
+ #include <sys/dsl_pool.h>
++#include <linux/param.h>
+ #ifdef _KERNEL
+ #include <sys/vmsystm.h>
+ #include <vm/anon.h>
+@@ -1002,7 +1003,7 @@ buf_init(void)
+ * with an average 64K block size. The table will take up
+ * totalmem*sizeof(void*)/64K (eg. 128KB/GB with 8-byte pointers).
+ */
+- while (hsize * 65536 < physmem * PAGESIZE)
++ while (hsize * 65536 < physmem * SPL_PAGESIZE)
+ hsize <<= 1;
+ retry:
+ buf_hash_table.ht_mask = hsize - 1;
+@@ -2500,7 +2501,7 @@ arc_adapt_thread(void)
+
+ /* Allow the module options to be changed */
+ if (zfs_arc_max > 64 << 20 &&
+- zfs_arc_max < physmem * PAGESIZE &&
++ zfs_arc_max < physmem * SPL_PAGESIZE &&
+ zfs_arc_max != arc_c_max)
+ arc_c_max = zfs_arc_max;
+
+@@ -4087,7 +4088,7 @@ arc_init(void)
+ zfs_arc_min_prefetch_lifespan = 1 * hz;
+
+ /* Start out with 1/8 of all memory */
+- arc_c = physmem * PAGESIZE / 8;
++ arc_c = physmem * SPL_PAGESIZE / 8;
+
+ #ifdef _KERNEL
+ /*
+@@ -4113,7 +4114,7 @@ arc_init(void)
+ * Allow the tunables to override our calculations if they are
+ * reasonable (ie. over 64MB)
+ */
+- if (zfs_arc_max > 64<<20 && zfs_arc_max < physmem * PAGESIZE)
++ if (zfs_arc_max > 64<<20 && zfs_arc_max < physmem * SPL_PAGESIZE)
+ arc_c_max = zfs_arc_max;
+ if (zfs_arc_min > 0 && zfs_arc_min <= arc_c_max)
+ arc_c_min = zfs_arc_min;
+@@ -4212,11 +4213,11 @@ arc_init(void)
+ * zfs_dirty_data_max_max (default 25% of physical memory).
+ */
+ if (zfs_dirty_data_max_max == 0)
+- zfs_dirty_data_max_max = physmem * PAGESIZE *
++ zfs_dirty_data_max_max = physmem * SPL_PAGESIZE *
+ zfs_dirty_data_max_max_percent / 100;
+
+ if (zfs_dirty_data_max == 0) {
+- zfs_dirty_data_max = physmem * PAGESIZE *
++ zfs_dirty_data_max = physmem * SPL_PAGESIZE *
+ zfs_dirty_data_max_percent / 100;
+ zfs_dirty_data_max = MIN(zfs_dirty_data_max,
+ zfs_dirty_data_max_max);
+diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c
+index 4f17506..ef5fac6 100644
+--- a/module/zfs/dbuf.c
++++ b/module/zfs/dbuf.c
+@@ -302,7 +302,7 @@ dbuf_init(void)
+ * with an average 4K block size. The table will take up
+ * totalmem*sizeof(void*)/4K (i.e. 2MB/GB with 8-byte pointers).
+ */
+- while (hsize * 4096 < physmem * PAGESIZE)
++ while (hsize * 4096 < physmem * SPL_PAGESIZE)
+ hsize <<= 1;
+
+ retry:
+diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c
+index 91f743a..d45aeda 100644
+--- a/module/zfs/zfs_vnops.c
++++ b/module/zfs/zfs_vnops.c
+@@ -364,7 +364,7 @@ update_pages(struct inode *ip, int64_t start, int len,
+ * On Read: We "read" preferentially from memory mapped pages,
+ * else we default from the dmu buffer.
+ *
+- * NOTE: We will always "break up" the IO into PAGESIZE uiomoves when
++ * NOTE: We will always "break up" the IO into SPL_PAGESIZE uiomoves when
+ * the file is memory mapped.
+ */
+ static int
+@@ -4118,11 +4118,11 @@ zfs_fillpage(struct inode *ip, struct page *pl[], int nr_pages)
+ */
+ page_idx = 0;
+ cur_pp = pl[0];
+- for (total = io_off + io_len; io_off < total; io_off += PAGESIZE) {
++ for (total = io_off + io_len; io_off < total; io_off += SPL_PAGESIZE) {
+ caddr_t va;
+
+ va = kmap(cur_pp);
+- err = dmu_read(os, zp->z_id, io_off, PAGESIZE, va,
++ err = dmu_read(os, zp->z_id, io_off, SPL_PAGESIZE, va,
+ DMU_READ_PREFETCH);
+ kunmap(cur_pp);
+ if (err) {
+diff --git a/module/zfs/zio.c b/module/zfs/zio.c
+index 332d50c..8f9b0e7 100644
+--- a/module/zfs/zio.c
++++ b/module/zfs/zio.c
+@@ -133,13 +133,13 @@ zio_init(void)
+ zio_link_cache = kmem_cache_create("zio_link_cache",
+ sizeof (zio_link_t), 0, NULL, NULL, NULL, NULL, NULL, 0);
+ zio_vdev_cache = kmem_cache_create("zio_vdev_cache", sizeof (vdev_io_t),
+- PAGESIZE, NULL, NULL, NULL, NULL, NULL, 0);
++ SPL_PAGESIZE, NULL, NULL, NULL, NULL, NULL, 0);
+
+ /*
+ * For small buffers, we want a cache for each multiple of
+ * SPA_MINBLOCKSIZE. For medium-size buffers, we want a cache
+ * for each quarter-power of 2. For large buffers, we want
+- * a cache for each multiple of PAGESIZE.
++ * a cache for each multiple of SPL_PAGESIZE.
+ */
+ for (c = 0; c < SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT; c++) {
+ size_t size = (c + 1) << SPA_MINBLOCKSHIFT;
+@@ -156,13 +156,13 @@ zio_init(void)
+ * kernel when modifying a non-watched buffer that shares the
+ * page with a watched buffer.
+ */
+- if (arc_watch && !IS_P2ALIGNED(size, PAGESIZE))
++ if (arc_watch && !IS_P2ALIGNED(size, SPL_PAGESIZE))
+ continue;
+ #endif
+ if (size <= 4 * SPA_MINBLOCKSIZE) {
+ align = SPA_MINBLOCKSIZE;
+- } else if (IS_P2ALIGNED(size, PAGESIZE)) {
+- align = PAGESIZE;
++ } else if (IS_P2ALIGNED(size, SPL_PAGESIZE)) {
++ align = SPL_PAGESIZE;
+ } else if (IS_P2ALIGNED(size, p2 >> 2)) {
+ align = p2 >> 2;
+ }
diff --git a/testing/zfs-grsec/timestruct.patch b/testing/zfs-grsec/timestruct.patch
new file mode 100644
index 0000000000..a25b41b484
--- /dev/null
+++ b/testing/zfs-grsec/timestruct.patch
@@ -0,0 +1,32 @@
+From 6296d14f69d42e30fff089cc865f9f1b3c13b6c3 Mon Sep 17 00:00:00 2001
+From: stf <s@ctrlc.hu>
+Date: Tue, 10 Jun 2014 03:37:51 +0200
+Subject: [PATCH] sys/param.h depends on types defined in
+ sys/types.h\n(hrtime_t & timestruc_t)
+
+---
+ lib/libspl/include/sys/types.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/lib/libspl/include/sys/types.h b/lib/libspl/include/sys/types.h
+index bd34dec..08cd0b4 100644
+--- a/lib/libspl/include/sys/types.h
++++ b/lib/libspl/include/sys/types.h
+@@ -30,7 +30,6 @@
+ #include <sys/isa_defs.h>
+ #include <sys/feature_tests.h>
+ #include_next <sys/types.h>
+-#include <sys/param.h> /* for NBBY */
+ #include <sys/types32.h>
+ #include <sys/va_list.h>
+
+@@ -96,4 +95,6 @@ typedef union {
+ } lloff_t;
+ #endif
+
++#include <sys/param.h> /* for NBBY */
++
+ #endif
+--
+1.9.3
+