KKloud TarusKKloud Tarus
  • Blog
  • Series
  • Team
  • About

Blog

Thoughts on engineering, design, and building great products.

SeriesAll postsBTFAPFAPIARPAWSAdmissionAffinityAggregationAnsibleAppArmorArchitectureAuthenticationAuthorizationAutomationAutoscaling
BTF và CO-RE: Một Lần Biên Dịch, Chạy Mọ...
LinuxeBPF

BTF và CO-RE: Một Lần Biên Dịch, Chạy Mọi Kernel

Cấu trúc dữ liệu bên trong nhân như task_struct có layout khác nhau giữa các phiên bản kernel — field nằm ở offset nào tùy bản. Vậy làm sao một chương trình eBPF biên dịch sẵn đọc đúng field trên mọi kernel? Câu trả lời là BTF và CO-RE. Bài cuối Part I sinh vmlinux.h từ BTF của nhân, viết một chương trình đọc ppid bằng cách lần qua task->real_parent->tgid, biên dịch một lần và chạy — libbpf tự tìm offset đúng theo BTF của kernel đang chạy. Đây cũng là nền cho Part III tự viết công cụ thật.

K
KaiMay 24, 2026
KKloud TarusKKloud Tarus

Explore. Build. Share.

  • Blog
  • Team
  • About
© 2026 KKloud Tarus. All rights reserved.