So I was reading a title called Terraforming: The Creation of Habitable Worlds and came across mention of the idea that sulfur dioxide was a greenhouse gas on Mars. This can't be a mistake because I saw it elsewhere, like here. And yet at the beginning of that same book there is a scenario in which artillery is being used to launch sulfur dioxide into the Earth's upper stratosphere to serve as a cooling agent. How can these two things be the case?
This is a partial answer. It is important to understand that the greenhouse effect is exclusively a tropospheric phenomenon, because of the sign of the lapse rate — it relies on temperatures decreasing with elevation. Nothing we add in the stratosphere is going to act as a greenhouse gas there.
Thermal radiation emitted by the Earth surface and lower troposphere is partially absorbed in the upper troposphere by CO₂, CH₄, H₂O, and other species. The upper troposphere is almost always much colder than the surface or lower troposphere. Like anything else, it will in turn emit thermal radiation, but due to its lower temperature, the radiation emitted to space is much less than what was originally emitted by the surface. It all balances out because temperatures change until there is equilibrium.
In the stratosphere, however, temperature increases with elevation. Therefore, there can be no greenhouse effect here. Species in the stratosphere have other effects. Ozone absorbs UV which protects us on the surface from nasty radiation, but also somewhat reduces energy input. If we inject species absorbing longwave radiation, those emit thermal radiation at a higher temperature than at lower layers. They also have much less mass, though; so the direct effect on the Earth surface will be small. I will leave it to other answers how exactly sulphur dioxide may act as a cooling agent.