Live data from Hacker News

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

bugzilla.mozilla.org

201–210 of 443 posts

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

#201
post #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 devel…

Yes. I mean it took 5 years, but who would count. /s

People care about open Firefox bugs much older than that. Basically any long-lived program will have ancient bugs that never made it onto someone’s todo list.

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

#202
post #13
post #9

That's one way to look at it, but a very biased take. An equally valid take is that Firefox was calling an expensive platform feature too often, and even though it has been killing performance for years (possibly, for the entire history of the project) nobody noticed or bothered to fix it on the application side.

The platform feature in question was normally cheap and just made artificially expensive by Defender intercepting calls to it and blocking until analysis was performed. I don't think it's the FireFox' team's responsibility to be aware of and take into account arbitrary software intercepting system calls.

> I don't think it's the FireFox' team's responsibility to be aware of and take into account arbitrary software intercepting system calls.

One of the first, hard lessons I had to learn about web development (like, stare-at-a-wall-and-consider-my-career-hard) is that web development is way more about network effects than application architecture.

Real people run systems with real configurations, and when you're targeting "the public" as your userbase you must account for that. And Mozilla knows this: if you go into the source code (circa 2009, YMMV) and look through the initialization and boot-up logic, you would find places where the system used heuristics to figure out whether some extensions had been installed in odd places instead of the "Extensions" directory (because the tool had been installed before Firefox) and hot-patch paths to pull in that component. Because if a user installs Flash and then installs Firefox and Flash doesn't work in Firefox, it's not Flash that's broken... It's Firefox.

It doesn't matter if the bug is in "Microsoft's code" or "Mozilla's code." That's unimportant. If you're a Mozilla engineer, all that matters is whether this bug would cause a user to get pissed off and uninstall Firefox.

Thats. All. That. Matters.

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

#203
post #140

Earlier quoted context omitted.

> That's 250 megawatts saved, the equivalent of an average coal power plant. Because some Microsoft engineer missed a bug. Are you sure you want to invoke this logic? Because following it through imagine the energy savings if Firefox users switched to Chrome.

There are good reasons to not use chrome over firefox, but few reasons to leave firefox bugged. I don’t think the same utilitarian logic applies.

Yeah, finally as the market share is where it should be for Firefox Microsoft had no more reasons to leave it on :D

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

#204
post #61
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?

> Surely it is Firefox' team's responsibility to use system calls in a sane way, say not almost 50x more than the competition? The docs for that function don't say anything about performance: https://learn.microsoft.com/en-us/windows/win32/api/memoryap... They also don't say anything about "sane" usage, and while I don't have an MBA, I'm pretty sure they don't teach anything about `VirtualProtect` ratios when doing c…

There are three facets to any protocol, API, or standard in software:

The spec, the intent of the spec, and the implementation of the spec.

Doesn't matter what the docs say; what matters is what performance testing shows. Docs lie.

And even if Chrome lucked into a cheaper implementation: that luck has given them a market edge.

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

#205
post #9

That's one way to look at it, but a very biased take. An equally valid take is that Firefox was calling an expensive platform feature too often, and even though it has been killing performance for years (possibly, for the entire history of the project) nobody noticed or bothered to fix it on the application side.

I'm not sure how you can possibly qualify VirtualProtect as "an expensive platform feature". Looking at the operation that VirtualProtect actually has to perform, from first principals, it should be one of the cheapest syscalls in the entire kernel. The bug was that ETW (in the antivirus process) was doing something braindead; zeroing a megabyte of memory unnecessarily every time someone called it just to get the siz…

> it should be one of the cheapest syscalls in the entire kernel.

That's an educated guess... that is unfortunately very easy to disprove :(

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

#206

Earlier quoted context omitted.

The OS isn't some random third party software, it's one of your dependencies. Your software doesn't work without the OS and if it also doesn't work with the OS, it just plain doesn't work.

That's really not a tenable mindset to be taking these days. With how much Windows has become a constantly-moving target rather than a stable platform, you need to regard it first and foremost as your adversary, whether you are developing against it or are simply an end user. And the days of being able to thoroughly test against every relevant version of the OS are long gone; Microsoft has ensured your QA will be Sis…

At the end of the day, it's about your users.

If your users are on Windows, you have to be where they are. Moving target, wonky API, warts, and all.

Yes, it's Sisyphean. That's why my shop had a whole room stuffed with parallel Windows installs. We couldn't afford to have our users be the first ones to notice Microsoft pulled the rug out from under us again.

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

#207

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.

> That's 250 megawatts saved, the equivalent of an average coal power plant. Because some Microsoft engineer missed a bug. Are you sure you want to invoke this logic? Because following it through imagine the energy savings if Firefox users switched to Chrome.

Think more like this: this bug cost an average coal power plant, all other things being equal. I doubt it's that much, but it certainly did waste a lot of energy.

> imagine the energy savings if Firefox users switched to Chrome.

Imagine the privacy savings if Chrome users switched to Firefox.

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

#208
post #9

That's one way to look at it, but a very biased take. An equally valid take is that Firefox was calling an expensive platform feature too often, and even though it has been killing performance for years (possibly, for the entire history of the project) nobody noticed or bothered to fix it on the application side.

I'm not sure how you can possibly qualify VirtualProtect as "an expensive platform feature". Looking at the operation that VirtualProtect actually has to perform, from first principals, it should be one of the cheapest syscalls in the entire kernel. The bug was that ETW (in the antivirus process) was doing something braindead; zeroing a megabyte of memory unnecessarily every time someone called it just to get the siz…

Branch prediction should be a super-dumb algorithm, but then Spectre comes along and, oh dear.

Malware protection algorithms make fools of us all.

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

#209
post #195

Earlier quoted context omitted.

This is one of the myriad reasons why I have a strong preference for Linux.

I just bought a Macbook because my dedicated Linux laptop, made by a popular Linux-only manufacturer, had so many issues that I got tired of diagnosing. I love Linux, but it's not a panacea for every computer issue under the sun, just a few of them. I, personally, am stoked I no longer have to deal with issues with this new machine, and can just take it into a Genius bar appointment to let someone else deal with it,…

> I, personally, am stoked I no longer have to deal with issues with this new machine, and can just take it into a Genius bar appointment to let someone else deal with it, for pennies a day. You can't get that on Linux!

Honest question. If you could get that on Linux, would you? and what kind of pricing would you consider reasonable? Is it something that would have to come with the computer (i.e. would you pay for it separately or would you only use it if it was "free" aka included with your laptop purchase)? Did you stick with the vendor-provided install or did you wipe and install your own preferred distro?

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

#210

Earlier quoted context omitted.

It's not too bad an analogy. Think of it this way: - Switching from Firefox to Chrome might be similar to switching between two car models, one consuming less energy than the other. - Fixing this bug is more like going to a car workshop to fix an injector issue in your car that was causing higher fuel consumption and more pollutants. The first one is really a matter of tradeoffs and personal choices. The second one i…

Isn't it more like an auto maker issuing a recall to fix an injector issue in all their cars?

An analogy can only get you so far, but in this case the bug is caused by Microsoft Defender, yet Firefox, the car manufacturer, is a different entity. So I wouldn't call it a recall.
Post reply on HN