Safety and stabilizability conditions for switching linear systems