annotate test/runtime/7107135/Test7107135.sh @ 14677:e0365e7b7454

8035983: Fix "Native frames:" in crash report (hs_err file) Summary: check fr.sender_sp() in java thread instead of os::is_first_C_frame(&fr). Reviewed-by: twisti, coleenp
author kvn
date Wed, 05 Mar 2014 16:21:22 -0800
parents 5e7eb4244604
children 4ca6dc0799b6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8710
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
1 #!/bin/sh
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
2
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
3 #
14482
5e7eb4244604 8025519: [TESTBUG] runtime/7107135/Test7107135.sh need to use COMPILEJAVA for javac task
ccheung
parents: 14476
diff changeset
4 # Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
8710
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
5 # Copyright (c) 2011 SAP AG. All Rights Reserved.
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
6 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
7 #
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
8 # This code is free software; you can redistribute it and/or modify it
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
9 # under the terms of the GNU General Public License version 2 only, as
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
10 # published by the Free Software Foundation.
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
11 #
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
12 # This code is distributed in the hope that it will be useful, but WITHOUT
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
14 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
15 # version 2 for more details (a copy is included in the LICENSE file that
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
16 # accompanied this code).
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
17 #
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
18 # You should have received a copy of the GNU General Public License version
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
19 # 2 along with this work; if not, write to the Free Software Foundation,
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
20 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
21 #
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
22 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
23 # or visit www.oracle.com if you need additional information or have any
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
24 # questions.
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
25 #
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
26
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
27 ##
14476
4510a3502166 8034898: [TESTBUG]: Zero failure project - tag all Runtime JTReg bugs that fail nightly
gtriantafill
parents: 12016
diff changeset
28 ## @ignore 8025519
8710
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
29 ## @test Test7107135.sh
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
30 ## @bug 7107135
11967
f9ee986a9fea 8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents: 8831
diff changeset
31 ## @bug 8021296
14482
5e7eb4244604 8025519: [TESTBUG] runtime/7107135/Test7107135.sh need to use COMPILEJAVA for javac task
ccheung
parents: 14476
diff changeset
32 ## @bug 8025519
8710
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
33 ## @summary Stack guard pages lost after loading library with executable stack.
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
34 ## @run shell Test7107135.sh
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
35 ##
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
36
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
37 if [ "${TESTSRC}" = "" ]
8831
04d6d4322c6a 8009152: A number of jtreg tests need review/improvement
collins
parents: 8710
diff changeset
38 then
04d6d4322c6a 8009152: A number of jtreg tests need review/improvement
collins
parents: 8710
diff changeset
39 TESTSRC=${PWD}
04d6d4322c6a 8009152: A number of jtreg tests need review/improvement
collins
parents: 8710
diff changeset
40 echo "TESTSRC not set. Using "${TESTSRC}" as default"
8710
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
41 fi
8831
04d6d4322c6a 8009152: A number of jtreg tests need review/improvement
collins
parents: 8710
diff changeset
42 echo "TESTSRC=${TESTSRC}"
04d6d4322c6a 8009152: A number of jtreg tests need review/improvement
collins
parents: 8710
diff changeset
43 ## Adding common setup Variables for running shell tests.
04d6d4322c6a 8009152: A number of jtreg tests need review/improvement
collins
parents: 8710
diff changeset
44 . ${TESTSRC}/../../test_env.sh
8710
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
45
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
46 # set platform-dependent variables
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
47 OS=`uname -s`
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
48 case "$OS" in
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
49 Linux)
8831
04d6d4322c6a 8009152: A number of jtreg tests need review/improvement
collins
parents: 8710
diff changeset
50 echo "Testing on Linux"
11967
f9ee986a9fea 8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents: 8831
diff changeset
51 gcc_cmd=`which gcc`
f9ee986a9fea 8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents: 8831
diff changeset
52 if [ "x$gcc_cmd" == "x" ]; then
f9ee986a9fea 8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents: 8831
diff changeset
53 echo "WARNING: gcc not found. Cannot execute test." 2>&1
f9ee986a9fea 8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents: 8831
diff changeset
54 exit 0;
f9ee986a9fea 8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents: 8831
diff changeset
55 fi
8710
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
56 ;;
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
57 *)
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
58 echo "Test passed; only valid for Linux"
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
59 exit 0;
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
60 ;;
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
61 esac
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
62
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
63 ARCH=`uname -m`
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
64
8831
04d6d4322c6a 8009152: A number of jtreg tests need review/improvement
collins
parents: 8710
diff changeset
65 THIS_DIR=.
8710
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
66
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
67 cp ${TESTSRC}${FS}*.java ${THIS_DIR}
14482
5e7eb4244604 8025519: [TESTBUG] runtime/7107135/Test7107135.sh need to use COMPILEJAVA for javac task
ccheung
parents: 14476
diff changeset
68 ${COMPILEJAVA}${FS}bin${FS}javac *.java
8710
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
69
11967
f9ee986a9fea 8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents: 8831
diff changeset
70 $gcc_cmd -fPIC -shared -c -o test.o \
14482
5e7eb4244604 8025519: [TESTBUG] runtime/7107135/Test7107135.sh need to use COMPILEJAVA for javac task
ccheung
parents: 14476
diff changeset
71 -I${COMPILEJAVA}${FS}include -I${COMPILEJAVA}${FS}include${FS}linux \
11967
f9ee986a9fea 8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents: 8831
diff changeset
72 ${TESTSRC}${FS}test.c
f9ee986a9fea 8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents: 8831
diff changeset
73
8710
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
74 ld -shared -z execstack -o libtest-rwx.so test.o
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
75 ld -shared -z noexecstack -o libtest-rw.so test.o
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
76
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
77
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
78 LD_LIBRARY_PATH=${THIS_DIR}
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
79 echo LD_LIBRARY_PATH = ${LD_LIBRARY_PATH}
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
80 export LD_LIBRARY_PATH
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
81
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
82 # This should not fail.
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
83 echo Check testprogram. Expected to pass:
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
84 echo ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} Test test-rw
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
85 ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} Test test-rw
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
86
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
87 echo
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
88 echo Test changing of stack protection:
12016
57ac7245594c 8019583: [TESTBUG] runtime/7107135 always passes
minqi
parents: 11967
diff changeset
89 echo ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} Test test-rwx
8710
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
90 ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} Test test-rwx
12016
57ac7245594c 8019583: [TESTBUG] runtime/7107135 always passes
minqi
parents: 11967
diff changeset
91 JAVA_RETVAL=$?
8710
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
92
12016
57ac7245594c 8019583: [TESTBUG] runtime/7107135 always passes
minqi
parents: 11967
diff changeset
93 if [ "$JAVA_RETVAL" == "0" ]
8710
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
94 then
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
95 echo
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
96 echo ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} TestMT test-rwx
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
97 ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} TestMT test-rwx
12016
57ac7245594c 8019583: [TESTBUG] runtime/7107135 always passes
minqi
parents: 11967
diff changeset
98 JAVA_RETVAL=$?
8710
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
99 fi
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
100
12016
57ac7245594c 8019583: [TESTBUG] runtime/7107135 always passes
minqi
parents: 11967
diff changeset
101 exit $JAVA_RETVAL