view patches/security/20120612/7143606.patch @ 2578:96394d394527

Add security patches for 2012/06/12. 2012-06-07 Andrew John Hughes <ahughes@redhat.com> * Makefile.am: (ICEDTEA_PATCHES): Add security patches. Make more patches HotSpot-build specific. * patches/ecj/override.patch: Add additional cases from 7143872. * patches/arm.patch: Moved to HotSpot-specific versions. * patches/arch.patch, * patches/freetypeversion.patch, * patches/gcc-suffix.patch: Fix to work with no fuzz. * patches/hotspot/hs20/arm.patch, * patches/hotspot/hs20/gcc-stack-markings.patch, * patches/hotspot/hs20/numa_on_early_glibc.patch, * patches/hotspot/hs20/sparc-trapsfix.patch, * patches/hotspot/hs20/version-hotspot.patch: Split to work with hs20 with no fuzz. * patches/hotspot/original/arm.patch, * patches/hotspot/original/gcc-stack-markings.patch, * patches/hotspot/original/numa_on_early_glibc.patch, * patches/hotspot/original/sparc-trapsfix.patch, * patches/hotspot/original/version-hotspot.patch: Likewise for hs19 (original). * patches/jaxp-serial-version-uid.patch, * patches/libraries.patch, * patches/nio2.patch, * patches/no-static-linking.patch, * patches/openjdk/6693253-security_warning.patch, * patches/openjdk/6766342-AA-simple-shape-performance.patch, * patches/openjdk/6797139-jbutton_truncation.patch, * patches/openjdk/6851973-kerberos.patch, * patches/openjdk/7102369-7094468-rmiregistry.patch: Fixed to work with no fuzz. * patches/openjdk/hs20/7034464-hugepage.patch, * patches/openjdk/hs20/7103224-glibc_name_collision.patch, Fixed to work with hs20 and no fuzz. * patches/openjdk/mutter.patch: Fixed to work with no fuzz. * patches/openjdk/original/7034464-hugepage.patch, * patches/openjdk/original/7103224-glibc_name_collision.patch, Fixed to work with hs19 (original) and no fuzz. * patches/openjdk/remove-mimpure-option-to-gcc.patch: Fixed to work with no fuzz. * patches/security/20120612/7079902.patch, * patches/security/20120612/7143606.patch, * patches/security/20120612/7143614.patch, * patches/security/20120612/7143617.patch, * patches/security/20120612/7143851.patch, * patches/security/20120612/7143872.patch, * patches/security/20120612/7145239.patch, * patches/security/20120612/7157609.patch, * patches/security/20120612/7160677.patch, * patches/security/20120612/7160757.patch, * patches/security/20120612/hs20/7110720.patch, * patches/security/20120612/hs20/7152811.patch, * patches/security/20120612/original/7110720.patch, * patches/security/20120612/original/7152811.patch, Security patches for 2012/06/12. * NEWS: Updated.
author Andrew John Hughes <ahughes@redhat.com>
date Fri, 08 Jun 2012 14:23:28 +0100
parents
children
line wrap: on
line source

diff -Nru openjdk.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/Driver.java openjdk/jdk/src/share/classes/com/sun/java/util/jar/pack/Driver.java
--- openjdk.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/Driver.java	2011-02-28 16:06:15.000000000 +0000
+++ openjdk/jdk/src/share/classes/com/sun/java/util/jar/pack/Driver.java	2012-06-08 00:21:54.885628274 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. 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
@@ -354,8 +354,7 @@
             where = new File(".").getAbsoluteFile();
 
 
-        File f = File.createTempFile(prefix, suffix, where);
-        return f;
+        return sun.misc.IOUtils.createTempFile(prefix, suffix, where);
     }
 
     static private
