{"id":32143,"date":"2021-04-15T14:30:35","date_gmt":"2021-04-15T18:30:35","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=32143"},"modified":"2021-04-15T14:30:35","modified_gmt":"2021-04-15T18:30:35","slug":"rust-support-in-the-linux-kernel","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2021\/04\/15\/rust-support-in-the-linux-kernel\/","title":{"rendered":"Rust Support in the Linux Kernel"},"content":{"rendered":"<p><a href=\"https:\/\/lkml.org\/lkml\/2021\/4\/14\/1023\">Miguel Ojeda<\/a>:<\/p>\n<blockquote cite=\"https:\/\/lkml.org\/lkml\/2021\/4\/14\/1023\">\n<p>Please note that the Rust support is intended to enable writing\ndrivers and similar &ldquo;leaf&rdquo; modules in Rust, at least for the\nforeseeable future. In particular, we do not intend to rewrite\nthe kernel core nor the major kernel subsystems (e.g. <tt>kernel\/<\/tt>,\n<tt>mm\/<\/tt>, <tt>sched\/<\/tt>...). Instead, the Rust support is built on top\nof those.<\/p>\n<p>[&#8230;]<\/p>\n<p>By using Rust in the Linux kernel, our hope is that:<\/p>\n<ul>\n<li>New code written in Rust has a reduced risk of memory safety bugs,\n    data races and logic bugs overall, thanks to the language\n    properties mentioned below.<\/li>\n<li>Maintainers are more confident in refactoring and accepting\n    patches for modules thanks to the safe subset of Rust.<\/li>\n<li>New drivers and modules become easier to write, thanks to\n    abstractions that are easier to reason about, based on modern\n    language features, as well as backed by detailed documentation.<\/li><\/ul>\n<\/blockquote>\n\n<p><a href=\"https:\/\/security.googleblog.com\/2021\/04\/rust-in-linux-kernel.html\">Wedson Almeida Filho<\/a>:<\/p>\n<blockquote cite=\"https:\/\/security.googleblog.com\/2021\/04\/rust-in-linux-kernel.html\"><p>In our <a href=\"https:\/\/security.googleblog.com\/2021\/04\/rust-in-android-platform.html\">previous post<\/a>, we announced that Android now supports the <a href=\"https:\/\/www.rust-lang.org\">Rust<\/a> programming language for developing the OS itself. Related to this, we are also participating in the effort to evaluate the use of Rust as a supported language for developing the Linux kernel. In this post, we discuss some technical aspects of this work using a few simple examples.\n<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Miguel Ojeda: Please note that the Rust support is intended to enable writing drivers and similar &ldquo;leaf&rdquo; modules in Rust, at least for the foreseeable future. In particular, we do not intend to rewrite the kernel core nor the major kernel subsystems (e.g. kernel\/, mm\/, sched\/...). Instead, the Rust support is built on top of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2021-04-15T18:30:38Z","apple_news_api_id":"a71f3a7d-c2e7-40cf-868b-56824a5f9b9f","apple_news_api_modified_at":"2021-04-15T18:30:38Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/Apx86fcLnQM-Gi1aCSl-bnw","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[248,448,71,408],"class_list":["post-32143","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-android","tag-linux","tag-programming","tag-rust-lang"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/32143","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=32143"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/32143\/revisions"}],"predecessor-version":[{"id":32144,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/32143\/revisions\/32144"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=32143"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=32143"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=32143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}