I think we can definitely rule out carbon dioxide. Mars' atmosphere has a pressure of 0.007 times that of Earth, or 0.007 atm or 700 Pa. At this pressure, carbon dioxide could be solid only at extremely low temperature, close to absolute zero. Even if it could survive underground as ice, it would sublimate almost instantly when coming in contact with the Martian atmosphere.
Water, can exist as ice, because its triple point is at 0.006 atm (almost the pressure of Mars' atmosphere) and about 0 degrees Celsius. This would allow water to sublimate if the temperature rose enough.
This is where I got my info on water and carbon dioxide (I got the atmospheric pressure on Mars from a book):
http://www.uiowa.edu/~c004131a/Phase_Diagrams.html