Print this page
11838 secflag tests are racy

Split Close
Expand all
Collapse all
          --- old/usr/src/test/os-tests/tests/secflags/secflags_dts.sh
          +++ new/usr/src/test/os-tests/tests/secflags/secflags_dts.sh
↓ open down ↓ 4 lines elided ↑ open up ↑
   5    5  # Common Development and Distribution License ("CDDL"), version 1.0.
   6    6  # You may only use this file in accordance with the terms of version
   7    7  # 1.0 of the CDDL.
   8    8  #
   9    9  # A full copy of the text of the CDDL should have accompanied this
  10   10  # source.  A copy of the CDDL is also available via the Internet at
  11   11  # http://www.illumos.org/license/CDDL.
  12   12  #
  13   13  
  14   14  # Copyright 2015, Richard Lowe.
       15 +# Copyright 2019 Joyent, Inc.
  15   16  
  16   17  tmpdir=/tmp/test.$$
  17   18  mkdir $tmpdir
  18   19  cd $tmpdir
  19   20  
  20   21  cleanup() {
  21   22      cd /
  22   23      rm -fr $tmpdir
  23   24  }
  24   25  
↓ open down ↓ 19 lines elided ↑ open up ↑
  44   45  gcc -o many-dts-noaslr tester.c -Wl,-z,aslr=disabled $(for elt in /usr/lib/lib*.so; do echo -Wl,-N,$(basename $elt); done)
  45   46  
  46   47  check() {
  47   48      bin=$1
  48   49      state=$2
  49   50      set=$3
  50   51      ret=0
  51   52  
  52   53      $bin &
  53   54      pid=$!
       55 +    sleep 1
  54   56      psecflags $pid | grep -q "${set}:.*aslr"
  55   57      (( $? != $state )) && ret=1
  56   58      kill -9 $pid
  57   59      return $ret
  58   60  }
  59   61  
  60   62  fail() {
  61   63      echo $@
  62   64      exit 1
  63   65  }
  64   66  
  65   67  psecflags -s none $$
  66   68  check ./tester-aslr 0 E || fail "DT_SUNW_ASLR 1 failed"
  67   69  check ./many-dts-aslr 0 E || fail "DT_SUNW_ASLR 1 with many DTs failed"
  68   70  check ./tester-aslr 1 I || fail "DT_SUNW_ASLR 1 incorrectly set the inheritable flag"
  69   71  
  70   72  psecflags -s aslr $$
  71   73  check ./tester-noaslr 1 E || fail "DT_SUNW_ASLR 0 failed"
  72   74  check ./many-dts-noaslr 1 E || fail "DT_SUNW_ASLR 0 with many DTs failed"
  73   75  
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX