On model selection consistency of penalized M-estimators: a geometric theory