mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
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 <spender@grsecurity.net> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Kevin Tanguy <kevin.tanguy@ovh.net> Closes #595
This commit is contained in:
committed by
Brian Behlendorf
parent
120faefed9
commit
0194e4a03c
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user