File tree 1 file changed +14
-2
lines changed
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -4628,8 +4628,20 @@ static int __init io_uring_init(void)
4628
4628
4629
4629
io_uring_optable_init ();
4630
4630
4631
- req_cachep = KMEM_CACHE (io_kiocb , SLAB_HWCACHE_ALIGN | SLAB_PANIC |
4632
- SLAB_ACCOUNT | SLAB_TYPESAFE_BY_RCU );
4631
+ /*
4632
+ * Allow user copy in the per-command field, which starts after the
4633
+ * file in io_kiocb and until the opcode field. The openat2 handling
4634
+ * requires copying in user memory into the io_kiocb object in that
4635
+ * range, and HARDENED_USERCOPY will complain if we haven't
4636
+ * correctly annotated this range.
4637
+ */
4638
+ req_cachep = kmem_cache_create_usercopy ("io_kiocb" ,
4639
+ sizeof (struct io_kiocb ), 0 ,
4640
+ SLAB_HWCACHE_ALIGN | SLAB_PANIC |
4641
+ SLAB_ACCOUNT | SLAB_TYPESAFE_BY_RCU ,
4642
+ offsetof(struct io_kiocb , cmd .data ),
4643
+ sizeof_field (struct io_kiocb , cmd .data ), NULL );
4644
+
4633
4645
return 0 ;
4634
4646
};
4635
4647
__initcall (io_uring_init );
You can’t perform that action at this time.
0 commit comments