Revert "Revert "hsakmt: Only set exec flag when requested""

This reverts commit 5a8092bccf.

Reason for revert: This will put back the change ID - Id1154f08f6ba21c633905fd46b06053994d6f3cc to ROCR repo, which will prevent memory allocations from being automatically granted the 'executable' flag, addressing previously -  incorrect and unsafe behavior in ROCm driver.

Change-Id: I3d45c45859929a80f7791681b411251e099a1901


[ROCm/ROCR-Runtime commit: 2d4a578020]
This commit is contained in:
Shweta Khatri
2025-01-09 22:33:12 -05:00
committed by David Yat Sin
parent 0b1dc71200
commit c5822cee5a
+2 -5
View File
@@ -1401,11 +1401,8 @@ static uint32_t fmm_translate_hsa_to_ioc_flags(HsaMemFlags flags)
KFD_IOC_ALLOC_MEM_FLAGS_UNCACHED);
if (!flags.ui32.ReadOnly)
ioc_flags |= KFD_IOC_ALLOC_MEM_FLAGS_WRITABLE;
/* TODO: Since, ROCr interfaces doesn't allow caller to set page
* permissions, mark all user allocations with exec permission.
* Check for flags.ui32.ExecuteAccess once ROCr is ready.
*/
ioc_flags |= KFD_IOC_ALLOC_MEM_FLAGS_EXECUTABLE;
if (flags.ui32.ExecuteAccess)
ioc_flags |= KFD_IOC_ALLOC_MEM_FLAGS_EXECUTABLE;
return ioc_flags;
}