According to the Hohenberg-Kohn theorem of density-functional theory (DFT), all observable quantities of systems of interacting electrons can be expressed as functionals of the ground-state density. This includes, in principle, the spin polarization (magnetization) of open-shell systems; the explicit form of the magnetization as a functional of the total density is, however, unknown. In practice, open-shell systems are always treated with spin-DFT, where the basic variables are the spin densities. Here, the relation between DFT and spin-DFT for open-shell systems is illustrated and the exact magnetization density functional is obtained for the half-filled Hubbard trimer. Errors arising from spin-restricted and -unrestricted exact-exchange Kohn-Sham calculations are analyzed and partially cured via the exact magnetization functional.