[sgen] Fix pinning in the presence of canaries.