File: legacy_syscall_info.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 (53 lines) | stat: -rwxr-xr-x 1,783 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
#!/bin/sh -efu
#
# Check legacy code used for obtaining syscall number, arguments,
# and return value when modern ptrace API was not available yet.
#
# Copyright (c) 2017-2021 Dmitry V. Levin <ldv@strace.io>
# Copyright (c) 2021-2024 The strace developers.
# All rights reserved.
#
# SPDX-License-Identifier: GPL-2.0-or-later

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

# The legacy API is broken on riscv64 with kernel 6.11+
# https://github.com/strace/strace/issues/315
[ "$(uname -m)" != "riscv64" ] ||
    require_max_kernel_version_or_skip 6.11

check_prog grep
$STRACE -d -enone / > /dev/null 2> "$LOG" ||:
grep -x "[^:]*strace: PTRACE_GET_SYSCALL_INFO works" "$LOG" > /dev/null ||
        skip_ 'PTRACE_GET_SYSCALL_INFO does not work'

run_prog ../chdir > /dev/null

helper='../../src/disable_ptrace_get_syscall_info'
$helper $args > /dev/null ||
	skip_ "$helper does not work"

$helper $STRACE -d -enone / > /dev/null 2> "$LOG" ||:
grep -x "[^:]*strace: PTRACE_GET_SYSCALL_INFO does not work" "$LOG" > /dev/null ||
	fail_ "$helper does not work properly"

> "$LOG" || fail_ "failed to write $LOG"
set -- --trace=chdir -a10 $args
$helper $STRACE -o "$LOG" "$@" > "$EXP" ||
	dump_log_and_fail_with "$helper $STRACE $* failed with code $?"

match_diff "$LOG" "$EXP"

helper2='../../src/disable_ptrace_getregset'
$helper2 $helper $args > /dev/null ||
	exit 0 # the second part of the test is not applicable

$helper2 $helper $STRACE -d -enone / > /dev/null 2> "$LOG" ||:
grep -x "[^:]*strace: PTRACE_GET_SYSCALL_INFO does not work" "$LOG" > /dev/null ||
	fail_ "$helper2 $helper does not work properly"

> "$LOG" || fail_ "failed to write $LOG"
$helper2 $helper $STRACE -o "$LOG" "$@" > "$EXP" ||
	dump_log_and_fail_with "$helper2 $helper $STRACE $* failed with code $?"

match_diff "$LOG" "$EXP"