We consider the acceleration of charged particles at the ultrarelativistic
shocks, with Lorentz factors Gamma(s) much greater than 1 relative to the u
pstream medium, arising in relativistic fireball models of gamma-ray bursts
(GRBs). We show that for Fermi;type shock acceleration, particles initiall
y isotropic in the upstream medium can gain a factor of order Gamma(s)(2) i
n energy in the first shock-crossing cycle, but that the energy gain factor
for subsequent shock-crossing cycles is only of order 2, because for reali
stic deflection processes particles do not have time to become isotropic up
stream before recrossing the shock.
We evaluate the maximum energy attainable and the efficiency of this proces
s, and show that for a GRB fireball expanding into a typical interstellar m
edium, these exclude the production of ultra-high-energy cosmic rays (UHECR
s), with energies in the range 10(18.5)-10(20.5) eV, by the blast wave. How
ever, we propose that in the context of neutron-star binaries as the progen
itors of GRBs, relativistic ions from the pulsar-wind bubbles produced by t
hese systems could be accelerated by the blast wave. We show that if the kn
own binary pulsars are typical, the maximum energy, efficiency and spectrum
in this case can account for the observed population of UHECRs.