subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1564252 - /subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp
Date Tue, 04 Feb 2014 11:06:23 GMT
Author: brane
Date: Tue Feb  4 11:06:23 2014
New Revision: 1564252

URL: http://svn.apache.org/r1564252
Log:
Follow up to r1563971: Make the JavaHL JVM crasher function more robust
and safer on weird architectures that actually allow writing to the
zero page.

* subversion/bindings/javahl/native/JNIUtil.cpp
  (gentle_crash_write_loc): Change type to svn_atomic_t.
  (gently_crash_the_jvm): Use atomic operations to read the value at
   address 0 first, and if that actually works, write the same value
   back. This might cause a slight stutter on a system that maps its
   aircraft engine control registers to address 0.

Modified:
    subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp

Modified: subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp?rev=1564252&r1=1564251&r2=1564252&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp Tue Feb  4 11:06:23 2014
@@ -120,7 +120,7 @@ bool initialize_jni_util(JNIEnv *env)
 
 namespace {
 
-volatile apr_int32_t *gentle_crash_write_loc = NULL;
+volatile svn_atomic_t *gentle_crash_write_loc = NULL;
 
 svn_error_t *
 gently_crash_the_jvm(svn_boolean_t can_return,
@@ -134,8 +134,9 @@ gently_crash_the_jvm(svn_boolean_t can_r
       // be not be caught in the context that we're interested in
       // getting the stack trace from.
 
-      // Try writing to the zero page
-      *gentle_crash_write_loc = 0xdeadbeef;
+      // Try reading from and writing to the zero page
+      const svn_atomic_t zeropage = svn_atomic_read(gentle_crash_write_loc);
+      svn_atomic_set(gentle_crash_write_loc, zeropage);
     }
 
   // Forward to the standard malfunction handler, which does call



Mime
View raw message