Live data from Hacker News

Firefox engineers discover a Windows Defender bug that causes high CPU usage

bugzilla.mozilla.org

61–70 of 223 posts

Re: Firefox engineers discover a Windows Defender bug that causes high CPU usage

#61
post #4

TL;DR: Windows Defender had a bug that made certain system calls expensive on CPU cycles when Defender's Real-time Protection feature is enabled. After discovery, Mozilla reported this issue to Microsoft. Microsoft is releasing a patch that should result in lower CPU usage when using Firefox on sites like YouTube (a ~75% CPU usage reduction was noted when browsing YouTube in Firefox with the fixed version of Defender…

> “Windows Defender had a bug that made certain system calls expensive

It also has a bug(?) which makes method calls 100x slower in PowerShell 7:

https://github.com/PowerShell/PowerShell/issues/19431

Re: Firefox engineers discover a Windows Defender bug that causes high CPU usage

#62
post #34

Earlier quoted context omitted.

Firefox is significantly slower than chrome. This usually doesn't matter, but you can immediately see it in any page that A) has a massive DOM or B) uses complex regular expressions that eat up the engine

I've read that a number of times now, but I have trouble matching it to my perceptions. Can you point to a specific website where you notice that slowness and then describe what action is slower? (Initial load, clicking stuff, scrolling, etc.) Just as an example, loading jslinux.org for me in Firefox is about twice as fast than in Chrome. That might be a special case of course, because it is a very special type of wo…

WebGL / Canvas heavy sites are typically significantly slower in Firefox compared to Chrome. Google Maps is a pretty good example of this.

Re: Firefox engineers discover a Windows Defender bug that causes high CPU usage

#63

Windows Defender is a long standing bug in the Windows operating system. ;) My impression is that its invention was for the sole purpose of eradicating the idea that Windows is insecure and prone to viruses, which explains why it can be overzealous and CPU hungry. I would only enable it for family members who don't know what they are doing. For some reason, I haven't needed any form of active virus scanning in someth…

> who don't know what they are doing.

I think this would describe the majority of computer users. And the majority of computer users are also using Windows.

> I haven't needed any form of active virus scanning in something like 15 years

Microsoft Defender antivirus was released alongside Windows 8 in 2012. And it's essentially a rewrite of Microsoft Security Essentials which came included starting with Vista. If you haven't been explicitly disabling it, which your comment sounds like, you've been running one without knowing it for 16 years

Re: Firefox engineers discover a Windows Defender bug that causes high CPU usage

#64

Earlier quoted context omitted.

Put 10,000 or so event handlers with their own DOM updates on a page. Chrome will run it smoothly (taking up a huge amount of RAM in the process), Firefox won't.

What is the definition of huge amount of RAM? How does Chrome perform when it's RAM constricted? Are we blaming Firefox for poorly designed websites? It feels like this is a straw man constructed to bash Firefox, rather than a real world scenario.

Extremely poorly-optimized websites are far more common these days than even mildly performant ones.

Re: Firefox engineers discover a Windows Defender bug that causes high CPU usage

#65

Windows Defender is a long standing bug in the Windows operating system. ;) My impression is that its invention was for the sole purpose of eradicating the idea that Windows is insecure and prone to viruses, which explains why it can be overzealous and CPU hungry. I would only enable it for family members who don't know what they are doing. For some reason, I haven't needed any form of active virus scanning in someth…

There's a misconception that you need to do something "stupid" to get a virus which is simply not the case. 0 days exist, and worms are still a thing (looking at you samba). A great example is Pytorch just recently had a supply chain attack, and installing the nightly version between December 25th and December 30th, 2022 - would result in your home directory getting uploaded including ssh keys. Chrome also just had a…

windows users will also happily "run as administrator", while a lot of linux users know not to do that in my experience

Re: Firefox engineers discover a Windows Defender bug that causes high CPU usage

#66
post #35
post #4

TL;DR: Windows Defender had a bug that made certain system calls expensive on CPU cycles when Defender's Real-time Protection feature is enabled. After discovery, Mozilla reported this issue to Microsoft. Microsoft is releasing a patch that should result in lower CPU usage when using Firefox on sites like YouTube (a ~75% CPU usage reduction was noted when browsing YouTube in Firefox with the fixed version of Defender…

Well, also Firefox is making an excessive number of calls to that slow system call compared to other browsers (Chrome, Edge).

