by basementcat · 3y ago · 0 comments
EDIT: Actually a fix may not be impossible as 2BSD makes use of the PDP11's ability to have a 64kB text bank and a distinct 64kB data bank. I suspect this may require a major redesign.
well, it was a consequence of vulnerabilities like this that CPUs added the capability to mark areas of memory as non-executable, more or less an extension of protected modes that separated different users.
The original von neumann idea that you could execute wherever the program counter was pointing was absolutely "feature" if not "obviously". The harvard architecture separating code and data space was "twice the address space in the same number of bits" beyond its "well the buses are separate anyhow"
Also, W^X would not really help there, as what gets overwritten is return address on stack, which is simply data and does not get executed. You would need some kind of stack canaries or control-flow integrity to catch that, which is probably somewhat complicated by the fact that it is in main(). (And also, on PDP-11 overhead of such schemes will probably be significant)