Closed Bug 1878765 Opened 1 year ago Closed 1 year ago

Assertion failure: false (MOZ_ASSERT_UNREACHABLE: TRRService::CompleteLookup called for unexpected request), at /builds/worker/checkouts/gecko/netwerk/dns/TRRService.cpp:1375

Categories

(Core :: Networking: DNS, defect, P2)

defect

Tracking

()

RESOLVED FIXED
125 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox123 --- wontfix
firefox124 --- wontfix
firefox125 --- fixed

People

(Reporter: tsmith, Assigned: valentin)

References

(Blocks 2 open bugs, )

Details

(Keywords: assertion, pernosco, Whiteboard: [necko-triaged][necko-priority-queue])

Attachments

(1 file)

Found with m-c 20240205-31b45b669866 (--enable-debug --enable-fuzzing)

This was found by visiting a live website with a debug build.

STR:

  • Launch browser and visit site

This issue was triggered by visiting http://eska.pl/.

Assertion failure: false (MOZ_ASSERT_UNREACHABLE: TRRService::CompleteLookup called for unexpected request), at /builds/worker/checkouts/gecko/netwerk/dns/TRRService.cpp:1375

45|0|xul.dll|mozilla::net::TRRService::CompleteLookup(nsHostRecord*, nsresult, mozilla::net::AddrInfo*, bool, nsTSubstring<char> const&, nsITRRSkipReason::value, mozilla::net::TRR*)|hg:hg.mozilla.org/mozilla-central:netwerk/dns/TRRService.cpp:31b45b6698662d418e5f0645e8010144351deb2b|1374|0x2e4
45|1|xul.dll|mozilla::net::TRR::FailData(nsresult)|hg:hg.mozilla.org/mozilla-central:netwerk/dns/TRR.cpp:31b45b6698662d418e5f0645e8010144351deb2b|817|0x203
45|2|xul.dll|mozilla::net::TRR::OnStopRequest(nsIRequest*, nsresult)|hg:hg.mozilla.org/mozilla-central:netwerk/dns/TRR.cpp:31b45b6698662d418e5f0645e8010144351deb2b|1067|0x74e
45|3|xul.dll|mozilla::net::TRRServiceChannel::OnStopRequest(nsIRequest*, nsresult)|hg:hg.mozilla.org/mozilla-central:netwerk/protocol/http/TRRServiceChannel.cpp:31b45b6698662d418e5f0645e8010144351deb2b|1236|0x182
45|4|xul.dll|nsInputStreamPump::OnStateStop()|hg:hg.mozilla.org/mozilla-central:netwerk/base/nsInputStreamPump.cpp:31b45b6698662d418e5f0645e8010144351deb2b|704|0x287
45|5|xul.dll|nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream*)|hg:hg.mozilla.org/mozilla-central:netwerk/base/nsInputStreamPump.cpp:31b45b6698662d418e5f0645e8010144351deb2b|416|0x1ce
45|6|xul.dll|NS_NewCancelableRunnableFunction<`lambda at /builds/worker/checkouts/gecko/xpcom/io/nsPipe3.cpp:71:35'>::FuncCancelableRunnable::Run()|hg:hg.mozilla.org/mozilla-central:xpcom/threads/nsThreadUtils.h:31b45b6698662d418e5f0645e8010144351deb2b|667|0x26
45|7|xul.dll|nsThread::ProcessNextEvent(bool, bool*)|hg:hg.mozilla.org/mozilla-central:xpcom/threads/nsThread.cpp:31b45b6698662d418e5f0645e8010144351deb2b|1193|0xa68
45|8|xul.dll|NS_ProcessNextEvent(nsIThread*, bool)|hg:hg.mozilla.org/mozilla-central:xpcom/threads/nsThreadUtils.cpp:31b45b6698662d418e5f0645e8010144351deb2b|480|0x44
45|9|xul.dll|mozilla::ipc::MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate*)|hg:hg.mozilla.org/mozilla-central:ipc/glue/MessagePump.cpp:31b45b6698662d418e5f0645e8010144351deb2b|300|0xd5
45|10|xul.dll|MessageLoop::RunHandler()|hg:hg.mozilla.org/mozilla-central:ipc/chromium/src/base/message_loop.cc:31b45b6698662d418e5f0645e8010144351deb2b|363|0x4f
45|11|xul.dll|MessageLoop::Run()|hg:hg.mozilla.org/mozilla-central:ipc/chromium/src/base/message_loop.cc:31b45b6698662d418e5f0645e8010144351deb2b|345|0x6e
45|12|xul.dll|nsThread::ThreadFunc(void*)|hg:hg.mozilla.org/mozilla-central:xpcom/threads/nsThread.cpp:31b45b6698662d418e5f0645e8010144351deb2b|370|0x15a
45|13|nss3.dll|_PR_NativeRunThread(void*)|hg:hg.mozilla.org/mozilla-central:nsprpub/pr/src/threads/combined/pruthr.c:31b45b6698662d418e5f0645e8010144351deb2b|399|0x120
45|14|nss3.dll|pr_root(void*)|hg:hg.mozilla.org/mozilla-central:nsprpub/pr/src/md/windows/w95thred.c:31b45b6698662d418e5f0645e8010144351deb2b|139|0x10
45|15|ucrtbase.dll||||
45|16|KERNELBASE.dll||||
45|17|mozglue.dll|patched_BaseThreadInitThunk(int, void*, void*)|hg:hg.mozilla.org/mozilla-central:toolkit/xre/dllservices/mozglue/WindowsDllBlocklist.cpp:31b45b6698662d418e5f0645e8010144351deb2b|561|0x74
45|18|ntdll.dll||||
45|19|KERNELBASE.dll||||

A Pernosco session is available here: https://pernos.co/debug/SyMfqSQvXsIBeFUFiXsyqg/index.html

Keywords: pernosco
Severity: -- → S3
Priority: -- → P2
Whiteboard: [necko-triaged][necko-priority-new]
Flags: needinfo?(valentin.gosu)
Whiteboard: [necko-triaged][necko-priority-new] → [necko-triaged][necko-priority-review]

It's great to have a pernosco log.

What's happening here is that we add the host to the blocklist:

https://searchfox.org/mozilla-central/rev/896042a1a71066254ceb5291f016ca3dbca21cb7/netwerk/dns/nsHostRecord.cpp#398

TRRService::Get()->AddToBlocklist(nsCString(host), originSuffix, pb, true);

This triggers another TRR request, to see if we need to add the parent domain to the blocklist instead:

https://searchfox.org/mozilla-central/rev/896042a1a71066254ceb5291f016ca3dbca21cb7/netwerk/dns/TRRService.cpp#1081-1084

RefPtr<TRR> trr = new TRR(this, check, TRRTYPE_NS, aOriginSuffix,
                          privateBrowsing, false);
trr->SetPurpose(TRR::Blocklist);
DispatchTRRRequest(trr);

The response resolves to a CNAME so we follow it, but this time we don't set the purpose of the request:

https://searchfox.org/mozilla-central/rev/896042a1a71066254ceb5291f016ca3dbca21cb7/netwerk/dns/TRR.cpp#855,902-903

nsresult TRR::FollowCname(nsIChannel* aChannel) {
...
  RefPtr<TRR> trr =
      new TRR(mHostResolver, mRec, mCname, mType, mCnameLoop, mPB);

We should copy the purpose field from the old to the new request here.

Flags: needinfo?(valentin.gosu)
Whiteboard: [necko-triaged][necko-priority-review] → [necko-triaged][necko-priority-next]
Assignee: nobody → valentin.gosu
Blocks: doh
Whiteboard: [necko-triaged][necko-priority-next] → [necko-triaged][necko-priority-queue]
Pushed by valentin.gosu@gmail.com: https://hg.mozilla.org/integration/autoland/rev/06e78822dc03 Copy purpose to TRR request following CNAME r=necko-reviewers,kershaw
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 125 Branch

The patch landed in nightly and beta is affected.
:valentin, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox124 to wontfix.

For more information, please visit BugBot documentation.

Flags: needinfo?(valentin.gosu)

The impact is minor. At worst the domain will not get added to the blocklist instead of the assertion happening.
This can ride the trains.

Flags: needinfo?(valentin.gosu)
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: