Mercurial > hg > release > icedtea6-1.8
view patches/security/20110607/6213702.patch @ 2150:e11a3915d1cf
Apply 2011/06/07 security patches.
2011-05-23 Andrew John Hughes <ahughes@redhat.com>
* Makefile.am: Add security patches.
* NEWS: List security patches.
* patches/icedtea-nio2.patch: Rerolled post-security
patching.
* patches/security/20110607/6213702.patch,
* patches/security/20110607/6618658.patch,
* patches/security/20110607/7012520.patch,
* patches/security/20110607/7013519.patch,
* patches/security/20110607/7013969.patch,
* patches/security/20110607/7013971.patch,
* patches/security/20110607/7016495.patch,
* patches/security/20110607/7020198.patch,
* patches/security/20110607/7020373.patch:
New security patches.
* patches/icedtea-xjc.patch: Rerolled after 7013971.
author | Andrew John Hughes <ahughes@redhat.com> |
---|---|
date | Tue, 24 May 2011 23:28:49 +0100 |
parents | |
children |
line wrap: on
line source
diff -Nru openjdk.orig/jdk/src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java openjdk/jdk/src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java --- openjdk.orig/jdk/src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java 2010-02-17 03:14:49.000000000 +0000 +++ openjdk/jdk/src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java 2011-05-24 16:36:14.987888272 +0100 @@ -308,14 +308,17 @@ private int processSelectedKeys(long updateCount) { int numKeysUpdated = 0; numKeysUpdated += processFDSet(updateCount, readFds, - PollArrayWrapper.POLLIN); + PollArrayWrapper.POLLIN, + false); numKeysUpdated += processFDSet(updateCount, writeFds, PollArrayWrapper.POLLCONN | - PollArrayWrapper.POLLOUT); + PollArrayWrapper.POLLOUT, + false); numKeysUpdated += processFDSet(updateCount, exceptFds, PollArrayWrapper.POLLIN | PollArrayWrapper.POLLCONN | - PollArrayWrapper.POLLOUT); + PollArrayWrapper.POLLOUT, + true); return numKeysUpdated; } @@ -327,7 +330,8 @@ * * me.updateCount <= me.clearedCount <= updateCount */ - private int processFDSet(long updateCount, int[] fds, int rOps) { + private int processFDSet(long updateCount, int[] fds, int rOps, + boolean isExceptFds) { int numKeysUpdated = 0; for (int i = 1; i <= fds[0]; i++) { int desc = fds[i]; @@ -343,6 +347,17 @@ if (me == null) continue; SelectionKeyImpl sk = me.ski; + + // The descriptor may be in the exceptfds set because there is + // OOB data queued to the socket. If there is OOB data then it + // is discarded and the key is not added to the selected set. + if (isExceptFds && + (sk.channel() instanceof SocketChannelImpl) && + discardUrgentData(desc)) + { + continue; + } + if (selectedKeys.contains(sk)) { // Key in selected set if (me.clearedCount != updateCount) { if (sk.channel.translateAndSetReadyOps(rOps, sk) && @@ -449,6 +464,8 @@ private native void resetWakeupSocket0(int wakeupSourceFd); + private native boolean discardUrgentData(int fd); + // We increment this counter on each call to updateSelectedKeys() // each entry in SubSelector.fdsMap has a memorized value of // updateCount. When we increment numKeysUpdated we set updateCount diff -Nru openjdk.orig/jdk/src/windows/native/sun/nio/ch/WindowsSelectorImpl.c openjdk/jdk/src/windows/native/sun/nio/ch/WindowsSelectorImpl.c --- openjdk.orig/jdk/src/windows/native/sun/nio/ch/WindowsSelectorImpl.c 2010-02-17 03:14:49.000000000 +0000 +++ openjdk/jdk/src/windows/native/sun/nio/ch/WindowsSelectorImpl.c 2011-05-24 16:36:14.987888272 +0100 @@ -211,3 +211,20 @@ recv(scinFd, bytes, WAKEUP_SOCKET_BUF_SIZE, 0); } } + +JNIEXPORT jboolean JNICALL +Java_sun_nio_ch_WindowsSelectorImpl_discardUrgentData(JNIEnv* env, jobject this, + jint s) +{ + char data[8]; + jboolean discarded = JNI_FALSE; + int n; + do { + n = recv(s, data, sizeof(data), MSG_OOB); + if (n > 0) { + discarded = JNI_TRUE; + } + } while (n > 0); + return discarded; +} +