diff options
author | Narayan Kamath <narayan@google.com> | 2016-11-09 14:12:12 +0000 |
---|---|---|
committer | Przemyslaw Szczepaniak <pszczepaniak@google.com> | 2016-11-09 14:12:58 +0000 |
commit | ce27766ff2cb33432017df70f74f0732adaabd97 (patch) | |
tree | fa5fd54c4cc3ecdf7f57710840481f266157e9d5 /annotations/generate_annotated_java_files.py | |
parent | 053d2f7746ee1c7b999f033c2ab1742df2c34c2f (diff) |
ZipFile: Never change file offset during I/O operations.
Use pread instead read and eliminate unnecessary calls to lseek.
dalvik.system.VMClassLoader maintains a cache of JarFile objects
that it creates whenever it loads resources from them. This cache may
be populated in the zygote as a side effect of preloading classes. When
processes are forked from the zygote, the file descriptors associated
with these JarFile objects point to the same kernel file description
and may end up stepping on each others toes. To avoid such issues, we
never make any offset changes to the associated file.
Note that we have a guarantee that the file will never be closed in
any forked process because the associated JarFile objects can never be
collected.
Test: run cts -m CtsLibcoreTestCases / ZipStressTest / manual testing
to trigger the race condition.
Bug: 30407219
Change-Id: Ic770a6ab6aca7f123a90002327d7f0a321e9afef
(cherry picked from commit 0393d3c84ed9bd24bcf0dac3782a1cc23400ace8)
Diffstat (limited to 'annotations/generate_annotated_java_files.py')
0 files changed, 0 insertions, 0 deletions