diff -Nru openjdk.orig/jdk/src/share/classes/java/awt/Font.java openjdk/jdk/src/share/classes/java/awt/Font.java
--- openjdk.orig/jdk/src/share/classes/java/awt/Font.java	2011-02-28 16:06:20.000000000 +0000
+++ openjdk/jdk/src/share/classes/java/awt/Font.java	2012-06-08 00:21:54.893628402 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2012, Oracle and/or its affiliates. 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
@@ -809,7 +809,7 @@
         File f = null;
         boolean hasPerm = false;
         try {
-            f = File.createTempFile("+~JT", ".tmp", null);
+            f = sun.misc.IOUtils.createTempFile("+~JT", ".tmp", null);
             f.delete();
             f = null;
             hasPerm = true;
@@ -860,7 +860,7 @@
             final File tFile = AccessController.doPrivileged(
                 new PrivilegedExceptionAction<File>() {
                     public File run() throws IOException {
-                        return File.createTempFile("+~JF", ".tmp", null);
+                        return sun.misc.IOUtils.createTempFile("+~JF", ".tmp", null);
                     }
                 }
             );
diff -Nru openjdk.orig/jdk/src/share/classes/java/io/File.java openjdk/jdk/src/share/classes/java/io/File.java
--- openjdk.orig/jdk/src/share/classes/java/io/File.java	2011-02-28 16:06:21.000000000 +0000
+++ openjdk/jdk/src/share/classes/java/io/File.java	2012-06-08 00:21:54.893628402 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2012, Oracle and/or its affiliates. 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
@@ -897,7 +897,7 @@
     public boolean createNewFile() throws IOException {
         SecurityManager security = System.getSecurityManager();
         if (security != null) security.checkWrite(path);
-        return fs.createFileExclusively(path);
+        return fs.createFileExclusively(path, false);
     }
 
     /**
@@ -1700,7 +1700,8 @@
         return new File(dir, prefix + Long.toString(n) + suffix);
     }
 
-    private static boolean checkAndCreate(String filename, SecurityManager sm)
+    private static boolean checkAndCreate(String filename, SecurityManager sm,
+                                          boolean restrictive)
         throws IOException
     {
         if (sm != null) {
@@ -1713,7 +1714,29 @@
                 throw new SecurityException("Unable to create temporary file");
             }
         }
-        return fs.createFileExclusively(filename);
+        return fs.createFileExclusively(filename, restrictive);
+    }
+    
+    // The resulting temporary file may have more restrictive access permission
+    // on some platforms, if restrictive is true.
+    private static File createTempFile0(String prefix, String suffix,
+                                        File directory, boolean restrictive)
+        throws IOException
+    {
+        if (prefix == null) throw new NullPointerException();
+        if (prefix.length() < 3)
+            throw new IllegalArgumentException("Prefix string too short");
+        String s = (suffix == null) ? ".tmp" : suffix;
+        if (directory == null) {
+            String tmpDir = LazyInitialization.temporaryDirectory();
+            directory = new File(tmpDir, fs.prefixLength(tmpDir));
+        }
+        SecurityManager sm = System.getSecurityManager();
+        File f;
+        do {
+            f = generateFile(prefix, s, directory);
+        } while (!checkAndCreate(f.getPath(), sm, restrictive));
+        return f;
     }
 
     /**
@@ -1789,20 +1812,7 @@
                                       File directory)
         throws IOException
     {
-        if (prefix == null) throw new NullPointerException();
-        if (prefix.length() < 3)
-            throw new IllegalArgumentException("Prefix string too short");
-        String s = (suffix == null) ? ".tmp" : suffix;
-        if (directory == null) {
-            String tmpDir = LazyInitialization.temporaryDirectory();
-            directory = new File(tmpDir, fs.prefixLength(tmpDir));
-        }
-        SecurityManager sm = System.getSecurityManager();
-        File f;
-        do {
-            f = generateFile(prefix, s, directory);
-        } while (!checkAndCreate(f.getPath(), sm));
-        return f;
+        return createTempFile0(prefix, suffix, directory, false);
     }
 
     /**
@@ -1837,7 +1847,7 @@
     public static File createTempFile(String prefix, String suffix)
         throws IOException
     {
-        return createTempFile(prefix, suffix, null);
+        return createTempFile0(prefix, suffix, null, false);
     }
 
 
@@ -1959,6 +1969,15 @@
             }
         );
     }
-
-
+    
+    // Set up JavaIOAccess in SharedSecrets
+    static {
+        sun.misc.SharedSecrets.setJavaIOFileAccess(new sun.misc.JavaIOFileAccess() {
+            public File createTempFile(String prefix, String suffix, File directory)
+                throws IOException
+            {
+                return createTempFile0(prefix, suffix, directory, true);
+            }
+        });
+    }
 }
diff -Nru openjdk.orig/jdk/src/share/classes/java/io/FileSystem.java openjdk/jdk/src/share/classes/java/io/FileSystem.java
--- openjdk.orig/jdk/src/share/classes/java/io/FileSystem.java	2011-02-28 16:06:21.000000000 +0000
+++ openjdk/jdk/src/share/classes/java/io/FileSystem.java	2012-06-08 00:21:54.893628402 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. 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
@@ -157,8 +157,13 @@
      * <code>true</code> if the file was created and <code>false</code> if a
      * file or directory with the given pathname already exists.  Throw an
      * IOException if an I/O error occurs.
+     *
+     * <p>
+     * The resulting file may have more restrictive access permission
+     * on some platforms, if restrictive is true. 
      */
-    public abstract boolean createFileExclusively(String pathname)
+    public abstract boolean createFileExclusively(String pathname,
+                                                  boolean restrictive)
         throws IOException;
 
     /**
diff -Nru openjdk.orig/jdk/src/share/classes/javax/imageio/stream/FileCacheImageInputStream.java openjdk/jdk/src/share/classes/javax/imageio/stream/FileCacheImageInputStream.java
--- openjdk.orig/jdk/src/share/classes/javax/imageio/stream/FileCacheImageInputStream.java	2011-02-28 16:06:25.000000000 +0000
+++ openjdk/jdk/src/share/classes/javax/imageio/stream/FileCacheImageInputStream.java	2012-06-08 00:21:54.893628402 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. 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
@@ -98,7 +98,7 @@
         }
         this.stream = stream;
         this.cacheFile =
-            File.createTempFile("imageio", ".tmp", cacheDir);
+            sun.misc.IOUtils.createTempFile("imageio", ".tmp", cacheDir);
         this.cache = new RandomAccessFile(cacheFile, "rw");
 
         this.closeAction = StreamCloser.createCloseAction(this);
diff -Nru openjdk.orig/jdk/src/share/classes/javax/imageio/stream/FileCacheImageOutputStream.java openjdk/jdk/src/share/classes/javax/imageio/stream/FileCacheImageOutputStream.java
--- openjdk.orig/jdk/src/share/classes/javax/imageio/stream/FileCacheImageOutputStream.java	2011-02-28 16:06:25.000000000 +0000
+++ openjdk/jdk/src/share/classes/javax/imageio/stream/FileCacheImageOutputStream.java	2012-06-08 00:21:54.893628402 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. 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
@@ -84,7 +84,7 @@
         }
         this.stream = stream;
         this.cacheFile =
-            File.createTempFile("imageio", ".tmp", cacheDir);
+            sun.misc.IOUtils.createTempFile("imageio", ".tmp", cacheDir);
         this.cache = new RandomAccessFile(cacheFile, "rw");
 
         this.closeAction = StreamCloser.createCloseAction(this);
diff -Nru openjdk.orig/jdk/src/share/classes/javax/management/loading/MLet.java openjdk/jdk/src/share/classes/javax/management/loading/MLet.java
--- openjdk.orig/jdk/src/share/classes/javax/management/loading/MLet.java	2011-02-28 16:06:25.000000000 +0000
+++ openjdk/jdk/src/share/classes/javax/management/loading/MLet.java	2012-06-08 00:21:54.893628402 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. 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
@@ -1152,7 +1152,7 @@
              if (is != null) {
                  File directory = new File(libraryDirectory);
                  directory.mkdirs();
-                 File file = File.createTempFile(libname + ".", null, directory);
+                 File file = sun.misc.IOUtils.createTempFile(libname + ".", null, directory);
                  file.deleteOnExit();
                  FileOutputStream fileOutput = new FileOutputStream(file);
                  int c;
diff -Nru openjdk.orig/jdk/src/share/classes/sun/misc/IOUtils.java openjdk/jdk/src/share/classes/sun/misc/IOUtils.java
--- openjdk.orig/jdk/src/share/classes/sun/misc/IOUtils.java	2011-02-28 16:06:34.000000000 +0000
+++ openjdk/jdk/src/share/classes/sun/misc/IOUtils.java	2012-06-08 00:21:54.893628402 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. 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
@@ -30,6 +30,7 @@
 package sun.misc;
 
 import java.io.EOFException;
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Arrays;
@@ -77,4 +78,37 @@
         }
         return output;
     }
+    
+    /*
+     * <p> Creates a new empty file in the specified directory, using the
+     * given prefix and suffix strings to generate its name. The resulting
+     * temporary file may have more restrictive access permission on some
+     * platforms.
+     *
+     * @param  prefix     The prefix string to be used in generating the file's
+     *                    name; must be at least three characters long
+     *
+     * @param  suffix     The suffix string to be used in generating the file's
+     *                    name; may be <code>null</code>, in which case the
+     *                    suffix <code>".tmp"</code> will be used
+     *
+     * @param  directory  The directory in which the file is to be created, or
+     *                    <code>null</code> if the default temporary-file
+     *                    directory is to be used
+     *
+     * @return  An abstract pathname denoting a newly-created empty file
+     *
+     * @see java.io.File#createTempFile(String,String,java.io.File)
+     */
+    public static File createTempFile(String prefix, String suffix, File directory)
+        throws IOException
+    {
+        return SharedSecrets.getJavaIOFileAccess().createTempFile(prefix, suffix, directory);
+    }
+
+    public static File createTempFile(String prefix, String suffix)
+        throws IOException
+    {
+        return SharedSecrets.getJavaIOFileAccess().createTempFile(prefix, suffix, null);
+    }
 }
