hotspot/test/runtime/7107135/Test7107135.sh
author pchelko
Wed, 23 Apr 2014 17:56:05 +0400
changeset 24529 c580bcb3aabc
parent 22898 3f9e14c6f705
child 25896 5f21a029fdeb
permissions -rw-r--r--
8027148: SystemFlavorMap.getNativesForFlavor returns list of native formats in incorrect order Reviewed-by: anthony, serb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15926
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
     1
#!/bin/sh
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
     2
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
     3
#
22898
3f9e14c6f705 8025519: [TESTBUG] runtime/7107135/Test7107135.sh need to use COMPILEJAVA for javac task
ccheung
parents: 22892
diff changeset
     4
#  Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
15926
8e87d545195f 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.
8e87d545195f 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.
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
     7
#
8e87d545195f 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
8e87d545195f 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
8e87d545195f 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.
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    11
#
8e87d545195f 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
8e87d545195f 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
8e87d545195f 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
8e87d545195f 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
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    16
#  accompanied this code).
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    17
#
8e87d545195f 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
8e87d545195f 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,
8e87d545195f 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.
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    21
#
8e87d545195f 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
8e87d545195f 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
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    24
#  questions.
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    25
#
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    26
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    27
##
22892
1709e0e0b87c 8034898: [TESTBUG]: Zero failure project - tag all Runtime JTReg bugs that fail nightly
gtriantafill
parents: 19272
diff changeset
    28
## @ignore 8025519
15926
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    29
## @test Test7107135.sh
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    30
## @bug 7107135
18988
0e7cbc5c39ec 8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents: 16457
diff changeset
    31
## @bug 8021296
22898
3f9e14c6f705 8025519: [TESTBUG] runtime/7107135/Test7107135.sh need to use COMPILEJAVA for javac task
ccheung
parents: 22892
diff changeset
    32
## @bug 8025519
15926
8e87d545195f 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.
8e87d545195f 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
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    35
##
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    36
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    37
if [ "${TESTSRC}" = "" ]
16457
92af83361777 8009152: A number of jtreg tests need review/improvement
collins
parents: 15926
diff changeset
    38
then
92af83361777 8009152: A number of jtreg tests need review/improvement
collins
parents: 15926
diff changeset
    39
  TESTSRC=${PWD}
92af83361777 8009152: A number of jtreg tests need review/improvement
collins
parents: 15926
diff changeset
    40
  echo "TESTSRC not set.  Using "${TESTSRC}" as default"
15926
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    41
fi
16457
92af83361777 8009152: A number of jtreg tests need review/improvement
collins
parents: 15926
diff changeset
    42
echo "TESTSRC=${TESTSRC}"
92af83361777 8009152: A number of jtreg tests need review/improvement
collins
parents: 15926
diff changeset
    43
## Adding common setup Variables for running shell tests.
92af83361777 8009152: A number of jtreg tests need review/improvement
collins
parents: 15926
diff changeset
    44
. ${TESTSRC}/../../test_env.sh
15926
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    45
8e87d545195f 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
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    47
OS=`uname -s`
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    48
case "$OS" in
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    49
  Linux)
16457
92af83361777 8009152: A number of jtreg tests need review/improvement
collins
parents: 15926
diff changeset
    50
    echo "Testing on Linux"
18988
0e7cbc5c39ec 8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents: 16457
diff changeset
    51
    gcc_cmd=`which gcc`
0e7cbc5c39ec 8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents: 16457
diff changeset
    52
    if [ "x$gcc_cmd" == "x" ]; then
0e7cbc5c39ec 8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents: 16457
diff changeset
    53
        echo "WARNING: gcc not found. Cannot execute test." 2>&1
0e7cbc5c39ec 8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents: 16457
diff changeset
    54
        exit 0;
0e7cbc5c39ec 8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents: 16457
diff changeset
    55
    fi
15926
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    56
    ;;
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    57
  *)
8e87d545195f 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"
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    59
    exit 0;
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    60
    ;;
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    61
esac
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    62
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    63
ARCH=`uname -m`
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    64
16457
92af83361777 8009152: A number of jtreg tests need review/improvement
collins
parents: 15926
diff changeset
    65
THIS_DIR=.
15926
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    66
8e87d545195f 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}
22898
3f9e14c6f705 8025519: [TESTBUG] runtime/7107135/Test7107135.sh need to use COMPILEJAVA for javac task
ccheung
parents: 22892
diff changeset
    68
${COMPILEJAVA}${FS}bin${FS}javac *.java
15926
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    69
18988
0e7cbc5c39ec 8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents: 16457
diff changeset
    70
$gcc_cmd -fPIC -shared -c -o test.o \
22898
3f9e14c6f705 8025519: [TESTBUG] runtime/7107135/Test7107135.sh need to use COMPILEJAVA for javac task
ccheung
parents: 22892
diff changeset
    71
    -I${COMPILEJAVA}${FS}include -I${COMPILEJAVA}${FS}include${FS}linux \
18988
0e7cbc5c39ec 8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents: 16457
diff changeset
    72
    ${TESTSRC}${FS}test.c
0e7cbc5c39ec 8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents: 16457
diff changeset
    73
15926
8e87d545195f 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
8e87d545195f 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
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    76
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    77
8e87d545195f 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}
8e87d545195f 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}
8e87d545195f 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
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    81
8e87d545195f 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.
8e87d545195f 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:
8e87d545195f 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
8e87d545195f 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
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    86
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    87
echo
8e87d545195f 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:
19272
96095ec2872b 8019583: [TESTBUG] runtime/7107135 always passes
minqi
parents: 18988
diff changeset
    89
echo ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} Test test-rwx
15926
8e87d545195f 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
19272
96095ec2872b 8019583: [TESTBUG] runtime/7107135 always passes
minqi
parents: 18988
diff changeset
    91
JAVA_RETVAL=$?
15926
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    92
19272
96095ec2872b 8019583: [TESTBUG] runtime/7107135 always passes
minqi
parents: 18988
diff changeset
    93
if [ "$JAVA_RETVAL" == "0" ]
15926
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    94
then
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    95
  echo
8e87d545195f 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
8e87d545195f 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
19272
96095ec2872b 8019583: [TESTBUG] runtime/7107135 always passes
minqi
parents: 18988
diff changeset
    98
  JAVA_RETVAL=$?
15926
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
    99
fi
8e87d545195f 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents:
diff changeset
   100
19272
96095ec2872b 8019583: [TESTBUG] runtime/7107135 always passes
minqi
parents: 18988
diff changeset
   101
exit $JAVA_RETVAL