• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2
3# Check decoding of SPARC-specific kern_features syscall.
4
5. "${srcdir=.}/scno_tampering.sh"
6
7run_prog ../kern_features > /dev/null
8prog="$args"
9fault_args='-a16 -e trace=kern_features -e inject=kern_features:retval='
10
11test_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
21test_run_rval 0 0
22test_run_rval 1 1
23test_run_rval 2 2
24test_run_rval 3 2147483646 # 0x7ffffffe
25test_run_rval 4 2147483647 # 0x7fffffff
26
27exit 0 # injecting retval < 0 not supported yet
28
29case "$SIZEOF_KERNEL_LONG_T" in
304)
31	test_run_rval 5 3735943886 # 0xdeadface
32	test_run_rval 6 4294967295 # 0xffffffff
33	;;
348)
35	test_run_rval 5 13464652301225294542 # 0xbadc0deddeadface
36	test_run_rval 6 18446744073709551615 # 0xffffffffffffffff
37	;;
38esac
39