401 Star 1.4K Fork 1.3K

GVPopenEuler / kernel

 / 详情

【OLK-5.10】sudo出现kmemleak告警

已完成
任务
创建于  
2023-07-15 19:54

【严重程度】 一般
【特性】 驱动/tty核心框架
【重现类型】 有条件概率重现
【定位分析】

The pid memleak is triggered by the following race:
task[sshd]                      task[bash]
-----------------------		-----------------------
  				            do_exit();
  				            disassociate_ctty();
  				            spin_lock_irq(¤t->sighand->siglock);
  				            put_pid(current->signal->tty_old_pgrp);
  				            current->signal->tty_old_pgrp = NULL;
  				            tty = tty_kref_get(current->signal->tty);
  				            //tty is not NULL
  				            spin_unlock_irq(¤t->sighand->siglock);
tty_vhangup();
tty_lock(tty);
...
tty_signal_session_leader();
spin_lock_irq(&p->sighand->siglock);
...
p->signal->tty_old_pgrp = get_pid(tty->pgrp); // tty_old_pgrp reassign
spin_unlock_irq(&p->sighand->siglock);
...
tty_unlock(tty);
  				            if (tty) {
  				                tty_lock(tty);
  				                ...
  				                put_pid(tty->pgrp);
  				                tty->pgrp = NULL;// It's too late
  				                ...
  				                tty_unlock(tty);
  				            }

in task[bash], tty_old_pgrp is released by disassociate_ctty(), then it's
reassigned by tty_signal_session_leader() in task[sshd], cause memleak.

评论 (1)

hulk-robot 创建了任务

Hi zhixiuzhou, 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.

openeuler-ci-bot 添加了
 
sig/Kernel
标签
yi yang 修改了描述
ci-robot 通过openeuler/kernel Pull Request !1672任务状态待办的 修改为已完成

登录 后才可以发表评论

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

搜索帮助