Muwatta Malik, Book 16, Hadith 556 (In-Book) ⓘ
ahya related to me from Malik that he had heard that AIi ibn Abi Talib used to rest his head on graves and lie on them. Malik said, "As far as we can see,it is only forbidden to sit on graves to relieve oneself."
وَحَدَّثَنِي عَنْ مَالِكٍ، أَنَّهُ بَلَغَهُ أَنَّ عَلِيَّ بْنَ أَبِي طَالِبٍ، كَانَ يَتَوَسَّدُ الْقُبُورَ وَيَضْطَجِعُ عَلَيْهَا . قَالَ مَالِكٌ وَإِنَّمَا نُهِيَ عَنِ الْقُعُودِ عَلَى الْقُبُورِ فِيمَا نُرَى لِلْمَذَاهِبِ .
also referenced under: Book 16, Hadith 34 (USC-MSA)