The gasket completely twisted up last time we opened the sunroof. Water had gotten under the gasket and the rust caused it to pop out of its seal. The sunroof began leaking when it rained.
Before I went and bought a new gasket it looked to me like this was an easy repair. I removed the four screws holding the sunroof in and brought it into the garage. I brushed off all the rust bubbles then made sure that the gasket would slip back into the channel and lay flat. I needed to use a flat headed screwdriver to help push the gasket into the channel.
I pulled the gasket back out and filled the channel with some silicone sealant before pressing the gasket back in neatly all the way along the back. I then reinstalled the sunroof.