🇰🇷 한글 설명
Linux 커널의 dmaengine sf-pdma 드라이버에서 멀티스레드 환경 사용 시 데이터 경합(Data Race)이 발생하는 취약점입니다. 여러 스레드가 동시에 DMA 채널을 사용하려고 할 때 디스크립터가 잘못 참조되어 커널 NULL 포인터 역참조 및 시스템 중단(Oops)을 유발할 수 있습니다.
💡 쉬운 설명
여러 작업이 동시에 하나의 통로를 사용하려고 할 때, 통로의 정보가 엉키면서 컴퓨터 시스템이 멈추거나 오류가 발생하는 문제입니다. 마치 여러 사람이 동시에 하나의 서류를 고치려다 서류가 찢어지거나 잘못된 정보를 읽게 되는 것과 같습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
dmaengine: sf-pdma: Add multithread support for a DMA channel
When we get a DMA channel and try to use it in multiple threads it
will cause oops and hanging the system.
% echo 64 > /sys/module/dmatest/parameters/threads_per_chan
% echo 10000 > /sys/module/dmatest/parameters/iterations
% echo 1 > /sys/module/dmatest/parameters/run
[ 89.480664] Unable to handle kernel NULL pointer dereference at virtual
address 00000000000000a0
[ 89.488725] Oops [#1]
[ 89.494708] CPU: 2 PID: 1008 Comm: dma0chan0-copy0 Not tainted
5.17.0-rc5
[ 89.509385] epc : vchan_find_desc+0x32/0x46
[ 89.513553] ra : sf_pdma_tx_status+0xca/0xd6
This happens because of data race. Each thread rewrite channels's
descriptor as soon as device_prep_dma_memcpy() is called. It leads to the
situation when the driver thinks that it uses right descriptor that
actually is freed or substituted for other one.
With current fixes a descriptor changes its value only when it has
been used. A new descriptor is acquired from vc->desc_issued queue that
is already filled with descriptors that are ready to be sent. Threads
have no direct access to DMA channel descriptor. Now it is just possible
to queue a descriptor for further processing.
📍 영향받는 시스템
Linux kernel 5.17.0-rc5 및 sf-pdma 드라이버를 사용하는 시스템
⚔️ 공격 벡터
로컬 공격자가 멀티스레드 기반의 DMA 테스트 또는 특정 드라이버 호출을 통해 커널 오류 유발
🛡️ 대응 방법
커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 디스크립터 관리 로직을 수정해야 함
🔧 검증 코드
출력된 커널 버전이 취약점이 해결된 패치 버전 이후인지 확인합니다.