Bug 193154 - Leak of two CCRSACryptorRef (4.0 Kbytes/1 page each) in com.apple.WebKit.WebContent running WebKit layout tests
Summary: Leak of two CCRSACryptorRef (4.0 Kbytes/1 page each) in com.apple.WebKit.WebC...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-01-04 12:20 PST by David Kilzer (:ddkilzer)
Modified: 2019-01-06 10:45 PST (History)
9 users (show)

See Also:


Attachments
Patch v1 (23.42 KB, patch)
2019-01-04 12:32 PST, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff
Patch v2 (23.40 KB, patch)
2019-01-04 13:22 PST, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews117 for mac-sierra (2.12 MB, application/zip)
2019-01-04 18:06 PST, EWS Watchlist
no flags Details
Patch v3 (24.93 KB, patch)
2019-01-04 18:15 PST, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff
Patch v4 (26.16 KB, patch)
2019-01-04 18:26 PST, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews116 for mac-sierra (2.19 MB, application/zip)
2019-01-04 20:27 PST, EWS Watchlist
no flags Details
Patch v5 (26.19 KB, patch)
2019-01-05 03:46 PST, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff
Patch v6 (26.21 KB, patch)
2019-01-05 03:55 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-04 12:20:03 PST
Leak of two CCRSACryptorRef (4.0 Kbytes/1 page 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: <0x7fa756846a00>':
[thread 0x700005520000]:
11  libsystem_pthread.dylib            0x7fff66301435 start_wqthread + 13
10  libsystem_pthread.dylib            0x7fff6630170e _pthread_wqthread + 619
9   libdispatch.dylib                  0x7fff660d04bd _dispatch_worker_thread2 + 90
8   libdispatch.dylib                  0x7fff660cfd26 _dispatch_root_queue_drain + 325
7   libdispatch.dylib                  0x7fff660c4240 _dispatch_queue_override_invoke + 767
6   libdispatch.dylib                  0x7fff660c1dcf _dispatch_client_callout + 8
5   libdispatch.dylib                  0x7fff660c0d53 _dispatch_call_block_and_release + 12
4   com.apple.WebCore                     0x1084b9ff7 invocation function for block in 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*) + 39  CryptoKeyRSAMac.cpp:323
3   libcommonCrypto.dylib              0x7fff65f9d3e2 CCRSACryptorGeneratePair + 243
2   libcommonCrypto.dylib              0x7fff65f9d499 CCRSACryptorGetPublicKeyFromPrivateKey + 30
1   libsystem_malloc.dylib             0x7fff662bd783 malloc + 24
0   libsystem_malloc.dylib             0x7fff662bd82b malloc_zone_malloc + 139 
====
    1 (4.00K) ROOT LEAK: 0x7fa756846a00 [4096]

STACK OF 1 INSTANCE OF 'ROOT LEAK: <0x7fa7582d1000>':
[thread 0x700005520000]:
10  libsystem_pthread.dylib            0x7fff66301435 start_wqthread + 13
9   libsystem_pthread.dylib            0x7fff6630170e _pthread_wqthread + 619
8   libdispatch.dylib                  0x7fff660d04bd _dispatch_worker_thread2 + 90
7   libdispatch.dylib                  0x7fff660cfd26 _dispatch_root_queue_drain + 325
6   libdispatch.dylib                  0x7fff660c4240 _dispatch_queue_override_invoke + 767
5   libdispatch.dylib                  0x7fff660c1dcf _dispatch_client_callout + 8
4   libdispatch.dylib                  0x7fff660c0d53 _dispatch_call_block_and_release + 12
3   com.apple.WebCore                     0x1084b9ff7 invocation function for block in 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*) + 39  CryptoKeyRSAMac.cpp:323
2   libcommonCrypto.dylib              0x7fff65f9d396 CCRSACryptorGeneratePair + 167
1   libsystem_malloc.dylib             0x7fff662bd783 malloc + 24
0   libsystem_malloc.dylib             0x7fff662bd82b malloc_zone_malloc + 139 
====
    1 (4.00K) ROOT LEAK: 0x7fa7582d1000 [4096]

