Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Matches closely the number of memory related security issues Firefox had in their CSS parser before the rewrite in Rust [1]

> Over the course of its lifetime, there have been 69 security bugs in Firefox’s style component. If we’d had a time machine and could have written this component in Rust from the start, 51 (73.9%) of these bugs would not have been possible

Also interesting on the topic of memory safety

https://hacks.mozilla.org/2019/01/fearless-security-memory-s...

[1] https://hacks.mozilla.org/2019/02/rewriting-a-browser-compon...



In this context I believe that the rewrite benefitted Firefox more than Rust

At Firefox they already knew the problem they were trying to solve using Rust, they already wrote that software, already discovered many of the overlooked complications involved in writing a modern browser, so, in conclusion, even a rewrite in plain C would have solved many of the bugs.

The simple operation of rewriting the same software with previous knowledge of how it works usually leads to simpler code (at the cost of developers time)

Firefox is also the entity that invented Rust, so it's in their best interest to publicize it as "the final weapon" against bug, but "if we had used Rust from the beginning these bugs would not have been possible" is just wishful thinking.

Rust itself could not be there without the browser war and the pressure that contemporary web puts on software that runs it

And it'been C/C++ that has driven us there


> At Firefox they already knew the problem they were trying to solve using Rust, they already wrote that software, already discovered many of the overlooked complications involved in writing a modern browser, so, in conclusion, even a rewrite in plain C would have solved many of the bugs.

The Rust re-write was the third attempt; the first two were in C++ and failed.


> The Rust re-write was the third attempt; the first two were in C++ and failed.

AFAIK most of Firefox is still written in C++, JavaScript and C [1]

The JavaScript interpreter, which is particularly important to users perceived speed, is entirely written in C++

[1] https://4e6.github.io/firefox-lang-stats/


I am talking specifically about the style engine, which is the topic of this sub-thread.


the posts linked in the beginning of the thread talk about 51 memory safety bugs over the course of many years, from 2002 to 2018.

Stylo has been the default CSS parser starting from the beginning of 2018.

It's good that Rust could have avoided them, but is it a fair comparison?

I think that when at Firefox they started to think about a new architecture to better enable parallelism they began improving considerably, Rust is only a part of that.


If you watch the talk I linked below, you’ll see more details. They were, and tried with C++, and failed. Rust was key to the success.


> If you watch the talk I linked below

I've watched it several times over the past 2 years

And I've read the posts about writing and HTML engine in Rust when they first came out in 2014

https://limpet.net/mbrubeck/2014/08/08/toy-layout-engine-1.h...

and ported them to Elixir and still use them in my programming lessons

> Rust was key to the success.

For them

It's important to specify that Rust, built by Firefox, lead to a Firefox success.

Just like Dart, created by Google, is the language of choice for Flutter, also created by Google.

I know you've been working at Mozilla to work on Rust and I believe Rust is very good, but I also think Mozilla could have used other languages, there were a few that could led them to success, but they understood this are times where the "means of production" aren't the machines but engineers tools, and creating a programming language is the best way to control part of that world.


> there were a few that could led them to success

which ones? If they tried 2 or 3 times with C++ and the Rust one succeeded, what other information would you need to have to convince you that Rust was the differentiating factor? It seems like you just don't want to admit that Rust was the key to their success in the project, even when you have someone who was there telling you that it was.

We aren't going to get research study levels of replication on large projects like this, so I don't know what standard you're looking for here.


> what other information would you need to have to convince you that Rust was the differentiating factor?

The fact that Chrome is doing just fine without it?

> t seems like you just don't want to admit that Rust was the key to their success in the projec

It seems like you are trying a classic ad personam, I agree that Rust was one of the changing factor, I also wrote it, but just for Firefox, not in general.

Which is the original point of this sub-thread.

> We aren't going to get research study levels of replication on large projects like this

I don't think Firefox is the only large project out there. nor the largest.


> I know you've been working at Mozilla to work on Rust

I haven't worked there in a year and a half.


That's a very short time span in human years.

Anyway I wasn't implying anything bad, just that you worked for years at Mozilla on Rust and it's like asking Anders Hejlsberg if C# enabled Microsoft to do things that have failed before with C++ or if TypeScript is better than vanilla JavScript.


Nonsense, the first rewrite was famously as success (because anyone claimed it could not be done).

Have you contributed any code?


Here is is straight from the devs: https://youtu.be/Y6SSTRr2mFU?t=360


Mozilla developed Rust specifically for this kind of rewrite. That was the entire point of it. (As relayed to me by one of the designers in 2011 or so.)

They didn't think just a rewrite in C would be enough, they didn't think any other existing language would be sufficient, and then they went off to design Rust. So the statement "Firefox is also the entity that invented Rust" kind of misses the point.


