Skip to content

only use dmlast for DML files distributed near the compiler#443

Open
mandolaerik wants to merge 3 commits into
intel:mainfrom
mandolaerik:pr/only-use-dmlast-for-dml-files-distributed-near-the-compiler
Open

only use dmlast for DML files distributed near the compiler#443
mandolaerik wants to merge 3 commits into
intel:mainfrom
mandolaerik:pr/only-use-dmlast-for-dml-files-distributed-near-the-compiler

Conversation

@mandolaerik
Copy link
Copy Markdown
Contributor

@mandolaerik mandolaerik commented May 13, 2026

This hopefully silences security people and bug-hunting LLM:s more efficiently, since the # nosec apparently wasn't sufficient to do so.

@syssimics syssimics requested a review from lwaern-intel May 13, 2026 20:56
@syssimics
Copy link
Copy Markdown
Contributor

PR Verification: ✅ success

Comment thread py/dml/toplevel.py Outdated
Comment thread py/dml/toplevel.py Outdated
if (dml_filename.endswith('.dml') and os.path.exists(ast_filename)
# Trust only .dmlast files inside the compiler tree. Files outside may
# come from incompatible parser versions or untrusted sources.
and Path(__file__).parent.parent.parent in Path(ast_filename).parents):
Copy link
Copy Markdown
Contributor

@lwaern-intel lwaern-intel May 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this check down as a new link of the if chain containing the WOLDAST check. We wanna warn/error if a dmlast is rejected, not just silently skip past it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still insist on this. The condition feels fragile to me, and I want to be sure we can tell when it fails.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I simply forgot your remark, fixed now.

@mandolaerik mandolaerik force-pushed the pr/only-use-dmlast-for-dml-files-distributed-near-the-compiler branch from 15d76b5 to f6c51af Compare May 18, 2026 07:13
@syssimics syssimics requested a review from lwaern-intel May 18, 2026 07:14
@syssimics
Copy link
Copy Markdown
Contributor

PR Verification: ✅ success

Copy link
Copy Markdown
Contributor

@lwaern-intel lwaern-intel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to address my concern in some way. Either do what I suggest, prove my concern is utterly unfounded, or remove the change entirely (now it's no longer needed.) As-is, all it takes is a shake-up of how dirs get -I:d (like how CMake shakes stuff up compared to Make) in a way we aren't expecting for .dmlasts to stop working, potentially in a way we wouldn't be able to easily detect.

@mandolaerik mandolaerik force-pushed the pr/only-use-dmlast-for-dml-files-distributed-near-the-compiler branch from f6c51af to ca4a943 Compare May 18, 2026 13:45
@syssimics syssimics requested a review from lwaern-intel May 18, 2026 13:45
@syssimics
Copy link
Copy Markdown
Contributor

DML Verification : 6: ❌ failure

@syssimics
Copy link
Copy Markdown
Contributor

DML Verification : 7: ❌ failure

@mandolaerik mandolaerik force-pushed the pr/only-use-dmlast-for-dml-files-distributed-near-the-compiler branch from ca4a943 to 5b82575 Compare May 18, 2026 13:57
@syssimics
Copy link
Copy Markdown
Contributor

DML Verification : 6: ❌ failure

@syssimics
Copy link
Copy Markdown
Contributor

PR Verification: ❌ failure

`pickle.loads` is unsafe for untrusted data, and although dmlast files
are only used on trusted data, it is hard for the reader to deduce this
so it is easier to use the safe unpickler idiom instead of suppressing
security warnings.
@mandolaerik mandolaerik force-pushed the pr/only-use-dmlast-for-dml-files-distributed-near-the-compiler branch from 5b82575 to 61619ef Compare May 18, 2026 14:42
@syssimics
Copy link
Copy Markdown
Contributor

PR Verification: ❌ failure

Symlink resolution caused the standard DML lib of fake pkgs in pkgs/
to appear as `<repo>/linux64/bin/dml`
@syssimics
Copy link
Copy Markdown
Contributor

PR Verification: ✅ success

@syssimics
Copy link
Copy Markdown
Contributor

DML Verification : 6: ❌ failure

@syssimics
Copy link
Copy Markdown
Contributor

DML Verification : 7: ❌ failure

@syssimics
Copy link
Copy Markdown
Contributor

PR Verification: ❌ failure

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.

3 participants