Open
iommufd: iommufd_fault_iopf_enable() returns with iopf_lock held when enabling SVA fails #10441
wt-liweiAdd on  7 hours ago
wt-liwei
wt-liwei
7 hours ago Create

环境信息

【OS版本】(如openEuler-22.03-LTS,参考命令"cat /etc/os-release"结果)
openEuler-24.03-SP4
【内核版本】(如kernel-5.10.0-60.138.0.165,参考命令"uname -r"结果)
OLK-6.6
【硬件平台】(缺陷相关的硬件信息,如:处理器型号、内存、磁盘、网卡、BIOS 等信息)

【组网信息】(和网络、性能相关的问题,应该说明详细的组网和场景信息)

缺陷信息

问题描述

drivers/iommu/iommufd/fault.c 中 iommufd_fault_iopf_enable() 在 IOMMU_DEV_FEAT_SVA 开启失败时直接 return ret;,没有释放 idev->iopf_lock,导致该 iopf_lock 永久持有。之后对同一设备的 iommufd_fault_iopf_enable()/iommufd_fault_iopf_disable() 会在 mutex_lock() 处永久阻塞。

影响(待验证)

代码路径上,后续对同一 idev 的 iommufd_fault_iopf_enable()/disable() 会阻塞在 mutex_lock()。实际现象(是否 hung task、是否 lockdep 告警)尚未确认。

相关问题

  1. IOPF 开启失败后仍继续执行 SVA 开启,覆盖了前一个 ret。
  2. SVA 开启失败时未回滚 IOPF,也未递减 idev->iopf_enabled,状态泄漏。
  3. iommufd_fault_iopf_disable() 中 SVA 的关闭位于引用计数判断之外,多次 enable 后提前关闭 SVA。

引入提交

  • 6b45626422f7 "iommufd: enable SVA when IOPF enabled"(OLK-6.6)

复现条件(待验证)

推断条件:IOMMU_DEV_FEAT_IOPF 开启成功,而 IOMMU_DEV_FEAT_SVA 开启失败(例如设备不支持 SVA)。尚未在实际设备上复现。

likedislike
openeuler-ci-botopeneuler-ci-botCollaborators
7 hours ago changed custom state from 已挂起 to 待办的
openeuler-ci-bot
openeuler-ci-botCollaborators
7 hours ago Comments:

@
issue变更为 [已取消/已挂起] 状态前,请操作者填写相关原因
请按如下格式评论原因后,重新进行操作


/reason xxxxxx

likedislike
openeuler-ci-botopeneuler-ci-botCollaborators
7 hours ago Assign allen-shi as responsible person
openeuler-ci-botopeneuler-ci-botCollaborators
7 hours ago Assign wkfxxx、zeng_zhaorong、sanglipeng、oekernel、hanjunguo、liwei818 as responsible person, remove original responsible person: allen-shi
openeuler-ci-botopeneuler-ci-botCollaborators
7 hours ago Modify description of issue
openeuler-ci-botopeneuler-ci-botCollaborators
7 hours ago Assign allen-shi as responsible person, remove original responsible person: wkfxxx、zeng_zhaorong、sanglipeng、oekernel、hanjunguo、liwei818
openeuler-ci-botopeneuler-ci-botCollaborators
7 hours ago Added label: sig/Kernel
openeuler-ci-bot
openeuler-ci-botCollaborators
7 hours ago Comments:

Welcome To openEuler Community

Hey @liwei818 , thanks for your contribution to the community.

Bot Usage Manual

I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands. You can self-configure the PR merge rules for this repository. For more details, please refer to Here.

Contact Guide

If you have any questions, please contact the SIG: Kernel ,
and any of the maintainers: @hanjunguo, @oekernel, @sanglipeng, @wkfxxx, @zeng_zhaorong ,
and any of the committers: @AlphaLan2025, @CTC-XiboWang, @Frank_Sae, @GoGo_phytium, @GongLei-, @LiuYongQiang0816, @SuperSix173, @Tankll2021, @TrueAI, @YiweiZ, @allen-shi, @alvin-ling, @baratta, @bibo_mao, @caixu-blue, @chen-jun-hw, @chenjiesong, @chenjunxin1992, @chenke2026, @chenxiaosonggitcode, @chiqijun, @chizl, @chriszjh, @duanqiangwen, @eaglew-forge, @eingesch, @fangfeng123, @fanghaiqinghw, @gang_he, @gaojuxin09, @gcw_EzAoulpf, @gouhao2022, @guohaocs2c, @guzitao, @hanjunguo, @hanliyang, @hellotcc, @henryze, @hewanhan, @hjx_gitff, @hongwu-wang, @howard_lu, @htforge, @hu-chunzhi, @hunan4222, @huzhitao, @hygmm, @jackknight, @jerry_lilijun, @jiayi0118, @junlong-zheng, @juntianlinux, @kailiu42, @kaitiandu, @kazero00, @kevinzhu1, @kile2009, @klmengkd, @koishimind, @kongzizaixian, @kunlun_spurs, @kylin-mayukun, @leap-io, @leap-zjke, @leoliu-oc, @li-huisong, @linan888, @linyuexie1, @linyunsheng, @liulongfang, @liyihang0226, @lostway1, @lujialin2, @mao-hongbo, @markyuan4ta21, @mawupeng, @mingqian218472, @mingrui-liu, @mufengyan, @nebulamatrix_rdma, @peterpangogogo, @pigalsofine, @qich, @raoxu-deepin, @raverstern, @robinorg, @rock_hw, @sageDriver, @sanglipeng, @shu-shengming, @shuaijiakun, @sinat_17738335, @siyanteng, @sming56_admin, @stavewu, @stkid, @sun_nanyong, @wangboe2022, @wanghang73, @wenzhiwei11, @whoisxxx, @wkfxxx, @woqidaideshi, @wsoydl, @xingmz1, @xukuohai, @yeweihua999, @ygn-ndwd-official, @yonghu_4dc5, @young-sun, @yubo-liu1, @yuehaibing_planb, @yushan_wang, @yuzenghui1, @zhang-changzhong, @zhangguodong11, @zhangyi089, @zhujianwei001, @zichengqu, @zouyipeng, @zqiao216 .

likedislike
openeuler-ci-bot
openeuler-ci-botCollaborators
7 hours ago Comments:

以下的要求不是强制性的, 未按模板评论时对issue无任何影响
issue处理注意事项:
1. 当前issue受影响的分支提交pr时, 须在pr描述中填写当前issue编号进行关联, 否则无法关闭当前issue;
2. 模板内容需要填写完整, 无论是受影响或者不受影响都需要填写完整内容,未引入的分支不需要填写, 否则无法关闭当前issue;
3. 以下为模板中需要填写完整的内容, 请复制到评论区回复, 注: 内容的标题名称(影响性分析说明, 缺陷严重等级, 受影响版本排查(受影响/不受影响), 修复是否涉及abi变化(是/否))不能省略,省略后defect-manager将无法正常解析填写内容.
评论区可能使用到的指令说明:

指令 指令说明 使用权限
/check-issue 触发defect-manager校验 不限
/reason xxx /reason +挂起或取消条件 不限

影响性分析说明:

缺陷严重等级:(Critical/High/Moderate/Low)

缺陷根因说明:

受影响版本排查(受影响/不受影响):

  1. openEuler-20.03-LTS-SP4:
  2. openEuler-22.03-LTS-SP4:
  3. openEuler-24.03-LTS-SP1:
  4. openEuler-24.03-LTS-SP3:
  5. openEuler-24.03-LTS-SP4:

abi变化(是/否):

  1. openEuler-20.03-LTS-SP4:
  2. openEuler-22.03-LTS-SP4:
  3. openEuler-24.03-LTS-SP1:
  4. openEuler-24.03-LTS-SP3:
  5. openEuler-24.03-LTS-SP4:

缺陷issue处理具体操作请参考:
https://atomgit.com/openeuler/cve-manager/blob/master/cve-vulner-manager/doc/md/defect-manager-manual.md
pr关联issue具体操作请参考:
https://docs.atomgit.com/docs/help/home/org_project/pullrequests/pr-related-issue

likedislike
openeuler-ci-botopeneuler-ci-botCollaborators
7 hours ago Added label: DEFECT/UNFIXED
wt-liweiwt-liwei
7 hours ago Modify description of issue
wt-liweiwt-liwei
7 hours ago Modify description of issue
wt-liweiwt-liwei
7 hours ago Modify description of issue
wt-liweiwt-liwei
7 hours ago Modify description of issue
wt-liweiwt-liwei
7 hours ago Modify description of issue
openeuler-infra-botopeneuler-infra-botCollaborators
4 hours ago Associated pull request
openeuler-infra-botopeneuler-infra-botCollaborators
4 hours ago Associated pull request
openeuler-infra-botopeneuler-infra-botCollaborators
1 hour ago Associated pull request
openeuler-infra-botopeneuler-infra-botCollaborators
32 minutes ago Associated pull request