File: inject-nf.test

package info (click to toggle)
strace 4.26-0.2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 35,988 kB
  • sloc: ansic: 95,598; sh: 7,155; makefile: 2,489; awk: 335; perl: 267; sed: 6
file content (55 lines) | stat: -rwxr-xr-x 1,013 bytes parent folder | download | duplicates (3)
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
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh -efu
#
# Check decoding of return values injected into a syscall that "never fails".
#
# Copyright (c) 2018 The strace developers.
# All rights reserved.
#
# SPDX-License-Identifier: GPL-2.0-or-later

. "${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