The simplest solution? Jettison a dead body into the vacuum of space. Kind of like burial at sea for sailors. However, that is prohibited by international agreement.
So, here is the proposed solution. If an astronaut dies while in route to Mars, NASA plans to put the body in a special bag that can be exposed to outer space. The body would freeze and be brought back into the spacecraft where it would be vibrated thereby causing the remains to be ground into a fine dust.
What happens to the “dust”? If someone dies while on Mars, NASA is discussing using the remains as compost for the crops settlers would grow.
Of course, human settlers on Mars would also have estate planning issues that need to be worked out, especially if they want to leave property on Mars to a relative living on Earth.
Needless to say, that is yet another difficult problem that NASA will need to work out.