《贾晓宇-Building Linux Distribution from Scratch with Rust.pdf》由会员分享,可在线阅读,更多相关《贾晓宇-Building Linux Distribution from Scratch with Rust.pdf(19页珍藏版)》请在三个皮匠报告上搜索。
1、第三届中国Rust开发者大会Building Linux Distribution from Scratch with RustSpeaker:Jia XiaoyuCONTENTSWhy choose rust?Using Rust and LFS build linux distroO2What rkos brings us?Why do we choose Rust?Why do we choose Rust?PhoTto/image/chartWhy do we want to use Rust to build most of the things in the Operating s
2、ystem?1.If you have a very large(millions of lines of code)codebase,written in a memory-unsafe programming language(such as C or C+),you can expect at least 65%of your security vulnerabilities to be caused by memory unsafety.2.Security issues can happen not only in the kernel,but also in the whole s
3、ystem,which includes the kernel and the system software.Why do we choose rust?The number of vulnerabilities by type in the GNU since 1999(data from:CVE Details)What rust-related things have happened in the kernel since the release of kernel 6.1?Linux 6.1:Officially Adds Support for Rust in the Kerne
4、lKernel internals(kallsyms expansion for Rust symbols,%pA format)Kbuild infrastructure(Rust build rules and support scripts)Rust crates and bindings for initial minimum viable buildRust kernel documentation and samplesPossible to create hello world moduleWhy do we choose rust?Linux 6.1Linux 6.4:What
5、 are the important updates?Linux 6.2:New:#vtable,declare_err!(),dbg!Linux 6.3:New:Some new type,new trait and alloc crate remove borrow moduleLinux 6.4:New :pin-init APIWhy do we choose rust?Using Rust and LFS build linux distroHow to build rust support Kernel?Require:rustc,rust-src(cross-compile co
6、re and alloc),rust-bindgenllvm(clang)make LLVM=1 rustavailablemake CC=clang rustavailableCompile kernelmake LLVM=1(CC=clang)rustavailableenbale Rust support in the General setupOther thinggccrs in developmentHapping HackingUsing Rust and LFS build linux distroBenefits of using LFS to build linuxdist