Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit e1d5a6aa authored by Łukasz Szymczyk's avatar Łukasz Szymczyk Committed by Narayan Kamath
Browse files

Reserve space on disk using fallocate

There were crashes when android failed to extract
zip archives due to out of free space on disk, with stacks like:

  #00 pc 00000000000156b0 /system/lib64/libc.so (memcpy+176)
  #1 pc 000000000002e5b8 /system/lib64/libandroidfw.so
  #2 pc 000000000002f488 /system/lib64/libandroidfw.so (ExtractToMemory+328)
  #3 pc 000000000002f5c8 /system/lib64/libandroidfw.so (ExtractEntryToFile+268)
  #4 pc 00000000000287d8 /system/lib64/libandroidfw.so (android::ZipFileRO::\
  uncompressEntry(void*, int) const+12)

Space for the file is now allocated using fallocate rather than
ftruncate, since ftruncate dont actually reserve space on disk. When writes
to the mmaped pointer fails to be realized due to out of space SIGBUS
is the result. With this change we make sure that there is space available
before mmaping the pointer.

Change-Id: Ic5e8c33dbe729edb57919dacff73811b34cc2dc2
parent 34c91edd
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment