news.volyx.in

11 year old unsoundness bugs found in Rust borrow checker (github.com)

746 points by formerly_proven · 5 days ago · 442 comments on HN

Article summary

A 11-year-old unsoundness bug has been found in the Rust borrow checker, which can be exploited to access memory after it has been freed. The bug is related to the lifetime requirements of structs and can be triggered by a malicious Drop implementation. The issue has been reported and is being worked on by the Rust team. The bug is considered high-priority but not critical, as it is difficult to exploit and has not been encountered in the wild before.

Main themes

  • Rust borrow checker
  • unsoundness bug
  • lifetime requirements
  • custom Drop implementations
  • language safety
  • complexity vs safety
  • testing and review

What commenters say

  • The bug is surprising because it is simple and could be encountered in normal code, but it has gone unnoticed for 11 years.
  • Custom Drop implementations are not uncommon in Rust, especially when working with FFI code or resources that need to be released.
  • The bug does not necessarily mean that Rust is an unsafe language, but rather that it is a complex language with edge cases that can be exploited.
  • The fact that the bug has gone unnoticed for so long suggests that it may not be a common pattern in Rust code, but it is still a serious issue that needs to be addressed.
  • The discovery of the bug highlights the importance of testing and reviewing code, even in languages that are designed to be safe and secure.
  • Some argue that the bug is not a major concern because it requires a specific and unusual pattern of code to exploit, while others believe that it is a significant issue that undermines the safety guarantees of the language.
  • The bug has sparked a discussion about the trade-offs between language complexity, safety, and performance, with some arguing that Rust's safety features come at the cost of complexity and others arguing that they are essential for building reliable software.