🇰🇷 한글 설명
Linux 커널의 bcm2835 SPI 드라이버에서 4개 이상의 슬레이브를 사용할 때 발생하는 경계 외 메모리 접근(Out-of-bounds access) 취약점입니다. GPIO를 이용한 칩 선택 방식을 사용할 경우, 정적으로 할당된 배열의 크기를 초과하여 메모리에 접근할 수 있습니다.
💡 쉬운 설명
컴퓨터 부품을 연결하는 통로에서 정해진 칸보다 더 많은 부품을 연결하려고 할 때, 허용되지 않은 메모리 영역을 건드려 시스템 오류를 일으킬 수 있는 문제입니다. 이는 장치 설정 과정에서 발생할 수 있는 보안 결함입니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
spi: bcm2835: Fix out-of-bounds access with more than 4 slaves
Commit 571e31fa60b3 ("spi: bcm2835: Cache CS register value for
->prepare_message()") limited the number of slaves to 3 at compile-time.
The limitation was necessitated by a statically-sized array prepare_cs[]
in the driver private data which contains a per-slave register value.
The commit sought to enforce the limitation at run-time by setting the
controller's num_chipselect to 3: Slaves with a higher chipselect are
rejected by spi_add_device().
However the commit neglected that num_chipselect only limits the number
of *native* chipselects. If GPIO chipselects are specified in the
device tree for more than 3 slaves, num_chipselect is silently raised by
of_spi_get_gpio_numbers() and the result are out-of-bounds accesses to
the statically-sized array prepare_cs[].
As a bandaid fix which is backportable to stable, raise the number of
allowed slaves to 24 (which "ought to be enough for anybody"), enforce
the limitation on slave ->setup and revert num_chipselect to 3 (which is
the number of native chipselects supported by the controller).
An upcoming for-next commit will allow an arbitrary number of slaves.
📍 영향받는 시스템
Linux kernel (bcm2835 SPI driver 사용 시스템)
⚔️ 공격 벡터
장치 트리(Device Tree) 설정을 통해 4개 이상의 SPI 슬레이브(GPIO 칩 선택 방식)를 구성하여 메모리 경계 외 접근 유도
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 SPI 슬레이브 제한 및 배열 크기 수정 사항 반영
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전(Commit 571e31fa60b6 이후)인지 확인