aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2006-04-04 23:25:09 +0000
committerTom Tromey <tromey@gcc.gnu.org>2006-04-04 23:25:09 +0000
commit119afc377a97d86375466560b8ad538197554b81 (patch)
tree69263b8da1ad85374698a5321589ea97c4c382ff
parent4b1c1f6fc2f1ed0d5e4315ef6b788bf84755a5ee (diff)
downloadgcc-119afc377a97d86375466560b8ad538197554b81.zip
gcc-119afc377a97d86375466560b8ad538197554b81.tar.gz
gcc-119afc377a97d86375466560b8ad538197554b81.tar.bz2
re PR classpath/26990 (SecurityManager.checkExit() problem)
PR libgcj/26990: * prims.cc (_Jv_RunMain): Use exitNoChecksAccessor. * gnu/java/lang/natMainThread.cc (call_main): Use exitNoChecksAccessor. * testsuite/libjava.lang/pr26990.out: New file. * testsuite/libjava.lang/pr26990.java: New file. * java/lang/Runtime.java (exitNoChecks): New method. (exitNoChecksAccessor): Likewise. (exit): Call exitNoChecks. From-SVN: r112685
-rw-r--r--libjava/ChangeLog12
-rw-r--r--libjava/gnu/java/lang/natMainThread.cc3
-rw-r--r--libjava/java/lang/Runtime.java15
-rw-r--r--libjava/prims.cc2
-rw-r--r--libjava/testsuite/libjava.lang/pr26990.java13
-rw-r--r--libjava/testsuite/libjava.lang/pr26990.out0
6 files changed, 40 insertions, 5 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index ce599c1..28b41f4 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,15 @@
+2006-04-04 Tom Tromey <tromey@redhat.com>
+
+ PR libgcj/26990:
+ * prims.cc (_Jv_RunMain): Use exitNoChecksAccessor.
+ * gnu/java/lang/natMainThread.cc (call_main): Use
+ exitNoChecksAccessor.
+ * testsuite/libjava.lang/pr26990.out: New file.
+ * testsuite/libjava.lang/pr26990.java: New file.
+ * java/lang/Runtime.java (exitNoChecks): New method.
+ (exitNoChecksAccessor): Likewise.
+ (exit): Call exitNoChecks.
+
2006-04-03 Tom Tromey <tromey@redhat.com>
* Makefile.in: Rebuilt.
diff --git a/libjava/gnu/java/lang/natMainThread.cc b/libjava/gnu/java/lang/natMainThread.cc
index 95626eb..99d5f95 100644
--- a/libjava/gnu/java/lang/natMainThread.cc
+++ b/libjava/gnu/java/lang/natMainThread.cc
@@ -57,6 +57,5 @@ gnu::java::lang::MainThread::call_main (void)
_Jv_ThreadWait ();
int status = (int) ::java::lang::ThreadGroup::had_uncaught_exception;
- ::java::lang::Runtime *runtime = ::java::lang::Runtime::getRuntime ();
- runtime->exit (status);
+ ::java::lang::Runtime::exitNoChecksAccessor (status);
}
diff --git a/libjava/java/lang/Runtime.java b/libjava/java/lang/Runtime.java
index 519b4ac..3466f19 100644
--- a/libjava/java/lang/Runtime.java
+++ b/libjava/java/lang/Runtime.java
@@ -146,9 +146,20 @@ public class Runtime
SecurityManager sm = SecurityManager.current; // Be thread-safe!
if (sm != null)
sm.checkExit(status);
+ exitNoChecks(status);
+ }
+ // Accessor to avoid adding a vtable slot.
+ static void exitNoChecksAccessor(int status)
+ {
+ current.exitNoChecks(status);
+ }
+
+ // Private since we can't add a vtable slot in 4.1.x.
+ private void exitNoChecks(int status)
+ {
if (runShutdownHooks())
- halt(status);
+ exitInternal(status);
// Someone else already called runShutdownHooks().
// Make sure we are not/no longer in the shutdownHooks set.
@@ -171,7 +182,7 @@ public class Runtime
// while finalization for exit is going on and the status is non-zero
// we halt immediately.
if (status != 0)
- halt(status);
+ exitInternal(status);
while (true)
try
diff --git a/libjava/prims.cc b/libjava/prims.cc
index 1ef5674..5e016c9 100644
--- a/libjava/prims.cc
+++ b/libjava/prims.cc
@@ -1525,7 +1525,7 @@ _Jv_RunMain (JvVMInitArgs *vm_args, jclass klass, const char *name, int argc,
("Exception during runtime initialization"));
t->printStackTrace();
if (runtime)
- runtime->exit (1);
+ java::lang::Runtime::exitNoChecksAccessor (1);
// In case the runtime creation failed.
::exit (1);
}
diff --git a/libjava/testsuite/libjava.lang/pr26990.java b/libjava/testsuite/libjava.lang/pr26990.java
new file mode 100644
index 0000000..88db93e
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/pr26990.java
@@ -0,0 +1,13 @@
+public class pr26990
+{
+ public static void main (String args[]) throws Exception
+ {
+ System.setSecurityManager(new SecurityManager()
+ {
+ public void checkExit(int status)
+ {
+ throw new SecurityException("This is a bug");
+ }
+ });
+ }
+}
diff --git a/libjava/testsuite/libjava.lang/pr26990.out b/libjava/testsuite/libjava.lang/pr26990.out
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/pr26990.out