the quarks have it own (rest) mass, but quite tiny compared to when you include binding energy (9 Mev vs 900 Mev)
Edit: More explanation: If you take the quark masses as unbound rest mass, it's not clear why the proton is bound -- it would have higher energy (=mass) than the unbound constituents. This is different from atoms, as a hydrogen atom has slightly less mass than the sum of a free proton and free electron (13.6eV in the ground state).