1 #!/bin/sh 2 3 # Check decoding of SPARC-specific kern_features syscall. 4 5 . "${srcdir=.}/scno_tampering.sh" 6 7 run_prog ../kern_features > /dev/null 8 prog="$args" 9 fault_args='-a16 -e trace=kern_features -e inject=kern_features:retval=' 10 11 test_run_rval() 12 { 13 local run rval 14 run="$1"; shift 15 rval="$1"; shift 16 17 run_strace $fault_args$rval $prog $run > "$EXP" 18 match_diff "$LOG" "$EXP" 19 } 20 21 test_run_rval 0 0 22 test_run_rval 1 1 23 test_run_rval 2 2 24 test_run_rval 3 2147483646 # 0x7ffffffe 25 test_run_rval 4 2147483647 # 0x7fffffff 26 27 exit 0 # injecting retval < 0 not supported yet 28 29 case "$SIZEOF_KERNEL_LONG_T" in 30 4) 31 test_run_rval 5 3735943886 # 0xdeadface 32 test_run_rval 6 4294967295 # 0xffffffff 33 ;; 34 8) 35 test_run_rval 5 13464652301225294542 # 0xbadc0deddeadface 36 test_run_rval 6 18446744073709551615 # 0xffffffffffffffff 37 ;; 38 esac 39