Skip to content
GitLab
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
    Projects Groups Topics Snippets
  • Register
  • Sign in
  • QEMU QEMU
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 795
    • Issues 795
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Terraform modules
    • Model experiments
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Insights
    • Issue
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • QEMUQEMU
  • QEMUQEMU
  • Issues
  • #1282
Closed
Open
Issue created Oct 28, 2022 by Siqi Chen@coc.cyqh

sdhci: DMA reentrancy issue leads to an infinite loop

Description of problem

When sdhci transfers multiple blocks, it doesnot check if the dma-write buffer pointer overlaps with its MMIO region, crafted content can cause DoS because of infinite loop and CPU consumption.

Reproducer

cat << EOF | ./qemu-system-x86_64 -machine accel=qtest -nodefaults \
-drive if=none,index=0,file=null-co://,format=raw,id=mydrive \
-device sdhci-pci -device sd-card,drive=mydrive \
-nographic -qtest stdio 
outl 0xcf8 0x80001004         
outl 0xcfc 0x107               
outl 0xcf8 0x80001010         
outl 0xcfc 0xfebf1000         
writel 0xfebf102c 0x1000007
writel 0xfebf1004 0x10200
writel 0xfebf1008 0
writel 0xfebf100c 0xc000000
writel 0xfebf100c 0x18000022
writel 0xfebf1000 0x2fffffff
writel 0xfebf1004 0x20008
writel 0xfebf100c 0x11000032
writel 0xfebf1000 0xfebf100c
EOF

Crash Detail

The QEMU process and guest os are not responding and unable to process any requests and no response. The CPU usage reaches 100%, and I can only use kill -9 [qemu-system-x86_64 pid] from host to kill it.

Analysis

In sdhci_sdma_transfer_multi_blocks function, use dma_memory_write to reentry and make s- > trnmod & SDHC_TRNS_BLK_CNT_EN = false. Then , the QEMU process gets stuck in an infinite loop.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking