The Chromium project will support the use of Rust libraries

Chromium

, the Chromium project will support the use of third-party C++ Rust libraries in Chromium

Google unveiled news recently that the team behind the Chromium project is working on adding a Rust toolchain from production to your build system.

For those who are still unaware of Rust, they should remember it well because this programming language, which was developed by Mozilla specifically for use in writing a browser, has begun to seep in and be accepted within many important projects, one of them being the Rust Kernel. Linux.

This will allow us to include the Rust code in the Chrome binary over the next year. The goal is to start small and set clear expectations for which libraries will be considered when they are ready.

So it stands to reason that Chromium is finally starting to roll out that technology as well. For Google, the introduction of Rust in Chromium will fulfill the objective of providing an easier and safer way to comply with the rule of two, which is to speed up development and improve the security of Chrome, in addition to improving security, removing memory errors and reducing the density of errors in the code.

We know that C++ and Rust can work very well together, thanks to tools like cxx, autocxx bindgen, cbindgen, diplomat, and (experimental) crubit. However, there are also limitations. We can expect the shape of these limitations to change over time with new or improved tools, but the decisions and descriptions here are based on the current state of technology.

Decision was taken as part of an initiative to prevent memory errors from appearing in the Chrome codebase. According to statistics provided two years ago, 70% of critical and dangerous security issues in Chromium are due to memory errors.

The use of the Rust language, which focuses on safe memory management and provides automatic memory management, it will reduce the risk of vulnerabilities caused by issues such as accessing an area of ​​memory after it has been freed and buffer overflow.

The goal of bringing Rust to Chromium is to provide an easier (no IPC) and safer (less complex C++ in general, no sandboxed memory safety bugs) way to satisfy the rule of two, in order to speed up development (less code to write, fewer design documents, fewer security patches) and to improve security (more lines of code with no security bugs in memory, lower code bug density) of Chrome. Additionally, the company is confident that we can use third-party Rust libraries to achieve this goal.

In early 2022, the Chromium team had already experimented with Rust and, after a few months, came to the conclusion that the language is initially unsuitable as a C++ replacement for complex tasks with asynchronous code that must work alongside existing code.

Therefore, planned use of Rust in Chromium is clearly limited at first. For one thing, interop will only go one way: from C++ to Rust. On the other hand, initially only the use of third-party libraries is allowed. These work as standalone components and are independent of Chromium's internal components. Libraries should have a simple API for your specific task. The Chromium team will then examine the libraries.

Finally, it is worth mentioning that as such adding support in Chromium will allow Rust code to port into Chrome binaries starting next year. The decision mainly looks at the issue of security: Rust offers greater security when writing to memory than C++ and prohibits potentially harmful behaviors such as reading unwritten variables, accessing beyond the limits set by arrays, dereferencing null or invalid pointers, the use of overridden iterators.

If you are interested in knowing more about it, you can consult the details In the following link.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.