[Devel] [PATCH RHEL8 COMMIT] ve, coredump: Fix usercopy warning.

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jul 24 19:28:10 MSK 2020


The commit is pushed to "branch-rh8-4.18.0-193.6.3.vz8.4.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-193.6.3.vz8.4.4
------>
commit 7746ee324da0b31171c3aa206177f031b58ecc0b
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date:   Fri Jul 24 19:28:09 2020 +0300

    ve, coredump: Fix usercopy warning.
    
    Usercopy WARNs about copying ve.core_pattern to user space:
    
    vzctl exec e2783e5e-840e-4c9a-9ef2-7ead73afb81c cat /proc/sys/kernel/core_pattern
     Call Trace:
      __check_object_size+0x134/0x160
      proc_dostring+0x164/0x200
      proc_dostring_coredump_virtual+0xb2/0xd0
      proc_dostring+0x200/0x200
      proc_sys_call_handler+0xa7/0xf0
      vfs_read+0x9d/0x150
      ksys_read+0x4f/0xb0
      do_syscall_64+0x5b/0x1c0
      entry_SYSCALL_64_after_hwframe+0x65/0xca
    
    Whitelist core_pattern in ve_struct kmem_cache since copying core_pattern
    is allowed by design.
    
    Fixes: e931118f8139 ("ve: Add ve cgroup and ve_hook subsys")
    https://jira.sw.ru/browse/PSBM-106216
    
    Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 kernel/ve/ve.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index befc5163cfe6..1688407562d4 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -1016,7 +1016,7 @@ EXPORT_SYMBOL_GPL(ve_cgrp_subsys);
 
 static int __init ve_subsys_init(void)
 {
-	ve_cachep = KMEM_CACHE(ve_struct, SLAB_PANIC);
+	ve_cachep = KMEM_CACHE_USERCOPY(ve_struct, SLAB_PANIC, core_pattern);
 	list_add(&ve0.ve_list, &ve_list_head);
 	return 0;
 }


More information about the Devel mailing list