1 #!/bin/sh -efu 2 3 # Check decoding of return values injected into a syscall that "never fails". 4 5 . "${srcdir=.}/scno_tampering.sh" 6 7 case "$STRACE_ARCH" in 8 alpha) 9 SYSCALL=getpgrp 10 ;; 11 *) 12 SYSCALL=getpid 13 ;; 14 esac 15 16 run_prog 17 prog="$args" 18 fault_args="-a9 -e trace=${SYSCALL} -e inject=${SYSCALL}:retval=" 19 20 test_rval() 21 { 22 local rval 23 rval="$1"; shift 24 25 run_strace $fault_args$rval $prog $rval > "$EXP" 26 match_diff "$LOG" "$EXP" 27 } 28 29 test_rval 0 30 test_rval 1 31 test_rval 0x7fffffff 32 test_rval 0x80000000 33 test_rval 0xfffff000 34 test_rval 0xfffffffe 35 test_rval 0xffffffff 36 37 case "$SIZEOF_KERNEL_LONG_T" in 38 8) 39 test_rval 0x80000000 40 test_rval 0xfffff000 41 test_rval 0xfffffffe 42 test_rval 0xffffffff 43 test_rval 0x100000000 44 test_rval 0x7fffffffffffffff 45 test_rval 0x8000000000000000 46 test_rval 0xfffffffffffff000 47 test_rval 0xfffffffffffffffe 48 test_rval 0xffffffffffffffff 49 ;; 50 esac 51