Skip to content

Fix CWD-relative CUTLASS C++ compilation cache (#3404) - #3442

Open
notkisk wants to merge 2 commits into
NVIDIA:mainfrom
notkisk:fix/3404-secure-cppgen-cache
Open

Fix CWD-relative CUTLASS C++ compilation cache (#3404)#3442
notkisk wants to merge 2 commits into
NVIDIA:mainfrom
notkisk:fix/3404-secure-cppgen-cache

Conversation

@notkisk

@notkisk notkisk commented Aug 9, 2026

Copy link
Copy Markdown

Description

Fixes #3404.

cutlass_cppgen previously stored compiled artifacts in compiled_cache.db relative to the process working directory. This allowed an attacker-
controlled database to supply a native library that was loaded through ctypes.CDLL.

This change:

  • Stores the cache under CUTLASS_CPPGEN_CACHE, XDG_CACHE_HOME, or ~/.cache/cutlass_cppgen.
  • Uses restrictive permissions for the cache directory and database where supported.
  • Stops forcing temporary CUDA and shared-library files into the working directory.
  • Cleans up temporary files and SQLite connections deterministically.
  • Adds regression tests for cache placement, permissions, and temporary library handling.

Existing CWD-local caches are intentionally no longer used and will be rebuilt in the new per-user cache location.

Testing

CUTLASS_CPPGEN_CACHE=/tmp/cutlass_cppgen_test_cache \
PYTHONPATH=/tmp/cutlass_cppgen_test_deps:python \
python -W error::ResourceWarning -m unittest test/python/cutlass_cppgen/test_cache.py

Result: Ran 4 tests ... OK

@notkisk

notkisk commented Aug 10, 2026

Copy link
Copy Markdown
Author

@hwu36 @jackkosaian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] - Native Code Execution via CWD-poisoned SQLite cache in CUTLASS cutlass_cppgen

1 participant