File: kern_features-fault.test

package info (click to toggle)
strace 6.13%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 71,488 kB
  • sloc: ansic: 176,497; sh: 9,675; makefile: 4,133; cpp: 885; awk: 353; perl: 267; exp: 62; sed: 9
file content (43 lines) | stat: -rwxr-xr-x 929 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
#
# Check decoding of SPARC-specific kern_features syscall.
#
# Copyright (c) 2018 The strace developers.
# All rights reserved.
#
# SPDX-License-Identifier: GPL-2.0-or-later

. "${srcdir=.}/scno_tampering.sh"

run_prog ../kern_features > /dev/null
prog="$args"
fault_args='-a16 -e trace=kern_features -e inject=kern_features:retval='

test_run_rval()
{
	local run rval
	run="$1"; shift
	rval="$1"; shift

	run_strace $fault_args$rval $prog $run > "$EXP"
	match_diff "$LOG" "$EXP"
}

test_run_rval 0 0
test_run_rval 1 1
test_run_rval 2 2
test_run_rval 3 2147483646 # 0x7ffffffe
test_run_rval 4 2147483647 # 0x7fffffff

exit 0 # injecting retval < 0 not supported yet

case "$SIZEOF_KERNEL_LONG_T" in
4)
	test_run_rval 5 3735943886 # 0xdeadface
	test_run_rval 6 4294967295 # 0xffffffff
	;;
8)
	test_run_rval 5 13464652301225294542 # 0xbadc0deddeadface
	test_run_rval 6 18446744073709551615 # 0xffffffffffffffff
	;;
esac