Print this page
Code review comments from jeffpc
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/test/os-tests/tests/secflags/secflags_aslr.sh
+++ new/usr/src/test/os-tests/tests/secflags/secflags_aslr.sh
1 1 #! /usr/bin/ksh
2 2 #
3 3 #
↓ open down ↓ |
3 lines elided |
↑ open up ↑ |
4 4 # This file and its contents are supplied under the terms of the
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 -# Copyright 2015, Richald Lowe.
14 +# Copyright 2015, Richard Lowe.
15 15
16 -# Verify that aslr musses things up, by comparing the mappings of 2 identical processes
16 +# Verify that aslr messes things up, by comparing the mappings of 2 identical
17 +# processes
17 18
18 19 LC_ALL=C # Collation is important
19 20
20 21 /usr/bin/psecflags -s aslr $$
21 22
22 23 tmpdir=/tmp/test.$$
23 24
24 25 mkdir $tmpdir
25 26 cd $tmpdir
26 27
27 28 cleanup() {
28 29 cd /
29 30 rm -fr $tmpdir
30 31 }
31 32
32 33 trap 'cleanup' EXIT
33 34
34 35 check() {
35 36 typeset name=$1
36 37 typeset command=$2
37 38
38 39 for (( i=0; i < 1000; i++ )); do
39 40 $command > out.$i
40 41 done
41 42
42 43 cat out.* | sort | uniq -c | sort -nk 1 | nawk '
43 44 BEGIN {
44 45 tot = 0
45 46 colls = 0
46 47 }
47 48
48 49 $2 != "text:" {
49 50 tot += $1
50 51 if ($1 > 1) {
51 52 colls += $1
52 53 }
53 54 }
54 55
55 56 END {
56 57 prc = (colls / tot) * 100
57 58 printf "'$name' Collisions: %d/%d (%g%%)\n", colls, tot, prc
58 59 exit prc
59 60 }
60 61 '
61 62 return $?
62 63 }
63 64
64 65 # Somewhat arbitrary
65 66 ACCEPTABLE=70
66 67
67 68 ret=0
68 69 check 32bit /opt/os-tests/tests/secflags/addrs-32
69 70 (( $? > $ACCEPTABLE )) && ret=1
70 71 check 64bit /opt/os-tests/tests/secflags/addrs-64
71 72 (( $? > $ACCEPTABLE )) && ret=1
72 73
73 74 exit $ret
↓ open down ↓ |
47 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX