Mercurial > hg > truffle
annotate test/runtime/7107135/Test7107135.sh @ 20257:7426d8d76305
8034761: Remove the do_code_roots parameter from process_strong_roots
Reviewed-by: tschatzl, mgerdin, jmasa
author | stefank |
---|---|
date | Thu, 13 Feb 2014 17:44:39 +0100 |
parents | 57ac7245594c |
children | 4510a3502166 |
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 # |
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
4 # Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. |
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 ## |
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
28 ## @test Test7107135.sh |
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
29 ## @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
|
30 ## @bug 8021296 |
8710
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
31 ## @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
|
32 ## @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
|
33 ## |
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
34 |
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
35 if [ "${TESTSRC}" = "" ] |
8831
04d6d4322c6a
8009152: A number of jtreg tests need review/improvement
collins
parents:
8710
diff
changeset
|
36 then |
04d6d4322c6a
8009152: A number of jtreg tests need review/improvement
collins
parents:
8710
diff
changeset
|
37 TESTSRC=${PWD} |
04d6d4322c6a
8009152: A number of jtreg tests need review/improvement
collins
parents:
8710
diff
changeset
|
38 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
|
39 fi |
8831
04d6d4322c6a
8009152: A number of jtreg tests need review/improvement
collins
parents:
8710
diff
changeset
|
40 echo "TESTSRC=${TESTSRC}" |
04d6d4322c6a
8009152: A number of jtreg tests need review/improvement
collins
parents:
8710
diff
changeset
|
41 ## Adding common setup Variables for running shell tests. |
04d6d4322c6a
8009152: A number of jtreg tests need review/improvement
collins
parents:
8710
diff
changeset
|
42 . ${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
|
43 |
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
44 # 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
|
45 OS=`uname -s` |
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
46 case "$OS" in |
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
47 Linux) |
8831
04d6d4322c6a
8009152: A number of jtreg tests need review/improvement
collins
parents:
8710
diff
changeset
|
48 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
|
49 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
|
50 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
|
51 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
|
52 exit 0; |
f9ee986a9fea
8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents:
8831
diff
changeset
|
53 fi |
8710
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
54 ;; |
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
55 *) |
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
56 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
|
57 exit 0; |
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
58 ;; |
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
59 esac |
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 ARCH=`uname -m` |
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
62 |
8831
04d6d4322c6a
8009152: A number of jtreg tests need review/improvement
collins
parents:
8710
diff
changeset
|
63 THIS_DIR=. |
8710
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
64 |
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
65 cp ${TESTSRC}${FS}*.java ${THIS_DIR} |
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
66 ${TESTJAVA}${FS}bin${FS}javac *.java |
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
67 |
11967
f9ee986a9fea
8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents:
8831
diff
changeset
|
68 $gcc_cmd -fPIC -shared -c -o test.o \ |
f9ee986a9fea
8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents:
8831
diff
changeset
|
69 -I${TESTJAVA}${FS}include -I${TESTJAVA}${FS}include${FS}linux \ |
f9ee986a9fea
8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents:
8831
diff
changeset
|
70 ${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
|
71 |
8710
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
72 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
|
73 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
|
74 |
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
75 |
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
76 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
|
77 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
|
78 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
|
79 |
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
80 # 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
|
81 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
|
82 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
|
83 ${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
|
84 |
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
85 echo |
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
86 echo Test changing of stack protection: |
12016 | 87 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
|
88 ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} Test test-rwx |
12016 | 89 JAVA_RETVAL=$? |
8710
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
90 |
12016 | 91 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
|
92 then |
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
93 echo |
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
94 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
|
95 ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} TestMT test-rwx |
12016 | 96 JAVA_RETVAL=$? |
8710
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
97 fi |
9058789475af
7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff
changeset
|
98 |
12016 | 99 exit $JAVA_RETVAL |