DangKiller: Eliminating Dangling Pointers Efficiently via Implicit Identifier

Daliang Xu, Dongwei Chen, Chun Yang, Kang Sun, Xu Cheng, Dong TongarXiv 2020

Abstract

Use-After-Free (UAF) vulnerabilities remain a critical threat to C/C++ software security. While existing solutions offer detection or elimination, they often impose prohibitive performance overheads due to complex pointer tracking. This paper presents DangKiller, a high-performance system that ensures temporal memory safety with minimal slowdown. By leveraging a novel "MinFat Pointer" design to encode object metadata directly into pointer bits and utilizing ARM64 hardware features like Top Byte Ignore (TBI), DangKiller eliminates the need for expensive metadata lookups. Evaluation on SPEC benchmarks shows a geometric mean runtime overhead as low as 3%, significantly outperforming prior state-of-the-art techniques while successfully neutralizing all tested UAF vulnerabilities.

Introduction

Use-After-Free (UAF) vulnerabilities occur when a program continues to use a "dangling pointer" that refers to memory that has already been deallocated. These are among the most dangerous and common security flaws, often exploited for remote code execution. Existing solutions generally fall into two camps: detection (which crashes the program when a bug is found) and elimination (which prevents the bug from causing harm, often via garbage collection).

However, most current elimination techniques suffer from significant performance costs. They often require scanning the entire memory space ("sweeping") to find dangling pointers or maintaining complex "pointer graphs" that track which pointers point to which objects. The metadata lookups required for these graphs are typically the primary bottleneck in achieving efficient temporal safety.

Methodology

DangKiller optimizes pointer tracking through several innovative components designed to minimize the "search and maintain" overhead associated with metadata.

MinFat Pointers & Implicit IDs

The core innovation of DangKiller is the "MinFat Pointer." Instead of looking up an object's ID in a separate table—a process that typically involves expensive memory accesses—DangKiller encodes the object's size (as a logarithm) into the unused high bits of the pointer itself. This allows the system to instantly calculate the object’s base address, referred to as the "Implicit ID," using simple arithmetic.

The MinFat Pointer design encodes metadata directly into the pointer bits to enable fast ID calculation.

Hardware-Software Synergy

To avoid the performance penalty of manually "masking" these metadata bits before every memory access, DangKiller utilizes the ARMv8 Top Byte Ignore (TBI) feature. This hardware capability allows the CPU to ignore the top 8 bits of a pointer during memory operations. By aligning software metadata needs with architectural features, DangKiller achieves rich security metadata with near-zero access cost.

Log Cache & Compression

To further reduce overhead, DangKiller implements a software Log Cache (using an XOR of the ID and location) to filter out redundant pointer store updates. Log Compression is also employed to optimize cases where multiple pointers in a contiguous block, such as an array, point to the same object.

Delayed Free Mechanism

DangKiller replaces standard free() calls with a delayed mechanism. Instead of immediately deallocating memory, it places objects in a free_list. The object is only truly freed once the pointer graph confirms that no dangling pointers to that object remain in memory. Unlike "Sanitizers" that terminate a program upon bug detection, DangKiller provides a tolerance mechanism that allows high-availability services to continue running safely.

Evaluation

The authors evaluated DangKiller using industry-standard benchmarks, including SPEC CPU2006 and SPEC CPU2017, to measure runtime and memory overhead. Effectiveness was verified using the NIST/Juliet Test Suite, covering 32 specific UAF and Double-Free cases.

Performance Results

DangKiller showed a geometric mean runtime overhead of only 11% on SPEC CPU2006 and a mere 3% on SPEC CPU2017. This represents a significant improvement over previous tools like DangSan. On the Apache web server, DangKiller resulted in only a 7% slowdown in request processing, demonstrating its viability for real-world production environments.

Breakdown of performance overhead across SPEC CPU2006 benchmarks, distinguishing between metadata maintenance and pointer handling.

Memory Trade-off

The primary cost of DangKiller's approach is memory consumption. Because objects are held in memory until all pointers to them are gone, the geometric mean memory overhead was 143.5%. In extreme cases, such as the mcf benchmark, memory usage spiked significantly, highlighting a trade-off between speed and space.

Limitations and Future Work

The high memory overhead makes DangKiller less suitable for memory-constrained environments like IoT devices. Additionally, compatibility issues may arise with programs (like gcc) that perform their own bit-manipulation on high pointer bits. The system also cannot track pointers within pre-compiled, uninstrumented shared libraries, potentially leading to false negatives. Future research directions include implementing multithreaded garbage collection for the free_list and improving the handling of memcpy to further enhance performance and coverage.

Summary updated

BibTeX
@misc{xu2020dangkiller,
  author = {Daliang Xu and Dongwei Chen and Chun Yang and Kang Sun and Xu Cheng and Dong Tong},
  title = {{DangKiller: Eliminating Dangling Pointers Efficiently via Implicit Identifier}},
  year = {2020},
  eprint = {2003.00175},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2003.00175},
}
Figure