Solution (source code)

= Solution

Let $x$ be the signed distance from the <Earth>'s centre along the polar tunnel, with $x(0)=r_0$ and $\dot x(0)=0$. The <shell theorem> leaves only the enclosed <mass> $4\pi\rho|x|^3/3$ contributing to the <gravitational field>. Consequently
$$
\ddot x=-\frac{4\pi G\rho}{3}x=-\frac{g}{r_0}x,\qquad g=\frac{4\pi G\rho r_0}{3}.
$$
This is <simple harmonic motion> with $\omega=\sqrt{g/r_0}$ and $x=r_0\cos(\omega t)$. Crossing the centre takes a quarter-period; reaching the opposite surface takes a half-period:
$$
\boxed{t_{\rm cross}=\pi\sqrt{\frac{r_0}{g}}=\sqrt{\frac{3\pi}{4G\rho}}.}
$$
The body's <mass> cancels. The polar diameter lies on the rotation axis, so the tunnel motion has no additional <centrifugal force> or <Coriolis force> from the <Earth>'s rotation. A realistic radial density profile would change the harmonic equation.