  [abridged] We aim to constrain the stellar initial mass function (IMF) during
the epoch of reionization. To this purpose, we build up a semi-empirical model
for the reionization history of the Universe, based on various ingredients: the
latest determination of the UV galaxy luminosity function from JWST out to
redshift $z\lesssim 12$; data-inferred and simulation-driven assumptions on the
redshift-dependent escape fraction of ionizing photons from primordial
galaxies; a simple yet flexible parameterization of the IMF $\phi(m_\star)\sim
m_\star^\xi\, e^{-m_{\star,\rm c}/m_\star}$ in terms of a high-mass end slope
$\xi<0$ and of a characteristic mass $m_{\star,\rm c}$ below which a flattening
or a bending sets in; the PARSEC stellar evolution code to compute the UV and
ionizing emission from different star's masses as a function of age and
metallicity; a few physical constraints related to stellar and galaxy formation
in faint galaxies at the reionization redshifts. We compare our model outcomes
with the reionization observables from different astrophysical and cosmological
probes, and perform Bayesian inference on the IMF parameters. We find that the
IMF slope $\xi$ is within the range from $-2.8$ to $-2.3$, while appreciably
flatter slopes are excluded at great significance. However, the bestfit value
of the IMF characteristic mass $m_{\star,\rm c}\sim$ a few $M_\odot$ implies a
suppression in the formation of small stellar masses, at variance with the IMF
in the local Universe; this may be induced by the thermal background $\sim
20-30$ K provided by CMB photons at the reionization redshifts. Finally, we
investigate the implications of our reconstructed IMF on the recent JWST
detections of massive galaxies at and beyond the reionization epoch, showing
that any putative tension with the standard cosmological framework is
substantially alleviated.
