1 Fearless Security: Memory Security Mozilla Hacks the Online Developer Weblog
Connie Phifer edited this page 1 month ago


Last yr, Mozilla shipped Quantum CSS in Firefox, which was the culmination of eight years of investment in Rust, a memory-protected systems programming language, and over a 12 months of rewriting a significant browser element in Rust. Pandora’s box of vulnerabilities. Rust not only prevents these sorts of errors, but the methods it makes use of to do so additionally stop information races, allowing programmers to cause more effectively about parallel code. In the coming weeks, Memory Wave this three-part series will look at memory safety and thread safety, and close with a case examine of the potential security advantages gained from rewriting Firefox’s CSS engine in Rust. When we speak about constructing safe applications, Memory Wave we frequently focus on memory safety. Informally, this means that in all attainable executions of a program, there is no such thing as a entry to invalid memory. For a extra formal definition, see Michael Hicks’ What's memory safety submit and The Meaning of Memory Safety, a paper that formalizes memory safety.


Memory violations like these can cause programs to crash unexpectedly and can be exploited to change meant habits. Potential consequences of a memory-associated bug embrace data leakage, arbitrary code execution, and remote code execution. Memory management is crucial to both the performance and the safety of applications. This part will discuss the fundamental memory mannequin. One key concept is pointers. A pointer is a variable that shops a memory deal with. If we go to that memory address, there can be some data there, so we say that the pointer is a reference to (or factors to) that data. Just like a house handle exhibits people where to find you, a memory tackle exhibits a program where to search out data. Every little thing in a program is situated at a selected memory address, together with code directions. Pointer misuse may cause serious safety vulnerabilities, including data leakage and arbitrary code execution. When we create a variable, the program must allocate enough house in memory to retailer the data for that variable.


Since the memory owned by every course of is finite, we additionally need some manner of reclaiming resources (or freeing them). When memory is freed, it turns into obtainable to retailer new information, but the previous knowledge can nonetheless exist till it is overwritten. A buffer is a contiguous area of memory that shops a number of instances of the identical data kind. For example, the phrase "My cat is Batman" would be saved in a 16-byte buffer. Buffers are outlined by a beginning memory address and a length