Live data from Hacker News

Microsoft fixes 5-year-old Defender bug, reducing Firefox-related CPU use by 75%

bugzilla.mozilla.org

31–40 of 443 posts

Re: Microsoft fixes 5-year-old Defender bug, reducing Firefox-related CPU use by 75%

#31

What apps other than Firefox might this have affected that badly (75% CPU usage)?

All of them? From IDEs through games to email clients. Remove that malware as soon as you can. Either replace it with some more competent antivirus (not sure there are any) or don't use any antivirus at all - as a visitor of this site you should generally know what you're doing and what is and what isn't safe. I use https://github.com/jbara2002/windows-defender-remover and have been running my Windows machines without any antivirus and without any issue for years (if you ask how do I know Defender sucks if I don't run it - I do run it at work where I can't remove it - only disable it temporarily and it turns itself on again after a while).

Re: Microsoft fixes 5-year-old Defender bug, reducing Firefox-related CPU use by 75%

#32

What apps other than Firefox might this have affected that badly (75% CPU usage)?

It's not clear to me if it's the same bug, but recent conversation here about this issue had this to say [1]:

> It also has a bug(?) which makes method calls 100x slower in PowerShell 7: https://github.com/PowerShell/PowerShell/issues/19431

[1] https://news.ycombinator.com/item?id=35459984

Re: Microsoft fixes 5-year-old Defender bug, reducing Firefox-related CPU use by 75%

#33
post #26
post #19

Earlier quoted context omitted.

> I don't think it's the FireFox' team's responsibility to be aware of and take into account arbitrary software intercepting system calls. Per the bug report, Firefox was generating up to ~14,000 calls where Chrome was generating ~300, though. Surely it is Firefox' team's responsibility to use system calls in a sane way, say not almost 50x more than the competition?

Did you read the bug report? This is literally about writing to files in a temp folder. Surely you can optimize that but you should also be able to assume that this does not use excessive amounts of CPU on a modern operating system.

Yes, I have read the bug report. It mentions that Firefox writes wayyyyy too much in the temp folder. It also mentions that the team should fix this behaviour independently of the fact that some of those calls are more costly than they should be because of the bug in Defender:

> With a standard Firefox configuration, the amount of calls to VirtualProtect is currently very high, and that is what explains the high CPU usage with Firefox. The information that the most impactful event originates from calls to VirtualProtect was forwarded to us by Microsoft, and I confirm it. In Firefox, disabling JIT makes MsMpEng.exe behave much more reasonably, as JIT engines are the source of the vast majority of calls to VirtualProtect.

> On Firefox's side, independently from the issue mentioned above, we should not consider that calls to VirtualProtect are cheap. We should look for opportunities to group multiple calls to VirtualProtect together, if possible. Even after the performance issue will be mitigated, each call to VirtualProtect will still trigger some amount of computation in MsMpEng.exe (or third-party AV software); the computation will just be more reasonably expensive.

Re: Microsoft fixes 5-year-old Defender bug, reducing Firefox-related CPU use by 75%

#34
post #27
post #22

Earlier quoted context omitted.

Also worth noting that the "expensive platform feature" you refer to in this specific case means "writing to a file". Something as basic as this should be assumed to be fast on modern operating systems.

It is not a bug that there are overlooked optimizations in some platform features. Windows has a ton of slow features. Starting a process, for example, takes forever. It is the responsibility of application authors to write their performance-sensitive critical path in such a way as to avoid bogus platform behaviors. This goes for Linux, which has more than its fair share of brain damage, as well as Windows.

I generally agree with you. Having worked on lots of cross platform software, a big part of that job is to work around quirks of the underlying platforms, which can be significant. However in this case, it's not that Firefox was introducing the usage of these APIs and was then starting to have performance problems. They used the APIs without problems when suddenly Defender came along and slowed them down by orders of magnitude when they had been working fine for years.

Re: Microsoft fixes 5-year-old Defender bug, reducing Firefox-related CPU use by 75%

#35
> mpengine.dll version 1.1.20200.4 was released on April 4, so the fix should be available for everybody now. See the end of comment 91 to know what version you are using. Also, the latest discoveries in bug 1822650 comment 6 suggest that we can go even further down in CPU usage, with all antivirus software this time, not just Windows Defender.

Really nice to see open collaboration between Mozilla and Microsoft development teams resulting in a net improvement for everybody.

Re: Microsoft fixes 5-year-old Defender bug, reducing Firefox-related CPU use by 75%

#36
post #12
post #3

I would like anyone that considers Microsoft to be a recent champion of Open Source to reflect on corporate doublespeak. It's plausible that this bug was engineered as an attack on Firefox.

Have you any semblance of proof of this? By the looks of it took Firefox a few years to figure out what the repro was, they reported it to MS, it was (very) promptly fixed and they were warned that the syscall they were using isn't being used as intended and they should consider changes to FF for future use cases.

I've lived through the browser wars and I can tell you that this would not surprise me one bit.

Re: Microsoft fixes 5-year-old Defender bug, reducing Firefox-related CPU use by 75%

#40
Quick napkin math of the wasted power : Firefox has ~300e6 users, let's assume the bug wasted 5 extra watts 4 hours a day.

That's 250 megawatts saved, the equivalent of an average coal power plant. Because some Microsoft engineer missed a bug.

Post reply on HN