  We determine non-perturbatively the normalisation factor $r_\mathrm{m}\equiv
Z_{\rm S}/Z_{\rm S}^{0}$, where $Z_{\rm S}$ and $Z_{\rm S}^{0}$ are the
renormalisation parameters of the flavour non-singlet and singlet scalar
densities, respectively. This quantity is required in the computation of quark
masses with Wilson fermions and for instance the renormalisation of nucleon
matrix elements of scalar densities. Our calculation involves simulations of
finite-volume lattice QCD with the tree-level Symanzik-improved gauge action,
$N_\mathrm{f} = 3$ mass-degenerate $\mathrm{O}(a)$ improved Wilson fermions and
Schr\"odinger functional boundary conditions. The slope of the current quark
mass, as a function of the subtracted Wilson quark mass is extracted both in a
unitary setup (where nearly chiral valence and sea quark masses are degenerate)
and in a non-unitary setup (where all valence flavours are chiral and the sea
quark masses are small). These slopes are then combined with $Z \equiv Z_{\rm
P}/(Z_{\rm S}Z_{\rm A})$ in order to obtain $r_\mathrm{m}$. A novel chiral Ward
identity is employed for the calculation of the normalisation factor $Z$. Our
results cover the range of gauge couplings corresponding to lattice spacings
below $0.1\,$fm, for which $N_\mathrm{f} = 2+1$ QCD simulations in large
volumes with the same lattice action are typically performed.
