ahya related to me from Malik that he had heard that AIi ibn AbiTalib used to rest his head on graves and lie on them.Maliksaid, "As far as we can see ,it is only forbidden to sit on graves torelieve oneself."
USC-MSA web (English) reference: Book 16, Hadith 34
Arabic reference: Book 16, Hadith 556