Comment 1 David Kilzer (:ddkilzer) 2019-01-04 12:20:42 PST
<rdar://problem/47052993>
Comment 2 David Kilzer (:ddkilzer) 2019-01-04 12:32:14 PST
Created attachment 358350 [details]
Patch v1
Comment 3 David Kilzer (:ddkilzer) 2019-01-04 12:32:39 PST
Comment on attachment 358350 [details]
Patch v1

Checking EWS for GTK/WPE.
Comment 4 David Kilzer (:ddkilzer) 2019-01-04 13:22:24 PST
Created attachment 358356 [details]
Patch v2
Comment 5 David Kilzer (:ddkilzer) 2019-01-04 13:23:33 PST
(In reply to David Kilzer (:ddkilzer) from comment #3)
> Comment on attachment 358350 [details]
> Patch v1
> 
> Checking EWS for GTK/WPE.

Oops, this patch was made on a working directory prior to the WTF::Optional changes.
Comment 6 Jiewen Tan 2019-01-04 13:29:09 PST
(In reply to David Kilzer (:ddkilzer) from comment #5)
> (In reply to David Kilzer (:ddkilzer) from comment #3)
> > Comment on attachment 358350 [details]
> > Patch v1
> > 
> > Checking EWS for GTK/WPE.
> 
> Oops, this patch was made on a working directory prior to the WTF::Optional
> changes.

I hit that as well.
Comment 7 EWS Watchlist 2019-01-04 18:06:10 PST
Comment on attachment 358356 [details]
Patch v2

Attachment 358356 [details] did not pass mac-debug-ews (mac):
Output: https://webkit-queues.webkit.org/results/10634982

New failing tests:
http/wpt/css/css-animations/start-animation-001.html
Comment 8 EWS Watchlist 2019-01-04 18:06:11 PST
Created attachment 358408 [details]
Archive of layout-test-results from ews117 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews117  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 9 David Kilzer (:ddkilzer) 2019-01-04 18:15:09 PST
Created attachment 358411 [details]
Patch v3
Comment 10 David Kilzer (:ddkilzer) 2019-01-04 18:26:05 PST
Created attachment 358413 [details]
Patch v4
Comment 11 David Kilzer (:ddkilzer) 2019-01-04 19:14:43 PST
Comment on attachment 358413 [details]
Patch v4

GTK/WPE ports finally build.  Marking this for review.
Comment 12 EWS Watchlist 2019-01-04 20:27:04 PST
Comment on attachment 358413 [details]
Patch v4

Attachment 358413 [details] did not pass mac-debug-ews (mac):
Output: https://webkit-queues.webkit.org/results/10636467

New failing tests:
http/wpt/css/css-animations/start-animation-001.html
Comment 13 EWS Watchlist 2019-01-04 20:27:06 PST
Created attachment 358426 [details]
Archive of layout-test-results from ews116 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews116  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 14 David Kilzer (:ddkilzer) 2019-01-05 03:46:27 PST
Created attachment 358434 [details]
Patch v5

- Add 'virtual' back to CryptoKeyRSA destructor.
- Rename struct WKCCRSACryptorRefDeleter to WebCore::CCRSACryptorRefDeleter.
Comment 15 David Kilzer (:ddkilzer) 2019-01-05 03:55:16 PST
Created attachment 358435 [details]
Patch v6

- Fix declaration of struct WebCore::CCRSACryptorRefDeleter.
Comment 16 Brent Fulgham 2019-01-05 20:38:00 PST
Comment on attachment 358435 [details]
Patch v6

View in context: https://bugs.webkit.org/attachment.cgi?id=358435&action=review

Looks good.

> Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp:73
> +    CCCryptorStatus status = CCRSAGetKeyComponents(keyIsPublic ? rsaKey.get() : publicKeyFromPrivateKey.get(), modulus.data(), &modulusLength, publicExponent.data(), &exponentLength, 0, 0, 0, 0);

Nice!
Comment 17 WebKit Commit Bot 2019-01-05 21:05:18 PST
Comment on attachment 358435 [details]
Patch v6

Clearing flags on attachment: 358435

Committed r239662: <https://trac.webkit.org/changeset/239662>
Comment 18 WebKit Commit Bot 2019-01-05 21:05:20 PST
All reviewed patches have been landed.  Closing bug.