public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] sched: fix user_mask double free
@ 2022-11-21 10:04 wangbiao3
  2022-11-21 10:04 ` [PATCH 1/1] " wangbiao3
  0 siblings, 1 reply; 10+ messages in thread
From: wangbiao3 @ 2022-11-21 10:04 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, vincent.guittot, brauner, bsegall
  Cc: linux-kernel, wangbiao3, wenjieli, chenguanyou

From: wangbiao3 <wangbiao3@xiaomi.com>

    Clone/Fork a new task,call dup_task_struct->arch_dup_task_struct(tsk,orig)
    which copy the data of parent/sibling task inclding p->user_cpus_ptr,so
    the user_cpus_ptr of newtask is the same with orig task's.When
    dup_task_struct call dup_user_cpus_ptr(tsk, orig, node),it return 0
    dircetly if src->user_cpus_ptris free by other task,in this case ,
    the newtask's address of user_cpus_ptr is not changed. Finally,
    wakup newtask to execute, call task_cpu_possible_mask-->
    do_set_cpus_allowed to set new task's user_cpus_ptr(user_mask) which
    call kfree user_mask at the end. So cause a slub double free panic.

    Use pi_lock to protect content of user_cpus_ptr in dup_user_cpus_ptr and
    clear dst->user_cpus_ptr when found src->user_cpus_ptr is null

    kernel BUG at mm/slub.c:363!
    Call trace:
     __slab_free+0x230/0x28c
     kfree+0x220/0x2cc
     do_set_cpus_allowed+0x74/0xa4
     select_fallback_rq+0x12c/0x200
     wake_up_new_task+0x26c/0x304
     kernel_clone+0x2c0/0x470
     __arm64_sys_clone+0x5c/0x8c
     invoke_syscall+0x60/0x150
     el0_svc_common.llvm.13030543509303927816+0x98/0x114
     do_el0_svc_compat+0x20/0x30
     el0_svc_compat+0x28/0x90
     el0t_32_sync_handler+0x7c/0xbc
     el0t_32_sync+0x1b8/0x1bc


wangbiao3 (1):
  sched: fix user_mask double free

 kernel/sched/core.c | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)

--
2.38.1

#/******±¾Óʼþ¼°Æä¸½¼þº¬ÓÐСÃ×¹«Ë¾µÄ±£ÃÜÐÅÏ¢£¬½öÏÞÓÚ·¢Ë͸øÉÏÃæµØÖ·ÖÐÁгöµÄ¸öÈË»òȺ×é¡£½ûÖ¹ÈÎºÎÆäËûÈËÒÔÈκÎÐÎʽʹÓ㨰üÀ¨µ«²»ÏÞÓÚÈ«²¿»ò²¿·ÖµØÐ¹Â¶¡¢¸´ÖÆ¡¢»òÉ¢·¢£©±¾ÓʼþÖеÄÐÅÏ¢¡£Èç¹ûÄú´íÊÕÁ˱¾Óʼþ£¬ÇëÄúÁ¢¼´µç»°»òÓʼþ֪ͨ·¢¼þÈ˲¢É¾³ý±¾Óʼþ£¡ This e-mail and its attachments contain confidential information from XIAOMI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!******/#

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-11-25  2:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-21 10:04 [PATCH 0/1] sched: fix user_mask double free wangbiao3
2022-11-21 10:04 ` [PATCH 1/1] " wangbiao3
2022-11-22 13:18   ` Quentin Perret
2022-11-22 14:05   ` Peter Zijlstra
2022-11-22 14:06     ` Peter Zijlstra
2022-11-22 15:39     ` Waiman Long
2022-11-22 18:13       ` Waiman Long
     [not found]         ` <1fe9abbdd12b41fc87c92b60550fc909@xiaomi.com>
     [not found]           ` <9a6b10cd-855d-ca15-01e9-2c95a8b692be@redhat.com>
     [not found]             ` <9cc51697705f472e99a620eee8569a32@xiaomi.com>
2022-11-24  3:59               ` 答复: [External Mail]Re: " Waiman Long
2022-11-24 12:04                 ` Wenjie Li (Evan)
2022-11-25  2:08                   ` Waiman Long

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox