)]}'
{
  "commit": "4cc0f9832ba76d734091636ce815239edde4911b",
  "tree": "01707857f9e4c10c34e3adb6f81be29b75be9338",
  "parents": [
    "32208b788023d8edeecd6bc91261880c6a08590f"
  ],
  "author": {
    "name": "Guanghui Feng",
    "email": "guanghuifeng@linux.alibaba.com",
    "time": "Thu Jul 16 22:16:22 2026 +0800"
  },
  "committer": {
    "name": "Kevin Liu",
    "email": "zhihuil@google.com",
    "time": "Thu Aug 20 21:15:56 2026 -0700"
  },
  "message": "iommu/amd: Wait for completion instead of returning early in iommu_completion_wait()\n\n[ Upstream commit 1e75a8255f11c81fb07e81e5029cfd75804350a0 ]\n\nneed_sync is a per-IOMMU flag shared by all domains and devices behind\nthat IOMMU. It is set whenever a command is queued with sync \u003d\u003d true and\ncleared when a completion-wait (CWAIT) command is queued. However, a\ncleared need_sync only means that a covering CWAIT has been queued, not\nthat all previously queued commands have actually completed in hardware.\n\niommu_completion_wait() read need_sync locklessly and returned early\nwhen it was false. This breaks the \"block until all previously queued\ncommands have completed\" contract in a multi-CPU scenario:\n\n  CPU2: queue inv-B                  \u003d\u003e need_sync \u003d true\n  CPU1: queue CWAIT(N); need_sync \u003d false; then wait_on_sem(N)\n  CPU2: read need_sync \u003d\u003d false      \u003d\u003e return 0 (no wait!)\n\nCPU2 returns without waiting for any sequence number even though its\ninv-B may not have completed yet (CWAIT(N), queued after inv-B, has not\nbeen signaled). CPU2 then proceeds to, for example, free page-table\npages while the IOMMU can still walk stale translations, opening a\nuse-after-free window. This is a logical race in the meaning of the\nflag, not a memory-visibility issue, so barriers alone do not help.\n\nFix it without losing the optimization of avoiding redundant CWAIT\ncommands: take iommu-\u003elock before testing need_sync, and when it is\nfalse do not return early but wait for the last allocated sequence\nnumber (cmd_sem_val). Since need_sync \u003d\u003d false implies no sync command\nwas queued after the last CWAIT, that CWAIT is FIFO-ordered after every\nnot-yet-completed command, so waiting for its sequence number guarantees\nall prior commands (possibly queued by another CPU) have completed. The\ncommon path with pending work is unchanged and no extra hardware command\nis issued.\n\nBUG\u003db/545105477\nTEST\u003dpresubmit\nRELEASE_NOTE\u003dFixed CVE-2026-68329 in the Linux kernel.\n\ncos-patch: security-moderate\nChange-Id: I9f4dec44d5b222f16c06069e4331253be5bf7c81\nSigned-off-by: Guanghui Feng \u003cguanghuifeng@linux.alibaba.com\u003e\nFixes: 815b33fdc279 (\"x86/amd-iommu: Cleanup completion-wait handling\")\nReviewed-by: Vasant Hegde \u003cvasant.hegde@amd.com\u003e\nSigned-off-by: Will Deacon \u003cwill@kernel.org\u003e\nSigned-off-by: Sasha Levin \u003csashal@kernel.org\u003e\nSigned-off-by: Kernel CVE Triage Automation \u003ccloud-image-kernel-cve-triage-automation@prod.google.com\u003e\nReviewed-on: https://cos-review.googlesource.com/c/third_party/kernel/+/183795\nReviewed-by: Kevin Liu \u003czhihuil@google.com\u003e\nReviewed-by: Derek Taylor \u003cddtaylor@google.com\u003e\nTested-by: Cusky Presubmit Bot \u003cpresubmit@cos-infra-prod.iam.gserviceaccount.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "48cf9e9e15976c6569d3458c34a424011c5b3678",
      "old_mode": 33188,
      "old_path": "drivers/iommu/amd/iommu.c",
      "new_id": "29ae44513cf688a07557ec4551db68a9e657e59a",
      "new_mode": 33188,
      "new_path": "drivers/iommu/amd/iommu.c"
    }
  ]
}
