🇰🇷 한글 설명
Linux 커널의 GPIO sysfs 인터페이스에서 부모 GPIO 컨트롤러를 언바인드할 때 내보낸 GPIO 속성이 /sys/class/gpio에 고아 상태로 남아있는 취약점. gpiod_unexport() 함수가 해제된 장치와 연관된 디스크립터를 찾지 못하여 최종 참조를 해제하지 못함.
💡 쉬운 설명
GPIO 장치를 소프트웨어로 제거할 때 관련 파일이 제대로 정리되지 않는 문제. 이로 인해 시스템 리소스가 낭비되고 예상치 못한 동작이 발생할 수 있음.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
gpio: sysfs: fix chip removal with GPIOs exported over sysfs
Currently if we export a GPIO over sysfs and unbind the parent GPIO
controller, the exported attribute will remain under /sys/class/gpio
because once we remove the parent device, we can no longer associate the
descriptor with it in gpiod_unexport() and never drop the final
reference.
Rework the teardown code: provide an unlocked variant of
gpiod_unexport() and remove all exported GPIOs with the sysfs_lock taken
before unregistering the parent device itself. This is done to prevent
any new exports happening before we unregister the device completely.
📍 영향받는 시스템
Linux 커널 (특히 GPIO sysfs 인터페이스가 활성화된 임베디드 시스템, IoT 장치, ARM 기반 보드)
⚔️ 공격 벡터
로컬 공격자가 GPIO를 sysfs를 통해 내보낸 후 부모 GPIO 컨트롤러를 언바인드하여 수행
🛡️ 대응 방법
Linux 커널을 최신 패치가 적용된 버전으로 업데이트 (gpiod_unexport() 잠금 메커니즘 및 teardown 코드 개선 적용)
🔧 검증 코드
커널 버전 확인 후 /sys/class/gpio의 파일 개수 확인. 언바인드 후 고아 GPIO 속성이 남아있으면 취약한 상태
cat /proc/version | grep -i 'linux version' && ls -la /sys/class/gpio/ 2>/dev/null | wc -l