Bug 193177 - Leak of WTF::Function objects in WebCore::CryptoKeyRSA::generatePair() (64-80 bytes each) in com.apple.WebKit.WebContent running WebKit layout tests
Summary: Leak of WTF::Function objects in WebCore::CryptoKeyRSA::generatePair() (64-80...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-01-06 10:45 PST by David Kilzer (:ddkilzer)
Modified: 2019-01-06 18:05 PST (History)
9 users (show)

See Also:


Attachments
Patch v1 (4.68 KB, patch)
2019-01-06 11:02 PST, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff
Patch v2 (4.67 KB, patch)
2019-01-06 11:16 PST, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2019-01-06 10:45:56 PST
Leak of WTF::Function objects in WebCore::CryptoKeyRSA::generatePair() (64-80 bytes each) in com.apple.WebKit.WebContent running WebKit layout tests.

$ ./Tools/Scripts/run-webkit-tests --no-build --debug --batch-size=1000 --child-processes=1 --verbose --leaks --no-retry --no-show-results imported/w3c/web-platform-tests/WebCryptoAPI/generateKey/successes_RSA-OAEP.https.any.worker.html

NOTE: Requires changes to run-webkit-tests to support --leaks with WebKit2.

STACK OF 1 INSTANCE OF 'ROOT LEAK: <0x7ffebf90a850>':
[thread 0x70000d866000]:
28  libsystem_pthread.dylib            0x7fff66301445 thread_start + 13
27  libsystem_pthread.dylib            0x7fff663052a7 _pthread_start + 70
26  libsystem_pthread.dylib            0x7fff66302339 _pthread_body + 126
25  com.apple.JavaScriptCore              0x115645cc9 WTF::wtfThreadEntryPoint(void*) + 9  ThreadingPthreads.cpp:203
24  com.apple.JavaScriptCore              0x115644032 WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*) + 194  memory:2597
23  com.apple.WebCore                     0x1129e6a06 WebCore::WorkerThread::workerThread() + 1046  RefPtr.h:58
22  com.apple.WebCore                     0x1129e3e00 WebCore::WorkerRunLoop::run(WebCore::WorkerGlobalScope*) + 96  WorkerRunLoop.cpp:138
21  com.apple.WebCore                     0x1129e403d WebCore::WorkerRunLoop::runInMode(WebCore::WorkerGlobalScope*, WebCore::ModePredicate const&, WebCore::WorkerRunLoop::WaitMode) + 477  WorkerRunLoop.cpp:211
20  com.apple.WebCore                     0x1125316d9 WebCore::ThreadTimers::sharedTimerFiredInternal() + 185  ThreadTimers.cpp:120
19  com.apple.WebCore                     0x112086be9 WebCore::MicrotaskQueue::performMicrotaskCheckpoint() + 137  Microtasks.cpp:95
18  com.apple.WebCore                     0x1120058af WebCore::ActiveDOMCallbackMicrotask::run() + 47  Function.h:56
17  com.apple.WebCore                     0x111e04943 WebCore::JSMicrotaskCallback::call() + 67  JSMicrotaskCallback.h:46
16  com.apple.WebCore                     0x111dfd664 WebCore::JSExecState::runTask(JSC::ExecState*, JSC::Microtask&) + 68  JSExecState.h:50
15  com.apple.JavaScriptCore              0x11613f9dd JSC::JSMicrotask::run(JSC::ExecState*) + 461  VM.h:950
14  com.apple.JavaScriptCore              0x1160708f4 JSC::profiledCall(JSC::ExecState*, JSC::ProfilingReason, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 196  CallData.cpp:41
13  com.apple.JavaScriptCore              0x115e29f25 JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 469  JITCodeInlines.h:39
12  com.apple.JavaScriptCore              0x115851919 vmEntryToJavaScript + 200  LowLevelInterpreter64.asm:295
11                                     0x277493874ff7 0x277493801000 + 475127
10                                     0x27749388199b 0x277493801000 + 526747
9                                      0x27749387a5cd 0x277493801000 + 497101
8                                      0x2774938828a7 0x277493801000 + 530599
7                                      0x277493801eb7 0x277493801000 + 3767
6   com.apple.WebCore                     0x111a7fd97 WebCore::jsSubtleCryptoPrototypeFunctionGenerateKey(JSC::ExecState*) + 567  Vector.h:340
5   com.apple.WebCore                     0x111eb2ca8 WebCore::SubtleCrypto::generateKey(JSC::ExecState&, WTF::Variant<JSC::Strong<JSC::JSObject>, WTF::String>&&, bool, WTF::Vector<WebCore::CryptoKeyUsage, 0ul, WTF::CrashOnOverflow, 16ul>&&, WTF::Ref<WebCore::DeferredPromise, WTF::DumbPtrTraits<WebCore::DeferredPromise> >&&) + 728  memory:2595
4   com.apple.WebCore                     0x111ec84b0 WebCore::CryptoAlgorithmRSA_OAEP::generateKey(WebCore::CryptoAlgorithmParameters const&, bool, int, WTF::Function<void (WTF::Variant<WTF::RefPtr<WebCore::CryptoKey, WTF::DumbPtrTraits<WebCore::CryptoKey> >, WebCore::CryptoKeyPair>&&)>&&, WTF::Function<void (WebCore::ExceptionCode)>&&, WebCore::ScriptExecutionContext&) + 208  CryptoAlgorithmRSA_OAEP.cpp:102
3   com.apple.WebCore                     0x111ed5dcc WebCore::CryptoKeyRSA::generatePair(WebCore::CryptoAlgorithmIdentifier, WebCore::CryptoAlgorithmIdentifier, bool, unsigned int, WTF::Vector<unsigned char, 0ul, WTF::CrashOnOverflow, 16ul> const&, bool, int, WTF::Function<void (WebCore::CryptoKeyPair&&)>&&, WTF::Function<void ()>&&, WebCore::ScriptExecutionContext*) + 268  CryptoKeyRSAMac.cpp:305
2   libc++abi.dylib                    0x7fff6383ff48 operator new(unsigned long) + 40
1   libsystem_malloc.dylib             0x7fff662bd783 malloc + 24
0   libsystem_malloc.dylib             0x7fff662bd82b malloc_zone_malloc + 139 
====
    4 (80 bytes) ROOT LEAK: 0x7ffebf90a850 [16]
       3 (64 bytes) <WTF::Function<void (WebCore::CryptoKeyPair&&)>::CallableWrapper<WebCore::CryptoAlgorithmRSA_OAEP::generateKey(WebCore::CryptoAlgorithmParameters const&, bool, int, WTF::Function<void (WTF::Variant<WTF::RefPtr<WebCore::CryptoKey, WTF::DumbPtrTraits<WebCore::CryptoKey> >, WebCore::CryptoKeyPair>&&)>&&, WTF::Function<void (WebCore::ExceptionCode)>&&, WebCore::ScriptExecutionContext&)::$_4> 0x7ffebf90a040> [16]
          2 (48 bytes) <WTF::Function<void (WTF::Variant<WTF::RefPtr<WebCore::CryptoKey, WTF::DumbPtrTraits<WebCore::CryptoKey> >, WebCore::CryptoKeyPair>&&)>::CallableWrapper<WebCore::SubtleCrypto::generateKey(JSC::ExecState&, WTF::Variant<JSC::Strong<JSC::JSObject>, WTF::String>&&, bool, WTF::Vector<WebCore::CryptoKeyUsage, 0ul, WTF::CrashOnOverflow, 16ul>&&, WTF::Ref<WebCore::DeferredPromise, WTF::DumbPtrTraits<WebCore::DeferredPromise> >&&)::$_10> 0x7ffeb7eec550> [32]
             1 (16 bytes) 0x7ffeb7c86960 [16]

STACK OF 1 INSTANCE OF 'ROOT LEAK: <0x7ffebf94d850>':
[thread 0x70000d866000]:
28  libsystem_pthread.dylib            0x7fff66301445 thread_start + 13
27  libsystem_pthread.dylib            0x7fff663052a7 _pthread_start + 70
26  libsystem_pthread.dylib            0x7fff66302339 _pthread_body + 126
25  com.apple.JavaScriptCore              0x115645cc9 WTF::wtfThreadEntryPoint(void*) + 9  ThreadingPthreads.cpp:203
24  com.apple.JavaScriptCore              0x115644032 WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*) + 194  memory:2597
23  com.apple.WebCore                     0x1129e6a06 WebCore::WorkerThread::workerThread() + 1046  RefPtr.h:58
22  com.apple.WebCore                     0x1129e3e00 WebCore::WorkerRunLoop::run(WebCore::WorkerGlobalScope*) + 96  WorkerRunLoop.cpp:138
21  com.apple.WebCore                     0x1129e403d WebCore::WorkerRunLoop::runInMode(WebCore::WorkerGlobalScope*, WebCore::ModePredicate const&, WebCore::WorkerRunLoop::WaitMode) + 477  WorkerRunLoop.cpp:211
20  com.apple.WebCore                     0x1125316d9 WebCore::ThreadTimers::sharedTimerFiredInternal() + 185  ThreadTimers.cpp:120
19  com.apple.WebCore                     0x112086be9 WebCore::MicrotaskQueue::performMicrotaskCheckpoint() + 137  Microtasks.cpp:95
18  com.apple.WebCore                     0x1120058af WebCore::ActiveDOMCallbackMicrotask::run() + 47  Function.h:56
17  com.apple.WebCore                     0x111e04943 WebCore::JSMicrotaskCallback::call() + 67  JSMicrotaskCallback.h:46
16  com.apple.WebCore                     0x111dfd664 WebCore::JSExecState::runTask(JSC::ExecState*, JSC::Microtask&) + 68  JSExecState.h:50
15  com.apple.JavaScriptCore              0x11613f9dd JSC::JSMicrotask::run(JSC::ExecState*) + 461  VM.h:950
14  com.apple.JavaScriptCore              0x1160708f4 JSC::profiledCall(JSC::ExecState*, JSC::ProfilingReason, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 196  CallData.cpp:41
13  com.apple.JavaScriptCore              0x115e29f25 JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 469  JITCodeInlines.h:39
12  com.apple.JavaScriptCore              0x115851919 vmEntryToJavaScript + 200  LowLevelInterpreter64.asm:295
11                                     0x277493874ff7 0x277493801000 + 475127
10                                     0x27749388199b 0x277493801000 + 526747
9                                      0x27749387a5cd 0x277493801000 + 497101
8                                      0x2774938828a7 0x277493801000 + 530599
7                                      0x277493801eb7 0x277493801000 + 3767
6   com.apple.WebCore                     0x111a7fd97 WebCore::jsSubtleCryptoPrototypeFunctionGenerateKey(JSC::ExecState*) + 567  Vector.h:340
5   com.apple.WebCore                     0x111eb2ca8 WebCore::SubtleCrypto::generateKey(JSC::ExecState&, WTF::Variant<JSC::Strong<JSC::JSObject>, WTF::String>&&, bool, WTF::Vector<WebCore::CryptoKeyUsage, 0ul, WTF::CrashOnOverflow, 16ul>&&, WTF::Ref<WebCore::DeferredPromise, WTF::DumbPtrTraits<WebCore::DeferredPromise> >&&) + 728  memory:2595
4   com.apple.WebCore                     0x111ec84b0 WebCore::CryptoAlgorithmRSA_OAEP::generateKey(WebCore::CryptoAlgorithmParameters const&, bool, int, WTF::Function<void (WTF::Variant<WTF::RefPtr<WebCore::CryptoKey, WTF::DumbPtrTraits<WebCore::CryptoKey> >, WebCore::CryptoKeyPair>&&)>&&, WTF::Function<void (WebCore::ExceptionCode)>&&, WebCore::ScriptExecutionContext&) + 208  CryptoAlgorithmRSA_OAEP.cpp:102
3   com.apple.WebCore                     0x111ed5de8 WebCore::CryptoKeyRSA::generatePair(WebCore::CryptoAlgorithmIdentifier, WebCore::CryptoAlgorithmIdentifier, bool, unsigned int, WTF::Vector<unsigned char, 0ul, WTF::CrashOnOverflow, 16ul> const&, bool, int, WTF::Function<void (WebCore::CryptoKeyPair&&)>&&, WTF::Function<void ()>&&, WebCore::ScriptExecutionContext*) + 296  CryptoKeyRSAMac.cpp:306
2   libc++abi.dylib                    0x7fff6383ff48 operator new(unsigned long) + 40
1   libsystem_malloc.dylib             0x7fff662bd783 malloc + 24
0   libsystem_malloc.dylib             0x7fff662bd82b malloc_zone_malloc + 139 
====
    3 (64 bytes) ROOT LEAK: 0x7ffebf94d850 [16]
       2 (48 bytes) <WTF::Function<void ()>::CallableWrapper<WebCore::CryptoAlgorithmRSA_OAEP::generateKey(WebCore::CryptoAlgorithmParameters const&, bool, int, WTF::Function<void (WTF::Variant<WTF::RefPtr<WebCore::CryptoKey, WTF::DumbPtrTraits<WebCore::CryptoKey> >, WebCore::CryptoKeyPair>&&)>&&, WTF::Function<void (WebCore::ExceptionCode)>&&, WebCore::ScriptExecutionContext&)::$_5> 0x7ffeb93600f0> [16]
          1 (32 bytes) <WTF::Function<void (WebCore::ExceptionCode)>::CallableWrapper<WebCore::SubtleCrypto::generateKey(JSC::ExecState&, WTF::Variant<JSC::Strong<JSC::JSObject>, WTF::String>&&, bool, WTF::Vector<WebCore::CryptoKeyUsage, 0ul, WTF::CrashOnOverflow, 16ul>&&, WTF::Ref<WebCore::DeferredPromise, WTF::DumbPtrTraits<WebCore::DeferredPromise> >&&)::$_11> 0x7ffebfa00170> [32]
Comment 1 David Kilzer (:ddkilzer) 2019-01-06 10:46:31 PST
<rdar://problem/47072196>
Comment 2 David Kilzer (:ddkilzer) 2019-01-06 11:02:25 PST
Created attachment 358461 [details]
Patch v1
Comment 3 David Kilzer (:ddkilzer) 2019-01-06 11:16:04 PST
Created attachment 358463 [details]
Patch v2

- Remove unneeded 'mutable' keyword.
Comment 4 WebKit Commit Bot 2019-01-06 18:05:52 PST
Comment on attachment 358463 [details]
Patch v2

Clearing flags on attachment: 358463

Committed r239664: <https://trac.webkit.org/changeset/239664>
Comment 5 WebKit Commit Bot 2019-01-06 18:05:54 PST
All reviewed patches have been landed.  Closing bug.