)]}'
{
  "commit": "9d51c891b7191914952fa783ffd05acb96dafe2d",
  "tree": "b7f17027c5569ef9968a578f1bff09a94417368b",
  "parents": [
    "db4dfdce0b6cb4eaf56804c91ffa91bea1cf16ac"
  ],
  "author": {
    "name": "4ast",
    "email": "alexei.starovoitov@gmail.com",
    "time": "Thu Apr 16 14:12:31 2026 -0700"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Thu Apr 16 14:12:31 2026 -0700"
  },
  "message": "[BPF] Add exception handling support with .bpf_cleanup section (#192164)\n\nAdd support for invoke/landingpad/resume instructions in the BPF backend\nso that Rust programs compiled with panic\u003dunwind can run cleanup code\n(Drop implementations) when bpf_throw fires.\n\nChanges:\n\n1. BPFISelLowering: Define exception pointer and selector registers\n(both R0) so SelectionDAG can lower landingpad instructions.\n\n2. BPFAsmPrinter::emitFunctionBodyEnd: Emit a .bpf_cleanup section with\na flat table of (begin, end, landing_pad) triples using\nR_BPF_64_NODYLD32 relocations.\n\nThe .bpf_cleanup section layout (12 bytes per entry):\n\n  u32 begin         // start of the invoke region\n  u32 end           // end of the invoke region\n  u32 landing_pad   // address of the cleanup block\n\nThe invoke region [begin, end) includes argument setup instructions\nbefore the call. The runtime checks begin \u003c\u003d PC \u003c end to find the\nmatching landing pad.\n\nLanding pad blocks survive optimization because invoke maintains CFG\nedges to them throughout codegen, same as every other backend. The\nstandard .gcc_except_table and .eh_frame are also emitted by the\nexisting DwarfCFIException handler; libbpf will ignore them.\n\nIn runtime:\n- bpf_throw() is called (from panic handler)\n- Kernel walks the BPF call stack with arch_bpf_stack_walk()\n- For each frame, look up current PC in .bpf_cleanup table\n- If match found: redirect execution to the cleanup function . cleanup\nfunction runs Drop impls (bpf_free, rcu_read_unlock, etc.) . calls\n_Unwind_Resume() which is patched to just \u0027ret\u0027 by the verifier .\nbpf_throw() pops frame goes to next\n- If no match: go to next frame\n\nSigned-off-by: Alexei Starovoitov \u003cast@kernel.org\u003e\nCo-authored-by: Alexei Starovoitov \u003cast@kernel.org\u003e",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "abe081c0c76fd973ed85829f1b418fb6f68178b3",
      "old_mode": 33188,
      "old_path": "llvm/lib/Target/BPF/BPFAsmPrinter.cpp",
      "new_id": "2d87ec3510e28676c0f79be786c2ae5c10944b11",
      "new_mode": 33188,
      "new_path": "llvm/lib/Target/BPF/BPFAsmPrinter.cpp"
    },
    {
      "type": "modify",
      "old_id": "75a1d7ed9f8842d6260e825c0ba336b701f1a4c1",
      "old_mode": 33188,
      "old_path": "llvm/lib/Target/BPF/BPFAsmPrinter.h",
      "new_id": "d1db65d878463be1dd3b1fe30007ccadbba310f1",
      "new_mode": 33188,
      "new_path": "llvm/lib/Target/BPF/BPFAsmPrinter.h"
    },
    {
      "type": "modify",
      "old_id": "f412e0b31c446a39d907045a6dcb31a594d52ccc",
      "old_mode": 33188,
      "old_path": "llvm/lib/Target/BPF/BPFISelLowering.h",
      "new_id": "b16fce0dd418f172171c793faf2e0f7a613efbd5",
      "new_mode": 33188,
      "new_path": "llvm/lib/Target/BPF/BPFISelLowering.h"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "81973a0ae3a48c363457934a2462ac3e05475a64",
      "new_mode": 33188,
      "new_path": "llvm/test/CodeGen/BPF/cleanup-reject-typed-catch.ll"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "bf215461ddb3d5c3ea71668ff3a038ba607d762d",
      "new_mode": 33188,
      "new_path": "llvm/test/CodeGen/BPF/cleanup-section.ll"
    }
  ]
}
