A geometric characterization of viable sets for controlled degenerate diffusions