WorksButNotTested 728b1216bb
Librasan (#3023)
* Fixes to main

* Add librasan

* Party like it's 2024

* Fix snapshot module to work with guest asan

* Fix guest_asan module

* Fixes to runner

* Fix linking issues using a REL

* Fix qemu_launcher

* Change modify_mapping to a method

* Fix gasan_test

* Remove debug from Justfile

* Optimize release build of librasan

* Set ulimit for qasan and gasan tests

* Tidy up symbol renaming

* Add missing symbols for PPC

* Change to support rustix 1.0.0

* Canonicalize the CUSTOM_ASAN_PATH

* Review changes

* Restructure backends

* release_max_level_info

* More review changes

* Clippy fixes

* Changes to reduce the burden on the CI

* Fix macos clippy

---------

Co-authored-by: Your Name <you@example.com>
2025-03-10 17:27:55 +01:00

1.8 KiB

rasan

rasan is a library intended to be used by a guest running in QEMU to support address sanitizer.

It has a modular design intended to support different use cases and environments. The following initial variants are implemented:

  • qasan - Intended as a drop in replacement for the original libqasan, this will interact with QEMU using the bespoke syscall interface to perform memory tracking and shadow mapping.
  • gasan - This is similar to qasan, but rather than having QEMU perform the management of the shadow memory and memory tracking, this work will be carried out purely in the guest (and hence should be more performant).
  • zasan - This variant is intended to have no dependencies on libc, nor any other libraries. It is intended to be used as a starting point for bare-metal targets or targets which have statically linked libc.

The componentized nature of the design is intended to permit the user to adapt rasan to their needs with minimal modification by selecting and combining alternative implementations of the various key components.

Features

  • dlmalloc - Enable support for the dlmalloc allocator backend.
  • guest - Enable support for shadow memory and tracking in the guest
  • host - Enable support for shadow memory and tracking in the host
  • libc - Enable use of LibcMmap to support creation of mappings using libc
  • linux - Enable use of LinuxMmap to support creation of mappings and host interaction using rustix.
  • std - Disable the magic used to support no_std environments

Testing

This project makes use of a number of unit and integration tests to validate the implementation.

Fuzzing

The project also includes a couple of fuzzing harnesses supported by cargo-fuzz in order to supplement unit and integration tests.