Stability of rock on beaches