There's really no limiting factor on how long we could stay there if we brought enough supplies with us and we had regular resupplies. Humans really only need food, water, and oxygen to survive. Via nuclear reactors, we have the technology and engineering to provide sufficient power to a base to provide heating and the power necessary to break ice into hydrogen and oxygen. MOXIE (Mars OXygen In situ resource utilization Experiment) is an experiment whose technology is Earth-proven, and which will be going on the 2020 Mars Rover to verify that it functions on Mars. It utilizes CO2 from the Martian atmosphere to produce Oxygen. However, as you mention, we could just use the ice to obtain this. The ice would also provide water.
That only leaves food, and growing food hydroponically is a very well-known science on Earth. Thanks to the ISS, we even have experience growing food hydroponically in an effectively zero gravity environment. Plants will certainly react differently to the low-gravity environment, but we could take a wide selection of seeds, and could likely very easily grow enough fruits and vegetables and legumes to keep humans alive. Plants are extremely hardy, and if given enough water, light (via LEDs), and nitrogen (which would have to be brought with us initially), they would thrive.
The problems we have to solve are not technological, they are engineering. The first thing we have to do is get there. We do not have a human-rated rocket which can send a sizable payload to Mars. The Falcon Heavy is certainly capable of sending a payload there, but the rocket would need to be human-rated, which basically means tested far more extensively than it has been now. After that, we would need a capsule which could sustain astronauts for the voyage; capable of protecting them from radiation, growing or storing sufficient food, recycling water, etc. The second thing we have to do is get them landed. The heaviest payload we're capable of landing on Mars with an existing (and active) lander is Curiosity, which is about 3900kg. This isn't nearly enough weight. For reference, the Lunar Lander was about 15,200kg, and this was not for a permanent base but for a small box for two astronauts, landing on a much smaller body with no atmosphere.
However, as I mentioned, these are engineering challenges not technological ones. We have the technology to build a large spacecraft. Indeed, something like the ISS would be more than capable of sustaining our astronauts for the flight to Mars, although we would want to build some better radiation shielding for the interplanetary journey. We have the technology to do a powered descent of a sizable payload onto Mars, we'd just have to design and build the lander.
Had the US desired to continue their funding of the Apollo program and the Saturn V rocket, we could have had a Martian landing in the 1980s. The technology existed then, and indeed the Saturn V of that era had a larger lift capacity than our most powerful rocket in production today. We could certainly do it with modern technology, we'd just have to fund, design, test, and build the rocket and lander to get us there. But in terms purely of survival, the technologies we'd need to survive (nuclear power, electrolysis, and hydroponics) have been available for more than half a century.
edit
and add that back in? Stack Exchange posts are "living documents" to some extent and can be modified, adjusted and updated to clarify and improve value, as long as this doesn't conflict with the author's intent. Now that there is an answer, you shouldn't change the question, but adding that wouldn't change it. $\endgroup$