aboutsummaryrefslogtreecommitdiffstats
path: root/main/zfs-hardened
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2017-04-27 05:11:55 +0000
committerWilliam Pitcock <nenolod@dereferenced.org>2017-04-27 05:46:22 +0000
commit43a9721d269bdcd4e863248474ae2601f2f53548 (patch)
tree23f30794ef2e2926cdef5bc18a9e1e2df9f28e71 /main/zfs-hardened
parent34cb8cea11aa9f398dac2b93b344c8531e4ba9dc (diff)
downloadaports-43a9721d269bdcd4e863248474ae2601f2f53548.tar.bz2
aports-43a9721d269bdcd4e863248474ae2601f2f53548.tar.xz
main/zfs-hardened: rename from zfs-grsec, provide zfs-grsec
Diffstat (limited to 'main/zfs-hardened')
-rw-r--r--main/zfs-hardened/0001-Use-the-correct-macro-to-include-backtrace.patch42
-rw-r--r--main/zfs-hardened/0002-Include-sys-types.h-in-devid.h.patch29
-rw-r--r--main/zfs-hardened/0003-Add-missing-fcntl.h-to-includes-in-mount_zfs.c.patch29
-rw-r--r--main/zfs-hardened/0004-Ensure-correct-return-value-type.patch30
-rw-r--r--main/zfs-hardened/0005-Set-_DATE_FMT-to-if-not-defined-in-libspl-timestamp..patch31
-rw-r--r--main/zfs-hardened/0006-Move-hrtime_t-timestruc_t-and-timespec_t.patch52
-rw-r--r--main/zfs-hardened/0007-Remove-complicated-libspl-assert-wrappers.patch159
-rw-r--r--main/zfs-hardened/0008-Add-support-for-libtirpc.patch331
-rw-r--r--main/zfs-hardened/0009-Add-support-for-alpine-linux.patch122
-rw-r--r--main/zfs-hardened/APKBUILD106
-rw-r--r--main/zfs-hardened/pax-rap-fixes.patch599
11 files changed, 1530 insertions, 0 deletions
diff --git a/main/zfs-hardened/0001-Use-the-correct-macro-to-include-backtrace.patch b/main/zfs-hardened/0001-Use-the-correct-macro-to-include-backtrace.patch
new file mode 100644
index 0000000000..aaae11f58a
--- /dev/null
+++ b/main/zfs-hardened/0001-Use-the-correct-macro-to-include-backtrace.patch
@@ -0,0 +1,42 @@
+From b8fd863517ae6dba1f4bdf225f45b97eb913e09e Mon Sep 17 00:00:00 2001
+From: Carlo Landmeter <clandmeter@gmail.com>
+Date: Tue, 1 Mar 2016 15:23:09 +0100
+Subject: [PATCH 1/8] Use the correct macro to include backtrace
+
+execinfo.h and backtrace() are GNU extensions provided by glibc
+and not by gcc, see:
+
+http://www.gnu.org/software/libc/manual/html_mono/libc.html#Backtraces
+
+Signed-off-by: Carlo Landmeter <clandmeter@gmail.com>
+Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Closes #4453
+---
+ cmd/ztest/ztest.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c
+index afe6faa..40524ed 100644
+--- a/cmd/ztest/ztest.c
++++ b/cmd/ztest/ztest.c
+@@ -123,7 +123,7 @@
+ #include <math.h>
+ #include <sys/fs/zfs.h>
+ #include <libnvpair.h>
+-#ifdef __GNUC__
++#ifdef __GLIBC__
+ #include <execinfo.h> /* for backtrace() */
+ #endif
+
+@@ -490,7 +490,7 @@ _umem_logging_init(void)
+ static void sig_handler(int signo)
+ {
+ struct sigaction action;
+-#ifdef __GNUC__ /* backtrace() is a GNU extension */
++#ifdef __GLIBC__ /* backtrace() is a GNU extension */
+ int nptrs;
+ void *buffer[BACKTRACE_SZ];
+
+--
+2.7.4
+
diff --git a/main/zfs-hardened/0002-Include-sys-types.h-in-devid.h.patch b/main/zfs-hardened/0002-Include-sys-types.h-in-devid.h.patch
new file mode 100644
index 0000000000..350d2cb6ba
--- /dev/null
+++ b/main/zfs-hardened/0002-Include-sys-types.h-in-devid.h.patch
@@ -0,0 +1,29 @@
+From 38cab4ba7bdeee22a114bcb09665be980a5b1f39 Mon Sep 17 00:00:00 2001
+From: Carlo Landmeter <clandmeter@gmail.com>
+Date: Tue, 1 Mar 2016 15:56:26 +0100
+Subject: [PATCH 2/8] Include sys/types.h in devid.h
+
+This is needed for musl libc
+
+Signed-off-by: Carlo Landmeter <clandmeter@gmail.com>
+Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Closes #4454
+---
+ lib/libspl/include/devid.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/lib/libspl/include/devid.h b/lib/libspl/include/devid.h
+index 5406c33..4b346da 100644
+--- a/lib/libspl/include/devid.h
++++ b/lib/libspl/include/devid.h
+@@ -27,6 +27,7 @@
+ #ifndef _LIBSPL_DEVID_H
+ #define _LIBSPL_DEVID_H
+
++#include <sys/types.h>
+ #include <stdlib.h>
+
+ typedef int ddi_devid_t;
+--
+2.7.4
+
diff --git a/main/zfs-hardened/0003-Add-missing-fcntl.h-to-includes-in-mount_zfs.c.patch b/main/zfs-hardened/0003-Add-missing-fcntl.h-to-includes-in-mount_zfs.c.patch
new file mode 100644
index 0000000000..87ccb78874
--- /dev/null
+++ b/main/zfs-hardened/0003-Add-missing-fcntl.h-to-includes-in-mount_zfs.c.patch
@@ -0,0 +1,29 @@
+From 401951765dcf49c5a993280bf6a93b89c7f01bb8 Mon Sep 17 00:00:00 2001
+From: Carlo Landmeter <clandmeter@gmail.com>
+Date: Fri, 25 Mar 2016 20:47:03 +0100
+Subject: [PATCH 3/8] Add missing fcntl.h to includes in mount_zfs.c
+
+This is needed for musl libc
+
+Signed-off-by: Carlo Landmeter <clandmeter@gmail.com>
+Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Closes #4456
+---
+ cmd/mount_zfs/mount_zfs.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/cmd/mount_zfs/mount_zfs.c b/cmd/mount_zfs/mount_zfs.c
+index bd860cb..a939744 100644
+--- a/cmd/mount_zfs/mount_zfs.c
++++ b/cmd/mount_zfs/mount_zfs.c
+@@ -33,6 +33,7 @@
+ #include <libzfs.h>
+ #include <locale.h>
+ #include <getopt.h>
++#include <fcntl.h>
+
+ #define ZS_COMMENT 0x00000000 /* comment */
+ #define ZS_ZFSUTIL 0x00000001 /* caller is zfs(8) */
+--
+2.7.4
+
diff --git a/main/zfs-hardened/0004-Ensure-correct-return-value-type.patch b/main/zfs-hardened/0004-Ensure-correct-return-value-type.patch
new file mode 100644
index 0000000000..9897864c02
--- /dev/null
+++ b/main/zfs-hardened/0004-Ensure-correct-return-value-type.patch
@@ -0,0 +1,30 @@
+From 8fb2f7092f5188d6ad42f0f66049568e49c8e7c8 Mon Sep 17 00:00:00 2001
+From: Carlo Landmeter <clandmeter@gmail.com>
+Date: Tue, 1 Mar 2016 15:32:52 +0100
+Subject: [PATCH 4/8] Ensure correct return value type
+
+When compiling with musl libc the return type will be incorrect.
+
+Signed-off-by: Carlo Landmeter <clandmeter@gmail.com>
+Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Closes #4454
+---
+ include/sys/zfs_context.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h
+index 4f7e328..78e33e1 100644
+--- a/include/sys/zfs_context.h
++++ b/include/sys/zfs_context.h
+@@ -623,7 +623,7 @@ extern void delay(clock_t ticks);
+ #define maxclsyspri -20
+ #define defclsyspri 0
+
+-#define CPU_SEQID (pthread_self() & (max_ncpus - 1))
++#define CPU_SEQID ((uintptr_t)pthread_self() & (max_ncpus - 1))
+
+ #define kcred NULL
+ #define CRED() NULL
+--
+2.7.4
+
diff --git a/main/zfs-hardened/0005-Set-_DATE_FMT-to-if-not-defined-in-libspl-timestamp..patch b/main/zfs-hardened/0005-Set-_DATE_FMT-to-if-not-defined-in-libspl-timestamp..patch
new file mode 100644
index 0000000000..37c5a33ffd
--- /dev/null
+++ b/main/zfs-hardened/0005-Set-_DATE_FMT-to-if-not-defined-in-libspl-timestamp..patch
@@ -0,0 +1,31 @@
+From f8c3aff70bbea57527ee301c16b94dcc8adc4cc9 Mon Sep 17 00:00:00 2001
+From: Carlo Landmeter <clandmeter@gmail.com>
+Date: Tue, 1 Mar 2016 16:23:12 +0100
+Subject: [PATCH 5/8] Set _DATE_FMT to '%+' if not defined in
+ libspl/timestamp.c
+
+Signed-off-by: Carlo Landmeter <clandmeter@gmail.com>
+Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Closes #4458
+---
+ lib/libspl/timestamp.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/lib/libspl/timestamp.c b/lib/libspl/timestamp.c
+index a4f4cf4..e2838da 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 "%+"
++#endif
++
+ /*
+ * Print timestamp as decimal reprentation of time_t value (-T u was specified)
+ * or in date(1) format (-T d was specified).
+--
+2.7.4
+
diff --git a/main/zfs-hardened/0006-Move-hrtime_t-timestruc_t-and-timespec_t.patch b/main/zfs-hardened/0006-Move-hrtime_t-timestruc_t-and-timespec_t.patch
new file mode 100644
index 0000000000..ac844dda62
--- /dev/null
+++ b/main/zfs-hardened/0006-Move-hrtime_t-timestruc_t-and-timespec_t.patch
@@ -0,0 +1,52 @@
+From d4ad14173906db278937a8779dc608a3e155727e Mon Sep 17 00:00:00 2001
+From: Carlo Landmeter <clandmeter@gmail.com>
+Date: Fri, 25 Mar 2016 13:21:53 +0100
+Subject: [PATCH 6/8] Move hrtime_t timestruc_t and timespec_t
+
+hrtime_t timestruc_t and timespec_t should have originally been
+included in sys/time.h so lets move them.
+
+longlong_t is not defined by any standard so change it to long long
+
+Signed-off-by: Carlo Landmeter <clandmeter@gmail.com>
+Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Closes #4459
+---
+ lib/libspl/include/sys/time.h | 5 +++++
+ lib/libspl/include/sys/types.h | 4 ----
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/lib/libspl/include/sys/time.h b/lib/libspl/include/sys/time.h
+index f0da440..03da3f7 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
+
++typedef long long hrtime_t;
++typedef struct timespec timestruc_t;
++typedef struct timespec timespec_t;
++
++
+ 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 25d56be..8996af9 100644
+--- a/lib/libspl/include/sys/types.h
++++ b/lib/libspl/include/sys/types.h
+@@ -55,10 +55,6 @@ typedef longlong_t diskaddr_t;
+ typedef ulong_t pgcnt_t; /* number of pages */
+ typedef long spgcnt_t; /* signed number of pages */
+
+-typedef longlong_t hrtime_t;
+-typedef struct timespec timestruc_t;
+-typedef struct timespec timespec_t;
+-
+ typedef short pri_t;
+
+ typedef int zoneid_t;
+--
+2.7.4
+
diff --git a/main/zfs-hardened/0007-Remove-complicated-libspl-assert-wrappers.patch b/main/zfs-hardened/0007-Remove-complicated-libspl-assert-wrappers.patch
new file mode 100644
index 0000000000..74e8a747c6
--- /dev/null
+++ b/main/zfs-hardened/0007-Remove-complicated-libspl-assert-wrappers.patch
@@ -0,0 +1,159 @@
+From bd123ed53786910cfdcfa7f3a983a268a5951fb0 Mon Sep 17 00:00:00 2001
+From: Brian Behlendorf <behlendorf1@llnl.gov>
+Date: Tue, 1 Mar 2016 15:45:43 +0100
+Subject: [PATCH 7/8] Remove complicated libspl assert wrappers
+
+Effectively provide our own version of assert()/verify() for use
+in user space. This minimizes our dependencies and aligns the
+user space assertion handling with what's used in the kernel.
+
+Signed-off-by: Carlo Landmeter <clandmeter@gmail.com>
+Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Closes #4449
+---
+ include/libzfs_impl.h | 5 ---
+ lib/libspl/include/assert.h | 82 ++++++++++++++++++++-------------------------
+ 2 files changed, 36 insertions(+), 51 deletions(-)
+
+diff --git a/include/libzfs_impl.h b/include/libzfs_impl.h
+index e805e3e..ff02fa7 100644
+--- a/include/libzfs_impl.h
++++ b/include/libzfs_impl.h
+@@ -46,11 +46,6 @@
+ extern "C" {
+ #endif
+
+-#ifdef VERIFY
+-#undef VERIFY
+-#endif
+-#define VERIFY verify
+-
+ typedef struct libzfs_fru {
+ char *zf_device;
+ char *zf_fru;
+diff --git a/lib/libspl/include/assert.h b/lib/libspl/include/assert.h
+index 52924e8..6226872 100644
+--- a/lib/libspl/include/assert.h
++++ b/lib/libspl/include/assert.h
+@@ -32,68 +32,54 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+
+-#ifndef __assert_c99
+-static inline void
+-__assert_c99(const char *expr, const char *file, int line, const char *func)
++static inline int
++libspl_assert(const char *buf, const char *file, const char *func, int line)
+ {
+- fprintf(stderr, "%s:%i: %s: Assertion `%s` failed.\n",
+- file, line, func, expr);
++ fprintf(stderr, "%s\n", buf);
++ fprintf(stderr, "ASSERT at %s:%d:%s()", file, line, func);
+ abort();
+ }
+-#endif /* __assert_c99 */
+-
+-#ifndef verify
+-#if defined(__STDC__)
+-#if __STDC_VERSION__ - 0 >= 199901L
+-#define verify(EX) (void)((EX) || \
+- (__assert_c99(#EX, __FILE__, __LINE__, __func__), 0))
+-#else
+-#define verify(EX) (void)((EX) || (__assert(#EX, __FILE__, __LINE__), 0))
+-#endif /* __STDC_VERSION__ - 0 >= 199901L */
+-#else
+-#define verify(EX) (void)((EX) || (_assert("EX", __FILE__, __LINE__), 0))
+-#endif /* __STDC__ */
+-#endif /* verify */
+-
+-#undef VERIFY
+-#undef ASSERT
+
+-#define VERIFY verify
+-#define ASSERT assert
++#ifdef verify
++#undef verify
++#endif
+
+-extern void __assert(const char *, const char *, int);
++#define VERIFY(cond) \
++ (void) ((!(cond)) && \
++ libspl_assert(#cond, __FILE__, __FUNCTION__, __LINE__))
++#define verify(cond) \
++ (void) ((!(cond)) && \
++ libspl_assert(#cond, __FILE__, __FUNCTION__, __LINE__))
+
+-static inline int
+-assfail(const char *buf, const char *file, int line)
+-{
+- __assert(buf, file, line);
+- return (0);
+-}
+-
+-/* BEGIN CSTYLED */
+-#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE) do { \
+- const TYPE __left = (TYPE)(LEFT); \
+- const TYPE __right = (TYPE)(RIGHT); \
+- if (!(__left OP __right)) { \
+- char *__buf = alloca(256); \
+- (void) snprintf(__buf, 256, "%s %s %s (0x%llx %s 0x%llx)", \
+- #LEFT, #OP, #RIGHT, \
+- (u_longlong_t)__left, #OP, (u_longlong_t)__right); \
+- assfail(__buf, __FILE__, __LINE__); \
+- } \
++#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE) \
++do { \
++ const TYPE __left = (TYPE)(LEFT); \
++ const TYPE __right = (TYPE)(RIGHT); \
++ if (!(__left OP __right)) { \
++ char *__buf = alloca(256); \
++ (void) snprintf(__buf, 256, \
++ "%s %s %s (0x%llx %s 0x%llx)", #LEFT, #OP, #RIGHT, \
++ (u_longlong_t)__left, #OP, (u_longlong_t)__right); \
++ libspl_assert(__buf, __FILE__, __FUNCTION__, __LINE__); \
++ } \
+ } while (0)
+-/* END CSTYLED */
+
+ #define VERIFY3S(x, y, z) VERIFY3_IMPL(x, y, z, int64_t)
+ #define VERIFY3U(x, y, z) VERIFY3_IMPL(x, y, z, uint64_t)
+ #define VERIFY3P(x, y, z) VERIFY3_IMPL(x, y, z, uintptr_t)
+ #define VERIFY0(x) VERIFY3_IMPL(x, ==, 0, uint64_t)
+
++#ifdef assert
++#undef assert
++#endif
++
+ #ifdef NDEBUG
+ #define ASSERT3S(x, y, z) ((void)0)
+ #define ASSERT3U(x, y, z) ((void)0)
+ #define ASSERT3P(x, y, z) ((void)0)
+ #define ASSERT0(x) ((void)0)
++#define ASSERT(x) ((void)0)
++#define assert(x) ((void)0)
+ #define ASSERTV(x)
+ #define IMPLY(A, B) ((void)0)
+ #define EQUIV(A, B) ((void)0)
+@@ -102,13 +88,17 @@ assfail(const char *buf, const char *file, int line)
+ #define ASSERT3U(x, y, z) VERIFY3U(x, y, z)
+ #define ASSERT3P(x, y, z) VERIFY3P(x, y, z)
+ #define ASSERT0(x) VERIFY0(x)
++#define ASSERT(x) VERIFY(x)
++#define assert(x) VERIFY(x)
+ #define ASSERTV(x) x
+ #define IMPLY(A, B) \
+ ((void)(((!(A)) || (B)) || \
+- assfail("(" #A ") implies (" #B ")", __FILE__, __LINE__)))
++ libspl_assert("(" #A ") implies (" #B ")", \
++ __FILE__, __FUNCTION__, __LINE__)))
+ #define EQUIV(A, B) \
+ ((void)((!!(A) == !!(B)) || \
+- assfail("(" #A ") is equivalent to (" #B ")", __FILE__, __LINE__)))
++ libspl_assert("(" #A ") is equivalent to (" #B ")", \
++ __FILE__, __FUNCTION__, __LINE__)))
+
+ #endif /* NDEBUG */
+
+--
+2.7.4
+
diff --git a/main/zfs-hardened/0008-Add-support-for-libtirpc.patch b/main/zfs-hardened/0008-Add-support-for-libtirpc.patch
new file mode 100644
index 0000000000..4849871483
--- /dev/null
+++ b/main/zfs-hardened/0008-Add-support-for-libtirpc.patch
@@ -0,0 +1,331 @@
+From 6f8aad51a7ef24ea614184f8ef801852b25357a1 Mon Sep 17 00:00:00 2001
+From: Brian Behlendorf <behlendorf1@llnl.gov>
+Date: Tue, 26 Apr 2016 17:24:41 -0700
+Subject: [PATCH 8/8] Add support for libtirpc
+
+While OpenSolaris libc and glibc both include XDR support, the musl libc
+does not in favor of depending on the BSD-licensed libtirpc library.
+
+Adding support is a simple matter of detecting the library, including
+the headers and linking against it. By default libtirpc will be checked
+for and if available used. Otherwise, configure will fall back to using
+the xdr implementation provided by libc if available. The options
+--with-tirpc/--without-tirpc can be used to disable this checking.
+
+In addition, the xdr_control() function has been simplied to only
+handle ZFSs specific use case.
+
+Original-patch-by: stf <s@ctrlc.hu>
+Original-patch-by: Richard Yao <ryao@gentoo.org>
+Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Signed-off-by: Signed-off-by: Carlo Landmeter <clandmeter@gmail.com>
+Closes #2254
+Closes #4559
+---
+ config/user-libtirpc.m4 | 30 ++++++++++++++
+ config/user.m4 | 1 +
+ lib/libnvpair/Makefile.am | 6 +--
+ lib/libnvpair/nvpair_alloc_system.c | 1 +
+ lib/libspl/Makefile.am | 1 -
+ lib/libspl/include/rpc/Makefile.am | 1 -
+ lib/libspl/include/rpc/types.h | 32 ---------------
+ lib/libspl/include/rpc/xdr.h | 43 ++++++++++++--------
+ lib/libspl/xdr.c | 78 -------------------------------------
+ 9 files changed, 61 insertions(+), 132 deletions(-)
+ create mode 100644 config/user-libtirpc.m4
+ delete mode 100644 lib/libspl/include/rpc/types.h
+ delete mode 100644 lib/libspl/xdr.c
+
+diff --git a/config/user-libtirpc.m4 b/config/user-libtirpc.m4
+new file mode 100644
+index 0000000..5f92906
+--- /dev/null
++++ b/config/user-libtirpc.m4
+@@ -0,0 +1,30 @@
++dnl #
++dnl # Check for libtirpc - may be needed for xdr functionality
++dnl #
++AC_DEFUN([ZFS_AC_CONFIG_USER_LIBTIRPC], [
++ AC_ARG_WITH([tirpc],
++ [AS_HELP_STRING([--with-tirpc],
++ [use tirpc for xdr encoding @<:@default=check@:>@])],
++ [],
++ [with_tirpc=check])
++
++ LIBTIRPC=
++ LIBTIRPC_CFLAGS=
++
++ AS_IF([test "x$with_tirpc" != xno],
++ [AC_CHECK_LIB([tirpc], [xdrmem_create],
++ [AC_SUBST([LIBTIRPC], [-ltirpc])
++ AC_SUBST([LIBTIRPC_CFLAGS], [-I/usr/include/tirpc])
++ AC_DEFINE([HAVE_LIBTIRPC], [1], [Define if you have libtirpc])
++ ],
++ [if test "x$with_tirpc" != xcheck; then
++ AC_MSG_FAILURE(
++ [--with-tirpc was given, but test for tirpc failed])
++ fi
++ AC_SEARCH_LIBS([xdrmem_create], [tirpc], [], [
++ AC_MSG_FAILURE([xdrmem_create() requires tirpc or libc])])
++ ])],
++ [AC_SEARCH_LIBS([xdrmem_create], [tirpc], [], [
++ AC_MSG_FAILURE([xdrmem_create() requires libc])])
++ ])
++])
+diff --git a/config/user.m4 b/config/user.m4
+index 7f79420..7213e61 100644
+--- a/config/user.m4
++++ b/config/user.m4
+@@ -10,6 +10,7 @@ AC_DEFUN([ZFS_AC_CONFIG_USER], [
+ ZFS_AC_CONFIG_USER_ARCH
+ ZFS_AC_CONFIG_USER_ZLIB
+ ZFS_AC_CONFIG_USER_LIBUUID
++ ZFS_AC_CONFIG_USER_LIBTIRPC
+ ZFS_AC_CONFIG_USER_LIBBLKID
+ ZFS_AC_CONFIG_USER_FRAME_LARGER_THAN
+ ZFS_AC_CONFIG_USER_RUNSTATEDIR
+diff --git a/lib/libnvpair/Makefile.am b/lib/libnvpair/Makefile.am
+index c9ac1f1..2833557 100644
+--- a/lib/libnvpair/Makefile.am
++++ b/lib/libnvpair/Makefile.am
+@@ -4,7 +4,7 @@ VPATH = \
+ $(top_srcdir)/module/nvpair \
+ $(top_srcdir)/lib/libnvpair
+
+-AM_CFLAGS += $(DEBUG_STACKFLAGS) $(FRAME_LARGER_THAN)
++AM_CFLAGS += $(DEBUG_STACKFLAGS) $(FRAME_LARGER_THAN) $(LIBTIRPC_CFLAGS)
+
+ DEFAULT_INCLUDES += \
+ -I$(top_srcdir)/include \
+@@ -26,8 +26,8 @@ nodist_libnvpair_la_SOURCES = \
+ $(KERNEL_C)
+
+ libnvpair_la_LIBADD = \
+- $(top_builddir)/lib/libuutil/libuutil.la
+-
++ $(top_builddir)/lib/libuutil/libuutil.la \
++ $(LIBTIRPC)
+ libnvpair_la_LDFLAGS = -version-info 1:1:0
+
+ EXTRA_DIST = $(USER_C)
+diff --git a/lib/libnvpair/nvpair_alloc_system.c b/lib/libnvpair/nvpair_alloc_system.c
+index f45dc5f..54dde1e 100644
+--- a/lib/libnvpair/nvpair_alloc_system.c
++++ b/lib/libnvpair/nvpair_alloc_system.c
+@@ -27,6 +27,7 @@
+
+
+ #include <rpc/types.h>
++#include <sys/kmem.h>
+ #include <sys/nvpair.h>
+
+ static void *
+diff --git a/lib/libspl/Makefile.am b/lib/libspl/Makefile.am
+index a569446..afd64fc 100644
+--- a/lib/libspl/Makefile.am
++++ b/lib/libspl/Makefile.am
+@@ -29,7 +29,6 @@ USER_C = \
+ strnlen.c \
+ timestamp.c \
+ zone.c \
+- xdr.c \
+ include/sys/list.h \
+ include/sys/list_impl.h
+
+diff --git a/lib/libspl/include/rpc/Makefile.am b/lib/libspl/include/rpc/Makefile.am
+index 7a29aba..78ee5a2 100644
+--- a/lib/libspl/include/rpc/Makefile.am
++++ b/lib/libspl/include/rpc/Makefile.am
+@@ -1,4 +1,3 @@
+ libspldir = $(includedir)/libspl/rpc
+ libspl_HEADERS = \
+- $(top_srcdir)/lib/libspl/include/rpc/types.h \
+ $(top_srcdir)/lib/libspl/include/rpc/xdr.h
+diff --git a/lib/libspl/include/rpc/types.h b/lib/libspl/include/rpc/types.h
+deleted file mode 100644
+index aa9901f..0000000
+--- a/lib/libspl/include/rpc/types.h
++++ /dev/null
+@@ -1,32 +0,0 @@
+-/*
+- * 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 2010 Sun Microsystems, Inc. All rights reserved.
+- * Use is subject to license terms.
+- */
+-
+-#ifndef LIBSPL_RPC_TYPES_H
+-#define LIBSPL_RPC_TYPES_H
+-
+-#include_next <rpc/types.h>
+-#include <sys/kmem.h>
+-
+-#endif /* LIBSPL_RPC_TYPES_H */
+diff --git a/lib/libspl/include/rpc/xdr.h b/lib/libspl/include/rpc/xdr.h
+index 99500d6..3c7c53f 100644
+--- a/lib/libspl/include/rpc/xdr.h
++++ b/lib/libspl/include/rpc/xdr.h
+@@ -32,11 +32,20 @@
+ #ifndef LIBSPL_RPC_XDR_H
+ #define LIBSPL_RPC_XDR_H
+
+-#include_next <rpc/xdr.h>
+-
+ /*
+- * These are XDR control operators
++ * When available prefer libtirpc for xdr functionality. This library is
++ * mandatory when compiling with musl libc because it does not provide xdr.
+ */
++#if defined(HAVE_LIBTIRPC)
++
++#include <tirpc/rpc/xdr.h>
++#ifdef xdr_control
++#undef xdr_control
++#endif
++
++#else
++#include_next <rpc/xdr.h>
++#endif /* HAVE_LIBTIRPC */
+
+ #define XDR_GET_BYTES_AVAIL 1
+
+@@ -46,20 +55,20 @@ typedef struct xdr_bytesrec {
+ } xdr_bytesrec_t;
+
+ /*
+- * These are the request arguments to XDR_CONTROL.
+- *
+- * XDR_PEEK - returns the contents of the next XDR unit on the XDR stream.
+- * XDR_SKIPBYTES - skips the next N bytes in the XDR stream.
+- * XDR_RDMAGET - for xdr implementation over RDMA, gets private flags from
+- * the XDR stream being moved over RDMA
+- * XDR_RDMANOCHUNK - for xdr implementaion over RDMA, sets private flags in
+- * the XDR stream moving over RDMA.
++ * This functionality is not required and is disabled in user space.
+ */
+-#define XDR_PEEK 2
+-#define XDR_SKIPBYTES 3
+-#define XDR_RDMAGET 4
+-#define XDR_RDMASET 5
++static inline bool_t
++xdr_control(XDR *xdrs, int request, void *info)
++{
++ xdr_bytesrec_t *xptr;
+
+-extern bool_t xdr_control(XDR *xdrs, int request, void *info);
++ ASSERT3U(request, ==, XDR_GET_BYTES_AVAIL);
+
+-#endif
++ xptr = (xdr_bytesrec_t *)info;
++ xptr->xc_is_last_record = TRUE;
++ xptr->xc_num_avail = xdrs->x_handy;
++
++ return (TRUE);
++}
++
++#endif /* LIBSPL_RPC_XDR_H */
+diff --git a/lib/libspl/xdr.c b/lib/libspl/xdr.c
+deleted file mode 100644
+index 288a338..0000000
+--- a/lib/libspl/xdr.c
++++ /dev/null
+@@ -1,78 +0,0 @@
+-/*
+- * CDDL HEADER START
+- *
+- * The contents of this file are subject to the terms of the
+- * Common Development and Distribution License, Version 1.0 only
+- * (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 2005 Sun Microsystems, Inc. All rights reserved.
+- * Use is subject to license terms.
+- *
+- * Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T
+- * All Rights Reserved
+- *
+- * Portions of this source code were derived from Berkeley 4.3 BSD
+- * under license from the Regents of the University of California.
+- */
+-
+-#include <rpc/xdr.h>
+-
+-/*
+- * As of glibc-2.5-25 there is not support for xdr_control(). The
+- * xdrmem implementation from OpenSolaris is used here.
+- *
+- * FIXME: Not well tested it may not work as expected.
+- */
+-bool_t
+-xdr_control(XDR *xdrs, int request, void *info)
+-{
+- xdr_bytesrec_t *xptr;
+- int32_t *int32p;
+- int len;
+-
+- switch (request) {
+- case XDR_GET_BYTES_AVAIL:
+- xptr = (xdr_bytesrec_t *)info;
+- xptr->xc_is_last_record = TRUE;
+- xptr->xc_num_avail = xdrs->x_handy;
+- return (TRUE);
+-
+- case XDR_PEEK:
+- /*
+- * Return the next 4 byte unit in the XDR stream.
+- */
+- if (xdrs->x_handy < sizeof (int32_t))
+- return (FALSE);
+- int32p = (int32_t *)info;
+- *int32p = (int32_t)ntohl((uint32_t)
+- (*((int32_t *)(xdrs->x_private))));
+- return (TRUE);
+-
+- case XDR_SKIPBYTES:
+- /*
+- * Skip the next N bytes in the XDR stream.
+- */
+- int32p = (int32_t *)info;
+- len = RNDUP((int)(*int32p));
+- if ((xdrs->x_handy -= len) < 0)
+- return (FALSE);
+- xdrs->x_private += len;
+- return (TRUE);
+-
+- }
+- return (FALSE);
+-}
+--
+2.7.4
+
diff --git a/main/zfs-hardened/0009-Add-support-for-alpine-linux.patch b/main/zfs-hardened/0009-Add-support-for-alpine-linux.patch
new file mode 100644
index 0000000000..54d55e6ea5
--- /dev/null
+++ b/main/zfs-hardened/0009-Add-support-for-alpine-linux.patch
@@ -0,0 +1,122 @@
+From 00aa1a096d2c9ecaf28faa51aca5feb9d406aab0 Mon Sep 17 00:00:00 2001
+From: Carlo Landmeter <clandmeter@gmail.com>
+Date: Tue, 1 Mar 2016 16:36:28 +0100
+Subject: [PATCH] Add support for alpine linux
+
+Both Alpine Linux and Gentoo use OpenRC so we share its logic
+---
+ config/zfs-build.m4 | 7 ++++++-
+ etc/init.d/Makefile.am | 2 +-
+ etc/init.d/zfs-import.in | 2 +-
+ etc/init.d/zfs-mount.in | 2 +-
+ etc/init.d/zfs-share.in | 2 +-
+ etc/init.d/zfs-zed.in | 2 +-
+ 6 files changed, 11 insertions(+), 6 deletions(-)
+
+diff --git a/config/zfs-build.m4 b/config/zfs-build.m4
+index f93c5b5..9d3f0a6 100644
+--- a/config/zfs-build.m4
++++ b/config/zfs-build.m4
+@@ -266,6 +266,8 @@ AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [
+ VENDOR=ubuntu ;
+ elif test -f /etc/debian_version ; then
+ VENDOR=debian ;
++ elif test -f /etc/alpine-release ; then
++ VENDOR=alpine ;
+ else
+ VENDOR= ;
+ fi
+@@ -278,6 +280,7 @@ AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [
+ redhat) DEFAULT_PACKAGE=rpm ;;
+ fedora) DEFAULT_PACKAGE=rpm ;;
+ gentoo) DEFAULT_PACKAGE=tgz ;;
++ alpine) DEFAULT_PACKAGE=tgz ;;
+ arch) DEFAULT_PACKAGE=tgz ;;
+ sles) DEFAULT_PACKAGE=rpm ;;
+ slackware) DEFAULT_PACKAGE=tgz ;;
+@@ -299,7 +302,8 @@ AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [
+ toss) DEFAULT_INIT_SCRIPT=redhat ;;
+ redhat) DEFAULT_INIT_SCRIPT=redhat ;;
+ fedora) DEFAULT_INIT_SCRIPT=fedora ;;
+- gentoo) DEFAULT_INIT_SCRIPT=gentoo ;;
++ gentoo) DEFAULT_INIT_SCRIPT=openrc ;;
++ alpine) DEFAULT_INIT_SCRIPT=openrc ;;
+ arch) DEFAULT_INIT_SCRIPT=lsb ;;
+ sles) DEFAULT_INIT_SCRIPT=lsb ;;
+ slackware) DEFAULT_INIT_SCRIPT=lsb ;;
+@@ -313,6 +317,7 @@ AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [
+
+ AC_MSG_CHECKING([default init config direectory])
+ case "$VENDOR" in
++ alpine) DEFAULT_INITCONF_DIR=/etc/conf.d ;;
+ gentoo) DEFAULT_INITCONF_DIR=/etc/conf.d ;;
+ toss) DEFAULT_INITCONF_DIR=/etc/sysconfig ;;
+ redhat) DEFAULT_INITCONF_DIR=/etc/sysconfig ;;
+diff --git a/etc/init.d/Makefile.am b/etc/init.d/Makefile.am
+index 5f70fc6..c6e29d1 100644
+--- a/etc/init.d/Makefile.am
++++ b/etc/init.d/Makefile.am
+@@ -21,7 +21,7 @@ $(init_SCRIPTS) $(initconf_SCRIPTS) $(initcommon_SCRIPTS): $(EXTRA_DIST)
+ else \
+ NFS_SRV=nfs; \
+ fi; \
+- if [ -e /etc/gentoo-release ]; then \
++ if [ -e /sbin/openrc-run ]; then \
+ SHELL=/sbin/runscript; \
+ else \
+ SHELL=/bin/sh; \
+diff --git a/etc/init.d/zfs-import.in b/etc/init.d/zfs-import.in
+index 2258638..354bbc6 100755
+--- a/etc/init.d/zfs-import.in
++++ b/etc/init.d/zfs-import.in
+@@ -308,7 +308,7 @@ do_start()
+
+ # ----------------------------------------------------
+
+-if [ ! -e /etc/gentoo-release ]
++if [ ! -e /sbin/openrc-run ]
+ then
+ case "$1" in
+ start)
+diff --git a/etc/init.d/zfs-mount.in b/etc/init.d/zfs-mount.in
+index 05cea9b..34db057 100755
+--- a/etc/init.d/zfs-mount.in
++++ b/etc/init.d/zfs-mount.in
+@@ -199,7 +199,7 @@ do_stop()
+
+ # ----------------------------------------------------
+
+-if [ ! -e /etc/gentoo-release ]
++if [ ! -e /sbin/openrc-run ]
+ then
+ case "$1" in
+ start)
+diff --git a/etc/init.d/zfs-share.in b/etc/init.d/zfs-share.in
+index 1b70da4..ce3cc1c 100755
+--- a/etc/init.d/zfs-share.in
++++ b/etc/init.d/zfs-share.in
+@@ -58,7 +58,7 @@ do_stop()
+
+ # ----------------------------------------------------
+
+-if [ ! -e /etc/gentoo-release ]; then
++if [ ! -e /sbin/openrc-run ]; then
+ case "$1" in
+ start)
+ do_start
+diff --git a/etc/init.d/zfs-zed.in b/etc/init.d/zfs-zed.in
+index 86e3185..d0086ee 100755
+--- a/etc/init.d/zfs-zed.in
++++ b/etc/init.d/zfs-zed.in
+@@ -98,7 +98,7 @@ do_reload()
+
+ # ----------------------------------------------------
+
+-if [ ! -e /etc/gentoo-release ]; then
++if [ ! -e /sbin/openrc-run ]; then
+ case "$1" in
+ start)
+ do_start
+--
+2.7.2
+
diff --git a/main/zfs-hardened/APKBUILD b/main/zfs-hardened/APKBUILD
new file mode 100644
index 0000000000..5db25486d8
--- /dev/null
+++ b/main/zfs-hardened/APKBUILD
@@ -0,0 +1,106 @@
+# Contributor: Carlo Landmeter <clandmeter@gmail.com>
+# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
+
+_flavor=${FLAVOR:-hardened}
+_realname=zfs
+_name=$_realname-$_flavor
+
+_kpkg=linux-$_flavor
+_kver=4.9.24
+_kpkgrel=1
+
+_realver=0.6.5.9
+_mypkgrel=0
+
+_kernelver=$_kver-r$_kpkgrel
+_abi_release=${_kver}-${_kpkgrel}-${_flavor}
+
+pkgname=$_name
+pkgver=$_kver
+pkgrel=$(($_kpkgrel + $_mypkgrel))
+pkgdesc="ZFS for Linux"
+url="http://zfsonlinux.org"
+arch="x86 x86_64"
+license="CDDL"
+depends="spl-$_flavor"
+depends_dev="glib-dev e2fsprogs-dev util-linux-dev libtirpc-dev
+ linux-$_flavor-dev=$_kernelver spl-$_flavor-dev"
+makedepends="$depends_dev automake autoconf libtool linux-headers"
+install_if="zfs linux-grsec-$_kver"
+install=""
+subpackages="$pkgname-dev"
+provides="${_realname}-grsec=${pkgver}-r${pkgrel}"
+source="https://github.com/zfsonlinux/zfs/releases/download/zfs-$_realver/zfs-$_realver.tar.gz
+ 0001-Use-the-correct-macro-to-include-backtrace.patch
+ 0002-Include-sys-types.h-in-devid.h.patch
+ 0003-Add-missing-fcntl.h-to-includes-in-mount_zfs.c.patch
+ 0004-Ensure-correct-return-value-type.patch
+ 0005-Set-_DATE_FMT-to-if-not-defined-in-libspl-timestamp..patch
+ 0006-Move-hrtime_t-timestruc_t-and-timespec_t.patch
+ 0007-Remove-complicated-libspl-assert-wrappers.patch
+ 0008-Add-support-for-libtirpc.patch
+ 0009-Add-support-for-alpine-linux.patch
+ pax-rap-fixes.patch
+ "
+
+
+builddir="$srcdir/$_realname-$_realver"
+
+prepare() {
+ # source the kernel version
+ (
+ if [ -f "$startdir"/../../main/linux-$_flavor/APKBUILD ]; then
+ . "$startdir"/../../main/linux-$_flavor/APKBUILD
+ if [ "$_kver" != "$pkgver" ]; then
+ die "$_name: Please update _kver to $pkgver"
+ fi
+ if [ "$_kpkgrel" != "$pkgrel" ]; then
+ die "$_name: Please update _kpkgrel to $pkgrel"
+ fi
+ fi
+ ) || return 1
+
+ default_prepare
+ autoreconf -vif || return 1
+}
+
+build() {
+ cd "$builddir"
+ export LIBS="$LIBS -lintl"
+ EXTRA_KCFLAGS="-Wno-error=unused-but-set-variable" \
+ ./configure --prefix=/usr \
+ --with-tirpc \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --localstatedir=/var \
+ --with-config=kernel \
+ --with-linux=/usr/src/linux-headers-${_abi_release} \
+ --with-spl=/usr/src/spl-${_realver} \
+ || return 1
+ make || return 1
+}
+
+package() {
+ cd "$builddir"
+ make DESTDIR="$pkgdir" \
+ install || return 1
+}
+
+dev() {
+ mkdir -p "$subpkgdir"/usr
+ mv "$pkgdir"/usr/src "$subpkgdir"/usr || return 1
+ default_dev
+}
+
+sha512sums="6e175f32421cf0f9e13429f12f0fac0564dc7059ab076831d0ebc4f6a17412160ca3526ebdf894bc7666e82580355b08701dd01c411d3177f82e7330b4529a37 zfs-0.6.5.9.tar.gz
+1e9f3c753b5bbe50ea6c953fec4200ae3a2de63abaa0dbcc2fb558a92716c27545ef773b3d0dc7bb1248622073a0db4c194d008bc83af7de7f90111169ffe31a 0001-Use-the-correct-macro-to-include-backtrace.patch
+244f143c3cca0102ee98aed122b70d9e255a68645d90f927d67fe19e89c4678839b91fbb560c4e55306510e8aec4762c4afc671317df153940f17e905c17b928 0002-Include-sys-types.h-in-devid.h.patch
+413cf13db3d390714fcd20c4150d3b0dbddcff031572117fcd4f015d929fde642381ab98f0b796dc4001472b2ee13dbf69261f4b83e990c2b0a080223667193c 0003-Add-missing-fcntl.h-to-includes-in-mount_zfs.c.patch
+c26793c4ada197584d5829a6d31fd826333416a73ac1fa1d8f84277ba99312db72608d6d13171131cdf61b20e1c6c1ada51027361d48cc7b2863fd5b23df8083 0004-Ensure-correct-return-value-type.patch
+fbd44839a422925a54710e8425405d24ca2428b78aa54b9a77492e5882a3e21aa4a5e53656466c5af79460fde75ac6aeb6f1f3fe85a1f26333d5acd36c6c9013 0005-Set-_DATE_FMT-to-if-not-defined-in-libspl-timestamp..patch
+e20fb3004af9e6454513d7df09292465e5bc4101a558538cf794ef41b56a30713e1868dcda251e6b3ed10c5f0178e86068bcb113bd8228eedb626cb73bb19ecd 0006-Move-hrtime_t-timestruc_t-and-timespec_t.patch
+9843aca713021772435cfa68fde5d9aa2de0387de0da6c48045db0348f2a24d2c2e968d3eb1921923170c9e2fd6514e31c5f0a7bacbf8510b53c2c625c4737d1 0007-Remove-complicated-libspl-assert-wrappers.patch
+fa752b3ed04f05ec4fac257cbd2c581a57a792e12165d8f135a77b894445cdefb0da1753922e3e59c9fbaed20ca1dc6d19b5436745c8fa588a42304f6561f1a2 0008-Add-support-for-libtirpc.patch
+d2efb627f493bab06f8049dc4bcb7c39269ff9dcd66879a0f96fa5040e1c7468f9e684277ec3e54841b3a5f8734d9470f2c6a1af470e3f1a71f759f9155b7ede 0009-Add-support-for-alpine-linux.patch
+85e545418fbf47b867e95d58f2c1fe810be5f280c66ac3f583e30f47737d752b40191a313accaac62537181c86ba0fc5485e8d4f50d6c561c317b7eb1db3c163 pax-rap-fixes.patch"
diff --git a/main/zfs-hardened/pax-rap-fixes.patch b/main/zfs-hardened/pax-rap-fixes.patch
new file mode 100644
index 0000000000..462ef57e48
--- /dev/null
+++ b/main/zfs-hardened/pax-rap-fixes.patch
@@ -0,0 +1,599 @@
+diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c
+index 40524ed..a83b559 100644
+--- a/cmd/ztest/ztest.c
++++ b/cmd/ztest/ztest.c
+@@ -5541,7 +5541,7 @@ ztest_resume(spa_t *spa)
+ (void) zio_resume(spa);
+ }
+
+-static void *
++static void
+ ztest_resume_thread(void *arg)
+ {
+ spa_t *spa = arg;
+@@ -5553,8 +5553,6 @@ ztest_resume_thread(void *arg)
+ }
+
+ thread_exit();
+-
+- return (NULL);
+ }
+
+ #define GRACE 300
+@@ -5588,7 +5586,7 @@ ztest_execute(int test, ztest_info_t *zi, uint64_t id)
+ (double)functime / NANOSEC, zi->zi_funcname);
+ }
+
+-static void *
++static void
+ ztest_thread(void *arg)
+ {
+ int rand;
+@@ -5628,8 +5626,6 @@ ztest_thread(void *arg)
+ }
+
+ thread_exit();
+-
+- return (NULL);
+ }
+
+ static void
+@@ -5818,7 +5814,7 @@ ztest_run(ztest_shared_t *zs)
+ * Create a thread to periodically resume suspended I/O.
+ */
+ VERIFY3P((resume_thread = zk_thread_create(NULL, 0,
+- (thread_func_t)ztest_resume_thread, spa, TS_RUN, NULL, 0, 0,
++ ztest_resume_thread, spa, TS_RUN, NULL, 0, 0,
+ PTHREAD_CREATE_JOINABLE)), !=, NULL);
+
+ #if 0
+@@ -5870,7 +5866,7 @@ ztest_run(ztest_shared_t *zs)
+ return;
+
+ VERIFY3P(thread = zk_thread_create(NULL, 0,
+- (thread_func_t)ztest_thread,
++ ztest_thread,
+ (void *)(uintptr_t)t, TS_RUN, NULL, 0, 0,
+ PTHREAD_CREATE_JOINABLE), !=, NULL);
+ tid[t] = thread->t_tid;
+diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h
+index 78e33e1..255b1a4 100644
+--- a/include/sys/zfs_context.h
++++ b/include/sys/zfs_context.h
+@@ -240,7 +240,7 @@ typedef struct kthread {
+ #define getcomm() "unknown"
+ #define thread_exit zk_thread_exit
+ #define thread_create(stk, stksize, func, arg, len, pp, state, pri) \
+- zk_thread_create(stk, stksize, (thread_func_t)func, arg, \
++ zk_thread_create(stk, stksize, func, arg, \
+ len, NULL, state, pri, PTHREAD_CREATE_DETACHED)
+ #define thread_join(t) zk_thread_join(t)
+ #define newproc(f, a, cid, pri, ctp, pid) (ENOSYS)
+diff --git a/include/sys/zio.h b/include/sys/zio.h
+index 4916d87..973dc73 100644
+--- a/include/sys/zio.h
++++ b/include/sys/zio.h
+@@ -513,7 +513,7 @@ extern void zio_shrink(zio_t *zio, uint64_t size);
+
+ extern int zio_wait(zio_t *zio);
+ extern void zio_nowait(zio_t *zio);
+-extern void zio_execute(zio_t *zio);
++extern void zio_execute(void *zio);
+ extern void zio_interrupt(zio_t *zio);
+
+ extern zio_t *zio_walk_parents(zio_t *cio);
+diff --git a/module/zfs/arc.c b/module/zfs/arc.c
+index 04fde6c..a9652dd 100644
+--- a/module/zfs/arc.c
++++ b/module/zfs/arc.c
+@@ -3416,7 +3416,7 @@ arc_kmem_reap_now(void)
+ * using mutex_tryenter() from arc_reclaim_thread().
+ */
+ static void
+-arc_reclaim_thread(void)
++arc_reclaim_thread(void *_unused)
+ {
+ fstrans_cookie_t cookie = spl_fstrans_mark();
+ clock_t growtime = 0;
+@@ -3509,7 +3509,7 @@ arc_reclaim_thread(void)
+ }
+
+ static void
+-arc_user_evicts_thread(void)
++arc_user_evicts_thread(void *_unused)
+ {
+ fstrans_cookie_t cookie = spl_fstrans_mark();
+ callb_cpr_t cpr;
+@@ -6732,7 +6732,7 @@ l2arc_release_cdata_buf(arc_buf_hdr_t *hdr)
+ * heart of the L2ARC.
+ */
+ static void
+-l2arc_feed_thread(void)
++l2arc_feed_thread(void *_unused)
+ {
+ callb_cpr_t cpr;
+ l2arc_dev_t *dev;
+diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c
+index 483067c..68d2933 100644
+--- a/module/zfs/dbuf.c
++++ b/module/zfs/dbuf.c
+@@ -1583,7 +1583,6 @@ dmu_buf_will_fill(dmu_buf_t *db_fake, dmu_tx_t *tx)
+ (void) dbuf_dirty(db, tx);
+ }
+
+-#pragma weak dmu_buf_fill_done = dbuf_fill_done
+ /* ARGSUSED */
+ void
+ dbuf_fill_done(dmu_buf_impl_t *db, dmu_tx_t *tx)
+@@ -1605,6 +1604,12 @@ dbuf_fill_done(dmu_buf_impl_t *db, dmu_tx_t *tx)
+ mutex_exit(&db->db_mtx);
+ }
+
++void __weak
++dmu_buf_fill_done(dmu_buf_t *db, dmu_tx_t *tx)
++{
++ dbuf_fill_done((dmu_buf_impl_t *)db, tx);
++}
++
+ void
+ dmu_buf_write_embedded(dmu_buf_t *dbuf, void *data,
+ bp_embedded_type_t etype, enum zio_compress comp,
+@@ -2240,13 +2245,20 @@ dbuf_rm_spill(dnode_t *dn, dmu_tx_t *tx)
+ dbuf_free_range(dn, DMU_SPILL_BLKID, DMU_SPILL_BLKID, tx);
+ }
+
+-#pragma weak dmu_buf_add_ref = dbuf_add_ref
+ void
+ dbuf_add_ref(dmu_buf_impl_t *db, void *tag)
+ {
+ VERIFY(refcount_add(&db->db_holds, tag) > 1);
+ }
+
++void __weak
++dmu_buf_add_ref(dmu_buf_t *_db, void* tag)
++{
++ dmu_buf_impl_t *db = (dmu_buf_impl_t *)_db;
++ dbuf_add_ref(db, tag);
++}
++
++
+ #pragma weak dmu_buf_try_add_ref = dbuf_try_add_ref
+ boolean_t
+ dbuf_try_add_ref(dmu_buf_t *db_fake, objset_t *os, uint64_t obj, uint64_t blkid,
+@@ -2412,13 +2424,18 @@ dbuf_rele_and_unlock(dmu_buf_impl_t *db, void *tag)
+ }
+ }
+
+-#pragma weak dmu_buf_refcount = dbuf_refcount
+ uint64_t
+ dbuf_refcount(dmu_buf_impl_t *db)
+ {
+ return (refcount_count(&db->db_holds));
+ }
+
++uint64_t __weak
++dmu_buf_refcount(dmu_buf_t *db)
++{
++ return dbuf_refcount((dmu_buf_impl_t *)db);
++}
++
+ void *
+ dmu_buf_replace_user(dmu_buf_t *db_fake, dmu_buf_user_t *old_user,
+ dmu_buf_user_t *new_user)
+diff --git a/module/zfs/spa.c b/module/zfs/spa.c
+index dde909e..34ff0dc 100644
+--- a/module/zfs/spa.c
++++ b/module/zfs/spa.c
+@@ -5646,8 +5646,9 @@ spa_async_autoexpand(spa_t *spa, vdev_t *vd)
+ }
+
+ static void
+-spa_async_thread(spa_t *spa)
++spa_async_thread(void *_spa)
+ {
++ spa_t *spa = _spa;
+ int tasks, i;
+
+ ASSERT(spa->spa_sync_on);
+diff --git a/module/zfs/txg.c b/module/zfs/txg.c
+index 1d5ee97..6469c8b 100644
+--- a/module/zfs/txg.c
++++ b/module/zfs/txg.c
+@@ -107,8 +107,8 @@
+ * now transition to the syncing state.
+ */
+
+-static void txg_sync_thread(dsl_pool_t *dp);
+-static void txg_quiesce_thread(dsl_pool_t *dp);
++static void txg_sync_thread(void *_dp);
++static void txg_quiesce_thread(void *_dp);
+
+ int zfs_txg_timeout = 5; /* max seconds worth of delta per txg */
+
+@@ -406,8 +406,9 @@ txg_quiesce(dsl_pool_t *dp, uint64_t txg)
+ }
+
+ static void
+-txg_do_callbacks(list_t *cb_list)
++txg_do_callbacks(void *_cb_list)
+ {
++ list_t *cb_list = _cb_list;
+ dmu_tx_do_callbacks(cb_list, 0);
+
+ list_destroy(cb_list);
+@@ -455,7 +456,7 @@ txg_dispatch_callbacks(dsl_pool_t *dp, uint64_t txg)
+
+ list_move_tail(cb_list, &tc->tc_callbacks[g]);
+
+- (void) taskq_dispatch(tx->tx_commit_cb_taskq, (task_func_t *)
++ (void) taskq_dispatch(tx->tx_commit_cb_taskq,
+ txg_do_callbacks, cb_list, TQ_SLEEP);
+ }
+ }
+@@ -475,8 +476,9 @@ txg_wait_callbacks(dsl_pool_t *dp)
+ }
+
+ static void
+-txg_sync_thread(dsl_pool_t *dp)
++txg_sync_thread(void *_dp)
+ {
++ dsl_pool_t *dp = _dp;
+ spa_t *spa = dp->dp_spa;
+ tx_state_t *tx = &dp->dp_tx;
+ callb_cpr_t cpr;
+@@ -584,8 +586,9 @@ txg_sync_thread(dsl_pool_t *dp)
+ }
+
+ static void
+-txg_quiesce_thread(dsl_pool_t *dp)
++txg_quiesce_thread(void *_dp)
+ {
++ dsl_pool_t *dp = _dp;
+ tx_state_t *tx = &dp->dp_tx;
+ callb_cpr_t cpr;
+
+diff --git a/module/zfs/zfs_replay.c b/module/zfs/zfs_replay.c
+index 0ca1e03..66a2d96 100644
+--- a/module/zfs/zfs_replay.c
++++ b/module/zfs/zfs_replay.c
+@@ -72,7 +72,7 @@ zfs_init_vattr(vattr_t *vap, uint64_t mask, uint64_t mode,
+
+ /* ARGSUSED */
+ static int
+-zfs_replay_error(zfs_sb_t *zsb, lr_t *lr, boolean_t byteswap)
++zfs_replay_error(void *zsb, char *lr, boolean_t byteswap)
+ {
+ return (SET_ERROR(ENOTSUP));
+ }
+@@ -265,8 +265,10 @@ zfs_replay_swap_attrs(lr_attr_t *lrattr)
+ * as option FUID information.
+ */
+ static int
+-zfs_replay_create_acl(zfs_sb_t *zsb, lr_acl_create_t *lracl, boolean_t byteswap)
++zfs_replay_create_acl(void *_zsb, char *_lracl, boolean_t byteswap)
+ {
++ zfs_sb_t *zsb = _zsb;
++ lr_acl_create_t *lracl = (lr_acl_create_t *)_lracl;
+ char *name = NULL; /* location determined later */
+ lr_create_t *lr = (lr_create_t *)lracl;
+ znode_t *dzp;
+@@ -405,8 +407,10 @@ bail:
+ }
+
+ static int
+-zfs_replay_create(zfs_sb_t *zsb, lr_create_t *lr, boolean_t byteswap)
++zfs_replay_create(void *_zsb, char *_lr, boolean_t byteswap)
+ {
++ zfs_sb_t *zsb = _zsb;
++ lr_create_t *lr = (lr_create_t *)_lr;
+ char *name = NULL; /* location determined later */
+ char *link; /* symlink content follows name */
+ znode_t *dzp;
+@@ -530,8 +534,10 @@ out:
+ }
+
+ static int
+-zfs_replay_remove(zfs_sb_t *zsb, lr_remove_t *lr, boolean_t byteswap)
++zfs_replay_remove(void *_zsb, char *_lr, boolean_t byteswap)
+ {
++ zfs_sb_t *zsb = _zsb;
++ lr_remove_t *lr = (lr_remove_t *)_lr;
+ char *name = (char *)(lr + 1); /* name follows lr_remove_t */
+ znode_t *dzp;
+ int error;
+@@ -563,8 +569,10 @@ zfs_replay_remove(zfs_sb_t *zsb, lr_remove_t *lr, boolean_t byteswap)
+ }
+
+ static int
+-zfs_replay_link(zfs_sb_t *zsb, lr_link_t *lr, boolean_t byteswap)
++zfs_replay_link(void *_zsb, char *_lr, boolean_t byteswap)
+ {
++ zfs_sb_t *zsb = _zsb;
++ lr_link_t *lr = (lr_link_t *)_lr;
+ char *name = (char *)(lr + 1); /* name follows lr_link_t */
+ znode_t *dzp, *zp;
+ int error;
+@@ -593,8 +601,10 @@ zfs_replay_link(zfs_sb_t *zsb, lr_link_t *lr, boolean_t byteswap)
+ }
+
+ static int
+-zfs_replay_rename(zfs_sb_t *zsb, lr_rename_t *lr, boolean_t byteswap)
++zfs_replay_rename(void *_zsb, char *_lr, boolean_t byteswap)
+ {
++ zfs_sb_t *zsb = _zsb;
++ lr_rename_t *lr = (lr_rename_t *)_lr;
+ char *sname = (char *)(lr + 1); /* sname and tname follow lr_rename_t */
+ char *tname = sname + strlen(sname) + 1;
+ znode_t *sdzp, *tdzp;
+@@ -624,8 +634,10 @@ zfs_replay_rename(zfs_sb_t *zsb, lr_rename_t *lr, boolean_t byteswap)
+ }
+
+ static int
+-zfs_replay_write(zfs_sb_t *zsb, lr_write_t *lr, boolean_t byteswap)
++zfs_replay_write(void *_zsb, char *_lr, boolean_t byteswap)
+ {
++ zfs_sb_t *zsb = _zsb;
++ lr_write_t *lr = (lr_write_t *)_lr;
+ char *data = (char *)(lr + 1); /* data follows lr_write_t */
+ znode_t *zp;
+ int error, written;
+@@ -693,8 +705,10 @@ zfs_replay_write(zfs_sb_t *zsb, lr_write_t *lr, boolean_t byteswap)
+ * the file is grown.
+ */
+ static int
+-zfs_replay_write2(zfs_sb_t *zsb, lr_write_t *lr, boolean_t byteswap)
++zfs_replay_write2(void *_zsb, char *_lr, boolean_t byteswap)
+ {
++ zfs_sb_t *zsb = _zsb;
++ lr_write_t *lr = (lr_write_t *)_lr;
+ znode_t *zp;
+ int error;
+ uint64_t end;
+@@ -738,8 +752,10 @@ top:
+ }
+
+ static int
+-zfs_replay_truncate(zfs_sb_t *zsb, lr_truncate_t *lr, boolean_t byteswap)
++zfs_replay_truncate(void *_zsb, char *_lr, boolean_t byteswap)
+ {
++ zfs_sb_t *zsb = _zsb;
++ lr_truncate_t *lr = (lr_truncate_t *)_lr;
+ znode_t *zp;
+ flock64_t fl;
+ int error;
+@@ -765,8 +781,10 @@ zfs_replay_truncate(zfs_sb_t *zsb, lr_truncate_t *lr, boolean_t byteswap)
+ }
+
+ static int
+-zfs_replay_setattr(zfs_sb_t *zsb, lr_setattr_t *lr, boolean_t byteswap)
++zfs_replay_setattr(void *_zsb, char *_lr, boolean_t byteswap)
+ {
++ zfs_sb_t *zsb = _zsb;
++ lr_setattr_t *lr = (lr_setattr_t *)_lr;
+ znode_t *zp;
+ xvattr_t xva;
+ vattr_t *vap = &xva.xva_vattr;
+@@ -817,8 +835,10 @@ zfs_replay_setattr(zfs_sb_t *zsb, lr_setattr_t *lr, boolean_t byteswap)
+ }
+
+ static int
+-zfs_replay_acl_v0(zfs_sb_t *zsb, lr_acl_v0_t *lr, boolean_t byteswap)
++zfs_replay_acl_v0(void *_zsb, char *_lr, boolean_t byteswap)
+ {
++ zfs_sb_t *zsb = _zsb;
++ lr_acl_v0_t *lr = (lr_acl_v0_t *)_lr;
+ ace_t *ace = (ace_t *)(lr + 1); /* ace array follows lr_acl_t */
+ vsecattr_t vsa;
+ znode_t *zp;
+@@ -861,8 +881,10 @@ zfs_replay_acl_v0(zfs_sb_t *zsb, lr_acl_v0_t *lr, boolean_t byteswap)
+ *
+ */
+ static int
+-zfs_replay_acl(zfs_sb_t *zsb, lr_acl_t *lr, boolean_t byteswap)
++zfs_replay_acl(void *_zsb, char *_lr, boolean_t byteswap)
+ {
++ zfs_sb_t *zsb = _zsb;
++ lr_acl_t *lr = (lr_acl_t *)_lr;
+ ace_t *ace = (ace_t *)(lr + 1);
+ vsecattr_t vsa;
+ znode_t *zp;
+@@ -912,25 +934,25 @@ zfs_replay_acl(zfs_sb_t *zsb, lr_acl_t *lr, boolean_t byteswap)
+ * Callback vectors for replaying records
+ */
+ zil_replay_func_t zfs_replay_vector[TX_MAX_TYPE] = {
+- (zil_replay_func_t)zfs_replay_error, /* no such type */
+- (zil_replay_func_t)zfs_replay_create, /* TX_CREATE */
+- (zil_replay_func_t)zfs_replay_create, /* TX_MKDIR */
+- (zil_replay_func_t)zfs_replay_create, /* TX_MKXATTR */
+- (zil_replay_func_t)zfs_replay_create, /* TX_SYMLINK */
+- (zil_replay_func_t)zfs_replay_remove, /* TX_REMOVE */
+- (zil_replay_func_t)zfs_replay_remove, /* TX_RMDIR */
+- (zil_replay_func_t)zfs_replay_link, /* TX_LINK */
+- (zil_replay_func_t)zfs_replay_rename, /* TX_RENAME */
+- (zil_replay_func_t)zfs_replay_write, /* TX_WRITE */
+- (zil_replay_func_t)zfs_replay_truncate, /* TX_TRUNCATE */
+- (zil_replay_func_t)zfs_replay_setattr, /* TX_SETATTR */
+- (zil_replay_func_t)zfs_replay_acl_v0, /* TX_ACL_V0 */
+- (zil_replay_func_t)zfs_replay_acl, /* TX_ACL */
+- (zil_replay_func_t)zfs_replay_create_acl, /* TX_CREATE_ACL */
+- (zil_replay_func_t)zfs_replay_create, /* TX_CREATE_ATTR */
+- (zil_replay_func_t)zfs_replay_create_acl, /* TX_CREATE_ACL_ATTR */
+- (zil_replay_func_t)zfs_replay_create_acl, /* TX_MKDIR_ACL */
+- (zil_replay_func_t)zfs_replay_create, /* TX_MKDIR_ATTR */
+- (zil_replay_func_t)zfs_replay_create_acl, /* TX_MKDIR_ACL_ATTR */
+- (zil_replay_func_t)zfs_replay_write2, /* TX_WRITE2 */
++ zfs_replay_error, /* no such type */
++ zfs_replay_create, /* TX_CREATE */
++ zfs_replay_create, /* TX_MKDIR */
++ zfs_replay_create, /* TX_MKXATTR */
++ zfs_replay_create, /* TX_SYMLINK */
++ zfs_replay_remove, /* TX_REMOVE */
++ zfs_replay_remove, /* TX_RMDIR */
++ zfs_replay_link, /* TX_LINK */
++ zfs_replay_rename, /* TX_RENAME */
++ zfs_replay_write, /* TX_WRITE */
++ zfs_replay_truncate, /* TX_TRUNCATE */
++ zfs_replay_setattr, /* TX_SETATTR */
++ zfs_replay_acl_v0, /* TX_ACL_V0 */
++ zfs_replay_acl, /* TX_ACL */
++ zfs_replay_create_acl, /* TX_CREATE_ACL */
++ zfs_replay_create, /* TX_CREATE_ATTR */
++ zfs_replay_create_acl, /* TX_CREATE_ACL_ATTR */
++ zfs_replay_create_acl, /* TX_MKDIR_ACL */
++ zfs_replay_create, /* TX_MKDIR_ATTR */
++ zfs_replay_create_acl, /* TX_MKDIR_ACL_ATTR */
++ zfs_replay_write2, /* TX_WRITE2 */
+ };
+diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c
+index 384a37f..76d02a4 100644
+--- a/module/zfs/zfs_vnops.c
++++ b/module/zfs/zfs_vnops.c
+@@ -919,6 +919,13 @@ zfs_write(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr)
+ }
+ EXPORT_SYMBOL(zfs_write);
+
++static void
++iput_wrapper(void *_i)
++{
++ struct inode *i = _i;
++ iput(i);
++}
++
+ void
+ zfs_iput_async(struct inode *ip)
+ {
+@@ -929,7 +936,7 @@ zfs_iput_async(struct inode *ip)
+
+ if (atomic_read(&ip->i_count) == 1)
+ taskq_dispatch(dsl_pool_iput_taskq(dmu_objset_pool(os)),
+- (task_func_t *)iput, ip, TQ_SLEEP);
++ iput_wrapper, ip, TQ_SLEEP);
+ else
+ iput(ip);
+ }
+diff --git a/module/zfs/zil.c b/module/zfs/zil.c
+index 289b23c..f909e99 100644
+--- a/module/zfs/zil.c
++++ b/module/zfs/zil.c
+@@ -1217,8 +1217,9 @@ zil_itx_destroy(itx_t *itx)
+ * so no locks are needed.
+ */
+ static void
+-zil_itxg_clean(itxs_t *itxs)
++zil_itxg_clean(void *data)
+ {
++ itxs_t *itxs = data;
+ itx_t *itx;
+ list_t *list;
+ avl_tree_t *t;
+@@ -1431,7 +1432,7 @@ zil_clean(zilog_t *zilog, uint64_t synced_txg)
+ * created a bad performance problem.
+ */
+ if (taskq_dispatch(zilog->zl_clean_taskq,
+- (void (*)(void *))zil_itxg_clean, clean_me, TQ_NOSLEEP) == 0)
++ zil_itxg_clean, clean_me, TQ_NOSLEEP) == 0)
+ zil_itxg_clean(clean_me);
+ }
+
+diff --git a/module/zfs/zio.c b/module/zfs/zio.c
+index 2bc88c5..df44e39 100644
+--- a/module/zfs/zio.c
++++ b/module/zfs/zio.c
+@@ -1345,7 +1345,7 @@ zio_taskq_dispatch(zio_t *zio, zio_taskq_type_t q, boolean_t cutinline)
+ * to dispatch the zio to another taskq at the same time.
+ */
+ ASSERT(taskq_empty_ent(&zio->io_tqent));
+- spa_taskq_dispatch_ent(spa, t, q, (task_func_t *)zio_execute, zio,
++ spa_taskq_dispatch_ent(spa, t, q, zio_execute, zio,
+ flags, &zio->io_tqent);
+ }
+
+@@ -1406,8 +1406,9 @@ static zio_pipe_stage_t *zio_pipeline[];
+ * it is externally visible.
+ */
+ void
+-zio_execute(zio_t *zio)
++zio_execute(void *_zio)
+ {
++ zio_t *zio = _zio;
+ fstrans_cookie_t cookie;
+
+ cookie = spl_fstrans_mark();
+@@ -1560,8 +1561,9 @@ zio_nowait(zio_t *zio)
+ */
+
+ static void
+-zio_reexecute(zio_t *pio)
++zio_reexecute(void *_pio)
+ {
++ zio_t *pio = _pio;
+ zio_t *cio, *cio_next;
+ int c, w;
+
+@@ -3362,7 +3364,7 @@ zio_done(zio_t *zio)
+ ASSERT(taskq_empty_ent(&zio->io_tqent));
+ spa_taskq_dispatch_ent(zio->io_spa,
+ ZIO_TYPE_CLAIM, ZIO_TASKQ_ISSUE,
+- (task_func_t *)zio_reexecute, zio, 0,
++ zio_reexecute, zio, 0,
+ &zio->io_tqent);
+ }
+ return (ZIO_PIPELINE_STOP);
+diff --git a/module/zfs/zvol.c b/module/zfs/zvol.c
+index 0bb68f9..9f4b11a 100644
+--- a/module/zfs/zvol.c
++++ b/module/zfs/zvol.c
+@@ -483,8 +483,10 @@ out:
+ * after a system failure
+ */
+ static int
+-zvol_replay_write(zvol_state_t *zv, lr_write_t *lr, boolean_t byteswap)
++zvol_replay_write(void *_zv, char *_lr, boolean_t byteswap)
+ {
++ zvol_state_t *zv = _zv;
++ lr_write_t *lr = (lr_write_t *)_lr;
+ objset_t *os = zv->zv_objset;
+ char *data = (char *)(lr + 1); /* data follows lr_write_t */
+ uint64_t off = lr->lr_offset;
+@@ -509,7 +511,7 @@ zvol_replay_write(zvol_state_t *zv, lr_write_t *lr, boolean_t byteswap)
+ }
+
+ static int
+-zvol_replay_err(zvol_state_t *zv, lr_t *lr, boolean_t byteswap)
++zvol_replay_err(void *zv, char *lr, boolean_t byteswap)
+ {
+ return (SET_ERROR(ENOTSUP));
+ }
+@@ -519,19 +521,19 @@ zvol_replay_err(zvol_state_t *zv, lr_t *lr, boolean_t byteswap)
+ * Only TX_WRITE is needed for zvol.
+ */
+ zil_replay_func_t zvol_replay_vector[TX_MAX_TYPE] = {
+- (zil_replay_func_t)zvol_replay_err, /* no such transaction type */
+- (zil_replay_func_t)zvol_replay_err, /* TX_CREATE */
+- (zil_replay_func_t)zvol_replay_err, /* TX_MKDIR */
+- (zil_replay_func_t)zvol_replay_err, /* TX_MKXATTR */
+- (zil_replay_func_t)zvol_replay_err, /* TX_SYMLINK */
+- (zil_replay_func_t)zvol_replay_err, /* TX_REMOVE */
+- (zil_replay_func_t)zvol_replay_err, /* TX_RMDIR */
+- (zil_replay_func_t)zvol_replay_err, /* TX_LINK */
+- (zil_replay_func_t)zvol_replay_err, /* TX_RENAME */
+- (zil_replay_func_t)zvol_replay_write, /* TX_WRITE */
+- (zil_replay_func_t)zvol_replay_err, /* TX_TRUNCATE */
+- (zil_replay_func_t)zvol_replay_err, /* TX_SETATTR */
+- (zil_replay_func_t)zvol_replay_err, /* TX_ACL */
++ zvol_replay_err, /* no such transaction type */
++ zvol_replay_err, /* TX_CREATE */
++ zvol_replay_err, /* TX_MKDIR */
++ zvol_replay_err, /* TX_MKXATTR */
++ zvol_replay_err, /* TX_SYMLINK */
++ zvol_replay_err, /* TX_REMOVE */
++ zvol_replay_err, /* TX_RMDIR */
++ zvol_replay_err, /* TX_LINK */
++ zvol_replay_err, /* TX_RENAME */
++ zvol_replay_write, /* TX_WRITE */
++ zvol_replay_err, /* TX_TRUNCATE */
++ zvol_replay_err, /* TX_SETATTR */
++ zvol_replay_err, /* TX_ACL */
+ };
+
+ /*