In this paper we consider a family of generalized Korteweg--de Vries equations and study the linear modulational instability of small amplitude traveling wave solutions. Under explicit nondegeneracy conditions on the dispersion relation, we completely describe the spectrum near the origin of the linearized operator at such solutions and prove that the unstable spectrum (when present) is composed of branches depicting always a closed ``figure 8."" We apply our abstract theorem to several equations such as the Whitham, the gravity-capillary Whitham, and the Kawahara equations, confirming that the unstable spectrum of the corresponding linearized operators exhibits a figure 8 instability, as was observed before only numerically. Our method of proof uses a symplectic version of Kato's theory of similarity transformation to reduce the problem to determining the eigenvalues of a 3 \times 3 complex Hamiltonian and reversible matrix. Then, via a block-diagonalization procedure, we conjugate such matrix into a block-diagonal one composed of a 2 \times 2 Hamiltonian and reversible matrix, describing the unstable spectrum, and a single purely imaginary element describing the stable eigenvalue.