- 08 Jun, 2016 6 commits
-
-
Przemyslaw Szczepaniak authored
-
Narayan Kamath authored
-
Neil Fuller authored
-
Sergio Giro authored
-
Przemyslaw Szczepaniak authored
Bug: 27441320 Change-Id: I2d1230013bd499ff00015890eedb63943f9904ec (partially cherry picked from commit 1b2f59a5)
-
Narayan Kamath authored
The level-1 cache was incorrectly implemented. The check written here : if (cache1 != null && charsetName.equals(cache1.getKey())) return cache1.getValue(); Is incorrect because a different thread might change the value of cache1 between the null check, the call to getKey and the call to getValue. The stress test in this change results in a 100% reproducible failure on a nexus 6P without the included fix. bug: 26548702 Change-Id: Ib564c5d84282bff23f7b95d3b520d45f740b0ba3
-
- 07 Jun, 2016 4 commits
-
-
Sergio Giro authored
Behaviour before this CL was to avoid selecting a SPI if there was a previously selected one. That is an incompatibility wrt M. This CL makes Cipher compatible with the M behaviour Bug: 29038928 Change-Id: Ie5ddf17e25344d41dc45f0c6df6effbca7dc7021
-
Neil Fuller authored
Addressing flakiness in test_parkFor_3 / test_parkUntil_3. The wait time permitted was Math.max(expectedMillis * 10, 30) where expectedMillis = 0. That meant that the test code had just 30ms between calling Thread.start() and the Parker code being executed reaching the notifyAll(). Other tests use an expectedMillis of 500 and 300, giving more time for the Thread to start and complete their wait(). e.g. 4500ms and 2700ms above the expected park time, respectively. Bug: 29177727 Change-Id: I92d34a535f98929b767eebb75d4c49487b9b0348
-
Przemyslaw Szczepaniak authored
-
Przemyslaw Szczepaniak authored
sun.security.provider.SecureRandom is never used on android, we always use the implementation from AndroidOpenSSL provider instead. Bug: 29091543 Change-Id: I20412c0f42c7b397ef5b05e623e61c2742fb935d (cherry picked from commit 337d8c17)
-
- 06 Jun, 2016 2 commits
-
-
Przemyslaw Szczepaniak authored
If ProxySelector#getDefault is not empty, openJdk SocksSocketImpl (the default SocketImpl) will try to use it to proxy the socket connection through it, even if the socket was created without the Proxy instance. This is a regression from marshmallow release, which would only tunnel the socket if the Proxy was explicitly set in constructor. Bug: 29092095 (cherry picked from commit 4c86b879) Change-Id: Ie3b505c33e053b9a4240daa61579f7800b74b07e
-
Narayan Kamath authored
bug: 29092095 (cherry picked from commit 51dea170) Change-Id: I74cb36c70d81be0e9333dc71fd1b9580b64d12ca
-
- 01 Jun, 2016 1 commit
-
-
Neil Fuller authored
-
- 31 May, 2016 1 commit
-
-
Neil Fuller authored
The dstEnd calculation could previously overflow and a negative dstBegin wasn't being caught in one specific case. Bug: 28998511 Change-Id: I144d92d114bab94f5a207c3e3d5f5b55c97e9838
-
- 27 May, 2016 5 commits
-
-
Narayan Kamath authored
We shouldn't close them after preClose because the descriptor will then describe a different file (/dev/null). bug: 28994821 (cherry picked from commit 48689e680a503e82cbe1d5cc122f4bb628aa2fa2) Change-Id: I3c3519cb3a54fdebf6d51520747735af01664696
-
Joachim Sauer authored
-
Przemyslaw Szczepaniak authored
-
Narayan Kamath authored
The OpenJDK epoll based selector suffers from a serious bug where it can never successfully deregister keys from closed channels. The root cause of this bug is the sequence of operations that occur when a channel that's registered with a selector is closed : (0) Application code calls Channel.close(). (1) The channel is "preClosed" - We dup2(2) /dev/null into the channel's file descriptor and the channel is marked as closed at the Java level. (2) All keys associated with the channel are cancelled. Cancels are lazy, which means that the Selectors involved won't necessarily deregister these keys until an ongoing call to select() (if any) returns or until the next call to select() on that selector. (3) Once all selectors associated with the channel deregister these cancelled keys, the channel FD is properly closed (via close(2)). Note that an arbitrary length of time might elapse between Step 0 and this step. This isn't a resource leak because the channel's FD is now a reference to "/dev/null". THE PROBLEM : ------------- The default Selector implementation on Linux 2.6 and higher uses epoll(7). epoll can scale better than poll(2) because a lot of the state related to the interest set (the set of descriptors we're polling on) is maintained by the kernel. One of the side-effects of this design is that callers must call into the kernel to make changes to the interest set via epoll_ctl(7), for eg., by using EPOLL_CTL_ADD to add descriptors or EPOLL_CTL_DEL to remove descriptors from the interest set. A call to epoll_ctl with op = EPOLL_CTL_DEL is made when the selector attempts to deregister an FD associated with a channel from the interest set (see Step 2, above). These calls will *always fail* because the channel has been preClosed (see Step 1). They fail because the kernel uses its own internal file structure to maintain state, and rejects the command because the descriptor we're passing in describes a different file (/dev/null) that isn't selectable and isn't registered with the epoll instance. This is an issue in upstream OpenJDK as well and various select implementations (such as netty) have hacks to work around it. Outside of Android, things will work OK in most cases because the kernel has its own internal cleanup logic to deregister files from epoll instances whenever the last *non epoll* reference to the file has been closed - and usually this happens at the point at which the dup2(2) from Step 1 is called. However, on Android, sockets tagged with the SocketTagger will never hit this code path because the socket tagging implementation (qtaguid) keeps a reference to the internal file until the socket has been untagged. In cases where sockets are closed without being untagged, the tagger keeps a reference to it until the process dies. THE SOLUTION : -------------- We switch over to using poll(2) instead of epoll(7). One of the advantages of poll(2) is that there's less state maintained by the kernel. We don't need to make a syscall (analogous to epoll_ctl) whenever we want to remove an FD from the interest set; we merely remove it from the list of FDs passed in the next time we call through to poll. Poll is also slightly more efficient and less overhead to set up when the number of FDs being polled is small (which is the common case on Android). We also need to make sure that all tagged sockets are untagged before they're preclosed at the platform level. However, there's nothing we can do about applications that abuse public api (android.net.TrafficStats). ALTERNATE APPROACHES : ---------------------- For completeness, I'm listing a couple of other approaches that were considered but discarded. - Removing preClose: This has the disadvantage of increasing the amount of time (Delta between Step 0 and Step 3) a channel's descriptor is kept alive. This also opens up races in the rare case where a closed FD number is reused on a different thread while we have reads pending. - A Synchronous call to EPOLL_CTL_DEL when a channel is removed: This is a non-starter because of the specified order of events in AbstractSelectableChannel; implCloseSelectableChannel must be called before all associated keys are cancelled. bug: 28318596 Change-Id: I407b06b4b538e19823ac27a4c9ae4c608a01a2ea
-
Narayan Kamath authored
Don't rely on temporary directory cleanup. bug: 28946760 Change-Id: I2cded2d0ffe6ea05008295460f8e16b09f8ad6f4
-
- 26 May, 2016 3 commits
-
-
Przemyslaw Szczepaniak authored
openJdk java.util.zip.ZipFile with OPEN_DELETE flag uses unlink to remove the file just after it's opened. This is causing trouble on /storage partition, we can read/write unlinked file easily, but lseek seems to fail with ENOENT. This change introduces alternative implementation that doesn't use unlink before closing the file. Bug: 28901232 Bug: 28950284 Change-Id: I871a84e9a14bc1b4b9d5b0faa207579e27bcfc81 (cherry picked from commit ae6b1b85)
-
Joachim Sauer authored
When java.util.TimeZone.setDefault() is called (either by client code or from ActivityThread.updateTimeZone due to ACTION_TIMEZONE_CHANGED) we need to notify android.icu.util.TimeZone of this change, as it keeps a cached android.icu.util.TimeZone object to represent that default value. android.icu.util.TimeZone.setTimeZone would be the obvious candidate here. Unfortunately that method was hidden to have a single consistent way to set the timezone and tries to do some extra work that is undesireable on Android. To avoid potential loops of ICU setDefault calling JDK setDefault and vice versa, we remove the ICU setDefault. Bug: 28949992 Change-Id: I46a59551864cd2b780f72d28e01a0c39daf3aef5
-
Neil Fuller authored
-
- 25 May, 2016 2 commits
-
-
Neil Fuller authored
An associated change in OkHttp is relaxing the validation to make it closer to the behavior in M. This may be temporary and could be removed in a future release of Android. Bug: 28867041 Bug: https://code.google.com/p/android/issues/detail?id=210205 Change-Id: If45f89578553e38ad455850f7f6bbecd4d51262e
-
Joachim Sauer authored
ICU DecimalFormat and java.text.DecimalFormat differ in their definition of setCurrency in that the former is documented to leave the minimum and maximum fraction digits untouched and the later updates it to the default of the currency. Since we implement java.text.DecimalFormat using the ICU DecimalFormat we have to work around that difference. Bug: 28893763 Change-Id: I0e7e19fe95f352e75cc9f53ad8a7739436de37d1
-
- 24 May, 2016 16 commits
-
-
Paul Duffin authored
Add tests for security vulnerability CVE-2016-0718 am: ec40d6fe am: 1ab7224f am: 549143a3 am: a38bf83c am: 52ac1089 am: 47e32c35 am: e6dfd2f1 am: 5b8e6731 am: 07f5f0c8 am: af27f876 am: c6d293d5 * commit 'c6d293d5': Add tests for security vulnerability CVE-2016-0718 Change-Id: Iaa151502de81cc779160be8119befa9ee94a72f3
-
Paul Duffin authored
Add tests for security vulnerability CVE-2016-0718 am: ec40d6fe am: 1ab7224f am: 549143a3 am: a38bf83c am: 52ac1089 am: 47e32c35 am: e6dfd2f1 am: 5b8e6731 am: 07f5f0c8 am: af27f876 * commit 'af27f876': Add tests for security vulnerability CVE-2016-0718 Change-Id: I5645c866066178a7c6ba5f93b83b94afe624d177
-
Paul Duffin authored
Add tests for security vulnerability CVE-2016-0718 am: ec40d6fe am: 1ab7224f am: 549143a3 am: a38bf83c am: 52ac1089 am: 47e32c35 am: e6dfd2f1 am: 5b8e6731 am: 07f5f0c8 * commit '07f5f0c8': Add tests for security vulnerability CVE-2016-0718 Change-Id: I6f1c1f81070c446c0e1a6dfc3ebd1736e064b16c
-
Paul Duffin authored
Add tests for security vulnerability CVE-2016-0718 am: ec40d6fe am: 1ab7224f am: 549143a3 am: a38bf83c am: 52ac1089 am: 47e32c35 am: e6dfd2f1 am: 5b8e6731 * commit '5b8e6731': Add tests for security vulnerability CVE-2016-0718 Change-Id: I7343001e102ed057194499c487f05dedea22c632
-
Paul Duffin authored
am: a38bf83c * commit 'a38bf83c': Add tests for security vulnerability CVE-2016-0718 Change-Id: I84c28366faad2789da5d774f33dc0b0a4248785c
-
Paul Duffin authored
am: 549143a3 * commit '549143a3': Add tests for security vulnerability CVE-2016-0718 Change-Id: I2783847d969d2f27996eda9fd8d0058d93886c38
-
Paul Duffin authored
am: 1ab7224f * commit '1ab7224f': Add tests for security vulnerability CVE-2016-0718 Change-Id: I441762ca3a8a015b1aa342a845ab8f75d8edcc79
-
Paul Duffin authored
am: ec40d6fe * commit 'ec40d6fe': Add tests for security vulnerability CVE-2016-0718 Change-Id: I46d5294d5dd1fa3cdd6ec1d9d7e99ceeee823612
-
Przemyslaw Szczepaniak authored
NetworkInterface#getHardwareAddress was caching the hardware address on its object creation. This is not consistent with other NwtworkInterface methods and will cause to return wrong value if address changes or network device changes/goes away. This change changes #getHardwareAddress to recreate a NetworkInterface and fetch up-to-date HW address (or throw an exception if there's no such address). Bug: 28903817 Change-Id: I6cc195f93358a17777e19af76b72eb49c26fc658 (cherry picked from commit 6da71a5f)
-
Paul Duffin authored
The fixes are in external/expat. (cherry picked from commit e168b494) Bug: 28698301 Change-Id: Iafe4a3387be20a05c217abd65588871bb7b47160
-
Paul Duffin authored
-
Paul Duffin authored
The fixes are in external/expat. Bug: 28698301 Change-Id: Ia8c17873409370884238484903faf08ee3b58e11
-
Przemyslaw Szczepaniak authored
Availability matrix for JCA algorithms/transformations/types were generated using android emulator. Bug: 2778729 Change-Id: I52111c016fcc279c5f3275a29c08358e61eafa4c (cherry picked from commit 444325bf)
-