ANDROID: 16K: Handle pgoff > file_size for shmem and file backed VMAs
VMAs can be created to be larger than the backing file: See [1] (This is also true for shmem backed VMAs.) Faulting off the end of a file will result in SIGBUS since there is no file page for the given file offset. shmem pages live in page cache or swap cache. Looking up a page cache page with an index (pgoff) beyond the file is invalid and will result in shmem_get_folio_gfp() returning -EINVAL. Insert fixup anon vmas for such file backed and shmem backed VMAs, to prevent the invalid faults in emulated 16kB mode. Although the 16K emulators currently use ext4 for the /data partition, also handle the case for f2fs which overrides the default filemap_fault with f2f2_filemap_fault(). [1] https://r.android.com/2967716 Bug: 355274435 Test: adb root && adb shell && adb shell cp /system/bin/strace /dev/ && adb shell /dev/strace -h Change-Id: Iede02e82fc5958b3aafaf75383404f2f7f59bb23 Signed-off-by:Kalesh Singh <kaleshsingh@google.com>
Loading
Please sign in to comment