4 ms·
> We've all heard the ghost stories about undefined C programs that delete hard disks Exactly that one. Someone at some job had written a Linux kernel driver -
by Matthias247 7y ago
> We've all heard the ghost stories about undefined C programs that delete hard disks
Exactly that one. Someone at some job had written a Linux kernel driver - for a subsystem which was definitely not related to any disk IO. This driver had a bug and was subject to a race condition which it lead it in some cases to write to memory which it didn't own. That caused hard drive corruptions on some devices.
I also had another one in an embedded software project: A "filesystem" on the flash memory got corrupted for multiple reasons: The responsible code was missing synchronization - if two threads would be writing at the same time the result was basically undefined. And it also missed checks for dynamic memory allocation failures, and would then to undefined things.
Debugging all those issues had not been particularly fun, and made me a firmer believer in safer programming languages.