diff -Nru openjdk.orig/jdk/src/share/classes/sun/misc/JavaIOFileAccess.java openjdk/jdk/src/share/classes/sun/misc/JavaIOFileAccess.java
--- openjdk.orig/jdk/src/share/classes/sun/misc/JavaIOFileAccess.java	1970-01-01 01:00:00.000000000 +0100
+++ openjdk/jdk/src/share/classes/sun/misc/JavaIOFileAccess.java	2012-06-08 00:21:54.893628402 +0100
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.misc;
+
+import java.io.File;
+import java.io.IOException;
+
+public interface JavaIOFileAccess {
+    public File createTempFile(String prefix, String suffix, File directory)
+        throws IOException;
+}
+
diff -Nru openjdk.orig/jdk/src/share/classes/sun/misc/SharedSecrets.java openjdk/jdk/src/share/classes/sun/misc/SharedSecrets.java
--- openjdk.orig/jdk/src/share/classes/sun/misc/SharedSecrets.java	2012-06-08 00:17:20.965183183 +0100
+++ openjdk/jdk/src/share/classes/sun/misc/SharedSecrets.java	2012-06-08 00:22:15.413961526 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. 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
@@ -53,6 +53,7 @@
     private static JavaSecurityProtectionDomainAccess javaSecurityProtectionDomainAccess;
     private static JavaSecurityAccess javaSecurityAccess;
     private static JavaAWTAccess javaAWTAccess;
+    private static JavaIOFileAccess javaIOFileAccess;
 
     public static JavaUtilJarAccess javaUtilJarAccess() {
         if (javaUtilJarAccess == null) {
@@ -145,8 +146,16 @@
     }
 
     public static JavaAWTAccess getJavaAWTAccess() {
-        // this may return null in which case calling code needs to 
+        // this may return null in which case calling code needs to
         // provision for.
         return javaAWTAccess;
     }
+
+    public static void setJavaIOFileAccess(JavaIOFileAccess access) {
+        javaIOFileAccess = access;
+    }
+
+    public static JavaIOFileAccess getJavaIOFileAccess() {
+        return javaIOFileAccess;
+    }
 }
diff -Nru openjdk.orig/jdk/src/share/classes/sun/net/www/protocol/jar/URLJarFile.java openjdk/jdk/src/share/classes/sun/net/www/protocol/jar/URLJarFile.java
--- openjdk.orig/jdk/src/share/classes/sun/net/www/protocol/jar/URLJarFile.java	2011-02-28 16:06:34.000000000 +0000
+++ openjdk/jdk/src/share/classes/sun/net/www/protocol/jar/URLJarFile.java	2012-06-08 00:21:54.893628402 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2012, Oracle and/or its affiliates. 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
@@ -219,7 +219,7 @@
                             OutputStream out = null;
                             File tmpFile = null;
                             try {
-                                tmpFile = File.createTempFile("jar_cache", null);
+                                tmpFile = sun.misc.IOUtils.createTempFile("jar_cache", null);
                                 tmpFile.deleteOnExit();
                                 out  = new FileOutputStream(tmpFile);
                                 int read = 0;
diff -Nru openjdk.orig/jdk/src/share/classes/sun/print/PSPrinterJob.java openjdk/jdk/src/share/classes/sun/print/PSPrinterJob.java
--- openjdk.orig/jdk/src/share/classes/sun/print/PSPrinterJob.java	2011-02-28 16:06:37.000000000 +0000
+++ openjdk/jdk/src/share/classes/sun/print/PSPrinterJob.java	2012-06-08 00:21:54.893628402 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. 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
@@ -652,7 +652,7 @@
                      * is not removed for some reason, request that it is
                      * removed when the VM exits.
                      */
-                    spoolFile = File.createTempFile("javaprint", ".ps", null);
+                    spoolFile = sun.misc.IOUtils.createTempFile("javaprint", ".ps", null);
                     spoolFile.deleteOnExit();
 
                 result = new FileOutputStream(spoolFile);
diff -Nru openjdk.orig/jdk/src/share/classes/sun/rmi/server/Activation.java openjdk/jdk/src/share/classes/sun/rmi/server/Activation.java
--- openjdk.orig/jdk/src/share/classes/sun/rmi/server/Activation.java	2011-02-28 16:06:38.000000000 +0000
+++ openjdk/jdk/src/share/classes/sun/rmi/server/Activation.java	2012-06-08 00:21:54.893628402 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. 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
@@ -1916,7 +1916,7 @@
                     new PrivilegedExceptionAction<Void>() {
                         public Void run() throws IOException {
                             File file =
-                                File.createTempFile("rmid-err", null, null);
+                                sun.misc.IOUtils.createTempFile("rmid-err", null, null);
                             PrintStream errStream =
                                 new PrintStream(new FileOutputStream(file));
                             System.setErr(errStream);
diff -Nru openjdk.orig/jdk/src/share/classes/sun/tools/jar/Main.java openjdk/jdk/src/share/classes/sun/tools/jar/Main.java
--- openjdk.orig/jdk/src/share/classes/sun/tools/jar/Main.java	2011-02-28 16:06:41.000000000 +0000
+++ openjdk/jdk/src/share/classes/sun/tools/jar/Main.java	2012-06-08 00:21:54.893628402 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. 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
@@ -127,14 +127,14 @@
 
     /**
      * Creates a new empty temporary file in the same directory as the
-     * specified file.  A variant of File.createTempFile.
+     * specified file.  A variant of sun.misc.IOUtils.createTempFile.
      */
     private static File createTempFileInSameDirectoryAs(File file)
         throws IOException {
         File dir = file.getParentFile();
         if (dir == null)
             dir = new File(".");
-        return File.createTempFile("jartmp", null, dir);
+        return sun.misc.IOUtils.createTempFile("jartmp", null, dir);
     }
 
     private boolean ok;
diff -Nru openjdk.orig/jdk/src/share/classes/sun/tools/native2ascii/Main.java openjdk/jdk/src/share/classes/sun/tools/native2ascii/Main.java
--- openjdk.orig/jdk/src/share/classes/sun/tools/native2ascii/Main.java	2011-02-28 16:06:41.000000000 +0000
+++ openjdk/jdk/src/share/classes/sun/tools/native2ascii/Main.java	2012-06-08 00:21:54.893628402 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. 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
@@ -237,9 +237,7 @@
             if (tempDir == null)
                 tempDir = new File(System.getProperty("user.dir"));
 
-            tempFile = File.createTempFile("_N2A",
-                                           ".TMP",
-                                            tempDir);
+            tempFile = sun.misc.IOUtils.createTempFile("_N2A", ".TMP", tempDir);
             tempFile.deleteOnExit();
 
             try {
diff -Nru openjdk.orig/jdk/src/solaris/classes/java/io/UnixFileSystem.java openjdk/jdk/src/solaris/classes/java/io/UnixFileSystem.java
--- openjdk.orig/jdk/src/solaris/classes/java/io/UnixFileSystem.java	2011-02-28 16:06:47.000000000 +0000
+++ openjdk/jdk/src/solaris/classes/java/io/UnixFileSystem.java	2012-06-08 00:21:54.893628402 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. 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
@@ -253,7 +253,7 @@
 
     /* -- File operations -- */
 
-    public native boolean createFileExclusively(String path)
+    public native boolean createFileExclusively(String path, boolean restrictive)
         throws IOException;
     public boolean delete(File f) {
         // Keep canonicalization caches in sync after file deletion
diff -Nru openjdk.orig/jdk/src/solaris/classes/sun/print/UnixPrintJob.java openjdk/jdk/src/solaris/classes/sun/print/UnixPrintJob.java
--- openjdk.orig/jdk/src/solaris/classes/sun/print/UnixPrintJob.java	2011-02-28 16:06:49.000000000 +0000
+++ openjdk/jdk/src/solaris/classes/sun/print/UnixPrintJob.java	2012-06-08 00:21:54.893628402 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. 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
@@ -937,7 +937,7 @@
                      * is not removed for some reason, request that it is
                      * removed when the VM exits.
                      */
-                    spoolFile = File.createTempFile("javaprint", ".ps", null);
+                    spoolFile = sun.misc.IOUtils.createTempFile("javaprint", ".ps", null);
                     spoolFile.deleteOnExit();
                 }
                 result = new FileOutputStream(spoolFile);
diff -Nru openjdk.orig/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java openjdk/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java
--- openjdk.orig/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java	2011-02-28 16:06:49.000000000 +0000
+++ openjdk/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java	2012-06-08 00:21:54.897628467 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. 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
@@ -712,7 +712,7 @@
 
                         Process proc;
                         BufferedReader bufferedReader = null;
-                        File f = File.createTempFile("prn","xc");
+                        File f = sun.misc.IOUtils.createTempFile("prn","xc");
                         cmd[2] = cmd[2]+">"+f.getAbsolutePath();
 
                         proc = Runtime.getRuntime().exec(cmd);
diff -Nru openjdk.orig/jdk/src/solaris/native/java/io/UnixFileSystem_md.c openjdk/jdk/src/solaris/native/java/io/UnixFileSystem_md.c
--- openjdk.orig/jdk/src/solaris/native/java/io/UnixFileSystem_md.c	2011-02-28 16:06:49.000000000 +0000
+++ openjdk/jdk/src/solaris/native/java/io/UnixFileSystem_md.c	2012-06-08 00:21:54.897628467 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. 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
@@ -310,7 +310,8 @@
 
 JNIEXPORT jboolean JNICALL
 Java_java_io_UnixFileSystem_createFileExclusively(JNIEnv *env, jclass cls,
-                                                  jstring pathname)
+                                                  jstring pathname,
+                                                  jboolean restrictive)
 {
     jboolean rv = JNI_FALSE;
 
@@ -319,7 +320,8 @@
         if (!strcmp (path, "/")) {
             fd = JVM_EEXIST;    /* The root directory always exists */
         } else {
-            fd = JVM_Open(path, JVM_O_RDWR | JVM_O_CREAT | JVM_O_EXCL, 0666);
+            jint mode = (restrictive == JNI_TRUE) ? 0600 : 0666;
+            fd = JVM_Open(path, JVM_O_RDWR | JVM_O_CREAT | JVM_O_EXCL, mode);
         }
         if (fd < 0) {
             if (fd != JVM_EEXIST) {
diff -Nru openjdk.orig/jdk/src/windows/classes/java/io/Win32FileSystem.java openjdk/jdk/src/windows/classes/java/io/Win32FileSystem.java
--- openjdk.orig/jdk/src/windows/classes/java/io/Win32FileSystem.java	2011-02-28 16:06:51.000000000 +0000
+++ openjdk/jdk/src/windows/classes/java/io/Win32FileSystem.java	2012-06-08 00:21:54.897628467 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. 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
@@ -510,7 +510,7 @@
 
     /* -- File operations -- */
 
-    public native boolean createFileExclusively(String path)
+    public native boolean createFileExclusively(String path, boolean restrictive)
         throws IOException;
     public boolean delete(File f) {
         // Keep canonicalization caches in sync after file deletion
diff -Nru openjdk.orig/jdk/src/windows/classes/java/io/WinNTFileSystem.java openjdk/jdk/src/windows/classes/java/io/WinNTFileSystem.java
--- openjdk.orig/jdk/src/windows/classes/java/io/WinNTFileSystem.java	2011-02-28 16:06:51.000000000 +0000
+++ openjdk/jdk/src/windows/classes/java/io/WinNTFileSystem.java	2012-06-08 00:21:54.897628467 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2012, Oracle and/or its affiliates. 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
@@ -61,7 +61,7 @@
 
     /* -- File operations -- */
 
-    public native boolean createFileExclusively(String path)
+    public native boolean createFileExclusively(String path, boolean restrictive)
                                                throws IOException;
     protected native boolean delete0(File f);
     public native String[] list(File f);
diff -Nru openjdk.orig/jdk/src/windows/native/java/io/Win32FileSystem_md.c openjdk/jdk/src/windows/native/java/io/Win32FileSystem_md.c
--- openjdk.orig/jdk/src/windows/native/java/io/Win32FileSystem_md.c	2011-02-28 16:06:51.000000000 +0000
+++ openjdk/jdk/src/windows/native/java/io/Win32FileSystem_md.c	2012-06-08 00:21:54.897628467 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. 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
@@ -262,7 +262,8 @@
 
 JNIEXPORT jboolean JNICALL
 Java_java_io_Win32FileSystem_createFileExclusively(JNIEnv *env, jclass cls,
-                                                   jstring pathname)
+                                                   jstring pathname,
+                                                   jboolean restrictive)
 {
     jboolean rv = JNI_FALSE;
     DWORD a;
diff -Nru openjdk.orig/jdk/src/windows/native/java/io/WinNTFileSystem_md.c openjdk/jdk/src/windows/native/java/io/WinNTFileSystem_md.c
--- openjdk.orig/jdk/src/windows/native/java/io/WinNTFileSystem_md.c	2011-02-28 16:06:51.000000000 +0000
+++ openjdk/jdk/src/windows/native/java/io/WinNTFileSystem_md.c	2012-06-08 00:21:54.897628467 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2012, Oracle and/or its affiliates. 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
@@ -349,7 +349,8 @@
 
 JNIEXPORT jboolean JNICALL
 Java_java_io_WinNTFileSystem_createFileExclusively(JNIEnv *env, jclass cls,
-                                                   jstring path)
+                                                   jstring path,
+                                                   jboolean restrictive)
 {
     HANDLE h = NULL;
     WCHAR *pathbuf = pathToNTPath(env, path, JNI_FALSE);