Skip to content

Commit e80f964

Browse files
committed
text tweaks to Firefox blog post
1 parent 1b40269 commit e80f964

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

content/blog/zlib-rs in Firefox.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ tags = ["zlib-rs", "data compression"]
99

1010
+++
1111

12-
As of [150.0.0](https://www.firefox.com/en-US/firefox/150.0/releasenotes/), Firefox uses zlib-rs for gzip (de)compression. This is very exciting, and has both performance and safety advantages.
12+
As of [151.0.0](https://www.firefox.com/en-US/firefox/151.0/releasenotes/), Firefox uses zlib-rs for gzip (de)compression. This is very exciting, and has both performance and safety advantages.
1313

1414
We first started talking to Mozilla engineers in summer 2024, and it took 2 years to actually get zlib-rs into production. What took us so long?
1515

@@ -34,6 +34,8 @@ This generation of CPUs is plagued by [instability and degradation issues](https
3434

3535
Eventually Fabian Giesen wrote ["Oodle 2.9.14 and Intel 13th/14th gen CPUs"](https://fgiesen.wordpress.com/2025/05/21/oodle-2-9-14-and-intel-13th-14th-gen-cpus/), which identifies the problem as a particular instruction used in writing the result of Huffman coding to memory. Zlib also uses Huffman coding, and zlib-rs turned out to also use the offending instruction.
3636

37+
Still, finding and shipping the solution in Firefox is not a quick fix. This May, shortly after the 151 release, Mozilla engineers shipped the patch, ["After a year, Firefox finally stops crashing on Intel's Raptor Lake CPUs — Mozilla releases new version patch critical flaw on Intel 13th-gen and 14th-gen CPUs"](https://www.tomshardware.com/software/mozilla-firefox/after-a-year-firefox-finally-stops-crashing-on-intels-raptor-lake-cpus-mozilla-releases-new-version-patch-critical-flaw-on-intel-13th-gen-and-14th-gen-cpus).
38+
3739
## Fixing the bug
3840

3941
Once you know what to look for, fixing the issue is reasonably straightforward. We had this function:
@@ -75,7 +77,7 @@ pub fn push_dist(&mut self, dist: u16, len: u8) {
7577
}
7678
```
7779

78-
The fix in Firefox is [here](https://github.com/mozilla-firefox/firefox/commit/711ef51645a2#diff-945832833d688a990ab42ad9c84ce62a5258698d92bbcabbcdaabc2efbbda282). The patch has been [upstreamed](https://github.com/trifectatechfoundation/zlib-rs/pull/520) into zlib-rs and we will continue to carry that patch for the foreseeable future: it's a marginal amount of unsafe that is easily vetted. These are the sacrifices we make to run reliably on a variety of platforms.
80+
The fix in Firefox by Mike Hommey is [here](https://github.com/mozilla-firefox/firefox/commit/711ef51645a2#diff-945832833d688a990ab42ad9c84ce62a5258698d92bbcabbcdaabc2efbbda282). The patch has been [upstreamed](https://github.com/trifectatechfoundation/zlib-rs/pull/520) into zlib-rs and we will continue to carry that patch for the foreseeable future: it's a marginal amount of unsafe that is easily vetted. These are the sacrifices we make to run reliably on a variety of platforms.
7981

8082
It turns out that LLVM 23 no longer emits the offending instruction, although I believe that is serendipitous and not deliberate. When we bump our MSRV to a version that requires LLVM 23 (e.g. for custom allocators and c-variadic functions) we can drop this workaround.
8183

0 commit comments

Comments
 (0)