ANDROID: 16K: Avoid mmap lock assertions for padding VMAs

The padding VMA is never inserted into the VMA tree; therefore we
don't need to have the mmap lock in exclusive mode to modify it.

Test: v2/android-gki/ack_platform_integration_main_cf_arm64_boot_test
      on kernel_virt_debug_aarch64
Bug: 346741763
Bug: 352463814
Change-Id: I4ca3ed22dab45b6bb895cb41c5c6792344188b61
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
(cherry picked from commit a8b3ebe7f90afe0ad0d9a8b0b90f266da06a7007)
This commit is contained in:
Kalesh Singh 2024-06-18 00:10:48 +00:00 committed by Jhih-Chen Huang
parent cb6c9fcea7
commit b6577b7604

View File

@ -294,11 +294,14 @@ struct vm_area_struct *get_pad_vma(struct vm_area_struct *vma)
/* Adjust the start to begin at the start of the padding section */
pad->vm_start = VMA_PAD_START(pad);
/*
* The below modifications to vm_flags don't need mmap write lock,
* since, pad does not belong to the VMA tree.
*/
/* Make the pad vma PROT_NONE */
vm_flags_clear(pad, VM_READ|VM_WRITE|VM_EXEC);
__vm_flags_mod(pad, 0, VM_READ|VM_WRITE|VM_EXEC);
/* Remove padding bits */
vm_flags_clear(pad, VM_PAD_MASK);
__vm_flags_mod(pad, 0, VM_PAD_MASK);
return pad;
}