🇰🇷 한글 설명
Linux 커널의 트레이싱 kprobe 모듈에서, trace_get_event_file() 호출이 실패했을 때 오류 코드가 포인터 변수에 할당된 상태로 남아 모듈 제거(kprobe_event_gen_test_exit) 시 NULL 포인터 역참조가 발생하는 문제입니다. 해당 함수에서 포인터를 사용하기 전에 에러 코드 및 NULL 여부를 검사하도록 수정되었습니다.
💡 쉬운 설명
리눅스 커널 내부의 테스트 모듈을 제거할 때 잘못된 메모리 주소를 참조해 시스템이 비정상 종료(커널 패닉)될 수 있는 결함입니다. 이 문제는 주로 시스템 안정성에 영향을 줍니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
tracing: kprobe: Fix potential null-ptr-deref on trace_event_file in kprobe_event_gen_test_exit()
When trace_get_event_file() failed, gen_kretprobe_test will be assigned
as the error code. If module kprobe_event_gen_test is removed now, the
null pointer dereference will happen in kprobe_event_gen_test_exit().
Check if gen_kprobe_test or gen_kretprobe_test is error code or NULL
before dereference them.
BUG: kernel NULL pointer dereference, address: 0000000000000012
PGD 0 P4D 0
Oops: 0000 [#1] SMP PTI
CPU: 3 PID: 2210 Comm: modprobe Not tainted
6.1.0-rc1-00171-g2159299a3b74-dirty #217
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
rel-1.15.0-0-g2dd4b9b3f840-prebuilt.qemu.org 04/01/2014
RIP: 0010:kprobe_event_gen_test_exit+0x1c/0xb5 [kprobe_event_gen_test]
Code: Unable to access opcode bytes at 0xffffffff9ffffff2.
RSP: 0018:ffffc900015bfeb8 EFLAGS: 00010246
RAX: ffffffffffffffea RBX: ffffffffa0002080 RCX: 0000000000000000
RDX: ffffffffa0001054 RSI: ffffffffa0001064 RDI: ffffffffdfc6349c
RBP: ffffffffa0000000 R08: 0000000000000004 R09: 00000000001e95c0
R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000800
R13: ffffffffa0002420 R14: 0000000000000000 R15: 0000000000000000
FS: 00007f56b75be540(0000) GS:ffff88813bc00000(0000)
knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffff9ffffff2 CR3: 000000010874a006 CR4: 0000000000330ee0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
__x64_sys_delete_module+0x206/0x380
? lockdep_hardirqs_on_prepare+0xd8/0x190
? syscall_enter_from_user_mode+0x1c/0x50
do_syscall_64+0x3f/0x90
entry_SYSCALL_64_after_hwframe+0x63/0xcd
📍 영향받는 시스템
패치 이전의 Linux 커널 버전 중 kprobe 이벤트 생성 테스트 모듈(kprobe_event_gen_test)이 포함된 시스템
⚔️ 공격 벡터
일반 사용자가 원격으로 악용하기 어렵고, 권한이 있는 사용자가 해당 테스트 모듈을 로드 후 제거하는 과정에서 서비스 거부(커널 크래시)를 유발할 수 있습니다.
🛡️ 대응 방법
배포판 제공 최신 커널 업데이트를 적용하고 재부팅하거나, 커널 소스에서 해당 NULL 체크 패치를 적용하세요.
🔧 검증 코드
출력된 커널 버전이 패치가 포함된 배포판 업데이트 버전인지 배포사 보안 공지와 대조하고, 모듈이 로드되지 않았다면 해당 테스트 모듈 노출 위험은 낮습니다.
uname -r && (lsmod | grep -i kprobe_event_gen_test || echo 'kprobe_event_gen_test 모듈 미로드')