snaggen

joined 2 years ago
 

Abstract—New contributors are critical to open source projects. Without them, the project will eventually atrophy and become inactive, or its experienced contributors will bias the future directions the project takes. However, new contributors can also bring a greater risk of introducing vulnerable code. For projects that have a need for both secure implementations and a strong, diverse contributor community, this conflict is a pressing issue. One avenue being pursued that could facilitate this goal is rewriting components of C or C++ code in Rust— a language designed to apply to the same domains as C and C++, but with greater safety guarantees. Seeking to answer whether Rust can help keep new contributors from introducing vulnerabilities, and therefore ease the burden on maintainers, we examine the Oxidation project from Mozilla, which has replaced components of the Firefox web browser with equivalents written in Rust. We use the available data from these projects to derive parameters for a novel application of learning curves, which we use to estimate the proportion of commits that introduce vulnerabilities from new contributors in a manner that is directly comparable. We find that despite concerns about ease of use, first-time contributors to Rust projects are about 70 times less likely to introduce vulnerabilities than first-time contributors to C++ projects. We also found that the rate of new contributors increased overall after switching to Rust, implying that this decrease in vulnerabilities from new contributors does not result from a smaller pool of more skilled developers, and that Rust can in fact facilitate new contributors. In the process, we also qualitatively analyze the Rust vulnerabilities in these projects, and measure the efficacy of the common SZZ algorithm for identifying bug-inducing commits from their fixes.

 

Quite some exciting progress since the last progress report! There have been 180 commits since the last progress report.

As of today, rustc_codegen_cranelift is available on nightly! :tada: You can run rustup component add rustc-codegen-cranelift-preview --toolchain nightly to install it and then either CARGO_PROFILE_DEV_CODEGEN_BACKEND=cranelift cargo +nightly build to use it for the current invocation or add

 

TL;DR

We want to improve the reliability and performance of crate downloads.

"Non-canonical downloads" (that use URLs containing hyphens or underscores where the crate published uses the opposite) are blocking these plans.

On 2023-11-20 support for "non-canonical downloads" will be disabled.

cargo users are unaffected.

[–] [email protected] 3 points 2 years ago (1 children)

And the Copy question.It is not that s reference has to implement Copy. A reference IS Copy, by the simple fact that it is a primitive value on the stack.

[–] [email protected] 5 points 2 years ago* (last edited 2 years ago) (2 children)

A reference &T holds a pointer, ie. the memory adress to the actual content of T

So, in the example x doesn't hold the value 42, it holds the memory adress to the memory there the integer value 42 is stored. So, to access the value, you need to dereference the reference. Which is why you need to use *x when you assign the value.

[–] [email protected] 4 points 2 years ago

Fixed it.... I come from a language culture were we like our negations :) Also, not native english speaker, so combine the two and you are in for a ride!

[–] [email protected] 10 points 2 years ago* (last edited 2 years ago) (2 children)

But isn't it kind of obvious that if you are able to do 180k times improvement, then the baseline is probably not very impressive to begin with. Still, that doesn't take away that the optimizations were impressive, and that it was interesting to read about it.

[–] [email protected] 0 points 2 years ago (1 children)

And if I understand it correctly, it now would be enough for them to ping in this community in a post to get it do show up here... so that might be something for them to think about.

[–] [email protected] 2 points 2 years ago* (last edited 2 years ago)

I actually agree, I much prefer articles. However, I found this interesting since it looked at turbopack, parcel, rspack and others and talked about how it comes that the JavaScript ecosystem seems to start to use a lot of rust for their tooling. It was quite long though...

[–] [email protected] 8 points 2 years ago

You don't have to use it....

[–] [email protected] 1 points 2 years ago* (last edited 2 years ago)

Because of ownership you’re forced into certain hierarchies, which make the code ugly and hard to read.

For non-gc languages you always have ownership, in most languages you just have to keep track of it manually. And whenever the rust compiler gives an error, you would most likely have had a future issue in another language. For gc languages, this may still exist if you share data between threads, causing possilbe race conditions and data corruption. So, the ownership/borrow model is just a formalization of implicit rules that exists in most languages.

[–] [email protected] 5 points 2 years ago

I see where you come from. I first turned to Go, but at the end of the day it was a nice language but it didn't tick my boxes. One of my main issues for backend servers, is for them to be robust. They should never fail in runtime. That means error handling is quite important, and as few runtime errors as possible. Go, fails this hard. The strictness of Rust, may be a pain while learning, and some syntax may be less than optimal, but the result will almost never fail in production. I have in fact never had a backend I wrote fail in production. The error handling also makes it easy to find any errors due to things out of my control. I switched a project from Java to Rust, and the log shrunk by a factor 10.

Note, I still use Go sometimes, but it is not my go to language. And on a second note, that you point to .unwrap() indicates that you never really used rust to write a backend, since use of .unwrap() will panik if you use that. You normally use .unwrap_or(...) or some other better construct. Also, complaining about unwrap() would indicate that you prefer a null pointer issue? Because, dropping null/nil is one of the great design choices, having null/nil is just a recepie for getting a runtime crash.

[–] [email protected] 1 points 2 years ago* (last edited 2 years ago) (1 children)

wouldn't it be better to use #[cfg(target_os = "windows")] instead of checking an env variable?

Reference: https://doc.rust-lang.org/rust-by-example/attribute/cfg.html

[–] [email protected] 6 points 2 years ago (1 children)

So, Linux is written by system programmers for system programmers.

This must be one of the most uninformed comment in a long time. Already 2001, there was quite a lot of UI work being done by the company Eazel, founded by Andy Hertzfeld who from Apple and with a bunch of former Apple people. Around the same time, Ximian (I think) was pushing project Utopia with the idea to form project teams of people from kernel devs up to UX, to ensure common tasks worked out of the box. One result of this is that printer configuration on Linux is a much easier than on any other OS. This all happened 20+ years ago, there have been quite a lot of UX people involved after that. And my experience is that people with little prior knowledge have an easier time with a modern Gnome desktop, than with Windows. The problem here is that most people know Windows to some extent, and are used to the weird quirks there, but any slight inconvenience on a new OS make them quit.

[–] [email protected] 7 points 2 years ago (1 children)

So, I will finally be able to drop some deps and use the built-in chown. Nice!

view more: ‹ prev next ›