by Imam Malik, translation by A'isha `Abdarahman at-Tarjumana and Ya`qub Johnson , Volume: Burials
Chapter: Stopping for Funerals and Sitting in Graveyards
Yahya related to me from Malik from Yahya ibn Said from Wafid ibn Amr ibn Said ibn Muadh from Nafi ibn Jubayr ibn Mutim from Masud ibn al-Hakam from AIi ibn Abi Talib that the Messenger of Allah, may Allah bless him and grant him peace, used to stand up when a funeral procession passed by, and then sit down again afterwards.
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."
Yahya related to me from Malik from Abu Bakr ibn Uthman ibn Sahl ibn Hunayf that he had heard Abu Umama ibn Sahl ibn Hunayf say, "We used to attend funeral processions, and the last of the people would not sit until they had been given permission ."