Commit be3ab5e2 authored by Tobias Thierer's avatar Tobias Thierer
Browse files

Partially verify Android patches for sun.nio.ch.FileChannelImpl.

This CL adds and improves some change markers, and also
integrates a bugfix in truncate() that was missed in the
update from OpenJDK 8u60 to 8u121-b13.

- annotate additions for CloseGuard support
- annotate additions for BlockGuard support
  note: From what I can see, position() won't block yet commit
  5873edf8 added BlockGuard
  invocations. I've kept the behavior for now since it's already
  present in released versions of Android.
- missing markers "Allocate a DirectByteBuffer directly.".
  From commit fe0e5d3e
- tweak marker "Ignore failed truncation for non-regular files."
  Introduced by commit 0f7f0c99.
- missing marker "Move clinit code to JNI registration functions."
  From commit f9d2599c.
- missing removal marker "Unused method getMappedBufferPool()."
  - already removed in initial import
- Integrate missing bugfix for FileChannelImpl.truncate().
  Upstream bug:
    JDK-8137121: (fc) Infinite loop FileChannel.truncate
  was fixed for OpenJDK 8u72 but was missed in Android's
  update from 8u60 to 8u121-b13.
  The buggy code cast the result of nd.truncate() (a long) to int,
  which led to an infinite loop when that typecast overflowed to
  -3, the value of IOStatus.INTERRUPTED.
  Upstream OpenJDK has a testng regression test "LoopingTruncate",
  but this CL does not integrate it.

Bug: 74377400
Test: Treehugger

Change-Id: Idf6343a79fea4d3b2aebfffd892082c9e88c7712
parent 381e39a9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment