Closed Bug 1775115 Opened 2 years ago Closed 2 years ago

TB102: receiving many (>120) OpenPGP keys in one email hangs/crashes Thunderbird

Categories

(MailNews Core :: Security: OpenPGP, defect, P1)

Thunderbird 102

Tracking

(thunderbird_esr102+ fixed, thunderbird103 affected)

RESOLVED FIXED
104 Branch
Tracking Status
thunderbird_esr102 + fixed
thunderbird103 --- affected

People

(Reporter: c3023, Assigned: KaiE)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(2 files)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:101.0) Gecko/20100101 Firefox/101.0

Steps to reproduce:

  1. send an email with more than 90 keys attached (e.g. choose "Send public key(s) via E-Mail" in the TB Open PGP Key manager - to distribute all organizational keys without the need for the recipient to add them separately from keyservers, or to share keys which are not on keyservers)
  2. try to open this email, and click on the arrow to expand the list of attachments

Actual results:

  1. thunderbird starts to hang for some minutes (~90 keys attached), but eventually succeeds to import. If there are more keys, like >120 keys, TB becomes unresponsive for a very long time, and I have to end the process via the task manager)
  2. there is nothing in the error console
  3. I use Win10Pro latest 64bit

This didn't happen with TB91 (I can import 180 keys without problems with TB91), and I think this might have to do with the new functionality to automatically import keys which are attached (and/or check whether the keys exist in the keyring?). I don't finding the bug anymore where this functionality is discussed, but I wonder if there is a parameter to disable the automatic key-checking, automatic import? I know 180 keys is a lot, but its still a bug which crashes/hangs TB, and this didn't happen in previous versions (we do this since TB60 or so).

Expected results:

  1. I should be able to successfully complete key import, just as this happened in TB91.

It doesn't automatically import, it will only collect them in a separate storage area so that you can use them later.

Component: Untriaged → Security: OpenPGP
Product: Thunderbird → MailNews Core
Summary: TB102b7: attaching many GPG keys in one email hangs/crashes Thunderbird → TB102b7: attaching many (180) GPG keys in one email hangs/crashes Thunderbird
Blocks: tb102found
Summary: TB102b7: attaching many (180) GPG keys in one email hangs/crashes Thunderbird → TB102: receiving many (>120) OpenPGP keys in one email hangs/crashes Thunderbird

I can reproduce. I found an operation that we perform repeatedly and which is very expensive (that's even before we deal with caching it in CollectedKeysDB).

I see very good potential to optimize, reducing from O(n²) to O(n).
Working on a patch.

Assignee: nobody → kaie
Severity: -- → S2
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P1
Keywords: regression
Regressed by: 1767942

Comment on attachment 9285901 [details]
Bug 1775115 - Optimize automatic processing of OpenPGP public key atttachments, avoid quadratic complexity. r=mkmelin

[Approval Request Comment]
Regression caused by (bug #): 1767942
User impact if declined: Slowness/Lockup/DoS
Testing completed (on c-c, etc.): manually
Risk to taking this patch (and alternatives if risky): low, we reuse an existing functionality to retrieve the same data, avoiding repeated unnecessary processing

Attachment #9285901 - Flags: approval-comm-esr102?
Attachment #9285901 - Flags: approval-comm-beta?
Status: NEW → ASSIGNED
Target Milestone: --- → 104 Branch

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/e21ab006cec7
Optimize automatic processing of OpenPGP public key atttachments, avoid quadratic complexity. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED

comm/mail/test/browser/openpgp/browser_openPGPDrafts.js is failing since this landed

Flags: needinfo?(kaie)

(In reply to Magnus Melin [:mkmelin] from comment #6)

comm/mail/test/browser/openpgp/browser_openPGPDrafts.js is failing since this landed

getKeyListFromKeyBlockImpl@chrome://openpgp/content/modules/RNP.jsm fails because parameter keyBlockStr is null/empty.

I cannot yet reproduce this by running the test locally.

Flags: needinfo?(kaie)

This missed beta uplift, so it will appear in beta 104 with the next esr opportunity being 102.1.1

Whiteboard: [TM:102.1.1]

Comment on attachment 9285901 [details]
Bug 1775115 - Optimize automatic processing of OpenPGP public key atttachments, avoid quadratic complexity. r=mkmelin

[Triage Comment]

Attachment #9285901 - Flags: approval-comm-beta? → approval-comm-beta-

(In reply to Kai Engert (:KaiE:) from comment #7)

(In reply to Magnus Melin [:mkmelin] from comment #6)

comm/mail/test/browser/openpgp/browser_openPGPDrafts.js is failing since this landed

getKeyListFromKeyBlockImpl@chrome://openpgp/content/modules/RNP.jsm fails because parameter keyBlockStr is null/empty.

I cannot yet reproduce this by running the test locally.

browser_collectKeys.js needs to run first for the failures to happen.

Flags: needinfo?(kaie)

Thanks Geoff for the detective work.

I made a mistake in the original patch. I had intended to set parameter 6 to true.

I had wrongly counted parameters, and didn't pay attention to default parameters, and I had wrongly changed parameter 5.

Flags: needinfo?(kaie)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/ef78f19d4bfd
Follow up to fix mistake in earlier patch, set correct parameter (for pubkey) to true. r=mkmelin

Status: REOPENED → RESOLVED
Closed: 2 years ago2 years ago
Resolution: --- → FIXED
Whiteboard: [TM:102.1.1]

Comment on attachment 9285901 [details]
Bug 1775115 - Optimize automatic processing of OpenPGP public key atttachments, avoid quadratic complexity. r=mkmelin

[Triage Comment]
Approved for esr102

Attachment #9285901 - Flags: approval-comm-esr102? → approval-comm-esr102+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: