changeset 2647:0911ad28ea98

Merge
author Andrew John Hughes <ahughes@redhat.com>
date Thu, 07 Jul 2011 14:19:34 +0100
parents d987bfbdfd8d (current diff) b98c208a3244 (diff)
children 67985e03e768
files ChangeLog Makefile.am
diffstat 6 files changed, 387 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Jul 07 14:17:12 2011 +0100
+++ b/ChangeLog	Thu Jul 07 14:19:34 2011 +0100
@@ -1,4 +1,4 @@
-2011-07-06  Andrew John Hughes  <ahughes@redhat.com>
+2011-07-07  Andrew John Hughes  <ahughes@redhat.com>
 
 	* Makefile.am:
 	(OPENJDK_DATE): Updated.
@@ -9,6 +9,19 @@
 	* configure.ac: Remove check for md5sum.
 	* hotspot.map: Move to sha256.
 
+2011-07-07  Pavel Tisnovsky  <ptisnovs@redhat.com>
+
+	* Makefile.am: added new patches
+	* NEWS: updated with backports
+	* patches/openjdk/6842838-64-bit_failure_in_handling_invalid_manifest.patch:
+	* patches/openjdk/6882768-test_for_6842838_is_broken.patch:
+	Backport of 6842838 and 6882768.
+
+2011-07-07  Pavel Tisnovsky  <ptisnovs@redhat.com>
+
+	* patches/openjdk/6679308-Poor_text_rendering_on_translucent_image.patch:
+	Fixed test location (added missing prefix 'jdk' into path).
+
 2011-07-06  Andrew John Hughes  <ahughes@redhat.com>
 
 	Make JPEG classes more binary compatible with
--- a/Makefile.am	Thu Jul 07 14:17:12 2011 +0100
+++ b/Makefile.am	Thu Jul 07 14:19:34 2011 +0100
@@ -353,7 +353,9 @@
 	patches/openjdk/7047069-Array_can_dynamically_change_size.patch \
 	patches/openjdk/6796786-invalid_FP_identity_transform.patch \
 	patches/openjdk/7042070-Typo_in_Test6796786.patch \
-	patches/openjdk/6679308-Poor_text_rendering_on_translucent_image.patch
+	patches/openjdk/6679308-Poor_text_rendering_on_translucent_image.patch \
+	patches/openjdk/6842838-64-bit_failure_in_handling_invalid_manifest.patch \
+	patches/openjdk/6882768-test_for_6842838_is_broken.patch \
 	patches/pr639-broken_shark_build.patch \
 	patches/powerpc-stacksize.patch \
 	patches/jtreg-remove-test-6987555.patch \
--- a/NEWS	Thu Jul 07 14:17:12 2011 +0100
+++ b/NEWS	Thu Jul 07 14:19:34 2011 +0100
@@ -46,6 +46,8 @@
   - S7042070: Typo in Test6796786.java
   - S7029152: Ideal nodes for String intrinsics miss memory edge optimization
   - S6679308: Poor text rendering on translucent image
+  - S6842838: 64-bit failure in handling invalid manifest in launcher.
+  - S6882768: Test for 6842838 is broken
 * Bug fixes
   - PR637: make check should exit with an error code if any regression test failed.
   - G356743: Support libpng 1.5.
--- a/patches/openjdk/6679308-Poor_text_rendering_on_translucent_image.patch	Thu Jul 07 14:17:12 2011 +0100
+++ b/patches/openjdk/6679308-Poor_text_rendering_on_translucent_image.patch	Thu Jul 07 14:19:34 2011 +0100
@@ -425,7 +425,7 @@
          }
 diff -r f50304904b8f -r d7accc312aec test/java/awt/Graphics2D/DrawString/AlphaSurfaceText.java
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ openjdk/test/java/awt/Graphics2D/DrawString/AlphaSurfaceText.java	Mon Apr 28 15:57:46 2008 -0700
++++ openjdk/jdk/test/java/awt/Graphics2D/DrawString/AlphaSurfaceText.java	Mon Apr 28 15:57:46 2008 -0700
 @@ -0,0 +1,106 @@
 +/*
 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/openjdk/6842838-64-bit_failure_in_handling_invalid_manifest.patch	Thu Jul 07 14:19:34 2011 +0100
@@ -0,0 +1,272 @@
+# HG changeset patch
+# User kevinw
+# Date 1252958108 -3600
+# Node ID eb19c5dc52bf5916c58972a3a08dec48950c7a38
+# Parent  aac01ec2cec47f4bac17971a1d2bc60bf3dd2196
+6842838: 64-bit failure in handling invalid manifest in launcher.
+Summary: Don't compare with hard-coded 32-bit -1 when checking zip fields.
+Reviewed-by: ksrini
+
+diff -r aac01ec2cec4 -r eb19c5dc52bf src/share/bin/parse_manifest.c
+--- openjdk.orig/jdk/src/share/bin/parse_manifest.c	Mon Sep 14 17:47:26 2009 +0100
++++ openjdk/jdk/src/share/bin/parse_manifest.c	Mon Sep 14 20:55:08 2009 +0100
+@@ -59,7 +59,7 @@
+     char        *out;
+     z_stream    zs;
+ 
+-    if (entry->csize == 0xffffffff || entry->isize == 0xffffffff)
++    if (entry->csize == (size_t) -1 || entry->isize == (size_t) -1 )
+         return (NULL);
+     if (lseek(fd, entry->offset, SEEK_SET) < (off_t)0)
+         return (NULL);
+diff -r aac01ec2cec4 -r eb19c5dc52bf test/tools/launcher/6842838/CreateBadJar.java
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ openjdk/jdk/test/tools/launcher/6842838/CreateBadJar.java	Mon Sep 14 20:55:08 2009 +0100
+@@ -0,0 +1,168 @@
++/*
++ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 only, as
++ * published by the Free Software Foundation.
++ *
++ * This code is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++ * version 2 for more details (a copy is included in the LICENSE file that
++ * accompanied this code).
++ *
++ * You should have received a copy of the GNU General Public License version
++ * 2 along with this work; if not, write to the Free Software Foundation,
++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
++ * CA 95054 USA or visit www.sun.com if you need additional information or
++ * have any questions.
++ */
++
++/*
++ * Borrowing significantly from Martin Buchholz's CorruptedZipFiles.java
++ *
++ * Needed a way of testing the checks for corrupt zip/jar entry in
++ * inflate_file from file j2se/src/share/bin/parse_manifest.c
++ * and running them with the 64-bit launcher. e.g.
++ * sparcv9/bin/java -jar badjar.jar
++ *
++ * Run from a script driver Test6842838.sh as we want to specifically run
++ * bin/sparcv9/java, the 64-bit launcher.
++ *
++ * So this program will create a zip file and damage it in the way
++ * required to tickle this bug.
++ *
++ * It will cause a buffer overrun: but that will not always crash.
++ * Use libumem preloaded by the script driver in order to
++ * abort quickly when the overrun happens.  That makes the test
++ * Solaris-specific.
++ */
++
++import java.util.*;
++import java.util.zip.*;
++import java.io.*;
++import static java.lang.System.*;
++import static java.util.zip.ZipFile.*;
++
++public class CreateBadJar {
++
++public static void main(String [] arguments) {
++
++        if (arguments.length != 2) {
++            throw new RuntimeException("Arguments: jarfilename entryname");
++        }
++        String outFile = arguments[0];
++        String entryName = arguments[1];
++
++        try {
++        // If the named file doesn't exist, create it.
++        // If it does, we are expecting it to contain the named entry, for
++        // alteration.
++        if (!new File(outFile).exists()) {
++          System.out.println("Creating file " + outFile);
++
++          // Create the requested zip/jar file.
++          ZipOutputStream zos = null;
++          zos = new ZipOutputStream(
++            new FileOutputStream(outFile));
++
++          ZipEntry e = new ZipEntry(entryName);
++          zos.putNextEntry(e);
++          for (int j=0; j<50000; j++) {
++            zos.write((int)'a');
++          }
++          zos.closeEntry();
++          zos.close();
++          zos = null;
++        }
++
++        // Read it.
++        int len = (int)(new File(outFile).length());
++        byte[] good = new byte[len];
++        FileInputStream fis = new FileInputStream(outFile);
++        fis.read(good);
++        fis.close();
++        fis = null;
++
++        int endpos = len - ENDHDR;
++        int cenpos = u16(good, endpos+ENDOFF);
++        if (u32(good, cenpos) != CENSIG) throw new RuntimeException("Where's CENSIG?");
++
++        byte[] bad;
++        bad = good.clone();
++
++        // Corrupt it...
++        int pos = findInCEN(bad, cenpos, entryName);
++
++        // What bad stuff are we doing to it?
++        // Store a 32-bit -1 in uncomp size.
++        bad[pos+0x18]=(byte)0xff;
++        bad[pos+0x19]=(byte)0xff;
++        bad[pos+0x1a]=(byte)0xff;
++        bad[pos+0x1b]=(byte)0xff;
++
++        // Bad work complete, delete the original.
++        new File(outFile).delete();
++
++        // Write it.
++        FileOutputStream fos = new FileOutputStream(outFile);
++        fos.write(bad);
++        fos.close();
++        fos = null;
++
++        } catch (Exception e) {
++            e.printStackTrace();
++        }
++
++}
++
++        /*
++         * Scan Central Directory File Headers looking for the named entry.
++         */
++
++    static int findInCEN(byte[] bytes, int cenpos, String entryName) {
++        int pos = cenpos;
++        int nextPos = 0;
++        String filename = null;
++        do {
++            if (nextPos != 0) {
++                pos = nextPos;
++            }
++            System.out.println("entry at pos = " + pos);
++            if (u32(bytes, pos) != CENSIG) throw new RuntimeException ("entry not found in CEN or premature end...");
++
++            int csize = u32(bytes, pos+0x14);          // +0x14 1 dword csize
++            int uncompsize = u32(bytes, pos+0x18);     // +0x18 1 dword uncomp size
++            int filenameLength = u16(bytes, pos+0x1c); // +0x1c 1 word length of filename
++            int extraLength = u16(bytes, pos+0x1e);    // +0x1e 1 world length of extra field
++            int commentLength = u16(bytes, pos+0x20);  // +0x20 1 world length of file comment
++            filename = new String(bytes, pos+0x2e, filenameLength); // +0x2e chars of filename
++            int offset = u32(bytes, pos+0x2a);         // +0x2a chars of filename
++
++            System.out.println("filename = " + filename + "\ncsize = " + csize +
++                               " uncomp.size = " + uncompsize +" file offset = " + offset);
++            nextPos =  pos + 0x2e + filenameLength + extraLength + commentLength;
++
++        } while (!filename.equals(entryName));
++
++        System.out.println("entry found at pos = " + pos);
++        return pos;
++    }
++
++    static int u8(byte[] data, int offset) {
++        return data[offset]&0xff;
++    }
++
++    static int u16(byte[] data, int offset) {
++        return u8(data,offset) + (u8(data,offset+1)<<8);
++    }
++
++    static int u32(byte[] data, int offset) {
++        return u16(data,offset) + (u16(data,offset+2)<<16);
++    }
++
++}
++
+diff -r aac01ec2cec4 -r eb19c5dc52bf test/tools/launcher/6842838/Test6842838.sh
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ openjdk/jdk/test/tools/launcher/6842838/Test6842838.sh	Mon Sep 14 20:55:08 2009 +0100
+@@ -0,0 +1,75 @@
++#!/bin/sh -x
++
++#
++# @test @(#)Test6842838.sh
++# @bug 6842838
++# @summary Test 6842838 64-bit launcher failure due to corrupt jar
++# @run shell Test6842838.sh
++#
++
++#
++# Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
++# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++#
++# This code is free software; you can redistribute it and/or modify it
++# under the terms of the GNU General Public License version 2 only, as
++# published by the Free Software Foundation.
++#
++# This code is distributed in the hope that it will be useful, but WITHOUT
++# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++# version 2 for more details (a copy is included in the LICENSE file that
++# accompanied this code).
++#
++# You should have received a copy of the GNU General Public License version
++# 2 along with this work; if not, write to the Free Software Foundation,
++# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++#
++# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
++# CA 95054 USA or visit www.sun.com if you need additional information or
++# have any questions.
++#
++
++if [ "${TESTSRC}" = "" ]
++then TESTSRC=.
++fi
++
++if [ "${TESTJAVA}" = "" ]
++then
++  PARENT=`dirname \`which java\``
++  TESTJAVA=`dirname ${PARENT}`
++  echo "TESTJAVA not set, selecting " ${TESTJAVA}
++  echo "If this is incorrect, try setting the variable manually."
++fi
++
++if [ "${TESTCLASSES}" = "" ]
++then
++  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
++  exit 1
++fi
++
++# set platform-dependent variables
++OS=`uname -s`
++case "$OS" in
++  SunOS )
++    NULL=/dev/null
++    PS=":"
++    FS="/"
++    JAVA_EXE=${TESTJAVA}${FS}bin${FS}sparcv9${FS}java
++    ;;
++  * )
++    echo "Only testing on sparcv9 (use libumem to reliably catch buffer overrun)"
++    exit 0;
++    ;;
++esac
++
++BADFILE=newbadjar.jar
++
++${JAVA_EXE} -version
++rm -f ${BADFILE}
++${TESTJAVA}/bin/javac CreateBadJar.java
++${JAVA_EXE} CreateBadJar ${BADFILE} "META-INF/MANIFEST.MF"
++LD_PRELOAD=/lib/64/libumem.so ${JAVA_EXE} -jar ${BADFILE} > test.out 2>&1
++
++grep "Invalid or corrupt jarfile" test.out
++exit $?
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/openjdk/6882768-test_for_6842838_is_broken.patch	Thu Jul 07 14:19:34 2011 +0100
@@ -0,0 +1,95 @@
+# HG changeset patch
+# User kevinw
+# Date 1253635268 -3600
+# Node ID b8004f6f4812e560cf464cae85c18522727c72ef
+# Parent  81dffe63c91318e2821f5e3379e428aa4787c6fc
+6882768: (launcher) test for 6842838 is broken
+Summary: Testcase correction.
+Reviewed-by: ksrini
+
+diff -r 81dffe63c913 -r b8004f6f4812 test/tools/launcher/6842838/Test6842838.sh
+--- openjdk.orig/jdk/test/tools/launcher/6842838/Test6842838.sh	Tue Sep 22 10:01:32 2009 +0800
++++ openjdk/jdk/test/tools/launcher/6842838/Test6842838.sh	Tue Sep 22 17:01:08 2009 +0100
+@@ -1,12 +1,3 @@
+-#!/bin/sh -x
+-
+-#
+-# @test @(#)Test6842838.sh
+-# @bug 6842838
+-# @summary Test 6842838 64-bit launcher failure due to corrupt jar
+-# @run shell Test6842838.sh
+-#
+-
+ #
+ # Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+@@ -30,21 +21,23 @@
+ # have any questions.
+ #
+ 
+-if [ "${TESTSRC}" = "" ]
+-then TESTSRC=.
++
++# @test Test6842838.sh
++# @bug 6842838
++# @summary Test 6842838 64-bit launcher failure due to corrupt jar
++# @compile CreateBadJar.java
++# @run shell Test6842838.sh
++
++set -x
++
++if [ "${TESTJAVA}" = "" ]; then
++  PARENT=`dirname \`which java\``
++  TESTJAVA=`dirname ${PARENT}`
++  printf "TESTJAVA not set.  Test cannot execute.  Failed.\n"
+ fi
+ 
+-if [ "${TESTJAVA}" = "" ]
+-then
+-  PARENT=`dirname \`which java\``
+-  TESTJAVA=`dirname ${PARENT}`
+-  echo "TESTJAVA not set, selecting " ${TESTJAVA}
+-  echo "If this is incorrect, try setting the variable manually."
+-fi
+-
+-if [ "${TESTCLASSES}" = "" ]
+-then
+-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
++if [ "${TESTCLASSES}" = "" ]; then
++  printf "TESTCLASSES not set.  Test cannot execute.  Failed.\n"
+   exit 1
+ fi
+ 
+@@ -58,18 +51,26 @@
+     JAVA_EXE=${TESTJAVA}${FS}bin${FS}sparcv9${FS}java
+     ;;
+   * )
+-    echo "Only testing on sparcv9 (use libumem to reliably catch buffer overrun)"
++    printf "Only testing on sparcv9 (use libumem to reliably catch buffer overrun)\n"
+     exit 0;
+     ;;
+ esac
+ 
++if [ ! -x ${JAVA_EXE} ]; then
++    printf "Warning: sparcv9 components not installed - skipping test.\n"
++    exit 0
++fi
++
++LIBUMEM=/lib/64/libumem.so
++if [ ! -x ${LIBUMEM} ]; then
++    printf "Warning: libumem not installed - skipping test.\n"
++    exit 0
++fi
++
+ BADFILE=newbadjar.jar
+-
+ ${JAVA_EXE} -version
+-rm -f ${BADFILE}
+-${TESTJAVA}/bin/javac CreateBadJar.java
+-${JAVA_EXE} CreateBadJar ${BADFILE} "META-INF/MANIFEST.MF"
+-LD_PRELOAD=/lib/64/libumem.so ${JAVA_EXE} -jar ${BADFILE} > test.out 2>&1
++${JAVA_EXE} -cp ${TESTCLASSES} CreateBadJar ${BADFILE} "META-INF/MANIFEST.MF"
++LD_PRELOAD=${LIBUMEM} ${JAVA_EXE} -jar ${BADFILE} > test.out 2>&1
+ 
+ grep "Invalid or corrupt jarfile" test.out
+ exit $?