This repository provides scripts and configurations to test end to end implementation of dmp mitigation by splitting secret.
The primary file for running tests is run.sh. It compiles and executes a test application with two different malloc implementations ("glibc malloc" and "secure malloc") and compares their results to check for discrepancies in allocation behavior.
To run a test with run.sh, provide your test source file as the first argument:
./run.sh your_test_file.cYou can add --silent as the second argument to suppress printed output:
./run.sh your_test_file.c --silentBefore running run.sh, you need to set the following environment variables:
-
LLVM_HOME:
Full path to your LLVM installation directory. Required to invoke the correctclangbinary.Example:
export LLVM_HOME=/usr/local/opt/llvm -
SDKROOT:
Used internally by the script to point to the macOS SDK path. It is auto-detected viaxcrunin the script. You usually do NOT need to set this manually. -
DYLD_LIBRARY_PATH (optional, if needed):
May be needed to locate custom shared libraries (dmp-rt/lib/, etc.), depending on your environment and dynamic loader configuration.Example:
export DYLD_LIBRARY_PATH=/Users/reshabh/dmp-rt/lib -
Additional paths:
If yourdmp-rt(runtime) libraries and headers are not at/Users/reshabh/dmp-rt/, update the script or set symlinks accordingly.
- The script first builds and runs the test with glibc malloc, storing its result in
malloc.result. - Then it builds and runs the test with the secure malloc (using additional LLVM and linker flags), storing its output in
secure.result. - It then compares the exit codes and outputs:
- If they match, it prints "PASS".
- If not, it prints "FAIL" (with details if not in silent mode).
Including the --silent flag as the second argument reduces output verbosity.
malloc.result— Output from standardglibc mallocexecutionsecure.result— Output from secure malloc executionmalloc.log, etc. — (if uncommented in the script) Detailed build and runtime logs
- To use as an LTO/LLVM pass, see commented commands in the script and adjust flags or paths as needed for your workflow.
- For dynamic analysis (using custom dynamic libraries and memcheck tools), refer to the further commented section at the script's end.
- Ensure all required libraries (
smalloc,slibc,ssyscall, etc.) are built and discoverable in your dynamic library path. - The script targets macOS; porting to other platforms may need path or tool adjustments.
For any specific questions or issues, please refer to the source of run.sh or open an issue.