History of Null Pointer Dereferences on macOS
afine.com
afine.com
//clang -o null_dereference null_dereference.c
#include <stdio.h>
int main() {
int *ptr = NULL; // Initialize a pointer to NULL
int value = *ptr; // Attempt to dereference the NULL pointer
printf("Value: %d\n", value); // This line will reached, because the previous will be optimized away.
return 0;
}
Example, https://godbolt.org/z/Kv3rcz1chOn ARM64, PAGEZERO's size cannot be made smaller than 4 GiB.
There is nothing in the standard that says that NULL must be 0.
We don't code for things like PDP-11 or Honeywell mainframes all that often.
We hear a lot these days from the (very much in-the-open) debate over how much (if any) of the Linux kernel should be rewritten in Rust for memory safety.
But does anyone know if a similar debate is also going on inside Apple re: XNU/Darwin, or within Microsoft re: NTOS? (Maybe not using Rust in particular, but some other memory-safe systems language?)
I don't know about Apple. I'd expect them to go for Swift rather than Rust, but Darwin doesn't seem to include any such code yet.
Linux is full of C developers who don't want anything to do with Rust actively working against the current Rust for Linux experiment. I expect Linux to end up lagging behind Apple and Microsoft in this area because of the difference in organisational structure and priorities.
Idk if the xnu kernel will adopt those but it seems most likely.
See https://www.nesdev.org/obelisk-6502-guide/addressing.html
Edit: Seems good half an hour later!