IMA currently tries to read the file to calculate a hash from inside i_rwsem. On file system like XFS that also take i_rwsem for reads this deadlocks. This patch instead adds a new ->integrity_read method for IMA that can be used to read data with i_rwsem held. For XFS it has an implementation that skips the locking, other file systems can just set it to the default implementation. As a side effect this also gets rid of playing with the address limit.