Luis Chamberlain <mcgrof@xxxxxxxxxx> writes: > On Wed, May 03, 2023 at 11:06:57AM +0200, Andreas Hindborg wrote: >> The statistics presented in my previous message [1] show that the C null block >> driver has had a significant amount of memory safety related problems in the >> past. 41% of fixes merged for the C null block driver are fixes for memory >> safety issues. This makes the null block driver a good candidate for rewriting >> in Rust. > > Curious, how long does it take to do an analysis like this? Are there efforts > to automate this a bit more? We have efforts to use machine learning to > evaluate stable candidate patches, we probably should be able to qualify > commits as fixing "memory safety", I figure. > > Because what I'd love to see is if we can could easily obtain similar > statistics for arbitrary parts of the kernel. The easiest way to break > this down might be by kconfig symbol for instance, and then based on > that gather more information about subsystems. > I spent around 4 hours with a spreadsheet and git. It would be cool if that work could be automated. It's not always clear from the commit heading that a commit is a fix. When it is clear that it is a fix, it might not be clear what is fixed. I had to look at the diff quite a few commits. There is some work mentioning the ratio of memory safety issues fixed in the kernel, but none of them go into details for specific subsystems as far as I know. 20% of bugs fixed in stable Linux Kernel branches for drivers are memory safety issues [1]. 65% of recent Linux kernel vulnerabilities are memory safety issues [2] > Then the rationale for considerating adopting rust bindings for certain areas > of the kernel becomes a bit clearer. As mentioned elsewhere in this thread there are other benefits from deploying Rust than provable absence of memory safety issues. Best regards Andreas [1] http://dx.doi.org/10.15514/ISPRAS-2018-30(6)-8 [2] https://lssna19.sched.com/event/RHaT/writing-linux-kernel-modules-in-safe-rust-geoffrey-thomas-two-sigma-investments-alex-gaynor-alloy