My understanding is that until recently (January), V8 (inside Chrome & Edge) made a similar number of calls. The main use is making it so that JIT-generated code is not writable while it is executing. It's an important security measure. V8 switched to a more recent mechanism (memory protection keys) that have been gradually getting support from the various OSes. But IIUC, they switched off the mprotect/VirtualProtect calls unconditionally, and added in the protection key stuff only where supported, which suggests that they left some configurations without any protection at all. SpiderMonkey (in Firefox) has not yet switched to the cheaper mechanism.

I may have some of the details wrong.

https://source.chromium.org/chromium/_/chromium/v8/v8.git/+/...

Re: Firefox engineers discover a Windows Defender bug that causes high CPU usage

#67
post #4

TL;DR: Windows Defender had a bug that made certain system calls expensive on CPU cycles when Defender's Real-time Protection feature is enabled. After discovery, Mozilla reported this issue to Microsoft. Microsoft is releasing a patch that should result in lower CPU usage when using Firefox on sites like YouTube (a ~75% CPU usage reduction was noted when browsing YouTube in Firefox with the fixed version of Defender…

I'm curious how much excess energy has been consumed, and won't be consumed any longer, as a result of this improvement - even just limited to reduced CPU usage on Windows machines using Firefox to watch Youtube.

I love thinking about the impacts of tiny improvements at scale like this, might do some napkin math on it later and see if I can come up with something in the right order of magnitude.

Re: Firefox engineers discover a Windows Defender bug that causes high CPU usage

#68
post #53

> a ~75% CPU usage reduction was noted when browsing YouTube in Firefox I wonder how many of the people who say "Firefox is significantly slower than chrome" are using windows... On my computer, Firefox IS slower than chrome but (with ad blockers enabled) by an insignificant amount. By still being "the last remaining mostly independent, maintained and reasonably popular browser" I'd prefer it to use over chrome even…

I just ran a test at https://browserbench.org/Speedometer2.1/ Firefox scored 89.5 ±1.7 Chromium scored 87.3 ±2.9 I guess that means Firefox did faster for those tests. I don't use Chrome or Chromium based browsers in general so I don't know how they compare in "feel". I am on Linux.

80-90s feels low in general, my phone gets +300 on that. Maybe some funky CPU powersave interfering with the runs?

Re: Firefox engineers discover a Windows Defender bug that causes high CPU usage

#69

Windows Defender is a long standing bug in the Windows operating system. ;) My impression is that its invention was for the sole purpose of eradicating the idea that Windows is insecure and prone to viruses, which explains why it can be overzealous and CPU hungry. I would only enable it for family members who don't know what they are doing. For some reason, I haven't needed any form of active virus scanning in someth…

> who don't know what they are doing. I think this would describe the majority of computer users. And the majority of computer users are also using Windows. > I haven't needed any form of active virus scanning in something like 15 years Microsoft Defender antivirus was released alongside Windows 8 in 2012. And it's essentially a rewrite of Microsoft Security Essentials which came included starting with Vista. If you…

>Microsoft Defender antivirus was released alongside Windows 8 in 2012. And it's essentially a rewrite of Microsoft Security Essentials which came included starting with Vista.

Not quite.

Windows Defender was released together with Windows Vista, this was very rudimentary and only handled malware and spyware not unlike Malwarebytes, it did not handle viruses.

Microsoft Security Essentials was released standalone sometime during Windows 7's era, this was fully fledged anti-virus.

Microsoft Security Essentials was renamed Microsoft Defender and bundled with Windows starting from Windows 8, where it has stayed to this day.

Re: Firefox engineers discover a Windows Defender bug that causes high CPU usage

#70

I've experienced a bug related to the on-disk real-time scanning of Windows Defender, but instead with 100% disk bandwidth usage for unreasonable amounts of time. I purchased a license of a proper antivirus software to avoid that bug and the performance issues gone away. When you install another AV software, Windows Defender steps down and leaves scanning to the 3rd-party security solution. I selected one of the most…

> I purchased a license of a proper antivirus software Which is that? For years (and come to think of it, this goes back to the 2000's or even 90's), AV / antimalware software comes across as scareware, using tricks to ensure you're afraid of not having it. And second, who here has ever had a virus in the past ten years?

There are some performance benchmarks for AV products:

https://www.av-comparatives.org/tests/performance-test-octob...

https://www.av-test.org/en/antivirus/home-windows/windows-10... (less useful..)

AV comparatives has some other tests also that might be of interest to HNers:

https://www.av-comparatives.org/tests/uninstallation-test-20...

https://www.av-comparatives.org/tests/false-alarm-test-septe... (reason why you might not want to pick the fastest product..)

Post reply on HN