426 Star 1.5K Fork 1.6K

GVPopenEuler/kernel

 / 详情

【OLK-5.10】【openEuler-22.03-LTS】同步 5.10 测试问题:KCSAN: data-race in __seccomp_filter / copy_process

已完成
任务
创建于  
2022-08-10 13:36

公司内部对 5.10 的 syzkaller KCSAN 测试发现如下问题:

==================================================================
BUG: KCSAN: data-race in __seccomp_filter / copy_process

read-write to 0xffff9e20d0a3b308 of 4 bytes by task 25128 on cpu 3:
 copy_process+0x18ce/0x1db0 kernel/fork.c:2320
 kernel_clone+0x155/0x600 kernel/fork.c:2495
 __do_sys_clone kernel/fork.c:2612 [inline]
 __se_sys_clone kernel/fork.c:2596 [inline]
 __x64_sys_clone+0xc8/0xf0 kernel/fork.c:2596
 do_syscall_64+0x37/0x50 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

read to 0xffff9e20d0a3b308 of 4 bytes by task 25131 on cpu 0:
 get_nr_threads include/linux/sched/signal.h:655 [inline]
 __seccomp_filter+0xc9b/0xdc0 kernel/seccomp.c:1263
 __secure_computing+0x8f/0x140 kernel/seccomp.c:1311
 syscall_trace_enter kernel/entry/common.c:58 [inline]
 __syscall_enter_from_user_work kernel/entry/common.c:81 [inline]
 syscall_enter_from_user_mode+0xd6/0x1b0 kernel/entry/common.c:99
 do_syscall_64+0x11/0x50 arch/x86/entry/common.c:41
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 25131 Comm: syz-executor.3 Not tainted 5.10.0+ #6
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
==================================================================

评论 (3)

Raverstern 创建了任务 3年前

Hi raverstern, welcome to the openEuler Community.
I'm the Bot here serving you. You can find the instructions on how to interact with me at Here.
If you have any questions, please contact the SIG: Kernel, and any of the maintainers: @yangyingliang , @gatieme , @jiaoff , @zhengzengkai , @LiuYongQiang0816 , @wangxiongfeng , @kevinzhu1 , @jentlestea , @lujialin2 , @wuxu_buque , @xukuohai , @lengchao , @alvin-ling , @yuzenghui , @yuehaibing , @juntianlinux , @chenguangli , @gasonchen , @whoisxxx , @koulihong , @kailiu42 , @hanjun-guo , @woqidaideshi , @chiqijun , @wkfxxx , @thundertown , @guohaocs2c , @kylin-mayukun , @oskernel0719 , @liuxinux , @newbeats , @zhujianwei001 , @zhenpengzheng , @SuperSix173 , @colyli , @zhangyi089 , @htforge , @xiexiuqi

openeuler-ci-bot 添加了
 
sig/Kernel
标签
3年前
Raverstern 修改了描述 3年前

问题分析

经检查,数据竞争发生在 current->signal->nr_threads 变量上:

  • 写端:copy_process() 中的 current->signal->nr_threads++
  • 读端:__seccomp_filter() 中的 get_nr_threads(current)

经确认,同一进程下的不同线程会共享 current->signal 结构体。数据竞争可能出现的场景为:存在同进程下两个线程 Ta、Tb,Ta 正在创建创建新线程;而 Tb 正处于系统调用执行过程中,且在使用 seccomp 对当前系统调用进行过滤。

问题处理

我们注意到内核主线已有相关补丁:d21918e5a94a ("signal/seccomp: Dump core when there is only one live thread")。根据补丁所属补丁集的描述,该补丁集是为了处理一系列与内核任务退出相关的数据竞争问题。补丁集主旨与当前问题相符。因此决定回合该补丁至 hulk-5.10。

登录 后才可以发表评论

状态
负责人
项目
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
预计工期 (小时)
开始日期   -   截止日期
-
置顶选项
优先级
分支
参与者(2)
5329419 openeuler ci bot 1632792936 Raverstern-raverstern
C
1
https://gitee.com/openeuler/kernel.git
git@gitee.com:openeuler/kernel.git
openeuler
kernel
kernel

搜索帮助