I wrote driver to a research OS as a university project. The system behave weird in some subtle ways, and I assumed that's my fault, as an inexperienced programmer.

After two sleepless weeks of chasing ghosts, I've realized that for some reason there is a context-switch that *did not* involve the scheduler! Further investigation led to the actual bug: the main trap code in the kernel was maskerading as different process just to be able to work on its virtual address, but never put that mask off!

It could have been found easily by a static analysis tool, given that a non-volatile global variable was only written to and never read; but we didn't use any.

Add Comment