Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

orangefs: add usercopy whitelist to orangefs_op_cache

orangefs_op_cache is created with kmem_cache_create(), which provides
no usercopy whitelist. orangefs_devreq_read() copies the tag and upcall
fields directly from slab objects to userspace via copy_to_user(). With
CONFIG_HARDENED_USERCOPY enabled, this triggers usercopy_abort().

Switch to kmem_cache_create_usercopy() with a whitelist covering the
tag and upcall fields, matching the pattern already used by
orangefs_inode_cache in super.c.

Signed-off-by: Ziyi Guo <n7l8m4@u.northwestern.edu>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>

authored by

Ziyi Guo and committed by
Mike Marshall
f855f4ab dbd6a823

+5 -1
+5 -1
fs/orangefs/orangefs-cache.c
··· 19 19 20 20 int op_cache_initialize(void) 21 21 { 22 - op_cache = kmem_cache_create("orangefs_op_cache", 22 + op_cache = kmem_cache_create_usercopy("orangefs_op_cache", 23 23 sizeof(struct orangefs_kernel_op_s), 24 24 0, 25 25 0, 26 + offsetof(struct orangefs_kernel_op_s, tag), 27 + offsetof(struct orangefs_kernel_op_s, upcall) + 28 + sizeof(struct orangefs_upcall_s) - 29 + offsetof(struct orangefs_kernel_op_s, tag), 26 30 NULL); 27 31 28 32 if (!op_cache) {