diff options
author | Kevin Tanguy <[email protected]> | 2017-01-17 21:05:14 +0100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-01-17 12:05:14 -0800 |
commit | 0194e4a03c394f0bb85cba78ac12f10c480c5670 (patch) | |
tree | 4b509fbbf9de775820f4b338ae4ebafbaed38888 /module | |
parent | 120faefed90aa4c276a3db45525dc5c804cb1a00 (diff) |
Add support for recent kmem_cache_create_usercopy
SLAB_USERCOPY flag was used to indicate PAX
not to kill copies from kernel to userland.
With recent grsecurity patchset and
CONFIG_GRKERNSEC_HIDESYM that enables
CONFIG_PAX_USERCOPY zfs would panic.
Handle newer API while keeping old one functional.
Tested-by: RageLtMan <rageltman@sempervictus>
Reviewed-by: spendergrsec <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Kevin Tanguy <[email protected]>
Closes #595
Diffstat (limited to 'module')
-rw-r--r-- | module/spl/spl-kmem-cache.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/module/spl/spl-kmem-cache.c b/module/spl/spl-kmem-cache.c index 99967b14f..45576b976 100644 --- a/module/spl/spl-kmem-cache.c +++ b/module/spl/spl-kmem-cache.c @@ -1001,8 +1001,17 @@ spl_kmem_cache_create(char *name, size_t size, size_t align, slabflags |= SLAB_USERCOPY; #endif - skc->skc_linux_cache = kmem_cache_create( - skc->skc_name, size, align, slabflags, NULL); +#if defined(HAVE_KMEM_CACHE_CREATE_USERCOPY) + /* + * Newer grsec patchset uses kmem_cache_create_usercopy() + * instead of SLAB_USERCOPY flag + */ + skc->skc_linux_cache = kmem_cache_create_usercopy( + skc->skc_name, size, align, slabflags, 0, size, NULL); +#else + skc->skc_linux_cache = kmem_cache_create( + skc->skc_name, size, align, slabflags, NULL); +#endif if (skc->skc_linux_cache == NULL) { rc = ENOMEM; goto out; |