Skip to content

Commit f855f4a

Browse files
haruki3hhhhubcapsc
authored andcommitted
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>
1 parent dbd6a82 commit f855f4a

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

fs/orangefs/orangefs-cache.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,14 @@ static struct kmem_cache *op_cache;
1919

2020
int op_cache_initialize(void)
2121
{
22-
op_cache = kmem_cache_create("orangefs_op_cache",
22+
op_cache = kmem_cache_create_usercopy("orangefs_op_cache",
2323
sizeof(struct orangefs_kernel_op_s),
2424
0,
2525
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),
2630
NULL);
2731

2832
if (!op_cache) {

0 commit comments

Comments
 (0)