lapisnev

Don't squeeze me, I fart

Things that make you go 🤌. Weird computer stuff. Artist and general creative type. Occasionally funny. Gentoo on main. I play rhythm games!

Inkscape Monofur font Cohost PLUS!

You can post SVG files like photos on this website! Spread the word!


DecayWTF
@DecayWTF

but I can. I do it all the time. Works great. Don't try to drag everyone down with you.


DecayWTF
@DecayWTF

x86 has the interrupt vector table at 0000:0000 in real mode and the first entry is the address for the divide by zero CPU exception handler, which is attached by DOS (or whatever OS) to a handler that kills the running program. Couple that with no memory protection, and reading from a null pointer will give you some quasi-random values that are essentially static at runtime. Even better, writing to it not only works fine but until and unless a program actually triggers a divide-by-zero, it will continue to work fine and you can read back what was written, no problem. The upshot of this is that for small values (anything smaller than 32-bits) you can read and write to a null pointer's target just fine and you'll never notice a problem until at some point (probably long after the program that stomped the address is no longer running and you're doing something else) when a divide-by-zero triggers and the interrupt jumps off into deep space.



You must log in to comment.

in reply to @atax1a's post:

and SysVr4 explicitly has a readable page starting at 0 (as, indeed, does linux with personality(2) MMAP_PAGE_ZERO; this may even be one of the very few remaining flags you can use for their intended purpose post-axing since R4 had ELF)