I'm in an operating systems class. Coming up, we have to do some work modifying kernel code. We have been advised not to use personal machines to test (I suppose this means install it) as we could write bad code and write over somewhere we shouldn't. We are given access to a machine in a lab to be safe. If I were to test using a VM, would that protect the host system from potentially unsafe code? I really want to not have to be stuck to a system at school and snapshots will be useful. If it is still high risk, any suggestions on what I need to consider to test safely?We will be using something like linuxmint to start with. If anyone wants to see what will be in the current project: http://www.cs.fsu.edu/~cop4610t/assignments/project2/writeup/specification.pdf 
Is developing/testing a linux module safe using a virtual machine?
linux;kernel modules;virtual machine
The main risks developing kernel modules are that you can crash your system much more easily than with regular code, and you'll probably find that you sometimes create modules that can't be unloaded which means you'll have to reboot to re-load them after you fix what's wrong.Yes, a VM is fine for this kind of development and it's what I use when I'm working on kernel modules. The VM nicely isolates your test environment from your running system.If you're going to take and restore snapshots, you should keep your source code checked in to a version control repository outside the VM so you don't accidentally lose your latest code when you discard the VM's current state.