There is a programming language that only came out in 2015, and in the past six years, amazon has sponsored it, Google has announced support for Android, and now Linux is adding it to the kernel, which is a real “big company pet”.
Guess what programming language this is? The answer: Rust!
Last month, Linux announced linux-Next’s initial support for Rust, prompting Linus Torvalds, the father of Linux, to “wait and see” about Rust’s entry into the Linux kernel.
This week, a mailing list from Linux kernel developer Miguel Ojeda is back in the spotlight: Adding Rust-supported RFC to the Linux kernel.
Post | CSDN: ryeo-won jeong
Product | CSDN (ID: CSDNnews)
In addition to releasing patches for the Linux kernel written in Rust, the email addresses both the pros and cons of the decision to support Rust and the concerns of developers, including:
Linux kernel developers’ determination to introduce Rust: Knowing that adding a second language to the kernel takes more effort and that modules written in Rust will be harder to replace even once Rust is no longer supported. Nonetheless, they argue that the advantages of introducing Rust outweigh the costs;
The purpose of adding Rust to Linux is to reduce the risk of memory security bugs and logic bugs, make it easier to write new drivers and modules as a modern programming language, and expand the participation of Linux kernel development.
In a kernel environment, Rust has advantages over C: a more stringent system reduces logical errors, a clear distinction between secure and unsafe code, and extensive independent standard libraries.
There are also some drawbacks to Rust: the current Linux kernel is more comfortable with C, relies on LLVM, and compilers are slow due to Rust being a young programming language, but there is room for improvement.
In addition, the email notes that, to date, the infrastructure is ready to support Rust in Linux kernels based on X86_64, ARM64, and PPC64LE, and other architectures and builds for Rust kernel support are progressing.
Details of the email can be viewed at lkml.org/lkml/2021/4…
Father of Linux: Not really
As for the content of the email, most people were supportive, and Linus again expressed some thoughts about it. While he does have some technical concerns about Rust getting into the Linux kernel, particularly the possibility that certain Rust configurations can cause crashes, he is generally “not annoying.”
He added that rather than the current base module, he would like to see some real examples of Rust as part of the proposal so that people can do something meaningful with it as real snippets of code.
Google: Strong support
Google, which recently announced support for Rust as an operating system for Android, is also supporting the introduction of Rust code into the Linux kernel (and previously joined Miguel Ojeda’s Rust for Linux organization). Wedson Almeida Filho, an engineer on Google’s Android team, posted a post about the incident on the official security blog.
Although C has been the language of choice for writing kernels for nearly half a century, memory security vulnerabilities still occur frequently, despite high-quality code, high standards of scrutiny, and thorough safeguards, the blog noted. For Android, kernel vulnerabilities are generally considered high-risk vulnerabilities.
As a result, Google said, “We believe Rust is now ready to join C as a practical language for developing kernels. It helps us reduce potential bugs and security vulnerabilities in privileged code, while keeping the core kernel in good shape and maintaining its performance characteristics.”
In addition, the article details some examples of how Rust helps kernel developers write safe and correct drivers and compares them to existing C language versions in terms of security and performance. Google has Rust support for almost all of the common kernel functionality required by Binder and is gathering feedback from the broader Linux kernel community in an effort to upstream existing Rust support.
Finally, Fil Ho looks forward to the addition of a second programming language to the Linux kernel: “This is an exciting moment and a rare opportunity that could affect the way the Linux kernel is developed and bode well for the Rust language.”
Linus actually supports Rust into the kernel
Google’s positive support and Linus’s more neutral attitude were also hotly debated.
@bug77 said:
“While Linus has some concerns about Rust, he’s actually in favor of adding Rust to the Linux kernel, because it’s normal to have concerns at this point.
Furthermore, the current discussion is not about including Rust in the kernel itself, but in kernel drivers. If there is a problem, it can be done at any time with minimal damage.
C is not going to go away for the next 10 to 20 years, but looking at Rust, it’s clear that it has evolved from a language that enthusiasts love to a language that big companies are starting to evaluate.”
The net friend @ ssokolow:
“Rust is more of a middle ground between C and C++ in terms of implicitly triggering complex behavior.”
Linux 5.13 looks imminent, and given Linus’ initial caution about Rust, it is unlikely that rust-related features will be introduced in this release. But if things go well in the future, we may see support for Rust in Linux 5.14. But it will be some time before Rust is officially supported, and C/C++ has an unshakeable place in writing computer kernels!
There is a saying that the best time to plant a tree is ten years ago, the next best is now. ** For learning programming or working friends, if you want to better improve your programming ability to help employment and even change industries, ** bend overtaking, fast one step! The author here may be able to help you ~
C language C++ programming learning exchange circle, **QQ group [951258402] ** wechat public number: C language programming learning base
Share (source code, project actual combat video, project notes, basic introduction tutorial)
Welcome to change careers and learn programming partners, use more information to learn and grow faster than their own thinking oh!
Programming learning video sharing: