Cyber Risks · Trail of Bits Blog

Finding bugs in C code with Multi-Level IR and VAST

Summary: Trail of Bits developed a tool called VAST that uses MLIR to build a "tower of IRs," letting a program analysis start at whichever abstraction level best fits the task and move up or down as needed. The post walks through a checker for a variant of the Sequoia bug in the Linux kernel, where function seq_buf_path passes an unsigned size_t size into a signed int buflen argument that then sizes a struct prepend_buffer declared via the DECLARE_BUFFER macro.

Key Takeaway: The Sequoia bug variant only becomes visible by connecting an unsigned-to-signed cast at the call site to pointer arithmetic inside the callee, a link that single-IR tools cannot make. If your bug-finding stack is pinned to one representation, bugs that span abstraction levels stay out of view.

Read the original at Trail of Bits Blog ↗

Topics
Vulnerabilities & Patching
Related