Re:Debugging memory corruption: who the hell writes “2” into...
by anaisbetts on Sunday November 14, 2021 @08:53AM
(#29217167)
> With that said, is there not a valgrind equivalent for Windows?
Yep, it's called Application Verifier and it will check all kinds of system calls and make the memory allocator incredibly aggro towards checking validity
> The other thing is, how can a system call block a thread but somehow that same thread runs other stuff in between that blocking call?
When you call select(), your thread is in a special state called Alertable Wait; one way to get out of it is to have an APC queued to your thread, which has a similar vibe to a UNIX signal (with all of the similar caveats about how easy it is to fuck things up in it). Basically, OP's scenario is similar to corruption caused by a badly written signal handler
Yep, it's called Application Verifier and it will check all kinds of system calls and make the memory allocator incredibly aggro towards checking validity
> The other thing is, how can a system call block a thread but somehow that same thread runs other stuff in between that blocking call?
When you call select(), your thread is in a special state called Alertable Wait; one way to get out of it is to have an APC queued to your thread, which has a similar vibe to a UNIX signal (with all of the similar caveats about how easy it is to fuck things up in it). Basically, OP's scenario is similar to corruption caused by a badly written signal handler