GMASS ultradeep spectroscopy of galaxies at z ~ 2 I. the stellar metallicity