OSDev.org
https://forum.osdev.org/

Null pointers and pointer safety
https://forum.osdev.org/viewtopic.php?f=15&t=31950
Page 4 of 4

Author:  StudlyCaps [ Wed May 31, 2017 8:47 pm ]
Post subject:  Re: Null pointers and pointer safety

goku420: I was more thinking of a static analysis situation where you're trying to find out before starting a program if it will fault or not. In that case you'd have to have to do some type of state machine analysis to determine if the variable will be valid in all cases when the code actually runs.

Author:  goku420 [ Wed May 31, 2017 9:09 pm ]
Post subject:  Re: Null pointers and pointer safety

StudlyCaps wrote:
goku420: I was more thinking of a static analysis situation where you're trying to find out before starting a program if it will fault or not. In that case you'd have to have to do some type of state machine analysis to determine if the variable will be valid in all cases when the code actually runs.


This would only work for degenerate cases like null pointer dereferences, otherwise like you said it is essentially the halting problem. However, the behavior of your page fault handler ultimately doesn't matter since the danger in invalid pointers comes from type punning, violating strict aliasing, out of bounds, etc. The latter three cases are easily caught by static analyzers.

Author:  StudlyCaps [ Wed May 31, 2017 11:02 pm ]
Post subject:  Re: Null pointers and pointer safety

You misunderstand me I think. I'm deliberately giving an example of something that won't work (or that isn't practical)! Someone earlier in the thread proposed that all binaries could be statically analysed by the OS and that programs which have unsafe pointer use can just not be run, making the system more stable. I was giving a counter example to say, in this case, that isn't feasible.

Page 4 of 4 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/