🇰🇷 한글 설명
Linux 커널의 arm64 아키텍처에서 BPF JIT 버퍼의 정렬 방식 문제로 인해 발생하는 취약점입니다. JIT 버퍼가 8바이트 단위로 정렬되지 않아 64비트 데이터 업데이트 시 원자성이 보장되지 않는 'Atomic Tearing' 현상이 발생할 수 있습니다. 이로 인해 잘못된 메모리 주소로 점프하여 시스템 불안정이나 보안 위협을 초래할 수 있습니다.
💡 쉬운 설명
컴퓨터가 데이터를 읽고 쓰는 과정에서 데이터의 시작 위치가 어긋나 데이터가 깨지는 현상이 발생할 수 있습니다. 이로 인해 프로그램이 엉뚱한 곳을 실행하게 되어 시스템이 멈추거나 해킹의 위험이 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
bpf, arm64: Force 8-byte alignment for JIT buffer to prevent atomic tearing
struct bpf_plt contains a u64 target field. Currently, the BPF JIT
allocator requests an alignment of 4 bytes (sizeof(u32)) for the JIT
buffer.
Because the base address of the JIT buffer can be 4-byte aligned (e.g.,
ending in 0x4 or 0xc), the relative padding logic in build_plt() fails
to ensure that target lands on an 8-byte boundary.
This leads to two issues:
1. UBSAN reports misaligned-access warnings when dereferencing the
structure.
2. More critically, target is updated concurrently via WRITE_ONCE() in
bpf_arch_text_poke() while the JIT'd code executes ldr. On arm64,
64-bit loads/stores are only guaranteed to be single-copy atomic if
they are 64-bit aligned. A misaligned target risks a torn read,
causing the JIT to jump to a corrupted address.
Fix this by increasing the allocation alignment requirement to 8 bytes
(sizeof(u64)) in bpf_jit_binary_pack_alloc(). This anchors the base of
the JIT buffer to an 8-byte boundary, allowing the relative padding math
in build_plt() to correctly align the target field.
📍 영향받는 시스템
Linux kernel (arm64 architecture) using BPF JIT
⚔️ 공격 벡터
동시성 제어 미흡을 이용한 Race Condition을 통한 JIT 코드 실행 흐름 조작
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 bpf_jit_binary_pack_alloc()의 정렬 요구사항을 8바이트로 수정해야 합니다.
🔧 검증 코드
커널 버전을 확인하고 dmesg 로그에서 정렬 관련 경고(misaligned-access)가 발생하는지 확인합니다.
uname -a && dmesg | grep -i 'bpf' | grep -i 'alignment'