Skip to content

Conversation

@hoodmane
Copy link
Contributor

No description provided.

@hoodmane hoodmane requested review from a team as code owners January 16, 2026 00:37
@hoodmane hoodmane force-pushed the hoodmane/prevent-loading-dynamic-shared-libs branch from 1996d75 to 7ef9c79 Compare January 16, 2026 00:40
@codspeed-hq
Copy link

codspeed-hq bot commented Jan 16, 2026

CodSpeed Performance Report

Merging this PR will degrade performance by 11.42%

Comparing hoodmane/prevent-loading-dynamic-shared-libs (7ef9c79) with main (65a8274)

Summary

❌ 1 regressed benchmark
✅ 67 untouched benchmarks
⏩ 129 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
simpleStringBody[Response] 19.2 µs 21.7 µs -11.42%

Footnotes

  1. 129 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

var libData = Module.patched_loadLibData(Module, f);
return flags.loadAsync ? Promise.resolve(libData) : libData;
}
function loadLibData1(){
Copy link
Contributor

Choose a reason for hiding this comment

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

What's this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well I'm trying to replace the definition of loadLibData. I'm replacing "function loadLibData(){" so after that there's a function body. I added my own function body but I need to define a new pointless function in order to discard the old function body.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. How about using a more meaningful name such as loadLibDataPrivate for just in case?

"function loadLibData(){",
"""
function loadLibData(){
var f = findLibraryFS(libName, flags.rpath);
Copy link
Contributor

Choose a reason for hiding this comment

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

findLibraryFS probably doesn't exist in old Emscripten versions? I guess I added that in 4.X

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed. My thought was to get it to work for 0.28.2 first and then work on 0.26 once that's working.

# fmt: off
Path(tmp_path / "a.so").write_bytes(
bytes(
[
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please add a comment about the content of this file?

Comment on lines +212 to +213
// Get the trusted read function from our private Map, not from the node
// or filesystem object (which could have been tampered with by user code)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this really something we should worry about? As long as users can access the Emscripten module object (I guess they can?), they can do anything.

I wonder if this additional barrier is really helpful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Users can access the Module object. However, they cannot access objects that are captured by closures. So patched_loadLibData can call UnsafeEval.newWasmModule(), but it is only willing to call it on read only data. The user could do all sorts of mischief with the file system, or even replace Module.patched_loadLibData with something else. But they can't import UnsafeEval into their own code, so they can only call it via the functions that call it that are attached to Module. As long as none of these functions are willing to compile arbitrary modules, we're okay.

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.

2 participants