Files
rk35xx-android14/external/strace/tests/inject-nf.test
T
hmz007 36ed224bac Rockchip Anroid14_SDK 20240628-rkr5 (2556df1a)
Signed-off-by: hmz007 <hmz007@gmail.com>
Change-Id: Ib87fdbe7a0be7dc961af3500fe9ea4589a127f9f
2024-10-29 18:12:02 +08:00

51 lines
897 B
Bash
Executable File

#!/bin/sh -efu
# Check decoding of return values injected into a syscall that "never fails".
. "${srcdir=.}/scno_tampering.sh"
case "$STRACE_ARCH" in
alpha)
SYSCALL=getpgrp
;;
*)
SYSCALL=getpid
;;
esac
run_prog
prog="$args"
fault_args="-a9 -e trace=${SYSCALL} -e inject=${SYSCALL}:retval="
test_rval()
{
local rval
rval="$1"; shift
run_strace $fault_args$rval $prog $rval > "$EXP"
match_diff "$LOG" "$EXP"
}
test_rval 0
test_rval 1
test_rval 0x7fffffff
test_rval 0x80000000
test_rval 0xfffff000
test_rval 0xfffffffe
test_rval 0xffffffff
case "$SIZEOF_KERNEL_LONG_T" in
8)
test_rval 0x80000000
test_rval 0xfffff000
test_rval 0xfffffffe
test_rval 0xffffffff
test_rval 0x100000000
test_rval 0x7fffffffffffffff
test_rval 0x8000000000000000
test_rval 0xfffffffffffff000
test_rval 0xfffffffffffffffe
test_rval 0xffffffffffffffff
;;
esac