Skip to content

dmp-mitigation/dmp-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dmp-test

This repository provides scripts and configurations to test end to end implementation of dmp mitigation by splitting secret.

Overview

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.

How to Run

To run a test with run.sh, provide your test source file as the first argument:

./run.sh your_test_file.c

You can add --silent as the second argument to suppress printed output:

./run.sh your_test_file.c --silent

Environment Variables

Before running run.sh, you need to set the following environment variables:

  • LLVM_HOME:
    Full path to your LLVM installation directory. Required to invoke the correct clang binary.

    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 via xcrun in 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 your dmp-rt (runtime) libraries and headers are not at /Users/reshabh/dmp-rt/, update the script or set symlinks accordingly.

Script Logic and Modes

  • 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).

Silent Mode

Including the --silent flag as the second argument reduces output verbosity.

Output Files

  • malloc.result — Output from standard glibc malloc execution
  • secure.result — Output from secure malloc execution
  • malloc.log, etc. — (if uncommented in the script) Detailed build and runtime logs

Advanced Usage

  • 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.

Troubleshooting

  • 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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors