File: ioctl-success.sh

package info (click to toggle)
strace 5.10-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 49,332 kB
  • sloc: ansic: 113,177; sh: 8,831; makefile: 3,108; awk: 364; perl: 267; sed: 9
file content (21 lines) | stat: -rwxr-xr-x 617 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
#!/bin/sh -efu
#
# Check decoding of ioctls using syscall injection.
#
# Expects a binary that accepts IOCTL_INJECT_START as the first argument.
#
# Copyright (c) 2018-2020 The strace developers.
# All rights reserved.
#
# SPDX-License-Identifier: GPL-2.0-or-later

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

: ${IOCTL_INJECT_START=256}
: ${IOCTL_INJECT_RETVAL=42}

run_strace -a50 "$@" -e trace=ioctl \
	-e inject=ioctl:retval="${IOCTL_INJECT_RETVAL}":when="${IOCTL_INJECT_START}+" \
	"../$NAME" "${IOCTL_INJECT_START}" "${IOCTL_INJECT_RETVAL}" > "$EXP"
grep -v '^ioctl([012][,<]' < "$LOG" > "$OUT"
match_diff "$OUT" "$EXP"