Some people seem to think Mozilla gets royalties every time you invoke rustc.

And that if I just took off my rose-tinted glasses, I'd realize my Rust code is buggy, unsafe, slow, and hard to maintain, and the only reason I'm using Rust is because of hype.

It was pretty hyped when I started using it, in 2015.


> And that if I just took off my rose-tinted glasses, I'd realize my Rust code is buggy, unsafe, slow, and hard to maintain

I didn't get the impression.

I understood that Firefox talks about their success in rewriting in Rust because it's their language, they control it and are the major sponsor and user.

I don't think Google or MS or any other company heavily involved in crafting programming languages for their own purposes will ever go that route for some of their core software, because they can't control the language and if they tried they would get the blame for trying.


Mozilla does not control Rust.

Google and Microsoft are both already using Rust for real products.


Not core.

There will never be Rust in Chrome or in Office.

Mozilla controls Rust because it's the largest Rust user.

Just like Google controls Go, even though it's opensource.

You said it yourself "the only real way to get a job working on Rust was to work at Mozilla"


> There will never be Rust in Chrome

There is a branch in the repository right now trying it out. Rust is also used in ChromeOS.

> Mozilla controls Rust because it's the largest Rust user.

Mozilla is not the largest Rust user, nor does the largest user control the language. Governance is consensus-based, and anyone is eligible to join.

> You said it yourself "the only real way to get a job working on Rust was to work at Mozilla"

I may have said that a long, long time ago, but it's not true today. The Rust team at Mozilla has been shrinking, and other companies have been letting folks work on Rust as part of their job.

And volunteers are like, 10x-25x more numerous than people who are paid to do so.


> There is a branch in the repository right now trying it out. Rust is also used in ChromeOS.

ChromeOS is a dead product.

> Mozilla is not the largest Rust user

Who is then?

> Governance is consensus-based, and anyone is eligible to join.

Same thing Google says about Go.

If Google is really interested in Rust I don't believe they will let the community keep the governance, I might be wrong, but better safe than sorry.

Is Google trying to take control over Rust?


It's really clear that no matter what evidence I provide, you're going to dismiss it, so I just won't bother anymore.


It's called a discussion.

You're not even aknowledging the fact that there could be different opinions on the matter, if I was you I wouldn't play the card "you're dismissing evidence".

You work on Rust, that's a fact, I'm giving you credit for it.

Can you say it doesn't affect your judgement at all?


Rust is now an official UWP / WinUI binding, part of Project Reunion, core Windows platform, and is shipping on Visual Studio Code and Azure IoT products.

Office will eventually make use of it.


> Rust is now an official UWP / WinUI binding, part of Project Reunion, core Windows platform

That's good to know! It appears Microsoft can be both bad and good.

> Office will eventually make use of it.

I have to see it before I believe it.

Office team is not "developers who make third party Windows apps so Microsoft indirectly profit from them"

There was a time when MS embraced Java, we've never seen it in Office though.


Microsoft is now a OpenJDK contributor has bought jClarity, Java has had several talks at Build and has parity with .NET on Azure SDKs, Office doesn't dictate all business lines.

And I bet you weren't reverse engineering Office to discover which ActiveX were implemented in J++ instead of VB 6.


> Microsoft is now a OpenJDK contributor

so what?

MS also ships a complete Linux distro now.

> Java has had several talks at Build and has parity with .NET on Azure SDKs, Office doesn't dictate all business lines.

And Linux is the most installed OS on Azure...

I can buy milk from my butcher, but his core product is still meat.

you still fail to see the difference between what they offer to potential clients and what they use internally.

They are expanding the offer but are still a software house in the end.

It also means that MS is using its weight on free (as in free speech) technologies, like Google has done before with other OSS projects and we all know how it ended.

> Office doesn't dictate all business lines

Obviously, it doesn't.

It only generates 33% of the revenues and 39% of the operative margins.

The second largest segment for revenues, behind computing (mainly HW), the first for margins.

Cloud comes third - and last - for revenues and second for profits with a pretty strong growth - less than 2018 but still strong -, but keep in mind that they include the Office 365 online offer and Gaming cloud in the segment.

> And I bet you weren't reverse engineering Office to discover which ActiveX were implemented in J++ instead of VB 6.

Would you bet ten millions dollar on it?


I think Rust is pretty much a meta-rewrite. The same way you describe a team learning from an existing product (CSS parser) what needed to be addressed, they applied the same logic but one level higher: on the very tool they were using.

I think it's clever, it was risky but it seems to be paying off.


To me it leads to exactly the opposite conclusion.

C/C++ or it's developers couldn't deliver, so they went a very risky direction that led to success.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: