view patches/security/20120612/hs20/7152811.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

# HG changeset patch
# User never
# Date 1339076966 -3600
# Node ID d998d70cb0e855ba7d867adc6410aaa5777b17ca
# Parent  aaf8f12b1e038cfe25ed41afb9f91a10dc4ff584
7152811: Issues in client compiler
Reviewed-by: kvn, jrose

diff --git a/src/share/vm/ci/ciField.cpp b/src/share/vm/ci/ciField.cpp
--- openjdk/hotspot/src/share/vm/ci/ciField.cpp
+++ openjdk/hotspot/src/share/vm/ci/ciField.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, 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
@@ -67,7 +67,7 @@
 
 // ------------------------------------------------------------------
 // ciField::ciField
-ciField::ciField(ciInstanceKlass* klass, int index): _known_to_link_with(NULL) {
+ciField::ciField(ciInstanceKlass* klass, int index): _known_to_link_with_put(NULL), _known_to_link_with_get(NULL) {
   ASSERT_IN_VM;
   CompilerThread *thread = CompilerThread::current();
 
@@ -143,7 +143,7 @@
   initialize_from(&field_desc);
 }
 
-ciField::ciField(fieldDescriptor *fd): _known_to_link_with(NULL) {
+ciField::ciField(fieldDescriptor *fd): _known_to_link_with_put(NULL), _known_to_link_with_get(NULL) {
   ASSERT_IN_VM;
 
   _cp_index = -1;
@@ -312,6 +312,10 @@
 bool ciField::will_link(ciInstanceKlass* accessing_klass,
                         Bytecodes::Code bc) {
   VM_ENTRY_MARK;
+  assert(bc == Bytecodes::_getstatic || bc == Bytecodes::_putstatic ||
+         bc == Bytecodes::_getfield  || bc == Bytecodes::_putfield,
+         "unexpected bytecode");
+
   if (_offset == -1) {
     // at creation we couldn't link to our holder so we need to
     // maintain that stance, otherwise there's no safe way to use this
@@ -319,8 +323,21 @@
     return false;
   }
 
-  if (_known_to_link_with == accessing_klass) {
-    return true;
+  // Check for static/nonstatic mismatch
+  bool is_static = (bc == Bytecodes::_getstatic || bc == Bytecodes::_putstatic);
+  if (is_static != this->is_static()) {
+    return false;
+  }
+
+  // Get and put can have different accessibility rules
+  bool is_put    = (bc == Bytecodes::_putfield  || bc == Bytecodes::_putstatic);
+  if (is_put) {
+    if (_known_to_link_with_put == accessing_klass) {
+      return true;
+    }
+    if (_known_to_link_with_get == accessing_klass) {
+      return true;
+    }
   }
 
   FieldAccessInfo result;
@@ -331,8 +348,13 @@
                               true, false, KILL_COMPILE_ON_FATAL_(false));
 
   // update the hit-cache, unless there is a problem with memory scoping:
-  if (accessing_klass->is_shared() || !is_shared())
-    _known_to_link_with = accessing_klass;
+  if (accessing_klass->is_shared() || !is_shared()) {
+    if (is_put) {
+      _known_to_link_with_put = accessing_klass;
+    } else {
+      _known_to_link_with_get = accessing_klass;
+    }
+  }
 
   return true;
 }
diff --git a/src/share/vm/ci/ciField.hpp b/src/share/vm/ci/ciField.hpp
--- openjdk/hotspot/src/share/vm/ci/ciField.hpp
+++ openjdk/hotspot/src/share/vm/ci/ciField.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, 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
@@ -49,7 +49,8 @@
   ciType*          _type;
   int              _offset;
   bool             _is_constant;
-  ciInstanceKlass* _known_to_link_with;
+  ciInstanceKlass* _known_to_link_with_put;
+  ciInstanceKlass* _known_to_link_with_get;
   ciConstant       _constant_value;
 
   // Used for will_link