Expertise in LLVM security features including sanitizers, hardening techniques, exploit mitigations, and secure compilation. Use this skill when implementing security-focused compiler features, analyzing vulnerabilities, or hardening applications.
This skill covers LLVM-based security features, sanitizers, hardening mechanisms, and secure software development practices.
Detects memory errors: buffer overflow, use-after-free, use-after-scope.
# Compile with ASan
clang -fsanitize=address -g program.c -o program
# Key features
# - Stack buffer overflow detection
# - Heap buffer overflow detection
# - Use-after-free detection
# - Memory leak detection
Detects uninitialized memory reads.
clang -fsanitize=memory -g program.c -o program
Detects data races in multithreaded programs.
clang -fsanitize=thread -g program.c -o program
Detects undefined behavior at runtime.
clang -fsanitize=undefined -g program.c -o program
# Specific checks
clang -fsanitize=signed-integer-overflow,null program.c
// Implementing custom memory tracking
extern "C" void __asan_poison_memory_region(void const volatile *addr, size_t size);
extern "C" void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
class SecureAllocator {