-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add source taintedness support for Wasm #47084
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
EWS run on previous version of this PR (hash 8148de2) |
@@ -172,7 +173,7 @@ void StreamingCompiler::didComplete() | |||
} | |||
|
|||
case CompilerMode::FullCompile: { | |||
m_vm.deferredWorkTimer->scheduleWorkSoon(ticket, [result = WTFMove(result)](DeferredWorkTimer::Ticket ticket) mutable { | |||
m_vm.deferredWorkTimer->scheduleWorkSoon(ticket, [result = WTFMove(result), source = m_source](DeferredWorkTimer::Ticket ticket) mutable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this correct? I wonder if didComplete
can be called from wasm compiler thread. Is it fine to take ref / deref of data structures inside SourceCode from the other thread?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed with Daniel. We should just thread SourceTaintedOrigin instead of SourceCode
, which removes the above risk.
8148de2
to
1b0fb4f
Compare
EWS run on previous version of this PR (hash 1b0fb4f) |
1b0fb4f
to
4daf32d
Compare
EWS run on previous version of this PR (hash 4daf32d) |
4daf32d
to
0012f40
Compare
EWS run on previous version of this PR (hash 0012f40) |
https://bugs.webkit.org/show_bug.cgi?id=294860 rdar://148934299 Reviewed by NOBODY (OOPS!). Previously, some source taintedness propagation would not work properly through WebAssembly function calls. This patch adds support for tainted Wasm stack frames, and fixes an issue with `bind` where bound functions would incorrectly use the target function's taintedness, instead of the current stack's taintedness. * JSTests/stress/taintedness-tracking-bind.js: Added. (check): (checkNot): (shouldBeUntainted): (shouldBeTainted): (vm.runTaintedString): * JSTests/stress/taintedness-tracking-wasm-proxying.js: Added. (log): (check): (checkNot): (shouldBeUntainted): (shouldBeTainted): (let.startupModule.new.WebAssembly.Module): (let.startupInstance.new.WebAssembly.Instance): * JSTests/stress/taintedness-tracking-wasm.js: Added. (check): (getTaintedState): (vm.runTaintedString.async taintedMain): * JSTests/stress/taintedness-tracking.js: * Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): * Source/JavaScriptCore/dfg/DFGOperations.cpp: (JSC::DFG::JSC_DEFINE_JIT_OPERATION): * Source/JavaScriptCore/interpreter/Interpreter.cpp: (JSC::Interpreter::executeCall): * Source/JavaScriptCore/interpreter/StackVisitor.h: (JSC::StackVisitor::Frame::isWasmFrame const): * Source/JavaScriptCore/parser/SourceTaintedOrigin.cpp: (JSC::sourceTaintedOriginFromStack): (JSC::computeNewSourceTaintedOriginFromStack): * Source/JavaScriptCore/runtime/FunctionPrototype.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/IntlCollatorPrototype.cpp: (JSC::JSC_DEFINE_CUSTOM_GETTER): * Source/JavaScriptCore/runtime/IntlDateTimeFormatPrototype.cpp: (JSC::JSC_DEFINE_CUSTOM_GETTER): * Source/JavaScriptCore/runtime/IntlNumberFormatPrototype.cpp: (JSC::JSC_DEFINE_CUSTOM_GETTER): * Source/JavaScriptCore/runtime/JSBoundFunction.cpp: (JSC::JSBoundFunction::create): (JSC::JSBoundFunction::createRaw): (JSC::JSBoundFunction::JSBoundFunction): * Source/JavaScriptCore/runtime/JSBoundFunction.h: * Source/JavaScriptCore/runtime/JSModuleLoader.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/VM.cpp: (JSC::VM::VM): (JSC::VM::getBoundFunction): * Source/JavaScriptCore/runtime/VM.h: * Source/JavaScriptCore/tools/JSDollarVM.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/wasm/WasmOperations.cpp: (JSC::Wasm::JSC_DEFINE_JIT_OPERATION): * Source/JavaScriptCore/wasm/WasmStreamingCompiler.cpp: (JSC::Wasm::StreamingCompiler::StreamingCompiler): (JSC::Wasm::StreamingCompiler::create): (JSC::Wasm::StreamingCompiler::didComplete): * Source/JavaScriptCore/wasm/WasmStreamingCompiler.h: * Source/JavaScriptCore/wasm/js/JSWebAssembly.cpp: (JSC::instantiate): (JSC::compileAndInstantiate): (JSC::JSWebAssembly::instantiate): (JSC::JSWebAssembly::instantiateForStreaming): (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/wasm/js/JSWebAssembly.h: * Source/JavaScriptCore/wasm/js/JSWebAssemblyInstance.cpp: (JSC::JSWebAssemblyInstance::JSWebAssemblyInstance): (JSC::JSWebAssemblyInstance::tryCreate): * Source/JavaScriptCore/wasm/js/JSWebAssemblyInstance.h: * Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): (JSC::m_source): (JSC::m_frameSize): Deleted. * Source/JavaScriptCore/wasm/js/WebAssemblyFunction.h: * Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/WebCore/bindings/js/JSDOMAsyncIterator.h: (WebCore::IteratorTraits>::createOnSettledFunction): (WebCore::IteratorTraits>::createOnFulfilledFunction): (WebCore::IteratorTraits>::createOnRejectedFunction): * Source/WebCore/bindings/js/JSDOMGlobalObject.cpp: (WebCore::handleResponseOnStreamingAction):
0012f40
to
75be93f
Compare
EWS run on current version of this PR (hash 75be93f) |
75be93f
75be93f