diff options
author | Elliott Hughes <enh@google.com> | 2018-02-24 03:11:46 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-02-24 03:11:46 +0000 |
commit | 5b3348ca5f0829c9149c01ade3904c8ff828bb62 (patch) | |
tree | 4b0da9dce35635a264d079fb8ef8b27a16430c29 | |
parent | f174ca62c552149d51472717a480e2a571885b9a (diff) | |
parent | b755614143ce6aab5265ed32c1bb6c8f748e7898 (diff) | |
download | strace-o-mr1-iot-preview-7.tar.gz |
Merge "Update strace to 4.21."android-wear-p-preview-2android-p-preview-3android-p-preview-2android-p-preview-1android-o-mr1-iot-release-1.0.1android-o-mr1-iot-release-1.0.0android-o-mr1-iot-preview-8android-o-mr1-iot-preview-7android-n-iot-release-polk-at1android-n-iot-release-lg-thinq-wk7o-mr1-iot-preview-8o-mr1-iot-preview-7
1554 files changed, 27839 insertions, 7933 deletions
diff --git a/.strace.1.in.date b/.strace.1.in.date new file mode 100644 index 00000000..d7495831 --- /dev/null +++ b/.strace.1.in.date @@ -0,0 +1 @@ +2018-02-11 diff --git a/.tarball-version b/.tarball-version new file mode 100644 index 00000000..1fda809d --- /dev/null +++ b/.tarball-version @@ -0,0 +1 @@ +4.21 diff --git a/.version b/.version new file mode 100644 index 00000000..1fda809d --- /dev/null +++ b/.version @@ -0,0 +1 @@ +4.21 @@ -0,0 +1 @@ +2018 @@ -52,6 +52,7 @@ cc_binary { "fchownat.c", "fcntl.c", "fetch_bpf_fprog.c", + "fetch_indirect_syscall_args.c", "fetch_struct_flock.c", "fetch_struct_keyctl_kdf_params.c", "fetch_struct_mmsghdr.c", @@ -69,6 +70,7 @@ cc_binary { "futex.c", "getcpu.c", "getcwd.c", + "getpagesize.c", "getrandom.c", "get_robust_list.c", "hdio.c", @@ -88,6 +90,7 @@ cc_binary { "kcmp.c", "kexec.c", "keyctl.c", + "kvm.c", "ldt.c", "link.c", "listen.c", @@ -40,6 +40,7 @@ strace-devel@lists.sourceforge.net mailing list. Cai Fei <caifei@cn.fujitsu.com> Carlos O'Donell <carlos@systemhalted.org> Carmelo Amoroso <carmelo.amoroso@st.com> + Chen Jingpiao <chenjingpiao@gmail.com> Cheolung Lee <chpie@grayhash.com> Chris Dearman <chris.dearman@imgtec.com> Chris Metcalf <cmetcalf@tilera.com> @@ -48,6 +49,7 @@ strace-devel@lists.sourceforge.net mailing list. Christian Svensson <blue@cmd.nu> Christopher Covington <cov@codeaurora.org> D.J. Barrow <djbarrow@de.ibm.com> + DJ Delorie <dj@redhat.com> Damien Profeta <damien.profeta@amadeus.com> Damir Shayhutdinov <damir@altlinux.org> Daniel P. Berrange <berrange@redhat.com> @@ -66,7 +68,7 @@ strace-devel@lists.sourceforge.net mailing list. Edgar E. Iglesias <edgar.iglesias@gmail.com> Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com> Elliott Hughes <enh@google.com> - Elvira Khabirova <lineprinter0@gmail.com> + Elvira Khabirova <lineprinter@altlinux.org> Erik Johansson <erik@ejohansson.se> Etienne Gemsa <etienne.gemsa@lse.epita.fr> Eugene Syromyatnikov <evgsyr@gmail.com> @@ -89,6 +91,7 @@ strace-devel@lists.sourceforge.net mailing list. Greg Banks <gbanks@pocketpenguins.com> H.J. Lu <hongjiu.lu@intel.com> Harald van Dijk <truedfx@gentoo.org> + Harsha Sharma <harshasharmaiitr@gmail.com> Heiko Carstens <heiko.carstens@de.ibm.com> Helge Deller <deller@gmx.de> Henrik Storner <storner@osiris.ping.dk> @@ -104,7 +107,6 @@ strace-devel@lists.sourceforge.net mailing list. JayRJoshi <jay.r.joshi100@gmail.com> Jeff Mahoney <jeffm@suse.com> Jian Zhen <zhenjl@gmail.com> - JingPiao Chen <chenjingpiao@gmail.com> Jiri Slaby <jirislaby@gmail.com> Joakim Bech <joakim.bech@linaro.org> Joe Ilacqua <spike@world.std.com> @@ -184,6 +186,7 @@ strace-devel@lists.sourceforge.net mailing list. Robin Hack <hack.robin@gmail.com> Roland Borde <bo@uebemc.siemens.de> Roland McGrath <roland@redhat.com> + Rolf Eike Beer <eb@emlix.com> Romain Naour <romain.naour@smile.fr> Sami Farin <safari@u.safari.iki.fi> Sandhya Bankar <bankarsandhya512@gmail.com> @@ -215,6 +218,7 @@ strace-devel@lists.sourceforge.net mailing list. Vicente Olivert Riera <vincent@gentoo.org> Victor Krapivensky <krapivenskiy.va@phystech.edu> Vineet Gupta <Vineet.Gupta1@synopsys.com> + Vitaly Chaykovsky <mgspeker@gmail.com> Wang Chao <wang.chao@cn.fujitsu.com> Weichuan Yan <wchyan@marvell.com> Wichert Akkerman <wichert@deephackmode.org> @@ -1,3 +1,3258 @@ +2018-02-13 Dmitry V. Levin <ldv@altlinux.org> + + Prepare for 4.21 release. + * NEWS: Update for 4.21 release. + + Update copyright headers. + Headers updated automatically using maint/update_copyright_years.sh + script. + +2018-02-13 Eugene Syromyatnikov <evgsyr@gmail.com> + + Remove old and unused maintenance scripts. + Firewell, last witnesses of bygone era. + + * linux/sparc/gen.pl: Remove. + * linux/x86_64/gentab.pl: Likewise. + * xlate.el: Likewise. + * Makefile.am (EXTRA_DIST): Remove them. + + Suggested-by: Elvira Khabirova <lineprinter@altlinux.org> + Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org> + +2018-02-13 Dmitry V. Levin <ldv@altlinux.org> + + Consistently use MAX_ERRNO_VALUE. + * filter_qualify.c (parse_inject_token): Replace 4095 + with MAX_ERRNO_VALUE. + * negated_errno.h (is_negated_errno): Likewise. Remove redundant + comment. + + Export SIZEOF_LONG and SIZEOF_KERNEL_LONG_T to tests. + * configure.ac (AC_SUBST): Add SIZEOF_LONG and SIZEOF_KERNEL_LONG_T. + * tests/Makefile.am (SIZEOF_LONG, SIZEOF_KERNEL_LONG_T): New variables. + (AM_TEST_LOG_FLAGS): Pass them. + * bootstrap: Substitute them. + +2018-02-13 Eugene Syromyatnikov <evgsyr@gmail.com> + + tests: avoid ioctl_kvm_run test failure when built with gcc -O0. + When built with -O0, gcc (rightfully) generates function prologue, which + results in writing %rbp to the stack, causing premature KVM_EXIT_MMIO. + It could be possible to avoid such problems by "naked" attribute but, + unfortunately, the latter is not available on x86 with older GCC. + A trick suggested in [1] is used instead: assembly is moved + to the global scope. + + [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50242#c3 + + * tests/ioctl_kvm_run.c (code): Remove function. + Add globally scoped __asm__ with the function code and its size. + (code, code_size): New extern symbols declarations. + (run_kvm): Remove code_size definition and initialization. + + Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org> + +2018-02-13 Eugene Syromyatnikov <evgsyr@gmail.com> + + tests/ioctl_kvm_run.c: add KVM_EXIT_MMIO diagnostics. + As it has proven itself useful. + + * tests/ioctl_kvm_run.c (run_kvm) <case KVM_EXIT_MMIO:>: Fail + on unexpected KVM_EXIT_MMIO, providing relevant diagnostics. + +2018-02-13 Eugene Syromyatnikov <evgsyr@gmail.com> + + tests: add compatibility layer for accept call. + Recent glibc (since version 2.26) uses accept4 syscall for implementing + accept call on sparc. Unfortunately, it's impossible to simply fall + back on raw syscall as it had not been wired up until linux commit + v4.4-rc8~4^2~1. + + * tests/accept_compat.h: New file. + * tests/Makefile.am (EXTRA_DIST): Add it. + * tests/net-y-unix.c: Include accept_compat.h, use do_accept() + instead of accept() calls. + * tests/net-yy-inet.c: Likewise. + * tests/net-yy-unix.c: Likewise. + * tests/net.expected: Allow accept4. + +2018-02-12 Dmitry V. Levin <ldv@altlinux.org> + + debian: build strace-udeb separately. + * debian/rules (extra_build_targets): Add build-udeb-stamp. + (build-udeb/Makefile): New rule. + (clean): Remove build-udeb. + * debian/strace-udeb.install: Update. + + Fixes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=826223 + +2018-02-12 Dmitry V. Levin <ldv@altlinux.org> + + Enable symbol demangling in deb- and rpm-driven builds. + * debian/control (Build-Depends) [amd64]: Add libiberty-dev. + * strace.spec.in (buildrequires_libunwind_devel): Add binutils-devel. + +2018-02-12 Dmitry V. Levin <ldv@altlinux.org> + + debian: re-enable -k option on x86_64. + This partially reverts commit v4.13~177. + + * debian/control (Build-Depends) [amd64]: Add libunwind-dev. + +2018-02-12 Dmitry V. Levin <ldv@altlinux.org> + + Add "strace -V" output to build log. + * strace.spec.in (%check): Print "strace -V" output before + running the test suite. + * debian/rules (%-stamp): Likewise. + +2018-02-12 Eugene Syromyatnikov <evgsyr@gmail.com> + + xlat: update NT_* constants. + * xlat/nt_descriptor_types.in (NT_PPC_PKEY): New constant introduced + by linux kernel commit v4.16-rc1~93^2~72. + + Update the list of PKEY_* constants. + * xlat/pkey_access.in (PKEY_DISABLE_EXECUTE): New constant introduced + by linux kernel commit v4.16-rc1~93^2~85. + * tests/pkey_alloc.c: Update expected output. + * NEWS: Mention it. + + powerpc, powerpc64: wire up pkey_* syscalls. + * linux/powerpc/syscallent.h [384..386]: Add pkey_alloc, + pkey_free, and pkey_mprotect syscalls introduced by linux kernel + commits v4.16-rc1~93^2~70 and v4.16-rc1~93^2~69, respectively. + * linux/powerpc64/syscallent.h: Likewise. + * NEWS: Mention it. + + Update NEWS. + +2018-02-12 Eugene Syromyatnikov <evgsyr@gmail.com> + + linux/ia64: remove IA-32 mode support. + There is no compat support in strace and there are no systems + within reach that would allow to test it. + + * linux/ia64/arch_regs.c (IA64_PSR_IS, ia64_ia32mode): Remove. + * linux/ia64/get_error.c (get_error): Remove ia64_ia32mode branch. + * linux/ia64/get_scno.c (arch_get_scno): Likewise. + * linux/ia64/get_syscall_args.c (get_syscall_args): Likewise. + * linux/ia64/set_error.c (arch_set_error, arch_set_success): Likewise. + * linux/ia64/set_scno.c (arch_set_scno): Likewise. + +2018-02-12 Eugene Syromyatnikov <evgsyr@gmail.com> + + syscall.c: parse return code second time after injecting. + In order to have the same view as tracee has, with regards to + "never fail" syscalls. + + * syscall.c (tamper_with_syscall_exiting): Call get_error after the + return value tampering to re-initialise u_rval and u_error fields + of struct tcb. + +2018-02-11 Eugene Syromyatnikov <evgsyr@gmail.com> + + sparc: mark as an architecture that has a dedicated error register. + * linux/sparc/arch_defs_.h (HAVE_ARCH_DEDICATED_ERR_REG): New macro, + define to 1. + + strace.1.in: ffix. + +2018-02-11 Dmitry V. Levin <ldv@altlinux.org> + + Include <sys/ptrace.h> early. + Include "ptrace.h" before any header that can include <signal.h> + because on some architectures the latter may include <asm/sigcontext.h> + which in turn may include <asm/ptrace.h> with potentially devastating + effect on <sys/ptrace.h>. + + * process.c: Include "ptrace.h" before "regs.h". + * rt_sigframe.c: Likewise. + * sigreturn.c: Include "ptrace.h" before "nsig.h". + * syscall.c: Likewise. + * wait.c: Include "ptrace.h" before <sys/wait.h>. + * strace.c: Include "ptrace.h" before <signal.h>. + * tests/ptrace.c: Likewise. + * tests/test_ucopy.c: Include <sys/ptrace.h> before <signal.h>. + +2018-02-11 Dmitry V. Levin <ldv@altlinux.org> + + Include <limits.h> instead of <sys/param.h> + Do not include <sys/param.h> unnecessarily as it includes <signal.h>. + + * pathtrace.c: Include <limits.h> instead of <sys/param.h>. + * strace.c: Likewise. + * syscall.c: Likewise. + * util.c: Likewise. + * tests/getcwd.c: Likewise. + * tests/group_req.c: Likewise. + * tests/inode_of_sockfd.c: Likewise. + * tests/ip_mreq.c: Likewise. + * tests/printpath-umovestr.c: Likewise. + * tests/qual_fault.c: Likewise. + * tests/test_printpath.c: Likewise. + * tests/umovestr3.c: Likewise. + * tests/net-y-unix.c: Do not include <sys/param.h>. + * tests/net-yy-unix.c: Likewise. + +2018-02-10 Eugene Syromyatnikov <evgsyr@gmail.com> + + basic_filters.c: introduce scno_by_name. + As it will be used elsewhere. + + * basic_filters.c (scno_by_name): New function. + (qualify_syscall_name): Use it. + * defs.h (scno_by_name): New declaration. + +2018-02-10 Eugene Syromyatnikov <evgsyr@gmail.com> + + xstring.h: rephrase xappendstr description a bit. + +2018-02-10 Eugene Syromyatnikov <evgsyr@gmail.com> + + xlat.c: return NULL in sprintflags if there are no flags. + Otherwise the auxstr is rather ugly at times. + + * xlat.c (sprintflags): Return NULL if no flags were printed. + +2018-02-10 Eugene Syromyatnikov <evgsyr@gmail.com> + + Change type of injected rval to kernel_long_t. + * defs.h (struct inject_data): Change type of rval field to + kernel_ulong_t. + * filter_qualify.c (parse_inject_token): Use string_to_kulong instead of + string_to_uint for rval parsing. Warn if retval is clipped in compat + personality. + + Mark architectures that indicate syscall error in a dedicated register. + * linux/alpha/arch_defs_.h (HAVE_ARCH_DEDICATED_ERR_REG): New macro, + define to 1. + * linux/ia64/arch_defs_.h: Likewise. + * linux/mips/arch_defs_.h: Likewise. + * linux/powerpc/arch_defs_.h: Likewise. + * linux/powerpc64/arch_defs_.h: Likewise. + * linux/sparc64/arch_defs_.h: Likewise. + * linux/arch_defs_.h [!HAVE_ARCH_DEDICATED_ERR_REG] + (HAVE_ARCH_DEDICATED_ERR_REG): New macro, define to 0. + * linux/nios2/arch_defs_.h: New file. + * Makefile.am (EXTRA_DIST): Add it. + +2018-02-10 Eugene Syromyatnikov <evgsyr@gmail.com> + + Make string_to_uint_ex more universal. + And add support for reading of various types. + + * string_to_uint.c (string_to_uint_ex): Change to work with long long. + (string_to_uint): Move it... + * string_to_uint.h (string_to_uint): ...here. + (string_to_uint_upto): Accept long long as max_val, return long long. + (string_to_ulong, string_to_kulong, string_to_ulonglong): New functions, + for completeness. + + Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org> + +2018-02-10 Eugene Syromyatnikov <evgsyr@gmail.com> + + Add pure syscall flag. + * basic_filters.c (lookup_class) <syscall_class>: Add "%pure" for + TRACE_PURE. + * sysent.h (TRACE_PURE): New syscall flag. + * sysent_shorthand_defs.h (PU): New shorthand macro. + * linux/32/syscallent.h ([172], [173], [174], [175], [176], [177], + [178]): Add PU flag to getpid, getppid, getuid, geteuid, getgid, + getegid, gettid syscalls. + * linux/64/syscallent.h ([172], [173], [174], [175], [176], [177], + [178]): Add PU flag to getpid, getppid, getuid, geteuid, getgid, + getegid, gettid syscalls. + * linux/aarch64/syscallent.h ([1060]): Add PU flag to getpgrp syscalls. + * linux/alpha/syscallent.h ([20], [24], [47], [63], [64], [89], + [378]): Add PU flag to getxpid, getxuid, getxgid, getpgrp, getpagesize, + getdtablesize, gettid syscalls. + * linux/arc/syscallent.h ([246]): Add PU flag to arc_gettls syscalls. + * linux/arm/syscallent.h ([20], [24], [47], [49], [50], [64], [65], + [199], [200], [201], [202], [224], [ARM_FIRST_SHUFFLED_SYSCALL+1+6]): + Add PU flag to getpid, getuid, getgid, geteuid, getegid, getppid, + getpgrp, getuid32, getgid32, geteuid32, getegid32, gettid, get_tls + syscalls. + * linux/avr32/syscallent.h ([20], [24], [47], [49], [50], [64], [65], + [176]): Add PU flag to getpid, getuid, getgid, geteuid, getegid, + getppid, getpgrp, gettid syscalls. + * linux/bfin/syscallent.h ([20], [24], [47], [49], [50], [64], [65], + [199], [200], [201], [202], [224]): Add PU flag to getpid, getuid, + getgid, geteuid, getegid, getppid, getpgrp, getuid32, getgid32, + geteuid32, getegid32, gettid syscalls. + * linux/hppa/syscallent.h ([20], [24], [47], [49], [50], [64], [65], + [206]): Add PU flag to getpid, getuid, getgid, geteuid, getegid, + getppid, getpgrp, gettid syscalls. + * linux/i386/syscallent.h ([20], [24], [47], [49], [50], [64], [65], + [199], [200], [201], [202], [224]): Add PU flag to getpid, getuid, + getgid, geteuid, getegid, getppid, getpgrp, getuid32, getgid32, + geteuid32, getegid32, gettid syscalls. + * linux/ia64/syscallent.h ([1041], [1042], [1046], [1047], [1062], + [1063], [1105], [1171]): Add PU flag to getpid, getppid, getuid, + geteuid, getgid, getegid, gettid, getpagesize syscalls. + * linux/m68k/syscallent.h ([20], [24], [47], [49], [50], [64], + [65], [166], [199], [200], [201], [202], [221], [333]): Add PU flag + to getpid, getuid, getgid, geteuid, getegid, getppid, getpgrp, + getpagesize, getuid32, getgid32, geteuid32, getegid32, gettid, + get_thread_area syscalls. + * linux/metag/syscallent.h ([248]): Add PU flag to metag_get_tls + syscalls. + * linux/microblaze/syscallent.h ([20], [24], [47], [49], [50], [64], + [65], [199], [200], [201], [202], [224]): Add PU flag to getpid, + getuid, getgid, geteuid, getegid, getppid, getpgrp, getuid32, getgid32, + geteuid32, getegid32, gettid syscalls. + * linux/powerpc64/syscallent.h ([20], [24], [47], [49], [50], [64], + [65], [207]): Add PU flag to getpid, getuid, getgid, geteuid, getegid, + getppid, getpgrp, gettid syscalls. + * linux/powerpc/syscallent.h ([20], [24], [47], [49], [50], [64], + [65], [207]): Add PU flag to getpid, getuid, getgid, geteuid, getegid, + getppid, getpgrp, gettid syscalls. + * linux/s390/syscallent.h ([20], [24], [47], [49], [50], [64], [65], + [199], [200], [201], [202], [236]): Add PU flag to getpid, getuid, + getgid, geteuid, getegid, getppid, getpgrp, getuid32, getgid32, + geteuid32, getegid32, gettid syscalls. + * linux/s390x/syscallent.h ([20], [64], [65], [199], [200], [201], + [202], [236]): Add PU flag to getpid, getppid, getpgrp, getuid, + getgid, geteuid, getegid, gettid syscalls. + * linux/sh64/syscallent.h ([20], [24], [47], [49], [50], [64], [65], + [199], [200], [201], [202], [252]): Add PU flag to getpid, getuid, + getgid, geteuid, getegid, getppid, getpgrp, getuid32, getgid32, + geteuid32, getegid32, gettid syscalls. + * linux/sh/syscallent.h ([20], [24], [47], [49], [50], [64], [65], + [199], [200], [201], [202], [224]): Add PU flag to getpid, getuid, + getgid, geteuid, getegid, getppid, getpgrp, getuid32, getgid32, + geteuid32, getegid32, gettid syscalls. + * linux/sparc64/syscallent.h ([20], [24], [47], [49], [50], [64], [81], + [143], [197], [340]): Add PU flag to getpid, getuid, getgid, geteuid, + getegid, getpagesize, getpgrp, gettid, getppid, kern_features syscalls. + * linux/sparc/syscallent.h ([20], [24], [44], [47], [49], [50], [53], + [64], [69], [70], [81], [143], [197], [340]): Add PU flag to getpid, + getuid, getuid32, getgid, geteuid, getegid, getgid32, getpagesize, + geteuid32, getegid32, getpgrp, gettid, getppid, kern_features syscalls. + * linux/x32/syscallent.h ([39], [102], [104], [107], [108], [110], + [111], [186]): Add PU flag to getpid, getuid, getgid, geteuid, getegid, + getppid, getpgrp, gettid syscalls. + * linux/x86_64/syscallent.h ([39], [102], [104], [107], [108], [110], + [111], [186]): Add PU flag to getpid, getuid, getgid, geteuid, getegid, + getppid, getpgrp, gettid syscalls. + * linux/xtensa/syscallent.h ([120], [127], [137], [139], [140], [141], + [150], [151]): Add PU flag to getpid, gettid, getuid, getgid, geteuid, + getegid, getppid, getpgrp syscalls. + * strace.1.in (.SS Filtering): Document it. + * NEWS: Mention it. + + syscall.c: warn if tampering failed. + + syscall.c: set errno if syscall is tampered. + +2018-02-10 Eugene Syromyatnikov <evgsyr@gmail.com> + + tests/nsyscall-d.test: swap exp and log in diff calls. + In line with the rest of the tests. + + * tests/nsyscalls-d.test: swap arguments of match_diff calls. + +2018-02-10 Eugene Syromyatnikov <evgsyr@gmail.com> + + linux/arm/get_scno.c: use debug_msg. + * linux/arm/get_scno.c (arch_get_scno): replace if (debug_flag) { + error_msg() } with debug_msg() call. + +2018-02-10 Eugene Syromyatnikov <evgsyr@gmail.com> + + Do not shuffle scno inside syscall_name. + This makes interface a bit irregular otherwise. + + * defs.h (syscall_name): Clarify description. + * syscall.c (syscall_name): Do not call shuffle_scno. + * printsiginfo.c (print_si_info) <case SIGSYS>: Use shuffle_scno. + +2018-02-10 Eugene Syromyatnikov <evgsyr@gmail.com> + + Handle very special __ARM_NR_-prefixed syscalls. + * linux/aarch64/nr_prefix.c: New file. + * linux/arm/nr_prefix.c: Likewise. + * linux/nr_prefix.c: Likewise. + * Makefile.am (EXTRA_DIST): Add them. + * printsiginfo.c: Include nr_prefix.c + (print_si_info): Use nr_prefix. + + Make shuffle_scno globally available. + * syscall.c (shuffle_scno): Move the declaration... + * defs.h (shuffle_scno): ...here. Remove static qualifier. + * linux/aarch64/shuffle_scno.c (shuffle_scno): Remove static qualifier. + * linux/arm/shuffle_scno.c: Likewise. + * linux/shuffle_scno.c: Likewise. + * linux/x32/shuffle_scno.c: Likewise. + * linux/x86_64/shuffle_scno.c: Likewise. + +2018-02-10 Eugene Syromyatnikov <evgsyr@gmail.com> + + syscall.c: use shuffle_scno in syscall_name. + syscall_name() is used only in printsiginfo.c:print_si_info currently, + and is supplied with raw syscall number (that's why it has this ugly + __X32_SYSCALL_BIT hack). But since it handled only __X32_SYSCALL_BIT and + not shuffle_scno(), it was broken on ARM. Let's replace it with shuffle_scno + call, as it handles both the case of shuffled ARM syscalls and the + __X32_SYSCALL_BIT. + + * syscall.c (syscall_name): Call shuffle_scno instead of custom + __X32_SYSCALL_BIT handling. + +2018-02-09 Eugene Syromyatnikov <evgsyr@gmail.com> + + Use shuffle_scno for x32 syscall numbers. + This changes behaviour of printing of unknown syscall. + + * linux/x32/shuffle_scno.c: New file. + * linux/x86_64/shuffle_scno.c: Likewise. + * Makefile.am (EXTRA_DIST): Add them. + * linux/x86_64/get_scno.c (arch_get_scno): Do not clear + __X32_SYSCALL_BIT. + * tests/nsyscalls.c: Update expected output. + +2018-02-09 Eugene Syromyatnikov <evgsyr@gmail.com> + + Move shuffle_scno() invocation to get_scno. + * linux/aarch64/get_scno.c (arch_get_scno): Remove shuffle_scno call. + * linux/arm/get_scno.c (arch_get_scno): Remove shuffle_scno calls. + * syscall.c (get_scno): Call shuffle_scno after arch_get_scno. + +2018-02-09 Eugene Syromyatnikov <evgsyr@gmail.com> + + Move shuffle_scno to arch-specific file. + While we are here, let's fix AArch64 by limiting scno shuffling + to compat personality only. + + * syscall.c: Include shuffle_scno.c. + (shuffle_scno): Move it to a... + * linux/arm/shuffle_scno.c: New file. + * linux/aarch64/shuffle_scno.c: New file, define arm's shuffle_scno + as arm_shuffle_scno and call it only for personality 1. + * linux/shuffle_scno.c: New file, fallback trivial shuffle_scno + definition. + * Makefile.am (EXTRA_DIST): Add them. + +2018-02-09 Eugene Syromyatnikov <evgsyr@gmail.com> + + Print unknown syscall number in hexadecimal. + * syscall.c (struct sysent_buf): Update buf field size. + (get_scno): Print unknown syscall number in hexadecimal form. + * tests/nsyscalls.c: Update expected output. + * strace.1.in: Document it. + * NEWS: Mention it. + + tests/accept.c: call accept syscall directly, if available. + * tests/accept.c [__NR_accept && !TEST_SYSCALL_NAME]: Define a wrapper that + calls accept directly. + * tests/sockname.c [TEST_SYSCALL_STR]: Do not define TEST_SYSCALL_STR. + + printsiginfo.c: add a comment about personality detection for SIGSYS. + Looks like it is not necessary, after all. + +2018-02-09 Eugene Syromyatnikov <evgsyr@gmail.com> + + linux/x86_64/set_error.c: update eax for compat personality. + Since this is where get_error gets the return value from in the compat case. + + linux/x86_64/set_error.c (set_error, set_success): Update i386_regs.eax + if tracee is in compat personality. + +2018-02-09 Eugene Syromyatnikov <evgsyr@gmail.com> + + Mark various arch-specific syscalls with SYSCALL_NEVER_FAILS. + * linux/alpha/syscallent.h (getpagesize, getdtablesize): Add NF flag. + * linux/arc/syscallent.h (arc_gettls): Likewise. + * linux/arm/syscallent.h (get_tls): Likewise. + * linux/ia64/syscallent.h (getpagesize): Likewise. + * linux/m68k/syscallent.h (getpagesize, get_thread_area): Likewise. + * linux/sparc/syscallent.h (getpagesize): Likewise. + * linux/sparc64/syscallent.h (getpagesize): Likewise. + +2018-02-09 Eugene Syromyatnikov <evgsyr@gmail.com> + + Add SYSCALL_NEVER_FAILS flag to getpgrp. + As glibc, at least, treats it this way. + + * linux/aarch64/syscallent.h (getpgrp): Add NF flag. + * linux/alpha/syscallent.h: Likewise. + * linux/arm/syscallent.h: Likewise. + * linux/avr32/syscallent.h: Likewise. + * linux/bfin/syscallent.h: Likewise. + * linux/hppa/syscallent.h: Likewise. + * linux/i386/syscallent.h: Likewise. + * linux/m68k/syscallent.h: Likewise. + * linux/microblaze/syscallent.h: Likewise. + * linux/powerpc/syscallent.h: Likewise. + * linux/powerpc64/syscallent.h: Likewise. + * linux/s390/syscallent.h: Likewise. + * linux/s390x/syscallent.h: Likewise. + * linux/sh/syscallent.h: Likewise. + * linux/sh64/syscallent.h: Likewise. + * linux/sparc/syscallent.h: Likewise. + * linux/sparc64/syscallent.h: Likewise. + * linux/x32/syscallent.h: Likewise. + * linux/x86_64/syscallent.h: Likewise. + * linux/xtensa/syscallent.h: Likewise. + +2018-02-09 Eugene Syromyatnikov <evgsyr@gmail.com> + + linux/x86_64/get_error.c: do not sign-extend if no error happened. + +2018-02-09 Eugene Syromyatnikov <evgsyr@gmail.com> + + tests/membarrier.c: fix expected output on nohz_full systems. + If nohz_full is enabled, MEMBARRIER_CMD_GLOBAL is not available. + + * tests/membarrier.c: check availability of MEMBARRIER_CMD_GLOBAL + separately. + +2018-02-09 Eugene Syromyatnikov <evgsyr@gmail.com> + + Update MEMBARRIER_CMD_* constants. + * xlat/membarrier_cmds.in: Add new constants, rename + MEMBARRIER_CMD_SHARED to MEMBARRIER_CMD_GLOBAL. + * NEWS: Mention this. + * tests/membarrier.c (main): Update expected output. + + Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org> + +2018-02-07 Eugene Syromyatnikov <evgsyr@gmail.com> + + perf.c: print group_fd argument of perf_event_open syscall as fd. + * perf.c (SYS_FUNC(perf_event_open)): Print 4th argument using printfd. + + syscall.c: print higher bits of syscall return value on x32 personality. + * syscall.c (syscall_exiting_trace): Check for current_klongsize instead + of current_wordsize to determine the size of tcp->u_rval. + + strace.1.in: history update. + strace.1.in (.SH HISTORY): Some amendments based on + https://github.com/strace/strace-talks/blob/master/2012-ossdevconf-obninsk-strace_from_upstream_PoV/ossdevconf_2012-slides-strace_from_upstream_PoV.tex + + strace.1.in: minor changes. + * strace.1.in (.SH DESCRIPTION): s/a passion/passion/, + s/Here the/Here, the/, s/Where traditional/Where the traditional/, + s/output has proven/output is proven/, s/In all cases/In most cases,/¸ + embolden st_mode, lstat, SIGCHLD, and SIGTTOU mentions, + s/In some cases /In some cases, / + (.SS Output format) <-o>: de-italicize dot in "filename.pid", convert + the sentence's voice to passive, some other rephrasing. Mention + incompatibility of output piping with -ff mode. + (.SS Output options) <-t>: s/time of day/wall clock time/. + (.SS Statistics) <-c>: Remove "on Linux" mention, -F option mention. + + README.md: add information about git repository location. + * README.md: Mention URLs for SourceForge, GitHub, and GitLab + repositories. + +2018-02-07 Dmitry V. Levin <ldv@altlinux.org> + + tests: rewrite net-accept-connect.c without strncpy. + gcc8 -Wall -Werror rejects our method of struct sockaddr_un.sun_path + initialization because the field lacks __nonstring__ attribute. + + As we calculate the length of the string being copied anyway, + workaround this gcc+glibc bug by changing the code to use this + pre-calculated length and get rid of strncpy completely. + + * tests/net-accept-connect.c (main): Use memcpy to initialize sun_path. + +2018-02-06 Dmitry V. Levin <ldv@altlinux.org> + + Use kernel's fcntl.h header instead of libc's for open_mode_flags. + As definitions of O_* macros provided by various libc implementations + are usually less reliable than those provided by kernel headers, switch + to use kernel's fcntl.h header. + + * open.c: Include <asm/fcntl.h> instead of <fcntl.h>. Remove + O_LARGEFILE fallback definitions assuming that the kernel headers + provide them. + * xlat/open_mode_flags.in: Add __O_SYNC after O_SYNC. Add O_TMPFILE + and __O_TMPFILE before O_DIRECTORY. Remove "O_TMPFILE & ~O_DIRECTORY". + * tests/open.c: Include <asm/fcntl.h> instead of <fcntl.h>. Remove + workarounds for libc O_TMPFILE implementations. + * tests/openat.c: Include <asm/fcntl.h> instead of <fcntl.h>. + (test_mode_flag): New function. + (main): Use it to check decoding of all access modes and file flags. + * tests/gen_tests.in (openat): Add -a option. + + Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com> + +2018-02-06 Dmitry V. Levin <ldv@altlinux.org> + + xlat: update TCP_* constants. + * xlat/socktcpoptions.in: Add TCP_FASTOPEN_KEY and + TCP_FASTOPEN_NO_COOKIE introduced by linux kernel commits + v4.15-rc1~84^2~387 and v4.15-rc1~84^2~339, respectively. + * NEWS: Mention this. + + xlat: update IPV6_* constants. + * xlat/sockipv6options.in: Add IPV6_FREEBIND introduced by linux kernel + commit v4.15-rc1~84^2~601. + * NEWS: Mention this. + + xlat: update MAP_* constants. + * xlat/mmap_flags.in: Add MAP_SHARED_VALIDATE and MAP_SYNC introduced + by linux kernel commits v4.15-rc1~71^2^2~23 and v4.15-rc1~71^2^2~12, + respectively. + * NEWS: Mention this. + +2018-02-06 Eugene Syromyatnikov <evgsyr@gmail.com> + + tests: avoid triggering -Wstringop-truncation in ioctl_dm.c. + * tests/ioctl_dm.c: Replace strncpy calls with memcpy as the character + arrays being copied are not C strings. + + Makefile.am: minor EXTRA_DIST formatting changes. + + Move large file-related wrappers to a separate header. + * strace.c [_LARGEFILE64_SOURCE]: Move the definitions under it to a... + * largefile_wrappers.h: ... new file. + * Makefile.am (strace_SOURCES): Add it. + +2018-01-29 Dmitry V. Levin <ldv@altlinux.org> + + strace.1: fix wording about setuid installation. + * strace.1.in (SETUID INSTALLATION): Fix wording. + + Closes: https://github.com/strace/strace/issues/24 + +2018-01-29 Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org> + + Add KVM_PPC_GET_CPU_CHAR ioctl definition from linux v4.15. + * linux/powerpc/ioctls_arch0.h: Update from linux v4.15 + using ioctls_gen.sh. + +2018-01-29 Eugene Syromyatnikov <evgsyr@gmail.com> + + Update NEWS. + + tests: check s390_pci_mmio_read and s390_pci_mmio_write decoders. + * tests/s390_pci_mmio_read_write.c: New file. + * tests/.gitignore: Add s390_pci_mmio_read_write. + * tests/pure_executables.list: Likewise. + * tests/gen_tests.in (s390_pci_mmio_read_write): New test. + + Introduce s390_pci_mmio_read, s390_pci_mmio_write system call decoders. + * linux/s390/syscallent.h ([352]): Change decoder to s390_pci_mmio_write. + ([353]): Change decoder to s390_pci_mmio_read. + * linux/s390x/syscallent.h: Likewise. + * s390.c (SYS_FUNC(s390_pci_mmio_write), SYS_FUNC(s390_pci_mmio_read)): + New function. + + tests: check s390_runtime_instr system call decoder. + * tests/s390_runtime_instr.c: New file. + * tests/.gitignore: Add s390_runtime_instr. + * tests/pure_executables.list: Likewise. + * tests/gen_tests.in (s390_runtime_instr): New test. + + Introduce s390_runtime_instr system call decoder. + * linux/s390/syscallent.h ([342]): Change decoder to s390_runtime_instr. + * linux/s390x/syscallent.h: Likewise. + * s390.c (SYS_FUNC(s390_runtime_instr)): New function. + * xlat/s390_runtime_instr_commands.in: New file. + + tests: check s390_guarded_storage system call decoder. + * configure.ac (AC_CHECK_HEADERS): Add asm/guarded_storage.h. + * tests/s390_guarded_storage-v.c: New file. + * tests/s390_guarded_storage.c: Likewise. + * tests/.gitignore: Add s390_guarded_storage, s390_guarded_storage-v. + * tests/pure_executables.list: Likewise. + * tests/gen_tests.in (s390_guarded_storage, s390_guarded_storage-v): + New tests. + + Introduce s390_guarded_storage system call decoder. + * linux/s390/syscallent.h ([378]): Change decoder to s390_guarded_storage. + * linux/s390x/syscallent.h: Likewise. + * s390.c (struct guard_storage_control_block, + struct guard_storage_event_parameter_list): New structure type + definition. + (guard_storage_print_gsepl, guard_storage_print_gscb, + SYS_FUNC(s390_guarded_storage)): New function. + (DIV_ROUND_UP): New macro. + * xlat/s390_guarded_storage_commands.in: New file. + + tests: check s390_sthyi system call decoder. + * configure.ac (AC_CHECK_FUNCS): Add iconv_open. + (AC_CHECK_HEADERS): Add iconv.h. + * tests/s390_sthyi-v.c: New file. + * tests/s390_sthyi.c: Likewise. + * tests/.gitignore: Add s390_sthyi, s390_sthyi-v. + * tests/pure_executables.list: Likewise. + * tests/gen_tests.in (s390_sthyi, s390_sthyi): New tests. + + Introduce s390_sthyi system call decoder. + * s390.c: New file. + * Makefile.am (strace_SOURCES): Add it. + * linux/s390/syscallent.h ([380]): Change decoder to s390_sthyi. + * linux/s390x/syscallent.h: Likewise. + * xlat/s390_sthyi_function_codes.in: New file. + + print_fields.h: add macro to print hexadecimal array field. + * print_fields.h (PRINT_FIELD_HEX_ARRAY): New macro, prints target + array with QUOTE_FORCE_HEX. + +2018-01-29 Eugene Syromyatnikov <evgsyr@gmail.com> + + Add print_quoted_string flag to generate comment. + Because there are never enough print_quoted_string flags. + + * defs.h (QUOTE_EMIT_COMMENT): New quoting flag macro constant. + * util.c (string_quote): Emit " /* " in the beginning and " */" in the + end if QUOTE_EMIT_COMMENT is passed. + (print_quoted_string): Increase alloc_size by 7 if QUOTE_EMIT_COMMENT is + passed. + +2018-01-25 Eugene Syromyatnikov <evgsyr@gmail.com> + + tests: make ioctl.test more flexible, use it for the rest of ioctl tests + As the remaining non-generated ioctl tests differ from ioctl.test only + in strace options, and since gen_tests.sh can pass arguments to sourced + tests, replace the remaining non-generated ioctl tests with invocations + of ioctl.test with appropriate parameters. + + * tests/ioctl.test: Pass script arguments to the strace invocation. + * tests/gen_tests.in (ioctl_dm): New entry, invoke ioctl.test with -s9. + (ioctl_dm-v): New entry, invoke ioctl.test with -v -s9. + (ioctl_kvm_run): New entry, invoke ioctl.test with -a36 -y. + (ioctl_loop-nv): New entry, invoke ioctl.test with -a22 -e verbose=none. + (ioctl_nsfs): New entry, invoke ioctl.test with -esignal=none. + (ioctl_sock_gifconf): New entry, invoke ioctl.test with -a28 -s1. + (ioctl_evdev-v, ioctl_loop-v, ioctl_rtc-v): Invoke ioctl.test + with -v option instead of ioctl-v.sh. + * tests/ioctl_dm-v.test: Remove. + * tests/ioctl_dm.test: Likewise. + * tests/ioctl_kvm_run.test: Likewise. + * tests/ioctl_loop-nv.test: Likewise. + * tests/ioctl_nsfs.test: Likewise. + * tests/ioctl_sock_gifconf.test: Likewise. + * tests/ioctl-v.sh: Likewise. + * tests/Makefile.am (DECODER_TESTS, EXTRA_DIST): Remove them. + +2018-01-25 Eugene Syromyatnikov <evgsyr@gmail.com> + + tests/gen_tests.sh: enable passing arguments to sourced tests. + * tests/gen_tests.sh: Read first argument separately, put it in $arg0, + and the rest of the arguments in $args. + (case "$arg0" in) <+*)>: Set command line to $args and source $arg0. + + xlat/gen.sh: add some rudimentary support for comments. + * xlat/gen.sh: Trim parts of the string abbreviated in "/*" and "*/" + + configure.ac: sort architectures in lexicographical order. + * configure.ac (case "$host_cpu"): sort architectures in alphabetical + order. + +2018-01-25 Dmitry V. Levin <ldv@altlinux.org> + + Drop non-functional CRIS architecture support. + From the very first commit when CRIS architecture support was introduced + and up to this comment that ends the agony of this non-functional code, + this support was incomplete and could never be compiled. + + * Makefile.am (EXTRA_DIST): Remove linux/crisv*. + * clone.c: Remove CRISV* checks. + * configure.ac ($host_cpu == cris*): Remove. + * linux/crisv10: Remove. + * linux/crisv32: Likewise. + + Fixes: v4.5.18-77-gea0e6e8 ("CRIS support by Hinko Kocevar ...") + +2018-01-25 Eugene Syromyatnikov <evgsyr@gmail.com> + + Update futex test in accordance with kernel's v4.15-rc7-202-gfbe0e83. + * futex.c (VALP, VALP_PR, VAL2P, VAL2P_PR): New macro definitions. + (main): Allow EINVAL on *REQUEUE* checks with VAL/VAL2 with higher bit + being set, check that the existing behaviour preserved with VALP/VAL2P + where higher bit is unset. + + tests/futex.c: improve error diagnostics. + * tests/futex.c (futex_error): Add func and line arguments, print them. + (CHECK_FUTEX_GENERIC): Pass __func__ and __LINE__ to futex_error. + + Add syscall entry for ARM-specific get_tls syscall. + * linux/arm/syscallent.h ([ARM_FIRST_SHUFFLED_SYSCALL+1+6]): New entry. + (ARM_LAST_SPECIAL_SYSCALL): Update to 6. + * NEWS: Mention it. + +2018-01-25 Eugene Syromyatnikov <evgsyr@gmail.com> + + Fix syscall descriptions for ARM-specific system calls. + Based on an analysis of arm_syscall in arch/arm/kernel/traps.c. + + * linux/arm/syscallent.h ([ARM_FIRST_SHUFFLED_SYSCALL+1+2]): Update + argument number, add TM flag. + ([ARM_FIRST_SHUFFLED_SYSCALL+1+1], [ARM_FIRST_SHUFFLED_SYSCALL+1+3], + [ARM_FIRST_SHUFFLED_SYSCALL+1+4], [ARM_FIRST_SHUFFLED_SYSCALL+1+5]): + Update argument number. + +2018-01-25 Eugene Syromyatnikov <evgsyr@gmail.com> + + tests: check riscv_flush_icache syscall decoder. + * tests/riscv_flush_icache.c: New file. + * tests/.gitignore: Add riscv_flush_icache. + * tests/gen_tests.in: Likewise. + * tests/pure_executables.list: Likewise. + + Implement decoding of riscv_flush_icache syscall. + * linux/riscv/syscallent.h ([259]): Add riscv_flush_icache entry. + * riscv.c: New file. + * Makefile.am (strace_SOURCES): Add it. + * xlat/riscv_flush_icache_flags.in: New file. + * NEWS: Mention it. + +2018-01-25 Eugene Syromyatnikov <evgsyr@gmail.com> + + Workaround stray PTRACE_EVENT_EXEC. + We (apparently) had a long-standing test failure inside strace-ff.test + with the symptom that it misses exit_group call. As it turned out, it + was PTRACE_EVENT_EXEC followed by execve syscall exiting stop. That + behaviour indeed screwed all the syscall state tracking for the tracee. + Let's try to patch it up by calling trace_syscall when we receive + PTRACE_EVENT_EXEC outside syscall. + + * defs.h (TCB_RECOVERING): New tcb flag. + * strace.c (dispatch_event) <case TE_STOP_BEFORE_EXECVE>: Invoke + trace_syscall with TCB_RECOVERING flag being set for the current_tcp + if the tracee is not on exiting syscall. + * syscall.c (get_scno): Set QUAL_RAW if we are recovering. + (tamper_with_syscall_entering): Do not perform actual tampering during + recovery as it's already too late. + * NEWS: Mention it. + + Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org> + +2018-01-24 Dmitry V. Levin <ldv@altlinux.org> + + tests: robustify set_ptracer_any. + * tests/set_ptracer_any.c (main) [HAVE_PRCTL]: Provide fallback + definitions for PR_SET_PTRACER and PR_SET_PTRACER_ANY constants, + set all unused prctl arguments to 0. + +2018-01-24 Dmitry V. Levin <ldv@altlinux.org> + + ia64: do not bail out in get_syscall_args if umove fails with EPERM. + If the kernel contains commit 84d77d3f06e7e8dea057d10e8ec77ad71f721be3, + both PTRACE_PEEKDATA and process_vm_readv become unavailable when the + process dumpable flag is cleared, on ia64 this results to all syscall + arguments being unavailable. + + Recognize this situation and do not treat it as get_syscall_args error + because the latter leaves the tracee in a ptrace stop. + + This condition used to be triggered by prctl-dumpable test that caused + strace to hang indefinitely. + + * linux/ia64/get_syscall_args.c (get_syscall_args): Do not bail out + if umove fails. + * tests/prctl-dumpable.c [__ia64__]: Skip the test. + +2018-01-24 Eugene Syromyatnikov <evgsyr@gmail.com> + + strace.c: reset printing_tcp on print_event_exit. + print_event_exit should have printing_tcp setup analogous to printleader and + syscall_exit_trace before printing its part, otherwise it spuriously resets + curcol in line_ended for the stale printing_tcp if followfork == 2. + + * strace.c (print_event_exit): Set printing_tcp to tcp before printing + exiting event line and calling line_ended. + +2018-01-23 Dmitry V. Levin <ldv@altlinux.org> + + tests: check path tracing of old select syscall. + * tests/xselect.c [xselect] (xselect): Turn into prototype. + * tests/oldselect-P.c: New file. + * tests/oldselect-efault-P.c: Likewise. + * tests/oldselect-efault.c: Likewise. + * tests/oldselect.c: Use xselect.c + * tests/pure_executables.list: Add oldselect-efault. + * tests/gen_tests.in (oldselect, oldselect-P, oldselect-efault, + oldselect-efault-P): New entries. + * tests/oldselect.expected: Remove. + * tests/oldselect.test: Remove. + * tests/Makefile.am (check_PROGRAMS): Add oldselect-P + and oldselect-efault-P. + (DECODER_TESTS): Remove oldselect.test. + (EXTRA_DIST): Remove oldselect.expected. + * tests/.gitignore: Add oldselect-P, oldselect-efault, + and oldselect-efault-P. + + tests: check path tracing of select/_newselect syscalls. + * tests/xselect.c (main) [PATH_TRACING_FD]: Skip if /proc/self/fd/ + is not available. Add test calls that use PATH_TRACING_FD. + (main): Conditionalize expected output for those calls + that do not use PATH_TRACING_FD with [!PATH_TRACING_FD]. + * tests/_newselect-P.c: New file. + * tests/select-P.c: Likewise. + * tests/Makefile.am (check_PROGRAMS): Add _newselect-P and select-P. + * tests/.gitignore: Likewise. + * tests/gen_tests.in (_newselect-P, select-P): New entries. + + tests: extend the check of select/_newselect syscalls decoding. + * tests/xselect.c: Rewrite for better coverage. + +2018-01-23 Dmitry V. Levin <ldv@altlinux.org> + + tests: redirect stdin to /dev/null. + Ensure that stdin descriptor is not available for output + by reopening it to input from /dev/null. + + * tests/run.sh: Redirect test's stdin to /dev/null. + +2018-01-23 Dmitry V. Levin <ldv@altlinux.org> + + tests: add file:line to perror_msg_and_fail/error_msg_and_fail output. + * tests/tests.h [!perror_msg_and_fail] (perror_msg_and_fail): New macro + wrapper around the homonymous function. + [!error_msg_and_fail] (error_msg_and_fail): Likewise. + * tests/error_msg.c (perror_msg_and_fail, error_msg_and_fail): New + macros defined to themselves. + + Rework decoding and pathtrace of old select syscall. + * linux/arch_defs_.h [!HAVE_ARCH_OLD_SELECT] (HAVE_ARCH_OLD_SELECT): New + macro. + * linux/aarch64/arch_defs_.h (HAVE_ARCH_OLD_SELECT): Likewise. + * linux/arm/arch_defs_.h: Likewise. + * linux/bfin/arch_defs_.h: Likewise. + * linux/i386/arch_defs_.h: Likewise. + * linux/m68k/arch_defs_.h: Likewise. + * linux/microblaze/arch_defs_.h: Likewise. + * linux/powerpc64/arch_defs_.h: Likewise. + * linux/sh/arch_defs_.h: Likewise. + * linux/x32/arch_defs_.h: Likewise. + * linux/x86_64/arch_defs_.h: Likewise. + * linux/powerpc/arch_defs_.h: New file. + * Makefile.am (EXTRA_DIST): Add it. + * desc.c (SYS_FUNC(oldselect)): Rewrite using + fetch_indirect_syscall_args, move under [HAVE_ARCH_OLD_SELECT]. + * pathtrace.c (match_xselect_args): New function. + (pathtrace_match_set): Use it. + +2018-01-23 Dmitry V. Levin <ldv@altlinux.org> + + Transform fetch_old_mmap_args into fetch_indirect_syscall_args. + As there are more than one old style syscall that take their arguments + via array, generalize fetch_old_mmap_args into a function that could + fetch variable number of arguments. + + * mem.c (fetch_old_mmap_args): Transform into ... + * fetch_indirect_syscall_args.c: ... fetch_indirect_syscall_args + in this new file. + * Makefile.am (libstrace_a_SOURCES): Add it. + * defs.h [HAVE_ARCH_OLD_MMAP] (fetch_old_mmap_args): Remove. + (fetch_indirect_syscall_args): New prototype. + * pathtrace.c (pathtrace_match_set) [HAVE_ARCH_OLD_MMAP]: Use + fetch_indirect_syscall_args instead of fetch_old_mmap_args. + +2018-01-23 Eugene Syromyatnikov <evgsyr@gmail.com> + + signal.c: remove excess semicolon after the end of the function. + * signal.c (rt_sigtimedwait): Remove semicolon after the function body. + + Use char * for pointer arithmetics. + * netlink_inet_diag.c (decode_inet_diag_req_compat, + decode_inet_diag_req_v2, decode_inet_diag_msg): Cast to char * + instead of void *. + * netlink_netlink_diag.c (decode_netlink_diag_req, + decode_netlink_diag_msg): Likewise. + * netlink_packet_diag.c (decode_packet_diag_req, + decode_packet_diag_msg): Likewise. + * netlink_unix_diag.c (decode_unix_diag_req, decode_unix_diag_msg): + Likewise. + * rtnl_addr.c (decode_ifaddrmsg): Likewise. + * rtnl_addrlabel.c (decode_ifaddrlblmsg): Likewise. + * rtnl_dcb.c (decode_dcbmsg): Likewise. + * rtnl_link.c (decode_ifinfomsg): Likewise. + * rtnl_mdb.c (decode_br_port_msg): Likewise. + * rtnl_neigh.c (decode_ndmsg): Likewise. + * rtnl_route.c (decode_rtmsg): Likewise. + * rtnl_rule.c (decode_fib_rule_hdr): Likewise. + * rtnl_tc.c (decode_tcmsg): Likewise. + +2018-01-23 Eugene Syromyatnikov <evgsyr@gmail.com> + + netlink_inet_diag.c: remove unnecessary return. + decode_inet_diag_req, as well as the functions it calls, returns void. + + * netlink_inet_diag.c (decode_inet_diag_req): Do not return anything. + +2018-01-21 Dmitry V. Levin <ldv@altlinux.org> + + Move decoder of getpagesize syscall to libstrace. + As only five architectures have getpagesize syscall, moving the decoder + to libstrace allows to get rid of getpagesize related ifdefs and check + build of getpagesize decoder on other architectures. + + * mem.c (SYS_FUNC(getpagesize)): Move ... + * getpagesize.c: ... to this new file. + * Makefile.am (libstrace_a_SOURCES): Add it. + +2018-01-21 Eugene Syromyatnikov <evgsyr@gmail.com> + + mpers: implement gawk 3 support. + Some old systems that still make some sense to be supported have only + gawk 3, so let's support them for now. + + In order to achieve that, multiple changes have been implemented: + - Multidimensional arrays are replaced with single-dimensional ones. + In most places it's a "][" -> ", " replacement, as awk allows some + kind of emulation of multidimensional arrays that way, but in several + occasions (specifically for storing name and special fields) we have + to iterate over them later, so we store that information in + additional arrays in order to get the keys. + - "switch" statements are replaced with sets of "if ... else if ... + else" statements. This change is trivial, except we've added + a temporary variable in what_is order to store expression value, for + readability purposes. + - No support for array iteration ordering. This one is most ugly of + them all. Luckily, not that ugly, we've just had to process index a + bit in order to make it lexicographically sortable and add two + temporary arrays containing sorted indices in order to sort over them + instead of those two arrays that we've added in order to work around + lack of multidimensional array support. + + * mpers.awk (compare_indices): Remove unused function. + (array_get, update_upper_bound, /^DW_AT_data_member_location/, + /^DW_AT_byte_size/, /^DW_AT_encoding/): Replace multidimensional array + access with comma-concatenated index. + (norm_idx): New function. + (array_seq): Replace multidimensional array access with + comma-concatenated index. Use comma-concatenated pair of (array_idx, + "seq") in order to check presence of the item in an array. + (what_is): Add enc and i local variables. Store the value of + array[what_idx, "encoding"] in it. Replace "switch" statements with + sets of "if ... else if ... else" statements. Replace multidimensional + array access with comma-concatenated index. Use for (... ; ...; ...) + iteration over aparents_keys instead of iteration over array. + (/^<[[:xdigit:]]+>/): Store idx as norm_idx(matches[2]). Replace + multidimensional array access with comma-concatenated index. Store an + additional flag in array_names array. + (/^DW_AT_name/): Replace multidimensional array access with + comma-concatenated index. Add a flag to array_names for that idx. + (/^DW_AT_type/): Do not capture "0x" as a part of a group, normalise + the captured group. Replace multidimensional array access with + comma-concatenated index. + (/^Abbrev Number:[^(]+\(DW_TAG_/): Replace multidimensional array access + with comma-concatenated index. Store additional flags in + array_special and array_parents arrays. + (END): Remove PROCINFO["sorted_in"] setup. Sort array_parents. Replace + multidimensional array access with comma-concatenated index. Iterate + over array_special to go over all the items that have "special" field. + Iterate over array_names to go over all items that have "name" field. + * NEWS: Mention it. + +2018-01-21 Eugene Syromyatnikov <evgsyr@gmail.com> + + dm: add support for event_nr in DM_LIST_DEVICES result. + Commit v4.13-rc1~137^2~13 (and a follow-up fix v4.14-rc4~20^2~3 + that changed alignment) introduced an additional hidden field + in the structure returned by DM_LIST_DEVICES ioctl command + that contains event_nr information. + + Unfortunately, we can't test it for now, but looks like it kinda works: + + # ./strace -v -eioctl -y dmsetup ls + ioctl(3</dev/mapper/control>, DM_VERSION, {version=4.0.0, + data_size=16384, flags=DM_EXISTS_FLAG} => {version=4.37.0, + data_size=16384, flags=DM_EXISTS_FLAG}) = 0 + ioctl(3</dev/mapper/control>, DM_LIST_DEVICES, {version=4.0.0, + data_size=16384, data_start=312, flags=DM_EXISTS_FLAG} => + {version=4.37.0, data_size=408, data_start=312, flags=DM_EXISTS_FLAG, + {dev=makedev(253, 1), name="fedoratesting--30-swap", event_nr=0}, + {dev=makedev(253, 0), name="fedoratesting--30-root"}}) = 0 + fedoratesting--30-swap (253:1) + fedoratesting--30-root (253:0) + + * dm.c (dm_decode_dm_name_list): Obtain the amount of bytes copied + during printing device name, print event number if there's a suitable + gap present and the DM version is high enough. + * NEWS: Mention it. + +2018-01-21 Eugene Syromyatnikov <evgsyr@gmail.com> + + Move definition of personality macros to arch_defs_.h. + * supported_personalities.h: Remove. + * defs.h: Do not include it. + * linux/arch_defs_.h [!DEFAULT_PERSONALITY] (DEFAULT_PERSONALITY): New + macro. + [!SUPPORTED_PERSONALITIES] (SUPPORTED_PERSONALITIES): Likewise. + * linux/aarch64/arch_defs_.h (SUPPORTED_PERSONALITIES): New macro. + * linux/riscv/arch_defs_.h: Likewise. + * linux/s390x/arch_defs_.h: Likewise. + * linux/sparc64/arch_defs_.h: Likewise. + * linux/x32/arch_defs_.h: Likewise. + * linux/x86_64/arch_defs_.h: Likewise. + * linux/powerpc64/arch_defs_.h: New file. + * linux/tile/arch_defs_.h: Likewise. + * Makefile.am (EXTRA_DIST): Add them. + (strace_SOURCES): Remove supported_personalities.h. + + Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org> + +2018-01-21 Eugene Syromyatnikov <evgsyr@gmail.com> + + Introduce HAVE_ARCH_SA_RESTORER. + In order to simplify HAVE_SA_RESTORER logic a bit. + + * linux/ia64/arch_defs_.h (HAVE_ARCH_SA_RESTORER): New macro. + * linux/m68k/arch_defs_.h: Likewise. + * linux/sparc/arch_defs_.h: Likewise. + * linux/sparc64/arch_defs_.h: Likewise. + * linux/hppa/arch_defs_.h: New file. + * Makefile.am (EXTRA_DIST): Add it. + * signal.c [HAVE_ARCH_SA_RESTORER]: Define HAVE_SA_RESTORER to it. + [!HAVE_ARCH_SA_RESTORER && SA_RESTORER]: Define HAVE_SA_RESTORER to 1. + [!HAVE_ARCH_SA_RESTORER && !SA_RESTORER]: Define HAVE_SA_RESTORER to 0. + +2018-01-21 Dmitry V. Levin <ldv@altlinux.org> + + Replace NEED_UID16_PARSERS with HAVE_ARCH_UID16_SYSCALLS. + * linux/arch_defs_.h [!HAVE_ARCH_UID16_SYSCALLS] + (HAVE_ARCH_UID16_SYSCALLS): New macro. + * linux/aarch64/arch_defs_.h (HAVE_ARCH_UID16_SYSCALLS): New macro. + * linux/arm/arch_defs_.h: Likewise. + * linux/i386/arch_defs_.h: Likewise. + * linux/ia64/arch_defs_.h: Likewise. + * linux/m68k/arch_defs_.h: Likewise. + * linux/s390/arch_defs_.h: Likewise. + * linux/s390x/arch_defs_.h: Likewise. + * linux/sh/arch_defs_.h: Likewise. + * linux/sparc/arch_defs_.h: Likewise. + * linux/sparc64/arch_defs_.h: Likewise. + * linux/syscall.h: Likewise. + * linux/x32/arch_defs_.h: Likewise. + * linux/x86_64/arch_defs_.h: Likewise. + * linux/bfin/arch_defs_.h: New file. + * linux/microblaze/arch_defs_.h: Likewise. + * linux/riscv/arch_defs_.h: Likewise. + * linux/sh64/arch_defs_.h: Likewise. + * Makefile.am (EXTRA_DIST): Add them. + * defs.h (NEED_UID16_PARSERS): Remove. + * linux/syscall.h: Check for HAVE_ARCH_UID16_SYSCALLS instead of + NEED_UID16_PARSERS. + * uid.c: Likewise. + + Replace HAVE_GETRVAL2 with HAVE_ARCH_GETRVAL2. + * linux/arch_defs_.h [!HAVE_ARCH_GETRVAL2] (HAVE_ARCH_GETRVAL2): New + macro. + * linux/alpha/arch_defs_.h: New file. + * linux/ia64/arch_defs_.h: Likewise. + * linux/mips/arch_defs_.h: Likewise. + * linux/sh/arch_defs_.h: Likewise. + * linux/sparc/arch_defs_.h: Likewise. + * linux/sparc64/arch_defs_.h: Likewise. + * Makefile.am (EXTRA_DIST): Add them. + * defs.h (HAVE_GETRVAL2): Remove. + (getrval2): Check for HAVE_ARCH_GETRVAL2 instead of arch checks. + * net.c (SYS_FUNC(pipe)): Check for HAVE_ARCH_GETRVAL2 instead of + HAVE_GETRVAL2. + * syscall.c: Likewise. + + Use #if idiom instead of #ifdef for HAVE_ARCH_* macros. + * linux/arch_defs_.h [!HAVE_ARCH_OLD_MMAP] (HAVE_ARCH_OLD_MMAP): New + macro. + [!HAVE_ARCH_OLD_MMAP_PGOFF] (HAVE_ARCH_OLD_MMAP_PGOFF): Likewise. + * defs.h: Use #if instead of #ifdef to check HAVE_ARCH_OLD_MMAP. + * mem.c: Use #if instead of #ifdef to check HAVE_ARCH_OLD_MMAP + and HAVE_ARCH_OLD_MMAP_PGOFF + * pathtrace.c: Likewise. + +2018-01-21 Dmitry V. Levin <ldv@altlinux.org> + + Rename arch-specific arch_defs.h files to arch_defs_.h. + Introduce a new arch_defs.h header that includes the corresponding + arch-specific arch_defs_.h file followed by generic arch_defs_.h file. + + * linux/arch_defs.h: Rename to linux/arch_defs_.h. + * linux/aarch64/arch_defs.h: Rename to linux/aarch64/arch_defs_.h. + * linux/arm/arch_defs.h: Rename to linux/arm/arch_defs_.h. + * linux/i386/arch_defs.h: Rename to linux/i386/arch_defs_.h. + * linux/m68k/arch_defs.h: Rename to linux/m68k/arch_defs_.h. + * linux/s390/arch_defs.h: Rename to linux/s390/arch_defs_.h. + * linux/s390x/arch_defs.h: Rename to linux/s390x/arch_defs_.h. + * linux/x32/arch_defs.h: Rename to linux/x32/arch_defs_.h. + * linux/x86_64/arch_defs.h: Rename to linux/x86_64/arch_defs_.h. + * arch_defs.h: New file. + * Makefile.am (strace_SOURCES): Add it. + (EXTRA_DIST): Rename linux/*/arch_defs.h to linux/*/arch_defs_.h. + +2018-01-19 Dmitry V. Levin <ldv@altlinux.org> + + Fix ANY_WORDSIZE_LESS_THAN_KERNEL_LONG definition. + * defs.h (ANY_WORDSIZE_LESS_THAN_KERNEL_LONG): Rewrite without undefined + behaviour. + + Fixes: f916793 ("Introduce ANY_WORDSIZE_LESS_THAN_KERNEL_LONG macro") + +2018-01-19 Eugene Syromyatnikov <evgsyr@gmail.com> + + util: return string size in printstr. + As umovestr now returns something useful, let's propagate it further. + + * defs.h (printstr_ex, printpathn, printpath): Change return type from + void to int. + (printstrn, printstr): Change return type from void to int, return + printstr_ex result. + * util.c (printpathn): Return -1 on NULL addr, nul_seen (exit code of + umovestr) on success. + (printpath): Return printpathn result. + (printstr_ex): Return -1 on NULL addr, umoven/umovestr result otherwise. + +2018-01-19 Eugene Syromyatnikov <evgsyr@gmail.com> + + ucopy: return string size in umovestr. + We return the size that includes \0 in order to preserve existing + behaviour (return 0 when \0 haven't been seen, return positive number + when it has been seen). + + * ucopy.c (umovestr_peekdata, umovestr): Return string length + including \0 instead of 1 when \0 is found. + +2018-01-19 Dmitry V. Levin <ldv@altlinux.org> + + mpers.awk: avoid redefinition of mpers_ptr_t. + Older versions of gcc like those found in RHEL6 fail with the following + diagnostics: + + In file included from block.c:32: + ./mpers-m32/struct_blk_user_trace_setup.h:2: error: redefinition of typedef ‘mpers_ptr_t’ + mpers_type.h:44: note: previous declaration of ‘mpers_ptr_t’ was here + + * mpers.awk (END): Add #ifndef guard to mpers_ptr_t typedef. + * mpers_test.sh: Update expected output. + +2018-01-19 Eugene Syromyatnikov <evgsyr@gmail.com> + + Add support for --enable-mpers=m32|mx32. + * configure.ac (AC_ARG_ENABLE([mpers])): Allow m32 and mx32 values + for --enable-mpers option. + * m4/mpers.m4 (st_MPERS): Check for personality support if personality + name is provided as an option. Fail if the requested personality + support is not available. + + Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org> + +2018-01-19 Eugene Syromyatnikov <evgsyr@gmail.com> + + tests: improve setugid error diagnostics a bit. + * tests/setugid.c (main): Print unexpected code returned by syscall. + +2018-01-19 Dmitry V. Levin <ldv@altlinux.org> + + v4l2: do not mpersify struct v4l2_create unless it is used by other code + This fixes build with mpers support on older systems that lack + definition of struct v4l2_create. + + * v4l2.c: Wrap references to struct v4l2_create with + [VIDIOC_CREATE_BUFS]. + +2018-01-18 Dmitry V. Levin <ldv@altlinux.org> + + btrfs: use uint32_t instead of __u32. + * btrfs.c (btrfs_ioctl) [!HAVE_STRUCT_BTRFS_IOCTL_FS_INFO_ARGS_NODESIZE]: + Replace __u32 with uint32_t. Remove useless cast. + +2018-01-19 Eugene Syromyatnikov <evgsyr@gmail.com> + + strace.1.in: clarify mpers flags in strace -V output. + The previous description was a bit dated. + + * strace.1.in (.SH "MULTIPLE PERSONALITY SUPPORT"): Remove "no-m32" and + "no-mx32", describe the situation when some of mpers flags are not + present in strace -V output. + +2018-01-19 Eugene Syromyatnikov <evgsyr@gmail.com> + + Add compat support for s390x. + By very popular demand. + + While we are here, let's refactor the condition for old_mmap_pgoff into + an arch-specific one, as it is used more than in one place. + + * NEWS: Mention this. + * strace.1.in (.SH "MULTIPLE PERSONALITY SUPPORT"): Likewise. + * configure.ac (case "$host_cpu" in) <s390x>: Set arch_m32 to s390, set + cc_flags_m32 to -m31. + (st_MPERS([m32])): Add s390x. + * defs.h [S390X]: Define NEED_UID16_PARSERS. + * linux/s390/arch_sigreturn.c [!S390_FRAME_PTR] (S390_FRAME_PTR): New + macro, define to s390_frame_ptr. + [!SIGNAL_FRAMESIZE] (SIGNAL_FRAMESIZE): New macro, define to + __SIGNAL_FRAMESIZE. + [!PTR_TYPE] (PTR_TYPE): New macro, define to unsigned long. + (arch_sigreturn): Use S390_FRAME_PTR, SIGNAL_FRAMESIZE, and PTR_TYPE + instead of s390_frame_ptr, __SIGNAL_FRAMESIZE, and pointer-sized type, + respectively. + * linux/s390/get_error.c [!ARCH_REGSET] (ARCH_REGSET): New macro, define + * to s390_regset. + (get_error): Use it instead of s390_regset. + * linux/s390/get_scno.c (arch_get_scno): Likewise. + * linux/s390/get_syscall_args.c (get_syscall_args): Likewise. + * linux/s390/set_error.c (arch_set_error, arch_set_success): Likewise. + * linux/s390/set_scno.c (arch_set_scno): Likewise. + * linux/s390x/arch_regs.c (psw_compat_t, s390_compat_regs, + s390x_regs_union, s390_frame_ptr, s390x_frame_ptr, s390x_io): New + variables. + (s390_regset, s390x_regset, ARCH_REGS_FOR_GETREGSET, + ARCH_IOVEC_FOR_GETREGSET, ARCH_PC_REG, ARCH_PERSONALITY_0_IOV_SIZE, + ARCH_PERSONALITY_1_IOV_SIZE): New macros. + * linux/s390x/arch_regs.h (s390_frame_ptr, s390x_frame_ptr): New + prototypes. + * linux/s390x/arch_rt_sigframe.c: Conditionalize on tcp->currpers. + * linux/s390x/arch_sigreturn.c: Likewise. + * linux/s390x/get_error.c: Likewise. + * linux/s390x/get_scno.c: Likewise. + * linux/s390x/get_syscall_args.c: Likewise. + * linux/s390x/set_error.c: Likewise. + * linux/s390x/set_scno.c: Likewise. + * linux/s390x/errnoent1.h: New file. + * linux/s390x/ioctls_arch1.h: Likewise. + * linux/s390x/ioctls_inc1.h: Likewise. + * linux/s390x/signalent1.h: Likewise. + * linux/s390x/syscallent1.h: Likewise. + * Makefile.am (EXTRA_DIST): Add new files added to linux/s390x. + * supported_personalities.h [S390X] (SUPPORTED_PERSONALITIES): Define + to 2. + * tests/strace-V.test: Add s390 to the list of architectures that have + m32 personality. + * linux/s390/arch_defs.h (HAVE_ARCH_OLD_MMAP_PGOFF): New macro. + * linux/s390x/arch_defs.h: Likewise. + * mem.c: Replace #ifdef S390 with #ifdef HAVE_ARCH_OLD_MMAP_PGOFF. + * pathtrace.c: Likewise. + +2018-01-18 Eugene Syromyatnikov <evgsyr@gmail.com> + + Update NEWS. + +2018-01-17 Dmitry V. Levin <ldv@altlinux.org> + + tests: check path tracing of ppoll syscall. + * tests/ppoll.c (main) [PATH_TRACING_FD]: Skip if /proc/self/fd/ + is not available. Add a test call that use PATH_TRACING_FD. + (main): Conditionalize expected output for those calls + that do not use PATH_TRACING_FD with [!PATH_TRACING_FD]. + * tests/ppoll-P.c: New file. + * tests/pure_executables.list: Add ppoll-P. + * tests/.gitignore: Likewise. + * tests/gen_tests.in (ppoll-P): New entry. + + tests: check path tracing of poll syscall. + * tests/poll.c (main) [PATH_TRACING_FD]: Skip if /proc/self/fd/ + is not available. Add tests calls that use PATH_TRACING_FD. + (main): Conditionalize expected output for those calls + that do not use PATH_TRACING_FD with [!PATH_TRACING_FD]. + * tests/poll-P.c: New file. + * tests/pure_executables.list: Add poll-P. + * tests/.gitignore: Likewise. + * tests/poll-P.test: New test. + * tests/Makefile.am (DECODER_TESTS): Add poll-P.test. + +2018-01-17 Eugene Syromyatnikov <evgsyr@gmail.com> + + tests: enable old_mmap-P.test on s390x. + As s390x is the only 64-bit architecture that has old_mmap, + the test needs some adjustments there. + + * tests/old_mmap.c: Update condition. + (main): Change int types to long, extend numerals to 64 bit, change + printing format qualifiers to corresponding long types. + + Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org> + +2018-01-17 Eugene Syromyatnikov <evgsyr@gmail.com> + + tests: check path tracing of old mmap syscall. + * tests/old_mmap.c [!TEST_FD]: Define TEST_FD. + (main) <args1_c>: Replace 5th argument with TEST_FD. + (main): Wrap the output for the calls that do not use TEST_FD + with #ifndef PATH_TRACING. + * tests/old_mmap-P.c: New file. + * tests/pure_executables.list: Add old_mmap-P. + * tests/.gitignore: Likewise. + * tests/gen_tests.in: Add old_mmap-P test. + +2018-01-17 Eugene Syromyatnikov <evgsyr@gmail.com> + + Fix pathtrace for old_mmap/old_mmap_pgoff. + As these system calls have only one argument that points to the + location in memory containing actual arguments, current path tracing + implementation is incorrect. In order to fix this, let's use recently + introduced fetch_old_mmap_args in order to get actual arguments suitable + for path matching. + + * pathtrace.c [HAVE_ARCH_OLD_MMAP] <case SEN_old_mmap, + case SEN_old_mmap_pgoff>: Retrieve actual old_mmap arguments with + fetch_old_mmap_args, pass the value from the retrieved args if it's + available. + +2018-01-17 Eugene Syromyatnikov <evgsyr@gmail.com> + + Test non-verbose old_mmap output. + * tests/old_mmap-v-none.c: New file. Include old_mmap.c. + * tests/pure_executables.list: Add old_mmap-v-none. + * tests/.gitignore: Likewise. + * tests/gen_tests.in (old_mmap-v-none): New entry. + +2018-01-17 Eugene Syromyatnikov <evgsyr@gmail.com> + + mem.c: use runtime check in fetch_old_mmap_args. + This makes code a bit cleaner and makes it compatible with the upcoming + s390x compat support. + + * mem.c [HAVE_ARCH_OLD_MMAP] (fetch_old_mmap_args): Replace + ANY_WORDSIZE_LESS_THAN_KERNEL_LONG check with current_wordsize == 4 + check. + +2018-01-17 Eugene Syromyatnikov <evgsyr@gmail.com> + + mem.c: introduce fetch_old_mmap_args. + Move common old_mmap/old_mmap_pgoff argument fetching code into a + separate function. + + As it is, it also fixes the case of non-verbose printing of old_mmap + arguments (see the new test in the next commit). Also, it is a + preparation for the fix of path tracing for these syscalls. + + * defs.h [HAVE_ARCH_OLD_MMAP] (fetch_old_mmap_args): New prototype. + * mem.c [HAVE_ARCH_OLD_MMAP] (fetch_old_mmap_args): New function. + [HAVE_ARCH_OLD_MMAP] (old_mmap, old_mmap_pgoff): Use it. + + Fixes: 3db07f11 "Fix old_mmap output when mmap arguments are unfetchable" + Suggested-by: Dmitry V. Levin <ldv@altlinux.org> + +2018-01-17 Eugene Syromyatnikov <evgsyr@gmail.com> + + Introduce arch-specific define HAVE_ARCH_OLD_MMAP. + * linux/arch_defs.h: New file. + * linux/aarch64/arch_defs.h: New file. Define HAVE_ARCH_OLD_MMAP. + * linux/arm/arch_defs.h: Likewise. + * linux/i386/arch_defs.h: Likewise. + * linux/m68k/arch_defs.h: Likewise. + * linux/s390/arch_defs.h: Likewise. + * linux/s390x/arch_defs.h: Likewise. + * linux/x32/arch_defs.h: Likewise. + * linux/x86_64/arch_defs.h: Likewise. + * Makefile.am (EXTRA_DIST): Add them. + * defs.h: Include "arch_defs.h" + * mem.c: Replace condition for SYS_FUNC(old_mmap) with #ifdef + HAVE_ARCH_OLD_MMAP. + + Suggested-by: Dmitry V. Levin <ldv@altlinux.org> + +2018-01-17 Dmitry V. Levin <ldv@altlinux.org> + Nikolay Marchuk <marchuk.nikolay.a@gmail.com> + + tests: improve descriptor set syntax testing. + * tests/filtering_fd-syntax.test: New file. + * tests/options-syntax.test: Move descriptor set syntax testing + to filtering_fd-syntax.test. + * tests/Makefile.am (MISC_TESTS): Add filtering_fd-syntax.test. + +2018-01-16 Eugene Syromyatnikov <evgsyr@gmail.com> + + strace.c: print correct out file name in error messages in case of -ff. + * strace.c (outf_perror): New function. + (tvprintf, tprints, flush_tcp_output): Use it. + + aarch64: use ARCH_SET_PERSONALITY_FROM_IOV_SIZE. + * linux/aarch64/arch_regs.c (ARCH_PERSONALITY_0_IOV_SIZE, + ARCH_PERSONALITY_1_IOV_SIZE): New macros. + * linux/aarch64/get_scno.c (arch_get_scno): Do not call + update_personality as it is handled by the generic get_regs code now. + +2018-01-16 Eugene Syromyatnikov <evgsyr@gmail.com> + + syscall.c: add ability to set personality based on GETREGSET iov size. + Some architectures (aarch64, s390x) use only PTRACE_GETREGSET interface + and use its size to detect current personality. Let's generalise this + approach and also avoid subtle errors when we get register but forget to + update personality, at least for those architectures. + + Note that in order to employ this behaviour, architecture has to use + PTRACE_GETREGSET exclusively (no HAVE_GETREGS_OLD) and should declare + appropriate ARCH_PERSONALITY_*_IOV_SIZE macros. + + * syscall.c (get_regs) [ptrace_getregset_or_getregs && + !HAVE_GETREGS_OLD]: Call update_personality based on the value returned + in the iov_len field by PTRACE_GETREGSET. Warn once if the returned + iov_len is unknown. + +2018-01-16 Eugene Syromyatnikov <evgsyr@gmail.com> + + syscall.c: add sanity check for the target personality number. + We can never be cautious enough. + + * defs.h (set_personality): Change argument type to unsigned int. + * syscall.c (set_personality): Change argument type to unsigned int, + check whether requested personality is sane, die otherwise. + +2018-01-16 Eugene Syromyatnikov <evgsyr@gmail.com> + + syscall.c: move current_personality check to set_personality. + As all the personality-dependent entries are initially in sync, we can + move the check whether we are setting the same personality as we + currently are inside set_personality out of update_personality. + + * syscall.c (current_wordsize, current_klongsize): Initialise to 0'th + personality value in order to make the statement about "all the + personality-dependent entries are initially in sync" true. + (set_personality): Check whether requested personality differs from + current_personality. + (update_personality): Call set_personality unconditionally. + +2018-01-16 Eugene Syromyatnikov <evgsyr@gmail.com> + + syscall.c: always update tcp->currpers in update_personality. + Sometimes (for example, switching from a process with one personality + to a process that previously had different personality but returning + from execve to that same personality into) it is possible that + current_personality is not changed, but tcp->currpers is different. + So, let's not return from update_personality and always update + tcp->currpers if it differs from the target personality. + + * syscall.c (update_personality): Do not exit early if personality == + current_personality. + +2018-01-16 Eugene Syromyatnikov <evgsyr@gmail.com> + + Update current_personality on tcb switch. + * strace.c (set_current_tcp): New function. + (printleader, droptcb, print_event_exit, next_event, dispatch_event): + Call set_current_tcp instead of setting current_tcp manually. + +2018-01-16 Eugene Syromyatnikov <evgsyr@gmail.com> + + Add support for specifying compiler options for mpers builds. + Because some architectures are very, very special. + + * configure.ac (cc_flags_m32, cc_flags_mx32): New variables. AC_SUBST + them. + * m4/mpers.m4 (MPERS_CFLAGS): Use instead of CFLAG, pushdef as + $cc_flags_$1. + Use mpers_name instead of CFLAG in AC_CACHE_CHECK messages. + Pass MPERS_CFLAGS as the second argument to mpers_test.sh + * mpers.sh: Add CC_ARCH_FLAGS as the second argument (PARSER_FILE + is moved to the third one). Do not expect leading dash in ARCH_FLAG + anymore. + * mpers_test.sh (mpers_cc_flags): New variable, initialise to the second + command line argument. + Pass $mpers_name without leading dash to mpers.sh. + Pass $mpers_cc_flags as the second argument to mpers.sh ($sample is + the third argument now). + * Makefile.am (mpers-m%.stamp:): Pass $(mpers_CC_FLAGS) as the second + argument to mpers.sh ($$f is now the third argument). + ($(mpers_m32_targets)): Define target variable mpers_CC_FLAGS with the + value of @cc_flags_m32@ + ($(mpers_mx32_targets)): Define target variable mpers_CC_FLAGS with the + value of @cc_flags_mx32@ + * tests/Makefile.am (MERS_CC_FLAGS): New variable. + * bootstrap: Append @cc_flags_$1@ to MPERS_CC_FLAGS. Append + $(MPERS_CC_FLAGS) to ARCH_MFLAGS. + +2018-01-16 Dmitry V. Levin <ldv@altlinux.org> + Nikolay Marchuk <marchuk.nikolay.a@gmail.com> + + tests: improve syscall set syntax testing. + * tests/filtering_syscall-syntax.test: New file. + * tests/options-syntax.test: Move syscall set syntax testing + to filtering_syscall-syntax.test. + * tests/qual_fault-syntax.test: Likewise. + * tests/qual_inject-syntax.test: Likewise. + * tests/Makefile.am (MISC_TESTS): Add filtering_syscall-syntax.test. + +2018-01-16 Dmitry V. Levin <ldv@altlinux.org> + + Enhance error diagnostics about invalid syscalls in fault injection syntax + Validate syscall set before the whole fault injection syntax. + + * filter_qualify.c (parse_inject_expression): Add const qualifier to + return type. Return an empty string when no syscall set is specified. + (qualify_inject_common): Add const qualifier to "name". Move + qualify_syscall_tokens invocation right after parse_inject_expression. + * tests/qual_fault-syntax.test: Update expected output. + * tests/qual_inject-syntax.test: Likewise. + +2018-01-16 Dmitry V. Levin <ldv@altlinux.org> + + basic_filters: use loop initial declarations. + * basic_filters.c (qualify_syscall_number, qualify_syscall_regex, + lookup_class, qualify_syscall_class, qualify_syscall_tokens, + qualify_tokens): Use "for" loop initial declarations. + + filter_qualify: use loop initial declarations. + * filter_qualify.c (sigstr_to_uint, find_errno_by_name, + parse_inject_expression, qualify_inject_common, qualify): Use "for" loop + initial declarations. + + configure: try to set the C compiler mode to accept ISO Standard C. + * configure.ac: Use AC_PROG_CC_STDC. + * NEWS: Mention this. + +2018-01-15 Dmitry V. Levin <ldv@altlinux.org> + + pathtrace: update the list of unrelated syscalls. + * pathtrace.c (pathtrace_match_set) <SEN_accept4, SEN_accept, + SEN_signalfd4, SEN_signalfd>: Skip matching. + + basic_filters: move legacy tracing class names to the end of table. + * basic_filters.c (lookup_class) <syscall_class>: Move names that do not + start with % to the end of table. + + Enhance decoding of mq_* syscalls. + * mq.c (SYS_FUNC(mq_open)): Add RVAL_FD to return value. + (SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive), SYS_FUNC(mq_notify), + SYS_FUNC(mq_getsetattr)): Print the first argument using printfd. + * NEWS: Mention this change. + * pathtrace.c (pathtrace_match_set) <SEN_mq_getsetattr, SEN_mq_notify, + SEN_mq_open, SEN_mq_timedreceive, SEN_mq_timedsend>: Skip matching. + * linux/32/syscallent.h (mq_getsetattr, mq_notify, mq_open, + mq_timedreceive, mq_timedsend): Add TD flag. + * linux/64/syscallent.h: Likewise. + * linux/alpha/syscallent.h: Likewise. + * linux/arm/syscallent.h: Likewise. + * linux/avr32/syscallent.h: Likewise. + * linux/bfin/syscallent.h: Likewise. + * linux/crisv10/syscallent.h: Likewise. + * linux/hppa/syscallent.h: Likewise. + * linux/i386/syscallent.h: Likewise. + * linux/ia64/syscallent.h: Likewise. + * linux/m68k/syscallent.h: Likewise. + * linux/microblaze/syscallent.h: Likewise. + * linux/mips/syscallent-n32.h: Likewise. + * linux/mips/syscallent-n64.h: Likewise. + * linux/mips/syscallent-o32.h: Likewise. + * linux/powerpc/syscallent.h: Likewise. + * linux/powerpc64/syscallent.h: Likewise. + * linux/s390/syscallent.h: Likewise. + * linux/s390x/syscallent.h: Likewise. + * linux/sh/syscallent.h: Likewise. + * linux/sh64/syscallent.h: Likewise. + * linux/sparc/syscallent.h: Likewise. + * linux/sparc64/syscallent.h: Likewise. + * linux/x32/syscallent.h: Likewise. + * linux/x86_64/syscallent.h: Likewise. + * linux/xtensa/syscallent.h: Likewise. + + Enhance error diagnostics about invalid syscalls in fault injection syntax + * basic_filters.c (qualify_syscall_tokens): Remove "name" argument, + assume its value is "system call". + * filter.h (qualify_syscall_tokens): Remove "name" argument. + All callers updated. + * tests/qual_fault-syntax.test: Update expected output. + + basic_filters: handle "all" in a more readable way. + * basic_filters.c (qualify_syscall_tokens, qualify_tokens): Remove + handle_inversion label, handle "all" by invoking invert_number_set_array + directly. + + filter: remove redundant braces around single line expressions. + * basic_filters.c (qualify_syscall_class, qualify_syscall_name): + Rearrange the inner loop body. + (qualify_syscall_number, lookup_class, qualify_syscall_tokens, + qualify_tokens): Remove redundant braces around single line expressions. + * filter_qualify.c (qualify_inject_common): Likewise. + + filter_qualify: move memory allocation from parse_inject_expression. + * filter_qualify.c (parse_inject_expression): Replace "s" and "buf" + arguments with "str" argument, use it instead of "s" and "*buf". + (qualify_inject_common): Rename "buf" to "copy", initialize it to a copy + of "str", pass "copy" to parse_inject_expression instead of "str" and + "buf". + +2018-01-14 Eugene Syromyatnikov <evgsyr@gmail.com> + + xlat: update NT_* constants. + Update NT_* descriptor types with the values borrowed from + kernel's include/uapi/linux/elf.h and glibc's elf.h. + + * xlat/nt_descriptor_types.in (NT_PRSTATUS, NT_FPREGSET, NT_PRPSINFO, + NT_PRXREG, NT_TASKSTRUCT, NT_PLATFORM, NT_AUXV, NT_GWINDOWS, NT_ASRS, + NT_PSTATUS, NT_PSINFO, NT_PRCRED, NT_UTSNAME, NT_LWPSTATUS, + NT_LWPSINFO, NT_PRFPXREG, NT_PRXFPREG, NT_PPC_VMX, NT_PPC_SPE, + NT_PPC_VSX, NT_386_TLS, NT_386_IOPERM, NT_X86_XSTATE): Add fallback + definitions. + (NT_SIGINFO, NT_FILE, NT_PPC_*, NT_S390_*, NT_ARM_*, NT_METAG_*, + NT_ARC_V2): New constants. + * NEWS: Mention this. + +2018-01-13 Dmitry V. Levin <ldv@altlinux.org> + + configure: use AC_MSG_ERROR and AC_MSG_FAILURE consistently. + * configure.ac [$arch = mips]: Use AC_MSG_FAILURE instead of + AC_MSG_ERROR when _MIPS_SIM cannot be determined. Use AC_MSG_ERROR + instead of AC_MSG_FAILURE when syscallent stubs cannot be generated. + +2018-01-11 Eugene Syromyatnikov <evgsyr@gmail.com> + Dmitry V. Levin <ldv@altlinux.org> + + configure: add --disable-mpers and --enable-mpers=check options. + On architectures supporting multiple personalities, multiple + personalities support in strace is required for proper decoding of + structures used by tracees with personalities that differ from the + personality of strace. + + New configure options control whether multiple personalities support + in strace is mandatory, optional, or disabled. + + The default is changed from what is now equivalent of + --enable-mpers=check (automatically detect whether required mpers + support could be enabled) to --enable-mpers (terminate the build + if required mpers support could not be enabled). + + * configure.ac (AC_ARG_ENABLE([mpers])): New option. + * m4/mpers.m4 (st_MPERS): Use enable_mpers. Terminate the build + if mpers could not be enabled and enable_mpers==yes. + * strace.spec.in: Specify --enable-mpers=check to %configure. + * debian/rules (build/Makefile, build64/Makefile): Specify + --enable-mpers=check to configure. + + Suggested-by: DJ Delorie <dj@redhat.com> + +2018-01-11 Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org> + + Update ioctl entries from linux v4.15-rc7. + * linux/32/ioctls_inc_align16.h: Update from linux v4.15-rc7 using ioctls_gen.sh. + * linux/32/ioctls_inc_align32.h: Likewise. + * linux/32/ioctls_inc_align64.h: Likewise. + * linux/64/ioctls_inc.h: Likewise. + * linux/x32/ioctls_inc0.h: Likewise. + * NEWS: Mention this. + +2018-01-11 Eugene Syromyatnikov <evgsyr@gmail.com> + Dmitry V. Levin <ldv@altlinux.org> + + Issue a warning when strace lacks tracee personality support. + * defs.h (HAVE_PERSONALITY_1_MPERS, HAVE_PERSONALITY_2_MPERS): New + macros. + * syscall.c (update_personality): Add need_mpers_warning array + initialized with mpers support data. Use it for printing the mpers + unavailability warning once per personality. + +2018-01-11 Eugene Syromyatnikov <evgsyr@gmail.com> + + tests: add more checks of reboot syscall decoding. + In particular, check for the recent fixes in reboot syscall decoder. + + * tests/gen_tests.in (reboot): Provide -s 256 option. + * tests/reboot.c (STR32, STR128): New macros. + (main): Add more checks. + +2018-01-11 Eugene Syromyatnikov <evgsyr@gmail.com> + + tests: use sprintrc in reboot.test. + * test/reboot.c (main): Use sprintrc instead of old-style manual + printing of return code. + +2018-01-11 Eugene Syromyatnikov <evgsyr@gmail.com> + + reboot.c: limit printing of the fourth argument to 255 bytes. + The size of kernel buffer is 256 bytes and the last byte is always zero. + + * reboot.c (SYS_FUNC(reboot)): Replace printstr call with printstr_ex + with size of 255 and style flag QUOTE_0_TERMINATED. + +2018-01-11 Eugene Syromyatnikov <evgsyr@gmail.com> + + reboot.c: use printxval instead of printflags. + Numeric arguments of reboot syscall are not flags but magic values. + + * reboot.c (SYS_FUNC(reboot)): Replace printflags with printxval. + +2018-01-11 Eugene Syromyatnikov <evgsyr@gmail.com> + + Search for <libiberty/demangle.h> in addition to <demangle.h> + This is the location where this header is installed on Debian-based + systems. + + * configure.ac: Check for libiberty/demangle.h in addition to + demangle.h. + * unwind.c [USE_DEMANGLE]: Include either <demangle.h> or + <libiberty_demangle.h> based on the presence of HAVE_DEMANGLE_H and + HAVE_LIBIBERTY_DEMANGLE_H macros. + +2018-01-11 Dmitry V. Levin <ldv@altlinux.org> + + strace.1: fix typo. + * strace.1.in (.SH NOTES): Replace prlimit with prlimit64. + +2018-01-11 Eugene Syromyatnikov <evgsyr@gmail.com> + + Document multiple personalities support. + * strace.1.in (.SH "MULTIPLE PERSONALITY SUPPORT"): New section. + + Add indication of mpers support to strace -V output. + * strace.c (print_version): Append information about m32 and mx32 + decoding support. + * tests/strace-V.test: Update expected output. + + Provide strace's native arch to the test framework. + * configure.ac (arch_native): New variable, set to arch. + * tests/Makefile.am (NATIVE_ARCH): New variable, set to @arch_native@. + (AM_TEST_LOG_FLAGS): Pass NATIVE_ARCH as STRACE_NATIVE_ARCH environment + variable. + + Add indication of optional demangle feature strace -V output. + * strace.c (print_version) [USE_DEMANGLE]: Append " stack-demangle" + to the features string. + * tests/strace-V.test: Update expected output. + + configure.ac: check for mpers support on RISC-V. + * confgure.ac (st_MPERS([m32])): Add riscv. + +2018-01-11 Eugene Syromyatnikov <evgsyr@gmail.com> + + Use xappendstr instead of xsnprintf where suitable. + Replace occurrences of + + outptr += xsnprintf(outptr, sizeof(outstr) - (outptr - outstr), ...) + + with much more sleek + + outptr = xappendstr(outstr, outptr, ...) + + * desc.c (decode_select): Replace xsnprintf with xappendstr. + * open.c (sprint_open_modes): Likewise. + * poll.c (decode_poll_exiting): Likewise. + * signal.c (sprintsigmask_n): Likewise. + * xlat.c (sprintflags): Likewise. + +2018-01-11 Eugene Syromyatnikov <evgsyr@gmail.com> + + xstring.h: add xappendstr. + Introduce a macro for handling common case of partial writes + to a character array. + + * xstring.h (get_pos_diff_): New function. + (xappendstr): New macro. + +2018-01-11 Eugene Syromyatnikov <evgsyr@gmail.com> + + Update perf-related flags. + - PERF_SAMPLE_BRANCH_TYPE_SAVE, added in v4.14-rc1~173^2~33^2~6 + - PERF_SAMPLE_PHYS_ADDR, added in v4.14-rc1~173^2~2 + + * xlat/perf_branch_sample_type.in (PERF_SAMPLE_BRANCH_TYPE_SAVE): New + flag. + * xlat/perf_event_sample_format.in (PERF_SAMPLE_PHYS_ADDR): Likewise. + * tests/perf_event_open.c: Update expected output. + +2018-01-11 Eugene Syromyatnikov <evgsyr@gmail.com> + + perf.c: add support for struct perf_event_attr.namespaces. + This field was introduced by linux kernel commit v4.12-rc1~152^2~42^2~10. + + * configure.ac (AC_CHECK_MEMBERS): Add perf_event_attr.namespaces. + * perf_event_struct.h (struct perf_event_attr): Add namespaces field. + * perf.c (print_perf_event_attr): Print namespaces field. + Update comment for __reserved_1 field. + * tests/perf_event_open.c (struct pea_flags): Add namespaces field. + (print_event_attr): Update expected output. + +2018-01-11 Eugene Syromyatnikov <evgsyr@gmail.com> + + tests: check decoding of [gs]et_thread_area syscalls on x86. + * tests/xet_thread_area_x86.c: New file. + * tests/xet_thread_area_x86.test: New test. + * tests/Makefile.am (DECODER_TESTS): Add it. + * tests/.gitignore: Add xet_thread_area_x86. + * tests/pure_executables.list: Likewise. + +2018-01-10 Eugene Syromyatnikov <evgsyr@gmail.com> + + tests: check decoding of modify_ldt with for 4-byte-available user_desc. + Since there is possibility now that strace read only entry_number field + of the user_desc struct, let's check that it doesn't do it with + modify_ldt syscall. + + * tests/modify_ldt.c (main): Add 4-byte-sized tail_alloc'ed variable. + Try to provide it as an argument to modify_ldt. + +2018-01-10 Eugene Syromyatnikov <evgsyr@gmail.com> + + Allow separate printing of struct user_desc.entry_number. + Kernel reads only entry_number field in the beginning of the + get_thread_area syscall handler. Let's replicate this behaviour. + + * defs.h (enum user_desc_print_filter): New enumeration. + (print_user_desc): Add an argument for signalling which part of the + structure should be printed. + * clone.c (print_tls_arg): Update print_user_desc call. + * ldt.c (print_user_desc): Add filter argument. Print entry_number on + entering and the rest on exiting. Store entering value of the + entry_number field in order to print the updated value in the impossible + case of changed entry_number value. + (SYS_FUNC(modify_ldt), SYS_FUNC(set_thread_area)): Update + print_user_desc call. + (SYS_FUNC(get_thread_area)): Call print_user_desc with + USER_DESC_ENTERING format argument on entering and with + USER_DESC_EXITING on exiting. + +2018-01-10 Eugene Syromyatnikov <evgsyr@gmail.com> + + tests: move struct user_desc printing function into a separate file. + As part of preparation for the introduction of [gs]et_thread_area test. + + * tests/modify_ldt.c (print_user_desc): Move it ... + * tests/print_user_desc.c: ... to new file. + * tests/Makefile.am (EXTRA_DIST): Add print_user_desc.c. + +2018-01-08 Eugene Syromyatnikov <evgsyr@gmail.com> + + tests: check decoding of modify_ldt syscall. + * tests/modify_ldt.c: New file. + * tests/gen_tests.in: Add modify_ldt test. + * tests/pure_executables.list: Add modify_ldt. + * tests/.gitignore: Likewise. + + ldt.c: manually set modify_ldt's error code. + * ldt.c (modify_ldt): Move parsing under entering(tcp). Check whether + return code is erroneous and set tcp->u_error appropriately along with + RVAL_PRINT_ERR_VAL flag. + +2018-01-08 Eugene Syromyatnikov <evgsyr@gmail.com> + + syscall.c: add support for printing return value and error code. + Some weird syscalls (like modify_ldt) return value that doesn't indicate + an error (less than -4096), but it is, in fact, erroneous (because they + decide to clip the return value to 32-bit, for example). + + Add a flag to print decoded error code along with syscall return value. + + * defs.h (RVAL_PRINT_ERR_VAL): New rval flag. + * syscall.c (syscall_exiting_trace): Handle it. + +2018-01-08 Eugene Syromyatnikov <evgsyr@gmail.com> + + ldt.c: print the first argument of modify_ldt as int. + * ldt.c (SYS_FUNC(modify_ldt)): Print the first argument as %d. + + ldt.c: print lm field for 64-bit tracees. + * configure.ac (AC_CHECK_MEMBERS): Add struct user_desc.lm. + * ldt.c (print_user_desc) [HAVE_STRUCT_USER_DESC_LM]: Print lm field + for non-compat tracees (it is ignored for compat ones). + +2018-01-08 Eugene Syromyatnikov <evgsyr@gmail.com> + + ldt.c: make struct user_desc output more structured. + Also, while we are here, let's fix print qualifiers (which should be %u + and not %d). + + * ldt.c (print_user_desc): Use PRINT_FIELD_* macros for printing + structure. + (SYS_FUNC(set_thread_area)): Change field key-value separator from ":" + to "=", change print format qualifier from %d to %u. + +2018-01-08 Eugene Syromyatnikov <evgsyr@gmail.com> + + print_fields.h: add PRINT_FIELD_U_CAST. + Add a macro for printing fields explicitly casted to specific type. + This is useful for bit fields, as otherwise the magic of *_extend_to_* + macros breaks. + + * print_field.h (PRINT_FIELD_U_CAST): New macro. + +2018-01-08 Eugene Syromyatnikov <evgsyr@gmail.com> + + print_fields.h: rename PRINT_FIELD_UID to PRINT_FIELD_ID. + As uid is not the only thing that has a special treatment of the -1 + value (and, as a result, needs special care), let's rename + PRINT_FIELD_UID to PRINT_FIELD_ID and make PRINT_FIELD_UID its alias. + + * print_fields.h (PRINT_FIELD_ID): Rename from PRINT_FIELD_UID. + (PRINT_FIELD_UID): Define to PRINT_FIELD_ID. + +2018-01-07 Dmitry V. Levin <ldv@altlinux.org> + + Fix build on systems without linux/genetlink.h. + * socketutils.c [!HAVE_LINUX_GENETLINK_H] (genl_families_xlat): Add + tcp argument. + + Fixes: v4.20-134-gc46fefc ("Add tcp arguments to netlink calls") + +2018-01-07 Eugene Syromyatnikov <evgsyr@gmail.com> + + count.c: whitespace. + + count.c: cleanup types and sizeof usage. + * count.c (call_summary_pers): Change the type of sorted_count + to "unsigned int *". Replace sizeof(int) with sizeof(sorted_count[0]). + Change the type of idx to unsigned int. + +2018-01-07 Eugene Syromyatnikov <evgsyr@gmail.com> + + count.c: collect definitions of format strings in one place. + In an attempt to make it more readable. + + * count.c (call_summary_pers): Put all format strings in static + constants. Use them. + +2018-01-07 Eugene Syromiatnikov <esyr@redhat.com> + + Add tcp arguments to netlink calls. + Since they call tracee-specific socket/sendmsg/recvmsg, we'd like to + pass tcp there. + + * defs.h (genl_families_xlat): Add tcp argument. + * netlink.c (decode_nlmsg_type_default, decode_nlmsg_type_generic, + decode_nlmsg_type_netfilter, typedef nlmsg_types_decoder_t): Likewise. + (decode_nlmsg_type): Add tcp argument. Pass tcp to decoder call. + (print_nlmsghdr): Pass tcp to the decode_nlmsg_type call. + * socketutils.c (send_query, receive_responses): Add tcp argument. + (inet_send_query, unix_send_query, netlink_send_query, ): Add tcp argument. + Pass tcp to the send_query call. + (unix_get): Add tcp argument. Pass tcp to the unix_send_query and + receive_responses calls. + (inet_get): Add tcp argument. Pass tcp to the inet_send_query and + receive_responses calls. + (tcp_v4_get, udp_v4_get, tcp_v6_get, udp_v6_get): Add tcp argument. Pass + tcp to the inet_get call. + (netlink_get): Add tcp argument. Pass tcp to the netlink_send_query and + receive_responses calls. + (protocols): Add tcp argument to the get field. + (get_sockaddr_by_inode_uncached): Add tcp argument. Pass tcp to + the protocols[].get calls. + (print_sockaddr_by_inode_uncached): Add tcp argument. Pass tcp to + the get_sockaddr_by_inode_uncached call. + (get_sockaddr_by_inode): Pass tcp to the get_sockaddr_by_inode_uncached + call. + (print_sockaddr_by_inode): Pass tcp to the + print_sockaddr_by_inode_uncached call. + (genl_send_dump_families): Add tcp argument. Pass tcp to the send_query + call. + (genl_families_xlat): Add tcp argument. Pass tcp to the + genl_send_dump_families and receive_responses calls. + +2018-01-07 Eugene Syromiatnikov <esyr@redhat.com> + + Add tcp argument to clear_regs. + * defs.h (clear_regs): Add argument struct tcb *tcp. + * syscall.c (clear_regs): Likewise. + * strace.c (next_event): Pass tcp to clear_regs() call. + +2018-01-07 Eugene Syromiatnikov <esyr@redhat.com> + + Pass tcp argument to get_optmem_max/read_int_from_file. + In preparation to passing tcp to all tracee-related syscalls. + + * defs.h (read_int_from_file): Add "struct tcb *" as the first argument. + * util.c (read_int_from_file): Likewise. + * msghdr.c (get_optmem_max): Add "struct tcb *tcp" as the first + argument, pass it to read_int_from_file call. + (decode_msg_control): Pass tcp to get_optmem_max. + +2018-01-07 Eugene Syromiatnikov <esyr@redhat.com> + + Include paths.h if it is available. + Use the OS definition of _PATH_BSHELL macro if it is available. + + * configure.ac (AC_CHECK_HEADERS): Add paths.h. + * strace.c [HAVE_PATHS_H]: Include paths.h. + +2018-01-07 Eugene Syromiatnikov <esyr@redhat.com> + + strace.c: avoid duplication of a format string in attach_tcb. + * strace.c (attach_tcb): Add task_path variable with the output format. + Use it for the procdir declaration and xsprintf format string argument. + +2018-01-07 Elvira Khabirova <lineprinter@altlinux.org> + + Move syscall_tampered to defs.h. + * syscall.c (syscall_tampered): Move ... + * defs.h: ... here. + +2018-01-07 Elvira Khabirova <lineprinter@altlinux.org> + + strace.c: rename set_sigaction to set_sighandler. + Since set_sigaction() actually specifies sa_handler and not sa_sigaction, + rename set_sigaction() to set_sighandler() for future definition of + set_sigaction() function as specifying sa_sigaction. + + * strace.c (set_sigaction): Rename to set_sighandler. + All callers updated. + +2018-01-07 Elvira Khabirova <lineprinter@altlinux.org> + + .gitignore: ignore "gnu" directory created by st_MPERS m4 macro. + + Update .mailmap. + * .mailmap (Elvira Khabirova): Add @altlinux.org. + +2018-01-07 Chen Jingpiao <chenjingpiao@gmail.com> + + .mailmap: add canonical name for Chen Jingpiao. + * .mailmap: Add canonical name for Chen Jingpiao. + +2018-01-07 Dmitry V. Levin <ldv@altlinux.org> + + personality.c: use sprintxval. + * personality.c (SYS_FUNC(personality)): Use sprintxval instead of local + implementation. + +2018-01-07 Eugene Syromiatnikov <esyr@redhat.com> + + xlat.c: add sprintxval for printing xval to string. + * defs.h (sprintxval): New declaration. + (sprintxval): New function. + +2018-01-07 Dmitry V. Levin <ldv@altlinux.org> + + desc.c: use xsnprintf instead of sprintf. + * desc.c: Include "xstring.h". + (decode_select): Replace sprintf with xsnprintf. + + xlat.c: use xsnprintf instead of sprintf. + * xlat.c: Include "xstring.h". + (sprintflags): Replace sprintf with xsnprintf. + + open.c: use xsnprintf instead of sprintf. + * open.c: Include "xstring.h". + (sprint_open_modes): Replace sprintf with xsnprintf. + + poll.c: use xs*printf instead of sprintf. + * poll.c: Include "xstring.h". + (decode_poll_exiting): Replace sprintf with xsnprintf and xsprintf. + + signal.c: use xs*printf instead of sprintf. + * signal.c: Include "xstring.h". + (signame): Replace sprintf with xsprintf. + (sprintsigmask_n): Replace sprintf with xsnprintf. + + print_timeval.c: use xsprintf instead of snprintf. + * print_timeval.c: Include "xstring.h". + (sprint_timeval, sprint_timeval32): Replace snprintf with xsprintf. + + print_timespec.c: use xsprintf instead of snprintf. + * print_timespec.c: Include "xstring.h". + (sprint_timespec): Replace snprintf with xsprintf. + + mmsghdr.c: use xsprintf instead of snprintf. + * mmsghdr.c: Include "xstring.h". + (SYS_FUNC(recvmmsg)): Replace snprintf with xsprintf. + + socketutils.c: use xsprintf instead of snprintf. + * socketutils.c: Include "xstring.h". + (unix_parse_response): Replace snprintf with xsprintf. + + alpha.c: use xsprintf instead of snprintf. + * alpha.c: Include "xstring.h". + (decode_getxxid): Replace snprintf with xsprintf. + + v4l2.c: use xsprintf instead of sprintf. + * v4l2.c: Include "xstring.h". + (print_v4l2_create_buffers): Replace sprintf with xsprintf. + + util.c: use x*sprintf instead of s*printf. + * util.c: Include "xstring.h". + (sprinttime_ex): Replace snprintf with xsnprintf. + (getfdproto): Replace sprintf with xsprintf. + + unwind.c: use xsprintf instead of sprintf. + * unwind.c: Include "xstring.h". + (build_mmap_cache): Replace sprintf with xsprintf. + + syscall.c: use xsprintf instead of sprintf. + * syscall.c: Include "xstring.h". + (get_scno): Replace sprintf with xsprintf. + + resource.c: use xsprintf instead of sprintf. + * resource.c: Include "xstring.h". + (sprint_rlim64, sprint_rlim32): Replace sprintf with xsprintf. + + pathtrace.c: use xsprintf instead of sprintf. + * pathtrace.c: Include "xstring.h". + (getfdpath): Replace sprintf with xsprintf. + +2018-01-07 Eugene Syromyatnikov <evgsyr@gmail.com> + + ldt.c: replace sprintf with xsprintf. + * ldt.c: Include "xstring.h". + (SYS_FUNC(set_thread_area)): Replace sprintf with xsprintf. + +2018-01-05 Dmitry V. Levin <ldv@altlinux.org> + + strace.c: use xsprintf instead of sprintf. + * strace.c: Include "xstring.h". + (strerror, newoutf, attach_tcb, print_debug_info): Replace sprintf + with xsprintf. + +2018-01-05 Eugene Syromyatnikov <evgsyr@gmail.com> + + ioprio.c: use xsprintf instead of sprintf. + * ioprio.c: Include "xstring.h". + (sprint_ioprio): Replace sprintf with xsprintf. + +2018-01-05 Eugene Syromyatnikov <evgsyr@gmail.com> + + Introduce hardened xsprintf/xsnprintf macros. + Let's try to future/fool-proof code a bit by introducing variants + of sprintf/snprintf that die if an overflow (or an error) occurs. + They are deemed to be the default choice for printing to some local + string buffer where no sensible error handling is implemented. + + * xstring.h: New file. + * Makefile.am (strace_SOURCES): Add it. + +2018-01-05 Eugene Syromyatnikov <evgsyr@gmail.com> + + count.c: use %9.u conversion specification. + Instead of printing to a temporary string. This also fixes a subtle bug + when the output for a billion errors and more is cut and shown + incorrectly. + + * count.c (struct call_counts): Change type of calls and errors fields + to unsigned int since they are used and printed as unsigned anyway. + (call_summary_pers): Remove error_str. Print cc->errors + and error_cum using %9.u conversion specification. + +2018-01-05 Eugene Syromyatnikov <evgsyr@gmail.com> + + count.c: use personality_names in call_summary report caption. + Otherwise the title is quite misleading for x32 personality. + + * count.c (call_summary): Use personality_names. + +2018-01-05 Victor Krapivensky <krapivenskiy.va@phystech.edu> + + Move personality names to a global variable. + This is a part of "Prepare for adding support for Lua scripting" + commit. + + * defs.h (personality_names): New external constant declaration. + * syscall.c: (personality_names): New global variable. + (update_personality): Use personality_names for reporting personality + name. + + Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com> + +2018-01-04 Lubomir Rintel <lkundrak@v3.sk> + + strace.spec.in: include Bluetooth headers for AF_BLUETOOTH sockets decoding + * strace.spec.in (BuildRequires): Add pkgconfig(bluez). + +2018-01-04 Dmitry V. Levin <ldv@altlinux.org> + + Lift artificial limit on output file names in -ff mode. + Starting with commit v4.5.19~88 strace imposed an artificial limit + on output file names in -ff mode, leading to the following absurd + behaviour: + + $ strace -ff -o"$(perl -e 'print "/" x 510')/$PWD/log" /bin/true + strace: Can't fopen '////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////.12345': Permission denied + + * strace.c (newoutf): Raise buffer size to PATH_MAX. + (init) <followfork >= 2>: Check output file name prefix length. + * tests/options-syntax.test: Check it. + +2018-01-04 Dmitry V. Levin <ldv@altlinux.org> + + configure.ac: fix typo. + * configure.ac: Replace CPPFALGS with CPPFLAGS. + + Fixes: v4.20-85-gf9c8e8a ("unwind: demangle symbol names") + +2018-01-03 Eugene Syromiatnikov <esyr@redhat.com> + + Change the first argument of upeek from pid to tcp. + All users were changed automatically by: + + for i in `git grep -l 'upeek(tcp->pid'`; do \ + sed -i 's/upeek(tcp->pid/upeek(tcp/g' "$i"; \ + done + + * upeek.c (upeek): Change the first argument from pid_t pid to struct + tcb *tcp. Use tcp->pid instead of pid in the function's body. + * defs.h (upeek): Update declaration. + * linux/alpha/arch_getrval2.c: Pass tcp instead of tcp->pid to the + upeek calls. + * linux/alpha/arch_rt_sigframe.c: Likewise. + * linux/alpha/arch_sigreturn.c: Likewise. + * linux/alpha/get_scno.c: Likewise. + * linux/alpha/get_syscall_args.c: Likewise. + * linux/alpha/get_syscall_result.c: Likewise. + * linux/bfin/arch_rt_sigframe.c: Likewise. + * linux/bfin/get_scno.c: Likewise. + * linux/bfin/get_syscall_args.c: Likewise. + * linux/bfin/get_syscall_result.c: Likewise. + * linux/crisv10/arch_rt_sigframe.c: Likewise. + * linux/crisv10/get_scno.c: Likewise. + * linux/crisv10/get_syscall_args.c: Likewise. + * linux/crisv10/get_syscall_result.c: Likewise. + * linux/hppa/arch_rt_sigframe.c: Likewise. + * linux/hppa/get_scno.c: Likewise. + * linux/hppa/get_syscall_args.c: Likewise. + * linux/hppa/get_syscall_result.c: Likewise. + * linux/microblaze/arch_rt_sigframe.c: Likewise. + * linux/microblaze/arch_sigreturn.c: Likewise. + * linux/microblaze/get_scno.c: Likewise. + * linux/microblaze/get_syscall_args.c: Likewise. + * linux/microblaze/get_syscall_result.c: Likewise. + * linux/powerpc/getregs_old.c: Likewise. + * linux/sh/arch_getrval2.c: Likewise. + * linux/sh/arch_rt_sigframe.c: Likewise. + * linux/sh/get_scno.c: Likewise. + * linux/sh/get_syscall_args.c: Likewise. + * linux/sh/get_syscall_result.c: Likewise. + * linux/sh64/get_scno.c: Likewise. + * linux/sh64/get_syscall_args.c: Likewise. + * linux/sh64/get_syscall_result.c: Likewise. + * linux/xtensa/arch_rt_sigframe.c: Likewise. + * linux/xtensa/get_scno.c: Likewise. + * linux/xtensa/get_syscall_args.c: Likewise. + * linux/xtensa/get_syscall_result.c: Likewise. + * syscall.c: Likewise. + +2018-01-03 Eugene Syromiatnikov <esyr@redhat.com> + + Change argument of getregs_old from pid to tcp. + * linux/powerpc/getregs_old.c (getregs_old): Change the first argument + from pid_t pid to struct tcb *tcp. Replace all instances of pid with + tcp->pid. + * linux/x86_64/getregs_old.c (getregs_old): Likewise. + * linux/x86_64/getregs_old.h (getregs_old): Update declaration. + * syscall.c (get_regs) [HAVE_GETREGS_OLD]: Pass tcp to the getregs_old + call instead of tcp->pid. + +2018-01-03 Eugene Syromiatnikov <esyr@redhat.com> + + Change the first argument of upoke from pid to tcp. + Users were updated automatically by: + + for i in `git grep -l 'upoke(tcp->pid'`; do \ + sed -i 's/upoke(tcp->pid/upoke(tcp/g' "$i"; \ + done + + * upoke.c (upoke): Change the first argument from pid_t pid to struct + tcb *tcp. Use tcp->pid instead of pid in the function's body. + * defs.h (upoke): Update declaration. + * linux/alpha/set_error.c (arch_set_error, arch_set_success): Provide + tcp in the first argument of the upoke call instead of tcp->pid. + * linux/alpha/set_scno.c (arch_set_scno): Likewise. + * linux/bfin/set_error.c (arch_set_error, arch_set_success): Likewise. + * linux/bfin/set_scno.c (arch_set_scno): Likewise. + * linux/crisv10/set_error.c (arch_set_error, arch_set_success): + Likewise. + * linux/crisv10/set_scno.c (arch_set_scno): Likewise. + * linux/hppa/set_error.c (arch_set_error, arch_set_success): Likewise. + * linux/hppa/set_scno.c (arch_set_scno): Likewise. + * linux/i386/set_error.c (arch_set_error, arch_set_success): Likewise. + * linux/i386/set_scno.c (arch_set_scno): Likewise. + * linux/microblaze/set_error.c (arch_set_error, arch_set_success): + Likewise. + * linux/microblaze/set_scno.c (arch_set_scno): Likewise. + * linux/powerpc/set_error.c (arch_set_error, arch_set_success): + Likewise. + * linux/powerpc/set_scno.c (arch_set_scno): Likewise. + * linux/sh/set_error.c (arch_set_error, arch_set_success): Likewise. + * linux/sh/set_scno.c (arch_set_scno): Likewise. + * linux/sh64/set_error.c (arch_set_error, arch_set_success): Likewise. + * linux/sh64/set_scno.c (arch_set_scno): Likewise. + * linux/x86_64/set_error.c (arch_set_error, arch_set_success): Likewise. + * linux/x86_64/set_scno.c (arch_set_scno): Likewise. + * linux/xtensa/set_error.c (arch_set_error, arch_set_success): Likewise. + * linux/xtensa/set_scno.c (arch_set_scno): Likewise. + +2018-01-03 Eugene Syromiatnikov <esyr@redhat.com> + + Move enum trace_event into a separate header. + As it will have users outside strace.c in the future. + + * trace_event.h (enum trace_event): Move it from... + * strace.c (enum trace_event): ...here. + (#include "trace_event.h"): New header, for enum trace_event. + * Makefile.am (strace_SOURCES): Add trace_event.h. + +2018-01-03 Eugene Syromyatnikov <evgsyr@gmail.com> + + Call get_scno during startup_tcb only for forcibly attached processes. + Otherwise it makes little sense on most arches to try to get syscall + number. + + * defs.h (TCB_GRABBED): New tcb flag. + * strace.c (attach_tcb): Set TCB_GRABBED for the tcb. + (startup_tcb): Call get_scno() only if process is grabbed and its + registers may contain syscall number information. + + Reported-by: Dmitry V. Levin <ldv@altlinux.org> + Closes: https://github.com/strace/strace/issues/22 + +2018-01-01 Eugene Syromyatnikov <evgsyr@gmail.com> + + strace.c: sort getopt switch branches alphabetically. + There's no reason to have them out of order. This also (almost) matches + their order in the getopt call argument, introduced in + v4.20-64-g61c03be. + + * strace.c (init): Sort branches in the getopt switch routine. + +2018-01-01 Eugene Syromyatnikov <evgsyr@gmail.com> + + strace.c: check for (non)zero argc instead of argv[0] + Since we can never be sure that we have NULL behind the last entry of + the argv array. + + * strace.c (init): Check for non-zero argc before/instead of argv[0]. + +2018-01-01 Eugene Syromyatnikov <evgsyr@gmail.com> + + strace.1: advertise strace-log-merge. + In order to raise awareness about strace-log-merge, mention it in + SEE ALSO section and -ff option description. + + * strace.1.in (.SS Filtering) <.TP .B \-ff>: Mention strace-log-merge. + (.SH "SEE ALSO"): Likewise. + +2017-12-29 Dmitry V. Levin <ldv@altlinux.org> + + unwind: demangle function arguments. + * unwind.c (print_stack_frame): Specify demangling style. + * tests/strace-k.test (result): Update regexp. + * tests/strace-k-demangle.test (expected): Update expected output. + + tests: check strace -k symbol names demangling. + * tests/strace-k-demangle.test: New test. + * tests/stack-fcall-mangled.c: New file. + * tests/stack-fcall-mangled-0.c: Likewise. + * tests/stack-fcall-mangled-1.c: Likewise. + * tests/stack-fcall-mangled-2.c: Likewise. + * tests/stack-fcall-mangled-3.c: Likewise. + * tests/stack-fcall.h [MANGLE] (f0, f1, f2, f3): New macros. + * tests/.gitignore: Add stack-fcall-mangled. + * tests/Makefile.am (check_PROGRAMS): Likewise. + (stack_fcall_mangled_SOURCES): New variable. + (EXTRA_DIST): Add strace-k-demangle.test. + [USE_LIBUNWIND && USE_DEMANGLE] (LIBUNWIND_TESTS): Likewise. + +2017-12-29 Dmitry V. Levin <ldv@altlinux.org> + + tests: parametrize strace-k.test. + Prepare for the check of strace -k symbol names demangling. + + * tests/strace-k.test: Parametrize $test_prog and $expected. + * tests/stack-fcall.h: New file. + * tests/stack-fcall.c: Include "stack-fcall.h" + * tests/stack-fcall-0.c: Likewise. + * tests/stack-fcall-1.c: Likewise. + * tests/stack-fcall-2.c: Likewise. + * tests/stack-fcall-3.c: Likewise. + * tests/Makefile.am (EXTRA_DIST): Add stack-fcall.h. + +2017-12-26 Masatake YAMATO <yamato@redhat.com> + + unwind: demangle symbol names. + Implement demangling of C++ symbol names in stack trace + using cplus_demangle function from GNU libiberty library. + + This is an example demangled stack trace output: + + fstat(5, {st_mode=S_IFREG|0664, st_size=0, ...}) = 0 + > /usr/lib64/libc-2.25.so(__fxstat64+0x12) [0xffd62] + > /usr/lib64/libc-2.25.so(_IO_file_doallocate+0x5f) [0x717ff] + > /usr/lib64/libc-2.25.so(_IO_doallocbuf+0x79) [0x81699] + > /usr/lib64/libc-2.25.so(_IO_file_overflow+0x198) [0x807b8] + > /usr/lib64/libc-2.25.so(_IO_file_xsputn+0xbd) [0x7ed5d] + > /usr/lib64/libc-2.25.so(fwrite_unlocked+0x60) [0x7d800] + > /usr/lib64/libleveldb.so.1.18(leveldb::EnvWrapper::StartThread+0x3b6) [0x48656] + > /usr/lib64/libleveldb.so.1.18(leveldb::log::Writer::EmitPhysicalRecord+0x89) [0x28bc9] + > /usr/lib64/libleveldb.so.1.18(leveldb::log::Writer::AddRecord+0x9e) [0x28d9e] + > /usr/lib64/libleveldb.so.1.18(leveldb::DBImpl::Write+0x208) [0x1ce18] + > /usr/lib64/libleveldb.so.1.18(leveldb::DB::Put+0x59) [0x192b9] + > /usr/lib64/libleveldb.so.1.18(leveldb::DBImpl::Put+0x1d) [0x1931d] + > /home/yamato/var/leveldb/doc/a.out(main+0x120) [0x1107] + > /usr/lib64/libc-2.25.so(__libc_start_main+0xea) [0x2088a] + > /home/yamato/var/leveldb/doc/a.out(_start+0x2a) [0xf3a] + + * Makefile.am [USE_DEMANGLE] (strace_CPPFLAGS, strace_LDFLAGS, + libiberty_LDADD): Append libiberty_CPPFLAGS, strace_LDFLAGS, and + libiberty_LIBS, respectively. + * configure.ac: Add --with-libiberty option. Check cplus_demangle + support in libiberty. + * unwind.c [USE_DEMANGLE]: Include <demangle.h>. + (print_stack_frame) [USE_DEMANGLE]: Use cplus_demangle. + +2017-12-26 Masatake YAMATO <yamato@redhat.com> + + Define macros for renaming xmalloc and xcalloc. + I'm planning to link strace with libiberty for mangling C++ + symbol names in stack trace enabled with -k option. + + Both names, xmalloc and xcalloc, are already defined and used + in libiberty, and they conflict with functions in strace. + Rename xmalloc and xcalloc functions defined in strace + to strace_xmalloc and strace_xcalloc, respectively, + to avoid this conflict. + + * xmalloc.h (xcalloc, xmalloc): New macros. + +2017-12-24 Dmitry V. Levin <ldv@altlinux.org> + + syscall: move a sparc specific include to an arch specific file. + * syscall.c [SPARC64]: Do not include <asm/psrcompat.h>. + [SPARC]: Do not include <asm/psr.h>. + * linux/sparc/get_error.c: Include <asm/psr.h>. + + syscall: move all ia64 specific includes to an arch specific file. + * syscall.c [IA64]: Remove. + * linux/ia64/get_syscall_args.c: Include <asm/rse.h>. + + syscall: simplify get_syscall_result. + * syscall.c [ptrace_getregset_or_getregs] (get_syscall_result_regs): + Define to get_regs. + (get_syscall_result): Use get_syscall_result_regs unconditionally. + +2017-12-24 Dmitry V. Levin <ldv@altlinux.org> + + syscall: change get_regs argument type. + This opens the way for future changes related to get_regs. + + * syscall.c (get_regs): Change argument type from "pid_t" + to "struct tcb *", all callers changed. + +2017-12-24 Dmitry V. Levin <ldv@altlinux.org> + + syscall: move get_regs call from syscall_exiting_decode to get_syscall_result + This make the code less confusing and opens the way for future changes + related to get_regs. + + * syscall.c (syscall_exiting_decode): Move get_regs invocation ... + (get_syscall_result) [ptrace_getregset_or_getregs]: ... here. + +2017-12-24 Dmitry V. Levin <ldv@altlinux.org> + + syscall: rework subcall decoding on mips o32. + Move syscall subcall handling to the same switch statement that + handles ipc and socket subcalls. + + * linux/mips/syscallent-o32.h [LINUX_MIPSO32] (SYS_syscall_subcall): + Define. + * syscall.c (decode_mips_subcall): Rename to decode_syscall_subcall, + conditionalize on SYS_syscall_subcall instead of LINUX_MIPSO32. + (syscall_entering_decode) [LINUX_MIPSO32]: Remove. + (syscall_entering_decode) [SYS_syscall_subcall]: Handle SEN_syscall + using decode_syscall_subcall. + +2017-12-24 Dmitry V. Levin <ldv@altlinux.org> + + syscall: tweak shuffle_scno ifdefery. + * syscall.c (shuffle_scno): Check for ARM_FIRST_SHUFFLED_SYSCALL + instead of ARM || AARCH64. This does not result to any code change + but looks more comprehensible. + + syscall: change get_regs to return an error code. + * syscall.c (get_regs_error) [!ptrace_getregset_or_getregs]: Do not + define. + (clear_regs) [!ptrace_getregset_or_getregs]: Do not set get_regs_error. + (get_regs) [ptrace_getregset_or_getregs]: Return get_regs_error, all + callers changed to test get_regs return code instead of get_regs_error + static variable, which is now internally used by get_regs() and + clear_regs() only. + (USE_GET_SYSCALL_RESULT_REGS): Do not define. + Use "#ifndef ptrace_getregset_or_getregs" + instead of "#ifdef USE_GET_SYSCALL_RESULT_REGS". + +2017-12-24 Harsha Sharma <harshasharmaiitr@gmail.com> + + tests: enhance run.sh usage error diagnostics. + * tests/run.sh: Execute timeout command only when invoked with + an argument, otherwise print an error message. + +2017-12-23 Dmitry V. Levin <ldv@altlinux.org> + + tests: skip nsyscalls-d.test on mips o32. + On mips o32, nsyscalls test is implemented using syscall #4000, + so nsyscalls-d cannot work there. + + * tests/nsyscalls-d.test: Skip on mips o32. + +2017-12-23 Dmitry V. Levin <ldv@altlinux.org> + + Remove linux/ptp_clock.h. + As linux kernel provides a compatible linux/ptp_clock.h header since + commit v3.8-rc1~139^2~514, there is no need for a local copy. + + * linux/ptp_clock.h: Remove. + * Makefile.am (EXTRA_DIST): Remove it. + * configure.ac (AC_CHECK_TYPES): Check for struct ptp_sys_offset + in <linux/ptp_clock.h>. + * ioctl.c (ioctl_decode) <case '='>: Conditionalize + on [HAVE_STRUCT_PTP_SYS_OFFSET]. + * ptp.c: Likewise. + +2017-12-23 Dmitry V. Levin <ldv@altlinux.org> + + Remove linux/ubi-user.h. + As linux kernel provides a compatible mtd/ubi-user.h header since + commit v3.7-rc1~85^2~17, there is no need for a local copy. + + * linux/ubi-user.h: Remove. + * Makefile.am (EXTRA_DIST): Remove it. + * configure.ac (AC_CHECK_MEMBERS): Check + for struct ubi_attach_req.max_beb_per1024 in <mtd/ubi-user.h>. + * ioctl.c (ioctl_decode) <case 'o', case 'O'>: Conditionalize + on HAVE_STRUCT_UBI_ATTACH_REQ_MAX_BEB_PER1024. + * ubi.c: Likewise. + +2017-12-23 Dmitry V. Levin <ldv@altlinux.org> + + Remove linux/mtd-abi.h. + As linux kernel provides a compatible mtd/mtd-abi.h header since + commit v3.2-rc1~14^2~33, there is no need for a local copy. + + * linux/mtd-abi.h: Remove. + * Makefile.am (EXTRA_DIST): Remove it. + * configure.ac (AC_CHECK_TYPES): Check for struct mtd_write_req + in <mtd/mtd-abi.h>. + * ioctl.c (ioctl_decode) <case 'M'>: Conditionalize + on [HAVE_STRUCT_MTD_WRITE_REQ]. + * mtd.c: Likewise. + * tests/ioctl_mtd.c: Likewise. + * tests/ioctl.c (main): Likewise. + +2017-12-23 Dmitry V. Levin <ldv@altlinux.org> + + Remove linux/personality.h. + * linux/personality.h: Remove. + * Makefile.am (EXTRA_DIST): Remove it. + * personality.c: Do not include <linux/personality.h>, include + "xlat/personality_flags.h" before "xlat/personality_types.h". + * xlat/personality_flags.in: Provide fallback definitions. + * xlat/personality_types.in: Likewise. + +2017-12-23 Dmitry V. Levin <ldv@altlinux.org> + + travis: switch from clang-3.8 to clang. + As travis provides a relatively fresh clang by default nowadays, + it makes sense to use default clang in clang-based test builds. + + * .travis.yml (matrix): Change clang-3.8 to clang. + +2017-12-21 Eugene Syromyatnikov <evgsyr@gmail.com> + + strace.1.in: mention perf and ftrace in SEE ALSO. + * strace.1.in (.SH SEE ALSO): Add references to perf-trace(1) and + trace-cmd(1). + + strace.1.in: clarify -F option behaviour. + * strace.1.in <.TP \-F>: Extend deprecation warning. Describe behaviour + of multiple instances of -F and interoperability of -F and -f. + +2017-12-20 Dmitry V. Levin <ldv@altlinux.org> + + tests: consistently use $STRACE_EXE instead of local alternatives. + * tests/get_regs.test: Replace "${STRACE##* }" with "$STRACE_EXE". + * tests/options-syntax.test: Replace "$strace_exp" with "$STRACE_EXE". + * tests/syntax.sh: Likewise. + +2017-12-20 Eugene Syromyatnikov <evgsyr@gmail.com> + Dmitry V. Levin <ldv@altlinux.org> + + strace.c: inform the user about -F option obsolescence. + * strace.c (init): Print an error message if the option is used. + +2017-12-20 Eugene Syromyatnikov <evgsyr@gmail.com> + + strace.c: sort option arguments alphabetically. + Except for the ones that enabled by configure options. + + While we are here, let's also change the indentation of while expression + continuation in order to separate it from the following switch clause. + + * strace.c (init): Reorder options in getopt() call. + +2017-12-20 Eugene Syromiatnikov <esyr@redhat.com> + + strace.c: use _exit() instead of exit() in child's die() + Let's keep child's death routine as minimalistic as possible for the + cases when vfork() is used instead of fork() on systems that lack MMU. + + * strace.c (die) <!(strace_tracer_pid == getpid())>: Call _exit(). + +2017-12-20 Harsha Sharma <harshasharmaiitr@gmail.com> + + syscall: replace if (debug_flag) ... with debug_msg macro. + * syscall.c (get_scno): Use debug_msg instead of + "if (debug_flag) error_msg". + +2017-12-20 Eugene Syromyatnikov <evgsyr@gmail.com> + + tests: check (some) debugging output generated during nsyscalls test. + * tests/nsyscalls-d.c: New file. + * tests/.gitignore: Add it. + * tests/nsyscalls-d.test: New test, variant of nsyscalls.test with debug + output check. + * tests/nsyscalls-nd.test: Likewise. + * tests/nsyscalls.c: Add expected debug output. + * tests/Makefile.am (check_PROGRAMS): Add nsyscalls-d. + (DECODER_TESTS): Add nsyscalls-d.test and nsyscalls-nd.test. + +2017-12-20 Eugene Syromiatnikov <esyr@redhat.com> + + pathtrace.c: use xgrowarray. + * defs.h <struct path_set>: Change type of num_selected field to size_t. + Add size field. + * pathtrace.c (storepath): Rewrite to utilise xgrowarray. + +2017-12-14 Dmitry V. Levin <ldv@altlinux.org> + + dyxlat: use xgrowarray. + * dyxlat.c (dyxlat_alloc): Use xgrowarray instead of xcalloc. + (dyxlat_add_pair): Use xgrowarray instead of xreallocarray. + + unwind: use xgrowarray. + * unwind.c (get_symbol_name): Use xgrowarray instead of manual + dynamic array management using xreallocarray. + +2017-12-14 Eugene Syromiatnikov <esyr@redhat.com> + + strace.c: use xgrowarray. + * strace.c (tcbtabsize): Change type to size_t. + (expand_tcbtab): Rewrite in order to utilise xgrowarray + instead of manual dynamic array management. + + unwind: use xgrowarray. + * unwind.c (build_mmap_cache): Use xgrowarray instead of manual dynamic + array management. + +2017-12-14 Eugene Syromiatnikov <esyr@redhat.com> + + xmalloc.c: introduce xgrowarray helper function. + In order to simplify dynamic array management code. + + * xmalloc.h (xgrowarray): New declaration. + * xmalloc.c (xgrowarray): New function. + +2017-12-14 Dmitry V. Levin <ldv@altlinux.org> + + tests: check error diagnostics when exec file name is too long. + * tests/options-syntax.test: Check error diagnostics when + exec file name length equals to PATH_MAX. + +2017-12-13 Eugene Syromiatnikov <esyr@redhat.com> + + strace.c: minor style fixes. + * strace.c (test_ptrace_seize): Remove excess braces. + (init): Wrap overly long string literal. Add braces + to the else if branch. + +2017-12-13 Eugene Syromiatnikov <esyr@redhat.com> + + strace.c: use *_func_* message printing macros where appropriate. + In order to provide some additional bits of information in weird error + cases or just replace existing usages of __func__/literal function name. + + * strace.c (detach): Use perror_func_msg() instead of perror_msg(). + (startup_attach, open_dummy_desc, startup_child, test_ptrace_seize): Use + perror_func_msg_and_die() instead of perror_msg_and_die(). + (test_ptrace_seize): Use error_func_msg_and_die() instead of + error_msg_and_die(). + +2017-12-13 Eugene Syromiatnikov <esyr@redhat.com> + + unwind.c: more verbose mapping overlapping diagnostic message. + * unwind.c (build_mmap_cache): Change error_msg() to debug_msg(), add + information about region names and the respective start and end + addresses. + +2017-12-13 Eugene Syromiatnikov <esyr@redhat.com> + + unwind.c: non-fatal handling of asprintf error. + An error returned by asprintf is a poor excuse for dying. + + * unwind.c (asprintf_error_str): New string constant. + (sprint_call_or_error): Replace error_msg_and_die() with + perror_func_msg() and usage of asprintf_error_str for a return value. + (queue_print): Free tmp->output line only if it is not + asprintf_error_str. + +2017-12-13 Eugene Syromiatnikov <esyr@redhat.com> + + unwind.c: eliminate DPRINTF. + Since DPRINTF is simply a macro that provides debugging information + along with some information about printing routine call site, now standard + debug_func_* macros are deemed to be a suitable replacement. + + * unwind.c (DPRINTF): Remove. + (build_mmap_cache, delete_mmap_cache, unwind_cache_invalidate, + unwind_print_stacktrace, unwind_captiure_stacktrace): Replace + DPRINTF(fmt, str, ...) with debug_func_msg(fmt, ...)/ + +2017-12-13 Eugene Syromiatnikov <esyr@redhat.com> + + strace.c: replace if (debug_flag) ... with suitable debug printing macros + * strace.c (alloc_tcb, droptcb, detach, attach_tcb, test_ptrace_seize, + init, startup_tcb): Replace if (debug_flag) error_msg(...) occurrences + with debug_error_msg(...). + (attach_tcb): Replace if (debug_flag) perror_msg(...) with + debug_perror_msg(...). + (cleanup, startup_tcb): Replace if (debug_flag) error_msg(...) + occurrences with debug_func_msg() in attempt to provide additional + information. + +2017-12-13 Eugene Syromiatnikov <esyr@redhat.com> + + error_prints.h: add *_func_* printing macros. + In order to reduce boilerplate for the cases when __func__ is desired + to be printed. + + * error_prints.h (error_func_msg, perror_func_msg, debug_func_msg, + debug_func_perror_msg, error_func_msg_and_die, perror_func_msg_and_die): + New macro definitions. + +2017-12-13 Eugene Syromiatnikov <esyr@redhat.com> + + error_prints.h: add debug print macros. + * defs.h (debug_flag): Move the declaration... + * error_prints.h (debug_flag): ... here. + (debug_msg, debug_perror_msg): New macro definitions. + Include <stdbool.h> for the debug_flag declaration. + +2017-12-04 Masatake YAMATO <yamato@redhat.com> + Dmitry V. Levin <ldv@altlinux.org> + + tests: check decoding of KVM ioctl commands. + * tests/ioctl_kvm_run.c: New file. + * tests/ioctl_kvm_run.test: New test. + * tests/Makefile.am (DECODER_TESTS): Add ioctl_kvm_run.test. + * tests/pure_executables.list: Add ioctl_kvm_run. + * tests/.gitignore: Likewise. + +2017-12-04 Masatake YAMATO <yamato@redhat.com> + + kvm: decode the argument of KVM_{SET, GET}_SREGS ioctl command. + * configure.ac (AC_CHECK_TYPES): Add struct kvm_sregs. + * kvm.c [HAVE_STRUCT_KVM_SREGS] (kvm_ioctl_decode_sregs): New function. + (kvm_ioctl) [HAVE_STRUCT_KVM_SREGS] <KVM_SET_SREGS, KVM_GET_SREGS>: + Use it. + * linux/arch_kvm.c (arch_print_kvm_sregs): New function. + * linux/x86_64/arch_kvm.c (PRINT_FIELD_KVM_SREGS_STRUCT): New macro. + (kvm_ioctl_decode_regs_dtable, kvm_ioctl_decode_regs_segment, + arch_print_kvm_sregs): New functions. + + kvm: decode the argument of KVM_{SET, GET}_REGS ioctl command. + * configure.ac (AC_CHECK_TYPES): Add struct kvm_regs. + * linux/arck_kvm.c: New file. + * linux/x86_64/arch_kvm.c: Likewise. + * linux/i386/arch_kvm.c: Likewise. + * linux/x32/arch_kvm.c: Likewise. + * Makefile.am (EXTRA_DIST): Add them. + * kvm.c: Include "arch_kvm.c". + [HAVE_STRUCT_KVM_REGS] (kvm_ioctl_decode_regs): New function. + (kvm_ioctl) [HAVE_STRUCT_KVM_REGS] <KVM_SET_REGS, KVM_GET_REGS>: Use it. + + kvm: decode the argument of KVM_SET_USER_MEMORY_REGION ioctl command. + * configure.ac (AC_CHECK_TYPES): Add struct kvm_userspace_memory_region. + * xlat/kvm_mem_flags.in: New file. + * kvm.c: Include print_fields.h. + [HAVE_STRUCT_KVM_USERSPACE_MEMORY_REGION]: Include xlat/kvm_mem_flags.h, + (kvm_ioctl_set_user_memory_region): New function. + (kvm_ioctl) [HAVE_STRUCT_KVM_USERSPACE_MEMORY_REGION] + <KVM_SET_USER_MEMORY_REGION>: Use it. + +2017-12-03 Eugene Syromyatnikov <evgsyr@gmail.com> + + Add strace mascot. + * strace.svg: New file. + + Co-Authored-by: Vitaly Chaykovsky <mgspeker@gmail.com> + +2017-12-03 Dmitry V. Levin <ldv@altlinux.org> + + tests: robustify attach-p-cmd.test against buggy kernels. + From time to time various kernels, old and new, just go nuts + and fail attach-p-cmd.test with the following diagnostics: + + 12345 --- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} --- + -12345 chdir("attach-p-cmd.test -p") = -1 ENOENT (No such file or directory) + +12345 syscall_4294967295(0xffe60934, 0x1c0, 0xffe60934, 0x1, 0xffe609b4, 0xffe60a58) = -1 (errno 38) + +12345 chdir("attach-p-cmd.test -p") = -1 ENOSYS (Function not implemented) + + Let's workaround this kernel madness by rewriting the test + without use of SIGALRM. + + * tests/attach-p-cmd.h: New file. + * tests/Makefile.am (EXTRA_DIST): Add attach-p-cmd.h. + * tests/attach-p-cmd-cmd.c: Include "attach-p-cmd.h". + (write_pidfile, wait_for_peer_invocation): New functions. + (main): Use them. + * tests/attach-p-cmd-p.c: Include <time.h> and "attach-p-cmd.h". + (wait_for_peer_invocation, wait_for_peer_termination): New functions. + (main): Use them. Do not raise SIGALRM, use nanosleep after peer + termination. + +2017-12-03 Dmitry V. Levin <ldv@altlinux.org> + + tests: robustify ipc_msgbuf.test against broken libc. + glibc between commits glibc-2.25~130 and glibc-2.26~740 had broken + msgctl(IPC_RMID) on hppa: this operation always failed with EINVAL + because of inappropriate use of IPC_64 flag. Similar issues were + fixed on other niche architectures. Let's workaround these issues + by skipping the test in case of msgctl(IPC_RMID) failure. + + * tests/ipc_msgbuf.c (cleanup): Change return type to int, + return 77 in case of msgctl(IPC_RMID) failure. + (main): Explicitly invoke cleanup() at the end. + +2017-12-01 Masatake YAMATO <yamato@redhat.com> + + kvm: decode the argument of KVM_CREATE_VCPU ioctl command. + * kvm.c (kvm_ioctl_create_vcpu): New function. + (kvm_ioctl) <KVM_CREATE_VCPU>: Use it. + + kvm: handle KVM_CREATE_VM ioctl command. + * kvm.c (kvm_ioctl): Handle KVM_CREATE_VM command. + + kvm: handle KVM_RUN, KVM_GET_VCPU_MMAP_SIZE, and KVM_GET_API_VERSION ioctl commands + * kvm.c (kvm_ioctl): Handle KVM_RUN, KVM_GET_VCPU_MMAP_SIZE, + and KVM_GET_API_VERSION commands. + + ioctl: add a stub for decoding kvm related ioctls. + * kvm.c: New file. + * Makefile.am (strace_SOURCES): Add it. + * configure.ac (AC_CHECK_HEADERS): Add linux/kvm.h. + * defs.h (kvm_ioctl): New prototype. + * ioctl.c (ioctl_decode) HAVE_LINUX_KVM_H]: Use kvm_ioctl. + +2017-11-30 Eugene Syromyatnikov <evgsyr@gmail.com> + + strace-log-merge: work around corner cases of strace -ttt parsing. + Employing strace -ttt for the logs destined to be fed to + strace-log-merge is ultimately the best solution except for the logs + that pass the following dates: + + Thu Jan 1 00:00:09 UTC 1970 + Thu Jan 1 00:01:39 UTC 1970 + Thu Jan 1 00:16:39 UTC 1970 + Thu Jan 1 02:46:39 UTC 1970 + Fri Jan 2 03:46:39 UTC 1970 + Mon Jan 12 13:46:39 UTC 1970 + Sun Apr 26 17:46:39 UTC 1970 + Sat Mar 3 09:46:39 UTC 1973 + Sun Sep 9 01:46:39 UTC 2001 + Sat Nov 20 17:46:39 UTC 2286 + Wed Nov 16 09:46:39 UTC 5138 + Fri Sep 27 01:46:39 UTC 33658 + Sun May 20 17:46:39 UTC 318857 + Sat Nov 7 09:46:39 UTC 3170843 + Sun Jul 5 01:46:39 UTC 31690708 + Sat Jan 25 17:46:39 UTC 316889355 + + Let's lift this limitation. + + * strace-log-merge: Generate numeric-only key for sorting, use sort -n + option. + +2017-11-30 Eugene Syromyatnikov <evgsyr@gmail.com> + + debian: add strace-log-merge to the list of installed files. + * debian/strace.install: Add strace-log-merge. + + Add strace-log-merge man page. + * strace-log-merge.1.in: New file. + * NEWS: Mention this. + * .gitignore: Add strace-log-merge.1. + * Makefile.am (man_MANS): Likewise. + * configure.ac (AC_CONFIG_FILES): Likewise. + * debian/strace.manpages: Likewise. + + strace-log-merge: add copyright header. + +2017-11-29 Dmitry V. Levin <ldv@altlinux.org> + + Add initial GitLab CI support. + * .gitlab-ci.yml: New file. + * travis-build.sh: Print $CC -print-multi-lib. Print config.log + in case of configure failure. + * travis-install.sh: Check sudo availability. Install autoconf, + automake, file, gawk, gcc-multilib, git, gzip, make, and xz-utils + for all targets. + (musl-gcc): Install ca-certificates. + +2017-11-25 Dmitry V. Levin <ldv@altlinux.org> + + mpers: fix cross-compiling. + In cross builds, a target version of readelf has to be used + instead of a native one. + + * configure.ac (AC_CHECK_TOOL): Add readelf. + * Makefile.am (READELF): New variable. + (mpers-m%.stamp): Pass it to $(srcdir)/mpers.sh. + * m4/mpers.m4 (st_MPERS): Pass READELF environment variable + to $srcdir/mpers_test.sh. + * mpers.sh (READELF): New variable. + Use it instead of readelf. + * maint/ioctls_sym.sh: Likewise. + * NEWS: Mention this fix. + + Reported-by: Rolf Eike Beer <eb@emlix.com> + +2017-11-22 Dmitry V. Levin <ldv@altlinux.org> + + tests: fix llseek test. + * tests/llseek.test: Fix typo. + + INSTALL-git.md: fix typo. + + tests: simplify bpf test a bit. + * tests/bpf.c (DEF_BPF_INIT_FIRST): New macro. + (init_BPF_MAP_CREATE_first, init_BPF_MAP_LOOKUP_ELEM_first, + init_BPF_PROG_LOAD_first, init_BPF_OBJ_PIN_first, + init_BPF_PROG_ATTACH_first, init_BPF_PROG_TEST_RUN_first, + init_BPF_PROG_GET_NEXT_ID_first, init_BPF_OBJ_GET_INFO_BY_FD_first): + Use it. + +2017-11-21 Dmitry V. Levin <ldv@altlinux.org> + + Implement decoding of BPF_OBJ_GET_INFO_BY_FD command of bpf syscall. + * configure.ac (AC_CHECK_MEMBERS): Add union bpf_attr.info.info. + * bpf.c (decode_BPF_OBJ_GET_INFO_BY_FD): New function. + (SYS_FUNC(bpf)) <bpf_cmd_decoders>: Use it. + * NEWS: Mention this. + * tests/bpf.c: Add macro guard for BPF_OBJ_GET_INFO_BY_FD decoder test. + [HAVE_UNION_BPF_ATTR_INFO_INFO] (sample_BPF_OBJ_GET_INFO_BY_FD_attr): + New variable. + [HAVE_UNION_BPF_ATTR_INFO_INFO] (init_BPF_OBJ_GET_INFO_BY_FD_first, + print_BPF_OBJ_GET_INFO_BY_FD_first, init_BPF_OBJ_GET_INFO_BY_FD_attr, + print_BPF_OBJ_GET_INFO_BY_FD_attr): New functions. + (main) [HAVE_UNION_BPF_ATTR_INFO_INFO]: Use them. + + Simplify union bpf_attr field checks. + * configure.ac: Use AC_CHECK_MEMBERS instead of st_CHECK_UNION_BPF_ATTR + for union bpf_attr field checks as the former seems to be enough + for the case. + * m4/st_bpf.m4: Remove. + + Implement decoding of BPF_*_GET_*_ID commands of bpf syscall. + * configure.ac: Check for union bpf_attr.next_id. + * bpf.c (decode_BPF_PROG_GET_NEXT_ID, decode_BPF_PROG_GET_FD_BY_ID, + * decode_BPF_MAP_GET_FD_BY_ID): New functions. + (decode_BPF_MAP_GET_NEXT_ID): New macro. + (SYS_FUNC(bpf)) <bpf_cmd_decoders>: Use them. + * NEWS: Mention this. + * tests/bpf.c: Add macro guard for BPF_*_GET_*_ID decoder tests. + [HAVE_UNION_BPF_ATTR_NEXT_ID] (init_BPF_PROG_GET_NEXT_ID_first, + print_BPF_PROG_GET_NEXT_ID_first, init_BPF_PROG_GET_NEXT_ID_attr, + print_BPF_PROG_GET_NEXT_ID_attr, print_BPF_PROG_GET_FD_BY_ID_first, + print_BPF_PROG_GET_FD_BY_ID_attr, print_BPF_MAP_GET_NEXT_ID_first, + print_BPF_MAP_GET_NEXT_ID_attr): New functions. + (init_BPF_MAP_GET_NEXT_ID_first, print_BPF_MAP_GET_NEXT_ID_first, + init_BPF_MAP_GET_NEXT_ID_attr, print_BPF_MAP_GET_NEXT_ID_attr, + init_BPF_PROG_GET_FD_BY_ID_first, init_BPF_PROG_GET_FD_BY_ID_attr, + init_BPF_MAP_GET_FD_BY_ID_first, init_BPF_MAP_GET_FD_BY_ID_attr): + New macros. + (main) [HAVE_UNION_BPF_ATTR_NEXT_ID]: Use them. + +2017-11-20 Dmitry V. Levin <ldv@altlinux.org> + + Implement decoding of BPF_PROG_TEST_RUN command of bpf syscall. + * configure.ac: Check for union bpf_attr.test.duration. + * bpf.c (decode_BPF_PROG_TEST_RUN): New function. + (SYS_FUNC(bpf)) <bpf_cmd_decoders>: Use it. + * NEWS: Mention this. + * tests/bpf.c: Include "print_fields.h". + Add macro guard for BPF_PROG_TEST_RUN decoder test. + [HAVE_UNION_BPF_ATTR_TEST_DURATION] (sample_BPF_PROG_TEST_RUN_attr): + New variable. + [HAVE_UNION_BPF_ATTR_TEST_DURATION] (init_BPF_PROG_TEST_RUN_first, + print_BPF_PROG_TEST_RUN_first, init_BPF_PROG_TEST_RUN_attr, + print_BPF_PROG_TEST_RUN_attr): New functions. + (main) [HAVE_UNION_BPF_ATTR_TEST_DURATION]: Use them. + +2017-11-20 Dmitry V. Levin <ldv@altlinux.org> + + bpf: update BPF_MAP_CREATE decoding. + Implement decoding of union bpf_attr.numa_node field for BPF_MAP_CREATE + command introduced by linux kernel commit v4.14-rc1~130^2~196^2~1. + + * configure.ac: Check for numa_node member of union bpf_attr + instead of inner_map_fd. + (decode_BPF_MAP_CREATE): Add numa_node field to the structure, print it. + * NEWS: Mention this. + * tests/bpf.c: Update macro guards of BPF_MAP_CREATE decoder test. + (init_BPF_MAP_CREATE_first, print_BPF_MAP_CREATE_attr): Update expected + output. + (init_BPF_MAP_CREATE_attr): Initialize numa_node field, update offset. + +2017-11-20 Eugene Syromiatnikov <esyr@redhat.com> + + unwind.c: cleanup. + * unwind.c (rebuild_cache_if_invalid): Simplify return statement. + + unwind.c: fix typo in comment. + * unwind.c (unwind_cache_invalidate, unwind_print_stacktrace, + unwind_capture_stacktrace): Replace strack with stack. + +2017-11-18 Dmitry V. Levin <ldv@altlinux.org> + + ipc_shm: decode hugetlb page size in shmget flags. + Decode alternative hugetlb page sizes introduced by kernel commit + v3.8-rc1~175^2~36. + + * ipc_shm.c [!SHM_HUGE_SHIFT] (SHM_HUGE_SHIFT): New macro. + [!SHM_HUGE_MASK] (SHM_HUGE_MASK): Likewise. + (SYS_FUNC(shmget)): Print hugetlb page size. + * tests/ipc_shm.c: Check it. + +2017-11-18 Dmitry V. Levin <ldv@altlinux.org> + + memfd_create: decode hugetlb page size. + Decode alternative hugetlb page sizes introduced by kernel commit + v4.14-rc1~126^2~17. + + * configure.ac (AC_CHECK_HEADERS): Add linux/memfd.h. + * memfd_create.c [HAVE_LINUX_MEMFD_H]: Include it. + [!MFD_HUGE_SHIFT] (MFD_HUGE_SHIFT): New macro. + [!MFD_HUGE_MASK] (MFD_HUGE_MASK): Likewise. + (SYS_FUNC(memfd_create)): Print hugetlb page size. + * tests/memfd_create.c: Check it. + +2017-11-18 Dmitry V. Levin <ldv@altlinux.org> + + Print the first argument of memfd_create syscall as a path. + The limit imposed by the kernel on the length of memfd_create first + argument is NAME_MAX - strlen("memfd:"). + + * memfd_create.c (SYS_FUNC(memfd_create)): Print the first argument + using printpathn. + * tests/memfd_create.c: Check it. + +2017-11-17 Dmitry V. Levin <ldv@altlinux.org> + + mem: decode hugetlb page size in mmap flags. + Decode alternative hugetlb page sizes introduced by kernel commit + v3.8-rc1~175^2~36. + + * mem.c [!MAP_HUGE_SHIFT] (MAP_HUGE_SHIFT): New macro. + [!MAP_HUGE_MASK] (MAP_HUGE_MASK): Likewise. + (print_mmap_flags): Print hugetlb page size. + * NEWS: Mention it. + * tests/remap_file_pages.c: Check it. + +2017-11-17 Dmitry V. Levin <ldv@altlinux.org> + + mem: assume that MAP_TYPE is defined. + Since linux kernel provided a definition of MAP_TYPE in <asm/mman.h> + as long ago as in v2.4.0, it's safe to assume that MAP_TYPE is defined. + + * mem.c (print_mmap_flags) [!MAP_TYPE]: Remove. + +2017-11-17 Dmitry V. Levin <ldv@altlinux.org> + + mem: move printing of mmap_flags to a separate function. + * mem.c (print_mmap_flags): New function. + (print_mmap, SYS_FUNC(remap_file_pages)): Use it. + +2017-11-17 Dmitry V. Levin <ldv@altlinux.org> + + Provide fallback definitions for SHM_EXEC constant. + Although SHM_EXEC is available in <linux/shm.h> since kernel commit + v2.6.9-rc2~23^2~93^2~78, the glibc version of <sys/shm.h> did not + provide SHM_EXEC until commit glibc-2.10~238. + + * xlat/shm_flags.in (SHM_EXEC): Add fallback definition. + * tests/shmxt.c (SHM_EXEC): Likewise. + +2017-11-17 Dmitry V. Levin <ldv@altlinux.org> + + Update SHM_* constants. + * xlat/shm_flags.in: Add SHM_EXEC introduced by kernel commit + v2.6.9-rc2~23^2~93^2~78. + * xlat/shm_resource_flags.in: Add SHM_NORESERVE introduced by kernel + commit v2.6.15-rc1~622. + * NEWS: Mention this. + * tests/ipc_shm.c (main): Update expected output. + * tests/shmxt.c (main): Update expected output, check SHM_EXEC decoding. + +2017-11-17 Dmitry V. Levin <ldv@altlinux.org> + + Remove fallback definitions for SHM_STAT and SHM_INFO constants. + These constants are universally available for quite a long time + and are used unconditionally in tests without any complaints. + + * xlat/shmctl_flags.in: Remove fallback definitions. + +2017-11-16 Dmitry V. Levin <ldv@altlinux.org> + + net: fix SOL_NETLINK NETLINK_LIST_MEMBERSHIPS decoding. + NETLINK_LIST_MEMBERSHIPS, unlike all other SOL_NETLINK options, requests + not just a single integer but an array of integers. The kernel also + supports a zero optlen NETLINK_LIST_MEMBERSHIPS request. + + * net.c (print_uint32): New function. + (print_getsockopt): Add ulen argument, rename len argument to rlen, + <SOL_NETLINK> Handle NETLINK_LIST_MEMBERSHIPS using print_array + and print_uint32. + (SYS_FUNC(getsockopt)): Pass ulen to print_getsockopt. + * tests/sockopt-sol_netlink.c (main): Check NETLINK_LIST_MEMBERSHIPS + decoding. + +2017-11-16 Dmitry V. Levin <ldv@altlinux.org> + + tests: check [gs]etsockopt SOL_NETLINK decoding. + * tests/sockopt-sol_netlink.c: New file. + * tests/gen_tests.in (sockopt-sol_netlink): New entry. + * tests/pure_executables.list: Add sockopt-sol_netlink. + * tests/.gitignore: Likewise. + +2017-11-16 Dmitry V. Levin <ldv@altlinux.org> + + net: fix decoding of optval argument of [gs]etsockopt SOL_NETLINK. + Tweak the parser to follow the kernel behaviour. + + * net.c (print_getsockopt, print_setsockopt) <SOL_NETLINK>: Fetch and + print returned value as integer iff the length is >= sizeof(int), + otherwise print the address. + * NEWS: Mention this. + +2017-11-15 Dmitry V. Levin <ldv@altlinux.org> + + net: decode optname argument of [gs]etsockopt for SOL_NETLINK level. + * xlat/socknetlinkoptions.in: New file. + * net.c: Include "xlat/socknetlinkoptions.h". + (print_sockopt_fd_level_name) <SOL_NETLINK>: Print name using + socknetlinkoptions. + * NEWS: Metnion this. + + Update MSG_* constants. + * xlat/msg_flags.in: Add MSG_ZEROCOPY introduced by kernel commit + v4.14-rc1~130^2~376^2~6. + * NEWS: Mention this. + + netlink: print descriptor attributes using printfd. + * nlattr.h (DECL_NLA(fd)): New prototype. + * nlattr.c (decode_nla_fd): New function. + * rtnl_link.c (ifla_xdp_nla_decoders) <IFLA_XDP_FD>: Use it. + (ifinfomsg_nla_decoders) <IFLA_NET_NS_FD>: Likewise. + * rtnl_nsid.c (rtgenmsg_nla_decoders) <NETNSA_FD>: Likewise. + * NEWS: Mention this. + +2017-11-14 Eugene Syromyatnikov <evgsyr@gmail.com> + + maint/update_copyright_years.sh: implement concurrent execution. + Analogous to the way it is done in xlat/gen.sh. + + * maint/update_copyright_years.sh (MAX_JOBS): New variable, initialize + it to double the CPU count. + <while [ -n "${1:-}" ]; do case "$1" in>: Add -j option parsing. + (jobs, pids): New variables. + <git ls-files -- "$@" | grep -vFx "$IGNORED_FILES" | while read f; do>: + Execute process_file in background, count background jobs and wait + if there are too many. + +2017-11-14 Eugene Syromyatnikov <evgsyr@gmail.com> + + maint/update_copyright_years.sh: use -efu shell mode. + * maint/update_copyright_years.sh: Add -efu to shebang. Adjust + the script for -efu shell mode. + +2017-11-14 Dmitry V. Levin <ldv@altlinux.org> + + Post-release administrivia. + * NEWS: Add a header line for the next release. + * debian/changelog.in: Add a changelog entry for 4.20-1. + * strace.spec.in: Likewise. + 2017-11-13 Dmitry V. Levin <ldv@altlinux.org> Prepare for 4.20 release. diff --git a/Makefile.am b/Makefile.am index 3ea56a14..db9ad6e8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,7 +4,7 @@ # Copyright (c) 2006-2016 Dmitry V. Levin <ldv@altlinux.org> # Copyright (c) 2008-2015 Mike Frysinger <vapier@gentoo.org> # Copyright (c) 2015 Elvira Khabirova <lineprinter0@gmail.com> -# Copyright (c) 2002-2017 The strace developers. +# Copyright (c) 2002-2018 The strace developers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -38,13 +38,15 @@ endif SUBDIRS = . tests $(TESTS_M32) $(TESTS_MX32) bin_PROGRAMS = strace -man_MANS = strace.1 +man_MANS = strace.1 strace-log-merge.1 bin_SCRIPTS = strace-graph strace-log-merge OS = linux # ARCH is `i386', `m68k', `sparc', etc. ARCH = @arch@ +READELF = @READELF@ + ACLOCAL_AMFLAGS = -I m4 AM_CFLAGS = $(WARN_CFLAGS) AM_CPPFLAGS = -I$(builddir)/$(OS)/$(ARCH) \ @@ -68,8 +70,10 @@ noinst_LIBRARIES = libstrace.a libstrace_a_CPPFLAGS = $(strace_CPPFLAGS) libstrace_a_CFLAGS = $(strace_CFLAGS) libstrace_a_SOURCES = \ + fetch_indirect_syscall_args.c \ fstatfs.c \ fstatfs64.c \ + getpagesize.c \ ipc.c \ sigreturn.c \ socketcall.c \ @@ -86,6 +90,7 @@ strace_SOURCES = \ affinity.c \ aio.c \ alpha.c \ + arch_defs.h \ basic_filters.c \ bind.c \ bjm.c \ @@ -164,6 +169,8 @@ strace_SOURCES = \ kexec.c \ keyctl.c \ keyctl_kdf_params.h \ + kvm.c \ + largefile_wrappers.h \ ldt.c \ link.c \ linux/asm_stat.h \ @@ -248,6 +255,7 @@ strace_SOURCES = \ regs.h \ renameat.c \ resource.c \ + riscv.c \ rt_sigframe.c \ rt_sigreturn.c \ rtc.c \ @@ -264,6 +272,7 @@ strace_SOURCES = \ rtnl_rule.c \ rtnl_tc.c \ rtnl_tc_action.c \ + s390.c \ sched.c \ sched_attr.h \ scsi.c \ @@ -290,7 +299,6 @@ strace_SOURCES = \ strace.c \ string_to_uint.h \ string_to_uint.c \ - supported_personalities.h \ swapon.c \ syscall.c \ sysctl.c \ @@ -303,6 +311,7 @@ strace_SOURCES = \ term.c \ time.c \ times.c \ + trace_event.h \ truncate.c \ ubi.c \ ucopy.c \ @@ -323,6 +332,7 @@ strace_SOURCES = \ xlat.h \ xmalloc.c \ xmalloc.h \ + xstring.h \ # end of strace_SOURCES if USE_LIBUNWIND @@ -330,6 +340,11 @@ strace_SOURCES += unwind.c strace_CPPFLAGS += $(libunwind_CPPFLAGS) strace_LDFLAGS += $(libunwind_LDFLAGS) strace_LDADD += $(libunwind_LIBS) +if USE_DEMANGLE +strace_CPPFLAGS += $(libiberty_CPPFLAGS) +strace_LDFLAGS += $(libiberty_LDFLAGS) +strace_LDADD += $(libiberty_LIBS) +endif endif @CODE_COVERAGE_RULES@ @@ -376,23 +391,27 @@ EXTRA_DIST = \ linux/32/syscallent.h \ linux/64/ioctls_inc.h \ linux/64/syscallent.h \ + linux/aarch64/arch_defs_.h \ linux/aarch64/arch_regs.c \ linux/aarch64/arch_regs.h \ - linux/aarch64/arch_rt_sigframe.c\ + linux/aarch64/arch_rt_sigframe.c \ linux/aarch64/arch_sigreturn.c \ linux/aarch64/errnoent1.h \ linux/aarch64/get_error.c \ linux/aarch64/get_scno.c \ - linux/aarch64/get_syscall_args.c\ + linux/aarch64/get_syscall_args.c \ linux/aarch64/ioctls_arch0.h \ linux/aarch64/ioctls_arch1.h \ linux/aarch64/ioctls_inc0.h \ linux/aarch64/ioctls_inc1.h \ + linux/aarch64/nr_prefix.c \ linux/aarch64/set_error.c \ linux/aarch64/set_scno.c \ + linux/aarch64/shuffle_scno.c \ linux/aarch64/signalent1.h \ linux/aarch64/syscallent.h \ linux/aarch64/syscallent1.h \ + linux/alpha/arch_defs_.h \ linux/alpha/arch_getrval2.c \ linux/alpha/arch_regs.c \ linux/alpha/arch_regs.h \ @@ -402,7 +421,7 @@ EXTRA_DIST = \ linux/alpha/get_error.c \ linux/alpha/get_scno.c \ linux/alpha/get_syscall_args.c \ - linux/alpha/get_syscall_result.c\ + linux/alpha/get_syscall_result.c \ linux/alpha/ioctls_arch0.h \ linux/alpha/ioctls_inc0.h \ linux/alpha/set_error.c \ @@ -421,8 +440,11 @@ EXTRA_DIST = \ linux/arc/set_error.c \ linux/arc/set_scno.c \ linux/arc/syscallent.h \ + linux/arch_defs_.h \ + linux/arch_kvm.c \ linux/arch_regs.h \ linux/arch_sigreturn.c \ + linux/arm/arch_defs_.h \ linux/arm/arch_regs.c \ linux/arm/arch_regs.h \ linux/arm/arch_rt_sigframe.c \ @@ -432,8 +454,10 @@ EXTRA_DIST = \ linux/arm/get_syscall_args.c \ linux/arm/ioctls_arch0.h \ linux/arm/ioctls_inc0.h \ + linux/arm/nr_prefix.c \ linux/arm/set_error.c \ linux/arm/set_scno.c \ + linux/arm/shuffle_scno.c \ linux/arm/syscallent.h \ linux/arm/userent.h \ linux/avr32/arch_regs.c \ @@ -448,6 +472,7 @@ EXTRA_DIST = \ linux/avr32/set_scno.c \ linux/avr32/syscallent.h \ linux/avr32/userent.h \ + linux/bfin/arch_defs_.h \ linux/bfin/arch_regs.c \ linux/bfin/arch_rt_sigframe.c \ linux/bfin/get_error.c \ @@ -461,33 +486,10 @@ EXTRA_DIST = \ linux/bfin/set_scno.c \ linux/bfin/syscallent.h \ linux/bfin/userent.h \ - linux/crisv10/arch_regs.c \ - linux/crisv10/arch_rt_sigframe.c\ - linux/crisv10/arch_sigreturn.c \ - linux/crisv10/get_error.c \ - linux/crisv10/get_scno.c \ - linux/crisv10/get_syscall_args.c \ - linux/crisv10/get_syscall_result.c \ - linux/crisv10/rt_sigframe.h \ - linux/crisv10/set_error.c \ - linux/crisv10/set_scno.c \ - linux/crisv10/syscallent.h \ - linux/crisv10/userent.h \ - linux/crisv32/arch_regs.c \ - linux/crisv32/arch_rt_sigframe.c\ - linux/crisv32/arch_sigreturn.c \ - linux/crisv32/get_error.c \ - linux/crisv32/get_scno.c \ - linux/crisv32/get_syscall_args.c \ - linux/crisv32/get_syscall_result.c \ - linux/crisv32/rt_sigframe.h \ - linux/crisv32/set_error.c \ - linux/crisv32/set_scno.c \ - linux/crisv32/syscallent.h \ - linux/crisv32/userent.h \ linux/dummy.h \ linux/errnoent.h \ linux/getregs_old.h \ + linux/hppa/arch_defs_.h \ linux/hppa/arch_regs.c \ linux/hppa/arch_regs.h \ linux/hppa/arch_rt_sigframe.c \ @@ -503,6 +505,8 @@ EXTRA_DIST = \ linux/hppa/set_scno.c \ linux/hppa/signalent.h \ linux/hppa/syscallent.h \ + linux/i386/arch_kvm.c \ + linux/i386/arch_defs_.h \ linux/i386/arch_regs.c \ linux/i386/arch_regs.h \ linux/i386/arch_rt_sigframe.c \ @@ -518,6 +522,7 @@ EXTRA_DIST = \ linux/i386/syscallent.h \ linux/i386/userent.h \ linux/i386/userent0.h \ + linux/ia64/arch_defs_.h \ linux/ia64/arch_getrval2.c \ linux/ia64/arch_regs.c \ linux/ia64/arch_regs.h \ @@ -533,6 +538,7 @@ EXTRA_DIST = \ linux/ia64/syscallent.h \ linux/ia64/userent.h \ linux/inet_diag.h \ + linux/m68k/arch_defs_.h \ linux/m68k/arch_regs.c \ linux/m68k/arch_regs.h \ linux/m68k/arch_rt_sigframe.c \ @@ -558,8 +564,9 @@ EXTRA_DIST = \ linux/metag/set_error.c \ linux/metag/set_scno.c \ linux/metag/syscallent.h \ + linux/microblaze/arch_defs_.h \ linux/microblaze/arch_regs.c \ - linux/microblaze/arch_rt_sigframe.c\ + linux/microblaze/arch_rt_sigframe.c \ linux/microblaze/arch_sigreturn.c \ linux/microblaze/get_error.c \ linux/microblaze/get_scno.c \ @@ -571,6 +578,7 @@ EXTRA_DIST = \ linux/microblaze/set_scno.c \ linux/microblaze/syscallent.h \ linux/microblaze/userent.h \ + linux/mips/arch_defs_.h \ linux/mips/arch_getrval2.c \ linux/mips/arch_regs.c \ linux/mips/arch_regs.h \ @@ -593,8 +601,8 @@ EXTRA_DIST = \ linux/mips/syscallent-o32.h \ linux/mips/syscallent.h \ linux/mips/userent.h \ - linux/mtd-abi.h \ linux/netlink_diag.h \ + linux/nios2/arch_defs_.h \ linux/nios2/arch_regs.c \ linux/nios2/arch_regs.h \ linux/nios2/arch_rt_sigframe.c \ @@ -606,6 +614,7 @@ EXTRA_DIST = \ linux/nios2/set_error.c \ linux/nios2/set_scno.c \ linux/nios2/syscallent.h \ + linux/nr_prefix.c \ linux/or1k/arch_regs.c \ linux/or1k/arch_regs.h \ linux/or1k/arch_rt_sigframe.c \ @@ -619,10 +628,10 @@ EXTRA_DIST = \ linux/or1k/syscallent.h \ linux/or1k/userent.h \ linux/packet_diag.h \ - linux/personality.h \ + linux/powerpc/arch_defs_.h \ linux/powerpc/arch_regs.c \ linux/powerpc/arch_regs.h \ - linux/powerpc/arch_rt_sigframe.c\ + linux/powerpc/arch_rt_sigframe.c \ linux/powerpc/arch_sigreturn.c \ linux/powerpc/errnoent.h \ linux/powerpc/get_error.c \ @@ -636,9 +645,10 @@ EXTRA_DIST = \ linux/powerpc/set_scno.c \ linux/powerpc/syscallent.h \ linux/powerpc/userent.h \ + linux/powerpc64/arch_defs_.h \ linux/powerpc64/arch_regs.c \ linux/powerpc64/arch_regs.h \ - linux/powerpc64/arch_rt_sigframe.c\ + linux/powerpc64/arch_rt_sigframe.c \ linux/powerpc64/arch_sigreturn.c \ linux/powerpc64/errnoent.h \ linux/powerpc64/errnoent1.h \ @@ -658,7 +668,7 @@ EXTRA_DIST = \ linux/powerpc64/syscallent.h \ linux/powerpc64/syscallent1.h \ linux/powerpc64/userent.h \ - linux/ptp_clock.h \ + linux/riscv/arch_defs_.h \ linux/riscv/arch_regs.c \ linux/riscv/arch_regs.h \ linux/riscv/arch_rt_sigframe.c \ @@ -676,6 +686,7 @@ EXTRA_DIST = \ linux/riscv/syscallent.h \ linux/riscv/syscallent1.h \ linux/rt_sigframe.h \ + linux/s390/arch_defs_.h \ linux/s390/arch_regs.c \ linux/s390/arch_regs.h \ linux/s390/arch_rt_sigframe.c \ @@ -692,20 +703,27 @@ EXTRA_DIST = \ linux/s390/userent.h \ linux/s390/userent0.h \ linux/s390/userent1.h \ + linux/s390x/arch_defs_.h \ linux/s390x/arch_regs.c \ linux/s390x/arch_regs.h \ linux/s390x/arch_rt_sigframe.c \ linux/s390x/arch_sigreturn.c \ + linux/s390x/errnoent1.h \ linux/s390x/get_error.c \ linux/s390x/get_scno.c \ linux/s390x/get_syscall_args.c \ linux/s390x/ioctls_arch0.h \ + linux/s390x/ioctls_arch1.h \ linux/s390x/ioctls_inc0.h \ + linux/s390x/ioctls_inc1.h \ linux/s390x/rt_sigframe.h \ linux/s390x/set_error.c \ linux/s390x/set_scno.c \ + linux/s390x/signalent1.h \ linux/s390x/syscallent.h \ + linux/s390x/syscallent1.h \ linux/s390x/userent.h \ + linux/sh/arch_defs_.h \ linux/sh/arch_getrval2.c \ linux/sh/arch_regs.c \ linux/sh/arch_rt_sigframe.c \ @@ -720,6 +738,7 @@ EXTRA_DIST = \ linux/sh/syscallent.h \ linux/sh/userent.h \ linux/sh/userent0.h \ + linux/sh64/arch_defs_.h \ linux/sh64/arch_regs.c \ linux/sh64/arch_regs.h \ linux/sh64/arch_rt_sigframe.c \ @@ -734,16 +753,17 @@ EXTRA_DIST = \ linux/sh64/set_scno.c \ linux/sh64/syscallent.h \ linux/sh64/userent.h \ + linux/shuffle_scno.c \ linux/signalent.h \ linux/smc_diag.h \ linux/sock_diag.h \ + linux/sparc/arch_defs_.h \ linux/sparc/arch_getrval2.c \ linux/sparc/arch_regs.c \ linux/sparc/arch_regs.h \ linux/sparc/arch_rt_sigframe.c \ linux/sparc/arch_sigreturn.c \ linux/sparc/errnoent.h \ - linux/sparc/gen.pl \ linux/sparc/get_error.c \ linux/sparc/get_scno.c \ linux/sparc/get_syscall_args.c \ @@ -755,16 +775,17 @@ EXTRA_DIST = \ linux/sparc/signalent.h \ linux/sparc/syscallent.h \ linux/sparc/userent.h \ + linux/sparc64/arch_defs_.h \ linux/sparc64/arch_getrval2.c \ linux/sparc64/arch_regs.c \ linux/sparc64/arch_regs.h \ - linux/sparc64/arch_rt_sigframe.c\ + linux/sparc64/arch_rt_sigframe.c \ linux/sparc64/arch_sigreturn.c \ linux/sparc64/errnoent.h \ linux/sparc64/errnoent1.h \ linux/sparc64/get_error.c \ linux/sparc64/get_scno.c \ - linux/sparc64/get_syscall_args.c\ + linux/sparc64/get_syscall_args.c \ linux/sparc64/ioctls_arch0.h \ linux/sparc64/ioctls_arch1.h \ linux/sparc64/ioctls_inc0.h \ @@ -779,6 +800,7 @@ EXTRA_DIST = \ linux/sparc64/userent.h \ linux/subcall.h \ linux/syscall.h \ + linux/tile/arch_defs_.h \ linux/tile/arch_regs.c \ linux/tile/arch_regs.h \ linux/tile/arch_rt_sigframe.c \ @@ -798,10 +820,11 @@ EXTRA_DIST = \ linux/tile/syscallent.h \ linux/tile/syscallent1.h \ linux/tile/userent.h \ - linux/ubi-user.h \ linux/unix_diag.h \ linux/userent.h \ linux/userent0.h \ + linux/x32/arch_defs_.h \ + linux/x32/arch_kvm.c \ linux/x32/arch_regs.c \ linux/x32/arch_regs.h \ linux/x32/arch_rt_sigframe.c \ @@ -817,17 +840,19 @@ EXTRA_DIST = \ linux/x32/rt_sigframe.h \ linux/x32/set_error.c \ linux/x32/set_scno.c \ + linux/x32/shuffle_scno.c \ linux/x32/signalent1.h \ linux/x32/syscallent.h \ linux/x32/syscallent1.h \ linux/x32/userent.h \ + linux/x86_64/arch_defs_.h \ + linux/x86_64/arch_kvm.c \ linux/x86_64/arch_regs.c \ linux/x86_64/arch_regs.h \ linux/x86_64/arch_rt_sigframe.c \ linux/x86_64/arch_sigreturn.c \ linux/x86_64/errnoent1.h \ linux/x86_64/errnoent2.h \ - linux/x86_64/gentab.pl \ linux/x86_64/get_error.c \ linux/x86_64/get_scno.c \ linux/x86_64/get_syscall_args.c \ @@ -842,6 +867,7 @@ EXTRA_DIST = \ linux/x86_64/rt_sigframe.h \ linux/x86_64/set_error.c \ linux/x86_64/set_scno.c \ + linux/x86_64/shuffle_scno.c \ linux/x86_64/signalent1.h \ linux/x86_64/signalent2.h \ linux/x86_64/syscallent.h \ @@ -871,7 +897,7 @@ EXTRA_DIST = \ $(XLAT_INPUT_FILES) \ $(XLAT_HEADER_FILES) \ xlat/gen.sh \ - xlate.el + # end of EXTRA_DIST .PHONY: check-valgrind-local check-valgrind-local: @@ -987,9 +1013,12 @@ libmpers_CFLAGS = $(strace_CFLAGS) mpers-m%.stamp: $(srcdir_mpers_source_files) | printers.h for f in $^; do \ - CC="$(CC)" CFLAGS="$(mpers_sh_opts) -DMPERS_IS_$(mpers_NAME)" \ - CPP="$(CPP)" CPPFLAGS="$(mpers_sh_opts) -DIN_MPERS -DMPERS_IS_$(mpers_NAME)" \ - $(srcdir)/mpers.sh -$(mpers_NAME) $$f || exit; \ + READELF="$(READELF)" \ + CC="$(CC)" \ + CFLAGS="$(mpers_sh_opts) -DMPERS_IS_$(mpers_NAME)" \ + CPP="$(CPP)" \ + CPPFLAGS="$(mpers_sh_opts) -DIN_MPERS -DMPERS_IS_$(mpers_NAME)" \ + $(srcdir)/mpers.sh $(mpers_NAME) $(mpers_CC_FLAGS) $$f || exit; \ done > $@ @@ -1060,6 +1089,7 @@ BUILT_SOURCES += $(mpers_m32_targets) CLEANFILES += $(mpers_m32_targets) $(mpers_m32_targets): mpers_NAME = m32 +$(mpers_m32_targets): mpers_CC_FLAGS = @cc_flags_m32@ endif # HAVE_M32_MPERS @@ -1076,6 +1106,7 @@ BUILT_SOURCES += $(mpers_mx32_targets) CLEANFILES += $(mpers_mx32_targets) $(mpers_mx32_targets): mpers_NAME = mx32 +$(mpers_mx32_targets): mpers_CC_FLAGS = @cc_flags_mx32@ endif # HAVE_MX32_MPERS diff --git a/Makefile.in b/Makefile.in index 2f14f434..f1822adb 100644 --- a/Makefile.in +++ b/Makefile.in @@ -20,7 +20,7 @@ # Copyright (c) 2006-2016 Dmitry V. Levin <ldv@altlinux.org> # Copyright (c) 2008-2015 Mike Frysinger <vapier@gentoo.org> # Copyright (c) 2015 Elvira Khabirova <lineprinter0@gmail.com> -# Copyright (c) 2002-2017 The strace developers. +# Copyright (c) 2002-2018 The strace developers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -143,27 +143,31 @@ DIST_COMMON = $(srcdir)/xlat/Makemodule.am $(srcdir)/scno.am \ $(srcdir)/mpers.am $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/configure $(am__configure_deps) \ $(srcdir)/config.h.in $(srcdir)/strace.1.in \ - $(srcdir)/strace.spec.in $(top_srcdir)/debian/changelog.in \ - depcomp AUTHORS COPYING INSTALL NEWS README compile \ - config.guess config.sub install-sh missing + $(srcdir)/strace-log-merge.1.in $(srcdir)/strace.spec.in \ + $(top_srcdir)/debian/changelog.in depcomp AUTHORS COPYING \ + INSTALL NEWS README compile config.guess config.sub install-sh \ + missing @USE_LIBUNWIND_TRUE@am__append_1 = unwind.c @USE_LIBUNWIND_TRUE@am__append_2 = $(libunwind_CPPFLAGS) @USE_LIBUNWIND_TRUE@am__append_3 = $(libunwind_LDFLAGS) @USE_LIBUNWIND_TRUE@am__append_4 = $(libunwind_LIBS) -@HAVE_M32_MPERS_TRUE@am__append_5 = libmpers-m32.a -@HAVE_M32_MPERS_TRUE@am__append_6 = libmpers-m32.a -@HAVE_M32_MPERS_TRUE@am__append_7 = $(mpers_m32_targets) -@HAVE_M32_MPERS_TRUE@am__append_8 = $(mpers_m32_targets) -@HAVE_MX32_MPERS_TRUE@am__append_9 = libmpers-mx32.a -@HAVE_MX32_MPERS_TRUE@am__append_10 = libmpers-mx32.a -@HAVE_MX32_MPERS_TRUE@am__append_11 = $(mpers_mx32_targets) -@HAVE_MX32_MPERS_TRUE@am__append_12 = $(mpers_mx32_targets) +@USE_DEMANGLE_TRUE@@USE_LIBUNWIND_TRUE@am__append_5 = $(libiberty_CPPFLAGS) +@USE_DEMANGLE_TRUE@@USE_LIBUNWIND_TRUE@am__append_6 = $(libiberty_LDFLAGS) +@USE_DEMANGLE_TRUE@@USE_LIBUNWIND_TRUE@am__append_7 = $(libiberty_LIBS) +@HAVE_M32_MPERS_TRUE@am__append_8 = libmpers-m32.a +@HAVE_M32_MPERS_TRUE@am__append_9 = libmpers-m32.a +@HAVE_M32_MPERS_TRUE@am__append_10 = $(mpers_m32_targets) +@HAVE_M32_MPERS_TRUE@am__append_11 = $(mpers_m32_targets) +@HAVE_MX32_MPERS_TRUE@am__append_12 = libmpers-mx32.a +@HAVE_MX32_MPERS_TRUE@am__append_13 = libmpers-mx32.a +@HAVE_MX32_MPERS_TRUE@am__append_14 = $(mpers_mx32_targets) +@HAVE_MX32_MPERS_TRUE@am__append_15 = $(mpers_mx32_targets) subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_prog_cc_for_build.m4 \ $(top_srcdir)/m4/ax_valgrind_check.m4 \ - $(top_srcdir)/m4/mpers.m4 $(top_srcdir)/m4/st_bpf.m4 \ + $(top_srcdir)/m4/mpers.m4 \ $(top_srcdir)/m4/st_save_restore_var.m4 \ $(top_srcdir)/m4/st_warn_cflags.m4 \ $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/configure.ac @@ -173,7 +177,8 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = strace.1 strace.spec debian/changelog +CONFIG_CLEAN_FILES = strace.1 strace-log-merge.1 strace.spec \ + debian/changelog CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar @@ -282,8 +287,10 @@ am__objects_2 = libmpers_mx32_a-block.$(OBJEXT) \ libmpers_mx32_a_OBJECTS = $(am_libmpers_mx32_a_OBJECTS) libstrace_a_AR = $(AR) $(ARFLAGS) libstrace_a_LIBADD = -am_libstrace_a_OBJECTS = libstrace_a-fstatfs.$(OBJEXT) \ - libstrace_a-fstatfs64.$(OBJEXT) libstrace_a-ipc.$(OBJEXT) \ +am_libstrace_a_OBJECTS = \ + libstrace_a-fetch_indirect_syscall_args.$(OBJEXT) \ + libstrace_a-fstatfs.$(OBJEXT) libstrace_a-fstatfs64.$(OBJEXT) \ + libstrace_a-getpagesize.$(OBJEXT) libstrace_a-ipc.$(OBJEXT) \ libstrace_a-sigreturn.$(OBJEXT) \ libstrace_a-socketcall.$(OBJEXT) libstrace_a-statfs.$(OBJEXT) \ libstrace_a-statfs64.$(OBJEXT) \ @@ -295,8 +302,8 @@ am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" \ "$(DESTDIR)$(man1dir)" PROGRAMS = $(bin_PROGRAMS) am__strace_SOURCES_DIST = access.c affinity.c aio.c alpha.c \ - basic_filters.c bind.c bjm.c block.c bpf.c bpf_filter.c \ - bpf_filter.h bpf_fprog.h bpf_seccomp_filter.c \ + arch_defs.h basic_filters.c bind.c bjm.c block.c bpf.c \ + bpf_filter.c bpf_filter.h bpf_fprog.h bpf_seccomp_filter.c \ bpf_sock_filter.c btrfs.c cacheflush.c capability.c caps0.h \ caps1.h chdir.c chmod.c clone.c copy_file_range.c count.c \ defs.h desc.c dirent.c dirent64.c dm.c dyxlat.c empty.h \ @@ -311,40 +318,41 @@ am__strace_SOURCES_DIST = access.c affinity.c aio.c alpha.c \ getcwd.c getrandom.c hdio.c hostname.c inotify.c io.c ioctl.c \ ioperm.c iopl.c ioprio.c ipc_defs.h ipc_msg.c ipc_msgctl.c \ ipc_sem.c ipc_shm.c ipc_shmctl.c kcmp.c kernel_types.h kexec.c \ - keyctl.c keyctl_kdf_params.h ldt.c link.c linux/asm_stat.h \ - linux/x32/asm_stat.h linux/x86_64/asm_stat.h listen.c \ - lookup_dcookie.c loop.c lseek.c macros.h mem.c membarrier.c \ - memfd_create.c mknod.c mmsghdr.c mount.c mpers_type.h mq.c \ - msghdr.c msghdr.h mtd.c native_defs.h negated_errno.h net.c \ - netlink.c netlink.h netlink_crypto.c netlink_sock_diag.h \ - netlink_inet_diag.c netlink_netlink_diag.c \ - netlink_packet_diag.c netlink_route.c netlink_route.h \ - netlink_selinux.c netlink_smc_diag.c netlink_sock_diag.c \ - netlink_unix_diag.c nlattr.c nlattr.h nsfs.c nsfs.h nsig.h \ - numa.c number_set.c number_set.h oldstat.c open.c \ - or1k_atomic.c pathtrace.c perf.c perf_event_struct.h \ - personality.c pkeys.c poll.c prctl.c print_dev_t.c \ - print_group_req.c print_fields.h print_ifindex.c \ + keyctl.c keyctl_kdf_params.h kvm.c largefile_wrappers.h ldt.c \ + link.c linux/asm_stat.h linux/x32/asm_stat.h \ + linux/x86_64/asm_stat.h listen.c lookup_dcookie.c loop.c \ + lseek.c macros.h mem.c membarrier.c memfd_create.c mknod.c \ + mmsghdr.c mount.c mpers_type.h mq.c msghdr.c msghdr.h mtd.c \ + native_defs.h negated_errno.h net.c netlink.c netlink.h \ + netlink_crypto.c netlink_sock_diag.h netlink_inet_diag.c \ + netlink_netlink_diag.c netlink_packet_diag.c netlink_route.c \ + netlink_route.h netlink_selinux.c netlink_smc_diag.c \ + netlink_sock_diag.c netlink_unix_diag.c nlattr.c nlattr.h \ + nsfs.c nsfs.h nsig.h numa.c number_set.c number_set.h \ + oldstat.c open.c or1k_atomic.c pathtrace.c perf.c \ + perf_event_struct.h personality.c pkeys.c poll.c prctl.c \ + print_dev_t.c print_group_req.c print_fields.h print_ifindex.c \ print_mq_attr.c print_msgbuf.c print_sg_req_info.c \ print_sigevent.c print_statfs.c print_struct_stat.c \ print_time.c print_timespec.c print_timeval.c print_timex.c \ printmode.c printrusage.c printsiginfo.c printsiginfo.h \ process.c process_vm.c ptp.c ptrace.h quota.c readahead.c \ - readlink.c reboot.c regs.h renameat.c resource.c rt_sigframe.c \ - rt_sigreturn.c rtc.c rtnl_addr.c rtnl_addrlabel.c rtnl_dcb.c \ - rtnl_link.c rtnl_mdb.c rtnl_neigh.c rtnl_neightbl.c \ - rtnl_netconf.c rtnl_nsid.c rtnl_route.c rtnl_rule.c rtnl_tc.c \ - rtnl_tc_action.c sched.c sched_attr.h scsi.c seccomp.c \ - sendfile.c sg_io_v3.c sg_io_v4.c shutdown.c sigaltstack.c \ - sigevent.h signal.c signalfd.c sock.c sockaddr.c socketutils.c \ - sram_alloc.c stat.c stat.h stat64.c statfs.c statfs.h statx.c \ - statx.h strace.c string_to_uint.h string_to_uint.c \ - supported_personalities.h swapon.c syscall.c sysctl.c sysent.h \ - sysent_shorthand_defs.h sysent_shorthand_undefs.h sysinfo.c \ - syslog.c sysmips.c term.c time.c times.c truncate.c ubi.c \ - ucopy.c uid.c uid16.c umask.c umount.c uname.c userfaultfd.c \ - ustat.c util.c utime.c utimes.c v4l2.c wait.c xattr.c xlat.c \ - xlat.h xmalloc.c xmalloc.h unwind.c + readlink.c reboot.c regs.h renameat.c resource.c riscv.c \ + rt_sigframe.c rt_sigreturn.c rtc.c rtnl_addr.c \ + rtnl_addrlabel.c rtnl_dcb.c rtnl_link.c rtnl_mdb.c \ + rtnl_neigh.c rtnl_neightbl.c rtnl_netconf.c rtnl_nsid.c \ + rtnl_route.c rtnl_rule.c rtnl_tc.c rtnl_tc_action.c s390.c \ + sched.c sched_attr.h scsi.c seccomp.c sendfile.c sg_io_v3.c \ + sg_io_v4.c shutdown.c sigaltstack.c sigevent.h signal.c \ + signalfd.c sock.c sockaddr.c socketutils.c sram_alloc.c stat.c \ + stat.h stat64.c statfs.c statfs.h statx.c statx.h strace.c \ + string_to_uint.h string_to_uint.c swapon.c syscall.c sysctl.c \ + sysent.h sysent_shorthand_defs.h sysent_shorthand_undefs.h \ + sysinfo.c syslog.c sysmips.c term.c time.c times.c \ + trace_event.h truncate.c ubi.c ucopy.c uid.c uid16.c umask.c \ + umount.c uname.c userfaultfd.c ustat.c util.c utime.c utimes.c \ + v4l2.c wait.c xattr.c xlat.c xlat.h xmalloc.c xmalloc.h \ + xstring.h unwind.c @USE_LIBUNWIND_TRUE@am__objects_3 = strace-unwind.$(OBJEXT) am_strace_OBJECTS = strace-access.$(OBJEXT) strace-affinity.$(OBJEXT) \ strace-aio.$(OBJEXT) strace-alpha.$(OBJEXT) \ @@ -385,15 +393,16 @@ am_strace_OBJECTS = strace-access.$(OBJEXT) strace-affinity.$(OBJEXT) \ strace-ipc_sem.$(OBJEXT) strace-ipc_shm.$(OBJEXT) \ strace-ipc_shmctl.$(OBJEXT) strace-kcmp.$(OBJEXT) \ strace-kexec.$(OBJEXT) strace-keyctl.$(OBJEXT) \ - strace-ldt.$(OBJEXT) strace-link.$(OBJEXT) \ - strace-listen.$(OBJEXT) strace-lookup_dcookie.$(OBJEXT) \ - strace-loop.$(OBJEXT) strace-lseek.$(OBJEXT) \ - strace-mem.$(OBJEXT) strace-membarrier.$(OBJEXT) \ - strace-memfd_create.$(OBJEXT) strace-mknod.$(OBJEXT) \ - strace-mmsghdr.$(OBJEXT) strace-mount.$(OBJEXT) \ - strace-mq.$(OBJEXT) strace-msghdr.$(OBJEXT) \ - strace-mtd.$(OBJEXT) strace-net.$(OBJEXT) \ - strace-netlink.$(OBJEXT) strace-netlink_crypto.$(OBJEXT) \ + strace-kvm.$(OBJEXT) strace-ldt.$(OBJEXT) \ + strace-link.$(OBJEXT) strace-listen.$(OBJEXT) \ + strace-lookup_dcookie.$(OBJEXT) strace-loop.$(OBJEXT) \ + strace-lseek.$(OBJEXT) strace-mem.$(OBJEXT) \ + strace-membarrier.$(OBJEXT) strace-memfd_create.$(OBJEXT) \ + strace-mknod.$(OBJEXT) strace-mmsghdr.$(OBJEXT) \ + strace-mount.$(OBJEXT) strace-mq.$(OBJEXT) \ + strace-msghdr.$(OBJEXT) strace-mtd.$(OBJEXT) \ + strace-net.$(OBJEXT) strace-netlink.$(OBJEXT) \ + strace-netlink_crypto.$(OBJEXT) \ strace-netlink_inet_diag.$(OBJEXT) \ strace-netlink_netlink_diag.$(OBJEXT) \ strace-netlink_packet_diag.$(OBJEXT) \ @@ -421,15 +430,16 @@ am_strace_OBJECTS = strace-access.$(OBJEXT) strace-affinity.$(OBJEXT) \ strace-ptp.$(OBJEXT) strace-quota.$(OBJEXT) \ strace-readahead.$(OBJEXT) strace-readlink.$(OBJEXT) \ strace-reboot.$(OBJEXT) strace-renameat.$(OBJEXT) \ - strace-resource.$(OBJEXT) strace-rt_sigframe.$(OBJEXT) \ - strace-rt_sigreturn.$(OBJEXT) strace-rtc.$(OBJEXT) \ - strace-rtnl_addr.$(OBJEXT) strace-rtnl_addrlabel.$(OBJEXT) \ - strace-rtnl_dcb.$(OBJEXT) strace-rtnl_link.$(OBJEXT) \ - strace-rtnl_mdb.$(OBJEXT) strace-rtnl_neigh.$(OBJEXT) \ - strace-rtnl_neightbl.$(OBJEXT) strace-rtnl_netconf.$(OBJEXT) \ - strace-rtnl_nsid.$(OBJEXT) strace-rtnl_route.$(OBJEXT) \ - strace-rtnl_rule.$(OBJEXT) strace-rtnl_tc.$(OBJEXT) \ - strace-rtnl_tc_action.$(OBJEXT) strace-sched.$(OBJEXT) \ + strace-resource.$(OBJEXT) strace-riscv.$(OBJEXT) \ + strace-rt_sigframe.$(OBJEXT) strace-rt_sigreturn.$(OBJEXT) \ + strace-rtc.$(OBJEXT) strace-rtnl_addr.$(OBJEXT) \ + strace-rtnl_addrlabel.$(OBJEXT) strace-rtnl_dcb.$(OBJEXT) \ + strace-rtnl_link.$(OBJEXT) strace-rtnl_mdb.$(OBJEXT) \ + strace-rtnl_neigh.$(OBJEXT) strace-rtnl_neightbl.$(OBJEXT) \ + strace-rtnl_netconf.$(OBJEXT) strace-rtnl_nsid.$(OBJEXT) \ + strace-rtnl_route.$(OBJEXT) strace-rtnl_rule.$(OBJEXT) \ + strace-rtnl_tc.$(OBJEXT) strace-rtnl_tc_action.$(OBJEXT) \ + strace-s390.$(OBJEXT) strace-sched.$(OBJEXT) \ strace-scsi.$(OBJEXT) strace-seccomp.$(OBJEXT) \ strace-sendfile.$(OBJEXT) strace-sg_io_v3.$(OBJEXT) \ strace-sg_io_v4.$(OBJEXT) strace-shutdown.$(OBJEXT) \ @@ -457,8 +467,11 @@ am_strace_OBJECTS = strace-access.$(OBJEXT) strace-affinity.$(OBJEXT) \ strace_OBJECTS = $(am_strace_OBJECTS) am__DEPENDENCIES_1 = @USE_LIBUNWIND_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) +@USE_DEMANGLE_TRUE@@USE_LIBUNWIND_TRUE@am__DEPENDENCIES_3 = \ +@USE_DEMANGLE_TRUE@@USE_LIBUNWIND_TRUE@ $(am__DEPENDENCIES_1) strace_DEPENDENCIES = libstrace.a $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_1) $(am__append_5) $(am__append_9) + $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_1) $(am__append_8) \ + $(am__append_12) strace_LINK = $(CCLD) $(strace_CFLAGS) $(CFLAGS) $(strace_LDFLAGS) \ $(LDFLAGS) -o $@ am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; @@ -686,10 +699,13 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ RANLIB = @RANLIB@ +READELF = @READELF@ RPM_CHANGELOGTIME = @RPM_CHANGELOGTIME@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SIZEOF_KERNEL_LONG_T = @SIZEOF_KERNEL_LONG_T@ +SIZEOF_LONG = @SIZEOF_LONG@ STRIP = @STRIP@ VALGRIND = @VALGRIND@ VALGRIND_ENABLED = @VALGRIND_ENABLED@ @@ -710,6 +726,7 @@ am__untar = @am__untar@ arch = @arch@ arch_m32 = @arch_m32@ arch_mx32 = @arch_mx32@ +arch_native = @arch_native@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -717,6 +734,8 @@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ +cc_flags_m32 = @cc_flags_m32@ +cc_flags_mx32 = @cc_flags_mx32@ datadir = @datadir@ datarootdir = @datarootdir@ dl_LIBS = @dl_LIBS@ @@ -734,6 +753,9 @@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +libiberty_CPPFLAGS = @libiberty_CPPFLAGS@ +libiberty_LDFLAGS = @libiberty_LDFLAGS@ +libiberty_LIBS = @libiberty_LIBS@ libunwind_CPPFLAGS = @libunwind_CPPFLAGS@ libunwind_LDFLAGS = @libunwind_LDFLAGS@ libunwind_LIBS = @libunwind_LIBS@ @@ -759,7 +781,7 @@ valgrind_tools = @valgrind_tools@ @HAVE_M32_RUNTIME_TRUE@TESTS_M32 = tests-m32 @HAVE_MX32_RUNTIME_TRUE@TESTS_MX32 = tests-mx32 SUBDIRS = . tests $(TESTS_M32) $(TESTS_MX32) -man_MANS = strace.1 +man_MANS = strace.1 strace-log-merge.1 bin_SCRIPTS = strace-graph strace-log-merge OS = linux # ARCH is `i386', `m68k', `sparc', etc. @@ -841,7 +863,8 @@ XLAT_INPUT_FILES = xlat/access_flags.in xlat/addrfams.in \ xlat/kcmp_types.in xlat/kexec_arch_values.in \ xlat/kexec_file_load_flags.in xlat/kexec_load_flags.in \ xlat/key_perms.in xlat/key_reqkeys.in xlat/key_spec.in \ - xlat/keyctl_commands.in xlat/lockfcmds.in xlat/loop_cmds.in \ + xlat/keyctl_commands.in xlat/kvm_mem_flags.in \ + xlat/lockfcmds.in xlat/loop_cmds.in \ xlat/loop_crypt_type_options.in xlat/loop_flags_options.in \ xlat/lwtunnel_encap_types.in xlat/madvise_cmds.in \ xlat/mbindflags.in xlat/mctl_sync.in xlat/mdb_flags.in \ @@ -894,15 +917,16 @@ XLAT_INPUT_FILES = xlat/access_flags.in xlat/addrfams.in \ xlat/ptrace_setoptions_flags.in xlat/quota_formats.in \ xlat/quotacmds.in xlat/quotatypes.in xlat/rename_flags.in \ xlat/resource_flags.in xlat/resources.in \ - xlat/route_nexthop_flags.in xlat/routing_flags.in \ - xlat/routing_protocols.in xlat/routing_scopes.in \ - xlat/routing_table_ids.in xlat/routing_types.in \ - xlat/rtnl_addr_attrs.in xlat/rtnl_addrlabel_attrs.in \ - xlat/rtnl_dcb_attrs.in xlat/rtnl_ifla_brport_attrs.in \ - xlat/rtnl_ifla_info_attrs.in xlat/rtnl_ifla_port_attrs.in \ - xlat/rtnl_ifla_vf_port_attrs.in xlat/rtnl_ifla_xdp_attrs.in \ - xlat/rtnl_link_attrs.in xlat/rtnl_mdb_attrs.in \ - xlat/rtnl_mdba_mdb_attrs.in xlat/rtnl_mdba_mdb_eattr_attrs.in \ + xlat/riscv_flush_icache_flags.in xlat/route_nexthop_flags.in \ + xlat/routing_flags.in xlat/routing_protocols.in \ + xlat/routing_scopes.in xlat/routing_table_ids.in \ + xlat/routing_types.in xlat/rtnl_addr_attrs.in \ + xlat/rtnl_addrlabel_attrs.in xlat/rtnl_dcb_attrs.in \ + xlat/rtnl_ifla_brport_attrs.in xlat/rtnl_ifla_info_attrs.in \ + xlat/rtnl_ifla_port_attrs.in xlat/rtnl_ifla_vf_port_attrs.in \ + xlat/rtnl_ifla_xdp_attrs.in xlat/rtnl_link_attrs.in \ + xlat/rtnl_mdb_attrs.in xlat/rtnl_mdba_mdb_attrs.in \ + xlat/rtnl_mdba_mdb_eattr_attrs.in \ xlat/rtnl_mdba_mdb_entry_attrs.in \ xlat/rtnl_mdba_router_attrs.in \ xlat/rtnl_mdba_router_pattr_attrs.in xlat/rtnl_neigh_attrs.in \ @@ -912,12 +936,14 @@ XLAT_INPUT_FILES = xlat/access_flags.in xlat/addrfams.in \ xlat/rtnl_rule_attrs.in xlat/rtnl_tc_action_attrs.in \ xlat/rtnl_tc_attrs.in xlat/rtnl_tca_stab_attrs.in \ xlat/rtnl_tca_stats_attrs.in xlat/rwf_flags.in \ - xlat/sa_handler_values.in xlat/sched_flags.in \ - xlat/schedulers.in xlat/scmvals.in xlat/scsi_sg_commands.in \ - xlat/secbits.in xlat/seccomp_filter_flags.in \ - xlat/seccomp_mode.in xlat/seccomp_ops.in \ - xlat/seccomp_ret_action.in xlat/semctl_flags.in \ - xlat/semop_flags.in xlat/setns_types.in \ + xlat/s390_guarded_storage_commands.in \ + xlat/s390_runtime_instr_commands.in \ + xlat/s390_sthyi_function_codes.in xlat/sa_handler_values.in \ + xlat/sched_flags.in xlat/schedulers.in xlat/scmvals.in \ + xlat/scsi_sg_commands.in xlat/secbits.in \ + xlat/seccomp_filter_flags.in xlat/seccomp_mode.in \ + xlat/seccomp_ops.in xlat/seccomp_ret_action.in \ + xlat/semctl_flags.in xlat/semop_flags.in xlat/setns_types.in \ xlat/setsockipoptions.in xlat/setsockipv6options.in \ xlat/sfd_flags.in xlat/sg_io_dxfer_direction.in \ xlat/sg_io_flags.in xlat/sg_io_info.in xlat/sg_scsi_reset.in \ @@ -935,9 +961,10 @@ XLAT_INPUT_FILES = xlat/access_flags.in xlat/addrfams.in \ xlat/sock_type_flags.in xlat/socketcalls.in \ xlat/socketlayers.in xlat/sockipoptions.in \ xlat/sockipv6options.in xlat/sockipxoptions.in \ - xlat/sockoptions.in xlat/sockpacketoptions.in \ - xlat/sockrawoptions.in xlat/socksctpoptions.in \ - xlat/socktcpoptions.in xlat/socktypes.in xlat/splice_flags.in \ + xlat/socknetlinkoptions.in xlat/sockoptions.in \ + xlat/sockpacketoptions.in xlat/sockrawoptions.in \ + xlat/socksctpoptions.in xlat/socktcpoptions.in \ + xlat/socktypes.in xlat/splice_flags.in \ xlat/sram_alloc_flags.in xlat/statfs_flags.in \ xlat/statx_attrs.in xlat/statx_masks.in xlat/swap_flags.in \ xlat/sync_file_range_flags.in xlat/sysctl_kern.in \ @@ -1032,11 +1059,11 @@ XLAT_HEADER_FILES = xlat/access_flags.h xlat/addrfams.h \ xlat/kcmp_types.h xlat/kexec_arch_values.h \ xlat/kexec_file_load_flags.h xlat/kexec_load_flags.h \ xlat/key_perms.h xlat/key_reqkeys.h xlat/key_spec.h \ - xlat/keyctl_commands.h xlat/lockfcmds.h xlat/loop_cmds.h \ - xlat/loop_crypt_type_options.h xlat/loop_flags_options.h \ - xlat/lwtunnel_encap_types.h xlat/madvise_cmds.h \ - xlat/mbindflags.h xlat/mctl_sync.h xlat/mdb_flags.h \ - xlat/mdb_states.h xlat/membarrier_cmds.h \ + xlat/keyctl_commands.h xlat/kvm_mem_flags.h xlat/lockfcmds.h \ + xlat/loop_cmds.h xlat/loop_crypt_type_options.h \ + xlat/loop_flags_options.h xlat/lwtunnel_encap_types.h \ + xlat/madvise_cmds.h xlat/mbindflags.h xlat/mctl_sync.h \ + xlat/mdb_flags.h xlat/mdb_states.h xlat/membarrier_cmds.h \ xlat/memfd_create_flags.h xlat/mempolicyflags.h \ xlat/mlock_flags.h xlat/mlockall_flags.h xlat/mmap_flags.h \ xlat/mmap_prot.h xlat/modem_flags.h xlat/modetypes.h \ @@ -1084,15 +1111,16 @@ XLAT_HEADER_FILES = xlat/access_flags.h xlat/addrfams.h \ xlat/ptrace_setoptions_flags.h xlat/quota_formats.h \ xlat/quotacmds.h xlat/quotatypes.h xlat/rename_flags.h \ xlat/resource_flags.h xlat/resources.h \ - xlat/route_nexthop_flags.h xlat/routing_flags.h \ - xlat/routing_protocols.h xlat/routing_scopes.h \ - xlat/routing_table_ids.h xlat/routing_types.h \ - xlat/rtnl_addr_attrs.h xlat/rtnl_addrlabel_attrs.h \ - xlat/rtnl_dcb_attrs.h xlat/rtnl_ifla_brport_attrs.h \ - xlat/rtnl_ifla_info_attrs.h xlat/rtnl_ifla_port_attrs.h \ - xlat/rtnl_ifla_vf_port_attrs.h xlat/rtnl_ifla_xdp_attrs.h \ - xlat/rtnl_link_attrs.h xlat/rtnl_mdb_attrs.h \ - xlat/rtnl_mdba_mdb_attrs.h xlat/rtnl_mdba_mdb_eattr_attrs.h \ + xlat/riscv_flush_icache_flags.h xlat/route_nexthop_flags.h \ + xlat/routing_flags.h xlat/routing_protocols.h \ + xlat/routing_scopes.h xlat/routing_table_ids.h \ + xlat/routing_types.h xlat/rtnl_addr_attrs.h \ + xlat/rtnl_addrlabel_attrs.h xlat/rtnl_dcb_attrs.h \ + xlat/rtnl_ifla_brport_attrs.h xlat/rtnl_ifla_info_attrs.h \ + xlat/rtnl_ifla_port_attrs.h xlat/rtnl_ifla_vf_port_attrs.h \ + xlat/rtnl_ifla_xdp_attrs.h xlat/rtnl_link_attrs.h \ + xlat/rtnl_mdb_attrs.h xlat/rtnl_mdba_mdb_attrs.h \ + xlat/rtnl_mdba_mdb_eattr_attrs.h \ xlat/rtnl_mdba_mdb_entry_attrs.h xlat/rtnl_mdba_router_attrs.h \ xlat/rtnl_mdba_router_pattr_attrs.h xlat/rtnl_neigh_attrs.h \ xlat/rtnl_neightbl_attrs.h xlat/rtnl_neightbl_parms_attrs.h \ @@ -1101,8 +1129,11 @@ XLAT_HEADER_FILES = xlat/access_flags.h xlat/addrfams.h \ xlat/rtnl_rule_attrs.h xlat/rtnl_tc_action_attrs.h \ xlat/rtnl_tc_attrs.h xlat/rtnl_tca_stab_attrs.h \ xlat/rtnl_tca_stats_attrs.h xlat/rwf_flags.h \ - xlat/sa_handler_values.h xlat/sched_flags.h xlat/schedulers.h \ - xlat/scmvals.h xlat/scsi_sg_commands.h xlat/secbits.h \ + xlat/s390_guarded_storage_commands.h \ + xlat/s390_runtime_instr_commands.h \ + xlat/s390_sthyi_function_codes.h xlat/sa_handler_values.h \ + xlat/sched_flags.h xlat/schedulers.h xlat/scmvals.h \ + xlat/scsi_sg_commands.h xlat/secbits.h \ xlat/seccomp_filter_flags.h xlat/seccomp_mode.h \ xlat/seccomp_ops.h xlat/seccomp_ret_action.h \ xlat/semctl_flags.h xlat/semop_flags.h xlat/setns_types.h \ @@ -1121,13 +1152,13 @@ XLAT_HEADER_FILES = xlat/access_flags.h xlat/addrfams.h \ xlat/smc_states.h xlat/sock_type_flags.h xlat/socketcalls.h \ xlat/socketlayers.h xlat/sockipoptions.h \ xlat/sockipv6options.h xlat/sockipxoptions.h \ - xlat/sockoptions.h xlat/sockpacketoptions.h \ - xlat/sockrawoptions.h xlat/socksctpoptions.h \ - xlat/socktcpoptions.h xlat/socktypes.h xlat/splice_flags.h \ - xlat/sram_alloc_flags.h xlat/statfs_flags.h xlat/statx_attrs.h \ - xlat/statx_masks.h xlat/swap_flags.h \ - xlat/sync_file_range_flags.h xlat/sysctl_kern.h \ - xlat/sysctl_net.h xlat/sysctl_net_core.h \ + xlat/socknetlinkoptions.h xlat/sockoptions.h \ + xlat/sockpacketoptions.h xlat/sockrawoptions.h \ + xlat/socksctpoptions.h xlat/socktcpoptions.h xlat/socktypes.h \ + xlat/splice_flags.h xlat/sram_alloc_flags.h \ + xlat/statfs_flags.h xlat/statx_attrs.h xlat/statx_masks.h \ + xlat/swap_flags.h xlat/sync_file_range_flags.h \ + xlat/sysctl_kern.h xlat/sysctl_net.h xlat/sysctl_net_core.h \ xlat/sysctl_net_ipv4.h xlat/sysctl_net_ipv4_conf.h \ xlat/sysctl_net_ipv4_route.h xlat/sysctl_net_ipv6.h \ xlat/sysctl_net_ipv6_route.h xlat/sysctl_net_unix.h \ @@ -1155,18 +1186,20 @@ XLAT_HEADER_FILES = xlat/access_flags.h xlat/addrfams.h \ xlat/v4l2_vbi_flags.h xlat/wait4_options.h xlat/waitid_types.h \ xlat/whence_codes.h xlat/xattrflags.h xlat/xdp_flags.h \ xlat/xfs_dqblk_flags.h xlat/xfs_quota_flags.h -strace_CPPFLAGS = $(AM_CPPFLAGS) $(am__append_2) \ +strace_CPPFLAGS = $(AM_CPPFLAGS) $(am__append_2) $(am__append_5) \ $(CODE_COVERAGE_CPPFLAGS) strace_CFLAGS = $(AM_CFLAGS) $(CODE_COVERAGE_CFLAGS) -strace_LDFLAGS = $(am__append_3) -strace_LDADD = libstrace.a $(am__append_4) $(CODE_COVERAGE_LIBS) \ - $(am__append_5) $(am__append_9) -noinst_LIBRARIES = libstrace.a $(am__append_6) $(am__append_10) +strace_LDFLAGS = $(am__append_3) $(am__append_6) +strace_LDADD = libstrace.a $(am__append_4) $(am__append_7) \ + $(CODE_COVERAGE_LIBS) $(am__append_8) $(am__append_12) +noinst_LIBRARIES = libstrace.a $(am__append_9) $(am__append_13) libstrace_a_CPPFLAGS = $(strace_CPPFLAGS) libstrace_a_CFLAGS = $(strace_CFLAGS) libstrace_a_SOURCES = \ + fetch_indirect_syscall_args.c \ fstatfs.c \ fstatfs64.c \ + getpagesize.c \ ipc.c \ sigreturn.c \ socketcall.c \ @@ -1178,57 +1211,58 @@ libstrace_a_SOURCES = \ upoke.c \ # end of libstrace_a_SOURCES -strace_SOURCES = access.c affinity.c aio.c alpha.c basic_filters.c \ - bind.c bjm.c block.c bpf.c bpf_filter.c bpf_filter.h \ - bpf_fprog.h bpf_seccomp_filter.c bpf_sock_filter.c btrfs.c \ - cacheflush.c capability.c caps0.h caps1.h chdir.c chmod.c \ - clone.c copy_file_range.c count.c defs.h desc.c dirent.c \ - dirent64.c dm.c dyxlat.c empty.h epoll.c error_prints.c \ - error_prints.h evdev.c eventfd.c execve.c fadvise.c \ - fallocate.c fanotify.c fchownat.c fcntl.c fetch_bpf_fprog.c \ - fetch_struct_flock.c fetch_struct_keyctl_kdf_params.c \ - fetch_struct_mmsghdr.c fetch_struct_msghdr.c \ - fetch_struct_stat.c fetch_struct_stat64.c \ - fetch_struct_statfs.c file_handle.c file_ioctl.c \ - filter_qualify.c filter.h flock.c flock.h fs_x_ioctl.c futex.c \ - gcc_compat.h get_robust_list.c getcpu.c getcwd.c getrandom.c \ - hdio.c hostname.c inotify.c io.c ioctl.c ioperm.c iopl.c \ - ioprio.c ipc_defs.h ipc_msg.c ipc_msgctl.c ipc_sem.c ipc_shm.c \ - ipc_shmctl.c kcmp.c kernel_types.h kexec.c keyctl.c \ - keyctl_kdf_params.h ldt.c link.c linux/asm_stat.h \ - linux/x32/asm_stat.h linux/x86_64/asm_stat.h listen.c \ - lookup_dcookie.c loop.c lseek.c macros.h mem.c membarrier.c \ - memfd_create.c mknod.c mmsghdr.c mount.c mpers_type.h mq.c \ - msghdr.c msghdr.h mtd.c native_defs.h negated_errno.h net.c \ - netlink.c netlink.h netlink_crypto.c netlink_sock_diag.h \ - netlink_inet_diag.c netlink_netlink_diag.c \ - netlink_packet_diag.c netlink_route.c netlink_route.h \ - netlink_selinux.c netlink_smc_diag.c netlink_sock_diag.c \ - netlink_unix_diag.c nlattr.c nlattr.h nsfs.c nsfs.h nsig.h \ - numa.c number_set.c number_set.h oldstat.c open.c \ - or1k_atomic.c pathtrace.c perf.c perf_event_struct.h \ - personality.c pkeys.c poll.c prctl.c print_dev_t.c \ - print_group_req.c print_fields.h print_ifindex.c \ +strace_SOURCES = access.c affinity.c aio.c alpha.c arch_defs.h \ + basic_filters.c bind.c bjm.c block.c bpf.c bpf_filter.c \ + bpf_filter.h bpf_fprog.h bpf_seccomp_filter.c \ + bpf_sock_filter.c btrfs.c cacheflush.c capability.c caps0.h \ + caps1.h chdir.c chmod.c clone.c copy_file_range.c count.c \ + defs.h desc.c dirent.c dirent64.c dm.c dyxlat.c empty.h \ + epoll.c error_prints.c error_prints.h evdev.c eventfd.c \ + execve.c fadvise.c fallocate.c fanotify.c fchownat.c fcntl.c \ + fetch_bpf_fprog.c fetch_struct_flock.c \ + fetch_struct_keyctl_kdf_params.c fetch_struct_mmsghdr.c \ + fetch_struct_msghdr.c fetch_struct_stat.c \ + fetch_struct_stat64.c fetch_struct_statfs.c file_handle.c \ + file_ioctl.c filter_qualify.c filter.h flock.c flock.h \ + fs_x_ioctl.c futex.c gcc_compat.h get_robust_list.c getcpu.c \ + getcwd.c getrandom.c hdio.c hostname.c inotify.c io.c ioctl.c \ + ioperm.c iopl.c ioprio.c ipc_defs.h ipc_msg.c ipc_msgctl.c \ + ipc_sem.c ipc_shm.c ipc_shmctl.c kcmp.c kernel_types.h kexec.c \ + keyctl.c keyctl_kdf_params.h kvm.c largefile_wrappers.h ldt.c \ + link.c linux/asm_stat.h linux/x32/asm_stat.h \ + linux/x86_64/asm_stat.h listen.c lookup_dcookie.c loop.c \ + lseek.c macros.h mem.c membarrier.c memfd_create.c mknod.c \ + mmsghdr.c mount.c mpers_type.h mq.c msghdr.c msghdr.h mtd.c \ + native_defs.h negated_errno.h net.c netlink.c netlink.h \ + netlink_crypto.c netlink_sock_diag.h netlink_inet_diag.c \ + netlink_netlink_diag.c netlink_packet_diag.c netlink_route.c \ + netlink_route.h netlink_selinux.c netlink_smc_diag.c \ + netlink_sock_diag.c netlink_unix_diag.c nlattr.c nlattr.h \ + nsfs.c nsfs.h nsig.h numa.c number_set.c number_set.h \ + oldstat.c open.c or1k_atomic.c pathtrace.c perf.c \ + perf_event_struct.h personality.c pkeys.c poll.c prctl.c \ + print_dev_t.c print_group_req.c print_fields.h print_ifindex.c \ print_mq_attr.c print_msgbuf.c print_sg_req_info.c \ print_sigevent.c print_statfs.c print_struct_stat.c \ print_time.c print_timespec.c print_timeval.c print_timex.c \ printmode.c printrusage.c printsiginfo.c printsiginfo.h \ process.c process_vm.c ptp.c ptrace.h quota.c readahead.c \ - readlink.c reboot.c regs.h renameat.c resource.c rt_sigframe.c \ - rt_sigreturn.c rtc.c rtnl_addr.c rtnl_addrlabel.c rtnl_dcb.c \ - rtnl_link.c rtnl_mdb.c rtnl_neigh.c rtnl_neightbl.c \ - rtnl_netconf.c rtnl_nsid.c rtnl_route.c rtnl_rule.c rtnl_tc.c \ - rtnl_tc_action.c sched.c sched_attr.h scsi.c seccomp.c \ - sendfile.c sg_io_v3.c sg_io_v4.c shutdown.c sigaltstack.c \ - sigevent.h signal.c signalfd.c sock.c sockaddr.c socketutils.c \ - sram_alloc.c stat.c stat.h stat64.c statfs.c statfs.h statx.c \ - statx.h strace.c string_to_uint.h string_to_uint.c \ - supported_personalities.h swapon.c syscall.c sysctl.c sysent.h \ - sysent_shorthand_defs.h sysent_shorthand_undefs.h sysinfo.c \ - syslog.c sysmips.c term.c time.c times.c truncate.c ubi.c \ - ucopy.c uid.c uid16.c umask.c umount.c uname.c userfaultfd.c \ - ustat.c util.c utime.c utimes.c v4l2.c wait.c xattr.c xlat.c \ - xlat.h xmalloc.c xmalloc.h $(am__append_1) + readlink.c reboot.c regs.h renameat.c resource.c riscv.c \ + rt_sigframe.c rt_sigreturn.c rtc.c rtnl_addr.c \ + rtnl_addrlabel.c rtnl_dcb.c rtnl_link.c rtnl_mdb.c \ + rtnl_neigh.c rtnl_neightbl.c rtnl_netconf.c rtnl_nsid.c \ + rtnl_route.c rtnl_rule.c rtnl_tc.c rtnl_tc_action.c s390.c \ + sched.c sched_attr.h scsi.c seccomp.c sendfile.c sg_io_v3.c \ + sg_io_v4.c shutdown.c sigaltstack.c sigevent.h signal.c \ + signalfd.c sock.c sockaddr.c socketutils.c sram_alloc.c stat.c \ + stat.h stat64.c statfs.c statfs.h statx.c statx.h strace.c \ + string_to_uint.h string_to_uint.c swapon.c syscall.c sysctl.c \ + sysent.h sysent_shorthand_defs.h sysent_shorthand_undefs.h \ + sysinfo.c syslog.c sysmips.c term.c time.c times.c \ + trace_event.h truncate.c ubi.c ucopy.c uid.c uid16.c umask.c \ + umount.c uname.c userfaultfd.c ustat.c util.c utime.c utimes.c \ + v4l2.c wait.c xattr.c xlat.c xlat.h xmalloc.c xmalloc.h \ + xstring.h $(am__append_1) CODE_COVERAGE_BRANCH_COVERAGE = 1 CODE_COVERAGE_GENHTML_OPTIONS = $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) \ --prefix $(shell cd $(abs_top_srcdir)/.. && pwd || echo .) @@ -1269,23 +1303,27 @@ EXTRA_DIST = \ linux/32/syscallent.h \ linux/64/ioctls_inc.h \ linux/64/syscallent.h \ + linux/aarch64/arch_defs_.h \ linux/aarch64/arch_regs.c \ linux/aarch64/arch_regs.h \ - linux/aarch64/arch_rt_sigframe.c\ + linux/aarch64/arch_rt_sigframe.c \ linux/aarch64/arch_sigreturn.c \ linux/aarch64/errnoent1.h \ linux/aarch64/get_error.c \ linux/aarch64/get_scno.c \ - linux/aarch64/get_syscall_args.c\ + linux/aarch64/get_syscall_args.c \ linux/aarch64/ioctls_arch0.h \ linux/aarch64/ioctls_arch1.h \ linux/aarch64/ioctls_inc0.h \ linux/aarch64/ioctls_inc1.h \ + linux/aarch64/nr_prefix.c \ linux/aarch64/set_error.c \ linux/aarch64/set_scno.c \ + linux/aarch64/shuffle_scno.c \ linux/aarch64/signalent1.h \ linux/aarch64/syscallent.h \ linux/aarch64/syscallent1.h \ + linux/alpha/arch_defs_.h \ linux/alpha/arch_getrval2.c \ linux/alpha/arch_regs.c \ linux/alpha/arch_regs.h \ @@ -1295,7 +1333,7 @@ EXTRA_DIST = \ linux/alpha/get_error.c \ linux/alpha/get_scno.c \ linux/alpha/get_syscall_args.c \ - linux/alpha/get_syscall_result.c\ + linux/alpha/get_syscall_result.c \ linux/alpha/ioctls_arch0.h \ linux/alpha/ioctls_inc0.h \ linux/alpha/set_error.c \ @@ -1314,8 +1352,11 @@ EXTRA_DIST = \ linux/arc/set_error.c \ linux/arc/set_scno.c \ linux/arc/syscallent.h \ + linux/arch_defs_.h \ + linux/arch_kvm.c \ linux/arch_regs.h \ linux/arch_sigreturn.c \ + linux/arm/arch_defs_.h \ linux/arm/arch_regs.c \ linux/arm/arch_regs.h \ linux/arm/arch_rt_sigframe.c \ @@ -1325,8 +1366,10 @@ EXTRA_DIST = \ linux/arm/get_syscall_args.c \ linux/arm/ioctls_arch0.h \ linux/arm/ioctls_inc0.h \ + linux/arm/nr_prefix.c \ linux/arm/set_error.c \ linux/arm/set_scno.c \ + linux/arm/shuffle_scno.c \ linux/arm/syscallent.h \ linux/arm/userent.h \ linux/avr32/arch_regs.c \ @@ -1341,6 +1384,7 @@ EXTRA_DIST = \ linux/avr32/set_scno.c \ linux/avr32/syscallent.h \ linux/avr32/userent.h \ + linux/bfin/arch_defs_.h \ linux/bfin/arch_regs.c \ linux/bfin/arch_rt_sigframe.c \ linux/bfin/get_error.c \ @@ -1354,33 +1398,10 @@ EXTRA_DIST = \ linux/bfin/set_scno.c \ linux/bfin/syscallent.h \ linux/bfin/userent.h \ - linux/crisv10/arch_regs.c \ - linux/crisv10/arch_rt_sigframe.c\ - linux/crisv10/arch_sigreturn.c \ - linux/crisv10/get_error.c \ - linux/crisv10/get_scno.c \ - linux/crisv10/get_syscall_args.c \ - linux/crisv10/get_syscall_result.c \ - linux/crisv10/rt_sigframe.h \ - linux/crisv10/set_error.c \ - linux/crisv10/set_scno.c \ - linux/crisv10/syscallent.h \ - linux/crisv10/userent.h \ - linux/crisv32/arch_regs.c \ - linux/crisv32/arch_rt_sigframe.c\ - linux/crisv32/arch_sigreturn.c \ - linux/crisv32/get_error.c \ - linux/crisv32/get_scno.c \ - linux/crisv32/get_syscall_args.c \ - linux/crisv32/get_syscall_result.c \ - linux/crisv32/rt_sigframe.h \ - linux/crisv32/set_error.c \ - linux/crisv32/set_scno.c \ - linux/crisv32/syscallent.h \ - linux/crisv32/userent.h \ linux/dummy.h \ linux/errnoent.h \ linux/getregs_old.h \ + linux/hppa/arch_defs_.h \ linux/hppa/arch_regs.c \ linux/hppa/arch_regs.h \ linux/hppa/arch_rt_sigframe.c \ @@ -1396,6 +1417,8 @@ EXTRA_DIST = \ linux/hppa/set_scno.c \ linux/hppa/signalent.h \ linux/hppa/syscallent.h \ + linux/i386/arch_kvm.c \ + linux/i386/arch_defs_.h \ linux/i386/arch_regs.c \ linux/i386/arch_regs.h \ linux/i386/arch_rt_sigframe.c \ @@ -1411,6 +1434,7 @@ EXTRA_DIST = \ linux/i386/syscallent.h \ linux/i386/userent.h \ linux/i386/userent0.h \ + linux/ia64/arch_defs_.h \ linux/ia64/arch_getrval2.c \ linux/ia64/arch_regs.c \ linux/ia64/arch_regs.h \ @@ -1426,6 +1450,7 @@ EXTRA_DIST = \ linux/ia64/syscallent.h \ linux/ia64/userent.h \ linux/inet_diag.h \ + linux/m68k/arch_defs_.h \ linux/m68k/arch_regs.c \ linux/m68k/arch_regs.h \ linux/m68k/arch_rt_sigframe.c \ @@ -1451,8 +1476,9 @@ EXTRA_DIST = \ linux/metag/set_error.c \ linux/metag/set_scno.c \ linux/metag/syscallent.h \ + linux/microblaze/arch_defs_.h \ linux/microblaze/arch_regs.c \ - linux/microblaze/arch_rt_sigframe.c\ + linux/microblaze/arch_rt_sigframe.c \ linux/microblaze/arch_sigreturn.c \ linux/microblaze/get_error.c \ linux/microblaze/get_scno.c \ @@ -1464,6 +1490,7 @@ EXTRA_DIST = \ linux/microblaze/set_scno.c \ linux/microblaze/syscallent.h \ linux/microblaze/userent.h \ + linux/mips/arch_defs_.h \ linux/mips/arch_getrval2.c \ linux/mips/arch_regs.c \ linux/mips/arch_regs.h \ @@ -1486,8 +1513,8 @@ EXTRA_DIST = \ linux/mips/syscallent-o32.h \ linux/mips/syscallent.h \ linux/mips/userent.h \ - linux/mtd-abi.h \ linux/netlink_diag.h \ + linux/nios2/arch_defs_.h \ linux/nios2/arch_regs.c \ linux/nios2/arch_regs.h \ linux/nios2/arch_rt_sigframe.c \ @@ -1499,6 +1526,7 @@ EXTRA_DIST = \ linux/nios2/set_error.c \ linux/nios2/set_scno.c \ linux/nios2/syscallent.h \ + linux/nr_prefix.c \ linux/or1k/arch_regs.c \ linux/or1k/arch_regs.h \ linux/or1k/arch_rt_sigframe.c \ @@ -1512,10 +1540,10 @@ EXTRA_DIST = \ linux/or1k/syscallent.h \ linux/or1k/userent.h \ linux/packet_diag.h \ - linux/personality.h \ + linux/powerpc/arch_defs_.h \ linux/powerpc/arch_regs.c \ linux/powerpc/arch_regs.h \ - linux/powerpc/arch_rt_sigframe.c\ + linux/powerpc/arch_rt_sigframe.c \ linux/powerpc/arch_sigreturn.c \ linux/powerpc/errnoent.h \ linux/powerpc/get_error.c \ @@ -1529,9 +1557,10 @@ EXTRA_DIST = \ linux/powerpc/set_scno.c \ linux/powerpc/syscallent.h \ linux/powerpc/userent.h \ + linux/powerpc64/arch_defs_.h \ linux/powerpc64/arch_regs.c \ linux/powerpc64/arch_regs.h \ - linux/powerpc64/arch_rt_sigframe.c\ + linux/powerpc64/arch_rt_sigframe.c \ linux/powerpc64/arch_sigreturn.c \ linux/powerpc64/errnoent.h \ linux/powerpc64/errnoent1.h \ @@ -1551,7 +1580,7 @@ EXTRA_DIST = \ linux/powerpc64/syscallent.h \ linux/powerpc64/syscallent1.h \ linux/powerpc64/userent.h \ - linux/ptp_clock.h \ + linux/riscv/arch_defs_.h \ linux/riscv/arch_regs.c \ linux/riscv/arch_regs.h \ linux/riscv/arch_rt_sigframe.c \ @@ -1569,6 +1598,7 @@ EXTRA_DIST = \ linux/riscv/syscallent.h \ linux/riscv/syscallent1.h \ linux/rt_sigframe.h \ + linux/s390/arch_defs_.h \ linux/s390/arch_regs.c \ linux/s390/arch_regs.h \ linux/s390/arch_rt_sigframe.c \ @@ -1585,20 +1615,27 @@ EXTRA_DIST = \ linux/s390/userent.h \ linux/s390/userent0.h \ linux/s390/userent1.h \ + linux/s390x/arch_defs_.h \ linux/s390x/arch_regs.c \ linux/s390x/arch_regs.h \ linux/s390x/arch_rt_sigframe.c \ linux/s390x/arch_sigreturn.c \ + linux/s390x/errnoent1.h \ linux/s390x/get_error.c \ linux/s390x/get_scno.c \ linux/s390x/get_syscall_args.c \ linux/s390x/ioctls_arch0.h \ + linux/s390x/ioctls_arch1.h \ linux/s390x/ioctls_inc0.h \ + linux/s390x/ioctls_inc1.h \ linux/s390x/rt_sigframe.h \ linux/s390x/set_error.c \ linux/s390x/set_scno.c \ + linux/s390x/signalent1.h \ linux/s390x/syscallent.h \ + linux/s390x/syscallent1.h \ linux/s390x/userent.h \ + linux/sh/arch_defs_.h \ linux/sh/arch_getrval2.c \ linux/sh/arch_regs.c \ linux/sh/arch_rt_sigframe.c \ @@ -1613,6 +1650,7 @@ EXTRA_DIST = \ linux/sh/syscallent.h \ linux/sh/userent.h \ linux/sh/userent0.h \ + linux/sh64/arch_defs_.h \ linux/sh64/arch_regs.c \ linux/sh64/arch_regs.h \ linux/sh64/arch_rt_sigframe.c \ @@ -1627,16 +1665,17 @@ EXTRA_DIST = \ linux/sh64/set_scno.c \ linux/sh64/syscallent.h \ linux/sh64/userent.h \ + linux/shuffle_scno.c \ linux/signalent.h \ linux/smc_diag.h \ linux/sock_diag.h \ + linux/sparc/arch_defs_.h \ linux/sparc/arch_getrval2.c \ linux/sparc/arch_regs.c \ linux/sparc/arch_regs.h \ linux/sparc/arch_rt_sigframe.c \ linux/sparc/arch_sigreturn.c \ linux/sparc/errnoent.h \ - linux/sparc/gen.pl \ linux/sparc/get_error.c \ linux/sparc/get_scno.c \ linux/sparc/get_syscall_args.c \ @@ -1648,16 +1687,17 @@ EXTRA_DIST = \ linux/sparc/signalent.h \ linux/sparc/syscallent.h \ linux/sparc/userent.h \ + linux/sparc64/arch_defs_.h \ linux/sparc64/arch_getrval2.c \ linux/sparc64/arch_regs.c \ linux/sparc64/arch_regs.h \ - linux/sparc64/arch_rt_sigframe.c\ + linux/sparc64/arch_rt_sigframe.c \ linux/sparc64/arch_sigreturn.c \ linux/sparc64/errnoent.h \ linux/sparc64/errnoent1.h \ linux/sparc64/get_error.c \ linux/sparc64/get_scno.c \ - linux/sparc64/get_syscall_args.c\ + linux/sparc64/get_syscall_args.c \ linux/sparc64/ioctls_arch0.h \ linux/sparc64/ioctls_arch1.h \ linux/sparc64/ioctls_inc0.h \ @@ -1672,6 +1712,7 @@ EXTRA_DIST = \ linux/sparc64/userent.h \ linux/subcall.h \ linux/syscall.h \ + linux/tile/arch_defs_.h \ linux/tile/arch_regs.c \ linux/tile/arch_regs.h \ linux/tile/arch_rt_sigframe.c \ @@ -1691,10 +1732,11 @@ EXTRA_DIST = \ linux/tile/syscallent.h \ linux/tile/syscallent1.h \ linux/tile/userent.h \ - linux/ubi-user.h \ linux/unix_diag.h \ linux/userent.h \ linux/userent0.h \ + linux/x32/arch_defs_.h \ + linux/x32/arch_kvm.c \ linux/x32/arch_regs.c \ linux/x32/arch_regs.h \ linux/x32/arch_rt_sigframe.c \ @@ -1710,17 +1752,19 @@ EXTRA_DIST = \ linux/x32/rt_sigframe.h \ linux/x32/set_error.c \ linux/x32/set_scno.c \ + linux/x32/shuffle_scno.c \ linux/x32/signalent1.h \ linux/x32/syscallent.h \ linux/x32/syscallent1.h \ linux/x32/userent.h \ + linux/x86_64/arch_defs_.h \ + linux/x86_64/arch_kvm.c \ linux/x86_64/arch_regs.c \ linux/x86_64/arch_regs.h \ linux/x86_64/arch_rt_sigframe.c \ linux/x86_64/arch_sigreturn.c \ linux/x86_64/errnoent1.h \ linux/x86_64/errnoent2.h \ - linux/x86_64/gentab.pl \ linux/x86_64/get_error.c \ linux/x86_64/get_scno.c \ linux/x86_64/get_syscall_args.c \ @@ -1735,6 +1779,7 @@ EXTRA_DIST = \ linux/x86_64/rt_sigframe.h \ linux/x86_64/set_error.c \ linux/x86_64/set_scno.c \ + linux/x86_64/shuffle_scno.c \ linux/x86_64/signalent1.h \ linux/x86_64/signalent2.h \ linux/x86_64/syscallent.h \ @@ -1764,7 +1809,7 @@ EXTRA_DIST = \ $(XLAT_INPUT_FILES) \ $(XLAT_HEADER_FILES) \ xlat/gen.sh \ - xlate.el + # end of EXTRA_DIST strace_SOURCES_c = \ $(filter %.c,$(strace_SOURCES)) $(filter %.c,$(libstrace_a_SOURCES)) @@ -1788,11 +1833,11 @@ ioctlent_h = $(patsubst $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%,ioctlent%,$(ioctls_i ioctl_redefs_h = $(filter-out ioctl_redefs0.h,$(subst ioctlent,ioctl_redefs,$(ioctlent_h))) BUILT_SOURCES = $(ioctl_redefs_h) $(ioctlent_h) native_printer_decls.h \ native_printer_defs.h printers.h sen.h sys_func.h .version \ - scno.h $(am__append_7) $(am__append_11) + scno.h $(am__append_10) $(am__append_14) CLEANFILES = $(ioctl_redefs_h) $(ioctlent_h) $(mpers_preproc_files) \ ioctl_iocdef.h ioctl_iocdef.i native_printer_decls.h \ native_printer_defs.h printers.h sen.h sys_func.h syscallent.i \ - scno.h $(am__append_8) $(am__append_12) + scno.h $(am__append_11) $(am__append_15) DISTCLEANFILES = gnu/stubs-32.h gnu/stubs-x32.h SCNO_CPPFLAGS = $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(ARCH_MFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) @@ -1882,6 +1927,8 @@ distclean-hdr: -rm -f config.h stamp-h1 strace.1: $(top_builddir)/config.status $(srcdir)/strace.1.in cd $(top_builddir) && $(SHELL) ./config.status $@ +strace-log-merge.1: $(top_builddir)/config.status $(srcdir)/strace-log-merge.1.in + cd $(top_builddir) && $(SHELL) ./config.status $@ strace.spec: $(top_builddir)/config.status $(srcdir)/strace.spec.in cd $(top_builddir) && $(SHELL) ./config.status $@ debian/changelog: $(top_builddir)/config.status $(top_srcdir)/debian/changelog.in @@ -2068,8 +2115,10 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmpers_mx32_a-ustat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmpers_mx32_a-utime.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmpers_mx32_a-v4l2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstrace_a-fetch_indirect_syscall_args.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstrace_a-fstatfs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstrace_a-fstatfs64.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstrace_a-getpagesize.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstrace_a-ipc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstrace_a-sigreturn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstrace_a-socketcall.Po@am__quote@ @@ -2148,6 +2197,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strace-kcmp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strace-kexec.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strace-keyctl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strace-kvm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strace-ldt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strace-link.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strace-listen.Po@am__quote@ @@ -2212,6 +2262,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strace-reboot.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strace-renameat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strace-resource.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strace-riscv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strace-rt_sigframe.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strace-rt_sigreturn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strace-rtc.Po@am__quote@ @@ -2228,6 +2279,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strace-rtnl_rule.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strace-rtnl_tc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strace-rtnl_tc_action.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strace-s390.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strace-sched.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strace-scsi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strace-seccomp.Po@am__quote@ @@ -3355,6 +3407,20 @@ libmpers_mx32_a-v4l2.obj: v4l2.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmpers_mx32_a_CPPFLAGS) $(CPPFLAGS) $(libmpers_mx32_a_CFLAGS) $(CFLAGS) -c -o libmpers_mx32_a-v4l2.obj `if test -f 'v4l2.c'; then $(CYGPATH_W) 'v4l2.c'; else $(CYGPATH_W) '$(srcdir)/v4l2.c'; fi` +libstrace_a-fetch_indirect_syscall_args.o: fetch_indirect_syscall_args.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrace_a_CPPFLAGS) $(CPPFLAGS) $(libstrace_a_CFLAGS) $(CFLAGS) -MT libstrace_a-fetch_indirect_syscall_args.o -MD -MP -MF $(DEPDIR)/libstrace_a-fetch_indirect_syscall_args.Tpo -c -o libstrace_a-fetch_indirect_syscall_args.o `test -f 'fetch_indirect_syscall_args.c' || echo '$(srcdir)/'`fetch_indirect_syscall_args.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstrace_a-fetch_indirect_syscall_args.Tpo $(DEPDIR)/libstrace_a-fetch_indirect_syscall_args.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fetch_indirect_syscall_args.c' object='libstrace_a-fetch_indirect_syscall_args.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrace_a_CPPFLAGS) $(CPPFLAGS) $(libstrace_a_CFLAGS) $(CFLAGS) -c -o libstrace_a-fetch_indirect_syscall_args.o `test -f 'fetch_indirect_syscall_args.c' || echo '$(srcdir)/'`fetch_indirect_syscall_args.c + +libstrace_a-fetch_indirect_syscall_args.obj: fetch_indirect_syscall_args.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrace_a_CPPFLAGS) $(CPPFLAGS) $(libstrace_a_CFLAGS) $(CFLAGS) -MT libstrace_a-fetch_indirect_syscall_args.obj -MD -MP -MF $(DEPDIR)/libstrace_a-fetch_indirect_syscall_args.Tpo -c -o libstrace_a-fetch_indirect_syscall_args.obj `if test -f 'fetch_indirect_syscall_args.c'; then $(CYGPATH_W) 'fetch_indirect_syscall_args.c'; else $(CYGPATH_W) '$(srcdir)/fetch_indirect_syscall_args.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstrace_a-fetch_indirect_syscall_args.Tpo $(DEPDIR)/libstrace_a-fetch_indirect_syscall_args.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fetch_indirect_syscall_args.c' object='libstrace_a-fetch_indirect_syscall_args.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrace_a_CPPFLAGS) $(CPPFLAGS) $(libstrace_a_CFLAGS) $(CFLAGS) -c -o libstrace_a-fetch_indirect_syscall_args.obj `if test -f 'fetch_indirect_syscall_args.c'; then $(CYGPATH_W) 'fetch_indirect_syscall_args.c'; else $(CYGPATH_W) '$(srcdir)/fetch_indirect_syscall_args.c'; fi` + libstrace_a-fstatfs.o: fstatfs.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrace_a_CPPFLAGS) $(CPPFLAGS) $(libstrace_a_CFLAGS) $(CFLAGS) -MT libstrace_a-fstatfs.o -MD -MP -MF $(DEPDIR)/libstrace_a-fstatfs.Tpo -c -o libstrace_a-fstatfs.o `test -f 'fstatfs.c' || echo '$(srcdir)/'`fstatfs.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstrace_a-fstatfs.Tpo $(DEPDIR)/libstrace_a-fstatfs.Po @@ -3383,6 +3449,20 @@ libstrace_a-fstatfs64.obj: fstatfs64.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrace_a_CPPFLAGS) $(CPPFLAGS) $(libstrace_a_CFLAGS) $(CFLAGS) -c -o libstrace_a-fstatfs64.obj `if test -f 'fstatfs64.c'; then $(CYGPATH_W) 'fstatfs64.c'; else $(CYGPATH_W) '$(srcdir)/fstatfs64.c'; fi` +libstrace_a-getpagesize.o: getpagesize.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrace_a_CPPFLAGS) $(CPPFLAGS) $(libstrace_a_CFLAGS) $(CFLAGS) -MT libstrace_a-getpagesize.o -MD -MP -MF $(DEPDIR)/libstrace_a-getpagesize.Tpo -c -o libstrace_a-getpagesize.o `test -f 'getpagesize.c' || echo '$(srcdir)/'`getpagesize.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstrace_a-getpagesize.Tpo $(DEPDIR)/libstrace_a-getpagesize.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='getpagesize.c' object='libstrace_a-getpagesize.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrace_a_CPPFLAGS) $(CPPFLAGS) $(libstrace_a_CFLAGS) $(CFLAGS) -c -o libstrace_a-getpagesize.o `test -f 'getpagesize.c' || echo '$(srcdir)/'`getpagesize.c + +libstrace_a-getpagesize.obj: getpagesize.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrace_a_CPPFLAGS) $(CPPFLAGS) $(libstrace_a_CFLAGS) $(CFLAGS) -MT libstrace_a-getpagesize.obj -MD -MP -MF $(DEPDIR)/libstrace_a-getpagesize.Tpo -c -o libstrace_a-getpagesize.obj `if test -f 'getpagesize.c'; then $(CYGPATH_W) 'getpagesize.c'; else $(CYGPATH_W) '$(srcdir)/getpagesize.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstrace_a-getpagesize.Tpo $(DEPDIR)/libstrace_a-getpagesize.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='getpagesize.c' object='libstrace_a-getpagesize.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrace_a_CPPFLAGS) $(CPPFLAGS) $(libstrace_a_CFLAGS) $(CFLAGS) -c -o libstrace_a-getpagesize.obj `if test -f 'getpagesize.c'; then $(CYGPATH_W) 'getpagesize.c'; else $(CYGPATH_W) '$(srcdir)/getpagesize.c'; fi` + libstrace_a-ipc.o: ipc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrace_a_CPPFLAGS) $(CPPFLAGS) $(libstrace_a_CFLAGS) $(CFLAGS) -MT libstrace_a-ipc.o -MD -MP -MF $(DEPDIR)/libstrace_a-ipc.Tpo -c -o libstrace_a-ipc.o `test -f 'ipc.c' || echo '$(srcdir)/'`ipc.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstrace_a-ipc.Tpo $(DEPDIR)/libstrace_a-ipc.Po @@ -4475,6 +4555,20 @@ strace-keyctl.obj: keyctl.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(strace_CPPFLAGS) $(CPPFLAGS) $(strace_CFLAGS) $(CFLAGS) -c -o strace-keyctl.obj `if test -f 'keyctl.c'; then $(CYGPATH_W) 'keyctl.c'; else $(CYGPATH_W) '$(srcdir)/keyctl.c'; fi` +strace-kvm.o: kvm.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(strace_CPPFLAGS) $(CPPFLAGS) $(strace_CFLAGS) $(CFLAGS) -MT strace-kvm.o -MD -MP -MF $(DEPDIR)/strace-kvm.Tpo -c -o strace-kvm.o `test -f 'kvm.c' || echo '$(srcdir)/'`kvm.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/strace-kvm.Tpo $(DEPDIR)/strace-kvm.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='kvm.c' object='strace-kvm.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(strace_CPPFLAGS) $(CPPFLAGS) $(strace_CFLAGS) $(CFLAGS) -c -o strace-kvm.o `test -f 'kvm.c' || echo '$(srcdir)/'`kvm.c + +strace-kvm.obj: kvm.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(strace_CPPFLAGS) $(CPPFLAGS) $(strace_CFLAGS) $(CFLAGS) -MT strace-kvm.obj -MD -MP -MF $(DEPDIR)/strace-kvm.Tpo -c -o strace-kvm.obj `if test -f 'kvm.c'; then $(CYGPATH_W) 'kvm.c'; else $(CYGPATH_W) '$(srcdir)/kvm.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/strace-kvm.Tpo $(DEPDIR)/strace-kvm.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='kvm.c' object='strace-kvm.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(strace_CPPFLAGS) $(CPPFLAGS) $(strace_CFLAGS) $(CFLAGS) -c -o strace-kvm.obj `if test -f 'kvm.c'; then $(CYGPATH_W) 'kvm.c'; else $(CYGPATH_W) '$(srcdir)/kvm.c'; fi` + strace-ldt.o: ldt.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(strace_CPPFLAGS) $(CPPFLAGS) $(strace_CFLAGS) $(CFLAGS) -MT strace-ldt.o -MD -MP -MF $(DEPDIR)/strace-ldt.Tpo -c -o strace-ldt.o `test -f 'ldt.c' || echo '$(srcdir)/'`ldt.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/strace-ldt.Tpo $(DEPDIR)/strace-ldt.Po @@ -5371,6 +5465,20 @@ strace-resource.obj: resource.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(strace_CPPFLAGS) $(CPPFLAGS) $(strace_CFLAGS) $(CFLAGS) -c -o strace-resource.obj `if test -f 'resource.c'; then $(CYGPATH_W) 'resource.c'; else $(CYGPATH_W) '$(srcdir)/resource.c'; fi` +strace-riscv.o: riscv.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(strace_CPPFLAGS) $(CPPFLAGS) $(strace_CFLAGS) $(CFLAGS) -MT strace-riscv.o -MD -MP -MF $(DEPDIR)/strace-riscv.Tpo -c -o strace-riscv.o `test -f 'riscv.c' || echo '$(srcdir)/'`riscv.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/strace-riscv.Tpo $(DEPDIR)/strace-riscv.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='riscv.c' object='strace-riscv.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(strace_CPPFLAGS) $(CPPFLAGS) $(strace_CFLAGS) $(CFLAGS) -c -o strace-riscv.o `test -f 'riscv.c' || echo '$(srcdir)/'`riscv.c + +strace-riscv.obj: riscv.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(strace_CPPFLAGS) $(CPPFLAGS) $(strace_CFLAGS) $(CFLAGS) -MT strace-riscv.obj -MD -MP -MF $(DEPDIR)/strace-riscv.Tpo -c -o strace-riscv.obj `if test -f 'riscv.c'; then $(CYGPATH_W) 'riscv.c'; else $(CYGPATH_W) '$(srcdir)/riscv.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/strace-riscv.Tpo $(DEPDIR)/strace-riscv.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='riscv.c' object='strace-riscv.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(strace_CPPFLAGS) $(CPPFLAGS) $(strace_CFLAGS) $(CFLAGS) -c -o strace-riscv.obj `if test -f 'riscv.c'; then $(CYGPATH_W) 'riscv.c'; else $(CYGPATH_W) '$(srcdir)/riscv.c'; fi` + strace-rt_sigframe.o: rt_sigframe.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(strace_CPPFLAGS) $(CPPFLAGS) $(strace_CFLAGS) $(CFLAGS) -MT strace-rt_sigframe.o -MD -MP -MF $(DEPDIR)/strace-rt_sigframe.Tpo -c -o strace-rt_sigframe.o `test -f 'rt_sigframe.c' || echo '$(srcdir)/'`rt_sigframe.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/strace-rt_sigframe.Tpo $(DEPDIR)/strace-rt_sigframe.Po @@ -5595,6 +5703,20 @@ strace-rtnl_tc_action.obj: rtnl_tc_action.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(strace_CPPFLAGS) $(CPPFLAGS) $(strace_CFLAGS) $(CFLAGS) -c -o strace-rtnl_tc_action.obj `if test -f 'rtnl_tc_action.c'; then $(CYGPATH_W) 'rtnl_tc_action.c'; else $(CYGPATH_W) '$(srcdir)/rtnl_tc_action.c'; fi` +strace-s390.o: s390.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(strace_CPPFLAGS) $(CPPFLAGS) $(strace_CFLAGS) $(CFLAGS) -MT strace-s390.o -MD -MP -MF $(DEPDIR)/strace-s390.Tpo -c -o strace-s390.o `test -f 's390.c' || echo '$(srcdir)/'`s390.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/strace-s390.Tpo $(DEPDIR)/strace-s390.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='s390.c' object='strace-s390.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(strace_CPPFLAGS) $(CPPFLAGS) $(strace_CFLAGS) $(CFLAGS) -c -o strace-s390.o `test -f 's390.c' || echo '$(srcdir)/'`s390.c + +strace-s390.obj: s390.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(strace_CPPFLAGS) $(CPPFLAGS) $(strace_CFLAGS) $(CFLAGS) -MT strace-s390.obj -MD -MP -MF $(DEPDIR)/strace-s390.Tpo -c -o strace-s390.obj `if test -f 's390.c'; then $(CYGPATH_W) 's390.c'; else $(CYGPATH_W) '$(srcdir)/s390.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/strace-s390.Tpo $(DEPDIR)/strace-s390.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='s390.c' object='strace-s390.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(strace_CPPFLAGS) $(CPPFLAGS) $(strace_CFLAGS) $(CFLAGS) -c -o strace-s390.obj `if test -f 's390.c'; then $(CYGPATH_W) 's390.c'; else $(CYGPATH_W) '$(srcdir)/s390.c'; fi` + strace-sched.o: sched.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(strace_CPPFLAGS) $(CPPFLAGS) $(strace_CFLAGS) $(CFLAGS) -MT strace-sched.o -MD -MP -MF $(DEPDIR)/strace-sched.Tpo -c -o strace-sched.o `test -f 'sched.c' || echo '$(srcdir)/'`sched.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/strace-sched.Tpo $(DEPDIR)/strace-sched.Po @@ -7075,6 +7197,8 @@ $(top_srcdir)/xlat/key_spec.h: $(top_srcdir)/xlat/key_spec.in $(top_srcdir)/xlat $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ $(top_srcdir)/xlat/keyctl_commands.h: $(top_srcdir)/xlat/keyctl_commands.in $(top_srcdir)/xlat/gen.sh $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ +$(top_srcdir)/xlat/kvm_mem_flags.h: $(top_srcdir)/xlat/kvm_mem_flags.in $(top_srcdir)/xlat/gen.sh + $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ $(top_srcdir)/xlat/lockfcmds.h: $(top_srcdir)/xlat/lockfcmds.in $(top_srcdir)/xlat/gen.sh $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ $(top_srcdir)/xlat/loop_cmds.h: $(top_srcdir)/xlat/loop_cmds.in $(top_srcdir)/xlat/gen.sh @@ -7299,6 +7423,8 @@ $(top_srcdir)/xlat/resource_flags.h: $(top_srcdir)/xlat/resource_flags.in $(top_ $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ $(top_srcdir)/xlat/resources.h: $(top_srcdir)/xlat/resources.in $(top_srcdir)/xlat/gen.sh $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ +$(top_srcdir)/xlat/riscv_flush_icache_flags.h: $(top_srcdir)/xlat/riscv_flush_icache_flags.in $(top_srcdir)/xlat/gen.sh + $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ $(top_srcdir)/xlat/route_nexthop_flags.h: $(top_srcdir)/xlat/route_nexthop_flags.in $(top_srcdir)/xlat/gen.sh $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ $(top_srcdir)/xlat/routing_flags.h: $(top_srcdir)/xlat/routing_flags.in $(top_srcdir)/xlat/gen.sh @@ -7367,6 +7493,12 @@ $(top_srcdir)/xlat/rtnl_tca_stats_attrs.h: $(top_srcdir)/xlat/rtnl_tca_stats_att $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ $(top_srcdir)/xlat/rwf_flags.h: $(top_srcdir)/xlat/rwf_flags.in $(top_srcdir)/xlat/gen.sh $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ +$(top_srcdir)/xlat/s390_guarded_storage_commands.h: $(top_srcdir)/xlat/s390_guarded_storage_commands.in $(top_srcdir)/xlat/gen.sh + $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ +$(top_srcdir)/xlat/s390_runtime_instr_commands.h: $(top_srcdir)/xlat/s390_runtime_instr_commands.in $(top_srcdir)/xlat/gen.sh + $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ +$(top_srcdir)/xlat/s390_sthyi_function_codes.h: $(top_srcdir)/xlat/s390_sthyi_function_codes.in $(top_srcdir)/xlat/gen.sh + $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ $(top_srcdir)/xlat/sa_handler_values.h: $(top_srcdir)/xlat/sa_handler_values.in $(top_srcdir)/xlat/gen.sh $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ $(top_srcdir)/xlat/sched_flags.h: $(top_srcdir)/xlat/sched_flags.in $(top_srcdir)/xlat/gen.sh @@ -7467,6 +7599,8 @@ $(top_srcdir)/xlat/sockipv6options.h: $(top_srcdir)/xlat/sockipv6options.in $(to $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ $(top_srcdir)/xlat/sockipxoptions.h: $(top_srcdir)/xlat/sockipxoptions.in $(top_srcdir)/xlat/gen.sh $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ +$(top_srcdir)/xlat/socknetlinkoptions.h: $(top_srcdir)/xlat/socknetlinkoptions.in $(top_srcdir)/xlat/gen.sh + $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ $(top_srcdir)/xlat/sockoptions.h: $(top_srcdir)/xlat/sockoptions.in $(top_srcdir)/xlat/gen.sh $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ $(top_srcdir)/xlat/sockpacketoptions.h: $(top_srcdir)/xlat/sockpacketoptions.in $(top_srcdir)/xlat/gen.sh @@ -7695,9 +7829,12 @@ $(strace_OBJECTS): scno.h mpers-m%.stamp: $(srcdir_mpers_source_files) | printers.h for f in $^; do \ - CC="$(CC)" CFLAGS="$(mpers_sh_opts) -DMPERS_IS_$(mpers_NAME)" \ - CPP="$(CPP)" CPPFLAGS="$(mpers_sh_opts) -DIN_MPERS -DMPERS_IS_$(mpers_NAME)" \ - $(srcdir)/mpers.sh -$(mpers_NAME) $$f || exit; \ + READELF="$(READELF)" \ + CC="$(CC)" \ + CFLAGS="$(mpers_sh_opts) -DMPERS_IS_$(mpers_NAME)" \ + CPP="$(CPP)" \ + CPPFLAGS="$(mpers_sh_opts) -DIN_MPERS -DMPERS_IS_$(mpers_NAME)" \ + $(srcdir)/mpers.sh $(mpers_NAME) $(mpers_CC_FLAGS) $$f || exit; \ done > $@ @@ -7754,8 +7891,10 @@ printers.h: $(mpers_preproc_files) native_printer_decls.h native_printer_defs.h: mpers_PREFIX = @HAVE_M32_MPERS_TRUE@$(mpers_m32_targets): mpers_NAME = m32 +@HAVE_M32_MPERS_TRUE@$(mpers_m32_targets): mpers_CC_FLAGS = @cc_flags_m32@ @HAVE_MX32_MPERS_TRUE@$(mpers_mx32_targets): mpers_NAME = mx32 +@HAVE_MX32_MPERS_TRUE@$(mpers_mx32_targets): mpers_CC_FLAGS = @cc_flags_mx32@ clean-local: -rm -rf mpers-m32 mpers-mx32 @@ -1,3 +1,76 @@ +Noteworthy changes in release 4.21 (2018-02-13) +=============================================== + +* Changes in behaviour + * Warning is now issued when -F option is used. + * Warning is now issued when a tracee with unsupported personality + is attached. + * Unknown syscall numbers are now printed in hexadecimal form. + +* Improvements + * Implemented decoding of netlink descriptor attributes as file descriptors. + * Implemented decoding of hugetlb page size selection flags. + * Implemented decoding of BPF_PROG_TEST_RUN, BPF_PROG_GET_NEXT_ID, + BPF_MAP_GET_NEXT_ID, BPF_PROG_GET_FD_BY_ID, BPF_MAP_GET_FD_BY_ID, + and BPF_OBJ_GET_INFO_BY_FD commands of bpf syscall. + * Enhanced decoding of get_thread_area, memfd_create, modify_ldt, + perf_event_open, reboot, s390_guarded_storage, s390_pcio_mmio_read, + s390_pci_mmio_write, s390_runtime_instr, s390_sthyi, set_thread_area, + and shmget syscalls. + * Implemented decoding of KVM_* and DM_LIST_DEVICES ioctl commands. + * Implemented decoding of riscv_flush_icache syscall. + * Enhanced decoding of getsockopt and setsockopt syscalls for SOL_NETLINK + level. + * Enhanced decoding of BPF_MAP_CREATE command of bpf syscall. + * Print values returned by mq_open syscall and first arguments + of mq_getsetattr, mq_notify, mq_timedreceive, and mq_timedsend syscalls + as file descriptors. + * Added decoding of get_tls syscall on arm. + * Added -e trace=%pure option for tracing system calls with no arguments that + never fail. + * Updated lists of IPV6_*, MAP_*, MEMBARRIER_CMD_*, MSG_*, NT_*, PKEY_*, + SHM_*, and TCP_* constants. + * Added manual page for the strace-log-merge command. + * Updated lists of ioctl commands from Linux 4.15. + * Implemented biarch support for s390x. + * Implemented an optional support for symbol demangling in strace -k output + (activated by --with-libiberty configure option). + * Information about availability of demangling and reliable personality + decoding (on architectures with multiple personalities) is now available + in strace -V output. + * Added decoding of pkey_alloc, pkey_free, and pkey_mprotect syscalls on + powerpc and powerpc64. + * Enhanced manual page. + +* Bug fixes + * Fixed multi-personality support in cross builds. + * Added mq_getsetattr, mq_notify, mq_open, mq_timedreceive, and mq_timedsend + syscalls to %desc tracing set. + * Fixed path tracing support for mmap syscalls with indirect arguments and + for old select syscall. + * Fixed decoding of arm-specific (__ARM_NR_*) syscalls. + * Fixed open mode flags decoding. + * Fixed corner cases in handling of strace -ff -ttt logs by strace-log-merge. + * Error counts that exceed one billion are now printed correctly in call + summary output. + * Fixed call summary header for x32 personality. + * Changes of tracee personalities are reported more reliably. + * Fixed the case when strace attaches to a tracee being inside exec and its + first syscall stop is syscall-exit-stop instead of syscall-enter-stop, + which messed up all the syscall state tracking. + * Fixed printing of higher 32 bits of the return value for x32 personality. + +* Portability + * A C compiler that supports "for" loop initial declarations is now required. + * Inability to configure multiple personality support on architectures where + multiple personalities are supported leads to configuration failure during + build now. Use --enable-mpers=check to revert to the old behaviour. + * Build-time requirement for the mpers support has been lowered from gawk 4 + to gawk 3. + * Removed incomplete and non-functional support for the CRIS architecture. + * Removed incomplete and unused support for IA-32 mode on the IA-64 + architecture. + Noteworthy changes in release 4.20 (2017-11-13) =============================================== @@ -1204,7 +1204,6 @@ m4_include([m4/ax_code_coverage.m4]) m4_include([m4/ax_prog_cc_for_build.m4]) m4_include([m4/ax_valgrind_check.m4]) m4_include([m4/mpers.m4]) -m4_include([m4/st_bpf.m4]) m4_include([m4/st_save_restore_var.m4]) m4_include([m4/st_warn_cflags.m4]) m4_include([m4/warnings.m4]) @@ -1,5 +1,6 @@ /* * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,6 +30,8 @@ #ifdef ALPHA +# include "xstring.h" + static int decode_getxxid(struct tcb *tcp, const char *what) { @@ -40,7 +43,7 @@ decode_getxxid(struct tcb *tcp, const char *what) return 0; static const char const fmt[] = "%s %ld"; static char outstr[sizeof(fmt) + 3 * sizeof(rval)]; - snprintf(outstr, sizeof(outstr), fmt, what, rval); + xsprintf(outstr, fmt, what, rval); tcp->auxstr = outstr; return RVAL_STR; } diff --git a/arch_defs.h b/arch_defs.h new file mode 100644 index 00000000..8844151c --- /dev/null +++ b/arch_defs.h @@ -0,0 +1,8 @@ +/* Aarch-specific definitions. */ +#ifndef STRACE_ARCH_DEFS_H +#define STRACE_ARCH_DEFS_H + +#include "arch_defs_.h" +#include "linux/arch_defs_.h" + +#endif /* !STRACE_ARCH_DEFS_H */ diff --git a/basic_filters.c b/basic_filters.c index 7b7f0a54..4ea23b54 100644 --- a/basic_filters.c +++ b/basic_filters.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,13 +38,11 @@ qualify_syscall_number(const char *s, struct number_set *set) if (n < 0) return false; - unsigned int p; bool done = false; - for (p = 0; p < SUPPORTED_PERSONALITIES; ++p) { - if ((unsigned) n >= nsyscall_vec[p]) { + for (unsigned int p = 0; p < SUPPORTED_PERSONALITIES; ++p) { + if ((unsigned) n >= nsyscall_vec[p]) continue; - } add_number_to_set_array(n, set, p); done = true; } @@ -71,12 +69,10 @@ qualify_syscall_regex(const char *s, struct number_set *set) if ((rc = regcomp(&preg, s, REG_EXTENDED | REG_NOSUB)) != 0) regerror_msg_and_die(rc, &preg, "regcomp", s); - unsigned int p; bool found = false; - for (p = 0; p < SUPPORTED_PERSONALITIES; ++p) { - unsigned int i; - for (i = 0; i < nsyscall_vec[p]; ++i) { + for (unsigned int p = 0; p < SUPPORTED_PERSONALITIES; ++p) { + for (unsigned int i = 0; i < nsyscall_vec[p]; ++i) { if (!sysent_vec[p][i].sys_name) continue; rc = regexec(&preg, sysent_vec[p][i].sys_name, @@ -101,13 +97,6 @@ lookup_class(const char *s) const char *name; unsigned int value; } syscall_class[] = { - { "desc", TRACE_DESC }, - { "file", TRACE_FILE }, - { "memory", TRACE_MEMORY }, - { "process", TRACE_PROCESS }, - { "signal", TRACE_SIGNAL }, - { "ipc", TRACE_IPC }, - { "network", TRACE_NETWORK }, { "%desc", TRACE_DESC }, { "%file", TRACE_FILE }, { "%memory", TRACE_MEMORY }, @@ -122,13 +111,20 @@ lookup_class(const char *s) { "%statfs", TRACE_STATFS }, { "%fstatfs", TRACE_FSTATFS }, { "%%statfs", TRACE_STATFS_LIKE }, + { "%pure", TRACE_PURE }, + /* legacy class names */ + { "desc", TRACE_DESC }, + { "file", TRACE_FILE }, + { "memory", TRACE_MEMORY }, + { "process", TRACE_PROCESS }, + { "signal", TRACE_SIGNAL }, + { "ipc", TRACE_IPC }, + { "network", TRACE_NETWORK }, }; - unsigned int i; - for (i = 0; i < ARRAY_SIZE(syscall_class); ++i) { - if (strcmp(s, syscall_class[i].name) == 0) { + for (unsigned int i = 0; i < ARRAY_SIZE(syscall_class); ++i) { + if (strcmp(s, syscall_class[i].name) == 0) return syscall_class[i].value; - } } return 0; @@ -141,37 +137,42 @@ qualify_syscall_class(const char *s, struct number_set *set) if (!n) return false; - unsigned int p; - for (p = 0; p < SUPPORTED_PERSONALITIES; ++p) { - unsigned int i; - - for (i = 0; i < nsyscall_vec[p]; ++i) { - if (!sysent_vec[p][i].sys_name - || (sysent_vec[p][i].sys_flags & n) != n) { - continue; - } - add_number_to_set_array(i, set, p); + for (unsigned int p = 0; p < SUPPORTED_PERSONALITIES; ++p) { + for (unsigned int i = 0; i < nsyscall_vec[p]; ++i) { + if (sysent_vec[p][i].sys_name && + (sysent_vec[p][i].sys_flags & n) == n) + add_number_to_set_array(i, set, p); } } return true; } +kernel_long_t +scno_by_name(const char *s, unsigned int p, kernel_long_t start) +{ + if (p >= SUPPORTED_PERSONALITIES) + return -1; + + for (kernel_ulong_t i = start; i < nsyscall_vec[p]; ++i) { + if (sysent_vec[p][i].sys_name && + strcmp(s, sysent_vec[p][i].sys_name) == 0) + return i; + } + + return -1; +} + static bool qualify_syscall_name(const char *s, struct number_set *set) { - unsigned int p; bool found = false; - for (p = 0; p < SUPPORTED_PERSONALITIES; ++p) { - unsigned int i; - - for (i = 0; i < nsyscall_vec[p]; ++i) { - if (!sysent_vec[p][i].sys_name - || strcmp(s, sysent_vec[p][i].sys_name)) { - continue; - } - add_number_to_set_array(i, set, p); + for (unsigned int p = 0; p < SUPPORTED_PERSONALITIES; ++p) { + for (kernel_long_t scno = 0; + (scno = scno_by_name(s, p, scno)) >= 0; + ++scno) { + add_number_to_set_array(scno, set, p); found = true; } } @@ -202,8 +203,7 @@ qualify_syscall(const char *token, struct number_set *set) * according to STR specification. */ void -qualify_syscall_tokens(const char *const str, struct number_set *const set, - const char *const name) +qualify_syscall_tokens(const char *const str, struct number_set *const set) { /* Clear all sets. */ clear_number_set_array(set, SUPPORTED_PERSONALITIES); @@ -213,7 +213,6 @@ qualify_syscall_tokens(const char *const str, struct number_set *const set, * of the remaining specification. */ const char *s = str; -handle_inversion: while (*s == '!') { invert_number_set_array(set, SUPPORTED_PERSONALITIES); ++s; @@ -227,8 +226,9 @@ handle_inversion: */ return; } else if (strcmp(s, "all") == 0) { - s = "!none"; - goto handle_inversion; + /* "all" == "!none" */ + invert_number_set_array(set, SUPPORTED_PERSONALITIES); + return; } /* @@ -240,22 +240,19 @@ handle_inversion: */ char *copy = xstrdup(s); char *saveptr = NULL; - const char *token; bool done = false; - for (token = strtok_r(copy, ",", &saveptr); token; - token = strtok_r(NULL, ",", &saveptr)) { + for (const char *token = strtok_r(copy, ",", &saveptr); + token; token = strtok_r(NULL, ",", &saveptr)) { done = qualify_syscall(token, set); - if (!done) { - error_msg_and_die("invalid %s '%s'", name, token); - } + if (!done) + error_msg_and_die("invalid system call '%s'", token); } free(copy); - if (!done) { - error_msg_and_die("invalid %s '%s'", name, str); - } + if (!done) + error_msg_and_die("invalid system call '%s'", str); } /* @@ -273,7 +270,6 @@ qualify_tokens(const char *const str, struct number_set *const set, * of the remaining specification. */ const char *s = str; -handle_inversion: while (*s == '!') { invert_number_set_array(set, 1); ++s; @@ -287,8 +283,9 @@ handle_inversion: */ return; } else if (strcmp(s, "all") == 0) { - s = "!none"; - goto handle_inversion; + /* "all" == "!none" */ + invert_number_set_array(set, 1); + return; } /* @@ -300,22 +297,19 @@ handle_inversion: */ char *copy = xstrdup(s); char *saveptr = NULL; - const char *token; int number = -1; - for (token = strtok_r(copy, ",", &saveptr); token; - token = strtok_r(NULL, ",", &saveptr)) { + for (const char *token = strtok_r(copy, ",", &saveptr); + token; token = strtok_r(NULL, ",", &saveptr)) { number = func(token); - if (number < 0) { + if (number < 0) error_msg_and_die("invalid %s '%s'", name, token); - } add_number_to_set(number, set); } free(copy); - if (number < 0) { + if (number < 0) error_msg_and_die("invalid %s '%s'", name, str); - } } @@ -90,7 +90,7 @@ DEF_BPF_CMD_DECODER(BPF_MAP_CREATE) { struct { uint32_t map_type, key_size, value_size, max_entries, - map_flags, inner_map_fd; + map_flags, inner_map_fd, numa_node; } attr = {}; const unsigned int len = size < sizeof(attr) ? size : sizeof(attr); @@ -103,6 +103,8 @@ DEF_BPF_CMD_DECODER(BPF_MAP_CREATE) PRINT_FIELD_U(", ", attr, max_entries); PRINT_FIELD_FLAGS(", ", attr, map_flags, bpf_map_flags, "BPF_F_???"); PRINT_FIELD_FD(", ", attr, inner_map_fd, tcp); + if (attr.map_flags & BPF_F_NUMA_NODE) + PRINT_FIELD_U(", ", attr, numa_node); decode_attr_extra_data(tcp, data, size, sizeof(attr)); tprints("}"); @@ -278,6 +280,105 @@ DEF_BPF_CMD_DECODER(BPF_PROG_DETACH) return RVAL_DECODED; } +DEF_BPF_CMD_DECODER(BPF_PROG_TEST_RUN) +{ + struct { + uint32_t prog_fd, retval, data_size_in, data_size_out; + uint64_t ATTRIBUTE_ALIGNED(8) data_in, data_out; + uint32_t repeat, duration; + } attr = {}; + const unsigned int len = size < sizeof(attr) ? size : sizeof(attr); + + memcpy(&attr, data, len); + + PRINT_FIELD_FD("{test={", attr, prog_fd, tcp); + PRINT_FIELD_U(", ", attr, retval); + PRINT_FIELD_U(", ", attr, data_size_in); + PRINT_FIELD_U(", ", attr, data_size_out); + PRINT_FIELD_X(", ", attr, data_in); + PRINT_FIELD_X(", ", attr, data_out); + PRINT_FIELD_U(", ", attr, repeat); + PRINT_FIELD_U(", ", attr, duration); + tprints("}"); + decode_attr_extra_data(tcp, data, size, sizeof(attr)); + tprints("}"); + + return RVAL_DECODED; +} + +DEF_BPF_CMD_DECODER(BPF_PROG_GET_NEXT_ID) +{ + struct { + uint32_t start_id, next_id; + } attr = {}; + const unsigned int len = size < sizeof(attr) ? size : sizeof(attr); + + memcpy(&attr, data, len); + + PRINT_FIELD_U("{", attr, start_id); + PRINT_FIELD_U(", ", attr, next_id); + decode_attr_extra_data(tcp, data, size, sizeof(attr)); + tprints("}"); + + return RVAL_DECODED; +} + +#define decode_BPF_MAP_GET_NEXT_ID decode_BPF_PROG_GET_NEXT_ID + +DEF_BPF_CMD_DECODER(BPF_PROG_GET_FD_BY_ID) +{ + struct { + uint32_t prog_id, next_id; + } attr = {}; + const unsigned int len = size < sizeof(attr) ? size : sizeof(attr); + + memcpy(&attr, data, len); + + PRINT_FIELD_U("{", attr, prog_id); + PRINT_FIELD_U(", ", attr, next_id); + decode_attr_extra_data(tcp, data, size, sizeof(attr)); + tprints("}"); + + return RVAL_DECODED; +} + +DEF_BPF_CMD_DECODER(BPF_MAP_GET_FD_BY_ID) +{ + struct { + uint32_t map_id, next_id; + } attr = {}; + const unsigned int len = size < sizeof(attr) ? size : sizeof(attr); + + memcpy(&attr, data, len); + + PRINT_FIELD_U("{", attr, map_id); + PRINT_FIELD_U(", ", attr, next_id); + decode_attr_extra_data(tcp, data, size, sizeof(attr)); + tprints("}"); + + return RVAL_DECODED; +} + +DEF_BPF_CMD_DECODER(BPF_OBJ_GET_INFO_BY_FD) +{ + struct { + uint32_t bpf_fd, info_len; + uint64_t ATTRIBUTE_ALIGNED(8) info; + } attr = {}; + const unsigned int len = size < sizeof(attr) ? size : sizeof(attr); + + memcpy(&attr, data, len); + + PRINT_FIELD_FD("{info={", attr, bpf_fd, tcp); + PRINT_FIELD_U(", ", attr, info_len); + PRINT_FIELD_X(", ", attr, info); + tprints("}"); + decode_attr_extra_data(tcp, data, size, sizeof(attr)); + tprints("}"); + + return RVAL_DECODED | RVAL_FD; +} + SYS_FUNC(bpf) { static const bpf_cmd_decoder_t bpf_cmd_decoders[] = { @@ -291,6 +392,12 @@ SYS_FUNC(bpf) BPF_CMD_ENTRY(BPF_OBJ_GET), BPF_CMD_ENTRY(BPF_PROG_ATTACH), BPF_CMD_ENTRY(BPF_PROG_DETACH), + BPF_CMD_ENTRY(BPF_PROG_TEST_RUN), + BPF_CMD_ENTRY(BPF_PROG_GET_NEXT_ID), + BPF_CMD_ENTRY(BPF_MAP_GET_NEXT_ID), + BPF_CMD_ENTRY(BPF_PROG_GET_FD_BY_ID), + BPF_CMD_ENTRY(BPF_MAP_GET_FD_BY_ID), + BPF_CMD_ENTRY(BPF_OBJ_GET_INFO_BY_FD), }; const unsigned int cmd = tcp->u_arg[0]; @@ -1,6 +1,6 @@ /* * Copyright (c) 2016 Jeff Mahoney <jeffm@suse.com> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -787,7 +787,7 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl, char uuid[UUID_STRING_SIZE+1]; uint32_t nodesize, sectorsize, clone_alignment; #ifndef HAVE_STRUCT_BTRFS_IOCTL_FS_INFO_ARGS_NODESIZE - __u32 *reserved32; + uint32_t *reserved32; #endif if (entering(tcp)) @@ -802,7 +802,7 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl, sectorsize = args.sectorsize, clone_alignment = args.clone_alignment; #else - reserved32 = (__u32 *) (void *) args.reserved; + reserved32 = (void *) args.reserved; nodesize = reserved32[0]; sectorsize = reserved32[1]; clone_alignment = reserved32[2]; @@ -4,7 +4,7 @@ * Copyright (c) 2008 Jan Kratochvil <jan.kratochvil@redhat.com> * Copyright (c) 2009-2013 Denys Vlasenko <dvlasenk@redhat.com> * Copyright (c) 2006-2015 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2014-2017 The strace developers. + * Copyright (c) 2014-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,7 +49,7 @@ # define ARG_PTID (tcp->scno == __NR_clone2 ? 3 : 2) # define ARG_CTID (tcp->scno == __NR_clone2 ? 4 : 3) # define ARG_TLS (tcp->scno == __NR_clone2 ? 5 : 4) -#elif defined S390 || defined S390X || defined CRISV10 || defined CRISV32 +#elif defined S390 || defined S390X # define ARG_STACK 0 # define ARG_FLAGS 1 # define ARG_PTID 2 @@ -84,7 +84,7 @@ print_tls_arg(struct tcb *const tcp, const kernel_ulong_t addr) if (current_personality == 1) # endif { - print_user_desc(tcp, tcp->u_arg[ARG_TLS]); + print_user_desc(tcp, tcp->u_arg[ARG_TLS], USER_DESC_BOTH); } # if SUPPORTED_PERSONALITIES > 1 else @@ -26,13 +26,7 @@ /* #undef BFIN */ /* Current copyright year. */ -#define COPYRIGHT_YEAR "2017" - -/* Define for the CRISv10 architecture. */ -/* #undef CRISV10 */ - -/* Define for the CRISv32 architecture. */ -/* #undef CRISV32 */ +#define COPYRIGHT_YEAR "2018" /* Define to 1 if you want OABI support on ARM EABI. */ #define ENABLE_ARM_OABI 0 @@ -43,6 +37,9 @@ /* Define to 1 if you have the <asm/cachectl.h> header file. */ /* #undef HAVE_ASM_CACHECTL_H */ +/* Define to 1 if you have the <asm/guarded_storage.h> header file. */ +/* #undef HAVE_ASM_GUARDED_STORAGE_H */ + /* Define to 1 if you have the <asm/sigcontext.h> header file. */ #define HAVE_ASM_SIGCONTEXT_H 1 @@ -646,6 +643,9 @@ 0 if you don't. */ #define HAVE_DECL_VM_VFS_CACHE_PRESSURE 1 +/* Define to 1 if you have the <demangle.h> header file. */ +/* #undef HAVE_DEMANGLE_H */ + /* Define to 1 if the system provides dladdr */ #define HAVE_DLADDR 1 @@ -685,12 +685,21 @@ /* Define to 1 if you have the <gnu/stubs-x32.h> header file. */ /* #undef HAVE_GNU_STUBS_X32_H */ +/* Define to 1 if you have the <iconv.h> header file. */ +/* #undef HAVE_ICONV_H */ + +/* Define to 1 if you have the `iconv_open' function. */ +/* #undef HAVE_ICONV_OPEN */ + /* Define to 1 if you have the `if_indextoname' function. */ #define HAVE_IF_INDEXTONAME 1 /* Define to 1 if you have the <inttypes.h> header file. */ #define HAVE_INTTYPES_H 1 +/* Define to 1 if you have the <libiberty/demangle.h> header file. */ +/* #undef HAVE_LIBIBERTY_DEMANGLE_H */ + /* Define to 1 if you have the <libunwind-ptrace.h> header file. */ /* #undef HAVE_LIBUNWIND_PTRACE_H */ @@ -745,6 +754,12 @@ /* Define to 1 if you have the <linux/kcmp.h> header file. */ #define HAVE_LINUX_KCMP_H 1 +/* Define to 1 if you have the <linux/kvm.h> header file. */ +#define HAVE_LINUX_KVM_H 1 + +/* Define to 1 if you have the <linux/memfd.h> header file. */ +#define HAVE_LINUX_MEMFD_H 1 + /* Define to 1 if you have the <linux/mmtimer.h> header file. */ #define HAVE_LINUX_MMTIMER_H 1 @@ -841,7 +856,7 @@ /* Define to 1 if you have the <linux/utsname.h> header file. */ #define HAVE_LINUX_UTSNAME_H 1 -/* Define to 1 if you have CFLAG mpers support */ +/* Define to 1 if you have mpers_name mpers support */ /* #undef HAVE_M32_MPERS */ /* Define to 1 if MPERS_NAME has the type 'struct stat'. */ @@ -863,7 +878,7 @@ /* Define to 1 if you have the <mqueue.h> header file. */ /* #undef HAVE_MQUEUE_H */ -/* Define to 1 if you have CFLAG mpers support */ +/* Define to 1 if you have mpers_name mpers support */ /* #undef HAVE_MX32_MPERS */ /* Define to 1 if MPERS_NAME has the type 'struct stat'. */ @@ -894,6 +909,9 @@ /* Define to 1 if you have the `open64' function. */ #define HAVE_OPEN64 1 +/* Define to 1 if you have the <paths.h> header file. */ +#define HAVE_PATHS_H 1 + /* Define to 1 if you have the `prctl' function. */ #define HAVE_PRCTL 1 @@ -1048,9 +1066,22 @@ /* Define to 1 if the system has the type `struct keyctl_kdf_params'. */ #define HAVE_STRUCT_KEYCTL_KDF_PARAMS 1 +/* Define to 1 if the system has the type `struct kvm_regs'. */ +#define HAVE_STRUCT_KVM_REGS 1 + +/* Define to 1 if the system has the type `struct kvm_sregs'. */ +#define HAVE_STRUCT_KVM_SREGS 1 + +/* Define to 1 if the system has the type `struct + kvm_userspace_memory_region'. */ +#define HAVE_STRUCT_KVM_USERSPACE_MEMORY_REGION 1 + /* Define to 1 if the system has the type `struct mmsghdr'. */ #define HAVE_STRUCT_MMSGHDR 1 +/* Define to 1 if the system has the type `struct mtd_write_req'. */ +#define HAVE_STRUCT_MTD_WRITE_REQ 1 + /* Define to 1 if the system has the type `struct ndt_config'. */ #define HAVE_STRUCT_NDT_CONFIG 1 @@ -1105,6 +1136,9 @@ /* Define to 1 if `mmap_data' is a member of `struct perf_event_attr'. */ #define HAVE_STRUCT_PERF_EVENT_ATTR_MMAP_DATA 1 +/* Define to 1 if `namespaces' is a member of `struct perf_event_attr'. */ +#define HAVE_STRUCT_PERF_EVENT_ATTR_NAMESPACES 1 + /* Define to 1 if `precise_ip' is a member of `struct perf_event_attr'. */ #define HAVE_STRUCT_PERF_EVENT_ATTR_PRECISE_IP 1 @@ -1133,6 +1167,9 @@ /* Define to 1 if `write_backward' is a member of `struct perf_event_attr'. */ #define HAVE_STRUCT_PERF_EVENT_ATTR_WRITE_BACKWARD 1 +/* Define to 1 if the system has the type `struct ptp_sys_offset'. */ +#define HAVE_STRUCT_PTP_SYS_OFFSET 1 + /* Define to 1 if the system has the type `struct ptrace_peeksiginfo_args'. */ #define HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS 1 @@ -1202,9 +1239,15 @@ /* Define to 1 if `tai' is a member of `struct timex'. */ #define HAVE_STRUCT_TIMEX_TAI 1 +/* Define to 1 if `max_beb_per1024' is a member of `struct ubi_attach_req'. */ +/* #undef HAVE_STRUCT_UBI_ATTACH_REQ_MAX_BEB_PER1024 */ + /* Define to 1 if the system has the type `struct user_desc'. */ /* #undef HAVE_STRUCT_USER_DESC */ +/* Define to 1 if `lm' is a member of `struct user_desc'. */ +/* #undef HAVE_STRUCT_USER_DESC_LM */ + /* Define to 1 if `domainname' is a member of `struct utsname'. */ #define HAVE_STRUCT_UTSNAME_DOMAINNAME 1 @@ -1268,21 +1311,30 @@ /* Define to 1 if typeof works with your compiler. */ #define HAVE_TYPEOF 1 -/* Define to 1 if attr_text initialization works */ +/* Define to 1 if `attach_flags' is a member of `union bpf_attr'. */ #define HAVE_UNION_BPF_ATTR_ATTACH_FLAGS 1 -/* Define to 1 if attr_text initialization works */ +/* Define to 1 if `bpf_fd' is a member of `union bpf_attr'. */ #define HAVE_UNION_BPF_ATTR_BPF_FD 1 -/* Define to 1 if attr_text initialization works */ +/* Define to 1 if `flags' is a member of `union bpf_attr'. */ #define HAVE_UNION_BPF_ATTR_FLAGS 1 -/* Define to 1 if attr_text initialization works */ -#define HAVE_UNION_BPF_ATTR_INNER_MAP_FD 1 +/* Define to 1 if `info.info' is a member of `union bpf_attr'. */ +/* #undef HAVE_UNION_BPF_ATTR_INFO_INFO */ + +/* Define to 1 if `next_id' is a member of `union bpf_attr'. */ +/* #undef HAVE_UNION_BPF_ATTR_NEXT_ID */ + +/* Define to 1 if `numa_node' is a member of `union bpf_attr'. */ +/* #undef HAVE_UNION_BPF_ATTR_NUMA_NODE */ -/* Define to 1 if attr_text initialization works */ +/* Define to 1 if `prog_flags' is a member of `union bpf_attr'. */ #define HAVE_UNION_BPF_ATTR_PROG_FLAGS 1 +/* Define to 1 if `test.duration' is a member of `union bpf_attr'. */ +#define HAVE_UNION_BPF_ATTR_TEST_DURATION 1 + /* Define to 1 if you have the <unistd.h> header file. */ #define HAVE_UNISTD_H 1 @@ -1329,7 +1381,7 @@ /* #undef M68K */ /* Date */ -#define MANPAGE_DATE "2017-08-28" +#define MANPAGE_DATE "2018-02-11" /* Define for the Meta architecture. */ /* #undef METAG */ @@ -1362,7 +1414,7 @@ #define PACKAGE_NAME "strace" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "strace 4.20" +#define PACKAGE_STRING "strace 4.21" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "strace" @@ -1371,7 +1423,7 @@ #define PACKAGE_URL "https://strace.io" /* Define to the version of this package. */ -#define PACKAGE_VERSION "4.20" +#define PACKAGE_VERSION "4.21" /* Define for the PowerPC architecture. */ /* #undef POWERPC */ @@ -1417,6 +1469,9 @@ /* Define for the Tile architecture */ /* #undef TILE */ +/* Do demangling symbols in stack trace */ +/* #undef USE_DEMANGLE */ + /* Compile stack tracing functionality */ /* #undef USE_LIBUNWIND */ @@ -1443,7 +1498,7 @@ /* Version number of package */ -#define VERSION "4.20" +#define VERSION "4.21" /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ diff --git a/config.h.in b/config.h.in index 77a73357..1fd4ab88 100644 --- a/config.h.in +++ b/config.h.in @@ -30,12 +30,6 @@ /* Current copyright year. */ #undef COPYRIGHT_YEAR -/* Define for the CRISv10 architecture. */ -#undef CRISV10 - -/* Define for the CRISv32 architecture. */ -#undef CRISV32 - /* Define to 1 if you want OABI support on ARM EABI. */ #undef ENABLE_ARM_OABI @@ -45,6 +39,9 @@ /* Define to 1 if you have the <asm/cachectl.h> header file. */ #undef HAVE_ASM_CACHECTL_H +/* Define to 1 if you have the <asm/guarded_storage.h> header file. */ +#undef HAVE_ASM_GUARDED_STORAGE_H + /* Define to 1 if you have the <asm/sigcontext.h> header file. */ #undef HAVE_ASM_SIGCONTEXT_H @@ -648,6 +645,9 @@ 0 if you don't. */ #undef HAVE_DECL_VM_VFS_CACHE_PRESSURE +/* Define to 1 if you have the <demangle.h> header file. */ +#undef HAVE_DEMANGLE_H + /* Define to 1 if the system provides dladdr */ #undef HAVE_DLADDR @@ -687,12 +687,21 @@ /* Define to 1 if you have the <gnu/stubs-x32.h> header file. */ #undef HAVE_GNU_STUBS_X32_H +/* Define to 1 if you have the <iconv.h> header file. */ +#undef HAVE_ICONV_H + +/* Define to 1 if you have the `iconv_open' function. */ +#undef HAVE_ICONV_OPEN + /* Define to 1 if you have the `if_indextoname' function. */ #undef HAVE_IF_INDEXTONAME /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H +/* Define to 1 if you have the <libiberty/demangle.h> header file. */ +#undef HAVE_LIBIBERTY_DEMANGLE_H + /* Define to 1 if you have the <libunwind-ptrace.h> header file. */ #undef HAVE_LIBUNWIND_PTRACE_H @@ -747,6 +756,12 @@ /* Define to 1 if you have the <linux/kcmp.h> header file. */ #undef HAVE_LINUX_KCMP_H +/* Define to 1 if you have the <linux/kvm.h> header file. */ +#undef HAVE_LINUX_KVM_H + +/* Define to 1 if you have the <linux/memfd.h> header file. */ +#undef HAVE_LINUX_MEMFD_H + /* Define to 1 if you have the <linux/mmtimer.h> header file. */ #undef HAVE_LINUX_MMTIMER_H @@ -843,7 +858,7 @@ /* Define to 1 if you have the <linux/utsname.h> header file. */ #undef HAVE_LINUX_UTSNAME_H -/* Define to 1 if you have CFLAG mpers support */ +/* Define to 1 if you have mpers_name mpers support */ #undef HAVE_M32_MPERS /* Define to 1 if MPERS_NAME has the type 'struct stat'. */ @@ -865,7 +880,7 @@ /* Define to 1 if you have the <mqueue.h> header file. */ #undef HAVE_MQUEUE_H -/* Define to 1 if you have CFLAG mpers support */ +/* Define to 1 if you have mpers_name mpers support */ #undef HAVE_MX32_MPERS /* Define to 1 if MPERS_NAME has the type 'struct stat'. */ @@ -896,6 +911,9 @@ /* Define to 1 if you have the `open64' function. */ #undef HAVE_OPEN64 +/* Define to 1 if you have the <paths.h> header file. */ +#undef HAVE_PATHS_H + /* Define to 1 if you have the `prctl' function. */ #undef HAVE_PRCTL @@ -1050,9 +1068,22 @@ /* Define to 1 if the system has the type `struct keyctl_kdf_params'. */ #undef HAVE_STRUCT_KEYCTL_KDF_PARAMS +/* Define to 1 if the system has the type `struct kvm_regs'. */ +#undef HAVE_STRUCT_KVM_REGS + +/* Define to 1 if the system has the type `struct kvm_sregs'. */ +#undef HAVE_STRUCT_KVM_SREGS + +/* Define to 1 if the system has the type `struct + kvm_userspace_memory_region'. */ +#undef HAVE_STRUCT_KVM_USERSPACE_MEMORY_REGION + /* Define to 1 if the system has the type `struct mmsghdr'. */ #undef HAVE_STRUCT_MMSGHDR +/* Define to 1 if the system has the type `struct mtd_write_req'. */ +#undef HAVE_STRUCT_MTD_WRITE_REQ + /* Define to 1 if the system has the type `struct ndt_config'. */ #undef HAVE_STRUCT_NDT_CONFIG @@ -1107,6 +1138,9 @@ /* Define to 1 if `mmap_data' is a member of `struct perf_event_attr'. */ #undef HAVE_STRUCT_PERF_EVENT_ATTR_MMAP_DATA +/* Define to 1 if `namespaces' is a member of `struct perf_event_attr'. */ +#undef HAVE_STRUCT_PERF_EVENT_ATTR_NAMESPACES + /* Define to 1 if `precise_ip' is a member of `struct perf_event_attr'. */ #undef HAVE_STRUCT_PERF_EVENT_ATTR_PRECISE_IP @@ -1135,6 +1169,9 @@ /* Define to 1 if `write_backward' is a member of `struct perf_event_attr'. */ #undef HAVE_STRUCT_PERF_EVENT_ATTR_WRITE_BACKWARD +/* Define to 1 if the system has the type `struct ptp_sys_offset'. */ +#undef HAVE_STRUCT_PTP_SYS_OFFSET + /* Define to 1 if the system has the type `struct ptrace_peeksiginfo_args'. */ #undef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS @@ -1204,9 +1241,15 @@ /* Define to 1 if `tai' is a member of `struct timex'. */ #undef HAVE_STRUCT_TIMEX_TAI +/* Define to 1 if `max_beb_per1024' is a member of `struct ubi_attach_req'. */ +#undef HAVE_STRUCT_UBI_ATTACH_REQ_MAX_BEB_PER1024 + /* Define to 1 if the system has the type `struct user_desc'. */ #undef HAVE_STRUCT_USER_DESC +/* Define to 1 if `lm' is a member of `struct user_desc'. */ +#undef HAVE_STRUCT_USER_DESC_LM + /* Define to 1 if `domainname' is a member of `struct utsname'. */ #undef HAVE_STRUCT_UTSNAME_DOMAINNAME @@ -1270,21 +1313,30 @@ /* Define to 1 if typeof works with your compiler. */ #undef HAVE_TYPEOF -/* Define to 1 if attr_text initialization works */ +/* Define to 1 if `attach_flags' is a member of `union bpf_attr'. */ #undef HAVE_UNION_BPF_ATTR_ATTACH_FLAGS -/* Define to 1 if attr_text initialization works */ +/* Define to 1 if `bpf_fd' is a member of `union bpf_attr'. */ #undef HAVE_UNION_BPF_ATTR_BPF_FD -/* Define to 1 if attr_text initialization works */ +/* Define to 1 if `flags' is a member of `union bpf_attr'. */ #undef HAVE_UNION_BPF_ATTR_FLAGS -/* Define to 1 if attr_text initialization works */ -#undef HAVE_UNION_BPF_ATTR_INNER_MAP_FD +/* Define to 1 if `info.info' is a member of `union bpf_attr'. */ +#undef HAVE_UNION_BPF_ATTR_INFO_INFO + +/* Define to 1 if `next_id' is a member of `union bpf_attr'. */ +#undef HAVE_UNION_BPF_ATTR_NEXT_ID + +/* Define to 1 if `numa_node' is a member of `union bpf_attr'. */ +#undef HAVE_UNION_BPF_ATTR_NUMA_NODE -/* Define to 1 if attr_text initialization works */ +/* Define to 1 if `prog_flags' is a member of `union bpf_attr'. */ #undef HAVE_UNION_BPF_ATTR_PROG_FLAGS +/* Define to 1 if `test.duration' is a member of `union bpf_attr'. */ +#undef HAVE_UNION_BPF_ATTR_TEST_DURATION + /* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H @@ -1423,6 +1475,9 @@ /* Define for the Tile architecture */ #undef TILE +/* Do demangling symbols in stack trace */ +#undef USE_DEMANGLE + /* Compile stack tracing functionality */ #undef USE_LIBUNWIND @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for strace 4.20. +# Generated by GNU Autoconf 2.69 for strace 4.21. # # Report bugs to <strace-devel@lists.sourceforge.net>. # @@ -11,7 +11,7 @@ # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # -# Copyright (c) 1999-2017 The strace developers. +# Copyright (c) 1999-2018 The strace developers. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## @@ -582,8 +582,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='strace' PACKAGE_TARNAME='strace' -PACKAGE_VERSION='4.20' -PACKAGE_STRING='strace 4.20' +PACKAGE_VERSION='4.21' +PACKAGE_STRING='strace 4.21' PACKAGE_BUGREPORT='strace-devel@lists.sourceforge.net' PACKAGE_URL='https://strace.io' @@ -647,14 +647,25 @@ HAVE_M32_MPERS_FALSE HAVE_M32_MPERS_TRUE HAVE_M32_RUNTIME_FALSE HAVE_M32_RUNTIME_TRUE +USE_DEMANGLE_FALSE +USE_DEMANGLE_TRUE +libiberty_CPPFLAGS +libiberty_LDFLAGS +libiberty_LIBS USE_LIBUNWIND_FALSE USE_LIBUNWIND_TRUE libunwind_CPPFLAGS libunwind_LDFLAGS libunwind_LIBS +READELF PERL dl_LIBS +SIZEOF_KERNEL_LONG_T +SIZEOF_LONG MIPS_ABI +arch_native +cc_flags_mx32 +cc_flags_m32 arch_mx32 arch_m32 arch @@ -793,6 +804,8 @@ with_gcov enable_code_coverage enable_arm_oabi with_libunwind +with_libiberty +enable_mpers enable_valgrind enable_valgrind_memcheck enable_valgrind_helgrind @@ -1348,7 +1361,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures strace 4.20 to adapt to many kinds of systems. +\`configure' configures strace 4.21 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1418,7 +1431,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of strace 4.20:";; + short | recursive ) echo "Configuration of strace 4.21:";; esac cat <<\_ACEOF @@ -1438,6 +1451,11 @@ Optional Features: --enable-gcc-Werror turn on gcc's -Werror option --enable-code-coverage Whether to enable code coverage support --enable-arm-oabi enable OABI support on ARM EABI + --enable-mpers=yes|no|check|m32|mx32 + whether to enable multiple personalities support + required for proper decoding of structures used by + tracees with personalities that differ from the + personality of strace, default is yes. --enable-valgrind Whether to enable Valgrind on the unit tests --disable-valgrind-memcheck Whether to skip memcheck during the Valgrind tests @@ -1452,6 +1470,7 @@ Optional Packages: --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-gcov=GCOV use given GCOV for coverage (GCOV=gcov). --with-libunwind use libunwind to implement stack tracing support + --with-libiberty use libiberty to demangle symbols in stack trace Some influential environment variables: CC C compiler command @@ -1530,14 +1549,14 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -strace configure 4.20 +strace configure 4.21 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. -Copyright (c) 1999-2017 The strace developers. +Copyright (c) 1999-2018 The strace developers. _ACEOF exit fi @@ -2270,7 +2289,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by strace $as_me 4.20, which was +It was created by strace $as_me 4.21, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3141,7 +3160,7 @@ fi # Define the identity of the package. PACKAGE='strace' - VERSION='4.20' + VERSION='4.21' cat >>confdefs.h <<_ACEOF @@ -4372,6 +4391,298 @@ else fi + case $ac_cv_prog_cc_stdc in #( + no) : + ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; #( + *) : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 +$as_echo_n "checking for $CC option to accept ISO C99... " >&6; } +if ${ac_cv_prog_cc_c99+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdarg.h> +#include <stdbool.h> +#include <stdlib.h> +#include <wchar.h> +#include <stdio.h> + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +#define debug(...) fprintf (stderr, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + your preprocessor is broken; +#endif +#if BIG_OK +#else + your preprocessor is broken; +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\0'; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static void +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str; + int number; + float fnumber; + + while (*format) + { + switch (*format++) + { + case 's': // string + str = va_arg (args_copy, const char *); + break; + case 'd': // int + number = va_arg (args_copy, int); + break; + case 'f': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); +} + +int +main () +{ + + // Check bool. + _Bool success = false; + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + test_varargs ("s, d' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' + || dynamic_array[ni.number - 1] != 543); + + ; + return 0; +} +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c99" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c99" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +$as_echo "$ac_cv_prog_cc_c99" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c99" != xno; then : + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdarg.h> +#include <stdio.h> +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 +else + ac_cv_prog_cc_stdc=no +fi + +fi + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO Standard C" >&5 +$as_echo_n "checking for $CC option to accept ISO Standard C... " >&6; } + if ${ac_cv_prog_cc_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +fi + + case $ac_cv_prog_cc_stdc in #( + no) : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; #( + '') : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; #( + *) : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_stdc" >&5 +$as_echo "$ac_cv_prog_cc_stdc" >&6; } ;; +esac + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -8510,28 +8821,67 @@ A''M_DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage -$as_echo "#define COPYRIGHT_YEAR \"2017\"" >>confdefs.h +$as_echo "#define COPYRIGHT_YEAR \"2018\"" >>confdefs.h -COPYRIGHT_YEAR=2017 +COPYRIGHT_YEAR=2018 -$as_echo "#define MANPAGE_DATE \"2017-08-28\"" >>confdefs.h +$as_echo "#define MANPAGE_DATE \"2018-02-11\"" >>confdefs.h -MANPAGE_DATE=2017-08-28 +MANPAGE_DATE=2018-02-11 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for supported architecture" >&5 $as_echo_n "checking for supported architecture... " >&6; } arch_m32= arch_mx32= +cc_flags_m32=-m32 +cc_flags_mx32=-mx32 case "$host_cpu" in +aarch64*) + arch=aarch64 + arch_m32=arm + +$as_echo "#define AARCH64 1" >>confdefs.h + + ;; +alpha*) + arch=alpha + +$as_echo "#define ALPHA 1" >>confdefs.h + + ;; +arc*) + arch=arc + +$as_echo "#define ARC 1" >>confdefs.h + + ;; +arm*) + arch=arm + +$as_echo "#define ARM 1" >>confdefs.h + + ;; +avr32*) + arch=avr32 + +$as_echo "#define AVR32 1" >>confdefs.h + + ;; bfin) arch=bfin $as_echo "#define BFIN 1" >>confdefs.h ;; +hppa*|parisc*) + arch=hppa + +$as_echo "#define HPPA 1" >>confdefs.h + + ;; i[3456]86|pentium) arch=i386 @@ -8550,35 +8900,34 @@ m68k) $as_echo "#define M68K 1" >>confdefs.h ;; -sparc64*) - arch=sparc64 - arch_m32=sparc - -$as_echo "#define SPARC64 1" >>confdefs.h - - ;; -sparc*) - arch=sparc - -$as_echo "#define SPARC 1" >>confdefs.h - - ;; metag*) arch=metag $as_echo "#define METAG 1" >>confdefs.h ;; +microblaze*) + arch=microblaze + +$as_echo "#define MICROBLAZE 1" >>confdefs.h + + ;; mips*) arch=mips $as_echo "#define MIPS 1" >>confdefs.h ;; -alpha*) - arch=alpha +nios2*) + arch=nios2 -$as_echo "#define ALPHA 1" >>confdefs.h +$as_echo "#define NIOS2 1" >>confdefs.h + + ;; +or1k*) + arch=or1k + +$as_echo "#define OR1K 1" >>confdefs.h ;; powerpc*) @@ -8611,29 +8960,10 @@ $as_echo "#define POWERPC64 1" >>confdefs.h fi ;; -arm*) - arch=arm - -$as_echo "#define ARM 1" >>confdefs.h - - ;; -aarch64*) - arch=aarch64 - arch_m32=arm - -$as_echo "#define AARCH64 1" >>confdefs.h - - ;; -avr32*) - arch=avr32 - -$as_echo "#define AVR32 1" >>confdefs.h - - ;; -arc*) - arch=arc +riscv*) + arch=riscv -$as_echo "#define ARC 1" >>confdefs.h +$as_echo "#define RISCV 1" >>confdefs.h ;; s390) @@ -8644,16 +8974,12 @@ $as_echo "#define S390 1" >>confdefs.h ;; s390x) arch=s390x + arch_m32=s390 + cc_flags_m32=-m31 $as_echo "#define S390X 1" >>confdefs.h ;; -hppa*|parisc*) - arch=hppa - -$as_echo "#define HPPA 1" >>confdefs.h - - ;; sh64*) arch=sh64 @@ -8666,6 +8992,25 @@ sh*) $as_echo "#define SH 1" >>confdefs.h ;; +sparc64*) + arch=sparc64 + arch_m32=sparc + +$as_echo "#define SPARC64 1" >>confdefs.h + + ;; +sparc*) + arch=sparc + +$as_echo "#define SPARC 1" >>confdefs.h + + ;; +tile*) + arch=tile + +$as_echo "#define TILE 1" >>confdefs.h + + ;; x86?64*) arch_m32=i386 cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -8698,58 +9043,12 @@ $as_echo "#define X32 1" >>confdefs.h fi ;; -cris|crisv10) - arch=crisv10 - -$as_echo "#define CRISV10 1" >>confdefs.h - - ;; -crisv32) - arch=crisv32 - -$as_echo "#define CRISV32 1" >>confdefs.h - - ;; -tile*) - arch=tile - -$as_echo "#define TILE 1" >>confdefs.h - - ;; -microblaze*) - arch=microblaze - -$as_echo "#define MICROBLAZE 1" >>confdefs.h - - ;; -nios2*) - arch=nios2 - -$as_echo "#define NIOS2 1" >>confdefs.h - - ;; - -or1k*) - arch=or1k - -$as_echo "#define OR1K 1" >>confdefs.h - - ;; - xtensa*) arch=xtensa $as_echo "#define XTENSA 1" >>confdefs.h ;; - -riscv*) - arch=riscv - -$as_echo "#define RISCV 1" >>confdefs.h - - ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: NO!" >&5 $as_echo "NO!" >&6; } @@ -8759,6 +9058,8 @@ esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $arch" >&5 $as_echo "$arch" >&6; } +arch_native=$arch + test -n "$arch_m32" || arch_m32=$arch test -n "$arch_mx32" || @@ -8767,6 +9068,9 @@ test -n "$arch_mx32" || + + + MIPS_ABI= if test "$arch" = mips; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _MIPS_SIM" >&5 @@ -8777,7 +9081,10 @@ else if ac_fn_c_compute_int "$LINENO" "_MIPS_SIM" "st_cv__MIPS_SIM" ""; then : else - as_fn_error $? "_MIPS_SIM cannot be determined" "$LINENO" 5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "_MIPS_SIM cannot be determined +See \`config.log' for more details" "$LINENO" 5; } fi fi @@ -9187,7 +9494,7 @@ $as_echo "#define gid_t int" >>confdefs.h fi -for ac_func in accept4 be64toh fallocate fanotify_mark fopen64 fork fputs_unlocked fstatat ftruncate futimens if_indextoname open64 prctl preadv process_vm_readv pwritev readahead signalfd stpcpy strerror strndup strsignal sync_file_range utimensat +for ac_func in accept4 be64toh fallocate fanotify_mark fopen64 fork fputs_unlocked fstatat ftruncate futimens iconv_open if_indextoname open64 prctl preadv process_vm_readv pwritev readahead signalfd stpcpy strerror strndup strsignal sync_file_range utimensat do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -9288,6 +9595,16 @@ cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_USER_DESC 1 _ACEOF +ac_fn_c_check_member "$LINENO" "struct user_desc" "lm" "ac_cv_member_struct_user_desc_lm" "#include <asm/ldt.h> +" +if test "x$ac_cv_member_struct_user_desc_lm" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_USER_DESC_LM 1 +_ACEOF + + +fi fi @@ -9646,6 +9963,16 @@ _ACEOF fi +ac_fn_c_check_member "$LINENO" "struct perf_event_attr" "namespaces" "ac_cv_member_struct_perf_event_attr_namespaces" "#include <linux/perf_event.h> +" +if test "x$ac_cv_member_struct_perf_event_attr_namespaces" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_PERF_EVENT_ATTR_NAMESPACES 1 +_ACEOF + + +fi ac_fn_c_check_member "$LINENO" "struct perf_event_attr" "bp_type" "ac_cv_member_struct_perf_event_attr_bp_type" "#include <linux/perf_event.h> " if test "x$ac_cv_member_struct_perf_event_attr_bp_type" = xyes; then : @@ -9738,7 +10065,7 @@ _ACEOF fi -for ac_header in asm/cachectl.h asm/sysmips.h bluetooth/bluetooth.h elf.h inttypes.h linux/bsg.h linux/cryptouser.h linux/dm-ioctl.h linux/dqblk_xfs.h linux/falloc.h linux/fib_rules.h linux/fiemap.h linux/genetlink.h linux/hiddev.h linux/if_addr.h linux/if_link.h linux/ip_vs.h linux/ipc.h linux/kcmp.h linux/mmtimer.h linux/msg.h linux/neighbour.h linux/netfilter/ipset/ip_set.h linux/netfilter/nf_tables.h linux/netfilter/nf_tables_compat.h linux/netfilter/nfnetlink.h linux/netfilter/nfnetlink_acct.h linux/netfilter/nfnetlink_conntrack.h linux/netfilter/nfnetlink_cthelper.h linux/netfilter/nfnetlink_cttimeout.h linux/netfilter/nfnetlink_log.h linux/netfilter/nfnetlink_queue.h linux/nsfs.h linux/perf_event.h linux/quota.h linux/seccomp.h linux/securebits.h linux/sem.h linux/shm.h linux/userfaultfd.h linux/utsname.h mqueue.h netinet/sctp.h netipx/ipx.h scsi/sg.h stropts.h sys/conf.h sys/eventfd.h sys/fanotify.h sys/ipc.h sys/msg.h sys/quota.h sys/reg.h sys/sem.h sys/shm.h sys/signalfd.h sys/xattr.h ustat.h +for ac_header in asm/cachectl.h asm/guarded_storage.h asm/sysmips.h bluetooth/bluetooth.h elf.h iconv.h inttypes.h linux/bsg.h linux/cryptouser.h linux/dm-ioctl.h linux/dqblk_xfs.h linux/falloc.h linux/fib_rules.h linux/fiemap.h linux/genetlink.h linux/hiddev.h linux/if_addr.h linux/if_link.h linux/ip_vs.h linux/ipc.h linux/kcmp.h linux/kvm.h linux/memfd.h linux/mmtimer.h linux/msg.h linux/neighbour.h linux/netfilter/ipset/ip_set.h linux/netfilter/nf_tables.h linux/netfilter/nf_tables_compat.h linux/netfilter/nfnetlink.h linux/netfilter/nfnetlink_acct.h linux/netfilter/nfnetlink_conntrack.h linux/netfilter/nfnetlink_cthelper.h linux/netfilter/nfnetlink_cttimeout.h linux/netfilter/nfnetlink_log.h linux/netfilter/nfnetlink_queue.h linux/nsfs.h linux/perf_event.h linux/quota.h linux/seccomp.h linux/securebits.h linux/sem.h linux/shm.h linux/userfaultfd.h linux/utsname.h mqueue.h netinet/sctp.h netipx/ipx.h paths.h scsi/sg.h stropts.h sys/conf.h sys/eventfd.h sys/fanotify.h sys/ipc.h sys/msg.h sys/quota.h sys/reg.h sys/sem.h sys/shm.h sys/signalfd.h sys/xattr.h ustat.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -9859,215 +10186,86 @@ if test "x$ac_cv_header_linux_bpf_h" = xyes; then : #define HAVE_LINUX_BPF_H 1 _ACEOF + ac_fn_c_check_member "$LINENO" "union bpf_attr" "attach_flags" "ac_cv_member_union_bpf_attr_attach_flags" "#include <linux/bpf.h> +" +if test "x$ac_cv_member_union_bpf_attr_attach_flags" = xyes; then : - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether union bpf_attr.attach_flags initialization works" >&5 -$as_echo_n "checking whether union bpf_attr.attach_flags initialization works... " >&6; } -if ${st_cv_member_union_bpf_attr_attach_flags+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <linux/bpf.h> -int -main () -{ -union bpf_attr a = { .attach_flags = 0 }; - ; - return 0; -} +cat >>confdefs.h <<_ACEOF +#define HAVE_UNION_BPF_ATTR_ATTACH_FLAGS 1 _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - st_cv_member_union_bpf_attr_attach_flags=yes -else - st_cv_member_union_bpf_attr_attach_flags=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $st_cv_member_union_bpf_attr_attach_flags" >&5 -$as_echo "$st_cv_member_union_bpf_attr_attach_flags" >&6; } -if test $st_cv_member_union_bpf_attr_attach_flags = yes; then - -$as_echo "#define HAVE_UNION_BPF_ATTR_ATTACH_FLAGS 1" >>confdefs.h fi +ac_fn_c_check_member "$LINENO" "union bpf_attr" "bpf_fd" "ac_cv_member_union_bpf_attr_bpf_fd" "#include <linux/bpf.h> +" +if test "x$ac_cv_member_union_bpf_attr_bpf_fd" = xyes; then : - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether union bpf_attr.bpf_fd initialization works" >&5 -$as_echo_n "checking whether union bpf_attr.bpf_fd initialization works... " >&6; } -if ${st_cv_member_union_bpf_attr_bpf_fd+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <linux/bpf.h> -int -main () -{ -union bpf_attr a = { .bpf_fd = 0 }; - ; - return 0; -} +cat >>confdefs.h <<_ACEOF +#define HAVE_UNION_BPF_ATTR_BPF_FD 1 _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - st_cv_member_union_bpf_attr_bpf_fd=yes -else - st_cv_member_union_bpf_attr_bpf_fd=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $st_cv_member_union_bpf_attr_bpf_fd" >&5 -$as_echo "$st_cv_member_union_bpf_attr_bpf_fd" >&6; } -if test $st_cv_member_union_bpf_attr_bpf_fd = yes; then - -$as_echo "#define HAVE_UNION_BPF_ATTR_BPF_FD 1" >>confdefs.h fi +ac_fn_c_check_member "$LINENO" "union bpf_attr" "flags" "ac_cv_member_union_bpf_attr_flags" "#include <linux/bpf.h> +" +if test "x$ac_cv_member_union_bpf_attr_flags" = xyes; then : - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether union bpf_attr.flags initialization works" >&5 -$as_echo_n "checking whether union bpf_attr.flags initialization works... " >&6; } -if ${st_cv_member_union_bpf_attr_flags+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <linux/bpf.h> -int -main () -{ -union bpf_attr a = { .flags = 0 }; - ; - return 0; -} +cat >>confdefs.h <<_ACEOF +#define HAVE_UNION_BPF_ATTR_FLAGS 1 _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - st_cv_member_union_bpf_attr_flags=yes -else - st_cv_member_union_bpf_attr_flags=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $st_cv_member_union_bpf_attr_flags" >&5 -$as_echo "$st_cv_member_union_bpf_attr_flags" >&6; } - -if test $st_cv_member_union_bpf_attr_flags = yes; then -$as_echo "#define HAVE_UNION_BPF_ATTR_FLAGS 1" >>confdefs.h fi +ac_fn_c_check_member "$LINENO" "union bpf_attr" "info.info" "ac_cv_member_union_bpf_attr_info_info" "#include <linux/bpf.h> +" +if test "x$ac_cv_member_union_bpf_attr_info_info" = xyes; then : - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether union bpf_attr.inner_map_fd initialization works" >&5 -$as_echo_n "checking whether union bpf_attr.inner_map_fd initialization works... " >&6; } -if ${st_cv_member_union_bpf_attr_inner_map_fd+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <linux/bpf.h> -int -main () -{ -union bpf_attr a = { .inner_map_fd = 0 }; - ; - return 0; -} +cat >>confdefs.h <<_ACEOF +#define HAVE_UNION_BPF_ATTR_INFO_INFO 1 _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - st_cv_member_union_bpf_attr_inner_map_fd=yes -else - st_cv_member_union_bpf_attr_inner_map_fd=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $st_cv_member_union_bpf_attr_inner_map_fd" >&5 -$as_echo "$st_cv_member_union_bpf_attr_inner_map_fd" >&6; } -if test $st_cv_member_union_bpf_attr_inner_map_fd = yes; then - -$as_echo "#define HAVE_UNION_BPF_ATTR_INNER_MAP_FD 1" >>confdefs.h fi +ac_fn_c_check_member "$LINENO" "union bpf_attr" "next_id" "ac_cv_member_union_bpf_attr_next_id" "#include <linux/bpf.h> +" +if test "x$ac_cv_member_union_bpf_attr_next_id" = xyes; then : +cat >>confdefs.h <<_ACEOF +#define HAVE_UNION_BPF_ATTR_NEXT_ID 1 +_ACEOF +fi +ac_fn_c_check_member "$LINENO" "union bpf_attr" "numa_node" "ac_cv_member_union_bpf_attr_numa_node" "#include <linux/bpf.h> +" +if test "x$ac_cv_member_union_bpf_attr_numa_node" = xyes; then : +cat >>confdefs.h <<_ACEOF +#define HAVE_UNION_BPF_ATTR_NUMA_NODE 1 +_ACEOF - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether union bpf_attr.prog_flags initialization works" >&5 -$as_echo_n "checking whether union bpf_attr.prog_flags initialization works... " >&6; } -if ${st_cv_member_union_bpf_attr_prog_flags+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <linux/bpf.h> -int -main () -{ -union bpf_attr a = { .prog_flags = 0 }; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - st_cv_member_union_bpf_attr_prog_flags=yes -else - st_cv_member_union_bpf_attr_prog_flags=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $st_cv_member_union_bpf_attr_prog_flags" >&5 -$as_echo "$st_cv_member_union_bpf_attr_prog_flags" >&6; } +ac_fn_c_check_member "$LINENO" "union bpf_attr" "prog_flags" "ac_cv_member_union_bpf_attr_prog_flags" "#include <linux/bpf.h> +" +if test "x$ac_cv_member_union_bpf_attr_prog_flags" = xyes; then : -if test $st_cv_member_union_bpf_attr_prog_flags = yes; then +cat >>confdefs.h <<_ACEOF +#define HAVE_UNION_BPF_ATTR_PROG_FLAGS 1 +_ACEOF -$as_echo "#define HAVE_UNION_BPF_ATTR_PROG_FLAGS 1" >>confdefs.h fi +ac_fn_c_check_member "$LINENO" "union bpf_attr" "test.duration" "ac_cv_member_union_bpf_attr_test_duration" "#include <linux/bpf.h> +" +if test "x$ac_cv_member_union_bpf_attr_test_duration" = xyes; then : +cat >>confdefs.h <<_ACEOF +#define HAVE_UNION_BPF_ATTR_TEST_DURATION 1 +_ACEOF - +fi fi @@ -10456,6 +10654,74 @@ _ACEOF fi +ac_fn_c_check_type "$LINENO" "struct mtd_write_req" "ac_cv_type_struct_mtd_write_req" "#include <mtd/mtd-abi.h> +" +if test "x$ac_cv_type_struct_mtd_write_req" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_MTD_WRITE_REQ 1 +_ACEOF + + +fi + + +ac_fn_c_check_member "$LINENO" "struct ubi_attach_req" "max_beb_per1024" "ac_cv_member_struct_ubi_attach_req_max_beb_per1024" "#include <mtd/ubi-user.h> +" +if test "x$ac_cv_member_struct_ubi_attach_req_max_beb_per1024" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_UBI_ATTACH_REQ_MAX_BEB_PER1024 1 +_ACEOF + + +fi + + +ac_fn_c_check_type "$LINENO" "struct ptp_sys_offset" "ac_cv_type_struct_ptp_sys_offset" "#include <linux/ptp_clock.h> +" +if test "x$ac_cv_type_struct_ptp_sys_offset" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_PTP_SYS_OFFSET 1 +_ACEOF + + +fi + + +ac_fn_c_check_type "$LINENO" "struct kvm_regs" "ac_cv_type_struct_kvm_regs" "#include <linux/kvm.h> +" +if test "x$ac_cv_type_struct_kvm_regs" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_KVM_REGS 1 +_ACEOF + + +fi +ac_fn_c_check_type "$LINENO" "struct kvm_sregs" "ac_cv_type_struct_kvm_sregs" "#include <linux/kvm.h> +" +if test "x$ac_cv_type_struct_kvm_sregs" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_KVM_SREGS 1 +_ACEOF + + +fi +ac_fn_c_check_type "$LINENO" "struct kvm_userspace_memory_region" "ac_cv_type_struct_kvm_userspace_memory_region" "#include <linux/kvm.h> +" +if test "x$ac_cv_type_struct_kvm_userspace_memory_region" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_KVM_USERSPACE_MEMORY_REGION 1 +_ACEOF + + +fi + + for ac_header in linux/btrfs.h do : ac_fn_c_check_header_mongrel "$LINENO" "linux/btrfs.h" "ac_cv_header_linux_btrfs_h" "$ac_includes_default" @@ -12478,6 +12744,8 @@ cat >>confdefs.h <<_ACEOF _ACEOF +SIZEOF_LONG="$ac_cv_sizeof_long" + # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. @@ -12579,6 +12847,8 @@ cat >>confdefs.h <<_ACEOF _ACEOF +SIZEOF_KERNEL_LONG_T="$ac_cv_sizeof_kernel_long_t" + # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. @@ -12614,6 +12884,7 @@ _ACEOF + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SIGRTMIN" >&5 $as_echo_n "checking for SIGRTMIN... " >&6; } if ${st_cv_SIGRTMIN+:} false; then : @@ -12807,6 +13078,99 @@ fi +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}readelf", so it can be a program name with args. +set dummy ${ac_tool_prefix}readelf; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_READELF+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$READELF"; then + ac_cv_prog_READELF="$READELF" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_READELF="${ac_tool_prefix}readelf" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +READELF=$ac_cv_prog_READELF +if test -n "$READELF"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READELF" >&5 +$as_echo "$READELF" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_READELF"; then + ac_ct_READELF=$READELF + # Extract the first word of "readelf", so it can be a program name with args. +set dummy readelf; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_READELF+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_READELF"; then + ac_cv_prog_ac_ct_READELF="$ac_ct_READELF" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_READELF="readelf" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_READELF=$ac_cv_prog_ac_ct_READELF +if test -n "$ac_ct_READELF"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_READELF" >&5 +$as_echo "$ac_ct_READELF" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_READELF" = x; then + READELF="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + READELF=$ac_ct_READELF + fi +else + READELF="$ac_cv_prog_READELF" +fi + + libunwind_CPPFLAGS= libunwind_LDFLAGS= libunwind_LIBS= @@ -13024,19 +13388,153 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $use_libunwind" >&5 $as_echo "$use_libunwind" >&6; } +libiberty_CPPFLAGS= +libiberty_LDFLAGS= +libiberty_LIBS= + +# Check whether --with-libiberty was given. +if test "${with_libiberty+set}" = set; then : + withval=$with_libiberty; case "${withval}" in + yes|no|check) ;; + *) with_libiberty=yes + libiberty_CPPFLAGS="-I${withval}/include" + libiberty_LDFLAGS="-L${withval}/lib" ;; + esac +else + with_libiberty=check + +fi + + +use_libiberty=no +if test "x$use_libunwind" = xyes && test "x$with_libiberty" != xno; then : + saved_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $libiberty_CPPFLAGS" + for ac_header in demangle.h libiberty/demangle.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + saved_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $libiberty_LDFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cplus_demangle in -liberty" >&5 +$as_echo_n "checking for cplus_demangle in -liberty... " >&6; } +if ${ac_cv_lib_iberty_cplus_demangle+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-liberty $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char cplus_demangle (); +int +main () +{ +return cplus_demangle (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_iberty_cplus_demangle=yes +else + ac_cv_lib_iberty_cplus_demangle=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_iberty_cplus_demangle" >&5 +$as_echo "$ac_cv_lib_iberty_cplus_demangle" >&6; } +if test "x$ac_cv_lib_iberty_cplus_demangle" = xyes; then : + libiberty_LIBS="-liberty" + use_libiberty=yes + +else + if test "x$with_libiberty" != xcheck; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to find cplus_demangle in libiberty +See \`config.log' for more details" "$LINENO" 5; } + fi + + +fi + + LDFLAGS="$saved_LDFLAGS" + +else + if test "x$with_libiberty" != xcheck; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to find demangle.h +See \`config.log' for more details" "$LINENO" 5; } + fi + + +fi + +done + + CPPFLAGS="$saved_CPPFLAGS" + + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable demangling symbols in stack trace" >&5 +$as_echo_n "checking whether to enable demangling symbols in stack trace... " >&6; } +if test "x$use_libiberty" = xyes; then + +$as_echo "#define USE_DEMANGLE 1" >>confdefs.h + + + + +fi + if test "x$use_libiberty" = xyes; then + USE_DEMANGLE_TRUE= + USE_DEMANGLE_FALSE='#' +else + USE_DEMANGLE_TRUE='#' + USE_DEMANGLE_FALSE= +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $use_libiberty" >&5 +$as_echo "$use_libiberty" >&6; } + if test "$arch" = mips && test "$no_create" != yes; then mkdir -p linux/mips if $srcdir/linux/mips/genstub.sh linux/mips; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: Generated MIPS syscallent stubs" >&5 $as_echo "Generated MIPS syscallent stubs" >&6; } else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "Failed to generate syscallent stubs -See \`config.log' for more details" "$LINENO" 5; } + as_fn_error $? "Failed to generate syscallent stubs" "$LINENO" 5 fi fi +# Check whether --enable-mpers was given. +if test "${enable_mpers+set}" = set; then : + enableval=$enable_mpers; case "$enableval" in + yes|no|check|m32|mx32) enable_mpers="$enableval" ;; + *) as_fn_error $? "bad value $enableval for enable-mpers option. + Valid options are: yes, no, check, m32, mx32." "$LINENO" 5 + ;; + esac +else + enable_mpers=yes +fi + + @@ -13049,7 +13547,10 @@ fi case "$arch" in - aarch64|powerpc64|sparc64|tile|x32|x86_64) + aarch64|powerpc64|riscv|s390x|sparc64|tile|x32|x86_64) + case "$enable_mpers" in + yes|check|m32) + @@ -13073,9 +13574,9 @@ done saved_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -m32 $IFLAG" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -m32 compile support" >&5 -$as_echo_n "checking for -m32 compile support... " >&6; } + CFLAGS="$CFLAGS $cc_flags_m32 $IFLAG" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for m32 personality compile support" >&5 +$as_echo_n "checking for m32 personality compile support... " >&6; } if ${st_cv_m32_cc+:} false; then : $as_echo_n "(cached) " >&6 else @@ -13094,8 +13595,8 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $st_cv_m32_cc" >&5 $as_echo "$st_cv_m32_cc" >&6; } if test $st_cv_m32_cc = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -m32 runtime support" >&5 -$as_echo_n "checking for -m32 runtime support... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for m32 personality runtime support" >&5 +$as_echo_n "checking for m32 personality runtime support... " >&6; } if ${st_cv_m32_runtime+:} false; then : $as_echo_n "(cached) " >&6 else @@ -13119,13 +13620,14 @@ fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $st_cv_m32_runtime" >&5 $as_echo "$st_cv_m32_runtime" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mpers.sh -m32 works" >&5 -$as_echo_n "checking whether mpers.sh -m32 works... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mpers.sh m32 $cc_flags_m32 works" >&5 +$as_echo_n "checking whether mpers.sh m32 $cc_flags_m32 works... " >&6; } if ${st_cv_m32_mpers+:} false; then : $as_echo_n "(cached) " >&6 else - if CC="$CC" CPP="$CPP" CPPFLAGS="$CPPFLAGS" \ - $srcdir/mpers_test.sh m32; then + if READELF="$READELF" \ + CC="$CC" CPP="$CPP" CPPFLAGS="$CPPFLAGS" \ + $srcdir/mpers_test.sh m32 $cc_flags_m32; then st_cv_m32_mpers=yes else st_cv_m32_mpers=no @@ -13479,7 +13981,27 @@ fi CFLAGS="$saved_CFLAGS" ;; - *) + *) # case "$enable_mpers" + st_cv_m32_runtime=no + st_cv_m32_mpers=no + ;; + esac + + test "$st_cv_m32_mpers" = yes || + st_cv_m32_mpers=no + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable m32 personality support" >&5 +$as_echo_n "checking whether to enable m32 personality support... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $st_cv_m32_mpers" >&5 +$as_echo "$st_cv_m32_mpers" >&6; } + + case "$enable_mpers,$st_cv_m32_mpers" in + yes,no|m32,no) + as_fn_error $? "Cannot enable m32 personality support" "$LINENO" 5 + ;; + esac + ;; + + *) # case "$arch" st_cv_m32_runtime=no st_cv_m32_mpers=no ;; @@ -13525,6 +14047,9 @@ fi case "$arch" in x86_64) + case "$enable_mpers" in + yes|check|mx32) + @@ -13548,9 +14073,9 @@ done saved_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -mx32 $IFLAG" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -mx32 compile support" >&5 -$as_echo_n "checking for -mx32 compile support... " >&6; } + CFLAGS="$CFLAGS $cc_flags_mx32 $IFLAG" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mx32 personality compile support" >&5 +$as_echo_n "checking for mx32 personality compile support... " >&6; } if ${st_cv_mx32_cc+:} false; then : $as_echo_n "(cached) " >&6 else @@ -13569,8 +14094,8 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $st_cv_mx32_cc" >&5 $as_echo "$st_cv_mx32_cc" >&6; } if test $st_cv_mx32_cc = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -mx32 runtime support" >&5 -$as_echo_n "checking for -mx32 runtime support... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mx32 personality runtime support" >&5 +$as_echo_n "checking for mx32 personality runtime support... " >&6; } if ${st_cv_mx32_runtime+:} false; then : $as_echo_n "(cached) " >&6 else @@ -13594,13 +14119,14 @@ fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $st_cv_mx32_runtime" >&5 $as_echo "$st_cv_mx32_runtime" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mpers.sh -mx32 works" >&5 -$as_echo_n "checking whether mpers.sh -mx32 works... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mpers.sh mx32 $cc_flags_mx32 works" >&5 +$as_echo_n "checking whether mpers.sh mx32 $cc_flags_mx32 works... " >&6; } if ${st_cv_mx32_mpers+:} false; then : $as_echo_n "(cached) " >&6 else - if CC="$CC" CPP="$CPP" CPPFLAGS="$CPPFLAGS" \ - $srcdir/mpers_test.sh mx32; then + if READELF="$READELF" \ + CC="$CC" CPP="$CPP" CPPFLAGS="$CPPFLAGS" \ + $srcdir/mpers_test.sh mx32 $cc_flags_mx32; then st_cv_mx32_mpers=yes else st_cv_mx32_mpers=no @@ -13954,7 +14480,27 @@ fi CFLAGS="$saved_CFLAGS" ;; - *) + *) # case "$enable_mpers" + st_cv_mx32_runtime=no + st_cv_mx32_mpers=no + ;; + esac + + test "$st_cv_mx32_mpers" = yes || + st_cv_mx32_mpers=no + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable mx32 personality support" >&5 +$as_echo_n "checking whether to enable mx32 personality support... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $st_cv_mx32_mpers" >&5 +$as_echo "$st_cv_mx32_mpers" >&6; } + + case "$enable_mpers,$st_cv_mx32_mpers" in + yes,no|mx32,no) + as_fn_error $? "Cannot enable mx32 personality support" "$LINENO" 5 + ;; + esac + ;; + + *) # case "$arch" st_cv_mx32_runtime=no st_cv_mx32_mpers=no ;; @@ -14399,7 +14945,7 @@ MOSTLYCLEANFILES += $(valgrind_log_files) -ac_config_files="$ac_config_files Makefile tests/Makefile tests-m32/Makefile tests-mx32/Makefile strace.1 strace.spec debian/changelog" +ac_config_files="$ac_config_files Makefile tests/Makefile tests-m32/Makefile tests-mx32/Makefile strace.1 strace-log-merge.1 strace.spec debian/changelog" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -14551,6 +15097,10 @@ if test -z "${USE_LIBUNWIND_TRUE}" && test -z "${USE_LIBUNWIND_FALSE}"; then as_fn_error $? "conditional \"USE_LIBUNWIND\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${USE_DEMANGLE_TRUE}" && test -z "${USE_DEMANGLE_FALSE}"; then + as_fn_error $? "conditional \"USE_DEMANGLE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${HAVE_M32_RUNTIME_TRUE}" && test -z "${HAVE_M32_RUNTIME_FALSE}"; then as_fn_error $? "conditional \"HAVE_M32_RUNTIME\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -14968,7 +15518,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by strace $as_me 4.20, which was +This file was extended by strace $as_me 4.21, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15035,7 +15585,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -strace config.status 4.20 +strace config.status 4.21 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -15171,6 +15721,7 @@ do "tests-m32/Makefile") CONFIG_FILES="$CONFIG_FILES tests-m32/Makefile" ;; "tests-mx32/Makefile") CONFIG_FILES="$CONFIG_FILES tests-mx32/Makefile" ;; "strace.1") CONFIG_FILES="$CONFIG_FILES strace.1" ;; + "strace-log-merge.1") CONFIG_FILES="$CONFIG_FILES strace-log-merge.1" ;; "strace.spec") CONFIG_FILES="$CONFIG_FILES strace.spec" ;; "debian/changelog") CONFIG_FILES="$CONFIG_FILES debian/changelog" ;; diff --git a/configure.ac b/configure.ac index 29285dbf..86b8a8eb 100644 --- a/configure.ac +++ b/configure.ac @@ -5,7 +5,7 @@ # Copyright (c) 2006-2016 Dmitry V. Levin <ldv@altlinux.org> # Copyright (c) 2008-2015 Mike Frysinger <vapier@gentoo.org> # Copyright (c) 2015 Elvira Khabirova <lineprinter0@gmail.com> -# Copyright (c) 2002-2017 The strace developers. +# Copyright (c) 2002-2018 The strace developers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -52,6 +52,7 @@ DEB_CHANGELOGTIME="$(LC_TIME=C date -R)" AC_SUBST(DEB_CHANGELOGTIME) AC_PROG_CC +AC_PROG_CC_STDC AC_PROG_CPP st_WARN_CFLAGS AX_PROG_CC_FOR_BUILD @@ -70,11 +71,38 @@ AC_SUBST([MANPAGE_DATE], [manpage_date]) AC_MSG_CHECKING([for supported architecture]) arch_m32= arch_mx32= +cc_flags_m32=-m32 +cc_flags_mx32=-mx32 case "$host_cpu" in +aarch64*) + arch=aarch64 + arch_m32=arm + AC_DEFINE([AARCH64], 1, [Define for the AArch64 architecture.]) + ;; +alpha*) + arch=alpha + AC_DEFINE([ALPHA], 1, [Define for the Alpha architecture.]) + ;; +arc*) + arch=arc + AC_DEFINE([ARC], 1, [Define for the ARC architecture.]) + ;; +arm*) + arch=arm + AC_DEFINE([ARM], 1, [Define for the ARM architecture.]) + ;; +avr32*) + arch=avr32 + AC_DEFINE([AVR32], 1, [Define for the AVR32 architecture.]) + ;; bfin) arch=bfin AC_DEFINE([BFIN], 1, [Define for the Blackfin architecture.]) ;; +hppa*|parisc*) + arch=hppa + AC_DEFINE([HPPA], 1, [Define for the HPPA architecture.]) + ;; i[[3456]]86|pentium) arch=i386 AC_DEFINE([I386], 1, [Define for the i386 architecture.]) @@ -87,26 +115,25 @@ m68k) arch=m68k AC_DEFINE([M68K], 1, [Define for the m68k architecture.]) ;; -sparc64*) - arch=sparc64 - arch_m32=sparc - AC_DEFINE([SPARC64], 1, [Define for the SPARC64 architecture.]) - ;; -sparc*) - arch=sparc - AC_DEFINE([SPARC], 1, [Define for the SPARC architecture.]) - ;; metag*) arch=metag AC_DEFINE([METAG], 1, [Define for the Meta architecture.]) ;; +microblaze*) + arch=microblaze + AC_DEFINE([MICROBLAZE], 1, [Define for the MicroBlaze architecture.]) + ;; mips*) arch=mips AC_DEFINE([MIPS], 1, [Define for the MIPS architecture.]) ;; -alpha*) - arch=alpha - AC_DEFINE([ALPHA], 1, [Define for the Alpha architecture.]) +nios2*) + arch=nios2 + AC_DEFINE([NIOS2], 1, [Define for the Nios-II architecture.]) + ;; +or1k*) + arch=or1k + AC_DEFINE([OR1K], 1, [Define for the OpenRISC 1000 architecture.]) ;; powerpc*) AC_DEFINE([POWERPC], 1, [Define for the PowerPC architecture.]) @@ -119,22 +146,9 @@ powerpc*) AC_DEFINE([POWERPC64], 1, [Define for the PowerPC64 architecture.]) fi ;; -arm*) - arch=arm - AC_DEFINE([ARM], 1, [Define for the ARM architecture.]) - ;; -aarch64*) - arch=aarch64 - arch_m32=arm - AC_DEFINE([AARCH64], 1, [Define for the AArch64 architecture.]) - ;; -avr32*) - arch=avr32 - AC_DEFINE([AVR32], 1, [Define for the AVR32 architecture.]) - ;; -arc*) - arch=arc - AC_DEFINE([ARC], 1, [Define for the ARC architecture.]) +riscv*) + arch=riscv + AC_DEFINE([RISCV], 1, [Define for the RISC-V architecture]) ;; s390) arch=s390 @@ -142,12 +156,10 @@ s390) ;; s390x) arch=s390x + arch_m32=s390 + cc_flags_m32=-m31 AC_DEFINE([S390X], 1, [Define for the S390x architecture.]) ;; -hppa*|parisc*) - arch=hppa - AC_DEFINE([HPPA], 1, [Define for the HPPA architecture.]) - ;; sh64*) arch=sh64 AC_DEFINE([SH64], 1, [Define for the SH64 architecture.]) @@ -156,6 +168,19 @@ sh*) arch=sh AC_DEFINE([SH], 1, [Define for the SH architecture.]) ;; +sparc64*) + arch=sparc64 + arch_m32=sparc + AC_DEFINE([SPARC64], 1, [Define for the SPARC64 architecture.]) + ;; +sparc*) + arch=sparc + AC_DEFINE([SPARC], 1, [Define for the SPARC architecture.]) + ;; +tile*) + arch=tile + AC_DEFINE([TILE], 1, [Define for the Tile architecture]) + ;; x86?64*) arch_m32=i386 AC_TRY_COMPILE( @@ -169,42 +194,10 @@ x86?64*) AC_DEFINE([X32], 1, [Define for the 32bit AMD x86-64 architecture.]) fi ;; -cris|crisv10) - arch=crisv10 - AC_DEFINE([CRISV10], 1, [Define for the CRISv10 architecture.]) - ;; -crisv32) - arch=crisv32 - AC_DEFINE([CRISV32], 1, [Define for the CRISv32 architecture.]) - ;; -tile*) - arch=tile - AC_DEFINE([TILE], 1, [Define for the Tile architecture]) - ;; -microblaze*) - arch=microblaze - AC_DEFINE([MICROBLAZE], 1, [Define for the MicroBlaze architecture.]) - ;; -nios2*) - arch=nios2 - AC_DEFINE([NIOS2], 1, [Define for the Nios-II architecture.]) - ;; - -or1k*) - arch=or1k - AC_DEFINE([OR1K], 1, [Define for the OpenRISC 1000 architecture.]) - ;; - xtensa*) arch=xtensa AC_DEFINE([XTENSA], 1, [Define for the Xtensa architecture]) ;; - -riscv*) - arch=riscv - AC_DEFINE([RISCV], 1, [Define for the RISC-V architecture]) - ;; - *) AC_MSG_RESULT([NO!]) AC_MSG_ERROR([architecture $host_cpu is not supported by strace]) @@ -212,6 +205,8 @@ riscv*) esac AC_MSG_RESULT($arch) +arch_native=$arch + test -n "$arch_m32" || arch_m32=$arch test -n "$arch_mx32" || @@ -219,12 +214,15 @@ test -n "$arch_mx32" || AC_SUBST(arch) AC_SUBST(arch_m32) AC_SUBST(arch_mx32) +AC_SUBST(cc_flags_m32) +AC_SUBST(cc_flags_mx32) +AC_SUBST(arch_native) MIPS_ABI= if test "$arch" = mips; then AC_CACHE_CHECK([for _MIPS_SIM], [st_cv__MIPS_SIM], [AC_COMPUTE_INT([st_cv__MIPS_SIM], [_MIPS_SIM], , - [AC_MSG_ERROR([_MIPS_SIM cannot be determined])])]) + [AC_MSG_FAILURE([_MIPS_SIM cannot be determined])])]) # requires GCC >= 3.4 AC_CACHE_CHECK([for MIPS ABI], [st_cv_mips_abi], @@ -277,6 +275,7 @@ AC_CHECK_FUNCS(m4_normalize([ fstatat ftruncate futimens + iconv_open if_indextoname open64 prctl @@ -304,7 +303,10 @@ AC_CHECK_TYPES([struct stat64, struct __old_kernel_stat],,, [#include <sys/types.h> #include <asm/stat.h>]) -AC_CHECK_TYPES([struct user_desc],,, [#include <asm/ldt.h>]) +AC_CHECK_TYPES([struct user_desc], + [AC_CHECK_MEMBERS([struct user_desc.lm],,, + [#include <asm/ldt.h>])],, + [#include <asm/ldt.h>]) AC_CHECK_MEMBERS([struct stat.st_mtime_nsec, struct stat64.st_mtime_nsec],,, [#include <sys/types.h> @@ -364,6 +366,7 @@ AC_CHECK_MEMBERS(m4_normalize([ struct perf_event_attr.use_clockid, struct perf_event_attr.context_switch, struct perf_event_attr.write_backward, + struct perf_event_attr.namespaces, struct perf_event_attr.bp_type, struct perf_event_attr.config1, struct perf_event_attr.config2, @@ -377,9 +380,11 @@ AC_CHECK_MEMBERS(m4_normalize([ AC_CHECK_HEADERS(m4_normalize([ asm/cachectl.h + asm/guarded_storage.h asm/sysmips.h bluetooth/bluetooth.h elf.h + iconv.h inttypes.h linux/bsg.h linux/cryptouser.h @@ -395,6 +400,8 @@ AC_CHECK_HEADERS(m4_normalize([ linux/ip_vs.h linux/ipc.h linux/kcmp.h + linux/kvm.h + linux/memfd.h linux/mmtimer.h linux/msg.h linux/neighbour.h @@ -420,6 +427,7 @@ AC_CHECK_HEADERS(m4_normalize([ mqueue.h netinet/sctp.h netipx/ipx.h + paths.h scsi/sg.h stropts.h sys/conf.h @@ -458,11 +466,16 @@ AC_CHECK_HEADERS([linux/input.h], [ ]) AC_CHECK_HEADERS([linux/bpf.h], [ - st_CHECK_UNION_BPF_ATTR([attach_flags]) - st_CHECK_UNION_BPF_ATTR([bpf_fd]) - st_CHECK_UNION_BPF_ATTR([flags]) - st_CHECK_UNION_BPF_ATTR([inner_map_fd]) - st_CHECK_UNION_BPF_ATTR([prog_flags]) + AC_CHECK_MEMBERS(m4_normalize([ + union bpf_attr.attach_flags, + union bpf_attr.bpf_fd, + union bpf_attr.flags, + union bpf_attr.info.info, + union bpf_attr.next_id, + union bpf_attr.numa_node, + union bpf_attr.prog_flags, + union bpf_attr.test.duration + ]),,, [#include <linux/bpf.h>]) ]) AC_CHECK_TYPES(m4_normalize([ @@ -534,6 +547,20 @@ AC_CHECK_TYPES([struct statfs64], [ AC_CHECK_TYPES([struct blk_user_trace_setup],,, [#include <linux/blktrace_api.h>]) +AC_CHECK_TYPES([struct mtd_write_req],,, [#include <mtd/mtd-abi.h>]) + +AC_CHECK_MEMBERS([struct ubi_attach_req.max_beb_per1024],,, [#include <mtd/ubi-user.h>]) + +AC_CHECK_TYPES(m4_normalize([ + struct ptp_sys_offset +]),,, [#include <linux/ptp_clock.h>]) + +AC_CHECK_TYPES(m4_normalize([ + struct kvm_regs, + struct kvm_sregs, + struct kvm_userspace_memory_region +]),,, [#include <linux/kvm.h>]) + AC_CHECK_HEADERS([linux/btrfs.h], [ AC_CHECK_MEMBERS(m4_normalize([ struct btrfs_ioctl_feature_flags.compat_flags, @@ -728,11 +755,16 @@ AC_CACHE_CHECK([for BLKGETSIZE64], [ac_cv_have_blkgetsize64], fi) AC_CHECK_SIZEOF([long]) +SIZEOF_LONG="$ac_cv_sizeof_long" +AC_SUBST(SIZEOF_LONG) AC_CHECK_SIZEOF([long long]) AC_CHECK_SIZEOF([off_t],,[#include <sys/types.h>]) AC_CHECK_SIZEOF([kernel_long_t],,[#include "$srcdir/kernel_types.h"]) +SIZEOF_KERNEL_LONG_T="$ac_cv_sizeof_kernel_long_t" +AC_SUBST(SIZEOF_KERNEL_LONG_T) AC_CHECK_SIZEOF([struct i64_i32],,[struct i64_i32 {long long i64; int i32;};]) + AC_CACHE_CHECK([for SIGRTMIN], [st_cv_SIGRTMIN], [[st_cv_SIGRTMIN="$(echo SIGRTMIN | $CPP $CPPFLAGS -P -imacros asm/signal.h - | @@ -779,6 +811,8 @@ AC_SUBST(dl_LIBS) AC_PATH_PROG([PERL], [perl]) +AC_CHECK_TOOL([READELF], [readelf]) + dnl stack trace with libunwind libunwind_CPPFLAGS= libunwind_LDFLAGS= @@ -868,16 +902,84 @@ fi AM_CONDITIONAL([USE_LIBUNWIND], [test "x$use_libunwind" = xyes]) AC_MSG_RESULT([$use_libunwind]) +dnl demangling symbols in the stack trace +libiberty_CPPFLAGS= +libiberty_LDFLAGS= +libiberty_LIBS= +AC_ARG_WITH([libiberty], + [AS_HELP_STRING([--with-libiberty], + [use libiberty to demangle symbols in stack trace])], + [case "${withval}" in + yes|no|check) ;; + *) with_libiberty=yes + libiberty_CPPFLAGS="-I${withval}/include" + libiberty_LDFLAGS="-L${withval}/lib" ;; + esac], + [with_libiberty=check] +) + +use_libiberty=no +AS_IF([test "x$use_libunwind" = xyes && test "x$with_libiberty" != xno], + [saved_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $libiberty_CPPFLAGS" + AC_CHECK_HEADERS([demangle.h libiberty/demangle.h], + [saved_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $libiberty_LDFLAGS" + AC_CHECK_LIB([iberty],[cplus_demangle], + [libiberty_LIBS="-liberty" + use_libiberty=yes + ], + [if test "x$with_libiberty" != xcheck; then + AC_MSG_FAILURE([failed to find cplus_demangle in libiberty]) + fi + ] + ) + LDFLAGS="$saved_LDFLAGS" + ], + [if test "x$with_libiberty" != xcheck; then + AC_MSG_FAILURE([failed to find demangle.h]) + fi + ] + ) + CPPFLAGS="$saved_CPPFLAGS" + ] +) + +dnl enable libiberty +AC_MSG_CHECKING([whether to enable demangling symbols in stack trace]) +if test "x$use_libiberty" = xyes; then + AC_DEFINE([USE_DEMANGLE], 1, [Do demangling symbols in stack trace]) + AC_SUBST(libiberty_LIBS) + AC_SUBST(libiberty_LDFLAGS) + AC_SUBST(libiberty_CPPFLAGS) +fi +AM_CONDITIONAL([USE_DEMANGLE], [test "x$use_libiberty" = xyes]) +AC_MSG_RESULT([$use_libiberty]) + if test "$arch" = mips && test "$no_create" != yes; then mkdir -p linux/mips if $srcdir/linux/mips/genstub.sh linux/mips; then AC_MSG_RESULT([Generated MIPS syscallent stubs]) else - AC_MSG_FAILURE([Failed to generate syscallent stubs]) + AC_MSG_ERROR([Failed to generate syscallent stubs]) fi fi -st_MPERS([m32], [aarch64|powerpc64|sparc64|tile|x32|x86_64]) +AC_ARG_ENABLE([mpers], + [AS_HELP_STRING([--enable-mpers=yes|no|check|m32|mx32], + [whether to enable multiple personalities support required + for proper decoding of structures used by tracees with + personalities that differ from the personality of strace, + default is yes.])], + [case "$enableval" in + yes|no|check|m32|mx32) enable_mpers="$enableval" ;; + *) AC_MSG_ERROR([bad value $enableval for enable-mpers option. + Valid options are: yes, no, check, m32, mx32.]) + ;; + esac], + [enable_mpers=yes]) + +st_MPERS([m32], [aarch64|powerpc64|riscv|s390x|sparc64|tile|x32|x86_64]) st_MPERS([mx32], [x86_64]) AX_VALGRIND_DFLT([sgcheck], [off]) @@ -888,6 +990,7 @@ AC_CONFIG_FILES([Makefile tests-m32/Makefile tests-mx32/Makefile strace.1 + strace-log-merge.1 strace.spec debian/changelog]) AC_OUTPUT @@ -8,7 +8,7 @@ * <barrow_dj@mail.yahoo.com,djbarrow@de.ibm.com> * Copyright (c) 2004 Roland McGrath <roland@redhat.com> * Copyright (c) 2006 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2006-2017 The strace developers. + * Copyright (c) 2006-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,7 +40,7 @@ struct call_counts { /* time may be total latency or system time */ struct timeval time; - int calls, errors; + unsigned int calls, errors; }; static struct call_counts *countv[SUPPORTED_PERSONALITIES]; @@ -154,22 +154,24 @@ void set_overhead(int n) static void call_summary_pers(FILE *outf) { + static const char dashes[] = "----------------"; + static const char header[] = "%6.6s %11.11s %11.11s %9.9s %9.9s %s\n"; + static const char data[] = "%6.2f %11.6f %11lu %9u %9.u %s\n"; + static const char summary[] = "%6.6s %11.6f %11.11s %9u %9.u %s\n"; + unsigned int i; - int call_cum, error_cum; + unsigned int call_cum, error_cum; struct timeval tv_cum, dtv; double float_tv_cum; double percent; - const char *dashes = "----------------"; - char error_str[sizeof(int)*3]; - int *sorted_count; + unsigned int *sorted_count; - fprintf(outf, "%6.6s %11.11s %11.11s %9.9s %9.9s %s\n", + fprintf(outf, header, "% time", "seconds", "usecs/call", "calls", "errors", "syscall"); - fprintf(outf, "%6.6s %11.11s %11.11s %9.9s %9.9s %s\n", - dashes, dashes, dashes, dashes, dashes, dashes); + fprintf(outf, header, dashes, dashes, dashes, dashes, dashes, dashes); - sorted_count = xcalloc(sizeof(int), nsyscalls); + sorted_count = xcalloc(sizeof(sorted_count[0]), nsyscalls); call_cum = error_cum = tv_cum.tv_sec = tv_cum.tv_usec = 0; if (overhead.tv_sec == -1) { tv_mul(&overhead, &shortest, 8); @@ -188,39 +190,32 @@ call_summary_pers(FILE *outf) float_tv_cum = tv_float(&tv_cum); if (counts) { if (sortfun) - qsort((void *) sorted_count, nsyscalls, sizeof(int), sortfun); + qsort((void *) sorted_count, nsyscalls, + sizeof(sorted_count[0]), sortfun); for (i = 0; i < nsyscalls; i++) { double float_syscall_time; - int idx = sorted_count[i]; + unsigned int idx = sorted_count[i]; struct call_counts *cc = &counts[idx]; if (cc->calls == 0) continue; tv_div(&dtv, &cc->time, cc->calls); - error_str[0] = '\0'; - if (cc->errors) - sprintf(error_str, "%u", cc->errors); float_syscall_time = tv_float(&cc->time); percent = (100.0 * float_syscall_time); if (percent != 0.0) percent /= float_tv_cum; /* else: float_tv_cum can be 0.0 too and we get 0/0 = NAN */ - fprintf(outf, "%6.2f %11.6f %11lu %9u %9.9s %s\n", + fprintf(outf, data, percent, float_syscall_time, (long) (1000000 * dtv.tv_sec + dtv.tv_usec), - cc->calls, - error_str, sysent[idx].sys_name); + cc->calls, cc->errors, sysent[idx].sys_name); } } free(sorted_count); - fprintf(outf, "%6.6s %11.11s %11.11s %9.9s %9.9s %s\n", - dashes, dashes, dashes, dashes, dashes, dashes); - error_str[0] = '\0'; - if (error_cum) - sprintf(error_str, "%u", error_cum); - fprintf(outf, "%6.6s %11.6f %11.11s %9u %9.9s %s\n", + fprintf(outf, header, dashes, dashes, dashes, dashes, dashes, dashes); + fprintf(outf, summary, "100.00", float_tv_cum, "", - call_cum, error_str, "total"); + call_cum, error_cum, "total"); } void @@ -236,8 +231,8 @@ call_summary(FILE *outf) set_personality(i); if (i) fprintf(outf, - "System call usage summary for %d bit mode:\n", - current_wordsize * 8); + "System call usage summary for %s mode:\n", + personality_names[i]); call_summary_pers(outf); } diff --git a/debian/changelog b/debian/changelog index 25790441..19574cfe 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,14 @@ -strace (4.20-1) experimental; urgency=low +strace (4.21-1) experimental; urgency=low - * strace 4.20 snapshot. + * strace 4.21 snapshot. - -- Strace <strace-devel@lists.sourceforge.net> Mon, 13 Nov 2017 21:49:34 +0000 + -- Strace <strace-devel@lists.sourceforge.net> Tue, 13 Feb 2018 23:10:19 +0000 + +strace (4.20-1) unstable; urgency=medium + + * New upstream version. + + -- Dmitry V. Levin <ldv@altlinux.org> Mon, 13 Nov 2017 20:21:22 +0000 strace (4.19-1) unstable; urgency=medium diff --git a/debian/changelog.in b/debian/changelog.in index 16f34d86..02bf4b83 100644 --- a/debian/changelog.in +++ b/debian/changelog.in @@ -4,6 +4,12 @@ strace (@PACKAGE_VERSION@-1) experimental; urgency=low -- Strace <@PACKAGE_BUGREPORT@> @DEB_CHANGELOGTIME@ +strace (4.20-1) unstable; urgency=medium + + * New upstream version. + + -- Dmitry V. Levin <ldv@altlinux.org> Mon, 13 Nov 2017 20:21:22 +0000 + strace (4.19-1) unstable; urgency=medium * New upstream version. diff --git a/debian/control b/debian/control index 92cdc204..477b9d98 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: strace Maintainer: Steve McIntyre <93sam@debian.org> Section: utils Priority: optional -Build-Depends: libc6-dev (>= 2.2.2) [!alpha !ia64], libc6.1-dev (>= 2.2.2) [alpha ia64], gcc-multilib [amd64 i386 powerpc ppc64 s390 sparc sparc64 x32], debhelper (>= 7.0.0), gawk +Build-Depends: libc6-dev (>= 2.2.2) [!alpha !ia64], libc6.1-dev (>= 2.2.2) [alpha ia64], gcc-multilib [amd64 i386 powerpc ppc64 s390 sparc sparc64 x32], debhelper (>= 7.0.0), gawk, libunwind-dev [amd64], libiberty-dev [amd64] Standards-Version: 3.9.8 Homepage: https://strace.io Vcs-Git: https://anonscm.debian.org/git/collab-maint/strace.git diff --git a/debian/rules b/debian/rules index d03cd5ce..2ba864bf 100755 --- a/debian/rules +++ b/debian/rules @@ -23,6 +23,8 @@ DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) +extra_build_targets += build-udeb-stamp + arch64_map = i386=x86_64 powerpc=powerpc64 sparc=sparc64 s390=s390x ifneq (,$(filter $(DEB_HOST_ARCH)=%, $(arch64_map))) HOST64 = $(strip $(patsubst $(DEB_HOST_ARCH)=%, %, \ @@ -47,22 +49,28 @@ build-indep: build-stamp $(extra_build_targets) %-stamp: %/Makefile $(MAKE) -C $* ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS))) + $*/strace -V $(MAKE) -C $* check VERBOSE=1 endif touch $@ build/Makefile: mkdir -p $(@D) - cd $(@D); sh ../configure --prefix=/usr $(CONFIG_OPTS) + cd $(@D); sh ../configure --enable-mpers=check --prefix=/usr $(CONFIG_OPTS) + +build-udeb/Makefile: + mkdir -p $(@D) + cd $(@D); sh ../configure --enable-mpers=check --prefix=/usr \ + --without-libunwind --without-libiberty $(CONFIG_OPTS) build64/Makefile: mkdir -p $(@D) - cd $(@D); CC="$(CC64)" sh ../configure --prefix=/usr --build=$(DEB_BUILD_GNU_TYPE) --host=$(HOST64) + cd $(@D); CC="$(CC64)" sh ../configure --enable-mpers=check --prefix=/usr --build=$(DEB_BUILD_GNU_TYPE) --host=$(HOST64) clean: dh_testdir dh_testroot - rm -rf build build64 strace64.1 debian/strace64.substvars + rm -rf build build-udeb build64 strace64.1 debian/strace64.substvars dh_clean binary: binary-indep binary-arch diff --git a/debian/strace-udeb.install b/debian/strace-udeb.install index 1f419282..d823419a 100644 --- a/debian/strace-udeb.install +++ b/debian/strace-udeb.install @@ -1 +1 @@ -build/strace usr/bin +build-udeb/strace usr/bin diff --git a/debian/strace.install b/debian/strace.install index 1f419282..30b0a6b0 100644 --- a/debian/strace.install +++ b/debian/strace.install @@ -1 +1,2 @@ build/strace usr/bin +strace-log-merge usr/bin diff --git a/debian/strace.manpages b/debian/strace.manpages index 5e74dd72..d3b94482 100644 --- a/debian/strace.manpages +++ b/debian/strace.manpages @@ -1 +1,2 @@ strace.1 +strace-log-merge.1 @@ -2,7 +2,7 @@ * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl> * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl> * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com> - * Copyright (c) 2001-2017 The strace developers. + * Copyright (c) 2001-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,13 +53,13 @@ #include <time.h> #include <sys/time.h> +#include "arch_defs.h" #include "error_prints.h" #include "gcc_compat.h" #include "kernel_types.h" #include "macros.h" #include "mpers_type.h" #include "string_to_uint.h" -#include "supported_personalities.h" #include "sysent.h" #include "xmalloc.h" @@ -149,10 +149,12 @@ extern char *stpcpy(char *dst, const char *src); # define PERSONALITY1_INCLUDE_PRINTERS_DEFS "m32_printer_defs.h" # define PERSONALITY1_INCLUDE_FUNCS "m32_funcs.h" # define MPERS_m32_IOCTL_MACROS "ioctl_redefs1.h" +# define HAVE_PERSONALITY_1_MPERS 1 #else # define PERSONALITY1_INCLUDE_PRINTERS_DECLS "native_printer_decls.h" # define PERSONALITY1_INCLUDE_PRINTERS_DEFS "native_printer_defs.h" # define PERSONALITY1_INCLUDE_FUNCS "empty.h" +# define HAVE_PERSONALITY_1_MPERS 0 #endif #if SUPPORTED_PERSONALITIES > 2 && defined HAVE_MX32_MPERS @@ -160,10 +162,12 @@ extern char *stpcpy(char *dst, const char *src); # define PERSONALITY2_INCLUDE_PRINTERS_DECLS "mx32_printer_decls.h" # define PERSONALITY2_INCLUDE_PRINTERS_DEFS "mx32_printer_defs.h" # define MPERS_mx32_IOCTL_MACROS "ioctl_redefs2.h" +# define HAVE_PERSONALITY_2_MPERS 1 #else # define PERSONALITY2_INCLUDE_PRINTERS_DECLS "native_printer_decls.h" # define PERSONALITY2_INCLUDE_PRINTERS_DEFS "native_printer_defs.h" # define PERSONALITY2_INCLUDE_FUNCS "empty.h" +# define HAVE_PERSONALITY_2_MPERS 0 #endif typedef struct ioctlent { @@ -177,7 +181,7 @@ typedef struct ioctlent { struct inject_data { uint16_t flags; uint16_t signo; - int rval; + kernel_long_t rval; }; struct inject_opts { @@ -244,6 +248,10 @@ struct tcb { #define TCB_TAMPERED 0x40 /* A syscall has been tampered with */ #define TCB_HIDE_LOG 0x80 /* We should hide everything (until execve) */ #define TCB_SKIP_DETACH_ON_FIRST_EXEC 0x100 /* -b execve should skip detach on first execve */ +#define TCB_GRABBED 0x200 /* We grab the process and can catch it + * in the middle of a syscall */ +#define TCB_RECOVERING 0x400 /* We try to recover after detecting incorrect + * syscall entering/exiting state */ /* qualifier flags */ #define QUAL_TRACE 0x001 /* this system call should be traced */ @@ -264,6 +272,8 @@ struct tcb { #define inject(tcp) ((tcp)->qual_flg & QUAL_INJECT) #define filtered(tcp) ((tcp)->flags & TCB_FILTERED) #define hide_log(tcp) ((tcp)->flags & TCB_HIDE_LOG) +#define syscall_tampered(tcp) ((tcp)->flags & TCB_TAMPERED) +#define recovering(tcp) ((tcp)->flags & TCB_RECOVERING) #include "xlat.h" @@ -309,6 +319,10 @@ extern const struct xlat whence_codes[]; #define RVAL_DECODED 0100 /* syscall decoding finished */ #define RVAL_IOCTL_DECODED 0200 /* ioctl sub-parser successfully decoded the argument */ +#define RVAL_PRINT_ERR_VAL 0400 /* Print decoded error code along with + syscall return value. Needed for modify_ldt + that for some reason decides to return + an error with higher bits set to 0. */ #define IOCTL_NUMBER_UNKNOWN 0 #define IOCTL_NUMBER_HANDLED 1 @@ -316,22 +330,6 @@ extern const struct xlat whence_codes[]; #define indirect_ipccall(tcp) (tcp->s_ent->sys_flags & TRACE_INDIRECT_SUBCALL) -#if defined(ARM) || defined(AARCH64) \ - || defined(I386) || defined(X32) || defined(X86_64) \ - || defined(IA64) \ - || defined(BFIN) \ - || defined(M68K) \ - || defined(MICROBLAZE) \ - || defined(RISCV) \ - || defined(S390) \ - || defined(SH) || defined(SH64) \ - || defined(SPARC) || defined(SPARC64) \ - /**/ -# define NEED_UID16_PARSERS 1 -#else -# define NEED_UID16_PARSERS 0 -#endif - enum sock_proto { SOCK_PROTO_UNKNOWN, SOCK_PROTO_UNIX, @@ -355,7 +353,6 @@ typedef enum { CFLAG_BOTH } cflag_t; extern cflag_t cflag; -extern bool debug_flag; extern bool Tflag; extern bool iflag; extern bool count_wallclock; @@ -365,7 +362,8 @@ extern unsigned int show_fd_path; /* are we filtering traces based on paths? */ extern struct path_set { const char **paths_selected; - unsigned int num_selected; + size_t num_selected; + size_t size; } global_path_set; #define tracing_paths (global_path_set.num_selected != 0) extern unsigned xflag; @@ -380,7 +378,7 @@ extern unsigned os_release; #undef KERNEL_VERSION #define KERNEL_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c)) -extern int read_int_from_file(const char *, int *); +extern int read_int_from_file(struct tcb *, const char *, int *); extern void set_sortby(const char *); extern void set_overhead(int); @@ -397,18 +395,37 @@ extern void syscall_exiting_finish(struct tcb *); extern void count_syscall(struct tcb *, const struct timeval *); extern void call_summary(FILE *); -extern void clear_regs(void); +extern void clear_regs(struct tcb *tcp); extern int get_scno(struct tcb *); extern kernel_ulong_t get_rt_sigframe_addr(struct tcb *); /** - * Convert syscall number to syscall name. + * Convert a (shuffled) syscall number to the corresponding syscall name. * * @param scno Syscall number. * @return String literal corresponding to the syscall number in case latter * is valid; NULL otherwise. */ extern const char *syscall_name(kernel_ulong_t scno); +/** + * Convert a syscall name to the corresponding (shuffled) syscall number. + * + * @param s Syscall name. + * @param p Personality. + * @param start From which position in syscall entry table resume the search. + * @return Shuffled syscall number (ready to use against sysent_vec) + * if syscall name is found; -1 otherwise. + */ +extern kernel_long_t scno_by_name(const char *s, unsigned p, + kernel_long_t start); +/** + * Shuffle syscall numbers so that we don't have huge gaps in syscall table. + * The shuffling should be an involution: shuffle_scno(shuffle_scno(n)) == n. + * + * @param scno Raw or shuffled syscall number. + * @return Shuffled or raw syscall number, respectively. + */ +extern kernel_ulong_t shuffle_scno(kernel_ulong_t scno); extern const char *err_name(unsigned long err); extern bool is_erestart(struct tcb *); @@ -448,8 +465,8 @@ umoven_or_printaddr_ignore_syserror(struct tcb *, kernel_ulong_t addr, extern int umovestr(struct tcb *, kernel_ulong_t addr, unsigned int len, char *laddr); -extern int upeek(int pid, unsigned long, kernel_ulong_t *); -extern int upoke(int pid, unsigned long, kernel_ulong_t); +extern int upeek(struct tcb *tcp, unsigned long, kernel_ulong_t *); +extern int upoke(struct tcb *tcp, unsigned long, kernel_ulong_t); extern bool print_array(struct tcb *, @@ -467,12 +484,8 @@ print_array(struct tcb *, void *opaque_data), void *opaque_data); -#if defined ALPHA || defined IA64 || defined MIPS \ - || defined SH || defined SPARC || defined SPARC64 -# define HAVE_GETRVAL2 +#if HAVE_ARCH_GETRVAL2 extern long getrval2(struct tcb *); -#else -# undef HAVE_GETRVAL2 #endif extern const char *signame(const int); @@ -495,7 +508,7 @@ void dyxlat_free(struct dyxlat *); const struct xlat *dyxlat_get(const struct dyxlat *); void dyxlat_add_pair(struct dyxlat *, uint64_t val, const char *str, size_t len); -const struct xlat *genl_families_xlat(void); +const struct xlat *genl_families_xlat(struct tcb *tcp); extern unsigned long get_pagesize(void); extern int next_set_bit(const void *bit_array, unsigned cur_bit, unsigned size_bits); @@ -518,6 +531,7 @@ str_strip_prefix_len(const char *str, const char *prefix, size_t prefix_len) #define QUOTE_OMIT_LEADING_TRAILING_QUOTES 0x02 #define QUOTE_OMIT_TRAILING_0 0x08 #define QUOTE_FORCE_HEX 0x10 +#define QUOTE_EMIT_COMMENT 0x20 extern int string_quote(const char *, char *, unsigned int, unsigned int); extern int print_quoted_string(const char *, unsigned int, unsigned int); @@ -544,6 +558,8 @@ extern int printxval_searchn(const struct xlat *xlat, size_t xlat_size, uint64_t val, const char *dflt); #define printxval_search(xlat__, val__, dflt__) \ printxval_searchn(xlat__, ARRAY_SIZE(xlat__), val__, dflt__) +extern int sprintxval(char *buf, size_t size, const struct xlat *, + unsigned int val, const char *dflt); extern int printargs(struct tcb *); extern int printargs_u(struct tcb *); extern int printargs_d(struct tcb *); @@ -561,6 +577,9 @@ extern void print_numeric_long_umask(unsigned long); extern void print_dev_t(unsigned long long dev); extern void print_abnormal_hi(kernel_ulong_t); +extern kernel_ulong_t * +fetch_indirect_syscall_args(struct tcb *, kernel_ulong_t addr, unsigned int n_args); + extern void dumpiov_in_msghdr(struct tcb *, kernel_ulong_t addr, kernel_ulong_t data_size); @@ -573,14 +592,14 @@ dumpiov_upto(struct tcb *, int len, kernel_ulong_t addr, kernel_ulong_t data_siz extern void dumpstr(struct tcb *, kernel_ulong_t addr, int len); -extern void +extern int printstr_ex(struct tcb *, kernel_ulong_t addr, kernel_ulong_t len, unsigned int user_style); -extern void +extern int printpathn(struct tcb *, kernel_ulong_t addr, unsigned int n); -extern void +extern int printpath(struct tcb *, kernel_ulong_t addr); #define TIMESPEC_TEXT_BUFSIZE \ @@ -658,6 +677,7 @@ name ## _ioctl(struct tcb *, unsigned int request, kernel_ulong_t arg) \ DECL_IOCTL(dm); DECL_IOCTL(file); DECL_IOCTL(fs_x); +DECL_IOCTL(kvm); DECL_IOCTL(nsfs); DECL_IOCTL(ptp); DECL_IOCTL(scsi); @@ -701,16 +721,16 @@ extern void unwind_print_stacktrace(struct tcb *); extern void unwind_capture_stacktrace(struct tcb *); #endif -static inline void +static inline int printstrn(struct tcb *tcp, kernel_ulong_t addr, kernel_ulong_t len) { - printstr_ex(tcp, addr, len, 0); + return printstr_ex(tcp, addr, len, 0); } -static inline void +static inline int printstr(struct tcb *tcp, kernel_ulong_t addr) { - printstr_ex(tcp, addr, -1, QUOTE_0_TERMINATED); + return printstr_ex(tcp, addr, -1, QUOTE_0_TERMINATED); } static inline int @@ -758,7 +778,21 @@ extern void print_itimerval32(struct tcb *, kernel_ulong_t addr); #endif #ifdef HAVE_STRUCT_USER_DESC -extern void print_user_desc(struct tcb *, kernel_ulong_t addr); +/** + * Filter what to print from the point of view of the get_thread_area syscall. + * Kernel copies only entry_number field at first and then tries to write the + * whole structure. + */ +enum user_desc_print_filter { + /* Print the "entering" part of struct user_desc - entry_number. */ + USER_DESC_ENTERING = 1, + /* Print the "exiting" part of the structure. */ + USER_DESC_EXITING = 2, + USER_DESC_BOTH = USER_DESC_ENTERING | USER_DESC_EXITING, +}; + +extern void print_user_desc(struct tcb *, kernel_ulong_t addr, + enum user_desc_print_filter filter); #endif /* Strace log generation machinery. @@ -788,7 +822,7 @@ extern void tprintf_comment(const char *fmt, ...) ATTRIBUTE_FORMAT((printf, 1, 2 extern void tprints_comment(const char *str); #if SUPPORTED_PERSONALITIES > 1 -extern void set_personality(int personality); +extern void set_personality(unsigned int personality); extern unsigned current_personality; #else # define set_personality(personality) ((void)0) @@ -811,9 +845,12 @@ extern unsigned current_klongsize; # endif #endif -#define ANY_WORDSIZE_LESS_THAN_KERNEL_LONG \ - (SIZEOF_KERNEL_LONG_T > 4 \ - && (SIZEOF_LONG < SIZEOF_KERNEL_LONG_T || !defined(current_wordsize))) +#if SIZEOF_KERNEL_LONG_T > 4 \ + && (SIZEOF_LONG < SIZEOF_KERNEL_LONG_T || !defined(current_wordsize)) +# define ANY_WORDSIZE_LESS_THAN_KERNEL_LONG 1 +#else +# define ANY_WORDSIZE_LESS_THAN_KERNEL_LONG 0 +#endif #define DECL_PRINTNUM(name) \ extern bool \ @@ -942,6 +979,8 @@ extern const char *const errnoent0[]; extern const char *const signalent0[]; extern const struct_ioctlent ioctlent0[]; +extern const char *const personality_names[]; + #if SUPPORTED_PERSONALITIES > 1 extern const struct_sysent *sysent; extern const char *const *errnoent; @@ -3,7 +3,7 @@ * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl> * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com> * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl> - * Copyright (c) 1999-2017 The strace developers. + * Copyright (c) 1999-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,6 +30,7 @@ */ #include "defs.h" +#include "xstring.h" SYS_FUNC(close) { @@ -157,7 +158,9 @@ decode_select(struct tcb *const tcp, const kernel_ulong_t *const args, /* +2 chars needed at the end: ']',NUL */ if (outptr < end_outstr - (sizeof(", except [") + sizeof(int)*3 + 2)) { if (first) { - outptr += sprintf(outptr, "%s%s [%u", + outptr = xappendstr(outstr, + outptr, + "%s%s [%u", sep, i == 0 ? "in" : i == 1 ? "out" : "except", j @@ -165,7 +168,9 @@ decode_select(struct tcb *const tcp, const kernel_ulong_t *const args, first = 0; sep = ", "; } else { - outptr += sprintf(outptr, " %u", j); + outptr = xappendstr(outstr, + outptr, + " %u", j); } } if (--ready_fds == 0) @@ -179,7 +184,8 @@ decode_select(struct tcb *const tcp, const kernel_ulong_t *const args, if (args[4]) { const char *str = sprint_tv_ts(tcp, args[4]); if (outptr + sizeof("left ") + strlen(sep) + strlen(str) < end_outstr) { - outptr += sprintf(outptr, "%sleft %s", sep, str); + outptr = xappendstr(outstr, outptr, + "%sleft %s", sep, str); } } *outptr = '\0'; @@ -190,29 +196,21 @@ decode_select(struct tcb *const tcp, const kernel_ulong_t *const args, return 0; } +#if HAVE_ARCH_OLD_SELECT SYS_FUNC(oldselect) { - kernel_ulong_t select_args[5]; - unsigned int oldselect_args[5]; + kernel_ulong_t *args = + fetch_indirect_syscall_args(tcp, tcp->u_arg[0], 5); - if (sizeof(*select_args) == sizeof(*oldselect_args)) { - if (umove_or_printaddr(tcp, tcp->u_arg[0], &select_args)) { - return 0; - } + if (args) { + return decode_select(tcp, args, print_timeval, sprint_timeval); } else { - unsigned int i; - - if (umove_or_printaddr(tcp, tcp->u_arg[0], &oldselect_args)) { - return 0; - } - - for (i = 0; i < 5; ++i) { - select_args[i] = oldselect_args[i]; - } + if (entering(tcp)) + printaddr(tcp->u_arg[0]); + return RVAL_DECODED; } - - return decode_select(tcp, select_args, print_timeval, sprint_timeval); } +#endif /* HAVE_ARCH_OLD_SELECT */ #ifdef ALPHA SYS_FUNC(osf_select) @@ -258,6 +258,7 @@ dm_decode_dm_name_list(struct tcb *const tcp, const kernel_ulong_t addr, uint32_t offset = ioc->data_start; uint32_t offset_end = 0; uint32_t count; + int rc; if (ioc->data_start == ioc->data_size) return; @@ -288,8 +289,36 @@ dm_decode_dm_name_list(struct tcb *const tcp, const kernel_ulong_t addr, PRINT_FIELD_DEV("{", s, dev); tprints(", name="); - printstr_ex(tcp, addr + offset_end, ioc->data_size - offset_end, - QUOTE_0_TERMINATED); + rc = printstr_ex(tcp, addr + offset_end, + ioc->data_size - offset_end, + QUOTE_0_TERMINATED); + + /* + * In Linux v4.13-rc1~137^2~13 it has been decided to cram in + * one more undocumented field after the device name, as if the + * format decoding was not twisted enough already. So, we have + * to check "next" now, and if it _looks like_ that there is + * a space for one additional integer, let's print it. As if the + * perversity with "name string going further than pointer to + * the next one" wasn't enough. Moreover, the calculation was + * broken for m32 on 64-bit kernels until v4.14-rc4~20^2~3, and + * we have no ability to detect kernel bit-ness (on x86, at + * least), so refrain from printing it for the DM versions below + * 4.37 (the original version was also aligned differently than + * now even on 64 bit). + */ + + if ((rc > 0) && ioc->version[1] >= 37) { + kernel_ulong_t event_addr = + (addr + offset_end + rc + 7) & ~7; + uint32_t event_nr; + + if ((event_addr + sizeof(event_nr)) <= + (addr + offset + s.next) && + !umove(tcp, event_addr, &event_nr)) + tprintf(", event_nr=%" PRIu32, event_nr); + } + tprints("}"); if (!s.next) @@ -44,8 +44,8 @@ dyxlat_alloc(const size_t nmemb) struct dyxlat *const dyxlat = xmalloc(sizeof(*dyxlat)); dyxlat->used = 1; - dyxlat->allocated = nmemb ? nmemb : 16; - dyxlat->xlat = xcalloc(dyxlat->allocated, sizeof(struct xlat)); + dyxlat->allocated = nmemb; + dyxlat->xlat = xgrowarray(NULL, &dyxlat->allocated, sizeof(struct xlat)); MARK_END(dyxlat->xlat[0]); return dyxlat; @@ -90,11 +90,9 @@ dyxlat_add_pair(struct dyxlat *const dyxlat, const uint64_t val, } } - if (dyxlat->used >= dyxlat->allocated) { - dyxlat->allocated *= 2; - dyxlat->xlat = xreallocarray(dyxlat->xlat, dyxlat->allocated, - sizeof(struct xlat)); - } + if (dyxlat->used >= dyxlat->allocated) + dyxlat->xlat = xgrowarray(dyxlat->xlat, &dyxlat->allocated, + sizeof(struct xlat)); dyxlat->xlat[dyxlat->used - 1].val = val; dyxlat->xlat[dyxlat->used - 1].str = xstrndup(str, len); diff --git a/error_prints.h b/error_prints.h index 7ddcb50b..99c80389 100644 --- a/error_prints.h +++ b/error_prints.h @@ -33,8 +33,12 @@ #ifndef STRACE_ERROR_PRINTS_H #define STRACE_ERROR_PRINTS_H +#include <stdbool.h> + #include "gcc_compat.h" +extern bool debug_flag; + void die(void) ATTRIBUTE_NORETURN; void error_msg(const char *fmt, ...) ATTRIBUTE_FORMAT((printf, 1, 2)); @@ -46,4 +50,30 @@ void error_msg_and_help(const char *fmt, ...) void error_msg_and_die(const char *fmt, ...) ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN; +/* Wrappers for if (debug_flag) error_msg(...) */ +#define debug_msg(...) \ + do { \ + if (debug_flag) \ + error_msg(__VA_ARGS__); \ + } while (0) +#define debug_perror_msg(...) \ + do { \ + if (debug_flag) \ + perror_msg(__VA_ARGS__); \ + } while (0) + +/* Simple wrappers for providing function name in error messages */ +#define error_func_msg(fmt_, ...) \ + error_msg("%s: " fmt_, __func__, ##__VA_ARGS__) +#define perror_func_msg(fmt_, ...) \ + perror_msg("%s: " fmt_, __func__, ##__VA_ARGS__) +#define debug_func_msg(fmt_, ...) \ + debug_msg("%s: " fmt_, __func__, ##__VA_ARGS__) +#define debug_func_perror_msg(fmt_, ...) \ + debug_perror_msg("%s: " fmt_, __func__, ##__VA_ARGS__) +#define error_func_msg_and_die(fmt_, ...) \ + error_msg_and_die("%s: " fmt_, __func__, ##__VA_ARGS__) +#define perror_func_msg_and_die(fmt_, ...) \ + perror_msg_and_die("%s: " fmt_, __func__, ##__VA_ARGS__) + #endif /* !STRACE_ERROR_PRINTS_H */ diff --git a/linux/crisv10/rt_sigframe.h b/fetch_indirect_syscall_args.c index 6080baef..72ee7c75 100644 --- a/linux/crisv10/rt_sigframe.h +++ b/fetch_indirect_syscall_args.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -25,17 +25,31 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef STRACE_RT_SIGFRAME_H -#define STRACE_RT_SIGFRAME_H +#include "defs.h" -#include <signal.h> +/* + * Fetch indirect syscall arguments that are provided as an array. + * Return a pointer to a static array of kernel_ulong_t elements, + * or NULL in case of fetch failure. + */ +kernel_ulong_t * +fetch_indirect_syscall_args(struct tcb *const tcp, + const kernel_ulong_t addr, + const unsigned int n_args) +{ + static kernel_ulong_t u_arg[MAX_ARGS]; + + if (current_wordsize == sizeof(*u_arg)) { + if (umoven(tcp, addr, sizeof(*u_arg) * n_args, u_arg)) + return NULL; + } else { + uint32_t narrow_arg[ARRAY_SIZE(u_arg)]; -typedef struct { - siginfo_t *pinfo; - void *puc; - siginfo_t info; - ucontext_t uc; - /* more data follows */ -} struct_rt_sigframe; + if (umoven(tcp, addr, sizeof(*narrow_arg) * n_args, narrow_arg)) + return NULL; + for (unsigned int i = 0; i < n_args; ++i) + u_arg[i] = narrow_arg[i]; + } -#endif /* !STRACE_RT_SIGFRAME_H */ + return u_arg; +} @@ -1,6 +1,6 @@ /* * Copyright (c) 2017 Nikolay Marchuk <marchuk.nikolay.a@gmail.com> - * Copyright (c) 2017 The strace developers. + * Copyright (c) 2017-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,7 +34,6 @@ typedef int (*string_to_uint_func)(const char *); void qualify_tokens(const char *str, struct number_set *set, string_to_uint_func func, const char *name); -void qualify_syscall_tokens(const char *str, struct number_set *set, - const char *name); +void qualify_syscall_tokens(const char *str, struct number_set *set); #endif /* !STRACE_FILTER_H */ diff --git a/filter_qualify.c b/filter_qualify.c index 5b0ef28c..49f0d612 100644 --- a/filter_qualify.c +++ b/filter_qualify.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,15 +44,13 @@ static struct number_set *verbose_set; static int sigstr_to_uint(const char *s) { - int i; - if (*s >= '0' && *s <= '9') return string_to_uint_upto(s, 255); if (strncasecmp(s, "SIG", 3) == 0) s += 3; - for (i = 0; i <= 255; ++i) { + for (int i = 0; i <= 255; ++i) { const char *name = signame(i); if (strncasecmp(name, "SIG", 3) != 0) @@ -72,9 +70,7 @@ sigstr_to_uint(const char *s) static int find_errno_by_name(const char *name) { - unsigned int i; - - for (i = 1; i < nerrnos; ++i) { + for (unsigned int i = 1; i < nerrnos; ++i) { if (errnoent[i] && (strcasecmp(name, errnoent[i]) == 0)) return i; } @@ -87,7 +83,7 @@ parse_inject_token(const char *const token, struct inject_opts *const fopts, const bool fault_tokens_only) { const char *val; - int intval; + kernel_long_t intval; if ((val = STR_STRIP_PREFIX(token, "when=")) != token) { /* @@ -133,9 +129,23 @@ parse_inject_token(const char *const token, struct inject_opts *const fopts, && (val = STR_STRIP_PREFIX(token, "retval=")) != token) { if (fopts->data.flags & INJECT_F_RETVAL) return false; - intval = string_to_uint(val); + intval = string_to_kulong(val); if (intval < 0) return false; + +#if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG && !HAVE_ARCH_DEDICATED_ERR_REG + if ((int) intval != intval) + error_msg("Injected return value %" PRI_kld " will be" + " clipped to %d in compat personality", + intval, (int) intval); + + if ((int) intval < 0 && (int) intval >= -MAX_ERRNO_VALUE) + error_msg("Inadvertent injection of error %d is" + " possible in compat personality for" + " retval=%" PRI_kld, + -(int) intval, intval); +#endif + fopts->data.rval = intval; fopts->data.flags |= INJECT_F_RETVAL; } else if (!fault_tokens_only @@ -154,30 +164,24 @@ parse_inject_token(const char *const token, struct inject_opts *const fopts, return true; } -static char * -parse_inject_expression(const char *const s, char **buf, +static const char * +parse_inject_expression(char *const str, struct inject_opts *const fopts, const bool fault_tokens_only) { + if (str[0] == '\0' || str[0] == ':') + return ""; + char *saveptr = NULL; - char *name = NULL; - char *token; + const char *name = strtok_r(str, ":", &saveptr); - *buf = xstrdup(s); - for (token = strtok_r(*buf, ":", &saveptr); token; - token = strtok_r(NULL, ":", &saveptr)) { - if (!name) - name = token; - else if (!parse_inject_token(token, fopts, fault_tokens_only)) - goto parse_error; + char *token; + while ((token = strtok_r(NULL, ":", &saveptr))) { + if (!parse_inject_token(token, fopts, fault_tokens_only)) + return NULL; } - if (name) - return name; - -parse_error: - free(*buf); - return *buf = NULL; + return name; } static void @@ -209,7 +213,7 @@ qualify_trace(const char *const str) { if (!trace_set) trace_set = alloc_number_set_array(SUPPORTED_PERSONALITIES); - qualify_syscall_tokens(str, trace_set, "system call"); + qualify_syscall_tokens(str, trace_set); } static void @@ -217,7 +221,7 @@ qualify_abbrev(const char *const str) { if (!abbrev_set) abbrev_set = alloc_number_set_array(SUPPORTED_PERSONALITIES); - qualify_syscall_tokens(str, abbrev_set, "system call"); + qualify_syscall_tokens(str, abbrev_set); } static void @@ -225,7 +229,7 @@ qualify_verbose(const char *const str) { if (!verbose_set) verbose_set = alloc_number_set_array(SUPPORTED_PERSONALITIES); - qualify_syscall_tokens(str, verbose_set, "system call"); + qualify_syscall_tokens(str, verbose_set); } static void @@ -233,7 +237,7 @@ qualify_raw(const char *const str) { if (!raw_set) raw_set = alloc_number_set_array(SUPPORTED_PERSONALITIES); - qualify_syscall_tokens(str, raw_set, "system call"); + qualify_syscall_tokens(str, raw_set); } static void @@ -245,11 +249,17 @@ qualify_inject_common(const char *const str, .first = 1, .step = 1 }; - char *buf = NULL; - char *name = parse_inject_expression(str, &buf, &opts, fault_tokens_only); - if (!name) { + char *copy = xstrdup(str); + const char *name = + parse_inject_expression(copy, &opts, fault_tokens_only); + if (!name) error_msg_and_die("invalid %s '%s'", description, str); - } + + struct number_set *tmp_set = + alloc_number_set_array(SUPPORTED_PERSONALITIES); + qualify_syscall_tokens(name, tmp_set); + + free(copy); /* If neither of retval, error, or signal is specified, then ... */ if (!opts.data.flags) { @@ -263,18 +273,11 @@ qualify_inject_common(const char *const str, } } - struct number_set *tmp_set = - alloc_number_set_array(SUPPORTED_PERSONALITIES); - qualify_syscall_tokens(name, tmp_set, description); - - free(buf); - /* - * Initialize inject_vec accourding to tmp_set. + * Initialize inject_vec according to tmp_set. * Merge tmp_set into inject_set. */ - unsigned int p; - for (p = 0; p < SUPPORTED_PERSONALITIES; ++p) { + for (unsigned int p = 0; p < SUPPORTED_PERSONALITIES; ++p) { if (number_set_array_is_empty(tmp_set, p)) continue; @@ -284,11 +287,10 @@ qualify_inject_common(const char *const str, } if (!inject_vec[p]) { inject_vec[p] = xcalloc(nsyscall_vec[p], - sizeof(*inject_vec[p])); + sizeof(*inject_vec[p])); } - unsigned int i; - for (i = 0; i < nsyscall_vec[p]; ++i) { + for (unsigned int i = 0; i < nsyscall_vec[p]; ++i) { if (is_number_in_set_array(i, tmp_set, p)) { add_number_to_set_array(i, inject_set, p); inject_vec[p][i] = opts; @@ -340,9 +342,8 @@ void qualify(const char *str) { const struct qual_options *opt = qual_options; - unsigned int i; - for (i = 0; i < ARRAY_SIZE(qual_options); ++i) { + for (unsigned int i = 0; i < ARRAY_SIZE(qual_options); ++i) { const char *name = qual_options[i].name; const size_t len = strlen(name); const char *val = str_strip_prefix_len(str, name, len); diff --git a/getpagesize.c b/getpagesize.c new file mode 100644 index 00000000..49c6234b --- /dev/null +++ b/getpagesize.c @@ -0,0 +1,6 @@ +#include "defs.h" + +SYS_FUNC(getpagesize) +{ + return RVAL_DECODED | RVAL_HEX; +} @@ -287,15 +287,21 @@ ioctl_decode(struct tcb *tcp) return scsi_ioctl(tcp, code, arg); case 'L': return loop_ioctl(tcp, code, arg); +#ifdef HAVE_STRUCT_MTD_WRITE_REQ case 'M': return mtd_ioctl(tcp, code, arg); +#endif +#ifdef HAVE_STRUCT_UBI_ATTACH_REQ_MAX_BEB_PER1024 case 'o': case 'O': return ubi_ioctl(tcp, code, arg); +#endif case 'V': return v4l2_ioctl(tcp, code, arg); +#ifdef HAVE_STRUCT_PTP_SYS_OFFSET case '=': return ptp_ioctl(tcp, code, arg); +#endif #ifdef HAVE_LINUX_INPUT_H case 'E': return evdev_ioctl(tcp, code, arg); @@ -314,6 +320,10 @@ ioctl_decode(struct tcb *tcp) case 0xfd: return dm_ioctl(tcp, code, arg); #endif +#ifdef HAVE_LINUX_KVM_H + case 0xae: + return kvm_ioctl(tcp, code, arg); +#endif default: break; } diff --git a/ioctlent0.h b/ioctlent0.h index 13c21656..7e542b15 100644 --- a/ioctlent0.h +++ b/ioctlent0.h @@ -1051,6 +1051,7 @@ { "DRM_IOCTL_MSM_GEM_CPU_FINI", 0x40046445 }, { "DRM_IOCTL_RADEON_FULLSCREEN", 0x40046446 }, { "DRM_IOCTL_MGA_SET_FENCE", 0x4004644a }, +{ "DRM_IOCTL_MSM_SUBMITQUEUE_CLOSE", 0x4004644b }, { "DRM_IOCTL_I915_DESTROY_HEAP", 0x4004644c }, { "DRM_IOCTL_I915_SET_VBLANK_PIPE", 0x4004644d }, { "DRM_IOCTL_R128_FULLSCREEN", 0x40046450 }, @@ -1403,6 +1404,7 @@ { "DRM_IOCTL_VIA_PCICMD", 0x4010644a }, { "DRM_IOCTL_I915_HWS_ADDR", 0x40106451 }, { "DRM_IOCTL_I915_GEM_INIT", 0x40106453 }, +{ "DRM_IOCTL_AMDGPU_SCHED", 0x40106455 }, { "DRM_IOCTL_SIS_FB_INIT", 0x40106456 }, { "DRM_IOCTL_RADEON_SETPARAM", 0x40106459 }, { "TUNER_SET_CONFIG", 0x4010645c }, @@ -1458,7 +1460,6 @@ { "DRM_IOCTL_QXL_UPDATE_AREA", 0x40186443 }, { "DRM_IOCTL_ETNAVIV_GEM_CPU_PREP", 0x40186444 }, { "DRM_IOCTL_MSM_GEM_CPU_PREP", 0x40186444 }, -{ "DRM_IOCTL_MSM_WAIT_FENCE", 0x40186447 }, { "DRM_IOCTL_R128_BLIT", 0x4018644b }, { "RIO_MPORT_MAINT_WRITE_LOCAL", 0x40186d06 }, { "RIO_MPORT_MAINT_WRITE_REMOTE", 0x40186d08 }, @@ -1487,6 +1488,7 @@ { "DRM_IOCTL_AMDGPU_INFO", 0x40206445 }, { "DRM_IOCTL_SIS_FB_FREE", 0x40206445 }, { "DRM_IOCTL_ETNAVIV_WAIT_FENCE", 0x40206447 }, +{ "DRM_IOCTL_MSM_WAIT_FENCE", 0x40206447 }, { "DRM_IOCTL_RADEON_CLEAR", 0x40206448 }, { "DRM_IOCTL_ETNAVIV_GEM_WAIT", 0x40206449 }, { "DRM_IOCTL_I915_CMDBUFFER", 0x4020644b }, @@ -2187,6 +2189,7 @@ { "DRM_IOCTL_MODE_RMFB", 0xc00464af }, { "DRM_IOCTL_MODE_DESTROY_DUMB", 0xc00464b4 }, { "DRM_IOCTL_MODE_DESTROYPROPBLOB", 0xc00464be }, +{ "DRM_IOCTL_MODE_REVOKE_LEASE", 0xc00464c9 }, { "SNDCTL_MIDI_PRETIME", 0xc0046d00 }, { "SNDCTL_MIDI_MPUMODE", 0xc0046d01 }, { "MGSL_IOCWAITEVENT", 0xc0046d08 }, @@ -2274,6 +2277,7 @@ { "DRM_IOCTL_PRIME_HANDLE_TO_FD", 0xc00c642d }, { "DRM_IOCTL_PRIME_FD_TO_HANDLE", 0xc00c642e }, { "DRM_IOCTL_MSM_GEM_MADVISE", 0xc00c6448 }, +{ "DRM_IOCTL_MSM_SUBMITQUEUE_NEW", 0xc00c644a }, { "DRM_IOCTL_VIA_CMDBUF_SIZE", 0xc00c644b }, { "DRM_IOCTL_I915_VBLANK_SWAP", 0xc00c644f }, { "DRM_IOCTL_RADEON_GEM_SET_DOMAIN", 0xc00c6463 }, @@ -2352,6 +2356,7 @@ { "DRM_IOCTL_TEGRA_GEM_SET_TILING", 0xc010644a }, { "DRM_IOCTL_VC4_LABEL_BO", 0xc010644a }, { "DRM_IOCTL_TEGRA_GEM_GET_TILING", 0xc010644b }, +{ "DRM_IOCTL_VC4_GEM_MADVISE", 0xc010644b }, { "DRM_IOCTL_RADEON_INDIRECT", 0xc010644d }, { "DRM_IOCTL_R128_INDIRECT", 0xc010644f }, { "DRM_IOCTL_AMDGPU_GEM_OP", 0xc0106450 }, @@ -2375,6 +2380,8 @@ { "DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE", 0xc01064c2 }, { "DRM_IOCTL_SYNCOBJ_RESET", 0xc01064c4 }, { "DRM_IOCTL_SYNCOBJ_SIGNAL", 0xc01064c5 }, +{ "DRM_IOCTL_MODE_LIST_LESSEES", 0xc01064c7 }, +{ "DRM_IOCTL_MODE_GET_LEASE", 0xc01064c8 }, { "MGSL_IOCWAITGPIO", 0xc0106d12 }, { "NCP_IOC_GETPRIVATEDATA", 0xc0106e0a }, { "DMX_GET_STC", 0xc0106f32 }, @@ -2420,6 +2427,8 @@ { "BINDER_GET_NODE_DEBUG_INFO", 0xc018620b }, { "DRM_IOCTL_MAP_BUFS", 0xc0186419 }, { "DRM_IOCTL_WAIT_VBLANK", 0xc018643a }, +{ "DRM_IOCTL_CRTC_GET_SEQUENCE", 0xc018643b }, +{ "DRM_IOCTL_CRTC_QUEUE_SEQUENCE", 0xc018643c }, { "DRM_IOCTL_AMDGPU_BO_LIST", 0xc0186443 }, { "DRM_IOCTL_AMDGPU_CS", 0xc0186444 }, { "DRM_IOCTL_I810_GETBUF", 0xc0186445 }, @@ -2444,6 +2453,7 @@ { "DRM_IOCTL_MODE_PAGE_FLIP", 0xc01864b0 }, { "DRM_IOCTL_MODE_DIRTYFB", 0xc01864b1 }, { "DRM_IOCTL_MODE_OBJ_SETPROPERTY", 0xc01864ba }, +{ "DRM_IOCTL_MODE_CREATE_LEASE", 0xc01864c6 }, { "I2OHRTGET", 0xc0186901 }, { "I2OLCTGET", 0xc0186902 }, { "RIO_ALLOC_DMA", 0xc0186d13 }, @@ -2498,6 +2508,7 @@ { "DRM_IOCTL_AMDGPU_WAIT_CS", 0xc0206449 }, { "DRM_IOCTL_MGA_DMA_BOOTSTRAP", 0xc020644c }, { "DRM_IOCTL_RADEON_TEXTURE", 0xc020644e }, +{ "DRM_IOCTL_AMDGPU_FENCE_TO_HANDLE", 0xc0206454 }, { "DRM_IOCTL_SIS_AGP_ALLOC", 0xc0206454 }, { "DRM_IOCTL_RADEON_GEM_CREATE", 0xc020645d }, { "DRM_IOCTL_RADEON_GEM_MMAP", 0xc020645e }, @@ -2589,6 +2600,7 @@ { "VIDIOC_ENUMAUDIO", 0xc0345641 }, { "VIDIOC_ENUMAUDOUT", 0xc0345642 }, { "VIDIOC_ENUM_FRAMEINTERVALS", 0xc034564b }, +{ "DELL_WMI_SMBIOS_CMD", 0xc0345700 }, { "MEDIA_IOC_SETUP_LINK", 0xc0347c03 }, { "SYNC_IOC_FILE_INFO", 0xc0383e04 }, { "HIDIOCGFIELDINFO", 0xc038480a }, @@ -2600,10 +2612,10 @@ { "CEC_TRANSMIT", 0xc0386105 }, { "CEC_RECEIVE", 0xc0386106 }, { "DRM_IOCTL_VIRTGPU_RESOURCE_CREATE", 0xc0386444 }, -{ "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", 0xc0386446 }, { "DRM_IOCTL_MODE_ATOMIC", 0xc03864bc }, { "BTRFS_IOC_INO_PATHS", 0xc0389423 }, { "BTRFS_IOC_LOGICAL_INO", 0xc0389424 }, +{ "BTRFS_IOC_LOGICAL_INO_V2", 0xc038943b }, { "GENWQE_SLU_UPDATE", 0xc038a550 }, { "GENWQE_SLU_READ", 0xc038a551 }, { "PTP_SYS_OFFSET_PRECISE", 0xc0403d08 }, @@ -2638,6 +2650,8 @@ { "VIDIOC_ENUMOUTPUT", 0xc0485630 }, { "VIDIOC_DECODER_CMD", 0xc0485660 }, { "VIDIOC_TRY_DECODER_CMD", 0xc0485661 }, +{ "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", 0xc0486446 }, +{ "DRM_IOCTL_ETNAVIV_PM_QUERY_DOM", 0xc048644a }, { "DRM_IOCTL_MODE_ATTACHMODE", 0xc04864a8 }, { "DRM_IOCTL_MODE_DETACHMODE", 0xc04864a9 }, { "VIDEO_COMMAND", 0xc0486f3b }, @@ -2648,6 +2662,7 @@ { "SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT", 0xc04c5349 }, { "VIDIOC_OMAP3ISP_AF_CFG", 0xc04c56c5 }, { "CEC_ADAP_G_CAPS", 0xc04c6100 }, +{ "DRM_IOCTL_ETNAVIV_PM_QUERY_SIG", 0xc04c644b }, { "NVME_NVM_IOCTL_ADMIN_VIO", 0xc0504c41 }, { "NVME_NVM_IOCTL_IO_VIO", 0xc0504c43 }, { "SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION", 0xc0505350 }, diff --git a/ioctlent1.h b/ioctlent1.h index f5301b8c..6926aa3c 100644 --- a/ioctlent1.h +++ b/ioctlent1.h @@ -1093,6 +1093,7 @@ { "DRM_IOCTL_MSM_GEM_CPU_FINI", 0x40046445 }, { "DRM_IOCTL_RADEON_FULLSCREEN", 0x40046446 }, { "DRM_IOCTL_MGA_SET_FENCE", 0x4004644a }, +{ "DRM_IOCTL_MSM_SUBMITQUEUE_CLOSE", 0x4004644b }, { "DRM_IOCTL_I915_DESTROY_HEAP", 0x4004644c }, { "DRM_IOCTL_RADEON_STIPPLE", 0x4004644c }, { "DRM_IOCTL_I915_SET_VBLANK_PIPE", 0x4004644d }, @@ -1445,6 +1446,7 @@ { "DRM_IOCTL_RADEON_CMDBUF", 0x40106450 }, { "DRM_IOCTL_I915_HWS_ADDR", 0x40106451 }, { "DRM_IOCTL_I915_GEM_INIT", 0x40106453 }, +{ "DRM_IOCTL_AMDGPU_SCHED", 0x40106455 }, { "DRM_IOCTL_SIS_AGP_FREE", 0x40106455 }, { "DRM_IOCTL_RADEON_SETPARAM", 0x40106459 }, { "DRM_IOCTL_I915_PERF_OPEN", 0x40106476 }, @@ -1502,7 +1504,6 @@ { "DRM_IOCTL_QXL_UPDATE_AREA", 0x40186443 }, { "DRM_IOCTL_ETNAVIV_GEM_CPU_PREP", 0x40186444 }, { "DRM_IOCTL_MSM_GEM_CPU_PREP", 0x40186444 }, -{ "DRM_IOCTL_MSM_WAIT_FENCE", 0x40186447 }, { "DRM_IOCTL_RADEON_CLEAR", 0x40186448 }, { "DRM_IOCTL_I915_CMDBUFFER", 0x4018644b }, { "DRM_IOCTL_R128_BLIT", 0x4018644b }, @@ -1536,6 +1537,7 @@ { "DRM_IOCTL_VIRTGPU_EXECBUFFER", 0x40206442 }, { "DRM_IOCTL_AMDGPU_INFO", 0x40206445 }, { "DRM_IOCTL_ETNAVIV_WAIT_FENCE", 0x40206447 }, +{ "DRM_IOCTL_MSM_WAIT_FENCE", 0x40206447 }, { "DRM_IOCTL_ETNAVIV_GEM_WAIT", 0x40206449 }, { "DRM_IOCTL_I915_GEM_PREAD", 0x4020645c }, { "DRM_IOCTL_I915_GEM_PWRITE", 0x4020645d }, @@ -2251,6 +2253,7 @@ { "DRM_IOCTL_MODE_RMFB", 0xc00464af }, { "DRM_IOCTL_MODE_DESTROY_DUMB", 0xc00464b4 }, { "DRM_IOCTL_MODE_DESTROYPROPBLOB", 0xc00464be }, +{ "DRM_IOCTL_MODE_REVOKE_LEASE", 0xc00464c9 }, { "I8K_GET_SPEED", 0xc0046985 }, { "I8K_GET_FAN", 0xc0046986 }, { "I8K_SET_FAN", 0xc0046987 }, @@ -2350,6 +2353,7 @@ { "DRM_IOCTL_PRIME_HANDLE_TO_FD", 0xc00c642d }, { "DRM_IOCTL_PRIME_FD_TO_HANDLE", 0xc00c642e }, { "DRM_IOCTL_MSM_GEM_MADVISE", 0xc00c6448 }, +{ "DRM_IOCTL_MSM_SUBMITQUEUE_NEW", 0xc00c644a }, { "DRM_IOCTL_VIA_CMDBUF_SIZE", 0xc00c644b }, { "DRM_IOCTL_I915_VBLANK_SWAP", 0xc00c644f }, { "DRM_IOCTL_RADEON_GEM_SET_DOMAIN", 0xc00c6463 }, @@ -2426,6 +2430,7 @@ { "DRM_IOCTL_TEGRA_GEM_SET_TILING", 0xc010644a }, { "DRM_IOCTL_VC4_LABEL_BO", 0xc010644a }, { "DRM_IOCTL_TEGRA_GEM_GET_TILING", 0xc010644b }, +{ "DRM_IOCTL_VC4_GEM_MADVISE", 0xc010644b }, { "DRM_IOCTL_RADEON_INDIRECT", 0xc010644d }, { "DRM_IOCTL_VIA_WAIT_IRQ", 0xc010644d }, { "DRM_IOCTL_R128_INDIRECT", 0xc010644f }, @@ -2449,6 +2454,8 @@ { "DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE", 0xc01064c2 }, { "DRM_IOCTL_SYNCOBJ_RESET", 0xc01064c4 }, { "DRM_IOCTL_SYNCOBJ_SIGNAL", 0xc01064c5 }, +{ "DRM_IOCTL_MODE_LIST_LESSEES", 0xc01064c7 }, +{ "DRM_IOCTL_MODE_GET_LEASE", 0xc01064c8 }, { "MGSL_IOCWAITGPIO", 0xc0106d12 }, { "DMX_GET_STC", 0xc0106f32 }, { "SCIF_ACCEPTREQ", 0xc0107304 }, @@ -2498,6 +2505,8 @@ { "DRM_IOCTL_GET_CLIENT", 0xc0186405 }, { "DRM_IOCTL_ADD_MAP", 0xc0186415 }, { "DRM_IOCTL_ADD_BUFS", 0xc0186416 }, +{ "DRM_IOCTL_CRTC_GET_SEQUENCE", 0xc018643b }, +{ "DRM_IOCTL_CRTC_QUEUE_SEQUENCE", 0xc018643c }, { "DRM_IOCTL_AMDGPU_BO_LIST", 0xc0186443 }, { "DRM_IOCTL_AMDGPU_CS", 0xc0186444 }, { "DRM_IOCTL_VC4_CREATE_SHADER_BO", 0xc0186445 }, @@ -2519,6 +2528,7 @@ { "DRM_IOCTL_MODE_PAGE_FLIP", 0xc01864b0 }, { "DRM_IOCTL_MODE_DIRTYFB", 0xc01864b1 }, { "DRM_IOCTL_MODE_OBJ_SETPROPERTY", 0xc01864ba }, +{ "DRM_IOCTL_MODE_CREATE_LEASE", 0xc01864c6 }, { "I2OPARMSET", 0xc0186903 }, { "I2OPARMGET", 0xc0186904 }, { "IPMICTL_RECEIVE_MSG_TRUNC", 0xc018690b }, @@ -2573,6 +2583,7 @@ { "SNDRV_RAWMIDI_IOCTL_PARAMS", 0xc0205710 }, { "DRM_IOCTL_AMDGPU_GEM_CREATE", 0xc0206440 }, { "DRM_IOCTL_AMDGPU_WAIT_CS", 0xc0206449 }, +{ "DRM_IOCTL_AMDGPU_FENCE_TO_HANDLE", 0xc0206454 }, { "DRM_IOCTL_RADEON_GEM_CREATE", 0xc020645d }, { "DRM_IOCTL_RADEON_GEM_MMAP", 0xc020645e }, { "DRM_IOCTL_RADEON_GEM_PREAD", 0xc0206461 }, @@ -2652,6 +2663,7 @@ { "VIDIOC_ENUMAUDIO", 0xc0345641 }, { "VIDIOC_ENUMAUDOUT", 0xc0345642 }, { "VIDIOC_ENUM_FRAMEINTERVALS", 0xc034564b }, +{ "DELL_WMI_SMBIOS_CMD", 0xc0345700 }, { "MEDIA_IOC_SETUP_LINK", 0xc0347c03 }, { "SYNC_IOC_FILE_INFO", 0xc0383e04 }, { "HIDIOCGFIELDINFO", 0xc038480a }, @@ -2661,10 +2673,10 @@ { "CEC_TRANSMIT", 0xc0386105 }, { "CEC_RECEIVE", 0xc0386106 }, { "DRM_IOCTL_VIRTGPU_RESOURCE_CREATE", 0xc0386444 }, -{ "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", 0xc0386446 }, { "DRM_IOCTL_MODE_ATOMIC", 0xc03864bc }, { "BTRFS_IOC_INO_PATHS", 0xc0389423 }, { "BTRFS_IOC_LOGICAL_INO", 0xc0389424 }, +{ "BTRFS_IOC_LOGICAL_INO_V2", 0xc038943b }, { "GENWQE_SLU_UPDATE", 0xc038a550 }, { "GENWQE_SLU_READ", 0xc038a551 }, { "VIDIOC_OMAP3ISP_PRV_CFG", 0xc03c56c2 }, @@ -2705,6 +2717,8 @@ { "VIDIOC_ENUMOUTPUT", 0xc0485630 }, { "VIDIOC_DECODER_CMD", 0xc0485660 }, { "VIDIOC_TRY_DECODER_CMD", 0xc0485661 }, +{ "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", 0xc0486446 }, +{ "DRM_IOCTL_ETNAVIV_PM_QUERY_DOM", 0xc048644a }, { "DRM_IOCTL_MODE_ATTACHMODE", 0xc04864a8 }, { "DRM_IOCTL_MODE_DETACHMODE", 0xc04864a9 }, { "VIDEO_COMMAND", 0xc0486f3b }, @@ -2715,6 +2729,7 @@ { "SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT", 0xc04c5349 }, { "VIDIOC_OMAP3ISP_AF_CFG", 0xc04c56c5 }, { "CEC_ADAP_G_CAPS", 0xc04c6100 }, +{ "DRM_IOCTL_ETNAVIV_PM_QUERY_SIG", 0xc04c644b }, { "NVME_NVM_IOCTL_ADMIN_VIO", 0xc0504c41 }, { "NVME_NVM_IOCTL_IO_VIO", 0xc0504c43 }, { "SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION", 0xc0505350 }, @@ -1,6 +1,6 @@ /* * Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2014-2017 The strace developers. + * Copyright (c) 2014-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,6 +27,7 @@ */ #include "defs.h" +#include "xstring.h" enum { IOPRIO_WHO_PROCESS = 1, @@ -62,10 +63,10 @@ sprint_ioprio(unsigned int ioprio) data = IOPRIO_PRIO_DATA(ioprio); str = xlookup(ioprio_class, class); if (str) - sprintf(outstr, "IOPRIO_PRIO_VALUE(%s, %d)", str, data); + xsprintf(outstr, "IOPRIO_PRIO_VALUE(%s, %d)", str, data); else - sprintf(outstr, "IOPRIO_PRIO_VALUE(%#x /* %s */, %d)", - class, "IOPRIO_CLASS_???", data); + xsprintf(outstr, "IOPRIO_PRIO_VALUE(%#x /* %s */, %d)", + class, "IOPRIO_CLASS_???", data); return outstr; } @@ -39,6 +39,14 @@ # include <linux/shm.h> #endif +#ifndef SHM_HUGE_SHIFT +# define SHM_HUGE_SHIFT 26 +#endif + +#ifndef SHM_HUGE_MASK +# define SHM_HUGE_MASK 0x3f +#endif + #include "xlat/shm_resource_flags.h" #include "xlat/shm_flags.h" @@ -50,9 +58,24 @@ SYS_FUNC(shmget) else tprints("IPC_PRIVATE"); tprintf(", %" PRI_klu ", ", tcp->u_arg[1]); - if (printflags(shm_resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0) + + unsigned int flags = tcp->u_arg[2] & ~0777; + const unsigned int mask = SHM_HUGE_MASK << SHM_HUGE_SHIFT; + const unsigned int hugetlb_value = flags & mask; + + flags &= ~mask; + if (flags || !hugetlb_value) + printflags(shm_resource_flags, flags, NULL); + + if (hugetlb_value) + tprintf("%s%u<<SHM_HUGE_SHIFT", + flags ? "|" : "", + hugetlb_value >> SHM_HUGE_SHIFT); + + if (flags || hugetlb_value) tprints("|"); print_numeric_umode_t(tcp->u_arg[2] & 0777); + return RVAL_DECODED; } @@ -0,0 +1,140 @@ +/* + * Support for decoding of KVM_* ioctl commands. + * + * Copyright (c) 2017 Masatake YAMATO <yamato@redhat.com> + * Copyright (c) 2017 Red Hat, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "defs.h" + +#ifdef HAVE_LINUX_KVM_H +# include <linux/kvm.h> +# include "print_fields.h" +# include "arch_kvm.c" + +static int +kvm_ioctl_create_vcpu(struct tcb *const tcp, const kernel_ulong_t arg) +{ + uint32_t cpuid = arg; + + tprintf(", %u", cpuid); + return RVAL_IOCTL_DECODED | RVAL_FD; +} + +# ifdef HAVE_STRUCT_KVM_USERSPACE_MEMORY_REGION +# include "xlat/kvm_mem_flags.h" +static int +kvm_ioctl_set_user_memory_region(struct tcb *const tcp, const kernel_ulong_t arg) +{ + struct kvm_userspace_memory_region u_memory_region; + + tprints(", "); + if (umove_or_printaddr(tcp, arg, &u_memory_region)) + return RVAL_IOCTL_DECODED; + + PRINT_FIELD_U("{", u_memory_region, slot); + PRINT_FIELD_FLAGS(", ", u_memory_region, flags, kvm_mem_flags, + "KVM_MEM_???"); + PRINT_FIELD_X(", ", u_memory_region, guest_phys_addr); + PRINT_FIELD_U(", ", u_memory_region, memory_size); + PRINT_FIELD_X(", ", u_memory_region, userspace_addr); + tprints("}"); + + return RVAL_IOCTL_DECODED; +} +# endif /* HAVE_STRUCT_KVM_USERSPACE_MEMORY_REGION */ + +# ifdef HAVE_STRUCT_KVM_REGS +static int +kvm_ioctl_decode_regs(struct tcb *const tcp, const unsigned int code, + const kernel_ulong_t arg) +{ + struct kvm_regs regs; + + if (code == KVM_GET_REGS && entering(tcp)) + return 0; + + tprints(", "); + if (!umove_or_printaddr(tcp, arg, ®s)) + arch_print_kvm_regs(tcp, arg, ®s); + + return RVAL_IOCTL_DECODED; +} +# endif /* HAVE_STRUCT_KVM_REGS */ + +# ifdef HAVE_STRUCT_KVM_SREGS +static int +kvm_ioctl_decode_sregs(struct tcb *const tcp, const unsigned int code, + const kernel_ulong_t arg) +{ + struct kvm_sregs sregs; + + if (code == KVM_GET_SREGS && entering(tcp)) + return 0; + + tprints(", "); + if (!umove_or_printaddr(tcp, arg, &sregs)) + arch_print_kvm_sregs(tcp, arg, &sregs); + + return RVAL_IOCTL_DECODED; +} +# endif /* HAVE_STRUCT_KVM_SREGS */ + +int +kvm_ioctl(struct tcb *const tcp, const unsigned int code, const kernel_ulong_t arg) +{ + switch (code) { + case KVM_CREATE_VCPU: + return kvm_ioctl_create_vcpu(tcp, arg); + +# ifdef HAVE_STRUCT_KVM_USERSPACE_MEMORY_REGION + case KVM_SET_USER_MEMORY_REGION: + return kvm_ioctl_set_user_memory_region(tcp, arg); +# endif + +# ifdef HAVE_STRUCT_KVM_REGS + case KVM_SET_REGS: + case KVM_GET_REGS: + return kvm_ioctl_decode_regs(tcp, code, arg); +# endif + +# ifdef HAVE_STRUCT_KVM_SREGS + case KVM_SET_SREGS: + case KVM_GET_SREGS: + return kvm_ioctl_decode_sregs(tcp, code, arg); +# endif + + case KVM_CREATE_VM: + return RVAL_DECODED | RVAL_FD; + case KVM_RUN: + case KVM_GET_VCPU_MMAP_SIZE: + case KVM_GET_API_VERSION: + default: + return RVAL_DECODED; + } +} + +#endif /* HAVE_LINUX_KVM_H */ diff --git a/largefile_wrappers.h b/largefile_wrappers.h new file mode 100644 index 00000000..6bb11a3f --- /dev/null +++ b/largefile_wrappers.h @@ -0,0 +1,58 @@ +/* + * Wrappers for handling discrepancies in LF64-themed syscalls availability and + * necessity between verious architectures and kernel veriosns. + * + * Copyright (c) 2012-2018 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef STRACE_LARGEFILE_WRAPPERS_H +#define STRACE_LARGEFILE_WRAPPERS_H + +#include "defs.h" + +#ifdef _LARGEFILE64_SOURCE +# ifdef HAVE_FOPEN64 +# define fopen_for_output fopen64 +# else +# define fopen_for_output fopen +# endif +# define struct_stat struct stat64 +# define stat_file stat64 +# define struct_dirent struct dirent64 +# define read_dir readdir64 +# define struct_rlimit struct rlimit64 +# define set_rlimit setrlimit64 +#else +# define fopen_for_output fopen +# define struct_stat struct stat +# define stat_file stat +# define struct_dirent struct dirent +# define read_dir readdir +# define struct_rlimit struct rlimit +# define set_rlimit setrlimit +#endif + +#endif /* STRACE_LARGEFILE_WRAPPERS_H */ @@ -6,7 +6,7 @@ * Copyright (c) 2002-2004 Roland McGrath <roland@redhat.com> * Copyright (c) 2010 Andreas Schwab <schwab@linux-m68k.org> * Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2014-2017 The strace developers. + * Copyright (c) 2014-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,50 +38,130 @@ # include <asm/ldt.h> +# include "print_fields.h" +# include "xstring.h" + void -print_user_desc(struct tcb *const tcp, const kernel_ulong_t addr) +print_user_desc(struct tcb *const tcp, const kernel_ulong_t addr, + enum user_desc_print_filter filter) { struct user_desc desc; + unsigned *entry_number = get_tcb_priv_data(tcp); + + switch (filter) { + case USER_DESC_ENTERING: + if (umove_or_printaddr(tcp, addr, &desc.entry_number)) + return; + + break; + + case USER_DESC_EXITING: + if (!addr || !verbose(tcp)) + return; + if (syserror(tcp) || umove(tcp, addr, &desc)) { + if (entry_number) + tprints(", ...}"); + + return; + } + + break; + + case USER_DESC_BOTH: + if (umove_or_printaddr(tcp, addr, &desc)) + return; + + break; + } + + if (filter & USER_DESC_ENTERING) { + PRINT_FIELD_ID("{", desc, entry_number); + + /* + * If we don't print the whole structure now, let's save it for + * later. + */ + if (filter == USER_DESC_ENTERING) { + entry_number = xmalloc(sizeof(*entry_number)); - if (umove_or_printaddr(tcp, addr, &desc)) - return; - - tprintf("{entry_number:%d, " - "base_addr:%#08x, " - "limit:%d, " - "seg_32bit:%d, " - "contents:%d, " - "read_exec_only:%d, " - "limit_in_pages:%d, " - "seg_not_present:%d, " - "useable:%d}", - desc.entry_number, - desc.base_addr, - desc.limit, - desc.seg_32bit, - desc.contents, - desc.read_exec_only, - desc.limit_in_pages, - desc.seg_not_present, - desc.useable); + *entry_number = desc.entry_number; + set_tcb_priv_data(tcp, entry_number, free); + } + } + + if (filter & USER_DESC_EXITING) { + /* + * It should be the same in case of get_thread_area, but we can + * never be sure... + */ + if (filter == USER_DESC_EXITING) { + if (entry_number) { + if (*entry_number != desc.entry_number) { + if ((int) desc.entry_number == -1) + tprints(" => -1"); + else + tprintf(" => %u", + desc.entry_number); + } + } else { + /* + * This is really strange. If we are here, it + * means that we failed on entering but somehow + * succeeded on exiting. + */ + PRINT_FIELD_ID(" => {", desc, entry_number); + } + } + + PRINT_FIELD_0X(", ", desc, base_addr); + PRINT_FIELD_0X(", ", desc, limit); + PRINT_FIELD_U_CAST(", ", desc, seg_32bit, unsigned int); + PRINT_FIELD_U_CAST(", ", desc, contents, unsigned int); + PRINT_FIELD_U_CAST(", ", desc, read_exec_only, unsigned int); + PRINT_FIELD_U_CAST(", ", desc, limit_in_pages, unsigned int); + PRINT_FIELD_U_CAST(", ", desc, seg_not_present, unsigned int); + PRINT_FIELD_U_CAST(", ", desc, useable, unsigned int); + +# ifdef HAVE_STRUCT_USER_DESC_LM + /* lm is totally ignored for 32-bit processes */ + if (current_klongsize == 8) + PRINT_FIELD_U_CAST(", ", desc, lm, unsigned int); +# endif /* HAVE_STRUCT_USER_DESC_LM */ + + tprints("}"); + } } SYS_FUNC(modify_ldt) { - tprintf("%" PRI_kld ", ", tcp->u_arg[0]); - if (tcp->u_arg[2] != sizeof(struct user_desc)) - printaddr(tcp->u_arg[1]); - else - print_user_desc(tcp, tcp->u_arg[1]); - tprintf(", %" PRI_klu, tcp->u_arg[2]); + if (entering(tcp)) { + tprintf("%d, ", (int) tcp->u_arg[0]); + if (tcp->u_arg[2] != sizeof(struct user_desc)) + printaddr(tcp->u_arg[1]); + else + print_user_desc(tcp, tcp->u_arg[1], USER_DESC_BOTH); + tprintf(", %" PRI_klu, tcp->u_arg[2]); + + return 0; + } - return RVAL_DECODED; + /* + * For some reason ("tht ABI for sys_modify_ldt() expects + * 'int'"), modify_ldt clips higher bits on x86_64. + */ + + if (syserror(tcp) || (kernel_ulong_t) tcp->u_rval < 0xfffff000) + return 0; + + tcp->u_error = -(unsigned int) tcp->u_rval; + + return RVAL_PRINT_ERR_VAL; } SYS_FUNC(set_thread_area) { if (entering(tcp)) { - print_user_desc(tcp, tcp->u_arg[0]); + print_user_desc(tcp, tcp->u_arg[0], USER_DESC_BOTH); } else { struct user_desc desc; @@ -91,7 +171,7 @@ SYS_FUNC(set_thread_area) } else { static char outstr[32]; - sprintf(outstr, "entry_number:%d", desc.entry_number); + xsprintf(outstr, "entry_number=%u", desc.entry_number); tcp->auxstr = outstr; return RVAL_STR; } @@ -101,8 +181,8 @@ SYS_FUNC(set_thread_area) SYS_FUNC(get_thread_area) { - if (exiting(tcp)) - print_user_desc(tcp, tcp->u_arg[0]); + print_user_desc(tcp, tcp->u_arg[0], + entering(tcp) ? USER_DESC_ENTERING : USER_DESC_EXITING); return 0; } diff --git a/linux/32/ioctls_inc_align16.h b/linux/32/ioctls_inc_align16.h index 175f85fb..1994589c 100644 --- a/linux/32/ioctls_inc_align16.h +++ b/linux/32/ioctls_inc_align16.h @@ -85,6 +85,7 @@ { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_BO_LIST", _IOC_READ|_IOC_WRITE, 0x6443, 0x18 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_CS", _IOC_READ|_IOC_WRITE, 0x6444, 0x18 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_CTX", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 }, +{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_FENCE_TO_HANDLE", _IOC_READ|_IOC_WRITE, 0x6454, 0x20 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_CREATE", _IOC_READ|_IOC_WRITE, 0x6440, 0x20 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_METADATA", _IOC_READ|_IOC_WRITE, 0x6446, 0x11c }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_MMAP", _IOC_READ|_IOC_WRITE, 0x6441, 0x08 }, @@ -93,6 +94,7 @@ { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_VA", _IOC_WRITE, 0x6448, 0x28 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_INFO", _IOC_WRITE, 0x6445, 0x20 }, +{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_SCHED", _IOC_WRITE, 0x6455, 0x10 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_VM", _IOC_READ|_IOC_WRITE, 0x6453, 0x08 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_CS", _IOC_READ|_IOC_WRITE, 0x6449, 0x20 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_FENCES", _IOC_READ|_IOC_WRITE, 0x6452, 0x18 }, @@ -111,6 +113,8 @@ { "drm/drm.h", "DRM_IOCTL_AUTH_MAGIC", _IOC_WRITE, 0x6411, 0x04 }, { "drm/drm.h", "DRM_IOCTL_BLOCK", _IOC_READ|_IOC_WRITE, 0x6412, 0x04 }, { "drm/drm.h", "DRM_IOCTL_CONTROL", _IOC_WRITE, 0x6414, 0x08 }, +{ "drm/drm.h", "DRM_IOCTL_CRTC_GET_SEQUENCE", _IOC_READ|_IOC_WRITE, 0x643b, 0x18 }, +{ "drm/drm.h", "DRM_IOCTL_CRTC_QUEUE_SEQUENCE", _IOC_READ|_IOC_WRITE, 0x643c, 0x18 }, { "drm/drm.h", "DRM_IOCTL_DMA", _IOC_READ|_IOC_WRITE, 0x6429, 0x28 }, { "drm/drm.h", "DRM_IOCTL_DROP_MASTER", _IOC_NONE, 0x641f, 0x00 }, { "drm/drm.h", "DRM_IOCTL_FINISH", _IOC_WRITE, 0x642c, 0x08 }, @@ -138,6 +142,7 @@ { "drm/drm.h", "DRM_IOCTL_MODE_ATTACHMODE", _IOC_READ|_IOC_WRITE, 0x64a8, 0x48 }, { "drm/drm.h", "DRM_IOCTL_MODE_CREATEPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64bd, 0x10 }, { "drm/drm.h", "DRM_IOCTL_MODE_CREATE_DUMB", _IOC_READ|_IOC_WRITE, 0x64b2, 0x20 }, +{ "drm/drm.h", "DRM_IOCTL_MODE_CREATE_LEASE", _IOC_READ|_IOC_WRITE, 0x64c6, 0x18 }, { "drm/drm.h", "DRM_IOCTL_MODE_CURSOR", _IOC_READ|_IOC_WRITE, 0x64a3, 0x1c }, { "drm/drm.h", "DRM_IOCTL_MODE_CURSOR2", _IOC_READ|_IOC_WRITE, 0x64bb, 0x24 }, { "drm/drm.h", "DRM_IOCTL_MODE_DESTROYPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64be, 0x04 }, @@ -154,10 +159,13 @@ { "drm/drm.h", "DRM_IOCTL_MODE_GETPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64ac, 0x10 }, { "drm/drm.h", "DRM_IOCTL_MODE_GETPROPERTY", _IOC_READ|_IOC_WRITE, 0x64aa, 0x40 }, { "drm/drm.h", "DRM_IOCTL_MODE_GETRESOURCES", _IOC_READ|_IOC_WRITE, 0x64a0, 0x40 }, +{ "drm/drm.h", "DRM_IOCTL_MODE_GET_LEASE", _IOC_READ|_IOC_WRITE, 0x64c8, 0x10 }, +{ "drm/drm.h", "DRM_IOCTL_MODE_LIST_LESSEES", _IOC_READ|_IOC_WRITE, 0x64c7, 0x10 }, { "drm/drm.h", "DRM_IOCTL_MODE_MAP_DUMB", _IOC_READ|_IOC_WRITE, 0x64b3, 0x10 }, { "drm/drm.h", "DRM_IOCTL_MODE_OBJ_GETPROPERTIES", _IOC_READ|_IOC_WRITE, 0x64b9, 0x1c }, { "drm/drm.h", "DRM_IOCTL_MODE_OBJ_SETPROPERTY", _IOC_READ|_IOC_WRITE, 0x64ba, 0x14 }, { "drm/drm.h", "DRM_IOCTL_MODE_PAGE_FLIP", _IOC_READ|_IOC_WRITE, 0x64b0, 0x18 }, +{ "drm/drm.h", "DRM_IOCTL_MODE_REVOKE_LEASE", _IOC_READ|_IOC_WRITE, 0x64c9, 0x04 }, { "drm/drm.h", "DRM_IOCTL_MODE_RMFB", _IOC_READ|_IOC_WRITE, 0x64af, 0x04 }, { "drm/drm.h", "DRM_IOCTL_MODE_SETCRTC", _IOC_READ|_IOC_WRITE, 0x64a2, 0x68 }, { "drm/drm.h", "DRM_IOCTL_MODE_SETGAMMA", _IOC_READ|_IOC_WRITE, 0x64a5, 0x20 }, @@ -195,10 +203,12 @@ { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_CPU_PREP", _IOC_WRITE, 0x6444, 0x18 }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_NEW", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 }, -{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x38 }, +{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x48 }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_USERPTR", _IOC_READ|_IOC_WRITE, 0x6448, 0x18 }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_WAIT", _IOC_WRITE, 0x6449, 0x20 }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 }, +{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_PM_QUERY_DOM", _IOC_READ|_IOC_WRITE, 0x644a, 0x48 }, +{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_PM_QUERY_SIG", _IOC_READ|_IOC_WRITE, 0x644b, 0x4a }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x20 }, { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_G2D_EXEC", _IOC_READ|_IOC_WRITE, 0x6462, 0x08 }, { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_G2D_GET_VER", _IOC_READ|_IOC_WRITE, 0x6460, 0x08 }, @@ -302,9 +312,11 @@ { "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 }, { "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_MADVISE", _IOC_READ|_IOC_WRITE, 0x6448, 0x0c }, { "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_NEW", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 }, -{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x24 }, +{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x28 }, { "drm/msm_drm.h", "DRM_IOCTL_MSM_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 }, -{ "drm/msm_drm.h", "DRM_IOCTL_MSM_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x18 }, +{ "drm/msm_drm.h", "DRM_IOCTL_MSM_SUBMITQUEUE_CLOSE", _IOC_WRITE, 0x644b, 0x04 }, +{ "drm/msm_drm.h", "DRM_IOCTL_MSM_SUBMITQUEUE_NEW", _IOC_READ|_IOC_WRITE, 0x644a, 0x0c }, +{ "drm/msm_drm.h", "DRM_IOCTL_MSM_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x1c }, { "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_CPU_FINI", _IOC_WRITE, 0x6483, 0x04 }, { "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_CPU_PREP", _IOC_WRITE, 0x6482, 0x08 }, { "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6484, 0x28 }, @@ -408,6 +420,7 @@ { "drm/tegra_drm.h", "DRM_IOCTL_TEGRA_SYNCPT_WAIT", _IOC_READ|_IOC_WRITE, 0x6444, 0x10 }, { "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_BO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 }, { "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_SHADER_BO", _IOC_READ|_IOC_WRITE, 0x6445, 0x18 }, +{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GEM_MADVISE", _IOC_READ|_IOC_WRITE, 0x644b, 0x10 }, { "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_HANG_STATE", _IOC_READ|_IOC_WRITE, 0x6446, 0xa0 }, { "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 }, { "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_TILING", _IOC_READ|_IOC_WRITE, 0x6449, 0x10 }, @@ -606,6 +619,7 @@ { "linux/btrfs.h", "BTRFS_IOC_INO_LOOKUP", _IOC_READ|_IOC_WRITE, 0x9412, 0x1000 }, { "linux/btrfs.h", "BTRFS_IOC_INO_PATHS", _IOC_READ|_IOC_WRITE, 0x9423, 0x38 }, { "linux/btrfs.h", "BTRFS_IOC_LOGICAL_INO", _IOC_READ|_IOC_WRITE, 0x9424, 0x38 }, +{ "linux/btrfs.h", "BTRFS_IOC_LOGICAL_INO_V2", _IOC_READ|_IOC_WRITE, 0x943b, 0x38 }, { "linux/btrfs.h", "BTRFS_IOC_QGROUP_ASSIGN", _IOC_WRITE, 0x9429, 0x18 }, { "linux/btrfs.h", "BTRFS_IOC_QGROUP_CREATE", _IOC_WRITE, 0x942a, 0x10 }, { "linux/btrfs.h", "BTRFS_IOC_QGROUP_LIMIT", _IOC_READ, 0x942b, 0x30 }, @@ -2400,6 +2414,7 @@ { "linux/wireless.h", "SIOCSIWSTATS", 0, 0x8B0E, 0 }, { "linux/wireless.h", "SIOCSIWTHRSPY", 0, 0x8B12, 0 }, { "linux/wireless.h", "SIOCSIWTXPOW", 0, 0x8B26, 0 }, +{ "linux/wmi.h", "DELL_WMI_SMBIOS_CMD", _IOC_READ|_IOC_WRITE, 0x5700, 0x34 }, { "media/drv-intf/exynos-fimc.h", "S5P_FIMC_TX_END_NOTIFY", _IOC_NONE, 0x6500, 0x00 }, { "media/i2c/adv7842.h", "ADV7842_CMD_RAM_TEST", _IOC_NONE, 0x56c0, 0x00 }, { "media/i2c/bt819.h", "BT819_FIFO_RESET_HIGH", _IOC_NONE, 0x6201, 0x00 }, diff --git a/linux/32/ioctls_inc_align32.h b/linux/32/ioctls_inc_align32.h index 165912a9..e8ee3f07 100644 --- a/linux/32/ioctls_inc_align32.h +++ b/linux/32/ioctls_inc_align32.h @@ -85,6 +85,7 @@ { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_BO_LIST", _IOC_READ|_IOC_WRITE, 0x6443, 0x18 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_CS", _IOC_READ|_IOC_WRITE, 0x6444, 0x18 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_CTX", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 }, +{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_FENCE_TO_HANDLE", _IOC_READ|_IOC_WRITE, 0x6454, 0x20 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_CREATE", _IOC_READ|_IOC_WRITE, 0x6440, 0x20 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_METADATA", _IOC_READ|_IOC_WRITE, 0x6446, 0x11c }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_MMAP", _IOC_READ|_IOC_WRITE, 0x6441, 0x08 }, @@ -93,6 +94,7 @@ { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_VA", _IOC_WRITE, 0x6448, 0x28 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_INFO", _IOC_WRITE, 0x6445, 0x20 }, +{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_SCHED", _IOC_WRITE, 0x6455, 0x10 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_VM", _IOC_READ|_IOC_WRITE, 0x6453, 0x08 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_CS", _IOC_READ|_IOC_WRITE, 0x6449, 0x20 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_FENCES", _IOC_READ|_IOC_WRITE, 0x6452, 0x18 }, @@ -111,6 +113,8 @@ { "drm/drm.h", "DRM_IOCTL_AUTH_MAGIC", _IOC_WRITE, 0x6411, 0x04 }, { "drm/drm.h", "DRM_IOCTL_BLOCK", _IOC_READ|_IOC_WRITE, 0x6412, 0x04 }, { "drm/drm.h", "DRM_IOCTL_CONTROL", _IOC_WRITE, 0x6414, 0x08 }, +{ "drm/drm.h", "DRM_IOCTL_CRTC_GET_SEQUENCE", _IOC_READ|_IOC_WRITE, 0x643b, 0x18 }, +{ "drm/drm.h", "DRM_IOCTL_CRTC_QUEUE_SEQUENCE", _IOC_READ|_IOC_WRITE, 0x643c, 0x18 }, { "drm/drm.h", "DRM_IOCTL_DMA", _IOC_READ|_IOC_WRITE, 0x6429, 0x28 }, { "drm/drm.h", "DRM_IOCTL_DROP_MASTER", _IOC_NONE, 0x641f, 0x00 }, { "drm/drm.h", "DRM_IOCTL_FINISH", _IOC_WRITE, 0x642c, 0x08 }, @@ -138,6 +142,7 @@ { "drm/drm.h", "DRM_IOCTL_MODE_ATTACHMODE", _IOC_READ|_IOC_WRITE, 0x64a8, 0x48 }, { "drm/drm.h", "DRM_IOCTL_MODE_CREATEPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64bd, 0x10 }, { "drm/drm.h", "DRM_IOCTL_MODE_CREATE_DUMB", _IOC_READ|_IOC_WRITE, 0x64b2, 0x20 }, +{ "drm/drm.h", "DRM_IOCTL_MODE_CREATE_LEASE", _IOC_READ|_IOC_WRITE, 0x64c6, 0x18 }, { "drm/drm.h", "DRM_IOCTL_MODE_CURSOR", _IOC_READ|_IOC_WRITE, 0x64a3, 0x1c }, { "drm/drm.h", "DRM_IOCTL_MODE_CURSOR2", _IOC_READ|_IOC_WRITE, 0x64bb, 0x24 }, { "drm/drm.h", "DRM_IOCTL_MODE_DESTROYPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64be, 0x04 }, @@ -154,10 +159,13 @@ { "drm/drm.h", "DRM_IOCTL_MODE_GETPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64ac, 0x10 }, { "drm/drm.h", "DRM_IOCTL_MODE_GETPROPERTY", _IOC_READ|_IOC_WRITE, 0x64aa, 0x40 }, { "drm/drm.h", "DRM_IOCTL_MODE_GETRESOURCES", _IOC_READ|_IOC_WRITE, 0x64a0, 0x40 }, +{ "drm/drm.h", "DRM_IOCTL_MODE_GET_LEASE", _IOC_READ|_IOC_WRITE, 0x64c8, 0x10 }, +{ "drm/drm.h", "DRM_IOCTL_MODE_LIST_LESSEES", _IOC_READ|_IOC_WRITE, 0x64c7, 0x10 }, { "drm/drm.h", "DRM_IOCTL_MODE_MAP_DUMB", _IOC_READ|_IOC_WRITE, 0x64b3, 0x10 }, { "drm/drm.h", "DRM_IOCTL_MODE_OBJ_GETPROPERTIES", _IOC_READ|_IOC_WRITE, 0x64b9, 0x1c }, { "drm/drm.h", "DRM_IOCTL_MODE_OBJ_SETPROPERTY", _IOC_READ|_IOC_WRITE, 0x64ba, 0x14 }, { "drm/drm.h", "DRM_IOCTL_MODE_PAGE_FLIP", _IOC_READ|_IOC_WRITE, 0x64b0, 0x18 }, +{ "drm/drm.h", "DRM_IOCTL_MODE_REVOKE_LEASE", _IOC_READ|_IOC_WRITE, 0x64c9, 0x04 }, { "drm/drm.h", "DRM_IOCTL_MODE_RMFB", _IOC_READ|_IOC_WRITE, 0x64af, 0x04 }, { "drm/drm.h", "DRM_IOCTL_MODE_SETCRTC", _IOC_READ|_IOC_WRITE, 0x64a2, 0x68 }, { "drm/drm.h", "DRM_IOCTL_MODE_SETGAMMA", _IOC_READ|_IOC_WRITE, 0x64a5, 0x20 }, @@ -195,10 +203,12 @@ { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_CPU_PREP", _IOC_WRITE, 0x6444, 0x18 }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_NEW", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 }, -{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x38 }, +{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x48 }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_USERPTR", _IOC_READ|_IOC_WRITE, 0x6448, 0x18 }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_WAIT", _IOC_WRITE, 0x6449, 0x20 }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 }, +{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_PM_QUERY_DOM", _IOC_READ|_IOC_WRITE, 0x644a, 0x48 }, +{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_PM_QUERY_SIG", _IOC_READ|_IOC_WRITE, 0x644b, 0x4c }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x20 }, { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_G2D_EXEC", _IOC_READ|_IOC_WRITE, 0x6462, 0x08 }, { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_G2D_GET_VER", _IOC_READ|_IOC_WRITE, 0x6460, 0x08 }, @@ -302,9 +312,11 @@ { "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 }, { "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_MADVISE", _IOC_READ|_IOC_WRITE, 0x6448, 0x0c }, { "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_NEW", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 }, -{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x24 }, +{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x28 }, { "drm/msm_drm.h", "DRM_IOCTL_MSM_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 }, -{ "drm/msm_drm.h", "DRM_IOCTL_MSM_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x18 }, +{ "drm/msm_drm.h", "DRM_IOCTL_MSM_SUBMITQUEUE_CLOSE", _IOC_WRITE, 0x644b, 0x04 }, +{ "drm/msm_drm.h", "DRM_IOCTL_MSM_SUBMITQUEUE_NEW", _IOC_READ|_IOC_WRITE, 0x644a, 0x0c }, +{ "drm/msm_drm.h", "DRM_IOCTL_MSM_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x1c }, { "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_CPU_FINI", _IOC_WRITE, 0x6483, 0x04 }, { "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_CPU_PREP", _IOC_WRITE, 0x6482, 0x08 }, { "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6484, 0x28 }, @@ -408,6 +420,7 @@ { "drm/tegra_drm.h", "DRM_IOCTL_TEGRA_SYNCPT_WAIT", _IOC_READ|_IOC_WRITE, 0x6444, 0x10 }, { "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_BO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 }, { "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_SHADER_BO", _IOC_READ|_IOC_WRITE, 0x6445, 0x18 }, +{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GEM_MADVISE", _IOC_READ|_IOC_WRITE, 0x644b, 0x10 }, { "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_HANG_STATE", _IOC_READ|_IOC_WRITE, 0x6446, 0xa0 }, { "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 }, { "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_TILING", _IOC_READ|_IOC_WRITE, 0x6449, 0x10 }, @@ -606,6 +619,7 @@ { "linux/btrfs.h", "BTRFS_IOC_INO_LOOKUP", _IOC_READ|_IOC_WRITE, 0x9412, 0x1000 }, { "linux/btrfs.h", "BTRFS_IOC_INO_PATHS", _IOC_READ|_IOC_WRITE, 0x9423, 0x38 }, { "linux/btrfs.h", "BTRFS_IOC_LOGICAL_INO", _IOC_READ|_IOC_WRITE, 0x9424, 0x38 }, +{ "linux/btrfs.h", "BTRFS_IOC_LOGICAL_INO_V2", _IOC_READ|_IOC_WRITE, 0x943b, 0x38 }, { "linux/btrfs.h", "BTRFS_IOC_QGROUP_ASSIGN", _IOC_WRITE, 0x9429, 0x18 }, { "linux/btrfs.h", "BTRFS_IOC_QGROUP_CREATE", _IOC_WRITE, 0x942a, 0x10 }, { "linux/btrfs.h", "BTRFS_IOC_QGROUP_LIMIT", _IOC_READ, 0x942b, 0x30 }, @@ -2400,6 +2414,7 @@ { "linux/wireless.h", "SIOCSIWSTATS", 0, 0x8B0E, 0 }, { "linux/wireless.h", "SIOCSIWTHRSPY", 0, 0x8B12, 0 }, { "linux/wireless.h", "SIOCSIWTXPOW", 0, 0x8B26, 0 }, +{ "linux/wmi.h", "DELL_WMI_SMBIOS_CMD", _IOC_READ|_IOC_WRITE, 0x5700, 0x34 }, { "media/drv-intf/exynos-fimc.h", "S5P_FIMC_TX_END_NOTIFY", _IOC_NONE, 0x6500, 0x00 }, { "media/i2c/adv7842.h", "ADV7842_CMD_RAM_TEST", _IOC_NONE, 0x56c0, 0x00 }, { "media/i2c/bt819.h", "BT819_FIFO_RESET_HIGH", _IOC_NONE, 0x6201, 0x00 }, diff --git a/linux/32/ioctls_inc_align64.h b/linux/32/ioctls_inc_align64.h index 25de6bad..fd8f575f 100644 --- a/linux/32/ioctls_inc_align64.h +++ b/linux/32/ioctls_inc_align64.h @@ -85,6 +85,7 @@ { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_BO_LIST", _IOC_READ|_IOC_WRITE, 0x6443, 0x18 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_CS", _IOC_READ|_IOC_WRITE, 0x6444, 0x18 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_CTX", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 }, +{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_FENCE_TO_HANDLE", _IOC_READ|_IOC_WRITE, 0x6454, 0x20 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_CREATE", _IOC_READ|_IOC_WRITE, 0x6440, 0x20 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_METADATA", _IOC_READ|_IOC_WRITE, 0x6446, 0x120 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_MMAP", _IOC_READ|_IOC_WRITE, 0x6441, 0x08 }, @@ -93,6 +94,7 @@ { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_VA", _IOC_WRITE, 0x6448, 0x28 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_INFO", _IOC_WRITE, 0x6445, 0x20 }, +{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_SCHED", _IOC_WRITE, 0x6455, 0x10 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_VM", _IOC_READ|_IOC_WRITE, 0x6453, 0x08 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_CS", _IOC_READ|_IOC_WRITE, 0x6449, 0x20 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_FENCES", _IOC_READ|_IOC_WRITE, 0x6452, 0x18 }, @@ -111,6 +113,8 @@ { "drm/drm.h", "DRM_IOCTL_AUTH_MAGIC", _IOC_WRITE, 0x6411, 0x04 }, { "drm/drm.h", "DRM_IOCTL_BLOCK", _IOC_READ|_IOC_WRITE, 0x6412, 0x04 }, { "drm/drm.h", "DRM_IOCTL_CONTROL", _IOC_WRITE, 0x6414, 0x08 }, +{ "drm/drm.h", "DRM_IOCTL_CRTC_GET_SEQUENCE", _IOC_READ|_IOC_WRITE, 0x643b, 0x18 }, +{ "drm/drm.h", "DRM_IOCTL_CRTC_QUEUE_SEQUENCE", _IOC_READ|_IOC_WRITE, 0x643c, 0x18 }, { "drm/drm.h", "DRM_IOCTL_DMA", _IOC_READ|_IOC_WRITE, 0x6429, 0x28 }, { "drm/drm.h", "DRM_IOCTL_DROP_MASTER", _IOC_NONE, 0x641f, 0x00 }, { "drm/drm.h", "DRM_IOCTL_FINISH", _IOC_WRITE, 0x642c, 0x08 }, @@ -138,6 +142,7 @@ { "drm/drm.h", "DRM_IOCTL_MODE_ATTACHMODE", _IOC_READ|_IOC_WRITE, 0x64a8, 0x48 }, { "drm/drm.h", "DRM_IOCTL_MODE_CREATEPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64bd, 0x10 }, { "drm/drm.h", "DRM_IOCTL_MODE_CREATE_DUMB", _IOC_READ|_IOC_WRITE, 0x64b2, 0x20 }, +{ "drm/drm.h", "DRM_IOCTL_MODE_CREATE_LEASE", _IOC_READ|_IOC_WRITE, 0x64c6, 0x18 }, { "drm/drm.h", "DRM_IOCTL_MODE_CURSOR", _IOC_READ|_IOC_WRITE, 0x64a3, 0x1c }, { "drm/drm.h", "DRM_IOCTL_MODE_CURSOR2", _IOC_READ|_IOC_WRITE, 0x64bb, 0x24 }, { "drm/drm.h", "DRM_IOCTL_MODE_DESTROYPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64be, 0x04 }, @@ -154,10 +159,13 @@ { "drm/drm.h", "DRM_IOCTL_MODE_GETPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64ac, 0x10 }, { "drm/drm.h", "DRM_IOCTL_MODE_GETPROPERTY", _IOC_READ|_IOC_WRITE, 0x64aa, 0x40 }, { "drm/drm.h", "DRM_IOCTL_MODE_GETRESOURCES", _IOC_READ|_IOC_WRITE, 0x64a0, 0x40 }, +{ "drm/drm.h", "DRM_IOCTL_MODE_GET_LEASE", _IOC_READ|_IOC_WRITE, 0x64c8, 0x10 }, +{ "drm/drm.h", "DRM_IOCTL_MODE_LIST_LESSEES", _IOC_READ|_IOC_WRITE, 0x64c7, 0x10 }, { "drm/drm.h", "DRM_IOCTL_MODE_MAP_DUMB", _IOC_READ|_IOC_WRITE, 0x64b3, 0x10 }, { "drm/drm.h", "DRM_IOCTL_MODE_OBJ_GETPROPERTIES", _IOC_READ|_IOC_WRITE, 0x64b9, 0x20 }, { "drm/drm.h", "DRM_IOCTL_MODE_OBJ_SETPROPERTY", _IOC_READ|_IOC_WRITE, 0x64ba, 0x18 }, { "drm/drm.h", "DRM_IOCTL_MODE_PAGE_FLIP", _IOC_READ|_IOC_WRITE, 0x64b0, 0x18 }, +{ "drm/drm.h", "DRM_IOCTL_MODE_REVOKE_LEASE", _IOC_READ|_IOC_WRITE, 0x64c9, 0x04 }, { "drm/drm.h", "DRM_IOCTL_MODE_RMFB", _IOC_READ|_IOC_WRITE, 0x64af, 0x04 }, { "drm/drm.h", "DRM_IOCTL_MODE_SETCRTC", _IOC_READ|_IOC_WRITE, 0x64a2, 0x68 }, { "drm/drm.h", "DRM_IOCTL_MODE_SETGAMMA", _IOC_READ|_IOC_WRITE, 0x64a5, 0x20 }, @@ -195,10 +203,12 @@ { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_CPU_PREP", _IOC_WRITE, 0x6444, 0x18 }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_NEW", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 }, -{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x38 }, +{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x48 }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_USERPTR", _IOC_READ|_IOC_WRITE, 0x6448, 0x18 }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_WAIT", _IOC_WRITE, 0x6449, 0x20 }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 }, +{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_PM_QUERY_DOM", _IOC_READ|_IOC_WRITE, 0x644a, 0x48 }, +{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_PM_QUERY_SIG", _IOC_READ|_IOC_WRITE, 0x644b, 0x4c }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x20 }, { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_G2D_EXEC", _IOC_READ|_IOC_WRITE, 0x6462, 0x08 }, { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_G2D_GET_VER", _IOC_READ|_IOC_WRITE, 0x6460, 0x08 }, @@ -304,7 +314,9 @@ { "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_NEW", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 }, { "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x28 }, { "drm/msm_drm.h", "DRM_IOCTL_MSM_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 }, -{ "drm/msm_drm.h", "DRM_IOCTL_MSM_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x18 }, +{ "drm/msm_drm.h", "DRM_IOCTL_MSM_SUBMITQUEUE_CLOSE", _IOC_WRITE, 0x644b, 0x04 }, +{ "drm/msm_drm.h", "DRM_IOCTL_MSM_SUBMITQUEUE_NEW", _IOC_READ|_IOC_WRITE, 0x644a, 0x0c }, +{ "drm/msm_drm.h", "DRM_IOCTL_MSM_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x20 }, { "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_CPU_FINI", _IOC_WRITE, 0x6483, 0x04 }, { "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_CPU_PREP", _IOC_WRITE, 0x6482, 0x08 }, { "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6484, 0x28 }, @@ -408,6 +420,7 @@ { "drm/tegra_drm.h", "DRM_IOCTL_TEGRA_SYNCPT_WAIT", _IOC_READ|_IOC_WRITE, 0x6444, 0x10 }, { "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_BO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 }, { "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_SHADER_BO", _IOC_READ|_IOC_WRITE, 0x6445, 0x18 }, +{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GEM_MADVISE", _IOC_READ|_IOC_WRITE, 0x644b, 0x10 }, { "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_HANG_STATE", _IOC_READ|_IOC_WRITE, 0x6446, 0xa0 }, { "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 }, { "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_TILING", _IOC_READ|_IOC_WRITE, 0x6449, 0x10 }, @@ -606,6 +619,7 @@ { "linux/btrfs.h", "BTRFS_IOC_INO_LOOKUP", _IOC_READ|_IOC_WRITE, 0x9412, 0x1000 }, { "linux/btrfs.h", "BTRFS_IOC_INO_PATHS", _IOC_READ|_IOC_WRITE, 0x9423, 0x38 }, { "linux/btrfs.h", "BTRFS_IOC_LOGICAL_INO", _IOC_READ|_IOC_WRITE, 0x9424, 0x38 }, +{ "linux/btrfs.h", "BTRFS_IOC_LOGICAL_INO_V2", _IOC_READ|_IOC_WRITE, 0x943b, 0x38 }, { "linux/btrfs.h", "BTRFS_IOC_QGROUP_ASSIGN", _IOC_WRITE, 0x9429, 0x18 }, { "linux/btrfs.h", "BTRFS_IOC_QGROUP_CREATE", _IOC_WRITE, 0x942a, 0x10 }, { "linux/btrfs.h", "BTRFS_IOC_QGROUP_LIMIT", _IOC_READ, 0x942b, 0x30 }, @@ -2400,6 +2414,7 @@ { "linux/wireless.h", "SIOCSIWSTATS", 0, 0x8B0E, 0 }, { "linux/wireless.h", "SIOCSIWTHRSPY", 0, 0x8B12, 0 }, { "linux/wireless.h", "SIOCSIWTXPOW", 0, 0x8B26, 0 }, +{ "linux/wmi.h", "DELL_WMI_SMBIOS_CMD", _IOC_READ|_IOC_WRITE, 0x5700, 0x34 }, { "media/drv-intf/exynos-fimc.h", "S5P_FIMC_TX_END_NOTIFY", _IOC_NONE, 0x6500, 0x00 }, { "media/i2c/adv7842.h", "ADV7842_CMD_RAM_TEST", _IOC_NONE, 0x56c0, 0x00 }, { "media/i2c/bt819.h", "BT819_FIFO_RESET_HIGH", _IOC_NONE, 0x6201, 0x00 }, diff --git a/linux/32/syscallent.h b/linux/32/syscallent.h index df25e897..b53bf88f 100644 --- a/linux/32/syscallent.h +++ b/linux/32/syscallent.h @@ -177,20 +177,20 @@ [169] = { 2, 0, SEN(gettimeofday), "gettimeofday" }, [170] = { 2, 0, SEN(settimeofday), "settimeofday" }, [171] = { 1, 0, SEN(adjtimex), "adjtimex" }, -[172] = { 0, NF, SEN(getpid), "getpid" }, -[173] = { 0, NF, SEN(getppid), "getppid" }, -[174] = { 0, NF, SEN(getuid), "getuid" }, -[175] = { 0, NF, SEN(geteuid), "geteuid" }, -[176] = { 0, NF, SEN(getgid), "getgid" }, -[177] = { 0, NF, SEN(getegid), "getegid" }, -[178] = { 0, NF, SEN(gettid), "gettid" }, +[172] = { 0, PU|NF, SEN(getpid), "getpid" }, +[173] = { 0, PU|NF, SEN(getppid), "getppid" }, +[174] = { 0, PU|NF, SEN(getuid), "getuid" }, +[175] = { 0, PU|NF, SEN(geteuid), "geteuid" }, +[176] = { 0, PU|NF, SEN(getgid), "getgid" }, +[177] = { 0, PU|NF, SEN(getegid), "getegid" }, +[178] = { 0, PU|NF, SEN(gettid), "gettid" }, [179] = { 1, 0, SEN(sysinfo), "sysinfo" }, -[180] = { 4, 0, SEN(mq_open), "mq_open" }, +[180] = { 4, TD, SEN(mq_open), "mq_open" }, [181] = { 1, 0, SEN(mq_unlink), "mq_unlink" }, -[182] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" }, -[183] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" }, -[184] = { 2, 0, SEN(mq_notify), "mq_notify" }, -[185] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" }, +[182] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" }, +[183] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" }, +[184] = { 2, TD, SEN(mq_notify), "mq_notify" }, +[185] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" }, [186] = { 2, TI, SEN(msgget), "msgget" }, [187] = { 3, TI, SEN(msgctl), "msgctl" }, [188] = { 5, TI, SEN(msgrcv), "msgrcv" }, diff --git a/linux/64/ioctls_inc.h b/linux/64/ioctls_inc.h index 691b6eae..0bc1c76f 100644 --- a/linux/64/ioctls_inc.h +++ b/linux/64/ioctls_inc.h @@ -85,6 +85,7 @@ { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_BO_LIST", _IOC_READ|_IOC_WRITE, 0x6443, 0x18 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_CS", _IOC_READ|_IOC_WRITE, 0x6444, 0x18 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_CTX", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 }, +{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_FENCE_TO_HANDLE", _IOC_READ|_IOC_WRITE, 0x6454, 0x20 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_CREATE", _IOC_READ|_IOC_WRITE, 0x6440, 0x20 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_METADATA", _IOC_READ|_IOC_WRITE, 0x6446, 0x120 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_MMAP", _IOC_READ|_IOC_WRITE, 0x6441, 0x08 }, @@ -93,6 +94,7 @@ { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_VA", _IOC_WRITE, 0x6448, 0x28 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_INFO", _IOC_WRITE, 0x6445, 0x20 }, +{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_SCHED", _IOC_WRITE, 0x6455, 0x10 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_VM", _IOC_READ|_IOC_WRITE, 0x6453, 0x08 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_CS", _IOC_READ|_IOC_WRITE, 0x6449, 0x20 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_FENCES", _IOC_READ|_IOC_WRITE, 0x6452, 0x18 }, @@ -111,6 +113,8 @@ { "drm/drm.h", "DRM_IOCTL_AUTH_MAGIC", _IOC_WRITE, 0x6411, 0x04 }, { "drm/drm.h", "DRM_IOCTL_BLOCK", _IOC_READ|_IOC_WRITE, 0x6412, 0x04 }, { "drm/drm.h", "DRM_IOCTL_CONTROL", _IOC_WRITE, 0x6414, 0x08 }, +{ "drm/drm.h", "DRM_IOCTL_CRTC_GET_SEQUENCE", _IOC_READ|_IOC_WRITE, 0x643b, 0x18 }, +{ "drm/drm.h", "DRM_IOCTL_CRTC_QUEUE_SEQUENCE", _IOC_READ|_IOC_WRITE, 0x643c, 0x18 }, { "drm/drm.h", "DRM_IOCTL_DMA", _IOC_READ|_IOC_WRITE, 0x6429, 0x40 }, { "drm/drm.h", "DRM_IOCTL_DROP_MASTER", _IOC_NONE, 0x641f, 0x00 }, { "drm/drm.h", "DRM_IOCTL_FINISH", _IOC_WRITE, 0x642c, 0x08 }, @@ -138,6 +142,7 @@ { "drm/drm.h", "DRM_IOCTL_MODE_ATTACHMODE", _IOC_READ|_IOC_WRITE, 0x64a8, 0x48 }, { "drm/drm.h", "DRM_IOCTL_MODE_CREATEPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64bd, 0x10 }, { "drm/drm.h", "DRM_IOCTL_MODE_CREATE_DUMB", _IOC_READ|_IOC_WRITE, 0x64b2, 0x20 }, +{ "drm/drm.h", "DRM_IOCTL_MODE_CREATE_LEASE", _IOC_READ|_IOC_WRITE, 0x64c6, 0x18 }, { "drm/drm.h", "DRM_IOCTL_MODE_CURSOR", _IOC_READ|_IOC_WRITE, 0x64a3, 0x1c }, { "drm/drm.h", "DRM_IOCTL_MODE_CURSOR2", _IOC_READ|_IOC_WRITE, 0x64bb, 0x24 }, { "drm/drm.h", "DRM_IOCTL_MODE_DESTROYPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64be, 0x04 }, @@ -154,10 +159,13 @@ { "drm/drm.h", "DRM_IOCTL_MODE_GETPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64ac, 0x10 }, { "drm/drm.h", "DRM_IOCTL_MODE_GETPROPERTY", _IOC_READ|_IOC_WRITE, 0x64aa, 0x40 }, { "drm/drm.h", "DRM_IOCTL_MODE_GETRESOURCES", _IOC_READ|_IOC_WRITE, 0x64a0, 0x40 }, +{ "drm/drm.h", "DRM_IOCTL_MODE_GET_LEASE", _IOC_READ|_IOC_WRITE, 0x64c8, 0x10 }, +{ "drm/drm.h", "DRM_IOCTL_MODE_LIST_LESSEES", _IOC_READ|_IOC_WRITE, 0x64c7, 0x10 }, { "drm/drm.h", "DRM_IOCTL_MODE_MAP_DUMB", _IOC_READ|_IOC_WRITE, 0x64b3, 0x10 }, { "drm/drm.h", "DRM_IOCTL_MODE_OBJ_GETPROPERTIES", _IOC_READ|_IOC_WRITE, 0x64b9, 0x20 }, { "drm/drm.h", "DRM_IOCTL_MODE_OBJ_SETPROPERTY", _IOC_READ|_IOC_WRITE, 0x64ba, 0x18 }, { "drm/drm.h", "DRM_IOCTL_MODE_PAGE_FLIP", _IOC_READ|_IOC_WRITE, 0x64b0, 0x18 }, +{ "drm/drm.h", "DRM_IOCTL_MODE_REVOKE_LEASE", _IOC_READ|_IOC_WRITE, 0x64c9, 0x04 }, { "drm/drm.h", "DRM_IOCTL_MODE_RMFB", _IOC_READ|_IOC_WRITE, 0x64af, 0x04 }, { "drm/drm.h", "DRM_IOCTL_MODE_SETCRTC", _IOC_READ|_IOC_WRITE, 0x64a2, 0x68 }, { "drm/drm.h", "DRM_IOCTL_MODE_SETGAMMA", _IOC_READ|_IOC_WRITE, 0x64a5, 0x20 }, @@ -195,10 +203,12 @@ { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_CPU_PREP", _IOC_WRITE, 0x6444, 0x18 }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_NEW", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 }, -{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x38 }, +{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x48 }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_USERPTR", _IOC_READ|_IOC_WRITE, 0x6448, 0x18 }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_WAIT", _IOC_WRITE, 0x6449, 0x20 }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 }, +{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_PM_QUERY_DOM", _IOC_READ|_IOC_WRITE, 0x644a, 0x48 }, +{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_PM_QUERY_SIG", _IOC_READ|_IOC_WRITE, 0x644b, 0x4c }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x20 }, { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_G2D_EXEC", _IOC_READ|_IOC_WRITE, 0x6462, 0x08 }, { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_G2D_GET_VER", _IOC_READ|_IOC_WRITE, 0x6460, 0x08 }, @@ -304,7 +314,9 @@ { "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_NEW", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 }, { "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x28 }, { "drm/msm_drm.h", "DRM_IOCTL_MSM_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 }, -{ "drm/msm_drm.h", "DRM_IOCTL_MSM_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x18 }, +{ "drm/msm_drm.h", "DRM_IOCTL_MSM_SUBMITQUEUE_CLOSE", _IOC_WRITE, 0x644b, 0x04 }, +{ "drm/msm_drm.h", "DRM_IOCTL_MSM_SUBMITQUEUE_NEW", _IOC_READ|_IOC_WRITE, 0x644a, 0x0c }, +{ "drm/msm_drm.h", "DRM_IOCTL_MSM_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x20 }, { "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_CPU_FINI", _IOC_WRITE, 0x6483, 0x04 }, { "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_CPU_PREP", _IOC_WRITE, 0x6482, 0x08 }, { "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6484, 0x28 }, @@ -408,6 +420,7 @@ { "drm/tegra_drm.h", "DRM_IOCTL_TEGRA_SYNCPT_WAIT", _IOC_READ|_IOC_WRITE, 0x6444, 0x10 }, { "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_BO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 }, { "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_SHADER_BO", _IOC_READ|_IOC_WRITE, 0x6445, 0x18 }, +{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GEM_MADVISE", _IOC_READ|_IOC_WRITE, 0x644b, 0x10 }, { "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_HANG_STATE", _IOC_READ|_IOC_WRITE, 0x6446, 0xa0 }, { "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 }, { "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_TILING", _IOC_READ|_IOC_WRITE, 0x6449, 0x10 }, @@ -606,6 +619,7 @@ { "linux/btrfs.h", "BTRFS_IOC_INO_LOOKUP", _IOC_READ|_IOC_WRITE, 0x9412, 0x1000 }, { "linux/btrfs.h", "BTRFS_IOC_INO_PATHS", _IOC_READ|_IOC_WRITE, 0x9423, 0x38 }, { "linux/btrfs.h", "BTRFS_IOC_LOGICAL_INO", _IOC_READ|_IOC_WRITE, 0x9424, 0x38 }, +{ "linux/btrfs.h", "BTRFS_IOC_LOGICAL_INO_V2", _IOC_READ|_IOC_WRITE, 0x943b, 0x38 }, { "linux/btrfs.h", "BTRFS_IOC_QGROUP_ASSIGN", _IOC_WRITE, 0x9429, 0x18 }, { "linux/btrfs.h", "BTRFS_IOC_QGROUP_CREATE", _IOC_WRITE, 0x942a, 0x10 }, { "linux/btrfs.h", "BTRFS_IOC_QGROUP_LIMIT", _IOC_READ, 0x942b, 0x30 }, @@ -2400,6 +2414,7 @@ { "linux/wireless.h", "SIOCSIWSTATS", 0, 0x8B0E, 0 }, { "linux/wireless.h", "SIOCSIWTHRSPY", 0, 0x8B12, 0 }, { "linux/wireless.h", "SIOCSIWTXPOW", 0, 0x8B26, 0 }, +{ "linux/wmi.h", "DELL_WMI_SMBIOS_CMD", _IOC_READ|_IOC_WRITE, 0x5700, 0x34 }, { "media/drv-intf/exynos-fimc.h", "S5P_FIMC_TX_END_NOTIFY", _IOC_NONE, 0x6500, 0x00 }, { "media/i2c/adv7842.h", "ADV7842_CMD_RAM_TEST", _IOC_NONE, 0x56c0, 0x00 }, { "media/i2c/bt819.h", "BT819_FIFO_RESET_HIGH", _IOC_NONE, 0x6201, 0x00 }, diff --git a/linux/64/syscallent.h b/linux/64/syscallent.h index a5ab193d..241d9442 100644 --- a/linux/64/syscallent.h +++ b/linux/64/syscallent.h @@ -170,20 +170,20 @@ [169] = { 2, 0, SEN(gettimeofday), "gettimeofday" }, [170] = { 2, 0, SEN(settimeofday), "settimeofday" }, [171] = { 1, 0, SEN(adjtimex), "adjtimex" }, -[172] = { 0, NF, SEN(getpid), "getpid" }, -[173] = { 0, NF, SEN(getppid), "getppid" }, -[174] = { 0, NF, SEN(getuid), "getuid" }, -[175] = { 0, NF, SEN(geteuid), "geteuid" }, -[176] = { 0, NF, SEN(getgid), "getgid" }, -[177] = { 0, NF, SEN(getegid), "getegid" }, -[178] = { 0, NF, SEN(gettid), "gettid" }, +[172] = { 0, PU|NF, SEN(getpid), "getpid" }, +[173] = { 0, PU|NF, SEN(getppid), "getppid" }, +[174] = { 0, PU|NF, SEN(getuid), "getuid" }, +[175] = { 0, PU|NF, SEN(geteuid), "geteuid" }, +[176] = { 0, PU|NF, SEN(getgid), "getgid" }, +[177] = { 0, PU|NF, SEN(getegid), "getegid" }, +[178] = { 0, PU|NF, SEN(gettid), "gettid" }, [179] = { 1, 0, SEN(sysinfo), "sysinfo" }, -[180] = { 4, 0, SEN(mq_open), "mq_open" }, +[180] = { 4, TD, SEN(mq_open), "mq_open" }, [181] = { 1, 0, SEN(mq_unlink), "mq_unlink" }, -[182] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" }, -[183] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" }, -[184] = { 2, 0, SEN(mq_notify), "mq_notify" }, -[185] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" }, +[182] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" }, +[183] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" }, +[184] = { 2, TD, SEN(mq_notify), "mq_notify" }, +[185] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" }, [186] = { 2, TI, SEN(msgget), "msgget" }, [187] = { 3, TI, SEN(msgctl), "msgctl" }, [188] = { 5, TI, SEN(msgrcv), "msgrcv" }, diff --git a/linux/aarch64/arch_defs_.h b/linux/aarch64/arch_defs_.h new file mode 100644 index 00000000..40232fd6 --- /dev/null +++ b/linux/aarch64/arch_defs_.h @@ -0,0 +1,4 @@ +#define HAVE_ARCH_OLD_MMAP 1 +#define HAVE_ARCH_OLD_SELECT 1 +#define HAVE_ARCH_UID16_SYSCALLS 1 +#define SUPPORTED_PERSONALITIES 2 diff --git a/linux/aarch64/arch_regs.c b/linux/aarch64/arch_regs.c index 5d805fb3..234d8c3b 100644 --- a/linux/aarch64/arch_regs.c +++ b/linux/aarch64/arch_regs.c @@ -36,3 +36,6 @@ static struct iovec aarch64_io = { #define ARCH_REGS_FOR_GETREGSET arm_regs_union #define ARCH_IOVEC_FOR_GETREGSET aarch64_io #define ARCH_PC_REG ((aarch64_io.iov_len == sizeof(arm_regs)) ? arm_regs.ARM_pc : aarch64_regs.pc) + +#define ARCH_PERSONALITY_0_IOV_SIZE sizeof(aarch64_regs) +#define ARCH_PERSONALITY_1_IOV_SIZE sizeof(arm_regs) diff --git a/linux/aarch64/get_scno.c b/linux/aarch64/get_scno.c index 569aea09..350f32fb 100644 --- a/linux/aarch64/get_scno.c +++ b/linux/aarch64/get_scno.c @@ -8,14 +8,11 @@ arch_get_scno(struct tcb *tcp) case sizeof(aarch64_regs): /* We are in 64-bit mode */ scno = aarch64_regs.regs[8]; - update_personality(tcp, 0); break; case sizeof(arm_regs): /* We are in 32-bit mode */ /* Note: we don't support OABI, unlike 32-bit ARM build */ scno = arm_regs.ARM_r7; - scno = shuffle_scno(scno); - update_personality(tcp, 1); break; } diff --git a/linux/aarch64/nr_prefix.c b/linux/aarch64/nr_prefix.c new file mode 100644 index 00000000..49fe77ae --- /dev/null +++ b/linux/aarch64/nr_prefix.c @@ -0,0 +1 @@ +#include "../arm/nr_prefix.c" diff --git a/linux/aarch64/shuffle_scno.c b/linux/aarch64/shuffle_scno.c new file mode 100644 index 00000000..7d4de73c --- /dev/null +++ b/linux/aarch64/shuffle_scno.c @@ -0,0 +1,12 @@ +#define shuffle_scno arm_shuffle_scno +#include "../arm/shuffle_scno.c" +#undef shuffle_scno + +kernel_ulong_t +shuffle_scno(kernel_ulong_t scno) +{ + if (current_personality == 1) + return arm_shuffle_scno(scno); + + return scno; +} diff --git a/linux/aarch64/syscallent.h b/linux/aarch64/syscallent.h index 4ff6118c..3220420f 100644 --- a/linux/aarch64/syscallent.h +++ b/linux/aarch64/syscallent.h @@ -49,7 +49,7 @@ [1057] = { 3, TD, SEN(lseek), "lseek" }, [1058] = { 6, TD|TM|SI, SEN(mmap), "mmap" }, [1059] = { 1, 0, SEN(alarm), "alarm" }, -[1060] = { 0, 0, SEN(getpgrp), "getpgrp" }, +[1060] = { 0, PU|NF, SEN(getpgrp), "getpgrp" }, [1061] = { 0, TS, SEN(pause), "pause" }, [1062] = { 1, 0, SEN(time), "time" }, [1063] = { 2, TF, SEN(utime), "utime" }, diff --git a/linux/alpha/arch_defs_.h b/linux/alpha/arch_defs_.h new file mode 100644 index 00000000..f6fe59e5 --- /dev/null +++ b/linux/alpha/arch_defs_.h @@ -0,0 +1,2 @@ +#define HAVE_ARCH_GETRVAL2 1 +#define HAVE_ARCH_DEDICATED_ERR_REG 1 diff --git a/linux/alpha/arch_getrval2.c b/linux/alpha/arch_getrval2.c index f78a9f0f..79533522 100644 --- a/linux/alpha/arch_getrval2.c +++ b/linux/alpha/arch_getrval2.c @@ -2,7 +2,7 @@ long getrval2(struct tcb *tcp) { unsigned long r20; - if (upeek(tcp->pid, 20, &r20) < 0) + if (upeek(tcp, 20, &r20) < 0) return -1; return r20; } diff --git a/linux/alpha/arch_rt_sigframe.c b/linux/alpha/arch_rt_sigframe.c index 3343183d..d341be13 100644 --- a/linux/alpha/arch_rt_sigframe.c +++ b/linux/alpha/arch_rt_sigframe.c @@ -29,5 +29,5 @@ FUNC_GET_RT_SIGFRAME_ADDR { unsigned long addr; - return upeek(tcp->pid, REG_FP, &addr) ? 0 : addr; + return upeek(tcp, REG_FP, &addr) ? 0 : addr; } diff --git a/linux/alpha/arch_sigreturn.c b/linux/alpha/arch_sigreturn.c index d5f19c50..396187ab 100644 --- a/linux/alpha/arch_sigreturn.c +++ b/linux/alpha/arch_sigreturn.c @@ -3,7 +3,7 @@ arch_sigreturn(struct tcb *tcp) { unsigned long addr; - if (upeek(tcp->pid, REG_FP, &addr) < 0) + if (upeek(tcp, REG_FP, &addr) < 0) return; addr += offsetof(struct sigcontext, sc_mask); diff --git a/linux/alpha/get_scno.c b/linux/alpha/get_scno.c index 3ffd78a6..3142da24 100644 --- a/linux/alpha/get_scno.c +++ b/linux/alpha/get_scno.c @@ -4,9 +4,9 @@ arch_get_scno(struct tcb *tcp) { kernel_ulong_t scno = 0; - if (upeek(tcp->pid, REG_A3, &alpha_a3) < 0) + if (upeek(tcp, REG_A3, &alpha_a3) < 0) return -1; - if (upeek(tcp->pid, REG_R0, &scno) < 0) + if (upeek(tcp, REG_R0, &scno) < 0) return -1; /* diff --git a/linux/alpha/get_syscall_args.c b/linux/alpha/get_syscall_args.c index a3857263..be61abfa 100644 --- a/linux/alpha/get_syscall_args.c +++ b/linux/alpha/get_syscall_args.c @@ -5,7 +5,7 @@ get_syscall_args(struct tcb *tcp) unsigned int i; for (i = 0; i < tcp->s_ent->nargs; ++i) - if (upeek(tcp->pid, REG_A0+i, &tcp->u_arg[i]) < 0) + if (upeek(tcp, REG_A0+i, &tcp->u_arg[i]) < 0) return -1; return 1; } diff --git a/linux/alpha/get_syscall_result.c b/linux/alpha/get_syscall_result.c index f4c504f1..e49a8253 100644 --- a/linux/alpha/get_syscall_result.c +++ b/linux/alpha/get_syscall_result.c @@ -1,6 +1,6 @@ static int get_syscall_result_regs(struct tcb *tcp) { - return (upeek(tcp->pid, REG_A3, &alpha_a3) < 0 || - upeek(tcp->pid, REG_R0, &alpha_r0) < 0) ? -1 : 0; + return (upeek(tcp, REG_A3, &alpha_a3) < 0 || + upeek(tcp, REG_R0, &alpha_r0) < 0) ? -1 : 0; } diff --git a/linux/alpha/set_error.c b/linux/alpha/set_error.c index bcc5ff86..169277bc 100644 --- a/linux/alpha/set_error.c +++ b/linux/alpha/set_error.c @@ -2,12 +2,12 @@ static int arch_set_error(struct tcb *tcp) { alpha_r0 = tcp->u_error; - return upoke(tcp->pid, REG_R0, alpha_r0); + return upoke(tcp, REG_R0, alpha_r0); } static int arch_set_success(struct tcb *tcp) { - return upoke(tcp->pid, REG_A3, (alpha_a3 = 0)) - || upoke(tcp->pid, REG_R0, (alpha_r0 = tcp->u_rval)); + return upoke(tcp, REG_A3, (alpha_a3 = 0)) + || upoke(tcp, REG_R0, (alpha_r0 = tcp->u_rval)); } diff --git a/linux/alpha/set_scno.c b/linux/alpha/set_scno.c index d5bcfb6d..e285c9ab 100644 --- a/linux/alpha/set_scno.c +++ b/linux/alpha/set_scno.c @@ -1,5 +1,5 @@ static int arch_set_scno(struct tcb *tcp, kernel_ulong_t scno) { - return upoke(tcp->pid, REG_R0, scno); + return upoke(tcp, REG_R0, scno); } diff --git a/linux/alpha/syscallent.h b/linux/alpha/syscallent.h index 5a72bb24..700ae299 100644 --- a/linux/alpha/syscallent.h +++ b/linux/alpha/syscallent.h @@ -1,7 +1,7 @@ /* * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl> * Copyright (c) 1993, 1994, 1995 Rick Sladkey <jrs@world.std.com> - * Copyright (c) 1995-2017 The strace developers. + * Copyright (c) 1995-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,11 +47,11 @@ [ 17] = { 1, TM|SI, SEN(brk), "brk" }, [ 18] = { 5, TSFA, SEN(printargs), "osf_getfsstat" }, /* not implemented */ [ 19] = { 3, TD, SEN(lseek), "lseek" }, -[ 20] = { 0, NF, SEN(getxpid), "getxpid" }, +[ 20] = { 0, PU|NF, SEN(getxpid), "getxpid" }, [ 21] = { 4, 0, SEN(printargs), "osf_mount" }, [ 22] = { 2, TF, SEN(umount2), "umount" }, [ 23] = { 1, 0, SEN(setuid), "setuid" }, -[ 24] = { 0, NF, SEN(getxuid), "getxuid" }, +[ 24] = { 0, PU|NF, SEN(getxuid), "getxuid" }, [ 25] = { 5, 0, SEN(printargs), "exec_with_loader" }, /* not implemented */ [ 26] = { 4, 0, SEN(ptrace), "ptrace" }, [ 27] = { 5, 0, SEN(printargs), "osf_nrecvmsg" }, /* not implemented */ @@ -74,7 +74,7 @@ [ 44] = { 5, 0, SEN(printargs), "osf_profil" }, /* not implemented */ [ 45] = { 3, TD|TF, SEN(open), "open" }, [ 46] = { 5, 0, SEN(printargs), "osf_old_sigaction" }, /* not implemented */ -[ 47] = { 0, NF, SEN(getxgid), "getxgid" }, +[ 47] = { 0, PU|NF, SEN(getxgid), "getxgid" }, [ 48] = { 2, TS, SEN(osf_sigprocmask), "osf_sigprocmask" }, [ 49] = { 5, 0, SEN(printargs), "osf_getlogin" }, /* not implemented */ [ 50] = { 5, 0, SEN(printargs), "osf_setlogin" }, /* not implemented */ @@ -90,8 +90,8 @@ [ 60] = { 1, NF, SEN(umask), "umask" }, [ 61] = { 1, TF, SEN(chroot), "chroot" }, [ 62] = { 5, TD|TFST|TSTA, SEN(printargs), "osf_old_fstat" }, /* not implemented */ -[ 63] = { 0, 0, SEN(getpgrp), "getpgrp" }, -[ 64] = { 0, 0, SEN(getpagesize), "getpagesize" }, +[ 63] = { 0, PU|NF, SEN(getpgrp), "getpgrp" }, +[ 64] = { 0, PU|NF, SEN(getpagesize), "getpagesize" }, [ 65] = { 5, TM, SEN(printargs), "osf_mremap" }, /* not implemented */ [ 66] = { 0, TP, SEN(vfork), "vfork" }, [ 67] = { 2, TF|TST|TSTA, SEN(stat), "stat" }, @@ -116,7 +116,7 @@ [ 86] = { 2, 0, SEN(osf_getitimer), "osf_getitimer" }, [ 87] = { 2, 0, SEN(gethostname), "gethostname" }, [ 88] = { 2, 0, SEN(sethostname), "sethostname" }, -[ 89] = { 0, 0, SEN(getdtablesize), "getdtablesize" }, +[ 89] = { 0, PU|NF, SEN(getdtablesize), "getdtablesize" }, [ 90] = { 2, TD, SEN(dup2), "dup2" }, [ 91] = { 2, TD|TFST|TSTA, SEN(fstat), "fstat" }, [ 92] = { 3, TD, SEN(fcntl), "fcntl" }, @@ -342,7 +342,7 @@ [375] = { 3, TM, SEN(mincore), "mincore" }, [376] = { 3, 0, SEN(printargs), "pciconfig_iobase" }, [377] = { 3, TD, SEN(getdents64), "getdents64" }, -[378] = { 0, NF, SEN(gettid), "gettid" }, +[378] = { 0, PU|NF, SEN(gettid), "gettid" }, [379] = { 3, TD, SEN(readahead), "readahead" }, [380] = { }, [381] = { 2, TS, SEN(kill), "tkill" }, @@ -395,12 +395,12 @@ [429] = { 6, TM, SEN(mbind), "mbind" }, /* not implemented */ [430] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" }, /* not implemented */ [431] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" }, /* not implemented */ -[432] = { 4, 0, SEN(mq_open), "mq_open" }, +[432] = { 4, TD, SEN(mq_open), "mq_open" }, [433] = { 1, 0, SEN(mq_unlink), "mq_unlink" }, -[434] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" }, -[435] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" }, -[436] = { 2, 0, SEN(mq_notify), "mq_notify" }, -[437] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" }, +[434] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" }, +[435] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" }, +[436] = { 2, TD, SEN(mq_notify), "mq_notify" }, +[437] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" }, [438] = { 5, TP, SEN(waitid), "waitid" }, [439] = { 5, 0, SEN(add_key), "add_key" }, [440] = { 4, 0, SEN(request_key), "request_key" }, diff --git a/linux/arc/syscallent.h b/linux/arc/syscallent.h index edcdff2e..1b7fd772 100644 --- a/linux/arc/syscallent.h +++ b/linux/arc/syscallent.h @@ -3,6 +3,6 @@ /* [244 ... 259] are arch specific */ [244] = { 3, 0, SEN(printargs), "cacheflush" }, [245] = { 1, 0, SEN(printargs), "arc_settls" }, -[246] = { 0, 0, SEN(printargs), "arc_gettls" }, +[246] = { 0, PU|NF, SEN(printargs), "arc_gettls" }, [247] = { 3, 0, SEN(sysfs), "sysfs" }, [248] = { 3, 0, SEN(printargs), "arc_usr_cmpxchg"}, diff --git a/linux/arch_defs_.h b/linux/arch_defs_.h new file mode 100644 index 00000000..a66be262 --- /dev/null +++ b/linux/arch_defs_.h @@ -0,0 +1,33 @@ +/* Fallback file for arch-specific definitions. */ + +#ifndef HAVE_ARCH_GETRVAL2 +# define HAVE_ARCH_GETRVAL2 0 +#endif + +#ifndef HAVE_ARCH_OLD_MMAP +# define HAVE_ARCH_OLD_MMAP 0 +#endif + +#ifndef HAVE_ARCH_OLD_MMAP_PGOFF +# define HAVE_ARCH_OLD_MMAP_PGOFF 0 +#endif + +#ifndef HAVE_ARCH_OLD_SELECT +# define HAVE_ARCH_OLD_SELECT 0 +#endif + +#ifndef HAVE_ARCH_UID16_SYSCALLS +# define HAVE_ARCH_UID16_SYSCALLS 0 +#endif + +#ifndef DEFAULT_PERSONALITY +# define DEFAULT_PERSONALITY 0 +#endif + +#ifndef SUPPORTED_PERSONALITIES +# define SUPPORTED_PERSONALITIES 1 +#endif + +#ifndef HAVE_ARCH_DEDICATED_ERR_REG +# define HAVE_ARCH_DEDICATED_ERR_REG 0 +#endif diff --git a/linux/arch_kvm.c b/linux/arch_kvm.c new file mode 100644 index 00000000..f12f32ab --- /dev/null +++ b/linux/arch_kvm.c @@ -0,0 +1,19 @@ +#ifdef HAVE_STRUCT_KVM_REGS +static void +arch_print_kvm_regs(struct tcb *const tcp, + const kernel_ulong_t addr, + const struct kvm_regs *const regs) +{ + printaddr(addr); +} +#endif /* HAVE_STRUCT_KVM_REGS */ + +#ifdef HAVE_STRUCT_KVM_SREGS +static void +arch_print_kvm_sregs(struct tcb *const tcp, + const kernel_ulong_t addr, + const struct kvm_sregs *const sregs) +{ + printaddr(addr); +} +#endif /* HAVE_STRUCT_KVM_SREGS */ diff --git a/linux/arm/arch_defs_.h b/linux/arm/arch_defs_.h new file mode 100644 index 00000000..a8e961f3 --- /dev/null +++ b/linux/arm/arch_defs_.h @@ -0,0 +1,3 @@ +#define HAVE_ARCH_OLD_MMAP 1 +#define HAVE_ARCH_OLD_SELECT 1 +#define HAVE_ARCH_UID16_SYSCALLS 1 diff --git a/linux/arm/get_scno.c b/linux/arm/get_scno.c index 5f680692..2cd5c711 100644 --- a/linux/arm/get_scno.c +++ b/linux/arm/get_scno.c @@ -2,7 +2,7 @@ * Copyright (c) 2003 Russell King <rmk@arm.linux.org.uk> * Copyright (c) 2011-2013 Denys Vlasenko <vda.linux@googlemail.com> * Copyright (c) 2011-2015 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2015-2017 The strace developers. + * Copyright (c) 2015-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -67,18 +67,13 @@ scno_in_r7: #endif - scno = shuffle_scno(scno); - /* * Do some sanity checks to figure out * whether it's really a syscall entry. */ if (arm_regs.ARM_ip && !scno_in_range(scno)) { - if (debug_flag) - error_msg("pid %d stray syscall exit:" - " ARM_ip = %ld, scno = %ld", - tcp->pid, arm_regs.ARM_ip, - shuffle_scno(scno)); + debug_msg("pid %d stray syscall exit: ARM_ip = %ld, scno = %ld", + tcp->pid, arm_regs.ARM_ip, scno); return 0; } diff --git a/linux/arm/nr_prefix.c b/linux/arm/nr_prefix.c new file mode 100644 index 00000000..99f571ff --- /dev/null +++ b/linux/arm/nr_prefix.c @@ -0,0 +1,12 @@ +static inline const char * +nr_prefix(kernel_ulong_t scno) +{ + /* + * For now, the set of syscalls that are shuffled is equivalent to the + * set of syscalls that have __ARM_NR_ prefix. + */ + if (shuffle_scno(scno) != scno) + return "__ARM_NR_"; + else + return "__NR_"; +} diff --git a/linux/arm/shuffle_scno.c b/linux/arm/shuffle_scno.c new file mode 100644 index 00000000..17a40d67 --- /dev/null +++ b/linux/arm/shuffle_scno.c @@ -0,0 +1,28 @@ +kernel_ulong_t +shuffle_scno(kernel_ulong_t scno) +{ + if (scno < ARM_FIRST_SHUFFLED_SYSCALL) + return scno; + + /* __ARM_NR_cmpxchg? Swap with LAST_ORDINARY+1 */ + if (scno == ARM_FIRST_SHUFFLED_SYSCALL) + return 0x000ffff0; + if (scno == 0x000ffff0) + return ARM_FIRST_SHUFFLED_SYSCALL; + +#define ARM_SECOND_SHUFFLED_SYSCALL (ARM_FIRST_SHUFFLED_SYSCALL + 1) + /* + * Is it ARM specific syscall? + * Swap [0x000f0000, 0x000f0000 + LAST_SPECIAL] range + * with [SECOND_SHUFFLED, SECOND_SHUFFLED + LAST_SPECIAL] range. + */ + if (scno >= 0x000f0000 && + scno <= 0x000f0000 + ARM_LAST_SPECIAL_SYSCALL) { + return scno - 0x000f0000 + ARM_SECOND_SHUFFLED_SYSCALL; + } + if (scno <= ARM_SECOND_SHUFFLED_SYSCALL + ARM_LAST_SPECIAL_SYSCALL) { + return scno + 0x000f0000 - ARM_SECOND_SHUFFLED_SYSCALL; + } + + return scno; +} diff --git a/linux/arm/syscallent.h b/linux/arm/syscallent.h index c5b9564b..76edf99b 100644 --- a/linux/arm/syscallent.h +++ b/linux/arm/syscallent.h @@ -1,7 +1,7 @@ /* * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl> * Copyright (c) 1993, 1994, 1995 Rick Sladkey <jrs@world.std.com> - * Copyright (c) 1995-2017 The strace developers. + * Copyright (c) 1995-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,11 +47,11 @@ [ 17] = { 0, TM, SEN(break), "break" }, [ 18] = { 2, TF|TST|TSTA, SEN(oldstat), "oldstat" }, [ 19] = { 3, TD, SEN(lseek), "lseek" }, -[ 20] = { 0, NF, SEN(getpid), "getpid" }, +[ 20] = { 0, PU|NF, SEN(getpid), "getpid" }, [ 21] = { 5, TF, SEN(mount), "mount" }, [ 22] = { 1, TF, SEN(umount), "umount" }, [ 23] = { 1, 0, SEN(setuid16), "setuid" }, -[ 24] = { 0, NF, SEN(getuid16), "getuid" }, +[ 24] = { 0, PU|NF, SEN(getuid16), "getuid" }, [ 25] = { 1, 0, SEN(stime), "stime" }, [ 26] = { 4, 0, SEN(ptrace), "ptrace" }, [ 27] = { 1, 0, SEN(alarm), "alarm" }, @@ -74,10 +74,10 @@ [ 44] = { 0, 0, SEN(prof), "prof" }, [ 45] = { 1, TM|SI, SEN(brk), "brk" }, [ 46] = { 1, 0, SEN(setgid16), "setgid" }, -[ 47] = { 0, NF, SEN(getgid16), "getgid" }, +[ 47] = { 0, PU|NF, SEN(getgid16), "getgid" }, [ 48] = { 2, TS, SEN(signal), "signal" }, -[ 49] = { 0, NF, SEN(geteuid16), "geteuid" }, -[ 50] = { 0, NF, SEN(getegid16), "getegid" }, +[ 49] = { 0, PU|NF, SEN(geteuid16), "geteuid" }, +[ 50] = { 0, PU|NF, SEN(getegid16), "getegid" }, [ 51] = { 1, TF, SEN(acct), "acct" }, [ 52] = { 2, TF, SEN(umount2), "umount2" }, [ 53] = { 0, 0, SEN(lock), "lock" }, @@ -91,8 +91,8 @@ [ 61] = { 1, TF, SEN(chroot), "chroot" }, [ 62] = { 2, TSFA, SEN(ustat), "ustat" }, [ 63] = { 2, TD, SEN(dup2), "dup2" }, -[ 64] = { 0, NF, SEN(getppid), "getppid" }, -[ 65] = { 0, 0, SEN(getpgrp), "getpgrp" }, +[ 64] = { 0, PU|NF, SEN(getppid), "getppid" }, +[ 65] = { 0, PU|NF, SEN(getpgrp), "getpgrp" }, [ 66] = { 0, 0, SEN(setsid), "setsid" }, [ 67] = { 3, TS, SEN(sigaction), "sigaction" }, [ 68] = { 0, TS, SEN(sgetmask), "sgetmask" }, @@ -226,10 +226,10 @@ [196] = { 2, TF|TLST|TSTA, SEN(lstat64), "lstat64" }, [197] = { 2, TD|TFST|TSTA, SEN(fstat64), "fstat64" }, [198] = { 3, TF, SEN(chown), "lchown32" }, -[199] = { 0, NF, SEN(getuid), "getuid32" }, -[200] = { 0, NF, SEN(getgid), "getgid32" }, -[201] = { 0, NF, SEN(geteuid), "geteuid32" }, -[202] = { 0, NF, SEN(geteuid), "getegid32" }, +[199] = { 0, PU|NF, SEN(getuid), "getuid32" }, +[200] = { 0, PU|NF, SEN(getgid), "getgid32" }, +[201] = { 0, PU|NF, SEN(geteuid), "geteuid32" }, +[202] = { 0, PU|NF, SEN(geteuid), "getegid32" }, [203] = { 2, 0, SEN(setreuid), "setreuid32" }, [204] = { 2, 0, SEN(setregid), "setregid32" }, [205] = { 2, 0, SEN(getgroups), "getgroups32" }, @@ -250,7 +250,7 @@ [220] = { 3, TM, SEN(madvise), "madvise" }, [221] = { 3, TD, SEN(fcntl64), "fcntl64" }, [222 ... 223] = { }, -[224] = { 0, NF, SEN(gettid), "gettid" }, +[224] = { 0, PU|NF, SEN(gettid), "gettid" }, [225] = { 5, TD, SEN(readahead), "readahead" }, [226] = { 5, TF, SEN(setxattr), "setxattr" }, [227] = { 5, TF, SEN(setxattr), "lsetxattr" }, @@ -299,12 +299,12 @@ [271] = { 3, 0, SEN(printargs), "pciconfig_iobase" }, [272] = { 5, 0, SEN(printargs), "pciconfig_read" }, [273] = { 5, 0, SEN(printargs), "pciconfig_write" }, -[274] = { 4, 0, SEN(mq_open), "mq_open" }, +[274] = { 4, TD, SEN(mq_open), "mq_open" }, [275] = { 1, 0, SEN(mq_unlink), "mq_unlink" }, -[276] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" }, -[277] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" }, -[278] = { 2, 0, SEN(mq_notify), "mq_notify" }, -[279] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" }, +[276] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" }, +[277] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" }, +[278] = { 2, TD, SEN(mq_notify), "mq_notify" }, +[279] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" }, [280] = { 5, TP, SEN(waitid), "waitid" }, [281] = { 3, TN, SEN(socket), "socket" }, [282] = { 3, TN, SEN(bind), "bind" }, @@ -444,9 +444,10 @@ * Remapped by shuffle_scno() to be directly after __ARM_NR_cmpxchg. */ [ARM_FIRST_SHUFFLED_SYSCALL+1+0] = { }, -[ARM_FIRST_SHUFFLED_SYSCALL+1+1] = { 5, 0, SEN(printargs), "breakpoint" }, -[ARM_FIRST_SHUFFLED_SYSCALL+1+2] = { 5, 0, SEN(printargs), "cacheflush" }, -[ARM_FIRST_SHUFFLED_SYSCALL+1+3] = { 5, 0, SEN(printargs), "usr26" }, -[ARM_FIRST_SHUFFLED_SYSCALL+1+4] = { 5, 0, SEN(printargs), "usr32" }, -[ARM_FIRST_SHUFFLED_SYSCALL+1+5] = { 5, 0, SEN(printargs), "set_tls" }, -#define ARM_LAST_SPECIAL_SYSCALL 5 +[ARM_FIRST_SHUFFLED_SYSCALL+1+1] = { 0, 0, SEN(printargs), "breakpoint" }, +[ARM_FIRST_SHUFFLED_SYSCALL+1+2] = { 3, TM, SEN(printargs), "cacheflush" }, +[ARM_FIRST_SHUFFLED_SYSCALL+1+3] = { 0, 0, SEN(printargs), "usr26" }, +[ARM_FIRST_SHUFFLED_SYSCALL+1+4] = { 0, 0, SEN(printargs), "usr32" }, +[ARM_FIRST_SHUFFLED_SYSCALL+1+5] = { 1, 0, SEN(printargs), "set_tls" }, +[ARM_FIRST_SHUFFLED_SYSCALL+1+6] = { 0, PU|NF, SEN(printargs), "get_tls" }, +#define ARM_LAST_SPECIAL_SYSCALL 6 diff --git a/linux/avr32/syscallent.h b/linux/avr32/syscallent.h index d75e5df7..c9dc52c5 100644 --- a/linux/avr32/syscallent.h +++ b/linux/avr32/syscallent.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Atmel Corporation - * Copyright (c) 2009-2017 The strace developers. + * Copyright (c) 2009-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -46,11 +46,11 @@ [ 17] = { 3, TF, SEN(chown), "lchown" }, [ 18] = { 3, TD, SEN(lseek), "lseek" }, [ 19] = { 5, TD, SEN(llseek), "_llseek" }, -[ 20] = { 0, NF, SEN(getpid), "getpid" }, +[ 20] = { 0, PU|NF, SEN(getpid), "getpid" }, [ 21] = { 5, TF, SEN(mount), "mount" }, [ 22] = { 1, TF, SEN(umount2), "umount2" }, [ 23] = { 1, 0, SEN(setuid), "setuid" }, -[ 24] = { 0, NF, SEN(getuid), "getuid" }, +[ 24] = { 0, PU|NF, SEN(getuid), "getuid" }, [ 25] = { 1, 0, SEN(stime), "stime" }, [ 26] = { 4, 0, SEN(ptrace), "ptrace" }, [ 27] = { 1, 0, SEN(alarm), "alarm" }, @@ -73,10 +73,10 @@ [ 44] = { 5, TP, SEN(clone), "clone" }, [ 45] = { 1, TM|SI, SEN(brk), "brk" }, [ 46] = { 1, 0, SEN(setgid), "setgid" }, -[ 47] = { 0, NF, SEN(getgid), "getgid" }, +[ 47] = { 0, PU|NF, SEN(getgid), "getgid" }, [ 48] = { 2, TF, SEN(getcwd), "getcwd" }, -[ 49] = { 0, NF, SEN(geteuid), "geteuid" }, -[ 50] = { 0, NF, SEN(getegid), "getegid" }, +[ 49] = { 0, PU|NF, SEN(geteuid), "geteuid" }, +[ 50] = { 0, PU|NF, SEN(getegid), "getegid" }, [ 51] = { 1, TF, SEN(acct), "acct" }, [ 52] = { 1, NF, SEN(setfsuid), "setfsuid" }, [ 53] = { 1, NF, SEN(setfsgid), "setfsgid" }, @@ -90,8 +90,8 @@ [ 61] = { 2, 0, SEN(setregid), "setregid" }, [ 62] = { 2, TSFA, SEN(ustat), "ustat" }, [ 63] = { 2, TD, SEN(dup2), "dup2" }, -[ 64] = { 0, NF, SEN(getppid), "getppid" }, -[ 65] = { 0, 0, SEN(getpgrp), "getpgrp" }, +[ 64] = { 0, PU|NF, SEN(getppid), "getppid" }, +[ 65] = { 0, PU|NF, SEN(getpgrp), "getpgrp" }, [ 66] = { 0, 0, SEN(setsid), "setsid" }, [ 67] = { 4, TS, SEN(rt_sigaction), "rt_sigaction" }, [ 68] = { 0, TS, SEN(rt_sigreturn), "rt_sigreturn" }, @@ -202,7 +202,7 @@ [173] = { 3, TM, SEN(madvise), "madvise" }, [174] = { 3, TD, SEN(getdents64), "getdents64" }, [175] = { 3, TD, SEN(fcntl64), "fcntl64" }, -[176] = { 0, NF, SEN(gettid), "gettid" }, +[176] = { 0, PU|NF, SEN(gettid), "gettid" }, [177] = { 4, TD, SEN(readahead), "readahead" }, [178] = { 5, TF, SEN(setxattr), "setxattr" }, [179] = { 5, TF, SEN(setxattr), "lsetxattr" }, @@ -253,12 +253,12 @@ [224] = { 6, TD, SEN(fadvise64_64), "fadvise64_64" }, [225] = { 3, 0, SEN(printargs), "cacheflush" }, [226] = { 5, 0, SEN(vserver), "vserver" }, -[227] = { 4, 0, SEN(mq_open), "mq_open" }, +[227] = { 4, TD, SEN(mq_open), "mq_open" }, [228] = { 1, 0, SEN(mq_unlink), "mq_unlink" }, -[229] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" }, -[230] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" }, -[231] = { 2, 0, SEN(mq_notify), "mq_notify" }, -[232] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" }, +[229] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" }, +[230] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" }, +[231] = { 2, TD, SEN(mq_notify), "mq_notify" }, +[232] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" }, [233] = { 4, 0, SEN(kexec_load), "kexec_load" }, [234] = { 5, TP, SEN(waitid), "waitid" }, [235] = { 5, 0, SEN(add_key), "add_key" }, diff --git a/linux/bfin/arch_defs_.h b/linux/bfin/arch_defs_.h new file mode 100644 index 00000000..d642058b --- /dev/null +++ b/linux/bfin/arch_defs_.h @@ -0,0 +1,2 @@ +#define HAVE_ARCH_OLD_SELECT 1 +#define HAVE_ARCH_UID16_SYSCALLS 1 diff --git a/linux/bfin/arch_rt_sigframe.c b/linux/bfin/arch_rt_sigframe.c index d84b8348..1692685c 100644 --- a/linux/bfin/arch_rt_sigframe.c +++ b/linux/bfin/arch_rt_sigframe.c @@ -29,5 +29,5 @@ FUNC_GET_RT_SIGFRAME_ADDR { unsigned long addr; - return upeek(tcp->pid, PT_USP, &addr) ? 0 : addr; + return upeek(tcp, PT_USP, &addr) ? 0 : addr; } diff --git a/linux/bfin/get_scno.c b/linux/bfin/get_scno.c index 8c3a7d21..c394889c 100644 --- a/linux/bfin/get_scno.c +++ b/linux/bfin/get_scno.c @@ -2,5 +2,5 @@ static int arch_get_scno(struct tcb *tcp) { - return upeek(tcp->pid, PT_ORIG_P0, &tcp->scno) < 0 ? -1 : 1; + return upeek(tcp, PT_ORIG_P0, &tcp->scno) < 0 ? -1 : 1; } diff --git a/linux/bfin/get_syscall_args.c b/linux/bfin/get_syscall_args.c index 69613d4e..506d3a99 100644 --- a/linux/bfin/get_syscall_args.c +++ b/linux/bfin/get_syscall_args.c @@ -8,7 +8,7 @@ get_syscall_args(struct tcb *tcp) unsigned int i; for (i = 0; i < tcp->s_ent->nargs; ++i) - if (upeek(tcp->pid, argreg[i], &tcp->u_arg[i]) < 0) + if (upeek(tcp, argreg[i], &tcp->u_arg[i]) < 0) return -1; return 1; } diff --git a/linux/bfin/get_syscall_result.c b/linux/bfin/get_syscall_result.c index c189a5fd..5c814b47 100644 --- a/linux/bfin/get_syscall_result.c +++ b/linux/bfin/get_syscall_result.c @@ -1,5 +1,5 @@ static int get_syscall_result_regs(struct tcb *tcp) { - return upeek(tcp->pid, PT_R0, &bfin_r0) < 0 ? -1 : 0; + return upeek(tcp, PT_R0, &bfin_r0) < 0 ? -1 : 0; } diff --git a/linux/bfin/set_error.c b/linux/bfin/set_error.c index 2bfecda0..002d904d 100644 --- a/linux/bfin/set_error.c +++ b/linux/bfin/set_error.c @@ -2,12 +2,12 @@ static int arch_set_error(struct tcb *tcp) { bfin_r0 = -tcp->u_error; - return upoke(tcp->pid, PT_R0, bfin_r0); + return upoke(tcp, PT_R0, bfin_r0); } static int arch_set_success(struct tcb *tcp) { bfin_r0 = tcp->u_rval; - return upoke(tcp->pid, PT_R0, bfin_r0); + return upoke(tcp, PT_R0, bfin_r0); } diff --git a/linux/bfin/set_scno.c b/linux/bfin/set_scno.c index 4508be1a..d63230fe 100644 --- a/linux/bfin/set_scno.c +++ b/linux/bfin/set_scno.c @@ -1,5 +1,5 @@ static int arch_set_scno(struct tcb *tcp, kernel_ulong_t scno) { - return upoke(tcp->pid, PT_ORIG_P0, scno); + return upoke(tcp, PT_ORIG_P0, scno); } diff --git a/linux/bfin/syscallent.h b/linux/bfin/syscallent.h index b68443e7..1ce2ff30 100644 --- a/linux/bfin/syscallent.h +++ b/linux/bfin/syscallent.h @@ -1,7 +1,7 @@ /* * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl> * Copyright (c) 1993, 1994, 1995 Rick Sladkey <jrs@world.std.com> - * Copyright (c) 1995-2017 The strace developers. + * Copyright (c) 1995-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,11 +47,11 @@ [ 17] = { 0, TM, SEN(break), "break" }, [ 18] = { 2, TF|TST|TSTA, SEN(oldstat), "oldstat" }, [ 19] = { 3, TD, SEN(lseek), "lseek" }, -[ 20] = { 0, NF, SEN(getpid), "getpid" }, +[ 20] = { 0, PU|NF, SEN(getpid), "getpid" }, [ 21] = { 5, TF, SEN(mount), "mount" }, [ 22] = { 1, TF, SEN(umount), "umount" }, [ 23] = { 1, 0, SEN(setuid16), "setuid" }, -[ 24] = { 0, NF, SEN(getuid16), "getuid" }, +[ 24] = { 0, PU|NF, SEN(getuid16), "getuid" }, [ 25] = { 1, 0, SEN(stime), "stime" }, [ 26] = { 4, 0, SEN(ptrace), "ptrace" }, [ 27] = { 1, 0, SEN(alarm), "alarm" }, @@ -74,10 +74,10 @@ [ 44] = { 0, 0, SEN(prof), "prof" }, [ 45] = { 1, TM|SI, SEN(brk), "brk" }, [ 46] = { 1, 0, SEN(setgid16), "setgid" }, -[ 47] = { 0, NF, SEN(getgid16), "getgid" }, +[ 47] = { 0, PU|NF, SEN(getgid16), "getgid" }, [ 48] = { 2, TS, SEN(signal), "signal" }, -[ 49] = { 0, NF, SEN(geteuid16), "geteuid" }, -[ 50] = { 0, NF, SEN(getegid16), "getegid" }, +[ 49] = { 0, PU|NF, SEN(geteuid16), "geteuid" }, +[ 50] = { 0, PU|NF, SEN(getegid16), "getegid" }, [ 51] = { 1, TF, SEN(acct), "acct" }, [ 52] = { 2, TF, SEN(umount2), "umount2" }, [ 53] = { 0, 0, SEN(lock), "lock" }, @@ -91,8 +91,8 @@ [ 61] = { 1, TF, SEN(chroot), "chroot" }, [ 62] = { 2, TSFA, SEN(ustat), "ustat" }, [ 63] = { 2, TD, SEN(dup2), "dup2" }, -[ 64] = { 0, NF, SEN(getppid), "getppid" }, -[ 65] = { 0, 0, SEN(getpgrp), "getpgrp" }, +[ 64] = { 0, PU|NF, SEN(getppid), "getppid" }, +[ 65] = { 0, PU|NF, SEN(getpgrp), "getpgrp" }, [ 66] = { 0, 0, SEN(setsid), "setsid" }, [ 67] = { 3, TS, SEN(sigaction), "sigaction" }, [ 68] = { 0, TS, SEN(sgetmask), "sgetmask" }, @@ -226,10 +226,10 @@ [196] = { 2, TF|TLST|TSTA, SEN(lstat64), "lstat64" }, [197] = { 2, TD|TFST|TSTA, SEN(fstat64), "fstat64" }, [198] = { 3, TF, SEN(chown), "chown32" }, -[199] = { 0, NF, SEN(getuid), "getuid32" }, -[200] = { 0, NF, SEN(getgid), "getgid32" }, -[201] = { 0, NF, SEN(geteuid), "geteuid32" }, -[202] = { 0, NF, SEN(geteuid), "getegid32" }, +[199] = { 0, PU|NF, SEN(getuid), "getuid32" }, +[200] = { 0, PU|NF, SEN(getgid), "getgid32" }, +[201] = { 0, PU|NF, SEN(geteuid), "geteuid32" }, +[202] = { 0, PU|NF, SEN(geteuid), "getegid32" }, [203] = { 2, 0, SEN(setreuid), "setreuid32" }, [204] = { 2, 0, SEN(setregid), "setregid32" }, [205] = { 2, 0, SEN(getgroups), "getgroups32" }, @@ -250,7 +250,7 @@ [220] = { 3, TD, SEN(getdents64), "getdents64" }, [221] = { 3, TD, SEN(fcntl64), "fcntl64" }, [222 ... 223] = { }, -[224] = { 0, NF, SEN(gettid), "gettid" }, +[224] = { 0, PU|NF, SEN(gettid), "gettid" }, [225] = { 4, TD, SEN(readahead), "readahead" }, [226] = { 5, TF, SEN(setxattr), "setxattr" }, [227] = { 5, TF, SEN(setxattr), "lsetxattr" }, @@ -304,12 +304,12 @@ [275] = { 6, TM, SEN(mbind), "mbind" }, [276] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" }, [277] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" }, -[278] = { 4, 0, SEN(mq_open), "mq_open" }, +[278] = { 4, TD, SEN(mq_open), "mq_open" }, [279] = { 1, 0, SEN(mq_unlink), "mq_unlink" }, -[280] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" }, -[281] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" }, -[282] = { 2, 0, SEN(mq_notify), "mq_notify" }, -[283] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" }, +[280] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" }, +[281] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" }, +[282] = { 2, TD, SEN(mq_notify), "mq_notify" }, +[283] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" }, [284] = { 4, 0, SEN(kexec_load), "kexec_load" }, [285] = { 5, TP, SEN(waitid), "waitid" }, [286] = { 5, 0, SEN(add_key), "add_key" }, diff --git a/linux/crisv10/arch_regs.c b/linux/crisv10/arch_regs.c deleted file mode 100644 index 9c372a36..00000000 --- a/linux/crisv10/arch_regs.c +++ /dev/null @@ -1,2 +0,0 @@ -static unsigned long cris_r10; -#define ARCH_PC_PEEK_ADDR (4 * PT_IRP) diff --git a/linux/crisv10/arch_sigreturn.c b/linux/crisv10/arch_sigreturn.c deleted file mode 100644 index 0458c8e8..00000000 --- a/linux/crisv10/arch_sigreturn.c +++ /dev/null @@ -1,16 +0,0 @@ -static void -arch_sigreturn(struct tcb *tcp) -{ - unsigned long regs[PT_MAX + 1]; - - if (ptrace(PTRACE_GETREGS, tcp->pid, NULL, regs) < 0) { - perror_msg("sigreturn: PTRACE_GETREGS"); - return; - } - const unsigned long addr = - regs[PT_USP] + offsetof(struct sigcontext, oldmask); - - tprints("{mask="); - print_sigset_addr(tcp, addr); - tprints("}"); -} diff --git a/linux/crisv10/get_error.c b/linux/crisv10/get_error.c deleted file mode 100644 index 2c81f1b7..00000000 --- a/linux/crisv10/get_error.c +++ /dev/null @@ -1,12 +0,0 @@ -#include "negated_errno.h" - -static void -get_error(struct tcb *tcp, const bool check_errno) -{ - if (check_errno && is_negated_errno(cris_r10)) { - tcp->u_rval = -1; - tcp->u_error = -cris_r10; - } else { - tcp->u_rval = cris_r10; - } -} diff --git a/linux/crisv10/get_scno.c b/linux/crisv10/get_scno.c deleted file mode 100644 index 14ff3386..00000000 --- a/linux/crisv10/get_scno.c +++ /dev/null @@ -1,6 +0,0 @@ -/* Return codes: 1 - ok, 0 - ignore, other - error. */ -static int -arch_get_scno(struct tcb *tcp) -{ - return upeek(tcp->pid, 4 * PT_R9, &tcp->scno) < 0 ? -1 : 1; -} diff --git a/linux/crisv10/get_syscall_args.c b/linux/crisv10/get_syscall_args.c deleted file mode 100644 index bdd05746..00000000 --- a/linux/crisv10/get_syscall_args.c +++ /dev/null @@ -1,15 +0,0 @@ -/* Return -1 on error or 1 on success (never 0!). */ -static int -get_syscall_args(struct tcb *tcp) -{ - static const int crisregs[MAX_ARGS] = { - 4*PT_ORIG_R10, 4*PT_R11, 4*PT_R12, - 4*PT_R13 , 4*PT_MOF, 4*PT_SRP - }; - unsigned int i; - - for (i = 0; i < tcp->s_ent->nargs; ++i) - if (upeek(tcp->pid, crisregs[i], &tcp->u_arg[i]) < 0) - return -1; - return 1; -} diff --git a/linux/crisv10/get_syscall_result.c b/linux/crisv10/get_syscall_result.c deleted file mode 100644 index 6b3679c1..00000000 --- a/linux/crisv10/get_syscall_result.c +++ /dev/null @@ -1,5 +0,0 @@ -static int -get_syscall_result_regs(struct tcb *tcp) -{ - return upeek(tcp->pid, 4 * PT_R10, &cris_r10) < 0 ? -1 : 0; -} diff --git a/linux/crisv10/set_error.c b/linux/crisv10/set_error.c deleted file mode 100644 index 3a14a87a..00000000 --- a/linux/crisv10/set_error.c +++ /dev/null @@ -1,13 +0,0 @@ -static int -arch_set_error(struct tcb *tcp) -{ - cris_r10 = -tcp->u_error; - return upoke(tcp->pid, 4 * PT_R10, cris_r10); -} - -static int -arch_set_success(struct tcb *tcp) -{ - cris_r10 = tcp->u_rval; - return upoke(tcp->pid, 4 * PT_R10, cris_r10); -} diff --git a/linux/crisv10/set_scno.c b/linux/crisv10/set_scno.c deleted file mode 100644 index 0de38fa7..00000000 --- a/linux/crisv10/set_scno.c +++ /dev/null @@ -1,5 +0,0 @@ -static int -arch_set_scno(struct tcb *tcp, kernel_ulong_t scno) -{ - return upoke(tcp->pid, 4 * PT_R9, scno); -} diff --git a/linux/crisv10/syscallent.h b/linux/crisv10/syscallent.h deleted file mode 100644 index 0232d2fa..00000000 --- a/linux/crisv10/syscallent.h +++ /dev/null @@ -1,358 +0,0 @@ -[ 0] = { 0, 0, SEN(restart_syscall), "restart_syscall" }, -[ 1] = { 1, TP|SE, SEN(exit), "exit" }, -[ 2] = { 0, TP, SEN(fork), "fork" }, -[ 3] = { 3, TD, SEN(read), "read" }, -[ 4] = { 3, TD, SEN(write), "write" }, -[ 5] = { 3, TD|TF, SEN(open), "open" }, -[ 6] = { 1, TD, SEN(close), "close" }, -[ 7] = { 3, TP, SEN(waitpid), "waitpid" }, -[ 8] = { 2, TD|TF, SEN(creat), "creat" }, -[ 9] = { 2, TF, SEN(link), "link" }, -[ 10] = { 1, TF, SEN(unlink), "unlink" }, -[ 11] = { 3, TF|TP|SE|SI, SEN(execve), "execve" }, -[ 12] = { 1, TF, SEN(chdir), "chdir" }, -[ 13] = { 1, 0, SEN(time), "time" }, -[ 14] = { 3, TF, SEN(mknod), "mknod" }, -[ 15] = { 2, TF, SEN(chmod), "chmod" }, -[ 16] = { 3, TF, SEN(chown16), "lchown" }, -[ 17] = { 0, TM, SEN(break), "break" }, -[ 18] = { 2, TF|TST|TSTA, SEN(oldstat), "oldstat" }, -[ 19] = { 3, TD, SEN(lseek), "lseek" }, -[ 20] = { 0, NF, SEN(getpid), "getpid" }, -[ 21] = { 5, TF, SEN(mount), "mount" }, -[ 22] = { 1, TF, SEN(umount), "umount" }, -[ 23] = { 1, 0, SEN(setuid16), "setuid" }, -[ 24] = { 0, NF, SEN(getuid16), "getuid" }, -[ 25] = { 1, 0, SEN(stime), "stime" }, -[ 26] = { 4, 0, SEN(ptrace), "ptrace" }, -[ 27] = { 1, 0, SEN(alarm), "alarm" }, -[ 28] = { 2, TD|TFST|TSTA, SEN(oldfstat), "oldfstat" }, -[ 29] = { 0, TS, SEN(pause), "pause" }, -[ 30] = { 2, TF, SEN(utime), "utime" }, -[ 31] = { 2, 0, SEN(stty), "stty" }, -[ 32] = { 2, 0, SEN(gtty), "gtty" }, -[ 33] = { 2, TF, SEN(access), "access" }, -[ 34] = { 1, 0, SEN(nice), "nice" }, -[ 35] = { 0, 0, SEN(ftime), "ftime" }, -[ 36] = { 0, 0, SEN(sync), "sync" }, -[ 37] = { 2, TS, SEN(kill), "kill" }, -[ 38] = { 2, TF, SEN(rename), "rename" }, -[ 39] = { 2, TF, SEN(mkdir), "mkdir" }, -[ 40] = { 1, TF, SEN(rmdir), "rmdir" }, -[ 41] = { 1, TD, SEN(dup), "dup" }, -[ 42] = { 1, TD, SEN(pipe), "pipe" }, -[ 43] = { 1, 0, SEN(times), "times" }, -[ 44] = { 0, 0, SEN(prof), "prof" }, -[ 45] = { 1, TM|SI, SEN(brk), "brk" }, -[ 46] = { 1, 0, SEN(setgid16), "setgid" }, -[ 47] = { 0, NF, SEN(getgid16), "getgid" }, -[ 48] = { 2, TS, SEN(signal), "signal" }, -[ 49] = { 0, NF, SEN(geteuid16), "geteuid" }, -[ 50] = { 0, NF, SEN(getegid16), "getegid" }, -[ 51] = { 1, TF, SEN(acct), "acct" }, -[ 52] = { 2, TF, SEN(umount2), "umount2" }, -[ 53] = { 0, 0, SEN(lock), "lock" }, -[ 54] = { 3, TD, SEN(ioctl), "ioctl" }, -[ 55] = { 3, TD, SEN(fcntl), "fcntl" }, -[ 56] = { 0, 0, SEN(mpx), "mpx" }, -[ 57] = { 2, 0, SEN(setpgid), "setpgid" }, -[ 58] = { 2, 0, SEN(ulimit), "ulimit" }, -[ 59] = { 1, 0, SEN(oldolduname), "oldolduname" }, -[ 60] = { 1, NF, SEN(umask), "umask" }, -[ 61] = { 1, TF, SEN(chroot), "chroot" }, -[ 62] = { 2, TSFA, SEN(ustat), "ustat" }, -[ 63] = { 2, TD, SEN(dup2), "dup2" }, -[ 64] = { 0, NF, SEN(getppid), "getppid" }, -[ 65] = { 0, 0, SEN(getpgrp), "getpgrp" }, -[ 66] = { 0, 0, SEN(setsid), "setsid" }, -[ 67] = { 3, TS, SEN(sigaction), "sigaction" }, -[ 68] = { 0, TS, SEN(sgetmask), "sgetmask" }, -[ 69] = { 1, TS, SEN(ssetmask), "ssetmask" }, -[ 70] = { 2, 0, SEN(setreuid16), "setreuid" }, -[ 71] = { 2, 0, SEN(setregid16), "setregid" }, -[ 72] = { 1, TS, SEN(sigsuspend), "sigsuspend" }, -[ 73] = { 1, TS, SEN(sigpending), "sigpending" }, -[ 74] = { 2, 0, SEN(sethostname), "sethostname" }, -[ 75] = { 2, 0, SEN(setrlimit), "setrlimit" }, -[ 76] = { 2, 0, SEN(getrlimit), "getrlimit" }, -[ 77] = { 2, 0, SEN(getrusage), "getrusage" }, -[ 78] = { 2, 0, SEN(gettimeofday), "gettimeofday" }, -[ 79] = { 2, 0, SEN(settimeofday), "settimeofday" }, -[ 80] = { 2, 0, SEN(getgroups16), "getgroups" }, -[ 81] = { 2, 0, SEN(setgroups16), "setgroups" }, -[ 82] = { 1, TD, SEN(oldselect), "select" }, -[ 83] = { 2, TF, SEN(symlink), "symlink" }, -[ 84] = { 2, TF|TLST|TSTA, SEN(oldlstat), "oldlstat" }, -[ 85] = { 3, TF, SEN(readlink), "readlink" }, -[ 86] = { 1, TF, SEN(uselib), "uselib" }, -[ 87] = { 2, TF, SEN(swapon), "swapon" }, -[ 88] = { 4, 0, SEN(reboot), "reboot" }, -[ 89] = { 3, TD, SEN(readdir), "readdir" }, -[ 90] = { 1, TD|TM|SI, SEN(old_mmap), "mmap" }, -[ 91] = { 2, TM|SI, SEN(munmap), "munmap" }, -[ 92] = { 2, TF, SEN(truncate), "truncate" }, -[ 93] = { 2, TD, SEN(ftruncate), "ftruncate" }, -[ 94] = { 2, TD, SEN(fchmod), "fchmod" }, -[ 95] = { 3, TD, SEN(fchown16), "fchown" }, -[ 96] = { 2, 0, SEN(getpriority), "getpriority" }, -[ 97] = { 3, 0, SEN(setpriority), "setpriority" }, -[ 98] = { 4, 0, SEN(profil), "profil" }, -[ 99] = { 2, TF|TSF|TSFA, SEN(statfs), "statfs" }, -[100] = { 2, TD|TFSF|TSFA, SEN(fstatfs), "fstatfs" }, -[101] = { 3, 0, SEN(ioperm), "ioperm" }, -[102] = { 2, TD, SEN(socketcall), "socketcall" }, -[103] = { 3, 0, SEN(syslog), "syslog" }, -[104] = { 3, 0, SEN(setitimer), "setitimer" }, -[105] = { 2, 0, SEN(getitimer), "getitimer" }, -[106] = { 2, TF|TST|TSTA, SEN(stat), "stat" }, -[107] = { 2, TF|TLST|TSTA, SEN(lstat), "lstat" }, -[108] = { 2, TD|TFST|TSTA, SEN(fstat), "fstat" }, -[109] = { 1, 0, SEN(olduname), "olduname" }, -[110] = { 1, 0, SEN(iopl), "iopl" }, -[111] = { 0, 0, SEN(vhangup), "vhangup" }, -[112] = { 0, 0, SEN(idle), "idle" }, -[113] = { 5, 0, SEN(vm86), "vm86" }, -[114] = { 4, TP, SEN(wait4), "wait4" }, -[115] = { 1, TF, SEN(swapoff), "swapoff" }, -[116] = { 1, 0, SEN(sysinfo), "sysinfo" }, -[117] = { 6, TI, SEN(ipc), "ipc" }, -[118] = { 1, TD, SEN(fsync), "fsync" }, -[119] = { 0, TS, SEN(sigreturn), "sigreturn" }, -[120] = { 5, TP, SEN(clone), "clone" }, -[121] = { 2, 0, SEN(setdomainname), "setdomainname" }, -[122] = { 1, 0, SEN(uname), "uname" }, -[123] = { 3, 0, SEN(modify_ldt), "modify_ldt" }, -[124] = { 1, 0, SEN(adjtimex), "adjtimex" }, -[125] = { 3, TM|SI, SEN(mprotect), "mprotect" }, -[126] = { 3, TS, SEN(sigprocmask), "sigprocmask" }, -[127] = { 2, 0, SEN(create_module), "create_module" }, -[128] = { 3, 0, SEN(init_module), "init_module" }, -[129] = { 2, 0, SEN(delete_module), "delete_module" }, -[130] = { 1, 0, SEN(get_kernel_syms), "get_kernel_syms" }, -[131] = { 4, TF, SEN(quotactl), "quotactl" }, -[132] = { 1, 0, SEN(getpgid), "getpgid" }, -[133] = { 1, TD, SEN(fchdir), "fchdir" }, -[134] = { 2, 0, SEN(bdflush), "bdflush" }, -[135] = { 3, 0, SEN(sysfs), "sysfs" }, -[136] = { 1, NF, SEN(personality), "personality" }, -[137] = { 5, 0, SEN(afs_syscall), "afs_syscall" }, -[138] = { 1, NF, SEN(setfsuid16), "setfsuid" }, -[139] = { 1, NF, SEN(setfsgid16), "setfsgid" }, -[140] = { 5, TD, SEN(llseek), "_llseek" }, -[141] = { 3, TD, SEN(getdents), "getdents" }, -[142] = { 5, TD, SEN(select), "_newselect" }, -[143] = { 2, TD, SEN(flock), "flock" }, -[144] = { 3, TM, SEN(msync), "msync" }, -[145] = { 3, TD, SEN(readv), "readv" }, -[146] = { 3, TD, SEN(writev), "writev" }, -[147] = { 1, 0, SEN(getsid), "getsid" }, -[148] = { 1, TD, SEN(fdatasync), "fdatasync" }, -[149] = { 1, 0, SEN(sysctl), "_sysctl" }, -[150] = { 2, TM, SEN(mlock), "mlock" }, -[151] = { 2, TM, SEN(munlock), "munlock" }, -[152] = { 1, TM, SEN(mlockall), "mlockall" }, -[153] = { 0, TM, SEN(munlockall), "munlockall" }, -[154] = { 2, 0, SEN(sched_setparam), "sched_setparam" }, -[155] = { 2, 0, SEN(sched_getparam), "sched_getparam" }, -[156] = { 3, 0, SEN(sched_setscheduler), "sched_setscheduler" }, -[157] = { 1, 0, SEN(sched_getscheduler), "sched_getscheduler" }, -[158] = { 0, 0, SEN(sched_yield), "sched_yield" }, -[159] = { 1, 0, SEN(sched_get_priority_max), "sched_get_priority_max"}, -[160] = { 1, 0, SEN(sched_get_priority_min), "sched_get_priority_min"}, -[161] = { 2, 0, SEN(sched_rr_get_interval), "sched_rr_get_interval" }, -[162] = { 2, 0, SEN(nanosleep), "nanosleep" }, -[163] = { 5, TM|SI, SEN(mremap), "mremap" }, -[164] = { 3, 0, SEN(setresuid16), "setresuid" }, -[165] = { 3, 0, SEN(getresuid16), "getresuid" }, -[167] = { 5, 0, SEN(query_module), "query_module" }, -[168] = { 3, TD, SEN(poll), "poll" }, -[169] = { 3, 0, SEN(nfsservctl), "nfsservctl" }, -[170] = { 3, 0, SEN(setresgid16), "setresgid" }, -[171] = { 3, 0, SEN(getresgid16), "getresgid" }, -[172] = { 5, 0, SEN(prctl), "prctl" }, -[173] = { 0, TS, SEN(rt_sigreturn), "rt_sigreturn" }, -[174] = { 4, TS, SEN(rt_sigaction), "rt_sigaction" }, -[175] = { 4, TS, SEN(rt_sigprocmask), "rt_sigprocmask" }, -[176] = { 2, TS, SEN(rt_sigpending), "rt_sigpending" }, -[177] = { 4, TS, SEN(rt_sigtimedwait), "rt_sigtimedwait" }, -[178] = { 3, TS, SEN(rt_sigqueueinfo), "rt_sigqueueinfo" }, -[179] = { 2, TS, SEN(rt_sigsuspend), "rt_sigsuspend" }, -[180] = { 5, TD, SEN(pread), "pread64" }, -[181] = { 5, TD, SEN(pwrite), "pwrite64" }, -[182] = { 3, TF, SEN(chown16), "chown" }, -[183] = { 2, TF, SEN(getcwd), "getcwd" }, -[184] = { 2, 0, SEN(capget), "capget" }, -[185] = { 2, 0, SEN(capset), "capset" }, -[186] = { 2, TS, SEN(sigaltstack), "sigaltstack" }, -[187] = { 4, TD|TN, SEN(sendfile), "sendfile" }, -[188] = { 5, TN, SEN(getpmsg), "getpmsg" }, -[189] = { 5, TN, SEN(putpmsg), "putpmsg" }, -[190] = { 0, TP, SEN(vfork), "vfork" }, -[191] = { 2, 0, SEN(getrlimit), "ugetrlimit" }, -[192] = { 6, TD|TM|SI, SEN(mmap_pgoff), "mmap2" }, -[193] = { 3, TF, SEN(truncate64), "truncate64" }, -[194] = { 3, TD, SEN(ftruncate64), "ftruncate64" }, -[195] = { 2, TF|TST|TSTA, SEN(stat64), "stat64" }, -[196] = { 2, TF|TLST|TSTA, SEN(lstat64), "lstat64" }, -[197] = { 2, TD|TFST|TSTA, SEN(fstat64), "fstat64" }, -[198] = { 3, TF, SEN(chown), "lchown32" }, -[199] = { 0, NF, SEN(getuid), "getuid32" }, -[200] = { 0, NF, SEN(getgid), "getgid32" }, -[201] = { 0, NF, SEN(geteuid), "geteuid32" }, -[202] = { 0, NF, SEN(getegid), "getegid32" }, -[203] = { 2, 0, SEN(setreuid), "setreuid32" }, -[204] = { 2, 0, SEN(setregid), "setregid32" }, -[205] = { 2, 0, SEN(getgroups), "getgroups32" }, -[206] = { 2, 0, SEN(setgroups), "setgroups32" }, -[207] = { 3, TD, SEN(fchown), "fchown32" }, -[208] = { 3, 0, SEN(setresuid), "setresuid32" }, -[209] = { 3, 0, SEN(getresuid), "getresuid32" }, -[210] = { 3, 0, SEN(setresgid), "setresgid32" }, -[211] = { 3, 0, SEN(getresgid), "getresgid32" }, -[212] = { 3, TF, SEN(chown), "chown32" }, -[213] = { 1, 0, SEN(setuid), "setuid32" }, -[214] = { 1, 0, SEN(setgid), "setgid32" }, -[215] = { 1, NF, SEN(setfsuid), "setfsuid32" }, -[216] = { 1, NF, SEN(setfsgid), "setfsgid32" }, -[217] = { 2, TF, SEN(pivotroot), "pivot_root" }, -[218] = { 3, TM, SEN(mincore), "mincore" }, -[219] = { 3, TM, SEN(madvise), "madvise" }, -[220] = { 3, TD, SEN(getdents64), "getdents64" }, -[221] = { 3, TD, SEN(fcntl64), "fcntl64" }, -[224] = { 0, NF, SEN(gettid), "gettid" }, -[225] = { 4, TD, SEN(readahead), "readahead" }, -[226] = { 5, TF, SEN(setxattr), "setxattr" }, -[227] = { 5, TF, SEN(setxattr), "lsetxattr" }, -[228] = { 5, TD, SEN(fsetxattr), "fsetxattr" }, -[229] = { 4, TF, SEN(getxattr), "getxattr" }, -[230] = { 4, TF, SEN(getxattr), "lgetxattr" }, -[231] = { 4, TD, SEN(fgetxattr), "fgetxattr" }, -[232] = { 3, TF, SEN(listxattr), "listxattr" }, -[233] = { 3, TF, SEN(listxattr), "llistxattr" }, -[234] = { 3, TD, SEN(flistxattr), "flistxattr" }, -[235] = { 2, TF, SEN(removexattr), "removexattr" }, -[236] = { 2, TF, SEN(removexattr), "lremovexattr" }, -[237] = { 2, TD, SEN(fremovexattr), "fremovexattr" }, -[238] = { 2, TS, SEN(kill), "tkill" }, -[239] = { 4, TD|TN, SEN(sendfile64), "sendfile64" }, -[240] = { 6, 0, SEN(futex), "futex" }, -[241] = { 3, 0, SEN(sched_setaffinity), "sched_setaffinity" }, -[242] = { 3, 0, SEN(sched_getaffinity), "sched_getaffinity" }, -[243] = { 1, 0, SEN(set_thread_area), "set_thread_area" }, -[244] = { 1, 0, SEN(get_thread_area), "get_thread_area" }, -[245] = { 2, TM, SEN(io_setup), "io_setup" }, -[246] = { 1, TM, SEN(io_destroy), "io_destroy" }, -[247] = { 5, 0, SEN(io_getevents), "io_getevents" }, -[248] = { 3, 0, SEN(io_submit), "io_submit" }, -[249] = { 3, 0, SEN(io_cancel), "io_cancel" }, -[250] = { 5, TD, SEN(fadvise64), "fadvise64" }, -[252] = { 1, TP|SE, SEN(exit), "exit_group" }, -[253] = { 4, 0, SEN(lookup_dcookie), "lookup_dcookie" }, -[254] = { 1, TD, SEN(epoll_create), "epoll_create" }, -[255] = { 4, TD, SEN(epoll_ctl), "epoll_ctl" }, -[256] = { 4, TD, SEN(epoll_wait), "epoll_wait" }, -[257] = { 5, TM|SI, SEN(remap_file_pages), "remap_file_pages" }, -[258] = { 1, 0, SEN(set_tid_address), "set_tid_address" }, -[259] = { 3, 0, SEN(timer_create), "timer_create" }, -[260] = { 4, 0, SEN(timer_settime), "timer_settime" }, -[261] = { 2, 0, SEN(timer_gettime), "timer_gettime" }, -[262] = { 1, 0, SEN(timer_getoverrun), "timer_getoverrun" }, -[263] = { 1, 0, SEN(timer_delete), "timer_delete" }, -[264] = { 2, 0, SEN(clock_settime), "clock_settime" }, -[265] = { 2, 0, SEN(clock_gettime), "clock_gettime" }, -[266] = { 2, 0, SEN(clock_getres), "clock_getres" }, -[267] = { 4, 0, SEN(clock_nanosleep), "clock_nanosleep" }, -[268] = { 3, TF|TSF|TSFA, SEN(statfs64), "statfs64" }, -[269] = { 3, TD|TFSF|TSFA, SEN(fstatfs64), "fstatfs64" }, -[270] = { 3, TS, SEN(tgkill), "tgkill" }, -[271] = { 2, TF, SEN(utimes), "utimes" }, -[272] = { 6, TD, SEN(fadvise64_64), "fadvise64_64" }, -[273] = { 5, 0, SEN(vserver), "vserver" }, -[274] = { 6, TM, SEN(mbind), "mbind" }, -[275] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" }, -[276] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" }, -[277] = { 4, 0, SEN(mq_open), "mq_open" }, -[278] = { 1, 0, SEN(mq_unlink), "mq_unlink" }, -[279] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" }, -[280] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" }, -[281] = { 2, 0, SEN(mq_notify), "mq_notify" }, -[282] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" }, -[283] = { 4, 0, SEN(kexec_load), "kexec_load" }, -[284] = { 5, TP, SEN(waitid), "waitid" }, -[286] = { 5, 0, SEN(add_key), "add_key" }, -[287] = { 4, 0, SEN(request_key), "request_key" }, -[288] = { 5, 0, SEN(keyctl), "keyctl" }, -[289] = { 3, 0, SEN(ioprio_set), "ioprio_set" }, -[290] = { 2, 0, SEN(ioprio_get), "ioprio_get" }, -[291] = { 0, TD, SEN(inotify_init), "inotify_init" }, -[292] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" }, -[293] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" }, -[294] = { 4, TM, SEN(migrate_pages), "migrate_pages" }, -[295] = { 4, TD|TF, SEN(openat), "openat" }, -[296] = { 3, TD|TF, SEN(mkdirat), "mkdirat" }, -[297] = { 4, TD|TF, SEN(mknodat), "mknodat" }, -[298] = { 5, TD|TF, SEN(fchownat), "fchownat" }, -[299] = { 3, TD|TF, SEN(futimesat), "futimesat" }, -[300] = { 4, TD|TF|TFST|TSTA,SEN(fstatat64), "fstatat64" }, -[301] = { 3, TD|TF, SEN(unlinkat), "unlinkat" }, -[302] = { 4, TD|TF, SEN(renameat), "renameat" }, -[303] = { 5, TD|TF, SEN(linkat), "linkat" }, -[304] = { 3, TD|TF, SEN(symlinkat), "symlinkat" }, -[305] = { 4, TD|TF, SEN(readlinkat), "readlinkat" }, -[306] = { 3, TD|TF, SEN(fchmodat), "fchmodat" }, -[307] = { 3, TD|TF, SEN(faccessat), "faccessat" }, -[308] = { 6, TD, SEN(pselect6), "pselect6" }, -[309] = { 5, TD, SEN(ppoll), "ppoll" }, -[310] = { 1, TP, SEN(unshare), "unshare" }, -[311] = { 2, 0, SEN(set_robust_list), "set_robust_list" }, -[312] = { 3, 0, SEN(get_robust_list), "get_robust_list" }, -[313] = { 6, TD, SEN(splice), "splice" }, -[314] = { 6, TD, SEN(sync_file_range), "sync_file_range" }, -[315] = { 4, TD, SEN(tee), "tee" }, -[316] = { 4, TD, SEN(vmsplice), "vmsplice" }, -[317] = { 6, TM, SEN(move_pages), "move_pages" }, -[318] = { 3, 0, SEN(getcpu), "getcpu" }, -[319] = { 6, TD, SEN(epoll_pwait), "epoll_pwait" }, -[320] = { 4, TD|TF, SEN(utimensat), "utimensat" }, -[321] = { 3, TD|TS, SEN(signalfd), "signalfd" }, -[322] = { 2, TD, SEN(timerfd_create), "timerfd_create" }, -[323] = { 1, TD, SEN(eventfd), "eventfd" }, -[324] = { 6, TD, SEN(fallocate), "fallocate" }, -[325] = { 4, TD, SEN(timerfd_settime), "timerfd_settime" }, -[326] = { 2, TD, SEN(timerfd_gettime), "timerfd_gettime" }, -[327] = { 4, TD|TS, SEN(signalfd4), "signalfd4" }, -[328] = { 2, TD, SEN(eventfd2), "eventfd2" }, -[329] = { 1, TD, SEN(epoll_create1), "epoll_create1" }, -[330] = { 3, TD, SEN(dup3), "dup3" }, -[331] = { 2, TD, SEN(pipe2), "pipe2" }, -[332] = { 1, TD, SEN(inotify_init1), "inotify_init1" }, -[333] = { 5, TD, SEN(preadv), "preadv" }, -[334] = { 5, TD, SEN(pwritev), "pwritev" }, -[335] = { 2, TD, SEN(setns), "setns" }, -[336] = { 5, TD|TF, SEN(name_to_handle_at), "name_to_handle_at" }, -[337] = { 3, TD, SEN(open_by_handle_at), "open_by_handle_at" }, -[338] = { 4, TP|TS, SEN(rt_tgsigqueueinfo), "rt_tgsigqueueinfo" }, -[339] = { 5, TD, SEN(perf_event_open), "perf_event_open" }, -[340] = { 5, TN, SEN(recvmmsg), "recvmmsg" }, -[341] = { 4, TN, SEN(accept4), "accept4" }, -[342] = { 2, TD, SEN(fanotify_init), "fanotify_init" }, -[343] = { 6, TD|TF, SEN(fanotify_mark), "fanotify_mark" }, -[344] = { 4, 0, SEN(prlimit64), "prlimit64" }, -[345] = { 2, 0, SEN(clock_adjtime), "clock_adjtime" }, -[346] = { 1, TD, SEN(syncfs), "syncfs" }, -[347] = { 4, TN, SEN(sendmmsg), "sendmmsg" }, -[348] = { 6, 0, SEN(process_vm_readv), "process_vm_readv" }, -[349] = { 6, 0, SEN(process_vm_writev), "process_vm_writev" }, -[350] = { 5, 0, SEN(kcmp), "kcmp" }, -[351] = { 3, TD, SEN(finit_module), "finit_module" }, -[352] = { 3, 0, SEN(sched_setattr), "sched_setattr" }, -[353] = { 4, 0, SEN(sched_getattr), "sched_getattr" }, -[354] = { 5, TD|TF, SEN(renameat2), "renameat2" }, -[355] = { 3, 0, SEN(seccomp), "seccomp" }, -[356] = { 3, 0, SEN(getrandom), "getrandom" }, -[357] = { 2, TD, SEN(memfd_create), "memfd_create" }, -[358] = { 3, TD, SEN(bpf), "bpf" }, -[359] = { 5, TD|TF|TP|SE|SI, SEN(execveat), "execveat" }, - -#define SYS_socket_subcall 400 -#include "subcall.h" diff --git a/linux/crisv10/userent.h b/linux/crisv10/userent.h deleted file mode 100644 index bea16aea..00000000 --- a/linux/crisv10/userent.h +++ /dev/null @@ -1,26 +0,0 @@ -XLAT(4*PT_FRAMETYPE), -XLAT(4*PT_ORIG_R10), -XLAT(4*PT_R13), -XLAT(4*PT_R12), -XLAT(4*PT_R11), -XLAT(4*PT_R10), -XLAT(4*PT_R9), -XLAT(4*PT_R8), -XLAT(4*PT_R7), -XLAT(4*PT_R6), -XLAT(4*PT_R5), -XLAT(4*PT_R4), -XLAT(4*PT_R3), -XLAT(4*PT_R2), -XLAT(4*PT_R1), -XLAT(4*PT_R0), -XLAT(4*PT_MOF), -XLAT(4*PT_DCCR), -XLAT(4*PT_SRP), -XLAT(4*PT_IRP), -XLAT(4*PT_CSRINSTR), -XLAT(4*PT_CSRADDR), -XLAT(4*PT_CSRDATA), -XLAT(4*PT_USP), -/* Other fields in "struct user" */ -#include "../userent0.h" diff --git a/linux/crisv32/arch_regs.c b/linux/crisv32/arch_regs.c deleted file mode 100644 index 8e59c156..00000000 --- a/linux/crisv32/arch_regs.c +++ /dev/null @@ -1,2 +0,0 @@ -#include "crisv10/arch_regs.c" -#define ARCH_PC_PEEK_ADDR (4 * PT_ERP) diff --git a/linux/crisv32/arch_rt_sigframe.c b/linux/crisv32/arch_rt_sigframe.c deleted file mode 100644 index 2f457462..00000000 --- a/linux/crisv32/arch_rt_sigframe.c +++ /dev/null @@ -1 +0,0 @@ -#include "crisv10/arch_rt_sigframe.c" diff --git a/linux/crisv32/arch_sigreturn.c b/linux/crisv32/arch_sigreturn.c deleted file mode 100644 index 6c0fc03b..00000000 --- a/linux/crisv32/arch_sigreturn.c +++ /dev/null @@ -1 +0,0 @@ -#include "crisv10/arch_sigreturn.c" diff --git a/linux/crisv32/get_error.c b/linux/crisv32/get_error.c deleted file mode 100644 index f7bb1e01..00000000 --- a/linux/crisv32/get_error.c +++ /dev/null @@ -1 +0,0 @@ -#include "crisv10/get_error.c" diff --git a/linux/crisv32/get_scno.c b/linux/crisv32/get_scno.c deleted file mode 100644 index edfd60f8..00000000 --- a/linux/crisv32/get_scno.c +++ /dev/null @@ -1 +0,0 @@ -#include "crisv10/get_scno.c" diff --git a/linux/crisv32/get_syscall_args.c b/linux/crisv32/get_syscall_args.c deleted file mode 100644 index 4d984659..00000000 --- a/linux/crisv32/get_syscall_args.c +++ /dev/null @@ -1 +0,0 @@ -#include "crisv10/get_syscall_args.c" diff --git a/linux/crisv32/get_syscall_result.c b/linux/crisv32/get_syscall_result.c deleted file mode 100644 index ebefdb20..00000000 --- a/linux/crisv32/get_syscall_result.c +++ /dev/null @@ -1 +0,0 @@ -#include "crisv10/get_syscall_result.c" diff --git a/linux/crisv32/rt_sigframe.h b/linux/crisv32/rt_sigframe.h deleted file mode 100644 index bfe07d4b..00000000 --- a/linux/crisv32/rt_sigframe.h +++ /dev/null @@ -1 +0,0 @@ -#include "crisv10/rt_sigframe.h" diff --git a/linux/crisv32/set_error.c b/linux/crisv32/set_error.c deleted file mode 100644 index 18a5ee8c..00000000 --- a/linux/crisv32/set_error.c +++ /dev/null @@ -1 +0,0 @@ -#include "crisv10/set_error.c" diff --git a/linux/crisv32/set_scno.c b/linux/crisv32/set_scno.c deleted file mode 100644 index b021adf1..00000000 --- a/linux/crisv32/set_scno.c +++ /dev/null @@ -1 +0,0 @@ -#include "crisv10/set_scno.c" diff --git a/linux/crisv32/syscallent.h b/linux/crisv32/syscallent.h deleted file mode 100644 index ce4e5284..00000000 --- a/linux/crisv32/syscallent.h +++ /dev/null @@ -1 +0,0 @@ -#include "crisv10/syscallent.h" diff --git a/linux/crisv32/userent.h b/linux/crisv32/userent.h deleted file mode 100644 index 3c5949eb..00000000 --- a/linux/crisv32/userent.h +++ /dev/null @@ -1,43 +0,0 @@ -XLAT(4*PT_ORIG_R10), -XLAT(4*PT_R0), -XLAT(4*PT_R1), -XLAT(4*PT_R2), -XLAT(4*PT_R3), -XLAT(4*PT_R4), -XLAT(4*PT_R5), -XLAT(4*PT_R6), -XLAT(4*PT_R7), -XLAT(4*PT_R8), -XLAT(4*PT_R9), -XLAT(4*PT_R10), -XLAT(4*PT_R11), -XLAT(4*PT_R12), -XLAT(4*PT_R13), -XLAT(4*PT_ACR), -XLAT(4*PT_SRS), -XLAT(4*PT_MOF), -XLAT(4*PT_SPC), -XLAT(4*PT_CCS), -XLAT(4*PT_SRP), -XLAT(4*PT_ERP), -XLAT(4*PT_EXS), -XLAT(4*PT_EDA), -XLAT(4*PT_USP), -XLAT(4*PT_PPC), -XLAT(4*PT_BP_CTRL), -XLAT(4*PT_BP+4), -XLAT(4*PT_BP+8), -XLAT(4*PT_BP+12), -XLAT(4*PT_BP+16), -XLAT(4*PT_BP+20), -XLAT(4*PT_BP+24), -XLAT(4*PT_BP+28), -XLAT(4*PT_BP+32), -XLAT(4*PT_BP+36), -XLAT(4*PT_BP+40), -XLAT(4*PT_BP+44), -XLAT(4*PT_BP+48), -XLAT(4*PT_BP+52), -XLAT(4*PT_BP+56), -/* Other fields in "struct user" */ -#include "../userent0.h" diff --git a/linux/hppa/arch_defs_.h b/linux/hppa/arch_defs_.h new file mode 100644 index 00000000..3a9bc3b3 --- /dev/null +++ b/linux/hppa/arch_defs_.h @@ -0,0 +1 @@ +#define HAVE_ARCH_SA_RESTORER 0 diff --git a/linux/hppa/arch_rt_sigframe.c b/linux/hppa/arch_rt_sigframe.c index e3c62fa5..aaf2ffe7 100644 --- a/linux/hppa/arch_rt_sigframe.c +++ b/linux/hppa/arch_rt_sigframe.c @@ -36,6 +36,6 @@ FUNC_GET_RT_SIGFRAME_ADDR { unsigned long addr; - return upeek(tcp->pid, 4 * 30, &addr) + return upeek(tcp, 4 * 30, &addr) ? 0 : (addr & ~1UL) - RT_SIGFRAME_SIZE; } diff --git a/linux/hppa/get_scno.c b/linux/hppa/get_scno.c index 7da2fc40..fb3ed56b 100644 --- a/linux/hppa/get_scno.c +++ b/linux/hppa/get_scno.c @@ -2,5 +2,5 @@ static int arch_get_scno(struct tcb *tcp) { - return upeek(tcp->pid, PT_GR20, &tcp->scno) < 0 ? -1 : 1; + return upeek(tcp, PT_GR20, &tcp->scno) < 0 ? -1 : 1; } diff --git a/linux/hppa/get_syscall_args.c b/linux/hppa/get_syscall_args.c index 2258ea87..aa938f50 100644 --- a/linux/hppa/get_syscall_args.c +++ b/linux/hppa/get_syscall_args.c @@ -5,7 +5,7 @@ get_syscall_args(struct tcb *tcp) unsigned int i; for (i = 0; i < tcp->s_ent->nargs; ++i) - if (upeek(tcp->pid, PT_GR26-4*i, &tcp->u_arg[i]) < 0) + if (upeek(tcp, PT_GR26-4*i, &tcp->u_arg[i]) < 0) return -1; return 1; } diff --git a/linux/hppa/get_syscall_result.c b/linux/hppa/get_syscall_result.c index 0d15d4db..de2b8829 100644 --- a/linux/hppa/get_syscall_result.c +++ b/linux/hppa/get_syscall_result.c @@ -1,5 +1,5 @@ static int get_syscall_result_regs(struct tcb *tcp) { - return upeek(tcp->pid, PT_GR28, &hppa_r28) < 0 ? -1 : 0; + return upeek(tcp, PT_GR28, &hppa_r28) < 0 ? -1 : 0; } diff --git a/linux/hppa/set_error.c b/linux/hppa/set_error.c index 92a7979f..edaada7f 100644 --- a/linux/hppa/set_error.c +++ b/linux/hppa/set_error.c @@ -2,12 +2,12 @@ static int arch_set_error(struct tcb *tcp) { hppa_r28 = -tcp->u_error; - return upoke(tcp->pid, PT_GR28, hppa_r28); + return upoke(tcp, PT_GR28, hppa_r28); } static int arch_set_success(struct tcb *tcp) { hppa_r28 = tcp->u_rval; - return upoke(tcp->pid, PT_GR28, hppa_r28); + return upoke(tcp, PT_GR28, hppa_r28); } diff --git a/linux/hppa/set_scno.c b/linux/hppa/set_scno.c index d4d873be..fcf8f43a 100644 --- a/linux/hppa/set_scno.c +++ b/linux/hppa/set_scno.c @@ -1,5 +1,5 @@ static int arch_set_scno(struct tcb *tcp, kernel_ulong_t scno) { - return upoke(tcp->pid, PT_GR20, scno); + return upoke(tcp, PT_GR20, scno); } diff --git a/linux/hppa/syscallent.h b/linux/hppa/syscallent.h index 89253380..70fe6906 100644 --- a/linux/hppa/syscallent.h +++ b/linux/hppa/syscallent.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2001 Hewlett-Packard, Matthew Wilcox - * Copyright (c) 2001-2017 The strace developers. + * Copyright (c) 2001-2018 The strace developers. */ [ 0] = { 0, 0, SEN(restart_syscall), "restart_syscall" }, @@ -23,11 +23,11 @@ [ 17] = { 3, TN, SEN(socket), "socket" }, [ 18] = { 2, TF|TST|TSTA, SEN(stat), "stat" }, [ 19] = { 3, TD, SEN(lseek), "lseek" }, -[ 20] = { 0, NF, SEN(getpid), "getpid" }, +[ 20] = { 0, PU|NF, SEN(getpid), "getpid" }, [ 21] = { 5, TF, SEN(mount), "mount" }, [ 22] = { 3, TN, SEN(bind), "bind" }, [ 23] = { 1, 0, SEN(setuid), "setuid" }, -[ 24] = { 0, NF, SEN(getuid), "getuid" }, +[ 24] = { 0, PU|NF, SEN(getuid), "getuid" }, [ 25] = { 1, 0, SEN(stime), "stime" }, [ 26] = { 4, 0, SEN(ptrace), "ptrace" }, [ 27] = { 1, 0, SEN(alarm), "alarm" }, @@ -50,10 +50,10 @@ [ 44] = { 3, TN, SEN(getsockname), "getsockname" }, [ 45] = { 1, TM|SI, SEN(brk), "brk" }, [ 46] = { 1, 0, SEN(setgid), "setgid" }, -[ 47] = { 0, NF, SEN(getgid), "getgid" }, +[ 47] = { 0, PU|NF, SEN(getgid), "getgid" }, [ 48] = { 2, TS, SEN(signal), "signal" }, -[ 49] = { 0, NF, SEN(geteuid), "geteuid" }, -[ 50] = { 0, NF, SEN(getegid), "getegid" }, +[ 49] = { 0, PU|NF, SEN(geteuid), "geteuid" }, +[ 50] = { 0, PU|NF, SEN(getegid), "getegid" }, [ 51] = { 1, TF, SEN(acct), "acct" }, [ 52] = { 2, TF, SEN(umount2), "umount2" }, [ 53] = { 3, TN, SEN(getpeername), "getpeername" }, @@ -67,8 +67,8 @@ [ 61] = { 1, TF, SEN(chroot), "chroot" }, [ 62] = { 2, TSFA, SEN(ustat), "ustat" }, [ 63] = { 2, TD, SEN(dup2), "dup2" }, -[ 64] = { 0, NF, SEN(getppid), "getppid" }, -[ 65] = { 0, 0, SEN(getpgrp), "getpgrp" }, +[ 64] = { 0, PU|NF, SEN(getppid), "getppid" }, +[ 65] = { 0, PU|NF, SEN(getpgrp), "getpgrp" }, [ 66] = { 0, 0, SEN(setsid), "setsid" }, [ 67] = { 2, TF, SEN(pivotroot), "pivot_root" }, [ 68] = { 0, TS, SEN(sgetmask), "sgetmask" }, @@ -209,7 +209,7 @@ [203] = { 5, 0, SEN(printargs), "attrctl" }, [204] = { 5, 0, SEN(printargs), "acl_get" }, [205] = { 5, 0, SEN(printargs), "acl_set" }, -[206] = { 0, NF, SEN(gettid), "gettid" }, +[206] = { 0, PU|NF, SEN(gettid), "gettid" }, [207] = { 4, TD, SEN(readahead), "readahead" }, [208] = { 2, TS, SEN(kill), "tkill" }, [209] = { 4, TD|TN, SEN(sendfile64), "sendfile64" }, @@ -232,12 +232,12 @@ [226] = { 4, TD, SEN(epoll_wait), "epoll_wait" }, [227] = { 5, TM|SI, SEN(remap_file_pages), "remap_file_pages" }, [228] = { 4, TI, SEN(semtimedop), "semtimedop" }, -[229] = { 4, 0, SEN(mq_open), "mq_open" }, +[229] = { 4, TD, SEN(mq_open), "mq_open" }, [230] = { 1, 0, SEN(mq_unlink), "mq_unlink" }, -[231] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" }, -[232] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" }, -[233] = { 2, 0, SEN(mq_notify), "mq_notify" }, -[234] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" }, +[231] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" }, +[232] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" }, +[233] = { 2, TD, SEN(mq_notify), "mq_notify" }, +[234] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" }, [235] = { 5, TP, SEN(waitid), "waitid" }, [236] = { 6, TD, SEN(fadvise64_64), "fadvise64_64" }, [237] = { 1, 0, SEN(set_tid_address), "set_tid_address" }, diff --git a/linux/i386/arch_defs_.h b/linux/i386/arch_defs_.h new file mode 100644 index 00000000..a8e961f3 --- /dev/null +++ b/linux/i386/arch_defs_.h @@ -0,0 +1,3 @@ +#define HAVE_ARCH_OLD_MMAP 1 +#define HAVE_ARCH_OLD_SELECT 1 +#define HAVE_ARCH_UID16_SYSCALLS 1 diff --git a/linux/i386/arch_kvm.c b/linux/i386/arch_kvm.c new file mode 100644 index 00000000..e8e982ee --- /dev/null +++ b/linux/i386/arch_kvm.c @@ -0,0 +1 @@ +#include "x86_64/arch_kvm.c" diff --git a/linux/i386/set_error.c b/linux/i386/set_error.c index 92b0a8d7..7d47e28b 100644 --- a/linux/i386/set_error.c +++ b/linux/i386/set_error.c @@ -3,7 +3,7 @@ arch_set_error(struct tcb *tcp) { i386_regs.eax = -tcp->u_error; #ifdef HAVE_GETREGS_OLD - return upoke(tcp->pid, 4 * EAX, i386_regs.eax); + return upoke(tcp, 4 * EAX, i386_regs.eax); #else return set_regs(tcp->pid); #endif @@ -14,7 +14,7 @@ arch_set_success(struct tcb *tcp) { i386_regs.eax = tcp->u_rval; #ifdef HAVE_GETREGS_OLD - return upoke(tcp->pid, 4 * EAX, i386_regs.eax); + return upoke(tcp, 4 * EAX, i386_regs.eax); #else return set_regs(tcp->pid); #endif diff --git a/linux/i386/set_scno.c b/linux/i386/set_scno.c index 3abe7768..67736eae 100644 --- a/linux/i386/set_scno.c +++ b/linux/i386/set_scno.c @@ -2,7 +2,7 @@ static int arch_set_scno(struct tcb *tcp, kernel_ulong_t scno) { #ifdef HAVE_GETREGS_OLD - return upoke(tcp->pid, 4 * ORIG_EAX, scno); + return upoke(tcp, 4 * ORIG_EAX, scno); #else i386_regs.orig_eax = scno; return set_regs(tcp->pid); diff --git a/linux/i386/syscallent.h b/linux/i386/syscallent.h index 6c5725ae..b00e1d87 100644 --- a/linux/i386/syscallent.h +++ b/linux/i386/syscallent.h @@ -1,7 +1,7 @@ /* * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl> * Copyright (c) 1993, 1994, 1995 Rick Sladkey <jrs@world.std.com> - * Copyright (c) 1995-2017 The strace developers. + * Copyright (c) 1995-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,11 +47,11 @@ [ 17] = { 0, TM, SEN(break), "break" }, [ 18] = { 2, TF|TST|TSTA, SEN(oldstat), "oldstat" }, [ 19] = { 3, TD, SEN(lseek), "lseek" }, -[ 20] = { 0, NF, SEN(getpid), "getpid" }, +[ 20] = { 0, PU|NF, SEN(getpid), "getpid" }, [ 21] = { 5, TF, SEN(mount), "mount" }, [ 22] = { 1, TF, SEN(umount), "umount" }, [ 23] = { 1, 0, SEN(setuid16), "setuid" }, -[ 24] = { 0, NF, SEN(getuid16), "getuid" }, +[ 24] = { 0, PU|NF, SEN(getuid16), "getuid" }, [ 25] = { 1, 0, SEN(stime), "stime" }, [ 26] = { 4, 0, SEN(ptrace), "ptrace" }, [ 27] = { 1, 0, SEN(alarm), "alarm" }, @@ -74,10 +74,10 @@ [ 44] = { 0, 0, SEN(prof), "prof" }, [ 45] = { 1, TM|SI, SEN(brk), "brk" }, [ 46] = { 1, 0, SEN(setgid16), "setgid" }, -[ 47] = { 0, NF, SEN(getgid16), "getgid" }, +[ 47] = { 0, PU|NF, SEN(getgid16), "getgid" }, [ 48] = { 2, TS, SEN(signal), "signal" }, -[ 49] = { 0, NF, SEN(geteuid16), "geteuid" }, -[ 50] = { 0, NF, SEN(getegid16), "getegid" }, +[ 49] = { 0, PU|NF, SEN(geteuid16), "geteuid" }, +[ 50] = { 0, PU|NF, SEN(getegid16), "getegid" }, [ 51] = { 1, TF, SEN(acct), "acct" }, [ 52] = { 2, TF, SEN(umount2), "umount2" }, [ 53] = { 0, 0, SEN(lock), "lock" }, @@ -91,8 +91,8 @@ [ 61] = { 1, TF, SEN(chroot), "chroot" }, [ 62] = { 2, TSFA, SEN(ustat), "ustat" }, [ 63] = { 2, TD, SEN(dup2), "dup2" }, -[ 64] = { 0, NF, SEN(getppid), "getppid" }, -[ 65] = { 0, 0, SEN(getpgrp), "getpgrp" }, +[ 64] = { 0, PU|NF, SEN(getppid), "getppid" }, +[ 65] = { 0, PU|NF, SEN(getpgrp), "getpgrp" }, [ 66] = { 0, 0, SEN(setsid), "setsid" }, [ 67] = { 3, TS, SEN(sigaction), "sigaction" }, [ 68] = { 0, TS, SEN(sgetmask), "sgetmask" }, @@ -226,10 +226,10 @@ [196] = { 2, TF|TLST|TSTA, SEN(lstat64), "lstat64" }, [197] = { 2, TD|TFST|TSTA, SEN(fstat64), "fstat64" }, [198] = { 3, TF, SEN(chown), "lchown32" }, -[199] = { 0, NF, SEN(getuid), "getuid32" }, -[200] = { 0, NF, SEN(getgid), "getgid32" }, -[201] = { 0, NF, SEN(geteuid), "geteuid32" }, -[202] = { 0, NF, SEN(getegid), "getegid32" }, +[199] = { 0, PU|NF, SEN(getuid), "getuid32" }, +[200] = { 0, PU|NF, SEN(getgid), "getgid32" }, +[201] = { 0, PU|NF, SEN(geteuid), "geteuid32" }, +[202] = { 0, PU|NF, SEN(getegid), "getegid32" }, [203] = { 2, 0, SEN(setreuid), "setreuid32" }, [204] = { 2, 0, SEN(setregid), "setregid32" }, [205] = { 2, 0, SEN(getgroups), "getgroups32" }, @@ -250,7 +250,7 @@ [220] = { 3, TD, SEN(getdents64), "getdents64" }, [221] = { 3, TD, SEN(fcntl64), "fcntl64" }, [222 ... 223] = { }, -[224] = { 0, NF, SEN(gettid), "gettid" }, +[224] = { 0, PU|NF, SEN(gettid), "gettid" }, [225] = { 4, TD, SEN(readahead), "readahead" }, [226] = { 5, TF, SEN(setxattr), "setxattr" }, [227] = { 5, TF, SEN(setxattr), "lsetxattr" }, @@ -303,12 +303,12 @@ [274] = { 6, TM, SEN(mbind), "mbind" }, [275] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" }, [276] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" }, -[277] = { 4, 0, SEN(mq_open), "mq_open" }, +[277] = { 4, TD, SEN(mq_open), "mq_open" }, [278] = { 1, 0, SEN(mq_unlink), "mq_unlink" }, -[279] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" }, -[280] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" }, -[281] = { 2, 0, SEN(mq_notify), "mq_notify" }, -[282] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" }, +[279] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" }, +[280] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" }, +[281] = { 2, TD, SEN(mq_notify), "mq_notify" }, +[282] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" }, [283] = { 4, 0, SEN(kexec_load), "kexec_load" }, [284] = { 5, TP, SEN(waitid), "waitid" }, [285] = { }, /* sys_setaltroot */ diff --git a/linux/ia64/arch_defs_.h b/linux/ia64/arch_defs_.h new file mode 100644 index 00000000..8674172a --- /dev/null +++ b/linux/ia64/arch_defs_.h @@ -0,0 +1,4 @@ +#define HAVE_ARCH_GETRVAL2 1 +#define HAVE_ARCH_UID16_SYSCALLS 1 +#define HAVE_ARCH_SA_RESTORER 0 +#define HAVE_ARCH_DEDICATED_ERR_REG 1 diff --git a/linux/ia64/arch_regs.c b/linux/ia64/arch_regs.c index deec1769..b79918e3 100644 --- a/linux/ia64/arch_regs.c +++ b/linux/ia64/arch_regs.c @@ -1,8 +1,5 @@ static struct pt_all_user_regs ia64_regs; unsigned long *const ia64_frame_ptr = &ia64_regs.gr[12]; -#define IA64_PSR_IS (1UL << 34) -#define ia64_ia32mode (ia64_regs.cr_ipsr & IA64_PSR_IS) - #define ARCH_REGS_FOR_GETREGS ia64_regs #define ARCH_PC_REG ia64_regs.br[0] diff --git a/linux/ia64/get_error.c b/linux/ia64/get_error.c index 41cae92e..61110779 100644 --- a/linux/ia64/get_error.c +++ b/linux/ia64/get_error.c @@ -3,20 +3,10 @@ static void get_error(struct tcb *tcp, const bool check_errno) { - if (ia64_ia32mode) { - int err = ia64_regs.gr[8]; - if (check_errno && is_negated_errno(err)) { - tcp->u_rval = -1; - tcp->u_error = -err; - } else { - tcp->u_rval = err; - } + if (ia64_regs.gr[10]) { + tcp->u_rval = -1; + tcp->u_error = ia64_regs.gr[8]; } else { - if (ia64_regs.gr[10]) { - tcp->u_rval = -1; - tcp->u_error = ia64_regs.gr[8]; - } else { - tcp->u_rval = ia64_regs.gr[8]; - } + tcp->u_rval = ia64_regs.gr[8]; } } diff --git a/linux/ia64/get_scno.c b/linux/ia64/get_scno.c index 0ddc17a9..88f2cad5 100644 --- a/linux/ia64/get_scno.c +++ b/linux/ia64/get_scno.c @@ -2,6 +2,6 @@ static int arch_get_scno(struct tcb *tcp) { - tcp->scno = ia64_ia32mode ? ia64_regs.gr[0] : ia64_regs.gr[15]; + tcp->scno = ia64_regs.gr[15]; return 1; } diff --git a/linux/ia64/get_syscall_args.c b/linux/ia64/get_syscall_args.c index 1b942eba..ad73c547 100644 --- a/linux/ia64/get_syscall_args.c +++ b/linux/ia64/get_syscall_args.c @@ -1,29 +1,26 @@ +#include <asm/rse.h> + /* Return -1 on error or 1 on success (never 0!). */ static int get_syscall_args(struct tcb *tcp) { - if (!ia64_ia32mode) { - unsigned long *rbs_end = - (unsigned long *) ia64_regs.ar[PT_AUR_BSP]; - unsigned long sof = (ia64_regs.cfm >> 0) & 0x7f; - unsigned long sol = (ia64_regs.cfm >> 7) & 0x7f; - unsigned long *out0 = ia64_rse_skip_regs(rbs_end, -sof + sol); - unsigned int i; + unsigned long *rbs_end = + (unsigned long *) ia64_regs.ar[PT_AUR_BSP]; + unsigned long sof = (ia64_regs.cfm >> 0) & 0x7f; + unsigned long sol = (ia64_regs.cfm >> 7) & 0x7f; + unsigned long *out0 = ia64_rse_skip_regs(rbs_end, -sof + sol); + unsigned int i; - for (i = 0; i < tcp->s_ent->nargs; ++i) { - if (umove(tcp, - (unsigned long) ia64_rse_skip_regs(out0, i), - &tcp->u_arg[i]) < 0) + for (i = 0; i < tcp->s_ent->nargs; ++i) { + if (umove(tcp, + (unsigned long) ia64_rse_skip_regs(out0, i), + &tcp->u_arg[i]) < 0) { + if (errno == EPERM) + tcp->u_arg[i] = 0; + else return -1; } - } else { - /* truncate away IVE sign-extension */ - tcp->u_arg[0] = 0xffffffff & ia64_regs.gr[11]; /* EBX */ - tcp->u_arg[1] = 0xffffffff & ia64_regs.gr[ 9]; /* ECX */ - tcp->u_arg[2] = 0xffffffff & ia64_regs.gr[10]; /* EDX */ - tcp->u_arg[3] = 0xffffffff & ia64_regs.gr[14]; /* ESI */ - tcp->u_arg[4] = 0xffffffff & ia64_regs.gr[15]; /* EDI */ - tcp->u_arg[5] = 0xffffffff & ia64_regs.gr[13]; /* EBP */ } + return 1; } diff --git a/linux/ia64/set_error.c b/linux/ia64/set_error.c index c566b638..69344997 100644 --- a/linux/ia64/set_error.c +++ b/linux/ia64/set_error.c @@ -1,12 +1,9 @@ static int arch_set_error(struct tcb *tcp) { - if (ia64_ia32mode) { - ia64_regs.gr[8] = -tcp->u_error; - } else { - ia64_regs.gr[8] = tcp->u_error; - ia64_regs.gr[10] = -1; - } + ia64_regs.gr[8] = tcp->u_error; + ia64_regs.gr[10] = -1; + return set_regs(tcp->pid); } @@ -14,8 +11,7 @@ static int arch_set_success(struct tcb *tcp) { ia64_regs.gr[8] = tcp->u_rval; - if (!ia64_ia32mode) { - ia64_regs.gr[10] = 0; - } + ia64_regs.gr[10] = 0; + return set_regs(tcp->pid); } diff --git a/linux/ia64/set_scno.c b/linux/ia64/set_scno.c index 1af7b025..8e0f9c45 100644 --- a/linux/ia64/set_scno.c +++ b/linux/ia64/set_scno.c @@ -1,10 +1,7 @@ static int arch_set_scno(struct tcb *tcp, kernel_ulong_t scno) { - if (ia64_ia32mode) - ia64_regs.gr[0] = scno; - else - ia64_regs.gr[15] = scno; + ia64_regs.gr[15] = scno; return set_regs(tcp->pid); } diff --git a/linux/ia64/syscallent.h b/linux/ia64/syscallent.h index 7ca4e391..33b3e8da 100644 --- a/linux/ia64/syscallent.h +++ b/linux/ia64/syscallent.h @@ -1,7 +1,7 @@ /* * Copyright (c) 1999, 2001 Hewlett-Packard Co * David Mosberger-Tang <davidm@hpl.hp.com> - * Copyright (c) 2000-2017 The strace developers. + * Copyright (c) 2000-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -59,13 +59,13 @@ [1038] = { 2, TF, SEN(chmod), "chmod" }, [1039] = { 3, TF, SEN(chown), "chown" }, [1040] = { 3, TD, SEN(lseek), "lseek" }, -[1041] = { 0, NF, SEN(getpid), "getpid" }, -[1042] = { 0, NF, SEN(getppid), "getppid" }, +[1041] = { 0, PU|NF, SEN(getpid), "getpid" }, +[1042] = { 0, PU|NF, SEN(getppid), "getppid" }, [1043] = { 5, TF, SEN(mount), "mount" }, [1044] = { 2, TF, SEN(umount2), "umount" }, [1045] = { 1, 0, SEN(setuid), "setuid" }, -[1046] = { 0, NF, SEN(getuid), "getuid" }, -[1047] = { 0, NF, SEN(geteuid), "geteuid" }, +[1046] = { 0, PU|NF, SEN(getuid), "getuid" }, +[1047] = { 0, PU|NF, SEN(geteuid), "geteuid" }, [1048] = { 4, 0, SEN(ptrace), "ptrace" }, [1049] = { 2, TF, SEN(access), "access" }, [1050] = { 0, 0, SEN(sync), "sync" }, @@ -80,8 +80,8 @@ [1059] = { 1, 0, SEN(times), "times" }, [1060] = { 1, TM|SI, SEN(brk), "brk" }, [1061] = { 1, 0, SEN(setgid), "setgid" }, -[1062] = { 0, NF, SEN(getgid), "getgid" }, -[1063] = { 0, NF, SEN(getegid), "getegid" }, +[1062] = { 0, PU|NF, SEN(getgid), "getgid" }, +[1063] = { 0, PU|NF, SEN(getegid), "getegid" }, [1064] = { 1, TF, SEN(acct), "acct" }, [1065] = { 3, TD, SEN(ioctl), "ioctl" }, [1066] = { 3, TD, SEN(fcntl), "fcntl" }, @@ -123,7 +123,7 @@ [1102] = { 3, 0, SEN(setpriority), "setpriority" }, [1103] = { 2, TF|TSF|TSFA, SEN(statfs), "statfs" }, [1104] = { 2, TD|TFSF|TSFA, SEN(fstatfs), "fstatfs" }, -[1105] = { 0, NF, SEN(gettid), "gettid" }, +[1105] = { 0, PU|NF, SEN(gettid), "gettid" }, [1106] = { 3, TI, SEN(semget), "semget" }, [1107] = { 3, TI, SEN(semop), "semop" }, [1108] = { 4, TI, SEN(semctl), "semctl" }, @@ -189,7 +189,7 @@ [1168] = { 2, 0, SEN(nanosleep), "nanosleep" }, [1169] = { 3, 0, SEN(nfsservctl), "nfsservctl" }, [1170] = { 5, 0, SEN(prctl), "prctl" }, -[1171] = { 0, 0, SEN(getpagesize), "getpagesize" }, +[1171] = { 0, PU|NF, SEN(getpagesize), "getpagesize" }, [1172] = { 6, TD|TM|SI, SEN(mmap_pgoff), "mmap2" }, [1173] = { 5, 0, SEN(printargs), "pciconfig_read" }, [1174] = { 5, 0, SEN(printargs), "pciconfig_write" }, @@ -280,12 +280,12 @@ [1259] = { 6, TM, SEN(mbind), "mbind" }, [1260] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" }, [1261] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" }, -[1262] = { 4, 0, SEN(mq_open), "mq_open" }, +[1262] = { 4, TD, SEN(mq_open), "mq_open" }, [1263] = { 1, 0, SEN(mq_unlink), "mq_unlink" }, -[1264] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" }, -[1265] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" }, -[1266] = { 2, 0, SEN(mq_notify), "mq_notify" }, -[1267] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" }, +[1264] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" }, +[1265] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" }, +[1266] = { 2, TD, SEN(mq_notify), "mq_notify" }, +[1267] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" }, [1268] = { 4, 0, SEN(kexec_load), "kexec_load" }, [1269] = { 5, 0, SEN(vserver), "vserver" }, [1270] = { 5, TP, SEN(waitid), "waitid" }, diff --git a/linux/m68k/arch_defs_.h b/linux/m68k/arch_defs_.h new file mode 100644 index 00000000..67e815c4 --- /dev/null +++ b/linux/m68k/arch_defs_.h @@ -0,0 +1,4 @@ +#define HAVE_ARCH_OLD_MMAP 1 +#define HAVE_ARCH_OLD_SELECT 1 +#define HAVE_ARCH_UID16_SYSCALLS 1 +#define HAVE_ARCH_SA_RESTORER 1 diff --git a/linux/m68k/syscallent.h b/linux/m68k/syscallent.h index dc532c72..b8bad1b1 100644 --- a/linux/m68k/syscallent.h +++ b/linux/m68k/syscallent.h @@ -1,7 +1,7 @@ /* * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl> * Copyright (c) 1993, 1994, 1995 Rick Sladkey <jrs@world.std.com> - * Copyright (c) 1995-2017 The strace developers. + * Copyright (c) 1995-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,11 +47,11 @@ [ 17] = { 0, TM, SEN(break), "break" }, [ 18] = { 2, TF|TST|TSTA, SEN(oldstat), "oldstat" }, [ 19] = { 3, TD, SEN(lseek), "lseek" }, -[ 20] = { 0, NF, SEN(getpid), "getpid" }, +[ 20] = { 0, PU|NF, SEN(getpid), "getpid" }, [ 21] = { 5, TF, SEN(mount), "mount" }, [ 22] = { 1, TF, SEN(umount), "umount" }, [ 23] = { 1, 0, SEN(setuid16), "setuid" }, -[ 24] = { 0, NF, SEN(getuid16), "getuid" }, +[ 24] = { 0, PU|NF, SEN(getuid16), "getuid" }, [ 25] = { 1, 0, SEN(stime), "stime" }, [ 26] = { 4, 0, SEN(ptrace), "ptrace" }, [ 27] = { 1, 0, SEN(alarm), "alarm" }, @@ -74,10 +74,10 @@ [ 44] = { 0, 0, SEN(prof), "prof" }, [ 45] = { 1, TM|SI, SEN(brk), "brk" }, [ 46] = { 1, 0, SEN(setgid16), "setgid" }, -[ 47] = { 0, NF, SEN(getgid16), "getgid" }, +[ 47] = { 0, PU|NF, SEN(getgid16), "getgid" }, [ 48] = { 2, TS, SEN(signal), "signal" }, -[ 49] = { 0, NF, SEN(geteuid16), "geteuid" }, -[ 50] = { 0, NF, SEN(getegid16), "getegid" }, +[ 49] = { 0, PU|NF, SEN(geteuid16), "geteuid" }, +[ 50] = { 0, PU|NF, SEN(getegid16), "getegid" }, [ 51] = { 1, TF, SEN(acct), "acct" }, [ 52] = { 2, TF, SEN(umount2), "umount2" }, [ 53] = { 0, 0, SEN(lock), "lock" }, @@ -91,8 +91,8 @@ [ 61] = { 1, TF, SEN(chroot), "chroot" }, [ 62] = { 2, TSFA, SEN(ustat), "ustat" }, [ 63] = { 2, TD, SEN(dup2), "dup2" }, -[ 64] = { 0, NF, SEN(getppid), "getppid" }, -[ 65] = { 0, 0, SEN(getpgrp), "getpgrp" }, +[ 64] = { 0, PU|NF, SEN(getppid), "getppid" }, +[ 65] = { 0, PU|NF, SEN(getpgrp), "getpgrp" }, [ 66] = { 0, 0, SEN(setsid), "setsid" }, [ 67] = { 3, TS, SEN(sigaction), "sigaction" }, [ 68] = { 0, TS, SEN(sgetmask), "sgetmask" }, @@ -193,7 +193,7 @@ [163] = { 5, TM|SI, SEN(mremap), "mremap" }, [164] = { 3, 0, SEN(setresuid16), "setresuid" }, [165] = { 3, 0, SEN(getresuid16), "getresuid" }, -[166] = { 0, 0, SEN(getpagesize), "getpagesize" }, +[166] = { 0, PU|NF, SEN(getpagesize), "getpagesize" }, [167] = { 5, 0, SEN(query_module), "query_module" }, [168] = { 3, TD, SEN(poll), "poll" }, [169] = { 3, 0, SEN(nfsservctl), "nfsservctl" }, @@ -226,10 +226,10 @@ [196] = { 2, TF|TLST|TSTA, SEN(lstat64), "lstat64" }, [197] = { 2, TD|TFST|TSTA, SEN(fstat64), "fstat64" }, [198] = { 3, TF, SEN(chown), "chown32" }, -[199] = { 0, NF, SEN(getuid), "getuid32" }, -[200] = { 0, NF, SEN(getgid), "getgid32" }, -[201] = { 0, NF, SEN(geteuid), "geteuid32" }, -[202] = { 0, NF, SEN(geteuid), "getegid32" }, +[199] = { 0, PU|NF, SEN(getuid), "getuid32" }, +[200] = { 0, PU|NF, SEN(getgid), "getgid32" }, +[201] = { 0, PU|NF, SEN(geteuid), "geteuid32" }, +[202] = { 0, PU|NF, SEN(geteuid), "getegid32" }, [203] = { 2, 0, SEN(setreuid), "setreuid32" }, [204] = { 2, 0, SEN(setregid), "setregid32" }, [205] = { 2, 0, SEN(getgroups), "getgroups32" }, @@ -247,7 +247,7 @@ [217] = { 2, TF, SEN(pivotroot), "pivot_root" }, [218 ... 219] = { }, [220] = { 3, TD, SEN(getdents64), "getdents64" }, -[221] = { 0, NF, SEN(gettid), "gettid" }, +[221] = { 0, PU|NF, SEN(gettid), "gettid" }, [222] = { 2, TS, SEN(kill), "tkill" }, [223] = { 5, TF, SEN(setxattr), "setxattr" }, [224] = { 5, TF, SEN(setxattr), "lsetxattr" }, @@ -297,12 +297,12 @@ [268] = { 6, TM, SEN(mbind), "mbind" }, [269] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" }, [270] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" }, -[271] = { 4, 0, SEN(mq_open), "mq_open" }, +[271] = { 4, TD, SEN(mq_open), "mq_open" }, [272] = { 1, 0, SEN(mq_unlink), "mq_unlink" }, -[273] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" }, -[274] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" }, -[275] = { 2, 0, SEN(mq_notify), "mq_notify" }, -[276] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" }, +[273] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" }, +[274] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" }, +[275] = { 2, TD, SEN(mq_notify), "mq_notify" }, +[276] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" }, [277] = { 5, TP, SEN(waitid), "waitid" }, [278] = { 5, 0, SEN(vserver), "vserver" }, [279] = { 5, 0, SEN(add_key), "add_key" }, @@ -359,7 +359,7 @@ [330] = { 5, TD, SEN(pwritev), "pwritev" }, [331] = { 4, TP|TS, SEN(rt_tgsigqueueinfo), "rt_tgsigqueueinfo" }, [332] = { 5, TD, SEN(perf_event_open), "perf_event_open" }, -[333] = { 0, 0, SEN(get_thread_area), "get_thread_area" }, +[333] = { 0, PU|NF, SEN(get_thread_area), "get_thread_area" }, [334] = { 1, 0, SEN(set_thread_area), "set_thread_area" }, [335] = { 6, 0, SEN(printargs), "atomic_cmpxchg_32" }, [336] = { 0, 0, SEN(printargs), "atomic_barrier" }, diff --git a/linux/metag/syscallent.h b/linux/metag/syscallent.h index 82ad55bb..723cfe36 100644 --- a/linux/metag/syscallent.h +++ b/linux/metag/syscallent.h @@ -3,4 +3,4 @@ [245] = { 2, 0, SEN(printargs), "metag_setglobalbit" }, [246] = { 1, 0, SEN(printargs), "metag_set_fpu_flags" }, [247] = { 1, 0, SEN(printargs), "metag_set_tls" }, -[248] = { 0, NF, SEN(printargs), "metag_get_tls" }, +[248] = { 0, PU|NF, SEN(printargs), "metag_get_tls" }, diff --git a/linux/microblaze/arch_defs_.h b/linux/microblaze/arch_defs_.h new file mode 100644 index 00000000..d642058b --- /dev/null +++ b/linux/microblaze/arch_defs_.h @@ -0,0 +1,2 @@ +#define HAVE_ARCH_OLD_SELECT 1 +#define HAVE_ARCH_UID16_SYSCALLS 1 diff --git a/linux/microblaze/arch_rt_sigframe.c b/linux/microblaze/arch_rt_sigframe.c index 10d03db6..dcecd1a4 100644 --- a/linux/microblaze/arch_rt_sigframe.c +++ b/linux/microblaze/arch_rt_sigframe.c @@ -29,5 +29,5 @@ FUNC_GET_RT_SIGFRAME_ADDR { unsigned long addr; - return upeek(tcp->pid, 4 * 1, &addr) ? 0 : addr; + return upeek(tcp, 4 * 1, &addr) ? 0 : addr; } diff --git a/linux/microblaze/arch_sigreturn.c b/linux/microblaze/arch_sigreturn.c index 6e4343a8..27920734 100644 --- a/linux/microblaze/arch_sigreturn.c +++ b/linux/microblaze/arch_sigreturn.c @@ -6,7 +6,7 @@ arch_sigreturn(struct tcb *tcp) unsigned long addr; /* Read r1, the stack pointer. */ - if (upeek(tcp->pid, 1 * 4, &addr) < 0) + if (upeek(tcp, 1 * 4, &addr) < 0) return; addr += offsetof(struct sigcontext, oldmask); diff --git a/linux/microblaze/get_scno.c b/linux/microblaze/get_scno.c index 6f98f834..6c11cd44 100644 --- a/linux/microblaze/get_scno.c +++ b/linux/microblaze/get_scno.c @@ -2,5 +2,5 @@ static int arch_get_scno(struct tcb *tcp) { - return upeek(tcp->pid, 0, &tcp->scno) < 0 ? -1 : 1; + return upeek(tcp, 0, &tcp->scno) < 0 ? -1 : 1; } diff --git a/linux/microblaze/get_syscall_args.c b/linux/microblaze/get_syscall_args.c index 830c8c32..1a3a48f9 100644 --- a/linux/microblaze/get_syscall_args.c +++ b/linux/microblaze/get_syscall_args.c @@ -5,7 +5,7 @@ get_syscall_args(struct tcb *tcp) unsigned int i; for (i = 0; i < tcp->s_ent->nargs; ++i) - if (upeek(tcp->pid, (5 + i) * 4, &tcp->u_arg[i]) < 0) + if (upeek(tcp, (5 + i) * 4, &tcp->u_arg[i]) < 0) return -1; return 1; } diff --git a/linux/microblaze/get_syscall_result.c b/linux/microblaze/get_syscall_result.c index 9ece53e8..5b593a4a 100644 --- a/linux/microblaze/get_syscall_result.c +++ b/linux/microblaze/get_syscall_result.c @@ -1,5 +1,5 @@ static int get_syscall_result_regs(struct tcb *tcp) { - return upeek(tcp->pid, 3 * 4, µblaze_r3) < 0 ? -1 : 0; + return upeek(tcp, 3 * 4, µblaze_r3) < 0 ? -1 : 0; } diff --git a/linux/microblaze/set_error.c b/linux/microblaze/set_error.c index 46866719..5bb83b5f 100644 --- a/linux/microblaze/set_error.c +++ b/linux/microblaze/set_error.c @@ -2,12 +2,12 @@ static int arch_set_error(struct tcb *tcp) { microblaze_r3 = -tcp->u_error; - return upoke(tcp->pid, 3 * 4, microblaze_r3); + return upoke(tcp, 3 * 4, microblaze_r3); } static int arch_set_success(struct tcb *tcp) { microblaze_r3 = tcp->u_rval; - return upoke(tcp->pid, 3 * 4, microblaze_r3); + return upoke(tcp, 3 * 4, microblaze_r3); } diff --git a/linux/microblaze/set_scno.c b/linux/microblaze/set_scno.c index b9cddefc..4f69a525 100644 --- a/linux/microblaze/set_scno.c +++ b/linux/microblaze/set_scno.c @@ -1,5 +1,5 @@ static int arch_set_scno(struct tcb *tcp, kernel_ulong_t scno) { - return upoke(tcp->pid, 0, scno); + return upoke(tcp, 0, scno); } diff --git a/linux/microblaze/syscallent.h b/linux/microblaze/syscallent.h index 4c7b9ada..4c645f46 100644 --- a/linux/microblaze/syscallent.h +++ b/linux/microblaze/syscallent.h @@ -1,7 +1,7 @@ /* * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl> * Copyright (c) 1993, 1994, 1995 Rick Sladkey <jrs@world.std.com> - * Copyright (c) 1995-2017 The strace developers. + * Copyright (c) 1995-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,11 +47,11 @@ [ 17] = { 0, TM, SEN(break), "break" }, [ 18] = { 2, TF|TST|TSTA, SEN(oldstat), "oldstat" }, [ 19] = { 3, TD, SEN(lseek), "lseek" }, -[ 20] = { 0, NF, SEN(getpid), "getpid" }, +[ 20] = { 0, PU|NF, SEN(getpid), "getpid" }, [ 21] = { 5, TF, SEN(mount), "mount" }, [ 22] = { 1, TF, SEN(umount), "umount" }, [ 23] = { 1, 0, SEN(setuid16), "setuid" }, -[ 24] = { 0, NF, SEN(getuid16), "getuid" }, +[ 24] = { 0, PU|NF, SEN(getuid16), "getuid" }, [ 25] = { 1, 0, SEN(stime), "stime" }, [ 26] = { 4, 0, SEN(ptrace), "ptrace" }, [ 27] = { 1, 0, SEN(alarm), "alarm" }, @@ -74,10 +74,10 @@ [ 44] = { 0, 0, SEN(prof), "prof" }, [ 45] = { 1, TM|SI, SEN(brk), "brk" }, [ 46] = { 1, 0, SEN(setgid16), "setgid" }, -[ 47] = { 0, NF, SEN(getgid16), "getgid" }, +[ 47] = { 0, PU|NF, SEN(getgid16), "getgid" }, [ 48] = { 2, TS, SEN(signal), "signal" }, -[ 49] = { 0, NF, SEN(geteuid16), "geteuid" }, -[ 50] = { 0, NF, SEN(getegid16), "getegid" }, +[ 49] = { 0, PU|NF, SEN(geteuid16), "geteuid" }, +[ 50] = { 0, PU|NF, SEN(getegid16), "getegid" }, [ 51] = { 1, TF, SEN(acct), "acct" }, [ 52] = { 2, TF, SEN(umount2), "umount2" }, [ 53] = { 0, 0, SEN(lock), "lock" }, @@ -91,8 +91,8 @@ [ 61] = { 1, TF, SEN(chroot), "chroot" }, [ 62] = { 2, TSFA, SEN(ustat), "ustat" }, [ 63] = { 2, TD, SEN(dup2), "dup2" }, -[ 64] = { 0, NF, SEN(getppid), "getppid" }, -[ 65] = { 0, 0, SEN(getpgrp), "getpgrp" }, +[ 64] = { 0, PU|NF, SEN(getppid), "getppid" }, +[ 65] = { 0, PU|NF, SEN(getpgrp), "getpgrp" }, [ 66] = { 0, 0, SEN(setsid), "setsid" }, [ 67] = { 3, TS, SEN(sigaction), "sigaction" }, [ 68] = { 0, TS, SEN(sgetmask), "sgetmask" }, @@ -226,10 +226,10 @@ [196] = { 2, TF|TLST|TSTA, SEN(lstat64), "lstat64" }, [197] = { 2, TD|TFST|TSTA, SEN(fstat64), "fstat64" }, [198] = { 3, TF, SEN(chown), "lchown32" }, -[199] = { 0, NF, SEN(getuid), "getuid32" }, -[200] = { 0, NF, SEN(getgid), "getgid32" }, -[201] = { 0, NF, SEN(geteuid), "geteuid32" }, -[202] = { 0, NF, SEN(geteuid), "getegid32" }, +[199] = { 0, PU|NF, SEN(getuid), "getuid32" }, +[200] = { 0, PU|NF, SEN(getgid), "getgid32" }, +[201] = { 0, PU|NF, SEN(geteuid), "geteuid32" }, +[202] = { 0, PU|NF, SEN(geteuid), "getegid32" }, [203] = { 2, 0, SEN(setreuid), "setreuid32" }, [204] = { 2, 0, SEN(setregid), "setregid32" }, [205] = { 2, 0, SEN(getgroups), "getgroups32" }, @@ -250,7 +250,7 @@ [220] = { 3, TD, SEN(getdents64), "getdents64" }, [221] = { 3, TD, SEN(fcntl64), "fcntl64" }, [222 ... 223] = { }, -[224] = { 0, NF, SEN(gettid), "gettid" }, +[224] = { 0, PU|NF, SEN(gettid), "gettid" }, [225] = { 4, TD, SEN(readahead), "readahead" }, [226] = { 5, TF, SEN(setxattr), "setxattr" }, [227] = { 5, TF, SEN(setxattr), "lsetxattr" }, @@ -303,12 +303,12 @@ [274] = { 6, TM, SEN(mbind), "mbind" }, [275] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" }, [276] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" }, -[277] = { 4, 0, SEN(mq_open), "mq_open" }, +[277] = { 4, TD, SEN(mq_open), "mq_open" }, [278] = { 1, 0, SEN(mq_unlink), "mq_unlink" }, -[279] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" }, -[280] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" }, -[281] = { 2, 0, SEN(mq_notify), "mq_notify" }, -[282] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" }, +[279] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" }, +[280] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" }, +[281] = { 2, TD, SEN(mq_notify), "mq_notify" }, +[282] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" }, [283] = { 4, 0, SEN(kexec_load), "kexec_load" }, [284] = { 5, TP, SEN(waitid), "waitid" }, [285] = { }, diff --git a/linux/mips/arch_defs_.h b/linux/mips/arch_defs_.h new file mode 100644 index 00000000..f6fe59e5 --- /dev/null +++ b/linux/mips/arch_defs_.h @@ -0,0 +1,2 @@ +#define HAVE_ARCH_GETRVAL2 1 +#define HAVE_ARCH_DEDICATED_ERR_REG 1 diff --git a/linux/mips/syscallent-n32.h b/linux/mips/syscallent-n32.h index 748e09cc..c7d35adf 100644 --- a/linux/mips/syscallent-n32.h +++ b/linux/mips/syscallent-n32.h @@ -234,12 +234,12 @@ [6231] = { 6, TM, SEN(mbind), "mbind" }, [6232] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" }, [6233] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" }, -[6234] = { 4, 0, SEN(mq_open), "mq_open" }, +[6234] = { 4, TD, SEN(mq_open), "mq_open" }, [6235] = { 1, 0, SEN(mq_unlink), "mq_unlink" }, -[6236] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" }, -[6237] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" }, -[6238] = { 2, 0, SEN(mq_notify), "mq_notify" }, -[6239] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" }, +[6236] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" }, +[6237] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" }, +[6238] = { 2, TD, SEN(mq_notify), "mq_notify" }, +[6239] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" }, [6240] = { 5, 0, SEN(vserver), "vserver" }, [6241] = { 5, TP, SEN(waitid), "waitid" }, [6242] = { }, diff --git a/linux/mips/syscallent-n64.h b/linux/mips/syscallent-n64.h index cc093667..3e558489 100644 --- a/linux/mips/syscallent-n64.h +++ b/linux/mips/syscallent-n64.h @@ -230,12 +230,12 @@ [5227] = { 6, TM, SEN(mbind), "mbind" }, [5228] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" }, [5229] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" }, -[5230] = { 4, 0, SEN(mq_open), "mq_open" }, +[5230] = { 4, TD, SEN(mq_open), "mq_open" }, [5231] = { 1, 0, SEN(mq_unlink), "mq_unlink" }, -[5232] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" }, -[5233] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" }, -[5234] = { 2, 0, SEN(mq_notify), "mq_notify" }, -[5235] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" }, +[5232] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" }, +[5233] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" }, +[5234] = { 2, TD, SEN(mq_notify), "mq_notify" }, +[5235] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" }, [5236] = { 5, 0, SEN(vserver), "vserver" }, [5237] = { 5, TP, SEN(waitid), "waitid" }, [5238] = { }, diff --git a/linux/mips/syscallent-o32.h b/linux/mips/syscallent-o32.h index 5ac79b5f..40419073 100644 --- a/linux/mips/syscallent-o32.h +++ b/linux/mips/syscallent-o32.h @@ -1,5 +1,6 @@ #if defined LINUX_MIPSO32 /* For an O32 strace, decode the o32 syscalls. */ +# define SYS_syscall_subcall 4000 [4000] = { MA, 0, SEN(syscall), "syscall" }, /* start of Linux o32 */ [4001] = { 1, TP|SE, SEN(exit), "exit" }, [4002] = { 0, TP, SEN(fork), "fork" }, @@ -271,12 +272,12 @@ [4268] = { 6, TM, SEN(mbind), "mbind" }, [4269] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" }, [4270] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" }, -[4271] = { 4, 0, SEN(mq_open), "mq_open" }, +[4271] = { 4, TD, SEN(mq_open), "mq_open" }, [4272] = { 1, 0, SEN(mq_unlink), "mq_unlink" }, -[4273] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" }, -[4274] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" }, -[4275] = { 2, 0, SEN(mq_notify), "mq_notify" }, -[4276] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" }, +[4273] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" }, +[4274] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" }, +[4275] = { 2, TD, SEN(mq_notify), "mq_notify" }, +[4276] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" }, [4277] = { 5, 0, SEN(vserver), "vserver" }, [4278] = { 5, TP, SEN(waitid), "waitid" }, [4279] = { }, diff --git a/linux/mtd-abi.h b/linux/mtd-abi.h deleted file mode 100644 index a63a99a4..00000000 --- a/linux/mtd-abi.h +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Copyright (c) 1999-2010 David Woodhouse <dwmw2@infradead.org> et al. - * Copyright (c) 2010-2017 The strace developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#ifndef __MTD_ABI_H__ -#define __MTD_ABI_H__ - -#include <linux/types.h> - -struct erase_info_user { - __u32 start; - __u32 length; -}; - -struct erase_info_user64 { - __u64 start; - __u64 length; -}; - -struct mtd_oob_buf { - __u32 start; - __u32 length; - unsigned char *ptr; -}; - -struct mtd_oob_buf64 { - __u64 start; - __u32 pad; - __u32 length; - __u64 usr_ptr; -}; - -/** - * MTD operation modes - * - * @MTD_OPS_PLACE_OOB: OOB data are placed at the given offset (default) - * @MTD_OPS_AUTO_OOB: OOB data are automatically placed at the free areas - * which are defined by the internal ecclayout - * @MTD_OPS_RAW: data are transferred as-is, with no error correction; - * this mode implies %MTD_OPS_PLACE_OOB - * - * These modes can be passed to ioctl(MEMWRITE) and are also used internally. - * See notes on "MTD file modes" for discussion on %MTD_OPS_RAW vs. - * %MTD_FILE_MODE_RAW. - */ -enum { - MTD_OPS_PLACE_OOB = 0, - MTD_OPS_AUTO_OOB = 1, - MTD_OPS_RAW = 2, -}; - -/** - * struct mtd_write_req - data structure for requesting a write operation - * - * @start: start address - * @len: length of data buffer - * @ooblen: length of OOB buffer - * @usr_data: user-provided data buffer - * @usr_oob: user-provided OOB buffer - * @mode: MTD mode (see "MTD operation modes") - * @padding: reserved, must be set to 0 - * - * This structure supports ioctl(MEMWRITE) operations, allowing data and/or OOB - * writes in various modes. To write to OOB-only, set @usr_data == NULL, and to - * write data-only, set @usr_oob == NULL. However, setting both @usr_data and - * @usr_oob to NULL is not allowed. - */ -struct mtd_write_req { - __u64 start; - __u64 len; - __u64 ooblen; - __u64 usr_data; - __u64 usr_oob; - __u8 mode; - __u8 padding[7]; -}; - -#define MTD_ABSENT 0 -#define MTD_RAM 1 -#define MTD_ROM 2 -#define MTD_NORFLASH 3 -#define MTD_NANDFLASH 4 -#define MTD_DATAFLASH 6 -#define MTD_UBIVOLUME 7 -#define MTD_MLCNANDFLASH 8 - -#define MTD_WRITEABLE 0x400 /* Device is writeable */ -#define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */ -#define MTD_NO_ERASE 0x1000 /* No erase necessary */ -#define MTD_POWERUP_LOCK 0x2000 /* Always locked after reset */ - -/* Some common devices / combinations of capabilities */ -#define MTD_CAP_ROM 0 -#define MTD_CAP_RAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE) -#define MTD_CAP_NORFLASH (MTD_WRITEABLE | MTD_BIT_WRITEABLE) -#define MTD_CAP_NANDFLASH (MTD_WRITEABLE) - -/* Obsolete ECC byte placement modes (used with obsolete MEMGETOOBSEL) */ -#define MTD_NANDECC_OFF 0 // Switch off ECC (Not recommended) -#define MTD_NANDECC_PLACE 1 // Use the given placement in the structure (YAFFS1 legacy mode) -#define MTD_NANDECC_AUTOPLACE 2 // Use the default placement scheme -#define MTD_NANDECC_PLACEONLY 3 // Use the given placement in the structure (Do not store ecc result on read) -#define MTD_NANDECC_AUTOPL_USR 4 // Use the given autoplacement scheme rather than using the default - -/* OTP mode selection */ -#define MTD_OTP_OFF 0 -#define MTD_OTP_FACTORY 1 -#define MTD_OTP_USER 2 - -struct mtd_info_user { - __u8 type; - __u32 flags; - __u32 size; /* Total size of the MTD */ - __u32 erasesize; - __u32 writesize; - __u32 oobsize; /* Amount of OOB data per block (e.g. 16) */ - __u64 padding; /* Old obsolete field; do not use */ -}; - -struct region_info_user { - __u32 offset; /* At which this region starts, - * from the beginning of the MTD */ - __u32 erasesize; /* For this region */ - __u32 numblocks; /* Number of blocks in this region */ - __u32 regionindex; -}; - -struct otp_info { - __u32 start; - __u32 length; - __u32 locked; -}; - -/* - * Note, the following ioctl existed in the past and was removed: - * #define MEMSETOOBSEL _IOW('M', 9, struct nand_oobinfo) - * Try to avoid adding a new ioctl with the same ioctl number. - */ - -/* Get basic MTD characteristics info (better to use sysfs) */ -#define MEMGETINFO _IOR('M', 1, struct mtd_info_user) -/* Erase segment of MTD */ -#define MEMERASE _IOW('M', 2, struct erase_info_user) -/* Write out-of-band data from MTD */ -#define MEMWRITEOOB _IOWR('M', 3, struct mtd_oob_buf) -/* Read out-of-band data from MTD */ -#define MEMREADOOB _IOWR('M', 4, struct mtd_oob_buf) -/* Lock a chip (for MTD that supports it) */ -#define MEMLOCK _IOW('M', 5, struct erase_info_user) -/* Unlock a chip (for MTD that supports it) */ -#define MEMUNLOCK _IOW('M', 6, struct erase_info_user) -/* Get the number of different erase regions */ -#define MEMGETREGIONCOUNT _IOR('M', 7, int) -/* Get information about the erase region for a specific index */ -#define MEMGETREGIONINFO _IOWR('M', 8, struct region_info_user) -/* Get info about OOB modes (e.g., RAW, PLACE, AUTO) - legacy interface */ -#define MEMGETOOBSEL _IOR('M', 10, struct nand_oobinfo) -/* Check if an eraseblock is bad */ -#define MEMGETBADBLOCK _IOW('M', 11, __kernel_loff_t) -/* Mark an eraseblock as bad */ -#define MEMSETBADBLOCK _IOW('M', 12, __kernel_loff_t) -/* Set OTP (One-Time Programmable) mode (factory vs. user) */ -#define OTPSELECT _IOR('M', 13, int) -/* Get number of OTP (One-Time Programmable) regions */ -#define OTPGETREGIONCOUNT _IOW('M', 14, int) -/* Get all OTP (One-Time Programmable) info about MTD */ -#define OTPGETREGIONINFO _IOW('M', 15, struct otp_info) -/* Lock a given range of user data (must be in mode %MTD_FILE_MODE_OTP_USER) */ -#define OTPLOCK _IOR('M', 16, struct otp_info) -/* Get ECC layout (deprecated) */ -#define ECCGETLAYOUT _IOR('M', 17, struct nand_ecclayout_user) -/* Get statistics about corrected/uncorrected errors */ -#define ECCGETSTATS _IOR('M', 18, struct mtd_ecc_stats) -/* Set MTD mode on a per-file-descriptor basis (see "MTD file modes") */ -#define MTDFILEMODE _IO('M', 19) -/* Erase segment of MTD (supports 64-bit address) */ -#define MEMERASE64 _IOW('M', 20, struct erase_info_user64) -/* Write data to OOB (64-bit version) */ -#define MEMWRITEOOB64 _IOWR('M', 21, struct mtd_oob_buf64) -/* Read data from OOB (64-bit version) */ -#define MEMREADOOB64 _IOWR('M', 22, struct mtd_oob_buf64) -/* Check if chip is locked (for MTD that supports it) */ -#define MEMISLOCKED _IOR('M', 23, struct erase_info_user) -/* - * Most generic write interface; can write in-band and/or out-of-band in various - * modes (see "struct mtd_write_req"). This ioctl is not supported for flashes - * without OOB, e.g., NOR flash. - */ -#define MEMWRITE _IOWR('M', 24, struct mtd_write_req) - -/* - * Obsolete legacy interface. Keep it in order not to break userspace - * interfaces - */ -struct nand_oobinfo { - __u32 useecc; - __u32 eccbytes; - __u32 oobfree[8][2]; - __u32 eccpos[32]; -}; - -struct nand_oobfree { - __u32 offset; - __u32 length; -}; - -#define MTD_MAX_OOBFREE_ENTRIES 8 -#define MTD_MAX_ECCPOS_ENTRIES 64 -/* - * OBSOLETE: ECC layout control structure. Exported to user-space via ioctl - * ECCGETLAYOUT for backwards compatbility and should not be mistaken as a - * complete set of ECC information. The ioctl truncates the larger internal - * structure to retain binary compatibility with the static declaration of the - * ioctl. Note that the "MTD_MAX_..._ENTRIES" macros represent the max size of - * the user struct, not the MAX size of the internal struct nand_ecclayout. - */ -struct nand_ecclayout_user { - __u32 eccbytes; - __u32 eccpos[MTD_MAX_ECCPOS_ENTRIES]; - __u32 oobavail; - struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES]; -}; - -/** - * struct mtd_ecc_stats - error correction stats - * - * @corrected: number of corrected bits - * @failed: number of uncorrectable errors - * @badblocks: number of bad blocks in this partition - * @bbtblocks: number of blocks reserved for bad block tables - */ -struct mtd_ecc_stats { - __u32 corrected; - __u32 failed; - __u32 badblocks; - __u32 bbtblocks; -}; - -/* - * MTD file modes - for read/write access to MTD - * - * @MTD_FILE_MODE_NORMAL: OTP disabled, ECC enabled - * @MTD_FILE_MODE_OTP_FACTORY: OTP enabled in factory mode - * @MTD_FILE_MODE_OTP_USER: OTP enabled in user mode - * @MTD_FILE_MODE_RAW: OTP disabled, ECC disabled - * - * These modes can be set via ioctl(MTDFILEMODE). The mode mode will be retained - * separately for each open file descriptor. - * - * Note: %MTD_FILE_MODE_RAW provides the same functionality as %MTD_OPS_RAW - - * raw access to the flash, without error correction or autoplacement schemes. - * Wherever possible, the MTD_OPS_* mode will override the MTD_FILE_MODE_* mode - * (e.g., when using ioctl(MEMWRITE)), but in some cases, the MTD_FILE_MODE is - * used out of necessity (e.g., `write()', ioctl(MEMWRITEOOB64)). - */ -enum mtd_file_modes { - MTD_FILE_MODE_NORMAL = MTD_OTP_OFF, - MTD_FILE_MODE_OTP_FACTORY = MTD_OTP_FACTORY, - MTD_FILE_MODE_OTP_USER = MTD_OTP_USER, - MTD_FILE_MODE_RAW, -}; - -#endif /* __MTD_ABI_H__ */ diff --git a/linux/nios2/arch_defs_.h b/linux/nios2/arch_defs_.h new file mode 100644 index 00000000..2bd4e4a2 --- /dev/null +++ b/linux/nios2/arch_defs_.h @@ -0,0 +1 @@ +#define HAVE_ARCH_DEDICATED_ERR_REG 1 diff --git a/linux/nr_prefix.c b/linux/nr_prefix.c new file mode 100644 index 00000000..f22814f4 --- /dev/null +++ b/linux/nr_prefix.c @@ -0,0 +1,11 @@ +/** + * Returns prefix for a syscall constant literal. It is has to be that way + * thanks to ARM that decided to prefix their special system calls like sys32 + * and sys26 with __ARM_NR_* prefix instead of __NR_*, so we can't simply print + * "__NR_". + */ +static inline const char * +nr_prefix(kernel_ulong_t scno) +{ + return "__NR_"; +} diff --git a/linux/personality.h b/linux/personality.h deleted file mode 100644 index 09b35c65..00000000 --- a/linux/personality.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef _LINUX_PERSONALITY_H -#define _LINUX_PERSONALITY_H - - -/* - * Flags for bug emulation. - * - * These occupy the top three bytes. - */ -enum { - UNAME26 = 0x0020000, - ADDR_NO_RANDOMIZE = 0x0040000, /* disable randomization of VA space */ - FDPIC_FUNCPTRS = 0x0080000, /* userspace function ptrs point to descriptors - * (signal handling) - */ - MMAP_PAGE_ZERO = 0x0100000, - ADDR_COMPAT_LAYOUT = 0x0200000, - READ_IMPLIES_EXEC = 0x0400000, - ADDR_LIMIT_32BIT = 0x0800000, - SHORT_INODE = 0x1000000, - WHOLE_SECONDS = 0x2000000, - STICKY_TIMEOUTS = 0x4000000, - ADDR_LIMIT_3GB = 0x8000000, -}; - -/* - * Security-relevant compatibility flags that must be - * cleared upon setuid or setgid exec: - */ -#define PER_CLEAR_ON_SETID (READ_IMPLIES_EXEC | \ - ADDR_NO_RANDOMIZE | \ - ADDR_COMPAT_LAYOUT | \ - MMAP_PAGE_ZERO) - -/* - * Personality types. - * - * These go in the low byte. Avoid using the top bit, it will - * conflict with error returns. - */ -enum { - PER_LINUX = 0x0000, - PER_LINUX_32BIT = 0x0000 | ADDR_LIMIT_32BIT, - PER_LINUX_FDPIC = 0x0000 | FDPIC_FUNCPTRS, - PER_SVR4 = 0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO, - PER_SVR3 = 0x0002 | STICKY_TIMEOUTS | SHORT_INODE, - PER_SCOSVR3 = 0x0003 | STICKY_TIMEOUTS | - WHOLE_SECONDS | SHORT_INODE, - PER_OSR5 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS, - PER_WYSEV386 = 0x0004 | STICKY_TIMEOUTS | SHORT_INODE, - PER_ISCR4 = 0x0005 | STICKY_TIMEOUTS, - PER_BSD = 0x0006, - PER_SUNOS = 0x0006 | STICKY_TIMEOUTS, - PER_XENIX = 0x0007 | STICKY_TIMEOUTS | SHORT_INODE, - PER_LINUX32 = 0x0008, - PER_LINUX32_3GB = 0x0008 | ADDR_LIMIT_3GB, - PER_IRIX32 = 0x0009 | STICKY_TIMEOUTS,/* IRIX5 32-bit */ - PER_IRIXN32 = 0x000a | STICKY_TIMEOUTS,/* IRIX6 new 32-bit */ - PER_IRIX64 = 0x000b | STICKY_TIMEOUTS,/* IRIX6 64-bit */ - PER_RISCOS = 0x000c, - PER_SOLARIS = 0x000d | STICKY_TIMEOUTS, - PER_UW7 = 0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO, - PER_OSF4 = 0x000f, /* OSF/1 v4 */ - PER_HPUX = 0x0010, - PER_MASK = 0x00ff, -}; - - -#endif /* _LINUX_PERSONALITY_H */ diff --git a/linux/powerpc/arch_defs_.h b/linux/powerpc/arch_defs_.h new file mode 100644 index 00000000..ef3f342e --- /dev/null +++ b/linux/powerpc/arch_defs_.h @@ -0,0 +1,2 @@ +#define HAVE_ARCH_OLD_SELECT 1 +#define HAVE_ARCH_DEDICATED_ERR_REG 1 diff --git a/linux/powerpc/getregs_old.c b/linux/powerpc/getregs_old.c index 1730f033..4485ca68 100644 --- a/linux/powerpc/getregs_old.c +++ b/linux/powerpc/getregs_old.c @@ -3,29 +3,29 @@ * we provide a slow fallback for old kernels. */ static int -getregs_old(pid_t pid) +getregs_old(struct tcb *tcp) { int i; long r; if (iflag) { - r = upeek(pid, sizeof(long) * PT_NIP, &ppc_regs.nip); + r = upeek(tcp, sizeof(long) * PT_NIP, &ppc_regs.nip); if (r) goto out; } #ifdef POWERPC64 /* else we never use it */ - r = upeek(pid, sizeof(long) * PT_MSR, &ppc_regs.msr); + r = upeek(tcp, sizeof(long) * PT_MSR, &ppc_regs.msr); if (r) goto out; #endif - r = upeek(pid, sizeof(long) * PT_CCR, &ppc_regs.ccr); + r = upeek(tcp, sizeof(long) * PT_CCR, &ppc_regs.ccr); if (r) goto out; - r = upeek(pid, sizeof(long) * PT_ORIG_R3, &ppc_regs.orig_gpr3); + r = upeek(tcp, sizeof(long) * PT_ORIG_R3, &ppc_regs.orig_gpr3); if (r) goto out; for (i = 0; i <= 8; i++) { - r = upeek(pid, sizeof(long) * (PT_R0 + i), + r = upeek(tcp, sizeof(long) * (PT_R0 + i), &ppc_regs.gpr[i]); if (r) goto out; diff --git a/linux/powerpc/ioctls_arch0.h b/linux/powerpc/ioctls_arch0.h index e922ec0e..f6f3b266 100644 --- a/linux/powerpc/ioctls_arch0.h +++ b/linux/powerpc/ioctls_arch0.h @@ -130,6 +130,7 @@ { "linux/kvm.h", "KVM_NMI", _IOC_NONE, 0xae9a, 0x00 }, { "linux/kvm.h", "KVM_PPC_ALLOCATE_HTAB", _IOC_READ|_IOC_WRITE, 0xaea7, 0x04 }, { "linux/kvm.h", "KVM_PPC_CONFIGURE_V3_MMU", _IOC_WRITE, 0xaeaf, 0x10 }, +{ "linux/kvm.h", "KVM_PPC_GET_CPU_CHAR", _IOC_READ, 0xaeb1, 0x20 }, { "linux/kvm.h", "KVM_PPC_GET_HTAB_FD", _IOC_WRITE, 0xaeaa, 0x20 }, { "linux/kvm.h", "KVM_PPC_GET_PVINFO", _IOC_WRITE, 0xaea1, 0x80 }, { "linux/kvm.h", "KVM_PPC_GET_RMMU_INFO", _IOC_WRITE, 0xaeb0, 0x60 }, diff --git a/linux/powerpc/set_error.c b/linux/powerpc/set_error.c index 7edabee5..38ae32bb 100644 --- a/linux/powerpc/set_error.c +++ b/linux/powerpc/set_error.c @@ -3,7 +3,7 @@ arch_set_error(struct tcb *tcp) { ppc_regs.gpr[3] = tcp->u_error; #ifdef HAVE_GETREGS_OLD - return upoke(tcp->pid, sizeof(long) * (PT_R0 + 3), ppc_regs.gpr[3]); + return upoke(tcp, sizeof(long) * (PT_R0 + 3), ppc_regs.gpr[3]); #else return set_regs(tcp->pid); #endif @@ -15,8 +15,8 @@ arch_set_success(struct tcb *tcp) ppc_regs.gpr[3] = tcp->u_rval; ppc_regs.ccr &= ~0x10000000; #ifdef HAVE_GETREGS_OLD - return upoke(tcp->pid, sizeof(long) * PT_CCR, ppc_regs.ccr) || - upoke(tcp->pid, sizeof(long) * (PT_R0 + 3), ppc_regs.gpr[3]); + return upoke(tcp, sizeof(long) * PT_CCR, ppc_regs.ccr) || + upoke(tcp, sizeof(long) * (PT_R0 + 3), ppc_regs.gpr[3]); #else return set_regs(tcp->pid); #endif diff --git a/linux/powerpc/set_scno.c b/linux/powerpc/set_scno.c index c5a04687..b2f66934 100644 --- a/linux/powerpc/set_scno.c +++ b/linux/powerpc/set_scno.c @@ -2,7 +2,7 @@ static int arch_set_scno(struct tcb *tcp, kernel_ulong_t scno) { #ifdef HAVE_GETREGS_OLD - return upoke(tcp->pid, sizeof(long) * PT_R0, scno); + return upoke(tcp, sizeof(long) * PT_R0, scno); #else ppc_regs.gpr[0] = scno; return set_regs(tcp->pid); diff --git a/linux/powerpc/syscallent.h b/linux/powerpc/syscallent.h index d5e574ae..d0bcbba7 100644 --- a/linux/powerpc/syscallent.h +++ b/linux/powerpc/syscallent.h @@ -1,7 +1,7 @@ /* * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl> * Copyright (c) 1993, 1994, 1995 Rick Sladkey <jrs@world.std.com> - * Copyright (c) 1995-2017 The strace developers. + * Copyright (c) 1995-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,11 +47,11 @@ [ 17] = { 0, TM, SEN(break), "break" }, [ 18] = { 2, TF|TST|TSTA, SEN(oldstat), "oldstat" }, [ 19] = { 3, TD, SEN(lseek), "lseek" }, -[ 20] = { 0, NF, SEN(getpid), "getpid" }, +[ 20] = { 0, PU|NF, SEN(getpid), "getpid" }, [ 21] = { 5, TF, SEN(mount), "mount" }, [ 22] = { 1, TF, SEN(umount), "umount" }, [ 23] = { 1, 0, SEN(setuid), "setuid" }, -[ 24] = { 0, NF, SEN(getuid), "getuid" }, +[ 24] = { 0, PU|NF, SEN(getuid), "getuid" }, [ 25] = { 1, 0, SEN(stime), "stime" }, [ 26] = { 4, 0, SEN(ptrace), "ptrace" }, [ 27] = { 1, 0, SEN(alarm), "alarm" }, @@ -74,10 +74,10 @@ [ 44] = { 0, 0, SEN(prof), "prof" }, [ 45] = { 1, TM|SI, SEN(brk), "brk" }, [ 46] = { 1, 0, SEN(setgid), "setgid" }, -[ 47] = { 0, NF, SEN(getgid), "getgid" }, +[ 47] = { 0, PU|NF, SEN(getgid), "getgid" }, [ 48] = { 2, TS, SEN(signal), "signal" }, -[ 49] = { 0, NF, SEN(geteuid), "geteuid" }, -[ 50] = { 0, NF, SEN(getegid), "getegid" }, +[ 49] = { 0, PU|NF, SEN(geteuid), "geteuid" }, +[ 50] = { 0, PU|NF, SEN(getegid), "getegid" }, [ 51] = { 1, TF, SEN(acct), "acct" }, [ 52] = { 2, TF, SEN(umount2), "umount2" }, [ 53] = { 0, 0, SEN(lock), "lock" }, @@ -91,8 +91,8 @@ [ 61] = { 1, TF, SEN(chroot), "chroot" }, [ 62] = { 2, TSFA, SEN(ustat), "ustat" }, [ 63] = { 2, TD, SEN(dup2), "dup2" }, -[ 64] = { 0, NF, SEN(getppid), "getppid" }, -[ 65] = { 0, 0, SEN(getpgrp), "getpgrp" }, +[ 64] = { 0, PU|NF, SEN(getppid), "getppid" }, +[ 65] = { 0, PU|NF, SEN(getpgrp), "getpgrp" }, [ 66] = { 0, 0, SEN(setsid), "setsid" }, [ 67] = { 3, TS, SEN(sigaction), "sigaction" }, [ 68] = { 0, TS, SEN(sgetmask), "sgetmask" }, @@ -234,7 +234,7 @@ [204] = { 3, TD, SEN(fcntl64), "fcntl64" }, [205] = { 3, TM, SEN(madvise), "madvise" }, [206] = { 3, TM, SEN(mincore), "mincore" }, -[207] = { 0, NF, SEN(gettid), "gettid" }, +[207] = { 0, PU|NF, SEN(gettid), "gettid" }, [208] = { 2, TS, SEN(kill), "tkill" }, [209] = { 5, TF, SEN(setxattr), "setxattr" }, [210] = { 5, TF, SEN(setxattr), "lsetxattr" }, @@ -289,12 +289,12 @@ [259] = { 6, TM, SEN(mbind), "mbind" }, [260] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" }, [261] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" }, -[262] = { 4, 0, SEN(mq_open), "mq_open" }, +[262] = { 4, TD, SEN(mq_open), "mq_open" }, [263] = { 1, 0, SEN(mq_unlink), "mq_unlink" }, -[264] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" }, -[265] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" }, -[266] = { 2, 0, SEN(mq_notify), "mq_notify" }, -[267] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" }, +[264] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" }, +[265] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" }, +[266] = { 2, TD, SEN(mq_notify), "mq_notify" }, +[267] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" }, [268] = { 4, 0, SEN(kexec_load), "kexec_load" }, [269] = { 5, 0, SEN(add_key), "add_key" }, [270] = { 4, 0, SEN(request_key), "request_key" }, @@ -411,6 +411,9 @@ [381] = { 6, TD, SEN(pwritev2), "pwritev2" }, [382] = { 5, TD, SEN(kexec_file_load), "kexec_file_load" }, [383] = { 5, TD|TF|TSTA, SEN(statx), "statx" }, +[384] = { 2, 0, SEN(pkey_alloc), "pkey_alloc" }, +[385] = { 1, 0, SEN(pkey_free), "pkey_free" }, +[386] = { 4, TM|SI, SEN(pkey_mprotect), "pkey_mprotect" }, #define SYS_socket_subcall 400 #include "subcall.h" diff --git a/linux/powerpc64/arch_defs_.h b/linux/powerpc64/arch_defs_.h new file mode 100644 index 00000000..037b52f6 --- /dev/null +++ b/linux/powerpc64/arch_defs_.h @@ -0,0 +1,3 @@ +#define HAVE_ARCH_OLD_SELECT 1 +#define SUPPORTED_PERSONALITIES 2 +#define HAVE_ARCH_DEDICATED_ERR_REG 1 diff --git a/linux/powerpc64/syscallent.h b/linux/powerpc64/syscallent.h index 21ba1d8c..74362c6f 100644 --- a/linux/powerpc64/syscallent.h +++ b/linux/powerpc64/syscallent.h @@ -1,7 +1,7 @@ /* * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl> * Copyright (c) 1993, 1994, 1995 Rick Sladkey <jrs@world.std.com> - * Copyright (c) 1995-2017 The strace developers. + * Copyright (c) 1995-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,11 +47,11 @@ [ 17] = { 0, TM, SEN(break), "break" }, [ 18] = { 2, TF|TST|TSTA, SEN(oldstat), "oldstat" }, [ 19] = { 3, TD, SEN(lseek), "lseek" }, -[ 20] = { 0, NF, SEN(getpid), "getpid" }, +[ 20] = { 0, PU|NF, SEN(getpid), "getpid" }, [ 21] = { 5, TF, SEN(mount), "mount" }, [ 22] = { 1, TF, SEN(umount), "umount" }, [ 23] = { 1, 0, SEN(setuid), "setuid" }, -[ 24] = { 0, NF, SEN(getuid), "getuid" }, +[ 24] = { 0, PU|NF, SEN(getuid), "getuid" }, [ 25] = { 1, 0, SEN(stime), "stime" }, [ 26] = { 4, 0, SEN(ptrace), "ptrace" }, [ 27] = { 1, 0, SEN(alarm), "alarm" }, @@ -74,10 +74,10 @@ [ 44] = { 0, 0, SEN(prof), "prof" }, [ 45] = { 1, TM|SI, SEN(brk), "brk" }, [ 46] = { 1, 0, SEN(setgid), "setgid" }, -[ 47] = { 0, NF, SEN(getgid), "getgid" }, +[ 47] = { 0, PU|NF, SEN(getgid), "getgid" }, [ 48] = { 2, TS, SEN(signal), "signal" }, -[ 49] = { 0, NF, SEN(geteuid), "geteuid" }, -[ 50] = { 0, NF, SEN(getegid), "getegid" }, +[ 49] = { 0, PU|NF, SEN(geteuid), "geteuid" }, +[ 50] = { 0, PU|NF, SEN(getegid), "getegid" }, [ 51] = { 1, TF, SEN(acct), "acct" }, [ 52] = { 2, TF, SEN(umount2), "umount2" }, [ 53] = { 0, 0, SEN(lock), "lock" }, @@ -91,8 +91,8 @@ [ 61] = { 1, TF, SEN(chroot), "chroot" }, [ 62] = { 2, TSFA, SEN(ustat), "ustat" }, [ 63] = { 2, TD, SEN(dup2), "dup2" }, -[ 64] = { 0, NF, SEN(getppid), "getppid" }, -[ 65] = { 0, 0, SEN(getpgrp), "getpgrp" }, +[ 64] = { 0, PU|NF, SEN(getppid), "getppid" }, +[ 65] = { 0, PU|NF, SEN(getpgrp), "getpgrp" }, [ 66] = { 0, 0, SEN(setsid), "setsid" }, [ 67] = { 3, TS, SEN(sigaction), "sigaction" }, [ 68] = { 0, TS, SEN(sgetmask), "sgetmask" }, @@ -229,7 +229,7 @@ [204] = { }, [205] = { 3, TM, SEN(madvise), "madvise" }, [206] = { 3, TM, SEN(mincore), "mincore" }, -[207] = { 0, NF, SEN(gettid), "gettid" }, +[207] = { 0, PU|NF, SEN(gettid), "gettid" }, [208] = { 2, TS, SEN(kill), "tkill" }, [209] = { 5, TF, SEN(setxattr), "setxattr" }, [210] = { 5, TF, SEN(setxattr), "lsetxattr" }, @@ -284,12 +284,12 @@ [259] = { 6, TM, SEN(mbind), "mbind" }, [260] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" }, [261] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" }, -[262] = { 4, 0, SEN(mq_open), "mq_open" }, +[262] = { 4, TD, SEN(mq_open), "mq_open" }, [263] = { 1, 0, SEN(mq_unlink), "mq_unlink" }, -[264] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" }, -[265] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" }, -[266] = { 2, 0, SEN(mq_notify), "mq_notify" }, -[267] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" }, +[264] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" }, +[265] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" }, +[266] = { 2, TD, SEN(mq_notify), "mq_notify" }, +[267] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" }, [268] = { 4, 0, SEN(kexec_load), "kexec_load" }, [269] = { 5, 0, SEN(add_key), "add_key" }, [270] = { 4, 0, SEN(request_key), "request_key" }, @@ -406,6 +406,9 @@ [381] = { 6, TD, SEN(pwritev2), "pwritev2" }, [382] = { 5, TD, SEN(kexec_file_load), "kexec_file_load" }, [383] = { 5, TD|TF|TSTA, SEN(statx), "statx" }, +[384] = { 2, 0, SEN(pkey_alloc), "pkey_alloc" }, +[385] = { 1, 0, SEN(pkey_free), "pkey_free" }, +[386] = { 4, TM|SI, SEN(pkey_mprotect), "pkey_mprotect" }, #define SYS_socket_subcall 400 #include "subcall.h" diff --git a/linux/ptp_clock.h b/linux/ptp_clock.h deleted file mode 100644 index 248f3ce7..00000000 --- a/linux/ptp_clock.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * PTP 1588 clock support - user space interface - * - * Copyright (c) 2010 OMICRON electronics GmbH - * Copyright (c) 2010-2017 The strace developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef _PTP_CLOCK_H_ -#define _PTP_CLOCK_H_ - -#include <linux/ioctl.h> -#include <linux/types.h> - -/* PTP_xxx bits, for the flags field within the request structures. */ -#define PTP_ENABLE_FEATURE (1<<0) -#define PTP_RISING_EDGE (1<<1) -#define PTP_FALLING_EDGE (1<<2) - -/* - * struct ptp_clock_time - represents a time value - * - * The sign of the seconds field applies to the whole value. The - * nanoseconds field is always unsigned. The reserved field is - * included for sub-nanosecond resolution, should the demand for - * this ever appear. - * - */ -struct ptp_clock_time { - __s64 sec; /* seconds */ - __u32 nsec; /* nanoseconds */ - __u32 reserved; -}; - -struct ptp_clock_caps { - int max_adj; /* Maximum frequency adjustment in parts per billon. */ - int n_alarm; /* Number of programmable alarms. */ - int n_ext_ts; /* Number of external time stamp channels. */ - int n_per_out; /* Number of programmable periodic signals. */ - int pps; /* Whether the clock supports a PPS callback. */ - int rsv[15]; /* Reserved for future use. */ -}; - -struct ptp_extts_request { - unsigned int index; /* Which channel to configure. */ - unsigned int flags; /* Bit field for PTP_xxx flags. */ - unsigned int rsv[2]; /* Reserved for future use. */ -}; - -struct ptp_perout_request { - struct ptp_clock_time start; /* Absolute start time. */ - struct ptp_clock_time period; /* Desired period, zero means disable. */ - unsigned int index; /* Which channel to configure. */ - unsigned int flags; /* Reserved for future use. */ - unsigned int rsv[4]; /* Reserved for future use. */ -}; - -#define PTP_MAX_SAMPLES 25 /* Maximum allowed offset measurement samples. */ - -struct ptp_sys_offset { - unsigned int n_samples; /* Desired number of measurements. */ - unsigned int rsv[3]; /* Reserved for future use. */ - /* - * Array of interleaved system/phc time stamps. The kernel - * will provide 2*n_samples + 1 time stamps, with the last - * one as a system time stamp. - */ - struct ptp_clock_time ts[2 * PTP_MAX_SAMPLES + 1]; -}; - -#define PTP_CLK_MAGIC '=' - -#define PTP_CLOCK_GETCAPS _IOR(PTP_CLK_MAGIC, 1, struct ptp_clock_caps) -#define PTP_EXTTS_REQUEST _IOW(PTP_CLK_MAGIC, 2, struct ptp_extts_request) -#define PTP_PEROUT_REQUEST _IOW(PTP_CLK_MAGIC, 3, struct ptp_perout_request) -#define PTP_ENABLE_PPS _IOW(PTP_CLK_MAGIC, 4, int) -#define PTP_SYS_OFFSET _IOW(PTP_CLK_MAGIC, 5, struct ptp_sys_offset) - -struct ptp_extts_event { - struct ptp_clock_time t; /* Time event occurred. */ - unsigned int index; /* Which channel produced the event. */ - unsigned int flags; /* Reserved for future use. */ - unsigned int rsv[2]; /* Reserved for future use. */ -}; - -#endif diff --git a/linux/riscv/arch_defs_.h b/linux/riscv/arch_defs_.h new file mode 100644 index 00000000..33494f5d --- /dev/null +++ b/linux/riscv/arch_defs_.h @@ -0,0 +1,2 @@ +#define HAVE_ARCH_UID16_SYSCALLS 1 +#define SUPPORTED_PERSONALITIES 2 diff --git a/linux/riscv/syscallent.h b/linux/riscv/syscallent.h index 7c416ef1..3dfed89e 100644 --- a/linux/riscv/syscallent.h +++ b/linux/riscv/syscallent.h @@ -1 +1,4 @@ #include "64/syscallent.h" + +/* #define __NR_riscv_flush_icache (__NR_arch_specific_syscall + 15) */ +[259] = { 3, TM, SEN(riscv_flush_icache), "riscv_flush_icache" }, diff --git a/linux/s390/arch_defs_.h b/linux/s390/arch_defs_.h new file mode 100644 index 00000000..59fee837 --- /dev/null +++ b/linux/s390/arch_defs_.h @@ -0,0 +1,3 @@ +#define HAVE_ARCH_OLD_MMAP 1 +#define HAVE_ARCH_OLD_MMAP_PGOFF 1 +#define HAVE_ARCH_UID16_SYSCALLS 1 diff --git a/linux/s390/arch_sigreturn.c b/linux/s390/arch_sigreturn.c index d1b85986..9c9e0ddf 100644 --- a/linux/s390/arch_sigreturn.c +++ b/linux/s390/arch_sigreturn.c @@ -1,11 +1,21 @@ +#ifndef S390_FRAME_PTR +# define S390_FRAME_PTR s390_frame_ptr +#endif +#ifndef SIGNAL_FRAMESIZE +# define SIGNAL_FRAMESIZE __SIGNAL_FRAMESIZE +#endif +#ifndef PTR_TYPE +# define PTR_TYPE unsigned long +#endif + static void arch_sigreturn(struct tcb *tcp) { - unsigned long mask[NSIG_BYTES / sizeof(long)]; - const unsigned long addr = *s390_frame_ptr + __SIGNAL_FRAMESIZE; + PTR_TYPE mask[NSIG_BYTES / sizeof(PTR_TYPE)]; + const PTR_TYPE addr = *S390_FRAME_PTR + SIGNAL_FRAMESIZE; if (umove(tcp, addr, &mask) < 0) { - tprintf("{mask=%#lx}", addr); + tprintf("{mask=%#llx}", zero_extend_signed_to_ull(addr)); } else { tprintsigmask_addr("{mask=", mask); tprints("}"); diff --git a/linux/s390/get_error.c b/linux/s390/get_error.c index 6d4d0a5e..6f3925be 100644 --- a/linux/s390/get_error.c +++ b/linux/s390/get_error.c @@ -1,12 +1,16 @@ #include "negated_errno.h" +#ifndef ARCH_REGSET +# define ARCH_REGSET s390_regset +#endif + static void get_error(struct tcb *tcp, const bool check_errno) { - if (check_errno && is_negated_errno(s390_regset.gprs[2])) { + if (check_errno && is_negated_errno(ARCH_REGSET.gprs[2])) { tcp->u_rval = -1; - tcp->u_error = -s390_regset.gprs[2]; + tcp->u_error = -ARCH_REGSET.gprs[2]; } else { - tcp->u_rval = s390_regset.gprs[2]; + tcp->u_rval = ARCH_REGSET.gprs[2]; } } diff --git a/linux/s390/get_scno.c b/linux/s390/get_scno.c index d323860d..2661795d 100644 --- a/linux/s390/get_scno.c +++ b/linux/s390/get_scno.c @@ -1,8 +1,12 @@ +#ifndef ARCH_REGSET +# define ARCH_REGSET s390_regset +#endif + /* Return codes: 1 - ok, 0 - ignore, other - error. */ static int arch_get_scno(struct tcb *tcp) { - tcp->scno = s390_regset.gprs[2] ? - s390_regset.gprs[2] : s390_regset.gprs[1]; + tcp->scno = ARCH_REGSET.gprs[2] ? + ARCH_REGSET.gprs[2] : ARCH_REGSET.gprs[1]; return 1; } diff --git a/linux/s390/get_syscall_args.c b/linux/s390/get_syscall_args.c index ebf6c6c4..2c353807 100644 --- a/linux/s390/get_syscall_args.c +++ b/linux/s390/get_syscall_args.c @@ -1,12 +1,16 @@ +#ifndef ARCH_REGSET +# define ARCH_REGSET s390_regset +#endif + /* Return -1 on error or 1 on success (never 0!). */ static int get_syscall_args(struct tcb *tcp) { - tcp->u_arg[0] = s390_regset.orig_gpr2; - tcp->u_arg[1] = s390_regset.gprs[3]; - tcp->u_arg[2] = s390_regset.gprs[4]; - tcp->u_arg[3] = s390_regset.gprs[5]; - tcp->u_arg[4] = s390_regset.gprs[6]; - tcp->u_arg[5] = s390_regset.gprs[7]; + tcp->u_arg[0] = ARCH_REGSET.orig_gpr2; + tcp->u_arg[1] = ARCH_REGSET.gprs[3]; + tcp->u_arg[2] = ARCH_REGSET.gprs[4]; + tcp->u_arg[3] = ARCH_REGSET.gprs[5]; + tcp->u_arg[4] = ARCH_REGSET.gprs[6]; + tcp->u_arg[5] = ARCH_REGSET.gprs[7]; return 1; } diff --git a/linux/s390/set_error.c b/linux/s390/set_error.c index 7262e5ce..f73e5780 100644 --- a/linux/s390/set_error.c +++ b/linux/s390/set_error.c @@ -1,13 +1,17 @@ +#ifndef ARCH_REGSET +# define ARCH_REGSET s390_regset +#endif + static int arch_set_error(struct tcb *tcp) { - s390_regset.gprs[2] = -tcp->u_error; + ARCH_REGSET.gprs[2] = -tcp->u_error; return set_regs(tcp->pid); } static int arch_set_success(struct tcb *tcp) { - s390_regset.gprs[2] = tcp->u_rval; + ARCH_REGSET.gprs[2] = tcp->u_rval; return set_regs(tcp->pid); } diff --git a/linux/s390/set_scno.c b/linux/s390/set_scno.c index c7a31100..6bb99993 100644 --- a/linux/s390/set_scno.c +++ b/linux/s390/set_scno.c @@ -1,6 +1,10 @@ +#ifndef ARCH_REGSET +# define ARCH_REGSET s390_regset +#endif + static int arch_set_scno(struct tcb *tcp, kernel_ulong_t scno) { - s390_regset.gprs[2] = scno; + ARCH_REGSET.gprs[2] = scno; return set_regs(tcp->pid); } diff --git a/linux/s390/syscallent.h b/linux/s390/syscallent.h index 2bf5a212..b7e768e0 100644 --- a/linux/s390/syscallent.h +++ b/linux/s390/syscallent.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2000 IBM Deutschland Entwicklung GmbH, IBM Coporation - * Copyright (c) 2000-2017 The strace developers. + * Copyright (c) 2000-2018 The strace developers. * Authors: Ulrich Weigand <Ulrich.Weigand@de.ibm.com> * D.J. Barrow <barrow_dj@mail.yahoo.com,djbarrow@de.ibm.com> * All rights reserved. @@ -49,11 +49,11 @@ [ 17] = { }, [ 18] = { }, [ 19] = { 3, TD, SEN(lseek), "lseek" }, -[ 20] = { 0, NF, SEN(getpid), "getpid" }, +[ 20] = { 0, PU|NF, SEN(getpid), "getpid" }, [ 21] = { 5, TF, SEN(mount), "mount" }, [ 22] = { 1, TF, SEN(umount), "umount" }, [ 23] = { 1, 0, SEN(setuid16), "setuid" }, -[ 24] = { 0, NF, SEN(getuid16), "getuid" }, +[ 24] = { 0, PU|NF, SEN(getuid16), "getuid" }, [ 25] = { 1, 0, SEN(stime), "stime" }, [ 26] = { 4, 0, SEN(ptrace), "ptrace" }, [ 27] = { 1, 0, SEN(alarm), "alarm" }, @@ -76,10 +76,10 @@ [ 44] = { }, [ 45] = { 1, TM|SI, SEN(brk), "brk" }, [ 46] = { 1, 0, SEN(setgid16), "setgid" }, -[ 47] = { 0, NF, SEN(getgid16), "getgid" }, +[ 47] = { 0, PU|NF, SEN(getgid16), "getgid" }, [ 48] = { 2, TS, SEN(signal), "signal" }, -[ 49] = { 0, NF, SEN(geteuid16), "geteuid" }, -[ 50] = { 0, NF, SEN(getegid16), "getegid" }, +[ 49] = { 0, PU|NF, SEN(geteuid16), "geteuid" }, +[ 50] = { 0, PU|NF, SEN(getegid16), "getegid" }, [ 51] = { 1, TF, SEN(acct), "acct" }, [ 52] = { 2, TF, SEN(umount2), "umount2" }, [ 53] = { }, @@ -93,8 +93,8 @@ [ 61] = { 1, TF, SEN(chroot), "chroot" }, [ 62] = { 2, TSFA, SEN(ustat), "ustat" }, [ 63] = { 2, TD, SEN(dup2), "dup2" }, -[ 64] = { 0, NF, SEN(getppid), "getppid" }, -[ 65] = { 0, 0, SEN(getpgrp), "getpgrp" }, +[ 64] = { 0, PU|NF, SEN(getppid), "getppid" }, +[ 65] = { 0, PU|NF, SEN(getpgrp), "getpgrp" }, [ 66] = { 0, 0, SEN(setsid), "setsid" }, [ 67] = { 3, TS, SEN(sigaction), "sigaction" }, [ 68] = { }, @@ -228,10 +228,10 @@ [196] = { 2, TF|TLST|TSTA, SEN(lstat64), "lstat64" }, [197] = { 2, TD|TFST|TSTA, SEN(fstat64), "fstat64" }, [198] = { 3, TF, SEN(chown), "lchown32" }, -[199] = { 0, NF, SEN(getuid), "getuid32" }, -[200] = { 0, NF, SEN(getgid), "getgid32" }, -[201] = { 0, NF, SEN(geteuid), "geteuid32" }, -[202] = { 0, NF, SEN(getegid), "getegid32" }, +[199] = { 0, PU|NF, SEN(getuid), "getuid32" }, +[200] = { 0, PU|NF, SEN(getgid), "getgid32" }, +[201] = { 0, PU|NF, SEN(geteuid), "geteuid32" }, +[202] = { 0, PU|NF, SEN(getegid), "getegid32" }, [203] = { 2, 0, SEN(setreuid), "setreuid32" }, [204] = { 2, 0, SEN(setregid), "setregid32" }, [205] = { 2, 0, SEN(getgroups), "getgroups32" }, @@ -265,7 +265,7 @@ [233] = { 2, TF, SEN(removexattr), "removexattr" }, [234] = { 2, TF, SEN(removexattr), "lremovexattr" }, [235] = { 2, TD, SEN(fremovexattr), "fremovexattr" }, -[236] = { 0, NF, SEN(gettid), "gettid" }, +[236] = { 0, PU|NF, SEN(gettid), "gettid" }, [237] = { 2, TS, SEN(kill), "tkill" }, [238] = { 6, 0, SEN(futex), "futex" }, [239] = { 3, 0, SEN(sched_setaffinity), "sched_setaffinity" }, @@ -300,12 +300,12 @@ [268] = { 6, TM, SEN(mbind), "mbind" }, [269] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" }, [270] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" }, -[271] = { 4, 0, SEN(mq_open), "mq_open" }, +[271] = { 4, TD, SEN(mq_open), "mq_open" }, [272] = { 1, 0, SEN(mq_unlink), "mq_unlink" }, -[273] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" }, -[274] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" }, -[275] = { 2, 0, SEN(mq_notify), "mq_notify" }, -[276] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" }, +[273] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" }, +[274] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" }, +[275] = { 2, TD, SEN(mq_notify), "mq_notify" }, +[276] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" }, [277] = { 4, 0, SEN(kexec_load), "kexec_load" }, [278] = { 5, 0, SEN(add_key), "add_key" }, [279] = { 4, 0, SEN(request_key), "request_key" }, @@ -371,7 +371,7 @@ [339] = { 2, TD, SEN(setns), "setns" }, [340] = { 6, 0, SEN(process_vm_readv), "process_vm_readv" }, [341] = { 6, 0, SEN(process_vm_writev), "process_vm_writev" }, -[342] = { 2, 0, SEN(printargs), "s390_runtime_instr" }, +[342] = { 2, 0, SEN(s390_runtime_instr), "s390_runtime_instr" }, [343] = { 5, 0, SEN(kcmp), "kcmp" }, [344] = { 3, TD, SEN(finit_module), "finit_module" }, [345] = { 3, 0, SEN(sched_setattr), "sched_setattr" }, @@ -381,8 +381,8 @@ [349] = { 3, 0, SEN(getrandom), "getrandom" }, [350] = { 2, TD, SEN(memfd_create), "memfd_create" }, [351] = { 3, TD, SEN(bpf), "bpf" }, -[352] = { 3, 0, SEN(printargs), "s390_pci_mmio_write" }, -[353] = { 3, 0, SEN(printargs), "s390_pci_mmio_read" }, +[352] = { 3, 0, SEN(s390_pci_mmio_write), "s390_pci_mmio_write" }, +[353] = { 3, 0, SEN(s390_pci_mmio_read), "s390_pci_mmio_read" }, [354] = { 5, TD|TF|TP|SE|SI, SEN(execveat), "execveat" }, [355] = { 1, TD, SEN(userfaultfd), "userfaultfd" }, [356] = { 2, 0, SEN(membarrier), "membarrier" }, @@ -407,8 +407,9 @@ [375] = { 6, TD, SEN(copy_file_range), "copy_file_range" }, [376] = { 6, TD, SEN(preadv2), "preadv2" }, [377] = { 6, TD, SEN(pwritev2), "pwritev2" }, -[378] = { 2, 0, SEN(printargs), "s390_guarded_storage" }, +[378] = { 2, 0, SEN(s390_guarded_storage), "s390_guarded_storage" }, [379] = { 5, TD|TF|TSTA, SEN(statx), "statx" }, +[380] = { 4, 0, SEN(s390_sthyi), "s390_sthyi" }, #define SYS_socket_subcall 400 #include "subcall.h" diff --git a/linux/s390x/arch_defs_.h b/linux/s390x/arch_defs_.h new file mode 100644 index 00000000..bed2f2d6 --- /dev/null +++ b/linux/s390x/arch_defs_.h @@ -0,0 +1,4 @@ +#define HAVE_ARCH_OLD_MMAP 1 +#define HAVE_ARCH_OLD_MMAP_PGOFF 1 +#define HAVE_ARCH_UID16_SYSCALLS 1 +#define SUPPORTED_PERSONALITIES 2 diff --git a/linux/s390x/arch_regs.c b/linux/s390x/arch_regs.c index 62aece72..b5efde76 100644 --- a/linux/s390x/arch_regs.c +++ b/linux/s390x/arch_regs.c @@ -1 +1,36 @@ -#include "s390/arch_regs.c" +typedef struct { + uint32_t mask; + uint32_t addr; +} ATTRIBUTE_ALIGNED(8) psw_compat_t; + +typedef struct { + psw_compat_t psw; + uint32_t gprs[NUM_GPRS]; + uint32_t acrs[NUM_ACRS]; + uint32_t orig_gpr2; +} s390_compat_regs; + +static union { + s390_compat_regs s390_regs; + s390_regs s390x_regs; +} s390x_regs_union; + +#define s390_regset s390x_regs_union.s390_regs +#define s390x_regset s390x_regs_union.s390x_regs + +uint32_t *const s390_frame_ptr = &s390_regset.gprs[15]; +unsigned long *const s390x_frame_ptr = &s390x_regset.gprs[15]; + +static struct iovec s390x_io = { + .iov_base = &s390x_regs_union, +}; + + +#define ARCH_REGS_FOR_GETREGSET s390x_regs_union +#define ARCH_IOVEC_FOR_GETREGSET s390x_io +#define ARCH_PC_REG \ + (s390x_io.iov_len == sizeof(s390_regset) ? \ + s390_regset.psw.addr : s390x_regset.psw.addr) + +#define ARCH_PERSONALITY_0_IOV_SIZE sizeof(s390x_regset) +#define ARCH_PERSONALITY_1_IOV_SIZE sizeof(s390_regset) diff --git a/linux/s390x/arch_regs.h b/linux/s390x/arch_regs.h index 14fced4e..1f8b57a1 100644 --- a/linux/s390x/arch_regs.h +++ b/linux/s390x/arch_regs.h @@ -1 +1,2 @@ -#include "s390/arch_regs.h" +extern uint32_t *const s390_frame_ptr; +extern unsigned long *const s390x_frame_ptr; diff --git a/linux/s390x/arch_rt_sigframe.c b/linux/s390x/arch_rt_sigframe.c index 9731c0e7..9c0255f8 100644 --- a/linux/s390x/arch_rt_sigframe.c +++ b/linux/s390x/arch_rt_sigframe.c @@ -1 +1,4 @@ -#include "s390/arch_rt_sigframe.c" +FUNC_GET_RT_SIGFRAME_ADDR +{ + return tcp->currpers == 1 ? *s390_frame_ptr : *s390x_frame_ptr; +} diff --git a/linux/s390x/arch_sigreturn.c b/linux/s390x/arch_sigreturn.c index 679a3952..edc9edd5 100644 --- a/linux/s390x/arch_sigreturn.c +++ b/linux/s390x/arch_sigreturn.c @@ -1 +1,27 @@ +#include <stdint.h> + +#define S390_SIGNAL_FRAMESIZE 96 + +#define SIGNAL_FRAMESIZE S390_SIGNAL_FRAMESIZE +#define PTR_TYPE uint32_t +#define S390_FRAME_PTR s390_frame_ptr +#define arch_sigreturn s390_arch_sigreturn #include "s390/arch_sigreturn.c" +#undef arch_sigreturn +#undef S390_FRAME_PTR +#undef PTR_TYPE +#undef SIGNAL_FRAMESIZE + +#define S390_FRAME_PTR s390x_frame_ptr +#define arch_sigreturn s390x_arch_sigreturn +#include "s390/arch_sigreturn.c" +#undef arch_sigreturn + +static void +arch_sigreturn(struct tcb *tcp) +{ + if (tcp->currpers == 1) + s390_arch_sigreturn(tcp); + else + s390x_arch_sigreturn(tcp); +} diff --git a/linux/s390x/errnoent1.h b/linux/s390x/errnoent1.h new file mode 100644 index 00000000..c0f7787d --- /dev/null +++ b/linux/s390x/errnoent1.h @@ -0,0 +1 @@ +#include "errnoent.h" diff --git a/linux/s390x/get_error.c b/linux/s390x/get_error.c index 8e3944c2..fe503f46 100644 --- a/linux/s390x/get_error.c +++ b/linux/s390x/get_error.c @@ -1 +1,22 @@ -#include "s390/get_error.c" +#include "negated_errno.h" + +#define get_error s390_get_error +#define ARCH_REGSET s390_regset +#include "../s390/get_error.c" +#undef ARCH_REGSET +#undef get_error + +#define get_error s390x_get_error +#define ARCH_REGSET s390x_regset +#include "../s390/get_error.c" +#undef ARCH_REGSET +#undef get_error + +static void +get_error(struct tcb *tcp, const bool check_errno) +{ + if (tcp->currpers == 1) + s390_get_error(tcp, check_errno); + else + s390x_get_error(tcp, check_errno); +} diff --git a/linux/s390x/get_scno.c b/linux/s390x/get_scno.c index 71816fbd..bf81b94c 100644 --- a/linux/s390x/get_scno.c +++ b/linux/s390x/get_scno.c @@ -1 +1,20 @@ -#include "s390/get_scno.c" +#define arch_get_scno s390_get_scno +#define ARCH_REGSET s390_regset +#include "../s390/get_scno.c" +#undef ARCH_REGSET +#undef arch_get_scno + +#define arch_get_scno s390x_get_scno +#define ARCH_REGSET s390x_regset +#include "../s390/get_scno.c" +#undef ARCH_REGSET +#undef arch_get_scno + +static int +arch_get_scno(struct tcb *tcp) +{ + if (s390x_io.iov_len == sizeof(s390_regset)) + return s390_get_scno(tcp); + else + return s390x_get_scno(tcp); +} diff --git a/linux/s390x/get_syscall_args.c b/linux/s390x/get_syscall_args.c index 4ded41d4..bed3d68f 100644 --- a/linux/s390x/get_syscall_args.c +++ b/linux/s390x/get_syscall_args.c @@ -1 +1,21 @@ -#include "s390/get_syscall_args.c" +#define get_syscall_args s390_get_syscall_args +#define ARCH_REGSET s390_regset +#include "../s390/get_syscall_args.c" +#undef ARCH_REGSET +#undef get_syscall_args + +#define get_syscall_args s390x_get_syscall_args +#define ARCH_REGSET s390x_regset +#include "../s390/get_syscall_args.c" +#undef ARCH_REGSET +#undef get_syscall_args + +/* Return -1 on error or 1 on success (never 0!). */ +static int +get_syscall_args(struct tcb *tcp) +{ + if (tcp->currpers == 1) + return s390_get_syscall_args(tcp); + else + return s390x_get_syscall_args(tcp); +} diff --git a/linux/s390x/ioctls_arch1.h b/linux/s390x/ioctls_arch1.h new file mode 100644 index 00000000..4a16cb5c --- /dev/null +++ b/linux/s390x/ioctls_arch1.h @@ -0,0 +1 @@ +#include "s390/ioctls_arch0.h" diff --git a/linux/s390x/ioctls_inc1.h b/linux/s390x/ioctls_inc1.h new file mode 100644 index 00000000..e09b6c6d --- /dev/null +++ b/linux/s390x/ioctls_inc1.h @@ -0,0 +1 @@ +#include "s390/ioctls_inc0.h" diff --git a/linux/s390x/set_error.c b/linux/s390x/set_error.c index 737ddef7..4a80ac27 100644 --- a/linux/s390x/set_error.c +++ b/linux/s390x/set_error.c @@ -1 +1,33 @@ -#include "s390/set_error.c" +#define arch_set_error s390_set_error +#define arch_set_success s390_set_success +#define ARCH_REGSET s390_regset +#include "../s390/set_error.c" +#undef ARCH_REGSET +#undef arch_set_success +#undef arch_set_error + +#define arch_set_error s390x_set_error +#define arch_set_success s390x_set_success +#define ARCH_REGSET s390x_regset +#include "../s390/set_error.c" +#undef ARCH_REGSET +#undef arch_set_success +#undef arch_set_error + +static int +arch_set_error(struct tcb *tcp) +{ + if (tcp->currpers == 1) + return s390_set_error(tcp); + else + return s390x_set_error(tcp); +} + +static int +arch_set_success(struct tcb *tcp) +{ + if (tcp->currpers == 1) + return s390_set_success(tcp); + else + return s390x_set_success(tcp); +} diff --git a/linux/s390x/set_scno.c b/linux/s390x/set_scno.c index 9cea4d10..2b4d16e8 100644 --- a/linux/s390x/set_scno.c +++ b/linux/s390x/set_scno.c @@ -1 +1,20 @@ -#include "s390/set_scno.c" +#define arch_set_scno s390_set_scno +#define ARCH_REGSET s390_regset +#include "../s390/set_scno.c" +#undef ARCH_REGSET +#undef arch_set_scno + +#define arch_set_scno s390x_set_scno +#define ARCH_REGSET s390x_regset +#include "../s390/set_scno.c" +#undef ARCH_REGSET +#undef arch_set_scno + +static int +arch_set_scno(struct tcb *tcp, kernel_ulong_t scno) +{ + if (tcp->currpers == 1) + return s390_set_scno(tcp, scno); + else + return s390x_set_scno(tcp, scno); +} diff --git a/linux/s390x/signalent1.h b/linux/s390x/signalent1.h new file mode 100644 index 00000000..093cba7f --- /dev/null +++ b/linux/s390x/signalent1.h @@ -0,0 +1 @@ +#include "signalent.h" diff --git a/linux/s390x/syscallent.h b/linux/s390x/syscallent.h index 3b662b4c..d16ee94f 100644 --- a/linux/s390x/syscallent.h +++ b/linux/s390x/syscallent.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2000 IBM Deutschland Entwicklung GmbH, IBM Coporation - * Copyright (c) 2000-2017 The strace developers. + * Copyright (c) 2000-2018 The strace developers. * Author: Ulrich Weigand <Ulrich.Weigand@de.ibm.com> * All rights reserved. * @@ -48,7 +48,7 @@ [ 17] = { }, [ 18] = { }, [ 19] = { 3, TD, SEN(lseek), "lseek" }, -[ 20] = { 0, NF, SEN(getpid), "getpid" }, +[ 20] = { 0, PU|NF, SEN(getpid), "getpid" }, [ 21] = { 5, TF, SEN(mount), "mount" }, [ 22] = { 1, TF, SEN(umount), "umount" }, [ 23] = { }, @@ -92,8 +92,8 @@ [ 61] = { 1, TF, SEN(chroot), "chroot" }, [ 62] = { 2, TSFA, SEN(ustat), "ustat" }, [ 63] = { 2, TD, SEN(dup2), "dup2" }, -[ 64] = { 0, NF, SEN(getppid), "getppid" }, -[ 65] = { 0, 0, SEN(getpgrp), "getpgrp" }, +[ 64] = { 0, PU|NF, SEN(getppid), "getppid" }, +[ 65] = { 0, PU|NF, SEN(getpgrp), "getpgrp" }, [ 66] = { 0, 0, SEN(setsid), "setsid" }, [ 67] = { 3, TS, SEN(sigaction), "sigaction" }, [ 68 ... 71] = { }, @@ -212,10 +212,10 @@ [191] = { 2, 0, SEN(getrlimit), "getrlimit" }, [196 ... 197] = { }, [198] = { 3, TF, SEN(chown), "lchown" }, -[199] = { 0, NF, SEN(getuid), "getuid" }, -[200] = { 0, NF, SEN(getgid), "getgid" }, -[201] = { 0, NF, SEN(geteuid), "geteuid" }, -[202] = { 0, NF, SEN(getegid), "getegid" }, +[199] = { 0, PU|NF, SEN(getuid), "getuid" }, +[200] = { 0, PU|NF, SEN(getgid), "getgid" }, +[201] = { 0, PU|NF, SEN(geteuid), "geteuid" }, +[202] = { 0, PU|NF, SEN(getegid), "getegid" }, [203] = { 2, 0, SEN(setreuid), "setreuid" }, [204] = { 2, 0, SEN(setregid), "setregid" }, [205] = { 2, 0, SEN(getgroups), "getgroups" }, @@ -249,7 +249,7 @@ [233] = { 2, TF, SEN(removexattr), "removexattr" }, [234] = { 2, TF, SEN(removexattr), "lremovexattr" }, [235] = { 2, TD, SEN(fremovexattr), "fremovexattr" }, -[236] = { 0, NF, SEN(gettid), "gettid" }, +[236] = { 0, PU|NF, SEN(gettid), "gettid" }, [237] = { 2, TS, SEN(kill), "tkill" }, [238] = { 6, 0, SEN(futex), "futex" }, [239] = { 3, 0, SEN(sched_setaffinity), "sched_setaffinity" }, @@ -284,12 +284,12 @@ [268] = { 6, TM, SEN(mbind), "mbind" }, [269] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" }, [270] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" }, -[271] = { 4, 0, SEN(mq_open), "mq_open" }, +[271] = { 4, TD, SEN(mq_open), "mq_open" }, [272] = { 1, 0, SEN(mq_unlink), "mq_unlink" }, -[273] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" }, -[274] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" }, -[275] = { 2, 0, SEN(mq_notify), "mq_notify" }, -[276] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" }, +[273] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" }, +[274] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" }, +[275] = { 2, TD, SEN(mq_notify), "mq_notify" }, +[276] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" }, [277] = { 4, 0, SEN(kexec_load), "kexec_load" }, [278] = { 5, 0, SEN(add_key), "add_key" }, [279] = { 4, 0, SEN(request_key), "request_key" }, @@ -355,7 +355,7 @@ [339] = { 2, TD, SEN(setns), "setns" }, [340] = { 6, 0, SEN(process_vm_readv), "process_vm_readv" }, [341] = { 6, 0, SEN(process_vm_writev), "process_vm_writev" }, -[342] = { 2, 0, SEN(printargs), "s390_runtime_instr" }, +[342] = { 2, 0, SEN(s390_runtime_instr), "s390_runtime_instr" }, [343] = { 5, 0, SEN(kcmp), "kcmp" }, [344] = { 3, TD, SEN(finit_module), "finit_module" }, [345] = { 3, 0, SEN(sched_setattr), "sched_setattr" }, @@ -365,8 +365,8 @@ [349] = { 3, 0, SEN(getrandom), "getrandom" }, [350] = { 2, TD, SEN(memfd_create), "memfd_create" }, [351] = { 3, TD, SEN(bpf), "bpf" }, -[352] = { 3, 0, SEN(printargs), "s390_pci_mmio_write" }, -[353] = { 3, 0, SEN(printargs), "s390_pci_mmio_read" }, +[352] = { 3, 0, SEN(s390_pci_mmio_write), "s390_pci_mmio_write" }, +[353] = { 3, 0, SEN(s390_pci_mmio_read), "s390_pci_mmio_read" }, [354] = { 5, TD|TF|TP|SE|SI, SEN(execveat), "execveat" }, [355] = { 1, TD, SEN(userfaultfd), "userfaultfd" }, [356] = { 2, 0, SEN(membarrier), "membarrier" }, @@ -391,8 +391,9 @@ [375] = { 6, TD, SEN(copy_file_range), "copy_file_range" }, [376] = { 6, TD, SEN(preadv2), "preadv2" }, [377] = { 6, TD, SEN(pwritev2), "pwritev2" }, -[378] = { 2, 0, SEN(printargs), "s390_guarded_storage" }, +[378] = { 2, 0, SEN(s390_guarded_storage), "s390_guarded_storage" }, [379] = { 5, TD|TF|TSTA, SEN(statx), "statx" }, +[380] = { 4, 0, SEN(s390_sthyi), "s390_sthyi" }, #define SYS_socket_subcall 400 #include "subcall.h" diff --git a/linux/s390x/syscallent1.h b/linux/s390x/syscallent1.h new file mode 100644 index 00000000..6b7a4b3c --- /dev/null +++ b/linux/s390x/syscallent1.h @@ -0,0 +1 @@ +#include "s390/syscallent.h" diff --git a/linux/sh/arch_defs_.h b/linux/sh/arch_defs_.h new file mode 100644 index 00000000..b4d39f0a --- /dev/null +++ b/linux/sh/arch_defs_.h @@ -0,0 +1,3 @@ +#define HAVE_ARCH_GETRVAL2 1 +#define HAVE_ARCH_OLD_SELECT 1 +#define HAVE_ARCH_UID16_SYSCALLS 1 diff --git a/linux/sh/arch_getrval2.c b/linux/sh/arch_getrval2.c index 27b7cdd0..c0067319 100644 --- a/linux/sh/arch_getrval2.c +++ b/linux/sh/arch_getrval2.c @@ -2,7 +2,7 @@ long getrval2(struct tcb *tcp) { unsigned long val; - if (upeek(tcp->pid, 4*(REG_REG0+1), &val) < 0) + if (upeek(tcp, 4*(REG_REG0+1), &val) < 0) return -1; return val; } diff --git a/linux/sh/arch_rt_sigframe.c b/linux/sh/arch_rt_sigframe.c index ae16e3f5..3c4f6f2b 100644 --- a/linux/sh/arch_rt_sigframe.c +++ b/linux/sh/arch_rt_sigframe.c @@ -29,5 +29,5 @@ FUNC_GET_RT_SIGFRAME_ADDR { unsigned long addr; - return upeek(tcp->pid, sizeof(long) * 15, &addr) ? 0 : addr; + return upeek(tcp, sizeof(long) * 15, &addr) ? 0 : addr; } diff --git a/linux/sh/get_scno.c b/linux/sh/get_scno.c index 45fc0b7b..e89520de 100644 --- a/linux/sh/get_scno.c +++ b/linux/sh/get_scno.c @@ -7,7 +7,7 @@ arch_get_scno(struct tcb *tcp) /* * In the new syscall ABI, the system call number is in R3. */ - if (upeek(tcp->pid, 4*(REG_REG0+3), &scno) < 0) + if (upeek(tcp, 4*(REG_REG0+3), &scno) < 0) return -1; if ((long) scno < 0) { diff --git a/linux/sh/get_syscall_args.c b/linux/sh/get_syscall_args.c index 0b6c8819..b4ee1dd3 100644 --- a/linux/sh/get_syscall_args.c +++ b/linux/sh/get_syscall_args.c @@ -13,7 +13,7 @@ get_syscall_args(struct tcb *tcp) unsigned int i; for (i = 0; i < tcp->s_ent->nargs; ++i) - if (upeek(tcp->pid, syscall_regs[i], &tcp->u_arg[i]) < 0) + if (upeek(tcp, syscall_regs[i], &tcp->u_arg[i]) < 0) return -1; return 1; } diff --git a/linux/sh/get_syscall_result.c b/linux/sh/get_syscall_result.c index f7b93b74..ff07a986 100644 --- a/linux/sh/get_syscall_result.c +++ b/linux/sh/get_syscall_result.c @@ -2,5 +2,5 @@ static int get_syscall_result_regs(struct tcb *tcp) { /* new syscall ABI returns result in R0 */ - return upeek(tcp->pid, 4 * REG_REG0, &sh_r0) < 0 ? -1 : 0; + return upeek(tcp, 4 * REG_REG0, &sh_r0) < 0 ? -1 : 0; } diff --git a/linux/sh/set_error.c b/linux/sh/set_error.c index cb093b64..bad76ede 100644 --- a/linux/sh/set_error.c +++ b/linux/sh/set_error.c @@ -2,12 +2,12 @@ static int arch_set_error(struct tcb *tcp) { sh_r0 = -tcp->u_error; - return upoke(tcp->pid, 4 * REG_REG0, sh_r0); + return upoke(tcp, 4 * REG_REG0, sh_r0); } static int arch_set_success(struct tcb *tcp) { sh_r0 = tcp->u_rval; - return upoke(tcp->pid, 4 * REG_REG0, sh_r0); + return upoke(tcp, 4 * REG_REG0, sh_r0); } diff --git a/linux/sh/set_scno.c b/linux/sh/set_scno.c index 5f71664a..4c175ed7 100644 --- a/linux/sh/set_scno.c +++ b/linux/sh/set_scno.c @@ -1,5 +1,5 @@ static int arch_set_scno(struct tcb *tcp, kernel_ulong_t scno) { - return upoke(tcp->pid, 4 * (REG_REG0 + 3), scno); + return upoke(tcp, 4 * (REG_REG0 + 3), scno); } diff --git a/linux/sh/syscallent.h b/linux/sh/syscallent.h index 74c07e1e..c40b3352 100644 --- a/linux/sh/syscallent.h +++ b/linux/sh/syscallent.h @@ -3,7 +3,7 @@ * Copyright (c) 1993, 1994, 1995 Rick Sladkey <jrs@world.std.com> * Copyright (c) 2000 PocketPenguins Inc. Linux for Hitachi SuperH * port by Greg Banks <gbanks@pocketpenguins.com> - * Copyright (c) 2000-2017 The strace developers. + * Copyright (c) 2000-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,11 +49,11 @@ [ 17] = { 0, TM, SEN(break), "break" }, [ 18] = { 2, TF|TST|TSTA, SEN(oldstat), "oldstat" }, [ 19] = { 3, TD, SEN(lseek), "lseek" }, -[ 20] = { 0, NF, SEN(getpid), "getpid" }, +[ 20] = { 0, PU|NF, SEN(getpid), "getpid" }, [ 21] = { 5, TF, SEN(mount), "mount" }, [ 22] = { 1, TF, SEN(umount), "umount" }, [ 23] = { 1, 0, SEN(setuid16), "setuid" }, -[ 24] = { 0, NF, SEN(getuid16), "getuid" }, +[ 24] = { 0, PU|NF, SEN(getuid16), "getuid" }, [ 25] = { 1, 0, SEN(stime), "stime" }, [ 26] = { 4, 0, SEN(ptrace), "ptrace" }, [ 27] = { 1, 0, SEN(alarm), "alarm" }, @@ -76,10 +76,10 @@ [ 44] = { 0, 0, SEN(prof), "prof" }, [ 45] = { 1, TM|SI, SEN(brk), "brk" }, [ 46] = { 1, 0, SEN(setgid16), "setgid" }, -[ 47] = { 0, NF, SEN(getgid16), "getgid" }, +[ 47] = { 0, PU|NF, SEN(getgid16), "getgid" }, [ 48] = { 2, TS, SEN(signal), "signal" }, -[ 49] = { 0, NF, SEN(geteuid16), "geteuid" }, -[ 50] = { 0, NF, SEN(getegid16), "getegid" }, +[ 49] = { 0, PU|NF, SEN(geteuid16), "geteuid" }, +[ 50] = { 0, PU|NF, SEN(getegid16), "getegid" }, [ 51] = { 1, TF, SEN(acct), "acct" }, [ 52] = { 2, TF, SEN(umount2), "umount2" }, [ 53] = { 0, 0, SEN(lock), "lock" }, @@ -93,8 +93,8 @@ [ 61] = { 1, TF, SEN(chroot), "chroot" }, [ 62] = { 2, TSFA, SEN(ustat), "ustat" }, [ 63] = { 2, TD, SEN(dup2), "dup2" }, -[ 64] = { 0, NF, SEN(getppid), "getppid" }, -[ 65] = { 0, 0, SEN(getpgrp), "getpgrp" }, +[ 64] = { 0, PU|NF, SEN(getppid), "getppid" }, +[ 65] = { 0, PU|NF, SEN(getpgrp), "getpgrp" }, [ 66] = { 0, 0, SEN(setsid), "setsid" }, [ 67] = { 3, TS, SEN(sigaction), "sigaction" }, [ 68] = { 0, TS, SEN(sgetmask), "sgetmask" }, @@ -227,10 +227,10 @@ [196] = { 2, TF|TLST|TSTA, SEN(lstat64), "lstat64" }, [197] = { 2, TD|TFST|TSTA, SEN(fstat64), "fstat64" }, [198] = { 3, TF, SEN(chown), "lchown32" }, -[199] = { 0, NF, SEN(getuid), "getuid32" }, -[200] = { 0, NF, SEN(getgid), "getgid32" }, -[201] = { 0, NF, SEN(geteuid), "geteuid32" }, -[202] = { 0, NF, SEN(getegid), "getegid32" }, +[199] = { 0, PU|NF, SEN(getuid), "getuid32" }, +[200] = { 0, PU|NF, SEN(getgid), "getgid32" }, +[201] = { 0, PU|NF, SEN(geteuid), "geteuid32" }, +[202] = { 0, PU|NF, SEN(getegid), "getegid32" }, [203] = { 2, 0, SEN(setreuid), "setreuid32" }, [204] = { 2, 0, SEN(setregid), "setregid32" }, [205] = { 2, 0, SEN(getgroups), "getgroups32" }, @@ -251,7 +251,7 @@ [220] = { 3, TD, SEN(getdents64), "getdents64" }, [221] = { 3, TD, SEN(fcntl64), "fcntl64" }, [222 ... 223] = { }, -[224] = { 0, NF, SEN(gettid), "gettid" }, +[224] = { 0, PU|NF, SEN(gettid), "gettid" }, [225] = { 4, TD, SEN(readahead), "readahead" }, [226] = { 5, TF, SEN(setxattr), "setxattr" }, [227] = { 5, TF, SEN(setxattr), "lsetxattr" }, @@ -303,12 +303,12 @@ [274] = { 6, TM, SEN(mbind), "mbind" }, [275] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" }, [276] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" }, -[277] = { 4, 0, SEN(mq_open), "mq_open" }, +[277] = { 4, TD, SEN(mq_open), "mq_open" }, [278] = { 1, 0, SEN(mq_unlink), "mq_unlink" }, -[279] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" }, -[280] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" }, -[281] = { 2, 0, SEN(mq_notify), "mq_notify" }, -[282] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" }, +[279] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" }, +[280] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" }, +[281] = { 2, TD, SEN(mq_notify), "mq_notify" }, +[282] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" }, [283] = { 4, 0, SEN(kexec_load), "kexec_load" }, [284] = { 5, TP, SEN(waitid), "waitid" }, [285] = { 5, 0, SEN(add_key), "add_key" }, diff --git a/linux/sh64/arch_defs_.h b/linux/sh64/arch_defs_.h new file mode 100644 index 00000000..0c9ca195 --- /dev/null +++ b/linux/sh64/arch_defs_.h @@ -0,0 +1 @@ +#define HAVE_ARCH_UID16_SYSCALLS 1 diff --git a/linux/sh64/get_scno.c b/linux/sh64/get_scno.c index 50a52232..bda2cd26 100644 --- a/linux/sh64/get_scno.c +++ b/linux/sh64/get_scno.c @@ -2,7 +2,7 @@ static int arch_get_scno(struct tcb *tcp) { - if (upeek(tcp->pid, REG_SYSCALL, &tcp->scno) < 0) + if (upeek(tcp, REG_SYSCALL, &tcp->scno) < 0) return -1; tcp->scno &= 0xffff; return 1; diff --git a/linux/sh64/get_syscall_args.c b/linux/sh64/get_syscall_args.c index 3970df8f..e35c3507 100644 --- a/linux/sh64/get_syscall_args.c +++ b/linux/sh64/get_syscall_args.c @@ -7,7 +7,7 @@ get_syscall_args(struct tcb *tcp) unsigned int i; for (i = 0; i < tcp->s_ent->nargs; ++i) - if (upeek(tcp->pid, REG_GENERAL(syscall_regs[i]), + if (upeek(tcp, REG_GENERAL(syscall_regs[i]), &tcp->u_arg[i]) < 0) return -1; return 1; diff --git a/linux/sh64/get_syscall_result.c b/linux/sh64/get_syscall_result.c index 4264dccc..33c42479 100644 --- a/linux/sh64/get_syscall_result.c +++ b/linux/sh64/get_syscall_result.c @@ -2,5 +2,5 @@ static int get_syscall_result_regs(struct tcb *tcp) { /* ABI defines result returned in r9 */ - return upeek(tcp->pid, REG_GENERAL(9), &sh64_r9) < 0 ? -1 : 0; + return upeek(tcp, REG_GENERAL(9), &sh64_r9) < 0 ? -1 : 0; } diff --git a/linux/sh64/set_error.c b/linux/sh64/set_error.c index 35271fb5..29293b22 100644 --- a/linux/sh64/set_error.c +++ b/linux/sh64/set_error.c @@ -2,12 +2,12 @@ static int arch_set_error(struct tcb *tcp) { sh64_r9 = -tcp->u_error; - return upoke(tcp->pid, REG_GENERAL(9), sh64_r9); + return upoke(tcp, REG_GENERAL(9), sh64_r9); } static int arch_set_success(struct tcb *tcp) { sh64_r9 = tcp->u_rval; - return upoke(tcp->pid, REG_GENERAL(9), sh64_r9); + return upoke(tcp, REG_GENERAL(9), sh64_r9); } diff --git a/linux/sh64/set_scno.c b/linux/sh64/set_scno.c index be4f1ed1..0e7c18fa 100644 --- a/linux/sh64/set_scno.c +++ b/linux/sh64/set_scno.c @@ -1,5 +1,5 @@ static int arch_set_scno(struct tcb *tcp, kernel_ulong_t scno) { - return upoke(tcp->pid, REG_SYSCALL, scno); + return upoke(tcp, REG_SYSCALL, scno); } diff --git a/linux/sh64/syscallent.h b/linux/sh64/syscallent.h index b1d141d0..4905b0f9 100644 --- a/linux/sh64/syscallent.h +++ b/linux/sh64/syscallent.h @@ -1,7 +1,7 @@ /* * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl> * Copyright (c) 1993, 1994, 1995 Rick Sladkey <jrs@world.std.com> - * Copyright (c) 1995-2017 The strace developers. + * Copyright (c) 1995-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,11 +47,11 @@ [ 17] = { 0, TM, SEN(break), "break" }, [ 18] = { 2, TF|TST|TSTA, SEN(oldstat), "oldstat" }, [ 19] = { 3, TD, SEN(lseek), "lseek" }, -[ 20] = { 0, NF, SEN(getpid), "getpid" }, +[ 20] = { 0, PU|NF, SEN(getpid), "getpid" }, [ 21] = { 5, TF, SEN(mount), "mount" }, [ 22] = { 1, TF, SEN(umount), "umount" }, [ 23] = { 1, 0, SEN(setuid16), "setuid" }, -[ 24] = { 0, NF, SEN(getuid16), "getuid" }, +[ 24] = { 0, PU|NF, SEN(getuid16), "getuid" }, [ 25] = { 1, 0, SEN(stime), "stime" }, [ 26] = { 4, 0, SEN(ptrace), "ptrace" }, [ 27] = { 1, 0, SEN(alarm), "alarm" }, @@ -74,10 +74,10 @@ [ 44] = { 0, 0, SEN(prof), "prof" }, [ 45] = { 1, TM|SI, SEN(brk), "brk" }, [ 46] = { 1, 0, SEN(setgid16), "setgid" }, -[ 47] = { 0, NF, SEN(getgid16), "getgid" }, +[ 47] = { 0, PU|NF, SEN(getgid16), "getgid" }, [ 48] = { 2, TS, SEN(signal), "signal" }, -[ 49] = { 0, NF, SEN(geteuid16), "geteuid" }, -[ 50] = { 0, NF, SEN(getegid16), "getegid" }, +[ 49] = { 0, PU|NF, SEN(geteuid16), "geteuid" }, +[ 50] = { 0, PU|NF, SEN(getegid16), "getegid" }, [ 51] = { 1, TF, SEN(acct), "acct" }, [ 52] = { 2, TF, SEN(umount2), "umount2" }, [ 53] = { 0, 0, SEN(lock), "lock" }, @@ -91,8 +91,8 @@ [ 61] = { 1, TF, SEN(chroot), "chroot" }, [ 62] = { 2, TSFA, SEN(ustat), "ustat" }, [ 63] = { 2, TD, SEN(dup2), "dup2" }, -[ 64] = { 0, NF, SEN(getppid), "getppid" }, -[ 65] = { 0, 0, SEN(getpgrp), "getpgrp" }, +[ 64] = { 0, PU|NF, SEN(getppid), "getppid" }, +[ 65] = { 0, PU|NF, SEN(getpgrp), "getpgrp" }, [ 66] = { 0, 0, SEN(setsid), "setsid" }, [ 67] = { 3, TS, SEN(sigaction), "sigaction" }, [ 68] = { 0, TS, SEN(sgetmask), "sgetmask" }, @@ -225,10 +225,10 @@ [196] = { 2, TF|TLST|TSTA, SEN(lstat64), "lstat64" }, [197] = { 2, TD|TFST|TSTA, SEN(fstat64), "fstat64" }, [198] = { 3, TF, SEN(chown), "lchown32" }, -[199] = { 0, NF, SEN(getuid), "getuid32" }, -[200] = { 0, NF, SEN(getgid), "getgid32" }, -[201] = { 0, NF, SEN(geteuid), "geteuid32" }, -[202] = { 0, NF, SEN(getegid), "getegid32" }, +[199] = { 0, PU|NF, SEN(getuid), "getuid32" }, +[200] = { 0, PU|NF, SEN(getgid), "getgid32" }, +[201] = { 0, PU|NF, SEN(geteuid), "geteuid32" }, +[202] = { 0, PU|NF, SEN(getegid), "getegid32" }, [203] = { 2, 0, SEN(setreuid), "setreuid32" }, [204] = { 2, 0, SEN(setregid), "setregid32" }, [205] = { 2, 0, SEN(getgroups), "getgroups32" }, @@ -277,7 +277,7 @@ [248] = { 3, TD, SEN(getdents64), "getdents64" }, [249] = { 3, TD, SEN(fcntl64), "fcntl64" }, [250 ... 251] = { }, -[252] = { 0, NF, SEN(gettid), "gettid" }, +[252] = { 0, PU|NF, SEN(gettid), "gettid" }, [253] = { 3, TD, SEN(readahead), "readahead" }, [254] = { 5, TF, SEN(setxattr), "setxattr" }, [255] = { 5, TF, SEN(setxattr), "lsetxattr" }, @@ -329,12 +329,12 @@ [302] = { 6, TM, SEN(mbind), "mbind" }, [303] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" }, [304] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" }, -[305] = { 4, 0, SEN(mq_open), "mq_open" }, +[305] = { 4, TD, SEN(mq_open), "mq_open" }, [306] = { 1, 0, SEN(mq_unlink), "mq_unlink" }, -[307] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" }, -[308] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" }, -[309] = { 2, 0, SEN(mq_notify), "mq_notify" }, -[310] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" }, +[307] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" }, +[308] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" }, +[309] = { 2, TD, SEN(mq_notify), "mq_notify" }, +[310] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" }, [311] = { 4, 0, SEN(kexec_load), "kexec_load" }, [312] = { 5, TP, SEN(waitid), "waitid" }, [313] = { 5, 0, SEN(add_key), "add_key" }, diff --git a/linux/shuffle_scno.c b/linux/shuffle_scno.c new file mode 100644 index 00000000..0e6feaf2 --- /dev/null +++ b/linux/shuffle_scno.c @@ -0,0 +1,5 @@ +kernel_ulong_t +shuffle_scno(kernel_ulong_t scno) +{ + return scno; +} diff --git a/linux/sparc/arch_defs_.h b/linux/sparc/arch_defs_.h new file mode 100644 index 00000000..e30336ab --- /dev/null +++ b/linux/sparc/arch_defs_.h @@ -0,0 +1,4 @@ +#define HAVE_ARCH_GETRVAL2 1 +#define HAVE_ARCH_UID16_SYSCALLS 1 +#define HAVE_ARCH_SA_RESTORER 1 +#define HAVE_ARCH_DEDICATED_ERR_REG 1 diff --git a/linux/sparc/gen.pl b/linux/sparc/gen.pl deleted file mode 100644 index 8c2f75b9..00000000 --- a/linux/sparc/gen.pl +++ /dev/null @@ -1,37 +0,0 @@ -open SPARC, "syscallent.h" || die "no puedo abrir el de la sparc"; -open ALPHA, "../alpha/syscallent.h" || die "no puedo abrir el de la alpha"; -open PC, "../i386/syscallent.h" || die "no puedo abrir PC\n"; - -while (<SPARC>) { - chop; - ($i1, $i2, $i3, $syscall, $syscall_name) = split; - $strn[$index] = $syscall_name; - $name[$index++] = $syscall; -} - -while (<ALPHA>){ - if (/\{/) { - ($i1, $n, $pr, $syscall) = split; - $par{$syscall} = $n; - $prr{$syscall} = $pr; - } -} - -while (<PC>){ - if (/\{/) { - ($i1, $n, $pr, $syscall) = split; - $par{$syscall} = $n; - $prr{$syscall} = $pr; - } -} - -print "missing \n"; - -for ($i = 0; $i < $index; $i++){ - $x = $name[$i]; - $y = $strn[$i]; - $n = $par{$x}; - $p = $prr{$x}; - $j++; - print "\t{ $n\t$p\t$x\t$y },\t /* $j */\n"; -} diff --git a/linux/sparc/get_error.c b/linux/sparc/get_error.c index 1b960ace..b41bfb37 100644 --- a/linux/sparc/get_error.c +++ b/linux/sparc/get_error.c @@ -1,3 +1,5 @@ +#include <asm/psr.h> + static void get_error(struct tcb *tcp, const bool check_errno) { diff --git a/linux/sparc/syscallent.h b/linux/sparc/syscallent.h index 9c6fda5e..a1974c2d 100644 --- a/linux/sparc/syscallent.h +++ b/linux/sparc/syscallent.h @@ -18,11 +18,11 @@ [ 17] = { 1, TM|SI, SEN(brk), "brk" }, [ 18] = { 4, 0, SEN(printargs), "perfctr" }, [ 19] = { 3, TD, SEN(lseek), "lseek" }, -[ 20] = { 0, NF, SEN(getpid), "getpid" }, +[ 20] = { 0, PU|NF, SEN(getpid), "getpid" }, [ 21] = { 2, 0, SEN(capget), "capget" }, [ 22] = { 2, 0, SEN(capset), "capset" }, [ 23] = { 1, 0, SEN(setuid16), "setuid" }, -[ 24] = { 0, NF, SEN(getuid16), "getuid" }, +[ 24] = { 0, PU|NF, SEN(getuid16), "getuid" }, [ 25] = { 4, TD, SEN(vmsplice), "vmsplice" }, [ 26] = { 4, 0, SEN(ptrace), "ptrace" }, [ 27] = { 1, 0, SEN(alarm), "alarm" }, @@ -42,16 +42,16 @@ [ 41] = { 1, TD, SEN(dup), "dup" }, [ 42] = { 0, TD, SEN(pipe), "pipe" }, [ 43] = { 1, 0, SEN(times), "times" }, -[ 44] = { 0, NF, SEN(getuid), "getuid32" }, +[ 44] = { 0, PU|NF, SEN(getuid), "getuid32" }, [ 45] = { 2, TF, SEN(umount2), "umount2" }, [ 46] = { 1, 0, SEN(setgid16), "setgid" }, -[ 47] = { 0, NF, SEN(getgid16), "getgid" }, +[ 47] = { 0, PU|NF, SEN(getgid16), "getgid" }, [ 48] = { 2, TS, SEN(signal), "signal" }, -[ 49] = { 0, NF, SEN(geteuid16), "geteuid" }, -[ 50] = { 0, NF, SEN(getegid16), "getegid" }, +[ 49] = { 0, PU|NF, SEN(geteuid16), "geteuid" }, +[ 50] = { 0, PU|NF, SEN(getegid16), "getegid" }, [ 51] = { 1, TF, SEN(acct), "acct" }, [ 52] = { }, -[ 53] = { 0, NF, SEN(getgid), "getgid32" }, +[ 53] = { 0, PU|NF, SEN(getgid), "getgid32" }, [ 54] = { 3, TD, SEN(ioctl), "ioctl" }, [ 55] = { 4, 0, SEN(reboot), "reboot" }, [ 56] = { 6, TD|TM|SI, SEN(mmap_4koff), "mmap2" }, @@ -62,13 +62,13 @@ [ 61] = { 1, TF, SEN(chroot), "chroot" }, [ 62] = { 2, TD|TFST|TSTA, SEN(fstat), "fstat" }, [ 63] = { 2, TD|TFST|TSTA, SEN(fstat64), "fstat64" }, -[ 64] = { 0, 0, SEN(getpagesize), "getpagesize" }, +[ 64] = { 0, PU|NF, SEN(getpagesize), "getpagesize" }, [ 65] = { 3, TM, SEN(msync), "msync" }, [ 66] = { 0, TP, SEN(vfork), "vfork" }, [ 67] = { 5, TD, SEN(pread), "pread64" }, [ 68] = { 5, TD, SEN(pwrite), "pwrite64" }, -[ 69] = { 0, NF, SEN(geteuid), "geteuid32" }, -[ 70] = { 0, NF, SEN(getegid), "getegid32" }, +[ 69] = { 0, PU|NF, SEN(geteuid), "geteuid32" }, +[ 70] = { 0, PU|NF, SEN(getegid), "getegid32" }, [ 71] = { 6, TD|TM|SI, SEN(mmap), "mmap" }, [ 72] = { 2, 0, SEN(setreuid), "setreuid32" }, [ 73] = { 2, TM|SI, SEN(munmap), "munmap" }, @@ -79,7 +79,7 @@ [ 78] = { 3, TM, SEN(mincore), "mincore" }, [ 79] = { 2, 0, SEN(getgroups16), "getgroups" }, [ 80] = { 2, 0, SEN(setgroups16), "setgroups" }, -[ 81] = { 0, 0, SEN(getpgrp), "getpgrp" }, +[ 81] = { 0, PU|NF, SEN(getpgrp), "getpgrp" }, [ 82] = { 2, 0, SEN(setgroups), "setgroups32" }, [ 83] = { 3, 0, SEN(setitimer), "setitimer" }, [ 84] = { 3, TD, SEN(ftruncate64), "ftruncate64" }, @@ -141,7 +141,7 @@ [140] = { 4, TD|TN, SEN(sendfile64), "sendfile64" }, [141] = { 3, TN, SEN(getpeername), "getpeername" }, [142] = { 6, 0, SEN(futex), "futex" }, -[143] = { 0, NF, SEN(gettid), "gettid" }, +[143] = { 0, PU|NF, SEN(gettid), "gettid" }, [144] = { 2, 0, SEN(getrlimit), "getrlimit" }, [145] = { 2, 0, SEN(setrlimit), "setrlimit" }, [146] = { 2, TF, SEN(pivotroot), "pivot_root" }, @@ -195,7 +195,7 @@ [194] = { 4, TD, SEN(epoll_ctl), "epoll_ctl" }, [195] = { 4, TD, SEN(epoll_wait), "epoll_wait" }, [196] = { 3, 0, SEN(ioprio_set), "ioprio_set" }, -[197] = { 0, NF, SEN(getppid), "getppid" }, +[197] = { 0, PU|NF, SEN(getppid), "getppid" }, [198] = { 3, TS, SEN(sigaction), "sigaction" }, [199] = { 0, TS, SEN(sgetmask), "sgetmask" }, [200] = { 1, TS, SEN(ssetmask), "ssetmask" }, @@ -271,12 +271,12 @@ [270] = { 3, 0, SEN(io_submit), "io_submit" }, [271] = { 3, 0, SEN(io_cancel), "io_cancel" }, [272] = { 5, 0, SEN(io_getevents), "io_getevents" }, -[273] = { 4, 0, SEN(mq_open), "mq_open" }, +[273] = { 4, TD, SEN(mq_open), "mq_open" }, [274] = { 1, 0, SEN(mq_unlink), "mq_unlink" }, -[275] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" }, -[276] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" }, -[277] = { 2, 0, SEN(mq_notify), "mq_notify" }, -[278] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" }, +[275] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" }, +[276] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" }, +[277] = { 2, TD, SEN(mq_notify), "mq_notify" }, +[278] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" }, [279] = { 5, TP, SEN(waitid), "waitid" }, [280] = { 4, TD, SEN(tee), "tee" }, [281] = { 5, 0, SEN(add_key), "add_key" }, @@ -338,7 +338,7 @@ [337] = { 2, TD, SEN(setns), "setns" }, [338] = { 6, 0, SEN(process_vm_readv), "process_vm_readv" }, [339] = { 6, 0, SEN(process_vm_writev), "process_vm_writev" }, -[340] = { 0, NF, SEN(printargs), "kern_features" }, +[340] = { 0, PU|NF, SEN(printargs), "kern_features" }, [341] = { 5, 0, SEN(kcmp), "kcmp" }, [342] = { 3, TD, SEN(finit_module), "finit_module" }, [343] = { 3, 0, SEN(sched_setattr), "sched_setattr" }, diff --git a/linux/sparc64/arch_defs_.h b/linux/sparc64/arch_defs_.h new file mode 100644 index 00000000..31ce9a2a --- /dev/null +++ b/linux/sparc64/arch_defs_.h @@ -0,0 +1,5 @@ +#define HAVE_ARCH_GETRVAL2 1 +#define HAVE_ARCH_UID16_SYSCALLS 1 +#define HAVE_ARCH_SA_RESTORER 1 +#define SUPPORTED_PERSONALITIES 2 +#define HAVE_ARCH_DEDICATED_ERR_REG 1 diff --git a/linux/sparc64/syscallent.h b/linux/sparc64/syscallent.h index 695aa19f..0b3530e3 100644 --- a/linux/sparc64/syscallent.h +++ b/linux/sparc64/syscallent.h @@ -18,11 +18,11 @@ [ 17] = { 1, TM|SI, SEN(brk), "brk" }, [ 18] = { 4, 0, SEN(printargs), "perfctr" }, [ 19] = { 3, TD, SEN(lseek), "lseek" }, -[ 20] = { 0, NF, SEN(getpid), "getpid" }, +[ 20] = { 0, PU|NF, SEN(getpid), "getpid" }, [ 21] = { 2, 0, SEN(capget), "capget" }, [ 22] = { 2, 0, SEN(capset), "capset" }, [ 23] = { 1, 0, SEN(setuid), "setuid" }, -[ 24] = { 0, NF, SEN(getuid), "getuid" }, +[ 24] = { 0, PU|NF, SEN(getuid), "getuid" }, [ 25] = { 4, TD, SEN(vmsplice), "vmsplice" }, [ 26] = { 4, 0, SEN(ptrace), "ptrace" }, [ 27] = { 1, 0, SEN(alarm), "alarm" }, @@ -44,10 +44,10 @@ [ 44] = { }, [ 45] = { 2, TF, SEN(umount2), "umount2" }, [ 46] = { 1, 0, SEN(setgid), "setgid" }, -[ 47] = { 0, NF, SEN(getgid), "getgid" }, +[ 47] = { 0, PU|NF, SEN(getgid), "getgid" }, [ 48] = { 2, TS, SEN(signal), "signal" }, -[ 49] = { 0, NF, SEN(geteuid), "geteuid" }, -[ 50] = { 0, NF, SEN(getegid), "getegid" }, +[ 49] = { 0, PU|NF, SEN(geteuid), "geteuid" }, +[ 50] = { 0, PU|NF, SEN(getegid), "getegid" }, [ 51] = { 1, TF, SEN(acct), "acct" }, [ 52] = { 2, 0, SEN(printargs), "memory_ordering" }, [ 53] = { }, @@ -61,7 +61,7 @@ [ 61] = { 1, TF, SEN(chroot), "chroot" }, [ 62] = { 2, TD|TFST|TSTA, SEN(fstat), "fstat" }, [ 63] = { 2, TD|TFST|TSTA, SEN(fstat64), "fstat64" }, -[ 64] = { 0, 0, SEN(getpagesize), "getpagesize" }, +[ 64] = { 0, PU|NF, SEN(getpagesize), "getpagesize" }, [ 65] = { 3, TM, SEN(msync), "msync" }, [ 66] = { 0, TP, SEN(vfork), "vfork" }, [ 67] = { 4, TD, SEN(pread), "pread64" }, @@ -77,7 +77,7 @@ [ 78] = { 3, TM, SEN(mincore), "mincore" }, [ 79] = { 2, 0, SEN(getgroups), "getgroups" }, [ 80] = { 2, 0, SEN(setgroups), "setgroups" }, -[ 81] = { 0, 0, SEN(getpgrp), "getpgrp" }, +[ 81] = { 0, PU|NF, SEN(getpgrp), "getpgrp" }, [ 82] = { }, [ 83] = { 3, 0, SEN(setitimer), "setitimer" }, [ 84] = { }, @@ -139,7 +139,7 @@ [140] = { 4, TD|TN, SEN(sendfile64), "sendfile64" }, [141] = { 3, TN, SEN(getpeername), "getpeername" }, [142] = { 6, 0, SEN(futex), "futex" }, -[143] = { 0, NF, SEN(gettid), "gettid" }, +[143] = { 0, PU|NF, SEN(gettid), "gettid" }, [144] = { 2, 0, SEN(getrlimit), "getrlimit" }, [145] = { 2, 0, SEN(setrlimit), "setrlimit" }, [146] = { 2, TF, SEN(pivotroot), "pivot_root" }, @@ -193,7 +193,7 @@ [194] = { 4, TD, SEN(epoll_ctl), "epoll_ctl" }, [195] = { 4, TD, SEN(epoll_wait), "epoll_wait" }, [196] = { 3, 0, SEN(ioprio_set), "ioprio_set" }, -[197] = { 0, NF, SEN(getppid), "getppid" }, +[197] = { 0, PU|NF, SEN(getppid), "getppid" }, [198] = { 3, TS, SEN(sigaction), "sigaction" }, [199] = { 0, TS, SEN(sgetmask), "sgetmask" }, [200] = { 1, TS, SEN(ssetmask), "ssetmask" }, @@ -269,12 +269,12 @@ [270] = { 3, 0, SEN(io_submit), "io_submit" }, [271] = { 3, 0, SEN(io_cancel), "io_cancel" }, [272] = { 5, 0, SEN(io_getevents), "io_getevents" }, -[273] = { 4, 0, SEN(mq_open), "mq_open" }, +[273] = { 4, TD, SEN(mq_open), "mq_open" }, [274] = { 1, 0, SEN(mq_unlink), "mq_unlink" }, -[275] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" }, -[276] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" }, -[277] = { 2, 0, SEN(mq_notify), "mq_notify" }, -[278] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" }, +[275] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" }, +[276] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" }, +[277] = { 2, TD, SEN(mq_notify), "mq_notify" }, +[278] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" }, [279] = { 5, TP, SEN(waitid), "waitid" }, [280] = { 4, TD, SEN(tee), "tee" }, [281] = { 5, 0, SEN(add_key), "add_key" }, @@ -336,7 +336,7 @@ [337] = { 2, TD, SEN(setns), "setns" }, [338] = { 6, 0, SEN(process_vm_readv), "process_vm_readv" }, [339] = { 6, 0, SEN(process_vm_writev), "process_vm_writev" }, -[340] = { 0, NF, SEN(printargs), "kern_features" }, +[340] = { 0, PU|NF, SEN(printargs), "kern_features" }, [341] = { 5, 0, SEN(kcmp), "kcmp" }, [342] = { 3, TD, SEN(finit_module), "finit_module" }, [343] = { 3, 0, SEN(sched_setattr), "sched_setattr" }, diff --git a/linux/syscall.h b/linux/syscall.h index bd155186..a1469b72 100644 --- a/linux/syscall.h +++ b/linux/syscall.h @@ -1,7 +1,7 @@ /* * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl> * Copyright (c) 1993, 1994, 1995 Rick Sladkey <jrs@world.std.com> - * Copyright (c) 1995-2017 The strace developers. + * Copyright (c) 1995-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,7 +34,7 @@ #include "sys_func.h" #include "sen.h" -#if NEED_UID16_PARSERS +#if HAVE_ARCH_UID16_SYSCALLS extern SYS_FUNC(chown16); extern SYS_FUNC(fchown16); extern SYS_FUNC(getgroups16); @@ -45,6 +45,6 @@ extern SYS_FUNC(setgroups16); extern SYS_FUNC(setresuid16); extern SYS_FUNC(setreuid16); extern SYS_FUNC(setuid16); -#endif +#endif /* HAVE_ARCH_UID16_SYSCALLS */ #endif /* !STRACE_LINUX_SYSCALL_H */ diff --git a/linux/tile/arch_defs_.h b/linux/tile/arch_defs_.h new file mode 100644 index 00000000..34a56248 --- /dev/null +++ b/linux/tile/arch_defs_.h @@ -0,0 +1,5 @@ +#define SUPPORTED_PERSONALITIES 2 + +#ifdef __tilepro__ +# define DEFAULT_PERSONALITY 1 +#endif diff --git a/linux/ubi-user.h b/linux/ubi-user.h deleted file mode 100644 index 0f5c7756..00000000 --- a/linux/ubi-user.h +++ /dev/null @@ -1,421 +0,0 @@ -/* - * Copyright (c) International Business Machines Corp., 2006 - * Copyright (c) 2006-2017 The strace developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Author: Artem Bityutskiy (Битюцкий Артём) - */ - -#ifndef __UBI_USER_H__ -#define __UBI_USER_H__ - -#include <linux/types.h> - -/* - * UBI device creation (the same as MTD device attachment) - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * - * MTD devices may be attached using %UBI_IOCATT ioctl command of the UBI - * control device. The caller has to properly fill and pass - * &struct ubi_attach_req object - UBI will attach the MTD device specified in - * the request and return the newly created UBI device number as the ioctl - * return value. - * - * UBI device deletion (the same as MTD device detachment) - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * - * An UBI device maybe deleted with %UBI_IOCDET ioctl command of the UBI - * control device. - * - * UBI volume creation - * ~~~~~~~~~~~~~~~~~~~ - * - * UBI volumes are created via the %UBI_IOCMKVOL ioctl command of UBI character - * device. A &struct ubi_mkvol_req object has to be properly filled and a - * pointer to it has to be passed to the ioctl. - * - * UBI volume deletion - * ~~~~~~~~~~~~~~~~~~~ - * - * To delete a volume, the %UBI_IOCRMVOL ioctl command of the UBI character - * device should be used. A pointer to the 32-bit volume ID hast to be passed - * to the ioctl. - * - * UBI volume re-size - * ~~~~~~~~~~~~~~~~~~ - * - * To re-size a volume, the %UBI_IOCRSVOL ioctl command of the UBI character - * device should be used. A &struct ubi_rsvol_req object has to be properly - * filled and a pointer to it has to be passed to the ioctl. - * - * UBI volumes re-name - * ~~~~~~~~~~~~~~~~~~~ - * - * To re-name several volumes atomically at one go, the %UBI_IOCRNVOL command - * of the UBI character device should be used. A &struct ubi_rnvol_req object - * has to be properly filled and a pointer to it has to be passed to the ioctl. - * - * UBI volume update - * ~~~~~~~~~~~~~~~~~ - * - * Volume update should be done via the %UBI_IOCVOLUP ioctl command of the - * corresponding UBI volume character device. A pointer to a 64-bit update - * size should be passed to the ioctl. After this, UBI expects user to write - * this number of bytes to the volume character device. The update is finished - * when the claimed number of bytes is passed. So, the volume update sequence - * is something like: - * - * fd = open("/dev/my_volume"); - * ioctl(fd, UBI_IOCVOLUP, &image_size); - * write(fd, buf, image_size); - * close(fd); - * - * Logical eraseblock erase - * ~~~~~~~~~~~~~~~~~~~~~~~~ - * - * To erase a logical eraseblock, the %UBI_IOCEBER ioctl command of the - * corresponding UBI volume character device should be used. This command - * unmaps the requested logical eraseblock, makes sure the corresponding - * physical eraseblock is successfully erased, and returns. - * - * Atomic logical eraseblock change - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * - * Atomic logical eraseblock change operation is called using the %UBI_IOCEBCH - * ioctl command of the corresponding UBI volume character device. A pointer to - * a &struct ubi_leb_change_req object has to be passed to the ioctl. Then the - * user is expected to write the requested amount of bytes (similarly to what - * should be done in case of the "volume update" ioctl). - * - * Logical eraseblock map - * ~~~~~~~~~~~~~~~~~~~~~ - * - * To map a logical eraseblock to a physical eraseblock, the %UBI_IOCEBMAP - * ioctl command should be used. A pointer to a &struct ubi_map_req object is - * expected to be passed. The ioctl maps the requested logical eraseblock to - * a physical eraseblock and returns. Only non-mapped logical eraseblocks can - * be mapped. If the logical eraseblock specified in the request is already - * mapped to a physical eraseblock, the ioctl fails and returns error. - * - * Logical eraseblock unmap - * ~~~~~~~~~~~~~~~~~~~~~~~~ - * - * To unmap a logical eraseblock to a physical eraseblock, the %UBI_IOCEBUNMAP - * ioctl command should be used. The ioctl unmaps the logical eraseblocks, - * schedules corresponding physical eraseblock for erasure, and returns. Unlike - * the "LEB erase" command, it does not wait for the physical eraseblock being - * erased. Note, the side effect of this is that if an unclean reboot happens - * after the unmap ioctl returns, you may find the LEB mapped again to the same - * physical eraseblock after the UBI is run again. - * - * Check if logical eraseblock is mapped - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * - * To check if a logical eraseblock is mapped to a physical eraseblock, the - * %UBI_IOCEBISMAP ioctl command should be used. It returns %0 if the LEB is - * not mapped, and %1 if it is mapped. - * - * Set an UBI volume property - * ~~~~~~~~~~~~~~~~~~~~~~~~~ - * - * To set an UBI volume property the %UBI_IOCSETPROP ioctl command should be - * used. A pointer to a &struct ubi_set_vol_prop_req object is expected to be - * passed. The object describes which property should be set, and to which value - * it should be set. - */ - -/* - * When a new UBI volume or UBI device is created, users may either specify the - * volume/device number they want to create or to let UBI automatically assign - * the number using these constants. - */ -#define UBI_VOL_NUM_AUTO (-1) -#define UBI_DEV_NUM_AUTO (-1) - -/* Maximum volume name length */ -#define UBI_MAX_VOLUME_NAME 127 - -/* ioctl commands of UBI character devices */ - -#define UBI_IOC_MAGIC 'o' - -/* Create an UBI volume */ -#define UBI_IOCMKVOL _IOW(UBI_IOC_MAGIC, 0, struct ubi_mkvol_req) -/* Remove an UBI volume */ -#define UBI_IOCRMVOL _IOW(UBI_IOC_MAGIC, 1, __s32) -/* Re-size an UBI volume */ -#define UBI_IOCRSVOL _IOW(UBI_IOC_MAGIC, 2, struct ubi_rsvol_req) -/* Re-name volumes */ -#define UBI_IOCRNVOL _IOW(UBI_IOC_MAGIC, 3, struct ubi_rnvol_req) - -/* ioctl commands of the UBI control character device */ - -#define UBI_CTRL_IOC_MAGIC 'o' - -/* Attach an MTD device */ -#define UBI_IOCATT _IOW(UBI_CTRL_IOC_MAGIC, 64, struct ubi_attach_req) -/* Detach an MTD device */ -#define UBI_IOCDET _IOW(UBI_CTRL_IOC_MAGIC, 65, __s32) - -/* ioctl commands of UBI volume character devices */ - -#define UBI_VOL_IOC_MAGIC 'O' - -/* Start UBI volume update */ -#define UBI_IOCVOLUP _IOW(UBI_VOL_IOC_MAGIC, 0, __s64) -/* LEB erasure command, used for debugging, disabled by default */ -#define UBI_IOCEBER _IOW(UBI_VOL_IOC_MAGIC, 1, __s32) -/* Atomic LEB change command */ -#define UBI_IOCEBCH _IOW(UBI_VOL_IOC_MAGIC, 2, __s32) -/* Map LEB command */ -#define UBI_IOCEBMAP _IOW(UBI_VOL_IOC_MAGIC, 3, struct ubi_map_req) -/* Unmap LEB command */ -#define UBI_IOCEBUNMAP _IOW(UBI_VOL_IOC_MAGIC, 4, __s32) -/* Check if LEB is mapped command */ -#define UBI_IOCEBISMAP _IOR(UBI_VOL_IOC_MAGIC, 5, __s32) -/* Set an UBI volume property */ -#define UBI_IOCSETVOLPROP _IOW(UBI_VOL_IOC_MAGIC, 6, \ - struct ubi_set_vol_prop_req) - -/* Maximum MTD device name length supported by UBI */ -#define MAX_UBI_MTD_NAME_LEN 127 - -/* Maximum amount of UBI volumes that can be re-named at one go */ -#define UBI_MAX_RNVOL 32 - -/* - * UBI volume type constants. - * - * @UBI_DYNAMIC_VOLUME: dynamic volume - * @UBI_STATIC_VOLUME: static volume - */ -enum { - UBI_DYNAMIC_VOLUME = 3, - UBI_STATIC_VOLUME = 4, -}; - -/* - * UBI set volume property ioctl constants. - * - * @UBI_VOL_PROP_DIRECT_WRITE: allow (any non-zero value) or disallow (value 0) - * user to directly write and erase individual - * eraseblocks on dynamic volumes - */ -enum { - UBI_VOL_PROP_DIRECT_WRITE = 1, -}; - -/** - * struct ubi_attach_req - attach MTD device request. - * @ubi_num: UBI device number to create - * @mtd_num: MTD device number to attach - * @vid_hdr_offset: VID header offset (use defaults if %0) - * @max_beb_per1024: maximum expected number of bad PEB per 1024 PEBs - * @padding: reserved for future, not used, has to be zeroed - * - * This data structure is used to specify MTD device UBI has to attach and the - * parameters it has to use. The number which should be assigned to the new UBI - * device is passed in @ubi_num. UBI may automatically assign the number if - * @UBI_DEV_NUM_AUTO is passed. In this case, the device number is returned in - * @ubi_num. - * - * Most applications should pass %0 in @vid_hdr_offset to make UBI use default - * offset of the VID header within physical eraseblocks. The default offset is - * the next min. I/O unit after the EC header. For example, it will be offset - * 512 in case of a 512 bytes page NAND flash with no sub-page support. Or - * it will be 512 in case of a 2KiB page NAND flash with 4 512-byte sub-pages. - * - * But in rare cases, if this optimizes things, the VID header may be placed to - * a different offset. For example, the boot-loader might do things faster if - * the VID header sits at the end of the first 2KiB NAND page with 4 sub-pages. - * As the boot-loader would not normally need to read EC headers (unless it - * needs UBI in RW mode), it might be faster to calculate ECC. This is weird - * example, but it real-life example. So, in this example, @vid_hdr_offer would - * be 2KiB-64 bytes = 1984. Note, that this position is not even 512-bytes - * aligned, which is OK, as UBI is clever enough to realize this is 4th - * sub-page of the first page and add needed padding. - * - * The @max_beb_per1024 is the maximum amount of bad PEBs UBI expects on the - * UBI device per 1024 eraseblocks. This value is often given in an other form - * in the NAND datasheet (min NVB i.e. minimal number of valid blocks). The - * maximum expected bad eraseblocks per 1024 is then: - * 1024 * (1 - MinNVB / MaxNVB) - * Which gives 20 for most NAND devices. This limit is used in order to derive - * amount of eraseblock UBI reserves for handling new bad blocks. If the device - * has more bad eraseblocks than this limit, UBI does not reserve any physical - * eraseblocks for new bad eraseblocks, but attempts to use available - * eraseblocks (if any). The accepted range is 0-768. If 0 is given, the - * default kernel value of %CONFIG_MTD_UBI_BEB_LIMIT will be used. - */ -struct ubi_attach_req { - __s32 ubi_num; - __s32 mtd_num; - __s32 vid_hdr_offset; - __s16 max_beb_per1024; - __s8 padding[10]; -}; - -/** - * struct ubi_mkvol_req - volume description data structure used in - * volume creation requests. - * @vol_id: volume number - * @alignment: volume alignment - * @bytes: volume size in bytes - * @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME) - * @padding1: reserved for future, not used, has to be zeroed - * @name_len: volume name length - * @padding2: reserved for future, not used, has to be zeroed - * @name: volume name - * - * This structure is used by user-space programs when creating new volumes. The - * @used_bytes field is only necessary when creating static volumes. - * - * The @alignment field specifies the required alignment of the volume logical - * eraseblock. This means, that the size of logical eraseblocks will be aligned - * to this number, i.e., - * (UBI device logical eraseblock size) mod (@alignment) = 0. - * - * To put it differently, the logical eraseblock of this volume may be slightly - * shortened in order to make it properly aligned. The alignment has to be - * multiple of the flash minimal input/output unit, or %1 to utilize the entire - * available space of logical eraseblocks. - * - * The @alignment field may be useful, for example, when one wants to maintain - * a block device on top of an UBI volume. In this case, it is desirable to fit - * an integer number of blocks in logical eraseblocks of this UBI volume. With - * alignment it is possible to update this volume using plane UBI volume image - * BLOBs, without caring about how to properly align them. - */ -struct ubi_mkvol_req { - __s32 vol_id; - __s32 alignment; - __s64 bytes; - __s8 vol_type; - __s8 padding1; - __s16 name_len; - __s8 padding2[4]; - char name[UBI_MAX_VOLUME_NAME + 1]; -} ATTRIBUTE_PACKED; - -/** - * struct ubi_rsvol_req - a data structure used in volume re-size requests. - * @vol_id: ID of the volume to re-size - * @bytes: new size of the volume in bytes - * - * Re-sizing is possible for both dynamic and static volumes. But while dynamic - * volumes may be re-sized arbitrarily, static volumes cannot be made to be - * smaller than the number of bytes they bear. To arbitrarily shrink a static - * volume, it must be wiped out first (by means of volume update operation with - * zero number of bytes). - */ -struct ubi_rsvol_req { - __s64 bytes; - __s32 vol_id; -} ATTRIBUTE_PACKED; - -/** - * struct ubi_rnvol_req - volumes re-name request. - * @count: count of volumes to re-name - * @padding1: reserved for future, not used, has to be zeroed - * @vol_id: ID of the volume to re-name - * @name_len: name length - * @padding2: reserved for future, not used, has to be zeroed - * @name: new volume name - * - * UBI allows to re-name up to %32 volumes at one go. The count of volumes to - * re-name is specified in the @count field. The ID of the volumes to re-name - * and the new names are specified in the @vol_id and @name fields. - * - * The UBI volume re-name operation is atomic, which means that should power cut - * happen, the volumes will have either old name or new name. So the possible - * use-cases of this command is atomic upgrade. Indeed, to upgrade, say, volumes - * A and B one may create temporary volumes %A1 and %B1 with the new contents, - * then atomically re-name A1->A and B1->B, in which case old %A and %B will - * be removed. - * - * If it is not desirable to remove old A and B, the re-name request has to - * contain 4 entries: A1->A, A->A1, B1->B, B->B1, in which case old A1 and B1 - * become A and B, and old A and B will become A1 and B1. - * - * It is also OK to request: A1->A, A1->X, B1->B, B->Y, in which case old A1 - * and B1 become A and B, and old A and B become X and Y. - * - * In other words, in case of re-naming into an existing volume name, the - * existing volume is removed, unless it is re-named as well at the same - * re-name request. - */ -struct ubi_rnvol_req { - __s32 count; - __s8 padding1[12]; - struct { - __s32 vol_id; - __s16 name_len; - __s8 padding2[2]; - char name[UBI_MAX_VOLUME_NAME + 1]; - } ents[UBI_MAX_RNVOL]; -} ATTRIBUTE_PACKED; - -/** - * struct ubi_leb_change_req - a data structure used in atomic LEB change - * requests. - * @lnum: logical eraseblock number to change - * @bytes: how many bytes will be written to the logical eraseblock - * @dtype: pass "3" for better compatibility with old kernels - * @padding: reserved for future, not used, has to be zeroed - * - * The @dtype field used to inform UBI about what kind of data will be written - * to the LEB: long term (value 1), short term (value 2), unknown (value 3). - * UBI tried to pick a PEB with lower erase counter for short term data and a - * PEB with higher erase counter for long term data. But this was not really - * used because users usually do not know this and could easily mislead UBI. We - * removed this feature in May 2012. UBI currently just ignores the @dtype - * field. But for better compatibility with older kernels it is recommended to - * set @dtype to 3 (unknown). - */ -struct ubi_leb_change_req { - __s32 lnum; - __s32 bytes; - __s8 dtype; /* obsolete, do not use! */ - __s8 padding[7]; -} ATTRIBUTE_PACKED; - -/** - * struct ubi_map_req - a data structure used in map LEB requests. - * @dtype: pass "3" for better compatibility with old kernels - * @lnum: logical eraseblock number to unmap - * @padding: reserved for future, not used, has to be zeroed - */ -struct ubi_map_req { - __s32 lnum; - __s8 dtype; /* obsolete, do not use! */ - __s8 padding[3]; -} ATTRIBUTE_PACKED; - - -/** - * struct ubi_set_vol_prop_req - a data structure used to set an UBI volume - * property. - * @property: property to set (%UBI_VOL_PROP_DIRECT_WRITE) - * @padding: reserved for future, not used, has to be zeroed - * @value: value to set - */ -struct ubi_set_vol_prop_req { - __u8 property; - __u8 padding[7]; - __u64 value; -} ATTRIBUTE_PACKED; - -#endif /* __UBI_USER_H__ */ diff --git a/linux/x32/arch_defs_.h b/linux/x32/arch_defs_.h new file mode 100644 index 00000000..40232fd6 --- /dev/null +++ b/linux/x32/arch_defs_.h @@ -0,0 +1,4 @@ +#define HAVE_ARCH_OLD_MMAP 1 +#define HAVE_ARCH_OLD_SELECT 1 +#define HAVE_ARCH_UID16_SYSCALLS 1 +#define SUPPORTED_PERSONALITIES 2 diff --git a/linux/x32/arch_kvm.c b/linux/x32/arch_kvm.c new file mode 100644 index 00000000..e8e982ee --- /dev/null +++ b/linux/x32/arch_kvm.c @@ -0,0 +1 @@ +#include "x86_64/arch_kvm.c" diff --git a/linux/x32/ioctls_inc0.h b/linux/x32/ioctls_inc0.h index 9d4041bf..87870e66 100644 --- a/linux/x32/ioctls_inc0.h +++ b/linux/x32/ioctls_inc0.h @@ -85,6 +85,7 @@ { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_BO_LIST", _IOC_READ|_IOC_WRITE, 0x6443, 0x18 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_CS", _IOC_READ|_IOC_WRITE, 0x6444, 0x18 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_CTX", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 }, +{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_FENCE_TO_HANDLE", _IOC_READ|_IOC_WRITE, 0x6454, 0x20 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_CREATE", _IOC_READ|_IOC_WRITE, 0x6440, 0x20 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_METADATA", _IOC_READ|_IOC_WRITE, 0x6446, 0x120 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_MMAP", _IOC_READ|_IOC_WRITE, 0x6441, 0x08 }, @@ -93,6 +94,7 @@ { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_VA", _IOC_WRITE, 0x6448, 0x28 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_INFO", _IOC_WRITE, 0x6445, 0x20 }, +{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_SCHED", _IOC_WRITE, 0x6455, 0x10 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_VM", _IOC_READ|_IOC_WRITE, 0x6453, 0x08 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_CS", _IOC_READ|_IOC_WRITE, 0x6449, 0x20 }, { "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_FENCES", _IOC_READ|_IOC_WRITE, 0x6452, 0x18 }, @@ -111,6 +113,8 @@ { "drm/drm.h", "DRM_IOCTL_AUTH_MAGIC", _IOC_WRITE, 0x6411, 0x04 }, { "drm/drm.h", "DRM_IOCTL_BLOCK", _IOC_READ|_IOC_WRITE, 0x6412, 0x04 }, { "drm/drm.h", "DRM_IOCTL_CONTROL", _IOC_WRITE, 0x6414, 0x08 }, +{ "drm/drm.h", "DRM_IOCTL_CRTC_GET_SEQUENCE", _IOC_READ|_IOC_WRITE, 0x643b, 0x18 }, +{ "drm/drm.h", "DRM_IOCTL_CRTC_QUEUE_SEQUENCE", _IOC_READ|_IOC_WRITE, 0x643c, 0x18 }, { "drm/drm.h", "DRM_IOCTL_DMA", _IOC_READ|_IOC_WRITE, 0x6429, 0x28 }, { "drm/drm.h", "DRM_IOCTL_DROP_MASTER", _IOC_NONE, 0x641f, 0x00 }, { "drm/drm.h", "DRM_IOCTL_FINISH", _IOC_WRITE, 0x642c, 0x08 }, @@ -138,6 +142,7 @@ { "drm/drm.h", "DRM_IOCTL_MODE_ATTACHMODE", _IOC_READ|_IOC_WRITE, 0x64a8, 0x48 }, { "drm/drm.h", "DRM_IOCTL_MODE_CREATEPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64bd, 0x10 }, { "drm/drm.h", "DRM_IOCTL_MODE_CREATE_DUMB", _IOC_READ|_IOC_WRITE, 0x64b2, 0x20 }, +{ "drm/drm.h", "DRM_IOCTL_MODE_CREATE_LEASE", _IOC_READ|_IOC_WRITE, 0x64c6, 0x18 }, { "drm/drm.h", "DRM_IOCTL_MODE_CURSOR", _IOC_READ|_IOC_WRITE, 0x64a3, 0x1c }, { "drm/drm.h", "DRM_IOCTL_MODE_CURSOR2", _IOC_READ|_IOC_WRITE, 0x64bb, 0x24 }, { "drm/drm.h", "DRM_IOCTL_MODE_DESTROYPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64be, 0x04 }, @@ -154,10 +159,13 @@ { "drm/drm.h", "DRM_IOCTL_MODE_GETPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64ac, 0x10 }, { "drm/drm.h", "DRM_IOCTL_MODE_GETPROPERTY", _IOC_READ|_IOC_WRITE, 0x64aa, 0x40 }, { "drm/drm.h", "DRM_IOCTL_MODE_GETRESOURCES", _IOC_READ|_IOC_WRITE, 0x64a0, 0x40 }, +{ "drm/drm.h", "DRM_IOCTL_MODE_GET_LEASE", _IOC_READ|_IOC_WRITE, 0x64c8, 0x10 }, +{ "drm/drm.h", "DRM_IOCTL_MODE_LIST_LESSEES", _IOC_READ|_IOC_WRITE, 0x64c7, 0x10 }, { "drm/drm.h", "DRM_IOCTL_MODE_MAP_DUMB", _IOC_READ|_IOC_WRITE, 0x64b3, 0x10 }, { "drm/drm.h", "DRM_IOCTL_MODE_OBJ_GETPROPERTIES", _IOC_READ|_IOC_WRITE, 0x64b9, 0x20 }, { "drm/drm.h", "DRM_IOCTL_MODE_OBJ_SETPROPERTY", _IOC_READ|_IOC_WRITE, 0x64ba, 0x18 }, { "drm/drm.h", "DRM_IOCTL_MODE_PAGE_FLIP", _IOC_READ|_IOC_WRITE, 0x64b0, 0x18 }, +{ "drm/drm.h", "DRM_IOCTL_MODE_REVOKE_LEASE", _IOC_READ|_IOC_WRITE, 0x64c9, 0x04 }, { "drm/drm.h", "DRM_IOCTL_MODE_RMFB", _IOC_READ|_IOC_WRITE, 0x64af, 0x04 }, { "drm/drm.h", "DRM_IOCTL_MODE_SETCRTC", _IOC_READ|_IOC_WRITE, 0x64a2, 0x68 }, { "drm/drm.h", "DRM_IOCTL_MODE_SETGAMMA", _IOC_READ|_IOC_WRITE, 0x64a5, 0x20 }, @@ -195,10 +203,12 @@ { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_CPU_PREP", _IOC_WRITE, 0x6444, 0x18 }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_NEW", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 }, -{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x38 }, +{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x48 }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_USERPTR", _IOC_READ|_IOC_WRITE, 0x6448, 0x18 }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_WAIT", _IOC_WRITE, 0x6449, 0x20 }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 }, +{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_PM_QUERY_DOM", _IOC_READ|_IOC_WRITE, 0x644a, 0x48 }, +{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_PM_QUERY_SIG", _IOC_READ|_IOC_WRITE, 0x644b, 0x4c }, { "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x20 }, { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_G2D_EXEC", _IOC_READ|_IOC_WRITE, 0x6462, 0x08 }, { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_G2D_GET_VER", _IOC_READ|_IOC_WRITE, 0x6460, 0x08 }, @@ -304,7 +314,9 @@ { "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_NEW", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 }, { "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x28 }, { "drm/msm_drm.h", "DRM_IOCTL_MSM_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 }, -{ "drm/msm_drm.h", "DRM_IOCTL_MSM_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x18 }, +{ "drm/msm_drm.h", "DRM_IOCTL_MSM_SUBMITQUEUE_CLOSE", _IOC_WRITE, 0x644b, 0x04 }, +{ "drm/msm_drm.h", "DRM_IOCTL_MSM_SUBMITQUEUE_NEW", _IOC_READ|_IOC_WRITE, 0x644a, 0x0c }, +{ "drm/msm_drm.h", "DRM_IOCTL_MSM_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x20 }, { "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_CPU_FINI", _IOC_WRITE, 0x6483, 0x04 }, { "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_CPU_PREP", _IOC_WRITE, 0x6482, 0x08 }, { "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6484, 0x28 }, @@ -408,6 +420,7 @@ { "drm/tegra_drm.h", "DRM_IOCTL_TEGRA_SYNCPT_WAIT", _IOC_READ|_IOC_WRITE, 0x6444, 0x10 }, { "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_BO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 }, { "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_SHADER_BO", _IOC_READ|_IOC_WRITE, 0x6445, 0x18 }, +{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GEM_MADVISE", _IOC_READ|_IOC_WRITE, 0x644b, 0x10 }, { "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_HANG_STATE", _IOC_READ|_IOC_WRITE, 0x6446, 0xa0 }, { "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 }, { "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_TILING", _IOC_READ|_IOC_WRITE, 0x6449, 0x10 }, @@ -606,6 +619,7 @@ { "linux/btrfs.h", "BTRFS_IOC_INO_LOOKUP", _IOC_READ|_IOC_WRITE, 0x9412, 0x1000 }, { "linux/btrfs.h", "BTRFS_IOC_INO_PATHS", _IOC_READ|_IOC_WRITE, 0x9423, 0x38 }, { "linux/btrfs.h", "BTRFS_IOC_LOGICAL_INO", _IOC_READ|_IOC_WRITE, 0x9424, 0x38 }, +{ "linux/btrfs.h", "BTRFS_IOC_LOGICAL_INO_V2", _IOC_READ|_IOC_WRITE, 0x943b, 0x38 }, { "linux/btrfs.h", "BTRFS_IOC_QGROUP_ASSIGN", _IOC_WRITE, 0x9429, 0x18 }, { "linux/btrfs.h", "BTRFS_IOC_QGROUP_CREATE", _IOC_WRITE, 0x942a, 0x10 }, { "linux/btrfs.h", "BTRFS_IOC_QGROUP_LIMIT", _IOC_READ, 0x942b, 0x30 }, @@ -2400,6 +2414,7 @@ { "linux/wireless.h", "SIOCSIWSTATS", 0, 0x8B0E, 0 }, { "linux/wireless.h", "SIOCSIWTHRSPY", 0, 0x8B12, 0 }, { "linux/wireless.h", "SIOCSIWTXPOW", 0, 0x8B26, 0 }, +{ "linux/wmi.h", "DELL_WMI_SMBIOS_CMD", _IOC_READ|_IOC_WRITE, 0x5700, 0x34 }, { "media/drv-intf/exynos-fimc.h", "S5P_FIMC_TX_END_NOTIFY", _IOC_NONE, 0x6500, 0x00 }, { "media/i2c/adv7842.h", "ADV7842_CMD_RAM_TEST", _IOC_NONE, 0x56c0, 0x00 }, { "media/i2c/bt819.h", "BT819_FIFO_RESET_HIGH", _IOC_NONE, 0x6201, 0x00 }, diff --git a/linux/x32/shuffle_scno.c b/linux/x32/shuffle_scno.c new file mode 100644 index 00000000..d0db368f --- /dev/null +++ b/linux/x32/shuffle_scno.c @@ -0,0 +1,8 @@ +kernel_ulong_t +shuffle_scno(kernel_ulong_t scno) +{ + if (current_personality == 0 && scno != (kernel_ulong_t) -1) + scno ^= __X32_SYSCALL_BIT; + + return scno; +} diff --git a/linux/x32/syscallent.h b/linux/x32/syscallent.h index bbc24474..e448dc5e 100644 --- a/linux/x32/syscallent.h +++ b/linux/x32/syscallent.h @@ -37,7 +37,7 @@ [ 36] = { 2, 0, SEN(getitimer), "getitimer" }, [ 37] = { 1, 0, SEN(alarm), "alarm" }, [ 38] = { 3, 0, SEN(setitimer), "setitimer" }, -[ 39] = { 0, NF, SEN(getpid), "getpid" }, +[ 39] = { 0, PU|NF, SEN(getpid), "getpid" }, [ 40] = { 4, TD|TN, SEN(sendfile64), "sendfile" }, [ 41] = { 3, TN, SEN(socket), "socket" }, [ 42] = { 3, TN, SEN(connect), "connect" }, @@ -100,16 +100,16 @@ [ 99] = { 1, 0, SEN(sysinfo), "sysinfo" }, [100] = { 1, 0, SEN(times), "times" }, [101] = { 4, 0, SEN(printargs), "64:ptrace" }, -[102] = { 0, NF, SEN(getuid), "getuid" }, +[102] = { 0, PU|NF, SEN(getuid), "getuid" }, [103] = { 3, 0, SEN(syslog), "syslog" }, -[104] = { 0, NF, SEN(getgid), "getgid" }, +[104] = { 0, PU|NF, SEN(getgid), "getgid" }, [105] = { 1, 0, SEN(setuid), "setuid" }, [106] = { 1, 0, SEN(setgid), "setgid" }, -[107] = { 0, NF, SEN(geteuid), "geteuid" }, -[108] = { 0, NF, SEN(getegid), "getegid" }, +[107] = { 0, PU|NF, SEN(geteuid), "geteuid" }, +[108] = { 0, PU|NF, SEN(getegid), "getegid" }, [109] = { 2, 0, SEN(setpgid), "setpgid" }, -[110] = { 0, NF, SEN(getppid), "getppid" }, -[111] = { 0, 0, SEN(getpgrp), "getpgrp" }, +[110] = { 0, PU|NF, SEN(getppid), "getppid" }, +[111] = { 0, PU|NF, SEN(getpgrp), "getpgrp" }, [112] = { 0, 0, SEN(setsid), "setsid" }, [113] = { 2, 0, SEN(setreuid), "setreuid" }, [114] = { 2, 0, SEN(setregid), "setregid" }, @@ -184,7 +184,7 @@ [183] = { 5, 0, SEN(afs_syscall), "afs_syscall" }, [184] = { 3, 0, SEN(tuxcall), "tuxcall" }, [185] = { 3, 0, SEN(security), "security" }, -[186] = { 0, NF, SEN(gettid), "gettid" }, +[186] = { 0, PU|NF, SEN(gettid), "gettid" }, [187] = { 3, TD, SEN(readahead), "readahead" }, [188] = { 5, TF, SEN(setxattr), "setxattr" }, [189] = { 5, TF, SEN(setxattr), "lsetxattr" }, @@ -238,12 +238,12 @@ [237] = { 6, TM, SEN(mbind), "mbind" }, [238] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" }, [239] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" }, -[240] = { 4, 0, SEN(mq_open), "mq_open" }, +[240] = { 4, TD, SEN(mq_open), "mq_open" }, [241] = { 1, 0, SEN(mq_unlink), "mq_unlink" }, -[242] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" }, -[243] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" }, +[242] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" }, +[243] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" }, [244] = { 2, 0, SEN(printargs), "64:mq_notify" }, -[245] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" }, +[245] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" }, [246] = { 4, 0, SEN(printargs), "64:kexec_load" }, [247] = { 5, TP, SEN(printargs), "64:waitid" }, [248] = { 5, 0, SEN(add_key), "add_key" }, @@ -351,7 +351,7 @@ [524] = { 3, CST|TS, SEN(rt_sigqueueinfo), "rt_sigqueueinfo" }, [525] = { 2, CST|TS, SEN(sigaltstack), "sigaltstack" }, [526] = { 3, CST, SEN(timer_create), "timer_create" }, -[527] = { 2, CST, SEN(mq_notify), "mq_notify" }, +[527] = { 2, CST|TD, SEN(mq_notify), "mq_notify" }, [528] = { 4, CST, SEN(kexec_load), "kexec_load" }, [529] = { 5, CST|TP, SEN(waitid), "waitid" }, [530] = { 2, CST, SEN(set_robust_list), "set_robust_list" }, diff --git a/linux/x86_64/arch_defs_.h b/linux/x86_64/arch_defs_.h new file mode 100644 index 00000000..169e0892 --- /dev/null +++ b/linux/x86_64/arch_defs_.h @@ -0,0 +1,4 @@ +#define HAVE_ARCH_OLD_MMAP 1 +#define HAVE_ARCH_OLD_SELECT 1 +#define HAVE_ARCH_UID16_SYSCALLS 1 +#define SUPPORTED_PERSONALITIES 3 diff --git a/linux/x86_64/arch_kvm.c b/linux/x86_64/arch_kvm.c new file mode 100644 index 00000000..f0075cae --- /dev/null +++ b/linux/x86_64/arch_kvm.c @@ -0,0 +1,110 @@ +#ifdef HAVE_STRUCT_KVM_REGS +static void +arch_print_kvm_regs(struct tcb *const tcp, + const kernel_ulong_t addr, + const struct kvm_regs *const regs) +{ + PRINT_FIELD_X("{", *regs, rax); + if (abbrev(tcp)) + tprints(", ..."); + else { + PRINT_FIELD_X(", ", *regs, rbx); + PRINT_FIELD_X(", ", *regs, rcx); + PRINT_FIELD_X(", ", *regs, rdx); + PRINT_FIELD_X(", ", *regs, rsi); + PRINT_FIELD_X(", ", *regs, rdi); + } + PRINT_FIELD_X(", ", *regs, rsp); + PRINT_FIELD_X(", ", *regs, rbp); + if (abbrev(tcp)) + tprints(", ..."); + else { + PRINT_FIELD_X(", ", *regs, r8); + PRINT_FIELD_X(", ", *regs, r9); + PRINT_FIELD_X(", ", *regs, r10); + PRINT_FIELD_X(", ", *regs, r11); + PRINT_FIELD_X(", ", *regs, r12); + PRINT_FIELD_X(", ", *regs, r13); + PRINT_FIELD_X(", ", *regs, r14); + PRINT_FIELD_X(", ", *regs, r15); + } + PRINT_FIELD_X(", ", *regs, rip); + + /* TODO: we can decode this more */ + PRINT_FIELD_X(", ", *regs, rflags); + + tprints("}"); +} +#endif /* HAVE_STRUCT_KVM_REGS */ + +#ifdef HAVE_STRUCT_KVM_SREGS +static void +kvm_ioctl_decode_regs_segment(const char *prefix, + const struct kvm_segment *const segment) +{ + tprints(prefix); + PRINT_FIELD_X("={", *segment, base); + PRINT_FIELD_U(", ", *segment, limit); + PRINT_FIELD_U(", ", *segment, selector); + PRINT_FIELD_U(", ", *segment, type); + PRINT_FIELD_U(", ", *segment, present); + PRINT_FIELD_U(", ", *segment, dpl); + PRINT_FIELD_U(", ", *segment, db); + PRINT_FIELD_U(", ", *segment, s); + PRINT_FIELD_U(", ", *segment, l); + PRINT_FIELD_U(", ", *segment, g); + PRINT_FIELD_U(", ", *segment, avl); + tprints("}"); +} + +static void +kvm_ioctl_decode_regs_dtable(const char *prefix, + const struct kvm_dtable *const dtable) +{ + tprints(prefix); + PRINT_FIELD_X("={", *dtable, base); + PRINT_FIELD_U(", ", *dtable, limit); + tprints("}"); +} + +# define PRINT_FIELD_KVM_SREGS_STRUCT(prefix_, where_, type_, field_) \ + kvm_ioctl_decode_regs_ ## type_(prefix_ #field_, &(where_)->field_) + +static void +arch_print_kvm_sregs(struct tcb *const tcp, + const kernel_ulong_t addr, + const struct kvm_sregs *const sregs) +{ + PRINT_FIELD_KVM_SREGS_STRUCT("{", sregs, segment, cs); + if (abbrev(tcp)) { + tprints(", ...}"); + return; + } + + PRINT_FIELD_KVM_SREGS_STRUCT(", ", sregs, segment, ds); + PRINT_FIELD_KVM_SREGS_STRUCT(", ", sregs, segment, es); + PRINT_FIELD_KVM_SREGS_STRUCT(", ", sregs, segment, fs); + PRINT_FIELD_KVM_SREGS_STRUCT(", ", sregs, segment, gs); + PRINT_FIELD_KVM_SREGS_STRUCT(", ", sregs, segment, ss); + PRINT_FIELD_KVM_SREGS_STRUCT(", ", sregs, segment, tr); + PRINT_FIELD_KVM_SREGS_STRUCT(", ", sregs, segment, ldt); + PRINT_FIELD_KVM_SREGS_STRUCT(", ", sregs, dtable, gdt); + PRINT_FIELD_KVM_SREGS_STRUCT(", ", sregs, dtable, idt); + PRINT_FIELD_U(", ", *sregs, cr0); + PRINT_FIELD_U(", ", *sregs, cr2); + PRINT_FIELD_U(", ", *sregs, cr3); + PRINT_FIELD_U(", ", *sregs, cr4); + PRINT_FIELD_U(", ", *sregs, cr8); + PRINT_FIELD_U(", ", *sregs, efer); + PRINT_FIELD_X(", ", *sregs, apic_base); + tprints(", interrupt_bitmap=["); + + unsigned int i; + for (i = 0; i < ARRAY_SIZE(sregs->interrupt_bitmap); i++) { + if (i != 0) + tprints(", "); + tprintf("%#" PRI__x64, sregs->interrupt_bitmap[i]); + } + tprints("]}"); +} +#endif /* HAVE_STRUCT_KVM_SREGS */ diff --git a/linux/x86_64/gentab.pl b/linux/x86_64/gentab.pl deleted file mode 100644 index 52f7aa95..00000000 --- a/linux/x86_64/gentab.pl +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/perl -w -#generate syscall table from a template file (usually the master i386 syscall -#ent.h) and the x86_64 unistd.h -%conv = ( - "exit" => "_exit", -); - -%known = ( - "mmap" => "sys_mmap", - "sched_yield" => "printargs", -); - -# only used when the template file has no entry -%args = ( - "arch_prctl" => 2, - "tkill" => 2, - "gettid" => 0, - "readahead" => 3, - # should decode all these: - "setxattr" => 5, - "lsetxattr" => 5, - "fsetxattr" => 5, - "getxattr" => 4, - "lgetxattr" => 4, - "fgetxattr" => 4, - "listxattr" => 3, - "llistxattr" => 3, - "flistxattr" => 3, - "removexattr" => 2, - "lremovexattr" => 2, - "fremovexattr" => 2, - "mmap" => 6, - "sched_yield" => 0, -); - -open(F,$ARGV[0]) || die "cannot open template file $ARGV[0]\n"; - -while (<F>) { - next unless /{/; - s/\/\*.*\*\///; - ($name) = /"([^"]+)"/; - chomp; - $call{$name} = $_; -} - -open(SL, ">syscallnum.h") || die "cannot create syscallnum.h\n"; - -open(S,$ARGV[1]) || die "cannot open syscall file $ARGV[1]\n"; -while (<S>) { - $name = ""; - next unless (($name, $num) = /define\s+__NR_(\S+)\s+(\d+)/); - next if $name eq ""; - - $name = $conv{$name} if defined($conv{$name}); - - if (!defined($call{$name})) { - unless (defined($args{$name})) { - print STDERR "unknown call $name $num\n"; - $na = 3; - } else { - $na = $args{$name}; - } - if (defined($known{$name})) { - $func = $known{$name}; - } else { - $func = "printargs"; - } - print "\t{ $na,\t0,\t$func,\t\"$name\" }, /* $num */\n"; - } else { - print "$call{$name} /* $num */\n"; - } - print SL "#define SYS_$name $num\n" -} diff --git a/linux/x86_64/get_error.c b/linux/x86_64/get_error.c index 440fdc74..ac47ab58 100644 --- a/linux/x86_64/get_error.c +++ b/linux/x86_64/get_error.c @@ -20,6 +20,9 @@ get_error(struct tcb *tcp, const bool check_errno) tcp->u_rval = -1; tcp->u_error = -rax; } else { - tcp->u_rval = rax; + if (x86_io.iov_len == sizeof(i386_regs)) + tcp->u_rval = (uint32_t) rax; + else + tcp->u_rval = rax; } } diff --git a/linux/x86_64/get_scno.c b/linux/x86_64/get_scno.c index 687f8435..4b066387 100644 --- a/linux/x86_64/get_scno.c +++ b/linux/x86_64/get_scno.c @@ -5,7 +5,7 @@ * Copyright (c) 2008-2013 Denys Vlasenko <vda.linux@googlemail.com> * Copyright (c) 2012 H.J. Lu <hongjiu.lu@intel.com> * Copyright (c) 2010-2015 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2015-2017 The strace developers. + * Copyright (c) 2015-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -75,7 +75,6 @@ arch_get_scno(struct tcb *tcp) * __X32_SYSCALL_BIT logic does not apply. */ if ((long long) x86_64_regs.orig_rax != -1) { - scno -= __X32_SYSCALL_BIT; currpers = 2; } else { # ifdef X32 @@ -99,7 +98,6 @@ arch_get_scno(struct tcb *tcp) case 0x33: if (x86_64_regs.ds == 0x2b) { currpers = 2; - scno &= ~__X32_SYSCALL_BIT; } else currpers = 0; break; diff --git a/linux/x86_64/getregs_old.c b/linux/x86_64/getregs_old.c index 9f7c2489..b96a0d54 100644 --- a/linux/x86_64/getregs_old.c +++ b/linux/x86_64/getregs_old.c @@ -1,6 +1,7 @@ /* * Copyright (c) 2013 Denys Vlasenko <vda.linux@googlemail.com> * Copyright (c) 2013-2015 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2015-2017 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,10 +32,10 @@ * a PTRACE_GETREGS based fallback is provided for old kernels. */ static int -getregs_old(pid_t pid) +getregs_old(struct tcb *tcp) { /* Use old method, with unreliable heuristical detection of 32-bitness. */ - long r = ptrace(PTRACE_GETREGS, pid, NULL, &x86_64_regs); + long r = ptrace(PTRACE_GETREGS, tcp->pid, NULL, &x86_64_regs); if (r) return r; diff --git a/linux/x86_64/getregs_old.h b/linux/x86_64/getregs_old.h index 80303016..f13fe24f 100644 --- a/linux/x86_64/getregs_old.h +++ b/linux/x86_64/getregs_old.h @@ -1,2 +1,2 @@ #define HAVE_GETREGS_OLD -static int getregs_old(pid_t); +static int getregs_old(struct tcb *); diff --git a/linux/x86_64/set_error.c b/linux/x86_64/set_error.c index 6c31bd86..0c7e188c 100644 --- a/linux/x86_64/set_error.c +++ b/linux/x86_64/set_error.c @@ -10,13 +10,19 @@ static int arch_set_error(struct tcb *tcp) { #ifdef HAVE_GETREGS_OLD - x86_64_regs.rax = -(long long) tcp->u_error; - return upoke(tcp->pid, 8 * RAX, x86_64_regs.rax); + kernel_ulong_t rval = -(kernel_long_t) tcp->u_error; + + if (x86_io.iov_len == sizeof(i386_regs)) + i386_regs.eax = rval; + else + x86_64_regs.rax = rval; + + return upoke(tcp, 8 * RAX, rval); #else if (x86_io.iov_len == sizeof(i386_regs)) return i386_set_error(tcp); - x86_64_regs.rax = -(long long) tcp->u_error; + x86_64_regs.rax = -(kernel_long_t) tcp->u_error; return set_regs(tcp->pid); #endif } @@ -25,13 +31,19 @@ static int arch_set_success(struct tcb *tcp) { #ifdef HAVE_GETREGS_OLD - x86_64_regs.rax = (long long) tcp->u_rval; - return upoke(tcp->pid, 8 * RAX, x86_64_regs.rax); + kernel_ulong_t rval = (kernel_ulong_t) tcp->u_rval; + + if (x86_io.iov_len == sizeof(i386_regs)) + i386_regs.eax = rval; + else + x86_64_regs.rax = rval; + + return upoke(tcp, 8 * RAX, rval); #else if (x86_io.iov_len == sizeof(i386_regs)) return i386_set_success(tcp); - x86_64_regs.rax = (long long) tcp->u_rval; + x86_64_regs.rax = (kernel_ulong_t) tcp->u_rval; return set_regs(tcp->pid); #endif } diff --git a/linux/x86_64/set_scno.c b/linux/x86_64/set_scno.c index 6438c526..3ca402eb 100644 --- a/linux/x86_64/set_scno.c +++ b/linux/x86_64/set_scno.c @@ -8,7 +8,7 @@ static int arch_set_scno(struct tcb *tcp, kernel_ulong_t scno) { #ifdef HAVE_GETREGS_OLD - return upoke(tcp->pid, 8 * ORIG_RAX, scno); + return upoke(tcp, 8 * ORIG_RAX, scno); #else if (x86_io.iov_len == sizeof(i386_regs)) return i386_set_scno(tcp, scno); diff --git a/linux/x86_64/shuffle_scno.c b/linux/x86_64/shuffle_scno.c new file mode 100644 index 00000000..77840c23 --- /dev/null +++ b/linux/x86_64/shuffle_scno.c @@ -0,0 +1,8 @@ +kernel_ulong_t +shuffle_scno(kernel_ulong_t scno) +{ + if (current_personality == 2) + scno ^= __X32_SYSCALL_BIT; + + return scno; +} diff --git a/linux/x86_64/syscallent.h b/linux/x86_64/syscallent.h index 0fafe03c..8d95c1db 100644 --- a/linux/x86_64/syscallent.h +++ b/linux/x86_64/syscallent.h @@ -37,7 +37,7 @@ [ 36] = { 2, 0, SEN(getitimer), "getitimer" }, [ 37] = { 1, 0, SEN(alarm), "alarm" }, [ 38] = { 3, 0, SEN(setitimer), "setitimer" }, -[ 39] = { 0, NF, SEN(getpid), "getpid" }, +[ 39] = { 0, PU|NF, SEN(getpid), "getpid" }, [ 40] = { 4, TD|TN, SEN(sendfile64), "sendfile" }, [ 41] = { 3, TN, SEN(socket), "socket" }, [ 42] = { 3, TN, SEN(connect), "connect" }, @@ -100,16 +100,16 @@ [ 99] = { 1, 0, SEN(sysinfo), "sysinfo" }, [100] = { 1, 0, SEN(times), "times" }, [101] = { 4, 0, SEN(ptrace), "ptrace" }, -[102] = { 0, NF, SEN(getuid), "getuid" }, +[102] = { 0, PU|NF, SEN(getuid), "getuid" }, [103] = { 3, 0, SEN(syslog), "syslog" }, -[104] = { 0, NF, SEN(getgid), "getgid" }, +[104] = { 0, PU|NF, SEN(getgid), "getgid" }, [105] = { 1, 0, SEN(setuid), "setuid" }, [106] = { 1, 0, SEN(setgid), "setgid" }, -[107] = { 0, NF, SEN(geteuid), "geteuid" }, -[108] = { 0, NF, SEN(getegid), "getegid" }, +[107] = { 0, PU|NF, SEN(geteuid), "geteuid" }, +[108] = { 0, PU|NF, SEN(getegid), "getegid" }, [109] = { 2, 0, SEN(setpgid), "setpgid" }, -[110] = { 0, NF, SEN(getppid), "getppid" }, -[111] = { 0, 0, SEN(getpgrp), "getpgrp" }, +[110] = { 0, PU|NF, SEN(getppid), "getppid" }, +[111] = { 0, PU|NF, SEN(getpgrp), "getpgrp" }, [112] = { 0, 0, SEN(setsid), "setsid" }, [113] = { 2, 0, SEN(setreuid), "setreuid" }, [114] = { 2, 0, SEN(setregid), "setregid" }, @@ -184,7 +184,7 @@ [183] = { 5, 0, SEN(afs_syscall), "afs_syscall" }, [184] = { 3, 0, SEN(tuxcall), "tuxcall" }, [185] = { 3, 0, SEN(security), "security" }, -[186] = { 0, NF, SEN(gettid), "gettid" }, +[186] = { 0, PU|NF, SEN(gettid), "gettid" }, [187] = { 3, TD, SEN(readahead), "readahead" }, [188] = { 5, TF, SEN(setxattr), "setxattr" }, [189] = { 5, TF, SEN(setxattr), "lsetxattr" }, @@ -238,12 +238,12 @@ [237] = { 6, TM, SEN(mbind), "mbind" }, [238] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" }, [239] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" }, -[240] = { 4, 0, SEN(mq_open), "mq_open" }, +[240] = { 4, TD, SEN(mq_open), "mq_open" }, [241] = { 1, 0, SEN(mq_unlink), "mq_unlink" }, -[242] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" }, -[243] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" }, -[244] = { 2, 0, SEN(mq_notify), "mq_notify" }, -[245] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" }, +[242] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" }, +[243] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" }, +[244] = { 2, TD, SEN(mq_notify), "mq_notify" }, +[245] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" }, [246] = { 4, 0, SEN(kexec_load), "kexec_load" }, [247] = { 5, TP, SEN(waitid), "waitid" }, [248] = { 5, 0, SEN(add_key), "add_key" }, diff --git a/linux/xtensa/arch_rt_sigframe.c b/linux/xtensa/arch_rt_sigframe.c index a40c76a5..97ffe6ca 100644 --- a/linux/xtensa/arch_rt_sigframe.c +++ b/linux/xtensa/arch_rt_sigframe.c @@ -29,5 +29,5 @@ FUNC_GET_RT_SIGFRAME_ADDR { unsigned long addr; - return upeek(tcp->pid, REG_A_BASE + 3, &addr) ? 0 : addr; + return upeek(tcp, REG_A_BASE + 3, &addr) ? 0 : addr; } diff --git a/linux/xtensa/get_scno.c b/linux/xtensa/get_scno.c index d230f73b..854a2795 100644 --- a/linux/xtensa/get_scno.c +++ b/linux/xtensa/get_scno.c @@ -2,5 +2,5 @@ static int arch_get_scno(struct tcb *tcp) { - return upeek(tcp->pid, SYSCALL_NR, &tcp->scno) < 0 ? -1 : 1; + return upeek(tcp, SYSCALL_NR, &tcp->scno) < 0 ? -1 : 1; } diff --git a/linux/xtensa/get_syscall_args.c b/linux/xtensa/get_syscall_args.c index a9c933a9..2a20cdb1 100644 --- a/linux/xtensa/get_syscall_args.c +++ b/linux/xtensa/get_syscall_args.c @@ -14,7 +14,7 @@ get_syscall_args(struct tcb *tcp) unsigned int i; for (i = 0; i < tcp->s_ent->nargs; ++i) - if (upeek(tcp->pid, xtensaregs[i], &tcp->u_arg[i]) < 0) + if (upeek(tcp, xtensaregs[i], &tcp->u_arg[i]) < 0) return -1; return 1; } diff --git a/linux/xtensa/get_syscall_result.c b/linux/xtensa/get_syscall_result.c index 51ad6dea..6eb513b8 100644 --- a/linux/xtensa/get_syscall_result.c +++ b/linux/xtensa/get_syscall_result.c @@ -1,5 +1,5 @@ static int get_syscall_result_regs(struct tcb *tcp) { - return upeek(tcp->pid, REG_A_BASE + 2, &xtensa_a2) < 0 ? -1 : 0; + return upeek(tcp, REG_A_BASE + 2, &xtensa_a2) < 0 ? -1 : 0; } diff --git a/linux/xtensa/set_error.c b/linux/xtensa/set_error.c index 4eb59171..e786b8cc 100644 --- a/linux/xtensa/set_error.c +++ b/linux/xtensa/set_error.c @@ -2,12 +2,12 @@ static int arch_set_error(struct tcb *tcp) { xtensa_a2 = -tcp->u_error; - return upoke(tcp->pid, REG_A_BASE + 2, xtensa_a2); + return upoke(tcp, REG_A_BASE + 2, xtensa_a2); } static int arch_set_success(struct tcb *tcp) { xtensa_a2 = tcp->u_rval; - return upoke(tcp->pid, REG_A_BASE + 2, xtensa_a2); + return upoke(tcp, REG_A_BASE + 2, xtensa_a2); } diff --git a/linux/xtensa/set_scno.c b/linux/xtensa/set_scno.c index 54c948d3..ca442fc3 100644 --- a/linux/xtensa/set_scno.c +++ b/linux/xtensa/set_scno.c @@ -1,5 +1,5 @@ static int arch_set_scno(struct tcb *tcp, kernel_ulong_t scno) { - return upoke(tcp->pid, SYSCALL_NR, scno); + return upoke(tcp, SYSCALL_NR, scno); } diff --git a/linux/xtensa/syscallent.h b/linux/xtensa/syscallent.h index 961cdafa..4d69d2ee 100644 --- a/linux/xtensa/syscallent.h +++ b/linux/xtensa/syscallent.h @@ -113,14 +113,14 @@ [117] = { 3, TF|TP|SE|SI, SEN(execve), "execve" }, [118] = { 1, TP|SE, SEN(exit), "exit" }, [119] = { 1, TP|SE, SEN(exit), "exit_group" }, -[120] = { 0, NF, SEN(getpid), "getpid" }, +[120] = { 0, PU|NF, SEN(getpid), "getpid" }, [121] = { 4, TP, SEN(wait4), "wait4" }, [122] = { 5, TP, SEN(waitid), "waitid" }, [123] = { 2, TS, SEN(kill), "kill" }, [124] = { 2, TS, SEN(kill), "tkill" }, [125] = { 3, TS, SEN(tgkill), "tgkill" }, [126] = { 1, 0, SEN(set_tid_address), "set_tid_address" }, -[127] = { 0, NF, SEN(gettid), "gettid" }, +[127] = { 0, PU|NF, SEN(gettid), "gettid" }, [128] = { 0, 0, SEN(setsid), "setsid" }, [129] = { 1, 0, SEN(getsid), "getsid" }, [130] = { 5, 0, SEN(prctl), "prctl" }, @@ -130,11 +130,11 @@ [134] = { 3, 0, SEN(setitimer), "setitimer" }, [135] = { 2, 0, SEN(getitimer), "getitimer" }, [136] = { 1, 0, SEN(setuid), "setuid" }, -[137] = { 0, NF, SEN(getuid), "getuid" }, +[137] = { 0, PU|NF, SEN(getuid), "getuid" }, [138] = { 1, 0, SEN(setgid), "setgid" }, -[139] = { 0, NF, SEN(getgid), "getgid" }, -[140] = { 0, NF, SEN(geteuid), "geteuid" }, -[141] = { 0, NF, SEN(getegid), "getegid" }, +[139] = { 0, PU|NF, SEN(getgid), "getgid" }, +[140] = { 0, PU|NF, SEN(geteuid), "geteuid" }, +[141] = { 0, PU|NF, SEN(getegid), "getegid" }, [142] = { 2, 0, SEN(setreuid), "setreuid" }, [143] = { 2, 0, SEN(setregid), "setregid" }, [144] = { 3, 0, SEN(setresuid), "setresuid" }, @@ -143,8 +143,8 @@ [147] = { 3, 0, SEN(getresgid), "getresgid" }, [148] = { 2, 0, SEN(setpgid), "setpgid" }, [149] = { 1, 0, SEN(getpgid), "getpgid" }, -[150] = { 0, NF, SEN(getppid), "getppid" }, -[151] = { 0, 0, SEN(getpgrp), "getpgrp" }, +[150] = { 0, PU|NF, SEN(getppid), "getppid" }, +[151] = { 0, PU|NF, SEN(getpgrp), "getpgrp" }, [152 ... 153] = { }, [154] = { 1, 0, SEN(times), "times" }, [155] = { 1, TF, SEN(acct), "acct" }, @@ -222,12 +222,12 @@ [229] = { 4, TS, SEN(rt_sigtimedwait), "rt_sigtimedwait" }, [230] = { 3, TS, SEN(rt_sigqueueinfo), "rt_sigqueueinfo" }, [231] = { 2, TS, SEN(rt_sigsuspend), "rt_sigsuspend" }, -[232] = { 4, 0, SEN(mq_open), "mq_open" }, +[232] = { 4, TD, SEN(mq_open), "mq_open" }, [233] = { 1, 0, SEN(mq_unlink), "mq_unlink" }, -[234] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" }, -[235] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" }, -[236] = { 2, 0, SEN(mq_notify), "mq_notify" }, -[237] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" }, +[234] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" }, +[235] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" }, +[236] = { 2, TD, SEN(mq_notify), "mq_notify" }, +[237] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" }, [238] = { }, [239] = { 2, TM, SEN(io_setup), "io_setup" }, [240] = { 1, TM, SEN(io_destroy), "io_destroy" }, diff --git a/m4/mpers.m4 b/m4/mpers.m4 index 12446826..6b471853 100644 --- a/m4/mpers.m4 +++ b/m4/mpers.m4 @@ -2,6 +2,7 @@ # # Copyright (c) 2015-2017 Dmitry V. Levin <ldv@altlinux.org> # Copyright (c) 2015 Elvira Khabirova <lineprinter0@gmail.com> +# Copyright (c) 2015-2018 The strace developers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -82,13 +83,16 @@ pushdef([mpers_name], [$1]) pushdef([MPERS_NAME], translit([$1], [a-z], [A-Z])) pushdef([HAVE_MPERS], [HAVE_]MPERS_NAME[_MPERS]) pushdef([HAVE_RUNTIME], [HAVE_]MPERS_NAME[_RUNTIME]) -pushdef([CFLAG], [-$1]) +pushdef([MPERS_CFLAGS], [$cc_flags_$1]) pushdef([st_cv_cc], [st_cv_$1_cc]) pushdef([st_cv_runtime], [st_cv_$1_runtime]) pushdef([st_cv_mpers], [st_cv_$1_mpers]) case "$arch" in [$2]) + case "$enable_mpers" in + yes|check|[$1]) + AH_TEMPLATE([HAVE_GNU_STUBS_32_H], [Define to 1 if you have the <gnu/stubs-32.h> header file.]) AH_TEMPLATE([HAVE_GNU_STUBS_X32_H], @@ -101,29 +105,32 @@ case "$arch" in IFLAG=-I.]) popdef([gnu_stubs]) saved_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS CFLAG $IFLAG" - AC_CACHE_CHECK([for CFLAG compile support], [st_cv_cc], + CFLAGS="$CFLAGS MPERS_CFLAGS $IFLAG" + AC_CACHE_CHECK([for mpers_name personality compile support], [st_cv_cc], [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdint.h> int main(){return 0;}]])], [st_cv_cc=yes], [st_cv_cc=no])]) if test $st_cv_cc = yes; then - AC_CACHE_CHECK([for CFLAG runtime support], [st_cv_runtime], + AC_CACHE_CHECK([for mpers_name personality runtime support], + [st_cv_runtime], [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdint.h> int main(){return 0;}]])], [st_cv_runtime=yes], [st_cv_runtime=no], [st_cv_runtime=no])]) - AC_CACHE_CHECK([whether mpers.sh CFLAG works], [st_cv_mpers], - [if CC="$CC" CPP="$CPP" CPPFLAGS="$CPPFLAGS" \ - $srcdir/mpers_test.sh [$1]; then + AC_CACHE_CHECK([whether mpers.sh mpers_name MPERS_CFLAGS works], + [st_cv_mpers], + [if READELF="$READELF" \ + CC="$CC" CPP="$CPP" CPPFLAGS="$CPPFLAGS" \ + $srcdir/mpers_test.sh [$1] MPERS_CFLAGS; then st_cv_mpers=yes else st_cv_mpers=no fi]) if test $st_cv_mpers = yes; then AC_DEFINE(HAVE_MPERS, [1], - [Define to 1 if you have CFLAG mpers support]) + [Define to 1 if you have mpers_name mpers support]) st_MPERS_STRUCT_STAT([]) st_MPERS_STRUCT_STAT([64]) @@ -148,7 +155,25 @@ case "$arch" in CFLAGS="$saved_CFLAGS" ;; - *) + *) # case "$enable_mpers" + st_cv_runtime=no + st_cv_mpers=no + ;; + esac + + test "$st_cv_mpers" = yes || + st_cv_mpers=no + AC_MSG_CHECKING([whether to enable $1 personality support]) + AC_MSG_RESULT([$st_cv_mpers]) + + case "$enable_mpers,$st_cv_mpers" in + yes,no|[$1],no) + AC_MSG_ERROR([Cannot enable $1 personality support]) + ;; + esac + ;; + + *) # case "$arch" st_cv_runtime=no st_cv_mpers=no ;; @@ -160,7 +185,7 @@ AM_CONDITIONAL(HAVE_MPERS, [test "$st_cv_mpers" = yes]) popdef([st_cv_mpers]) popdef([st_cv_runtime]) popdef([st_cv_cc]) -popdef([CFLAG]) +popdef([MPERS_CFLAGS]) popdef([HAVE_RUNTIME]) popdef([HAVE_MPERS]) popdef([MPERS_NAME]) @@ -5,7 +5,7 @@ * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl> * Copyright (c) 2000 PocketPenguins Inc. Linux for Hitachi SuperH * port by Greg Banks <gbanks@pocketpenguins.com> - * Copyright (c) 1999-2017 The strace developers. + * Copyright (c) 1999-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,7 +32,7 @@ */ #include "defs.h" -#include <asm/mman.h> +#include <linux/mman.h> #include <sys/mman.h> unsigned long @@ -55,6 +55,31 @@ SYS_FUNC(brk) #include "xlat/mmap_prot.h" #include "xlat/mmap_flags.h" +#ifndef MAP_HUGE_SHIFT +# define MAP_HUGE_SHIFT 26 +#endif + +#ifndef MAP_HUGE_MASK +# define MAP_HUGE_MASK 0x3f +#endif + +static void +print_mmap_flags(kernel_ulong_t flags) +{ + printxval64(mmap_flags, flags & MAP_TYPE, "MAP_???"); + flags &= ~MAP_TYPE; + + const unsigned int mask = MAP_HUGE_MASK << MAP_HUGE_SHIFT; + const unsigned int hugetlb_value = flags & mask; + + flags &= ~mask; + addflags(mmap_flags, flags); + + if (hugetlb_value) + tprintf("|%u<<MAP_HUGE_SHIFT", + hugetlb_value >> MAP_HUGE_SHIFT); +} + static void print_mmap(struct tcb *tcp, kernel_ulong_t *u_arg, unsigned long long offset) { @@ -68,12 +93,7 @@ print_mmap(struct tcb *tcp, kernel_ulong_t *u_arg, unsigned long long offset) tprintf(", %" PRI_klu ", ", len); printflags64(mmap_prot, prot, "PROT_???"); tprints(", "); -#ifdef MAP_TYPE - printxval64(mmap_flags, flags & MAP_TYPE, "MAP_???"); - addflags(mmap_flags, flags & ~MAP_TYPE); -#else - printflags64(mmap_flags, flags, "MAP_???"); -#endif + print_mmap_flags(flags); tprints(", "); printfd(tcp, fd); tprintf(", %#llx", offset); @@ -87,51 +107,43 @@ print_mmap(struct tcb *tcp, kernel_ulong_t *u_arg, unsigned long long offset) * Confused? Me too! */ -#if defined AARCH64 || defined ARM \ - || defined I386 || defined X86_64 || defined X32 \ - || defined M68K \ - || defined S390 || defined S390X +#if HAVE_ARCH_OLD_MMAP /* Params are pointed to by u_arg[0], offset is in bytes */ SYS_FUNC(old_mmap) { - kernel_ulong_t u_arg[6]; -# if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG - /* We are here only in a 32-bit personality. */ - unsigned int narrow_arg[6]; - if (umove_or_printaddr(tcp, tcp->u_arg[0], &narrow_arg)) - return RVAL_DECODED | RVAL_HEX; - unsigned int i; - for (i = 0; i < 6; i++) - u_arg[i] = narrow_arg[i]; -# else - if (umove_or_printaddr(tcp, tcp->u_arg[0], &u_arg)) - return RVAL_DECODED | RVAL_HEX; -# endif - print_mmap(tcp, u_arg, u_arg[5]); + kernel_ulong_t *args = + fetch_indirect_syscall_args(tcp, tcp->u_arg[0], 6); + + if (args) + print_mmap(tcp, args, args[5]); + else + printaddr(tcp->u_arg[0]); return RVAL_DECODED | RVAL_HEX; } -#endif /* old_mmap architectures */ -#ifdef S390 +# if HAVE_ARCH_OLD_MMAP_PGOFF /* Params are pointed to by u_arg[0], offset is in pages */ SYS_FUNC(old_mmap_pgoff) { - kernel_ulong_t u_arg[5]; - int i; - unsigned int narrow_arg[6]; - unsigned long long offset; - if (umove_or_printaddr(tcp, tcp->u_arg[0], &narrow_arg)) - return RVAL_DECODED | RVAL_HEX; - for (i = 0; i < 5; i++) - u_arg[i] = narrow_arg[i]; - offset = narrow_arg[5]; - offset *= get_pagesize(); - print_mmap(tcp, u_arg, offset); + kernel_ulong_t *args = + fetch_indirect_syscall_args(tcp, tcp->u_arg[0], 6); + + if (args) { + unsigned long long offset; + + offset = args[5]; + offset *= get_pagesize(); + + print_mmap(tcp, args, offset); + } else { + printaddr(tcp->u_arg[0]); + } return RVAL_DECODED | RVAL_HEX; } -#endif /* S390 */ +# endif /* HAVE_ARCH_OLD_MMAP_PGOFF */ +#endif /* HAVE_ARCH_OLD_MMAP */ /* Params are passed directly, offset is in bytes */ SYS_FUNC(mmap) @@ -297,14 +309,6 @@ SYS_FUNC(mincore) return 0; } -#if defined ALPHA || defined IA64 || defined M68K \ - || defined SPARC || defined SPARC64 -SYS_FUNC(getpagesize) -{ - return RVAL_DECODED | RVAL_HEX; -} -#endif - SYS_FUNC(remap_file_pages) { const kernel_ulong_t addr = tcp->u_arg[0]; @@ -317,12 +321,7 @@ SYS_FUNC(remap_file_pages) tprintf(", %" PRI_klu ", ", size); printflags64(mmap_prot, prot, "PROT_???"); tprintf(", %" PRI_klu ", ", pgoff); -#ifdef MAP_TYPE - printxval64(mmap_flags, flags & MAP_TYPE, "MAP_???"); - addflags(mmap_flags, flags & ~MAP_TYPE); -#else - printflags64(mmap_flags, flags, "MAP_???"); -#endif + print_mmap_flags(flags); return RVAL_DECODED; } diff --git a/memfd_create.c b/memfd_create.c index 1691352c..1f6a6d6d 100644 --- a/memfd_create.c +++ b/memfd_create.c @@ -28,13 +28,37 @@ #include "defs.h" +#ifdef HAVE_LINUX_MEMFD_H +# include <linux/memfd.h> +#endif + #include "xlat/memfd_create_flags.h" +#ifndef MFD_HUGE_SHIFT +# define MFD_HUGE_SHIFT 26 +#endif + +#ifndef MFD_HUGE_MASK +# define MFD_HUGE_MASK 0x3f +#endif + SYS_FUNC(memfd_create) { - printstr(tcp, tcp->u_arg[0]); + printpathn(tcp, tcp->u_arg[0], 255 - (sizeof("memfd:") - 1)); tprints(", "); - printflags(memfd_create_flags, tcp->u_arg[1], "MFD_???"); + + unsigned int flags = tcp->u_arg[1]; + const unsigned int mask = MFD_HUGE_MASK << MFD_HUGE_SHIFT; + const unsigned int hugetlb_value = flags & mask; + flags &= ~mask; + + if (flags || !hugetlb_value) + printflags(memfd_create_flags, flags, "MFD_???"); + + if (hugetlb_value) + tprintf("%s%u<<MFD_HUGE_SHIFT", + flags ? "|" : "", + hugetlb_value >> MFD_HUGE_SHIFT); return RVAL_DECODED | RVAL_FD; } @@ -3,6 +3,7 @@ * Copyright (c) 2012-2013 Denys Vlasenko <vda.linux@googlemail.com> * Copyright (c) 2014 Masatake YAMATO <yamato@redhat.com> * Copyright (c) 2010-2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,6 +31,7 @@ #include "defs.h" #include "msghdr.h" +#include "xstring.h" #include <limits.h> static int @@ -240,8 +242,7 @@ SYS_FUNC(recvmmsg) return 0; /* timeout on exit */ static char str[sizeof("left") + TIMESPEC_TEXT_BUFSIZE]; - snprintf(str, sizeof(str), "left %s", - sprint_timespec(tcp, tcp->u_arg[4])); + xsprintf(str, "left %s", sprint_timespec(tcp, tcp->u_arg[4])); tcp->auxstr = str; return RVAL_STR; } @@ -2,7 +2,7 @@ # # Copyright (c) 2015 Elvira Khabirova <lineprinter0@gmail.com> # Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org> -# Copyright (c) 2015-2017 The strace developers. +# Copyright (c) 2015-2018 The strace developers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -27,19 +27,10 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -function compare_indices(i1, v1, i2, v2, \ - c1, c2) -{ - c1 = strtonum(sprintf("%s", i1)) - c2 = strtonum(sprintf("%s", i2)) - if (c1 < c2) - return -1 - return (c1 != c2) -} function array_get(array_idx, array_member, \ array_return) { - array_return = array[array_idx][array_member] + array_return = array[array_idx, array_member] if ("" == array_return) { printf("%s: index [%s] without %s\n", FILENAME, array_idx, array_member) > "/dev/stderr" @@ -47,12 +38,16 @@ function array_get(array_idx, array_member, \ } return array_return } +function norm_idx(idx) +{ + return sprintf("%016s", idx) +} function array_seq(array_idx) { - if ("seq" in array[array_idx]) - return array[array_idx]["seq"] + if ((array_idx, "seq") in array) + return array[array_idx, "seq"] index_seq++ - array[array_idx]["seq"] = index_seq + array[array_idx, "seq"] = index_seq return index_seq } function enter(array_idx, @@ -75,72 +70,63 @@ function leave(array_idx, to_return) function update_upper_bound(idx, val, \ count) { - count = array[idx]["count"] + count = array[idx, "count"] if (count == "") count = 1 - array[idx]["count"] = count * val - array[idx]["upper_bound"] = array[idx]["upper_bound"] "[" val "]" + array[idx, "count"] = count * val + array[idx, "upper_bound"] = array[idx, "upper_bound"] "[" val "]" } function what_is(what_idx, \ item, loc_diff, location, prev_location, prev_returned_size, \ - special, to_return, type_idx) + special, to_return, type_idx, enc, i) { enter(what_idx) special = array_get(what_idx, "special") - switch (special) { - case "base_type": - switch (array_get(what_idx, "encoding")) { - case 5: # signed + if (special == "base_type") { + enc = array_get(what_idx, "encoding") + if (enc == 5) { # signed printf("int%s_t ", 8 * array_get(what_idx, "byte_size")) - break - case 7: # unsigned + } else if (enc == 7) { # unsigned printf("uint%s_t ", 8 * array_get(what_idx, "byte_size")) - break - default: # float, signed/unsigned char + } else { # float, signed/unsigned char printf("%s ", array_get(what_idx, "name")) - break } returned_size = array_get(what_idx, "byte_size") - break - case "enumeration_type": + } else if (special == "enumeration_type") { returned_size = array_get(what_idx, "byte_size") printf("uint%s_t ", 8 * returned_size) - break - case "pointer_type": + } else if (special == "pointer_type") { printf("mpers_ptr_t ") returned_size = array_get(what_idx, "byte_size") - break - case "array_type": + } else if (special == "array_type") { type_idx = array_get(what_idx, "type") what_is(type_idx) - to_return = array[what_idx]["upper_bound"] + to_return = array[what_idx, "upper_bound"] if ("" == to_return) to_return = "[0]" - returned_size = array[what_idx]["count"] * returned_size + returned_size = array[what_idx, "count"] * returned_size return leave(what_idx, to_return) - break - case "structure_type": + } else if (special == "structure_type") { print "struct {" prev_location = 0 location = 0 returned_size = 0 prev_returned_size = 0 - for (item in array) { - if ("parent" in array[item] && \ - array_get(item, "parent") == what_idx) { - location = array_get(item, "location") + for (i = 1; i <= parents_cnt; i += 1) { + if (array_parents[aparents_keys[i]] == what_idx) { + location = array_get(aparents_keys[i], "location") loc_diff = location - prev_location - \ prev_returned_size if (loc_diff != 0) { printf("unsigned char mpers_%s_%s[%s];\n", - "filler", array_seq(item), loc_diff) + "filler", array_seq(aparents_keys[i]), loc_diff) } prev_location = location - returned = what_is(item) + returned = what_is(aparents_keys[i]) prev_returned_size = returned_size - printf("%s%s;\n", array[item]["name"], returned) + printf("%s%s;\n", array[aparents_keys[i], "name"], returned) } } returned_size = array_get(what_idx, "byte_size") @@ -150,31 +136,25 @@ function what_is(what_idx, \ "end_filler", array_seq(item), loc_diff) } printf("} ATTRIBUTE_PACKED ") - break - case "union_type": + } else if (special == "union_type") { print "union {" - for (item in array) { - if ("parent" in array[item] && \ - array_get(item, "parent") == what_idx) { - returned = what_is(item) - printf("%s%s;\n", array[item]["name"], returned) + for (i = 1; i <= parents_cnt; i += 1) { + if (array_parents[aparents_keys[i]] == what_idx) { + returned = what_is(aparents_keys[i]) + printf("%s%s;\n", array[aparents_keys[i], "name"], returned) } } printf("} ") returned_size = array_get(what_idx, "byte_size") - break - case "typedef": + } else if (special == "typedef") { type_idx = array_get(what_idx, "type") return leave(what_idx, what_is(type_idx)) - break - case "member": + } else if (special == "member") { type_idx = array_get(what_idx, "type") return leave(what_idx, what_is(type_idx)) - break - default: + } else { type_idx = array_get(what_idx, "type") what_is(type_idx) - break } return leave(what_idx, "") } @@ -186,31 +166,32 @@ BEGIN { /^<[[:xdigit:]]+>/ { match($0, /([[:alnum:]]+)><([[:alnum:]]+)/, matches) level = matches[1] - idx = "0x" matches[2] - array[idx]["idx"] = idx + idx = norm_idx(matches[2]) + array[idx, "idx"] = idx parent[level] = idx } /^DW_AT_data_member_location/ { if (!match($0, /\(DW_OP_plus_uconst:[[:space:]]+([[:digit:]]+)\)/, temparray)) match($0, /([[:digit:]]+)/, temparray) - array[idx]["location"] = temparray[1] + array[idx, "location"] = temparray[1] } /^DW_AT_name/ { match($0, /:[[:space:]]+([[:alpha:]_][[:alnum:]_[:space:]]*)/, \ temparray) - array[idx]["name"] = temparray[1] + array_names[idx] = 1 + array[idx, "name"] = temparray[1] } /^DW_AT_byte_size/ { match($0, /[[:digit:]]+/, temparray) - array[idx]["byte_size"] = temparray[0] + array[idx, "byte_size"] = temparray[0] } /^DW_AT_encoding/ { match($0, /[[:digit:]]+/, temparray) - array[idx]["encoding"] = temparray[0] + array[idx, "encoding"] = temparray[0] } /^DW_AT_type/ { - match($0, /:[[:space:]]+<(0x[[:xdigit:]]*)>$/, temparray) - array[idx]["type"] = temparray[1] + match($0, /:[[:space:]]+<0x([[:xdigit:]]*)>$/, temparray) + array[idx, "type"] = norm_idx(temparray[1]) } /^DW_AT_upper_bound/ { match($0, /[[:digit:]]+/, temparray) @@ -223,24 +204,30 @@ BEGIN { /^Abbrev Number:[^(]+\(DW_TAG_/ { if (match($0, /typedef|union_type|structure_type|pointer_type\ |enumeration_type|array_type|base_type|member/, temparray)) { - array[idx]["special"] = temparray[0] + array_special[idx] = temparray[0] + array[idx, "special"] = temparray[0] if ("pointer_type" == temparray[0]) - array[idx]["byte_size"] = default_pointer_size + array[idx, "byte_size"] = default_pointer_size if (level > 1 && "member" == temparray[0]) - array[idx]["parent"] = parent[level-1] + array_parents[idx] = parent[level-1] } } END { - PROCINFO["sorted_in"] = "compare_indices" - for (item in array) { - if (array[item]["special"] == "pointer_type") { - print "typedef uint" \ - 8 * array_get(item, "byte_size") "_t mpers_ptr_t;" + parents_cnt = asorti(array_parents, aparents_keys) + + for (item in array_special) { + if (array[item, "special"] == "pointer_type") { + mpers_ptr_t = \ + "uint" 8 * array_get(item, "byte_size") "_t" + print "#ifndef mpers_ptr_t_is_" mpers_ptr_t + print "typedef " mpers_ptr_t " mpers_ptr_t;" + print "#define mpers_ptr_t_is_" mpers_ptr_t + print "#endif" break } } - for (item in array) { - if (array[item]["name"] == VAR_NAME) { + for (item in array_names) { + if (array[item, "name"] == VAR_NAME) { type = array_get(item, "type") print "typedef" what_is(type) @@ -1,7 +1,7 @@ #!/bin/sh -e # # Copyright (c) 2015 Elvira Khabirova <lineprinter0@gmail.com> -# Copyright (c) 2015-2017 The strace developers. +# Copyright (c) 2015-2018 The strace developers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -30,15 +30,17 @@ export LC_ALL=C MPERS_AWK="${0%/*}/mpers.awk" ARCH_FLAG=$1 -PARSER_FILE=$2 +CC_ARCH_FLAG=$2 +PARSER_FILE=$3 +READELF="${READELF:-readelf}" CC="${CC-gcc}" CFLAGS="$CFLAGS -gdwarf-2 -c" CPP="${CPP-$CC -E}" CPPFLAGS="$CPPFLAGS -MM -MG" VAR_NAME='mpers_target_var' -BITS_DIR="mpers${ARCH_FLAG}" +BITS_DIR="mpers-${ARCH_FLAG}" mkdir -p ${BITS_DIR} set -- $(sed -r -n \ @@ -61,8 +63,8 @@ for m_type; do grep -F -q "${m_type}.h" "${f_i}" || continue sed -i -e '/DEF_MPERS_TYPE/d' "${f_c}" - $CC $CFLAGS $ARCH_FLAG "${f_c}" -o "${f_o}" - readelf --debug-dump=info "${f_o}" > "${f_d1}" + $CC $CFLAGS $CC_ARCH_FLAG "${f_c}" -o "${f_o}" + $READELF --debug-dump=info "${f_o}" > "${f_d1}" sed -r -n ' /^[[:space:]]*<1>/,/^[[:space:]]*<1><[^>]+>: Abbrev Number: 0/!d /^[[:space:]]*<[^>]*><[^>]*>: Abbrev Number: 0/d @@ -70,6 +72,6 @@ for m_type; do s/^[[:space:]]*((<[[:xdigit:]]+>){2}):[[:space:]]+/\1\n/ s/[[:space:]]+$// p' "${f_d1}" > "${f_d2}" - gawk -v VAR_NAME="$VAR_NAME" -v ARCH_FLAG="${ARCH_FLAG#-}" \ + gawk -v VAR_NAME="$VAR_NAME" -v ARCH_FLAG="${ARCH_FLAG}" \ -f "$MPERS_AWK" "${f_d2}" > "${f_h}" done diff --git a/mpers_test.sh b/mpers_test.sh index 66588eea..982f0a02 100755 --- a/mpers_test.sh +++ b/mpers_test.sh @@ -2,7 +2,7 @@ # # Copyright (c) 2015 Elvira Khabirova <lineprinter0@gmail.com> # Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org> -# Copyright (c) 2015-2017 The strace developers. +# Copyright (c) 2015-2018 The strace developers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -28,6 +28,7 @@ # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. mpers_name="$1"; shift +mpers_cc_flags="$1"; shift size="$(printf %s "$mpers_name" |tr -cd '[0-9]')" [ "$size" -gt 0 ] @@ -80,9 +81,13 @@ typedef struct { EOF expected="$mpers_dir/sample.expected" +mpers_ptr_t="uint${size}_t" cat > "$expected" <<EOF #include <inttypes.h> -typedef uint${size}_t mpers_ptr_t; +#ifndef mpers_ptr_t_is_${mpers_ptr_t} +typedef ${mpers_ptr_t} mpers_ptr_t; +#define mpers_ptr_t_is_${mpers_ptr_t} +#endif typedef struct { struct { @@ -124,5 +129,5 @@ EOF CFLAGS="$CPPFLAGS -I${srcdir} -DMPERS_IS_${mpers_name}" \ CPPFLAGS="$CPPFLAGS -I${srcdir} -DIN_MPERS -DMPERS_IS_${mpers_name}" \ -"$mpers_sh" "-$mpers_name" "$sample" +"$mpers_sh" "$mpers_name" "$mpers_cc_flags" "$sample" cmp "$expected" "$mpers_dir"/sample_struct.h > /dev/null @@ -1,7 +1,7 @@ /* * Copyright (c) 2004 Ulrich Drepper <drepper@redhat.com> * Copyright (c) 2005-2015 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2015-2017 The strace developers. + * Copyright (c) 2015-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,12 +43,13 @@ SYS_FUNC(mq_open) tprints(", "); printmqattr(tcp, tcp->u_arg[3], false); } - return RVAL_DECODED; + return RVAL_DECODED | RVAL_FD; } SYS_FUNC(mq_timedsend) { - tprintf("%d, ", (int) tcp->u_arg[0]); + printfd(tcp, tcp->u_arg[0]); + tprints(", "); printstrn(tcp, tcp->u_arg[1], tcp->u_arg[2]); tprintf(", %" PRI_klu ", %u, ", tcp->u_arg[2], (unsigned int) tcp->u_arg[3]); @@ -59,7 +60,8 @@ SYS_FUNC(mq_timedsend) SYS_FUNC(mq_timedreceive) { if (entering(tcp)) { - tprintf("%d, ", (int) tcp->u_arg[0]); + printfd(tcp, tcp->u_arg[0]); + tprints(", "); } else { if (syserror(tcp)) printaddr(tcp->u_arg[1]); @@ -82,7 +84,8 @@ SYS_FUNC(mq_timedreceive) SYS_FUNC(mq_notify) { - tprintf("%d, ", (int) tcp->u_arg[0]); + printfd(tcp, tcp->u_arg[0]); + tprints(", "); print_sigevent(tcp, tcp->u_arg[1]); return RVAL_DECODED; } @@ -90,7 +93,8 @@ SYS_FUNC(mq_notify) SYS_FUNC(mq_getsetattr) { if (entering(tcp)) { - tprintf("%d, ", (int) tcp->u_arg[0]); + printfd(tcp, tcp->u_arg[0]); + tprints(", "); printmqattr(tcp, tcp->u_arg[1], true); tprints(", "); } else { @@ -262,12 +262,12 @@ print_cmsg_type_data(struct tcb *tcp, const int cmsg_level, const int cmsg_type, } static unsigned int -get_optmem_max(void) +get_optmem_max(struct tcb *tcp) { static int optmem_max; if (!optmem_max) { - if (read_int_from_file("/proc/sys/net/core/optmem_max", + if (read_int_from_file(tcp, "/proc/sys/net/core/optmem_max", &optmem_max) || optmem_max <= 0) { optmem_max = sizeof(long long) * (2 * IOV_MAX + 512); } else { @@ -293,8 +293,8 @@ decode_msg_control(struct tcb *const tcp, const kernel_ulong_t addr, #endif sizeof(struct cmsghdr); - unsigned int control_len = in_control_len > get_optmem_max() - ? get_optmem_max() : in_control_len; + unsigned int control_len = in_control_len > get_optmem_max(tcp) + ? get_optmem_max(tcp) : in_control_len; unsigned int buf_len = control_len; char *buf = buf_len < cmsg_size ? NULL : malloc(buf_len); if (!buf || umoven(tcp, addr, buf_len, buf) < 0) { @@ -27,28 +27,27 @@ #include "defs.h" -#include DEF_MPERS_TYPE(struct_mtd_oob_buf) +#ifdef HAVE_STRUCT_MTD_WRITE_REQ -#include <linux/ioctl.h> +# include DEF_MPERS_TYPE(struct_mtd_oob_buf) -/* The mtd api changes quickly, so we have to keep a local copy */ -#include <linux/version.h> -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) -# include "mtd-abi.h" -#else +# include <linux/ioctl.h> # include <mtd/mtd-abi.h> -#endif typedef struct mtd_oob_buf struct_mtd_oob_buf; +#endif /* HAVE_STRUCT_MTD_WRITE_REQ */ + #include MPERS_DEFS -#include "xlat/mtd_mode_options.h" -#include "xlat/mtd_file_mode_options.h" -#include "xlat/mtd_type_options.h" -#include "xlat/mtd_flags_options.h" -#include "xlat/mtd_otp_options.h" -#include "xlat/mtd_nandecc_options.h" +#ifdef HAVE_STRUCT_MTD_WRITE_REQ + +# include "xlat/mtd_mode_options.h" +# include "xlat/mtd_file_mode_options.h" +# include "xlat/mtd_type_options.h" +# include "xlat/mtd_flags_options.h" +# include "xlat/mtd_otp_options.h" +# include "xlat/mtd_nandecc_options.h" static void decode_erase_info_user(struct tcb *const tcp, const kernel_ulong_t addr) @@ -362,3 +361,5 @@ MPERS_PRINTER_DECL(int, mtd_ioctl, struct tcb *const tcp, return RVAL_IOCTL_DECODED; } + +#endif /* HAVE_STRUCT_MTD_WRITE_REQ */ diff --git a/negated_errno.h b/negated_errno.h index 9ec851b0..cdc02100 100644 --- a/negated_errno.h +++ b/negated_errno.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2015-2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2017-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,8 +36,7 @@ static inline bool is_negated_errno(kernel_ulong_t val) { - /* Linux kernel defines MAX_ERRNO to 4095. */ - kernel_ulong_t max = -(kernel_long_t) 4095; + kernel_ulong_t max = -(kernel_long_t) MAX_ERRNO_VALUE; #ifndef current_klongsize if (current_klongsize < sizeof(val)) { @@ -3,7 +3,7 @@ * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl> * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com> * Copyright (c) 1996-2000 Wichert Akkerman <wichert@cistron.nl> - * Copyright (c) 1999-2017 The strace developers. + * Copyright (c) 1999-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -354,7 +354,7 @@ do_pipe(struct tcb *tcp, int flags_arg) SYS_FUNC(pipe) { -#ifdef HAVE_GETRVAL2 +#if HAVE_ARCH_GETRVAL2 if (exiting(tcp) && !syserror(tcp)) printpair_fd(tcp, tcp->u_rval, getrval2(tcp)); return 0; @@ -390,8 +390,9 @@ SYS_FUNC(socketpair) #include "xlat/getsockipv6options.h" #include "xlat/setsockipv6options.h" #include "xlat/sockipxoptions.h" -#include "xlat/sockrawoptions.h" +#include "xlat/socknetlinkoptions.h" #include "xlat/sockpacketoptions.h" +#include "xlat/sockrawoptions.h" #include "xlat/socksctpoptions.h" #include "xlat/socktcpoptions.h" @@ -431,6 +432,9 @@ print_sockopt_fd_level_name(struct tcb *tcp, int fd, unsigned int level, case SOL_RAW: printxval(sockrawoptions, name, "RAW_???"); break; + case SOL_NETLINK: + printxval(socknetlinkoptions, name, "NETLINK_???"); + break; /* Other SOL_* protocol levels still need work. */ @@ -552,27 +556,35 @@ print_icmp_filter(struct tcb *const tcp, const kernel_ulong_t addr, int len) tprints(")"); } +static bool +print_uint32(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data) +{ + tprintf("%u", *(uint32_t *) elem_buf); + + return true; +} + static void print_getsockopt(struct tcb *const tcp, const unsigned int level, const unsigned int name, const kernel_ulong_t addr, - const int len) + const int ulen, const int rlen) { if (addr && verbose(tcp)) switch (level) { case SOL_SOCKET: switch (name) { case SO_LINGER: - print_get_linger(tcp, addr, len); + print_get_linger(tcp, addr, rlen); return; #ifdef SO_PEERCRED case SO_PEERCRED: - print_ucred(tcp, addr, len); + print_ucred(tcp, addr, rlen); return; #endif #ifdef SO_ATTACH_FILTER case SO_ATTACH_FILTER: - if (len && (unsigned short) len == (unsigned int) len) - print_sock_fprog(tcp, addr, len); + if (rlen && (unsigned short) rlen == (unsigned int) rlen) + print_sock_fprog(tcp, addr, rlen); else printaddr(addr); return; @@ -584,7 +596,7 @@ print_getsockopt(struct tcb *const tcp, const unsigned int level, switch (name) { #ifdef PACKET_STATISTICS case PACKET_STATISTICS: - print_tpacket_stats(tcp, addr, len); + print_tpacket_stats(tcp, addr, rlen); return; #endif } @@ -593,19 +605,44 @@ print_getsockopt(struct tcb *const tcp, const unsigned int level, case SOL_RAW: switch (name) { case ICMP_FILTER: - print_icmp_filter(tcp, addr, len); + print_icmp_filter(tcp, addr, rlen); return; } break; + + case SOL_NETLINK: + if (ulen < 0 || rlen < 0) { + /* + * As the kernel neither accepts nor returns a negative + * length, in case of successful getsockopt syscall + * invocation these negative values must have come + * from userspace. + */ + printaddr(addr); + return; + } + switch (name) { + case NETLINK_LIST_MEMBERSHIPS: { + uint32_t buf; + print_array(tcp, addr, MIN(ulen, rlen) / sizeof(buf), + &buf, sizeof(buf), + umoven_or_printaddr, print_uint32, 0); + break; + } + default: + printnum_int(tcp, addr, "%d"); + break; + } + return; } /* default arg printing */ if (verbose(tcp)) { - if (len == sizeof(int)) { + if (rlen == sizeof(int)) { printnum_int(tcp, addr, "%d"); } else { - printstrn(tcp, addr, len); + printstrn(tcp, addr, rlen); } } else { printaddr(addr); @@ -638,7 +675,7 @@ SYS_FUNC(getsockopt) tprintf(", [%d]", ulen); } else { print_getsockopt(tcp, tcp->u_arg[1], tcp->u_arg[2], - tcp->u_arg[3], rlen); + tcp->u_arg[3], ulen, rlen); if (ulen != rlen) tprintf(", [%d->%d]", ulen, rlen); else @@ -821,6 +858,13 @@ print_setsockopt(struct tcb *const tcp, const unsigned int level, return; } break; + + case SOL_NETLINK: + if (len < (int) sizeof(int)) + printaddr(addr); + else + printnum_int(tcp, addr, "%d"); + return; } /* default arg printing */ @@ -107,7 +107,7 @@ get_fd_nl_family(struct tcb *const tcp, const int fd) } static void -decode_nlmsg_type_default(const struct xlat *const xlat, +decode_nlmsg_type_default(struct tcb *tcp, const struct xlat *const xlat, const uint16_t type, const char *const dflt) { @@ -115,11 +115,11 @@ decode_nlmsg_type_default(const struct xlat *const xlat, } static void -decode_nlmsg_type_generic(const struct xlat *const xlat, +decode_nlmsg_type_generic(struct tcb *tcp, const struct xlat *const xlat, const uint16_t type, const char *const dflt) { - printxval(genl_families_xlat(), type, dflt); + printxval(genl_families_xlat(tcp), type, dflt); } static const struct { @@ -155,7 +155,7 @@ static const struct { }; static void -decode_nlmsg_type_netfilter(const struct xlat *const xlat, +decode_nlmsg_type_netfilter(struct tcb *tcp, const struct xlat *const xlat, const uint16_t type, const char *const dflt) { @@ -183,7 +183,7 @@ decode_nlmsg_type_netfilter(const struct xlat *const xlat, tprintf("%#x", msg_type); } -typedef void (*nlmsg_types_decoder_t)(const struct xlat *, +typedef void (*nlmsg_types_decoder_t)(struct tcb *, const struct xlat *, uint16_t type, const char *dflt); @@ -215,7 +215,8 @@ static const struct { * for family here to filter out -1. */ static void -decode_nlmsg_type(const uint16_t type, const unsigned int family) +decode_nlmsg_type(struct tcb *tcp, const uint16_t type, + const unsigned int family) { nlmsg_types_decoder_t decoder = decode_nlmsg_type_default; const struct xlat *xlat = netlink_types; @@ -234,7 +235,7 @@ decode_nlmsg_type(const uint16_t type, const unsigned int family) dflt = nlmsg_types[family].dflt; } - decoder(xlat, type, dflt); + decoder(tcp, xlat, type, dflt); } static const struct xlat * @@ -443,7 +444,7 @@ print_nlmsghdr(struct tcb *tcp, tprintf("{len=%u, type=", nlmsghdr->nlmsg_len); - decode_nlmsg_type(nlmsghdr->nlmsg_type, family); + decode_nlmsg_type(tcp, nlmsghdr->nlmsg_type, family); tprints(", flags="); decode_nlmsg_flags(nlmsghdr->nlmsg_flags, diff --git a/netlink_inet_diag.c b/netlink_inet_diag.c index cffe3f5a..a54ba221 100644 --- a/netlink_inet_diag.c +++ b/netlink_inet_diag.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2016 Fabien Siron <fabien.siron@epita.fr> * Copyright (c) 2017 JingPiao Chen <chenjingpiao@gmail.com> - * Copyright (c) 2017 The strace developers. + * Copyright (c) 2017-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -202,7 +202,7 @@ decode_inet_diag_req_compat(struct tcb *const tcp, if (len >= sizeof(req)) { if (!umoven_or_printaddr(tcp, addr + offset, sizeof(req) - offset, - (void *) &req + offset)) { + (char *) &req + offset)) { PRINT_FIELD_U("", req, idiag_src_len); PRINT_FIELD_U(", ", req, idiag_dst_len); PRINT_FIELD_FLAGS(", ", req, idiag_ext, @@ -245,7 +245,7 @@ decode_inet_diag_req_v2(struct tcb *const tcp, if (len >= sizeof(req)) { if (!umoven_or_printaddr(tcp, addr + offset, sizeof(req) - offset, - (void *) &req + offset)) { + (char *) &req + offset)) { PRINT_FIELD_XVAL("", req, sdiag_protocol, inet_protocols, "IPPROTO_???"); PRINT_FIELD_FLAGS(", ", req, idiag_ext, @@ -275,11 +275,9 @@ DECL_NETLINK_DIAG_DECODER(decode_inet_diag_req) { if (nlmsghdr->nlmsg_type == TCPDIAG_GETSOCK || nlmsghdr->nlmsg_type == DCCPDIAG_GETSOCK) - return decode_inet_diag_req_compat(tcp, nlmsghdr, - family, addr, len); + decode_inet_diag_req_compat(tcp, nlmsghdr, family, addr, len); else - return decode_inet_diag_req_v2(tcp, nlmsghdr, - family, addr, len); + decode_inet_diag_req_v2(tcp, nlmsghdr, family, addr, len); } static bool @@ -403,7 +401,7 @@ DECL_NETLINK_DIAG_DECODER(decode_inet_diag_msg) if (len >= sizeof(msg)) { if (!umoven_or_printaddr(tcp, addr + offset, sizeof(msg) - offset, - (void *) &msg + offset)) { + (char *) &msg + offset)) { PRINT_FIELD_XVAL("", msg, idiag_state, tcp_states, "TCP_???"); PRINT_FIELD_U(", ", msg, idiag_timer); diff --git a/netlink_netlink_diag.c b/netlink_netlink_diag.c index 65d41957..eb689b89 100644 --- a/netlink_netlink_diag.c +++ b/netlink_netlink_diag.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2016 Fabien Siron <fabien.siron@epita.fr> * Copyright (c) 2017 JingPiao Chen <chenjingpiao@gmail.com> - * Copyright (c) 2017 The strace developers. + * Copyright (c) 2017-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -51,7 +51,7 @@ DECL_NETLINK_DIAG_DECODER(decode_netlink_diag_req) if (len >= sizeof(req)) { if (!umoven_or_printaddr(tcp, addr + offset, sizeof(req) - offset, - (void *) &req + offset)) { + (char *) &req + offset)) { if (NDIAG_PROTO_ALL == req.sdiag_protocol) tprintf("%s=%s", "sdiag_protocol", "NDIAG_PROTO_ALL"); @@ -162,7 +162,7 @@ DECL_NETLINK_DIAG_DECODER(decode_netlink_diag_msg) if (len >= sizeof(msg)) { if (!umoven_or_printaddr(tcp, addr + offset, sizeof(msg) - offset, - (void *) &msg + offset)) { + (char *) &msg + offset)) { PRINT_FIELD_XVAL("", msg, ndiag_type, socktypes, "SOCK_???"); PRINT_FIELD_XVAL(", ", msg, ndiag_protocol, diff --git a/netlink_packet_diag.c b/netlink_packet_diag.c index 8a69d4cc..49523836 100644 --- a/netlink_packet_diag.c +++ b/netlink_packet_diag.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2016 Fabien Siron <fabien.siron@epita.fr> * Copyright (c) 2017 JingPiao Chen <chenjingpiao@gmail.com> - * Copyright (c) 2017 The strace developers. + * Copyright (c) 2017-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -51,7 +51,7 @@ DECL_NETLINK_DIAG_DECODER(decode_packet_diag_req) if (len >= sizeof(req)) { if (!umoven_or_printaddr(tcp, addr + offset, sizeof(req) - offset, - (void *) &req + offset)) { + (char *) &req + offset)) { PRINT_FIELD_XVAL("", req, sdiag_protocol, ethernet_protocols, "ETH_P_???"); PRINT_FIELD_U(", ", req, pdiag_ino); @@ -187,7 +187,7 @@ DECL_NETLINK_DIAG_DECODER(decode_packet_diag_msg) if (len >= sizeof(msg)) { if (!umoven_or_printaddr(tcp, addr + offset, sizeof(msg) - offset, - (void *) &msg + offset)) { + (char *) &msg + offset)) { PRINT_FIELD_XVAL("", msg, pdiag_type, socktypes, "SOCK_???"); PRINT_FIELD_U(", ", msg, pdiag_num); diff --git a/netlink_unix_diag.c b/netlink_unix_diag.c index 254a659f..4f3fbcc8 100644 --- a/netlink_unix_diag.c +++ b/netlink_unix_diag.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2016 Fabien Siron <fabien.siron@epita.fr> * Copyright (c) 2017 JingPiao Chen <chenjingpiao@gmail.com> - * Copyright (c) 2017 The strace developers. + * Copyright (c) 2017-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,7 +49,7 @@ DECL_NETLINK_DIAG_DECODER(decode_unix_diag_req) if (len >= sizeof(req)) { if (!umoven_or_printaddr(tcp, addr + offset, sizeof(req) - offset, - (void *) &req + offset)) { + (char *) &req + offset)) { PRINT_FIELD_U("", req, sdiag_protocol); PRINT_FIELD_FLAGS(", ", req, udiag_states, tcp_state_flags, "1<<TCP_???"); @@ -153,7 +153,7 @@ DECL_NETLINK_DIAG_DECODER(decode_unix_diag_msg) if (len >= sizeof(msg)) { if (!umoven_or_printaddr(tcp, addr + offset, sizeof(msg) - offset, - (void *) &msg + offset)) { + (char *) &msg + offset)) { PRINT_FIELD_XVAL("", msg, udiag_type, socktypes, "SOCK_???"); PRINT_FIELD_XVAL(", ", msg, udiag_state, @@ -208,6 +208,22 @@ decode_nla_meminfo(struct tcb *const tcp, } bool +decode_nla_fd(struct tcb *const tcp, + const kernel_ulong_t addr, + const unsigned int len, + const void *const opaque_data) +{ + int fd; + + if (len < sizeof(fd)) + return false; + else if (!umove_or_printaddr(tcp, addr, &fd)) + printfd(tcp, fd); + + return true; +} + +bool decode_nla_ifindex(struct tcb *const tcp, const kernel_ulong_t addr, const unsigned int len, @@ -60,6 +60,7 @@ DECL_NLA(be16); DECL_NLA(be64); DECL_NLA(str); DECL_NLA(strn); +DECL_NLA(fd); DECL_NLA(ifindex); DECL_NLA(meminfo); DECL_NLA(rt_class); @@ -7,7 +7,7 @@ * Copyright (c) 2006-2007 Ulrich Drepper <drepper@redhat.com> * Copyright (c) 2009-2013 Denys Vlasenko <dvlasenk@redhat.com> * Copyright (c) 2005-2015 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2014-2017 The strace developers. + * Copyright (c) 2014-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,8 +34,9 @@ */ #include "defs.h" +#include "xstring.h" -#include <fcntl.h> +#include <asm/fcntl.h> /* some libcs are guilty of messing up with O_ACCMODE */ #undef O_ACCMODE @@ -44,11 +45,6 @@ #ifdef O_LARGEFILE # if O_LARGEFILE == 0 /* biarch platforms in 64-bit mode */ # undef O_LARGEFILE -# ifdef SPARC64 -# define O_LARGEFILE 0x40000 -# elif defined X86_64 || defined S390X -# define O_LARGEFILE 0100000 -# endif # endif #endif @@ -110,7 +106,7 @@ sprint_open_modes(unsigned int flags) } /* flags is still nonzero */ *p++ = sep; - sprintf(p, "%#x", flags); + p = xappendstr(outstr, p, "%#x", flags); return outstr; } diff --git a/pathtrace.c b/pathtrace.c index 52582380..c0c16f50 100644 --- a/pathtrace.c +++ b/pathtrace.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2011 Comtrol Corp. - * Copyright (c) 2011-2017 The strace developers. + * Copyright (c) 2011-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -28,10 +28,11 @@ */ #include "defs.h" -#include <sys/param.h> +#include <limits.h> #include <poll.h> #include "syscall.h" +#include "xstring.h" struct path_set global_path_set; @@ -82,16 +83,15 @@ fdmatch(struct tcb *tcp, int fd, struct path_set *set) static void storepath(const char *path, struct path_set *set) { - unsigned i; - if (pathmatch(path, set)) return; /* already in table */ - i = set->num_selected++; - set->paths_selected = xreallocarray(set->paths_selected, - set->num_selected, - sizeof(set->paths_selected[0])); - set->paths_selected[i] = path; + if (set->num_selected >= set->size) + set->paths_selected = + xgrowarray(set->paths_selected, &set->size, + sizeof(set->paths_selected[0])); + + set->paths_selected[set->num_selected++] = path; } /* @@ -106,7 +106,7 @@ getfdpath(struct tcb *tcp, int fd, char *buf, unsigned bufsize) if (fd < 0) return -1; - sprintf(linkpath, "/proc/%u/fd/%u", tcp->pid, fd); + xsprintf(linkpath, "/proc/%u/fd/%u", tcp->pid, fd); n = readlink(linkpath, buf, bufsize - 1); /* * NB: if buf is too small, readlink doesn't fail, @@ -143,6 +143,41 @@ pathtrace_select_set(const char *path, struct path_set *set) storepath(rpath, set); } +static bool +match_xselect_args(struct tcb *tcp, const kernel_ulong_t *args, + struct path_set *set) +{ + /* Kernel truncates arg[0] to int, we do the same. */ + int nfds = (int) args[0]; + /* Kernel rejects negative nfds, so we don't parse it either. */ + if (nfds <= 0) + return false; + /* Beware of select(2^31-1, NULL, NULL, NULL) and similar... */ + if (nfds > 1024*1024) + nfds = 1024*1024; + unsigned int fdsize = (((nfds + 7) / 8) + current_wordsize-1) & -current_wordsize; + fd_set *fds = xmalloc(fdsize); + + for (unsigned int i = 1; i <= 3; ++i) { + if (args[i] == 0) + continue; + if (umoven(tcp, args[i], fdsize, fds) < 0) + continue; + for (int j = 0;; ++j) { + j = next_set_bit(fds, j, nfds); + if (j < 0) + break; + if (fdmatch(tcp, j, set)) { + free(fds); + return true; + } + } + } + + free(fds); + return false; +} + /* * Return true if syscall accesses a selected path * (or if no paths have been specified for tracing). @@ -214,10 +249,19 @@ pathtrace_match_set(struct tcb *tcp, struct path_set *set) upathmatch(tcp, tcp->u_arg[1], set) || upathmatch(tcp, tcp->u_arg[3], set); +#if HAVE_ARCH_OLD_MMAP case SEN_old_mmap: -#if defined(S390) +# if HAVE_ARCH_OLD_MMAP_PGOFF case SEN_old_mmap_pgoff: -#endif +# endif + { + kernel_ulong_t *args = + fetch_indirect_syscall_args(tcp, tcp->u_arg[0], 6); + + return args && fdmatch(tcp, args[4], set); + } +#endif /* HAVE_ARCH_OLD_MMAP */ + case SEN_mmap: case SEN_mmap_4koff: case SEN_mmap_pgoff: @@ -249,70 +293,18 @@ pathtrace_match_set(struct tcb *tcp, struct path_set *set) return fdmatch(tcp, tcp->u_arg[argn], set) || upathmatch(tcp, tcp->u_arg[argn + 1], set); } +#if HAVE_ARCH_OLD_SELECT case SEN_oldselect: - case SEN_pselect6: - case SEN_select: { - int i, j; - int nfds; - kernel_ulong_t *args; - kernel_ulong_t select_args[5]; - unsigned int oldselect_args[5]; - unsigned int fdsize; - fd_set *fds; - - if (SEN_oldselect == s->sen) { - if (sizeof(*select_args) == sizeof(*oldselect_args)) { - if (umove(tcp, tcp->u_arg[0], &select_args)) { - return false; - } - } else { - unsigned int n; - - if (umove(tcp, tcp->u_arg[0], &oldselect_args)) { - return false; - } - - for (n = 0; n < 5; ++n) { - select_args[n] = oldselect_args[n]; - } - } - args = select_args; - } else { - args = tcp->u_arg; - } + kernel_ulong_t *args = + fetch_indirect_syscall_args(tcp, tcp->u_arg[0], 5); - /* Kernel truncates arg[0] to int, we do the same. */ - nfds = (int) args[0]; - /* Kernel rejects negative nfds, so we don't parse it either. */ - if (nfds <= 0) - return false; - /* Beware of select(2^31-1, NULL, NULL, NULL) and similar... */ - if (nfds > 1024*1024) - nfds = 1024*1024; - fdsize = (((nfds + 7) / 8) + current_wordsize-1) & -current_wordsize; - fds = xmalloc(fdsize); - - for (i = 1; i <= 3; ++i) { - if (args[i] == 0) - continue; - if (umoven(tcp, args[i], fdsize, fds) < 0) { - continue; - } - for (j = 0;; j++) { - j = next_set_bit(fds, j, nfds); - if (j < 0) - break; - if (fdmatch(tcp, j, set)) { - free(fds); - return true; - } - } - } - free(fds); - return false; + return args && match_xselect_args(tcp, args, set); } - +#endif + case SEN_pselect6: + case SEN_select: + return match_xselect_args(tcp, tcp->u_arg, set); case SEN_poll: case SEN_ppoll: { @@ -340,6 +332,8 @@ pathtrace_match_set(struct tcb *tcp, struct path_set *set) return false; } + case SEN_accept4: + case SEN_accept: case SEN_bpf: case SEN_epoll_create: case SEN_epoll_create1: @@ -349,10 +343,17 @@ pathtrace_match_set(struct tcb *tcp, struct path_set *set) case SEN_inotify_init: case SEN_inotify_init1: case SEN_memfd_create: + case SEN_mq_getsetattr: + case SEN_mq_notify: + case SEN_mq_open: + case SEN_mq_timedreceive: + case SEN_mq_timedsend: case SEN_perf_event_open: case SEN_pipe: case SEN_pipe2: case SEN_printargs: + case SEN_signalfd4: + case SEN_signalfd: case SEN_socket: case SEN_socketpair: case SEN_timerfd_create: @@ -2,7 +2,7 @@ * Copyright (c) 2013 Ben Noordhuis <info@bnoordhuis.nl> * Copyright (c) 2013-2015 Dmitry V. Levin <ldv@altlinux.org> * Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com> - * Copyright (c) 2015-2017 The strace developers. + * Copyright (c) 2015-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -304,7 +304,8 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr) ", comm_exec=%u" ", use_clockid=%u" ", context_switch=%u" - ", write_backward=%u", + ", write_backward=%u" + ", namespaces=%u", attr->mmap_data, attr->sample_id_all, attr->exclude_host, @@ -315,7 +316,8 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr) attr->comm_exec, attr->use_clockid, attr->context_switch, - attr->write_backward); + attr->write_backward, + attr->namespaces); /* * Print it only in case it is non-zero, since it may contain flags we @@ -324,7 +326,7 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr) if (attr->__reserved_1) { tprintf(", __reserved_1=%#" PRIx64, (uint64_t) attr->__reserved_1); - tprints_comment("Bits 63..28"); + tprints_comment("Bits 63..29"); } if (attr->watermark) @@ -422,10 +424,11 @@ SYS_FUNC(perf_event_open) print_perf_event_attr(tcp, tcp->u_arg[0]); } - tprintf(", %d, %d, %d, ", + tprintf(", %d, %d, ", (int) tcp->u_arg[1], - (int) tcp->u_arg[2], - (int) tcp->u_arg[3]); + (int) tcp->u_arg[2]); + printfd(tcp, tcp->u_arg[3]); + tprints(", "); printflags64(perf_event_open_flags, tcp->u_arg[4], "PERF_FLAG_???"); return RVAL_DECODED | RVAL_FD; diff --git a/perf_event_struct.h b/perf_event_struct.h index b5a15bb5..a75b88ad 100644 --- a/perf_event_struct.h +++ b/perf_event_struct.h @@ -40,7 +40,8 @@ struct perf_event_attr { use_clockid :1, context_switch :1, write_backward :1, - __reserved_1 :36; + namespaces :1, + __reserved_1 :35; union { uint32_t wakeup_events; uint32_t wakeup_watermark; diff --git a/personality.c b/personality.c index 44ed5e3b..c3666806 100644 --- a/personality.c +++ b/personality.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2014-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,9 +27,8 @@ */ #include "defs.h" -#include <linux/personality.h> -#include "xlat/personality_types.h" #include "xlat/personality_flags.h" +#include "xlat/personality_types.h" SYS_FUNC(personality) @@ -54,13 +54,9 @@ SYS_FUNC(personality) return 0; pers = tcp->u_rval; - const char *type = xlookup(personality_types, pers & PER_MASK); - char *p; static char outstr[1024]; - if (type) - p = stpcpy(outstr, type); - else - p = outstr + sprintf(outstr, "%#x /* %s */", pers & PER_MASK, "PER_???"); + char *p = outstr + sprintxval(outstr, sizeof(outstr), personality_types, + pers & PER_MASK, "PER_???"); pers &= ~PER_MASK; if (pers) strcpy(p, sprintflags("|", personality_flags, pers)); @@ -1,7 +1,7 @@ /* * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com> * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl> - * Copyright (c) 1999-2017 The strace developers. + * Copyright (c) 1999-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,6 +29,7 @@ #include "defs.h" #include <poll.h> +#include "xstring.h" #include "xlat/pollflags.h" @@ -96,7 +97,7 @@ decode_poll_exiting(struct tcb *const tcp, const kernel_ulong_t pts) *outptr++ = '['; else outptr = stpcpy(outptr, ", "); - outptr += sprintf(outptr, "%#" PRI_klx, cur); + outptr = xappendstr(outstr, outptr, "%#" PRI_klx, cur); break; } if (!fds.revents) @@ -112,7 +113,7 @@ decode_poll_exiting(struct tcb *const tcp, const kernel_ulong_t pts) static const char fmt[] = "{fd=%d, revents="; char fdstr[sizeof(fmt) + sizeof(int) * 3]; - sprintf(fdstr, fmt, fds.fd); + xsprintf(fdstr, fmt, fds.fd); const char *flagstr = sprintflags("", pollflags, (unsigned short) fds.revents); diff --git a/print_fields.h b/print_fields.h index 35859c99..401ff04f 100644 --- a/print_fields.h +++ b/print_fields.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2016-2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2017-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,6 +45,10 @@ STRACE_PRINTF("%s%s=%llu", (prefix_), #field_, \ zero_extend_signed_to_ull((where_).field_)) +#define PRINT_FIELD_U_CAST(prefix_, where_, field_, type_) \ + STRACE_PRINTF("%s%s=%llu", (prefix_), #field_, \ + zero_extend_signed_to_ull((type_) (where_).field_)) + #define PRINT_FIELD_X(prefix_, where_, field_) \ STRACE_PRINTF("%s%s=%#llx", (prefix_), #field_, \ zero_extend_signed_to_ull((where_).field_)) @@ -74,7 +79,11 @@ (dflt_)); \ } while (0) -#define PRINT_FIELD_UID(prefix_, where_, field_) \ +/* + * Generic "ID" printing. ID is considered unsigned except for the special value + * of -1. + */ +#define PRINT_FIELD_ID(prefix_, where_, field_) \ do { \ if (sign_extend_unsigned_to_ll((where_).field_) == -1LL) \ STRACE_PRINTF("%s%s=-1", (prefix_), #field_); \ @@ -83,6 +92,8 @@ zero_extend_signed_to_ull((where_).field_)); \ } while (0) +#define PRINT_FIELD_UID PRINT_FIELD_ID + #define PRINT_FIELD_STRING(prefix_, where_, field_, len_, style_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ @@ -97,6 +108,15 @@ sizeof((where_).field_)); \ } while (0) +#define PRINT_FIELD_HEX_ARRAY(prefix_, where_, field_) \ + do { \ + STRACE_PRINTF("%s%s=", (prefix_), #field_); \ + print_quoted_string((const char *)(where_).field_, \ + sizeof((where_).field_) + \ + MUST_BE_ARRAY((where_).field_), \ + QUOTE_FORCE_HEX); \ + } while (0) + #define PRINT_FIELD_INET_ADDR(prefix_, where_, field_, af_) \ do { \ STRACE_PRINTF(prefix_); \ diff --git a/print_timespec.c b/print_timespec.c index c8ab5b7b..a482f103 100644 --- a/print_timespec.c +++ b/print_timespec.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,6 +34,8 @@ typedef struct timespec timespec_t; #include MPERS_DEFS +#include "xstring.h" + #ifndef UTIME_NOW # define UTIME_NOW ((1l << 30) - 1l) #endif @@ -125,9 +127,9 @@ MPERS_PRINTER_DECL(const char *, sprint_timespec, strcpy(buf, "NULL"); } else if (!verbose(tcp) || (exiting(tcp) && syserror(tcp)) || umove(tcp, addr, &t)) { - snprintf(buf, sizeof(buf), "%#" PRI_klx, addr); + xsprintf(buf, "%#" PRI_klx, addr); } else { - snprintf(buf, sizeof(buf), timespec_fmt, + xsprintf(buf, timespec_fmt, (long long) t.tv_sec, zero_extend_signed_to_ull(t.tv_nsec)); } diff --git a/print_timeval.c b/print_timeval.c index 8e0708f4..3690ce76 100644 --- a/print_timeval.c +++ b/print_timeval.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2015-2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,6 +34,8 @@ typedef struct timeval timeval_t; #include MPERS_DEFS +#include "xstring.h" + static const char timeval_fmt[] = "{tv_sec=%lld, tv_usec=%llu}"; static void @@ -103,9 +106,9 @@ MPERS_PRINTER_DECL(const char *, sprint_timeval, strcpy(buf, "NULL"); } else if (!verbose(tcp) || (exiting(tcp) && syserror(tcp)) || umove(tcp, addr, &t)) { - snprintf(buf, sizeof(buf), "%#" PRI_klx, addr); + xsprintf(buf, "%#" PRI_klx, addr); } else { - snprintf(buf, sizeof(buf), timeval_fmt, + xsprintf(buf, timeval_fmt, (long long) t.tv_sec, zero_extend_signed_to_ull(t.tv_usec)); } @@ -196,9 +199,9 @@ sprint_timeval32(struct tcb *const tcp, const kernel_ulong_t addr) strcpy(buf, "NULL"); } else if (!verbose(tcp) || (exiting(tcp) && syserror(tcp)) || umove(tcp, addr, &t)) { - snprintf(buf, sizeof(buf), "%#" PRI_klx, addr); + xsprintf(buf, "%#" PRI_klx, addr); } else { - snprintf(buf, sizeof(buf), timeval_fmt, + xsprintf(buf, timeval_fmt, (long long) t.tv_sec, zero_extend_signed_to_ull(t.tv_usec)); } diff --git a/printsiginfo.c b/printsiginfo.c index 2c7b2034..bab9e229 100644 --- a/printsiginfo.c +++ b/printsiginfo.c @@ -7,7 +7,7 @@ * Copyright (c) 2013 Denys Vlasenko <vda.linux@googlemail.com> * Copyright (c) 2011-2015 Dmitry V. Levin <ldv@altlinux.org> * Copyright (c) 2015 Elvira Khabirova <lineprinter0@gmail.com> - * Copyright (c) 2015-2017 The strace developers. + * Copyright (c) 2015-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,6 +42,8 @@ #include MPERS_DEFS +#include "nr_prefix.c" + #ifndef IN_MPERS #include "printsiginfo.h" #endif @@ -191,14 +193,31 @@ print_si_info(const siginfo_t *sip) break; #ifdef HAVE_SIGINFO_T_SI_SYSCALL case SIGSYS: { - const char *scname = - syscall_name((unsigned) sip->si_syscall); + /* + * Note that we can safely use the personlity set in + * current_personality here (and don't have to guess it + * based on X32_SYSCALL_BIT and si_arch, for example): + * - The signal is delivered as a result of seccomp + * filtering to the process executing forbidden + * syscall. + * - We have set the personality for the tracee during + * the syscall entering. + * - The current_personality is reliably switched in + * the next_event routine, it is set to the + * personality of the last call made (the one that + * triggered the signal delivery). + * - Looks like there are no other cases where SIGSYS + * is delivered from the kernel so far. + */ + const char *scname = syscall_name(shuffle_scno( + (unsigned) sip->si_syscall)); tprints(", si_call_addr="); printaddr(ptr_to_kulong(sip->si_call_addr)); tprints(", si_syscall="); if (scname) - tprintf("__NR_%s", scname); + tprintf("%s%s", + nr_prefix(sip->si_syscall), scname); else tprintf("%u", (unsigned) sip->si_syscall); tprints(", si_arch="); @@ -8,7 +8,7 @@ * <barrow_dj@mail.yahoo.com,djbarrow@de.ibm.com> * Copyright (c) 2000 PocketPenguins Inc. Linux for Hitachi SuperH * port by Greg Banks <gbanks@pocketpenguins.com> - * Copyright (c) 1999-2017 The strace developers. + * Copyright (c) 1999-2018 The strace developers. * * All rights reserved. * @@ -41,10 +41,10 @@ # include <elf.h> #endif -#include "xlat/nt_descriptor_types.h" - -#include "regs.h" #include "ptrace.h" +#include "regs.h" + +#include "xlat/nt_descriptor_types.h" #include "xlat/ptrace_cmds.h" #include "xlat/ptrace_setoptions_flags.h" #include "xlat/ptrace_peeksiginfo_flags.h" @@ -28,10 +28,13 @@ */ #include "defs.h" -#include <linux/ioctl.h> -#include <linux/ptp_clock.h> -#include "xlat/ptp_flags_options.h" +#ifdef HAVE_STRUCT_PTP_SYS_OFFSET + +# include <linux/ioctl.h> +# include <linux/ptp_clock.h> + +# include "xlat/ptp_flags_options.h" int ptp_ioctl(struct tcb *const tcp, const unsigned int code, @@ -138,3 +141,5 @@ ptp_ioctl(struct tcb *const tcp, const unsigned int code, return RVAL_IOCTL_DECODED; } + +#endif /* HAVE_STRUCT_PTP_SYS_OFFSET */ @@ -10,14 +10,19 @@ SYS_FUNC(reboot) const unsigned int magic2 = tcp->u_arg[1]; const unsigned int cmd = tcp->u_arg[2]; - printflags(bootflags1, magic1, "LINUX_REBOOT_MAGIC_???"); + printxval(bootflags1, magic1, "LINUX_REBOOT_MAGIC_???"); tprints(", "); - printflags(bootflags2, magic2, "LINUX_REBOOT_MAGIC_???"); + printxval(bootflags2, magic2, "LINUX_REBOOT_MAGIC_???"); tprints(", "); - printflags(bootflags3, cmd, "LINUX_REBOOT_CMD_???"); + printxval(bootflags3, cmd, "LINUX_REBOOT_CMD_???"); if (cmd == LINUX_REBOOT_CMD_RESTART2) { tprints(", "); - printstr(tcp, tcp->u_arg[3]); + /* + * The size of kernel buffer is 256 bytes and + * the last byte is always zero, at most 255 bytes + * are copied from the user space. + */ + printstr_ex(tcp, tcp->u_arg[3], 255, QUOTE_0_TERMINATED); } return RVAL_DECODED; } @@ -3,7 +3,7 @@ * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl> * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com> * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl> - * Copyright (c) 1999-2017 The strace developers. + * Copyright (c) 1999-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,6 +32,8 @@ #include "defs.h" #include <sys/resource.h> +#include "xstring.h" + #include "xlat/resources.h" static const char * @@ -43,9 +45,9 @@ sprint_rlim64(uint64_t lim) return "RLIM64_INFINITY"; if (lim > 1024 && lim % 1024 == 0) - sprintf(buf, "%" PRIu64 "*1024", lim / 1024); + xsprintf(buf, "%" PRIu64 "*1024", lim / 1024); else - sprintf(buf, "%" PRIu64, lim); + xsprintf(buf, "%" PRIu64, lim); return buf; } @@ -74,9 +76,9 @@ sprint_rlim32(uint32_t lim) return "RLIM_INFINITY"; if (lim > 1024 && lim % 1024 == 0) - sprintf(buf, "%" PRIu32 "*1024", lim / 1024); + xsprintf(buf, "%" PRIu32 "*1024", lim / 1024); else - sprintf(buf, "%" PRIu32, lim); + xsprintf(buf, "%" PRIu32, lim); return buf; } diff --git a/linux/crisv10/arch_rt_sigframe.c b/riscv.c index f3d5f108..aaa39325 100644 --- a/linux/crisv10/arch_rt_sigframe.c +++ b/riscv.c @@ -1,5 +1,7 @@ /* - * Copyright (c) 2017 Dmitry V. Levin <ldv@altlinux.org> + * RISC-V-specific syscall decoders. + * + * Copyright (c) 2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -25,9 +27,27 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -FUNC_GET_RT_SIGFRAME_ADDR +#include "defs.h" + +#ifdef RISCV + +# include "xlat/riscv_flush_icache_flags.h" + +SYS_FUNC(riscv_flush_icache) { - unsigned long addr; + /* uintptr_t start */ + printaddr(tcp->u_arg[0]); - return upeek(tcp->pid, 4 * PT_USP, &addr) ? 0 : addr; + /* uintptr_t end */ + tprints(", "); + printaddr(tcp->u_arg[1]); + + /* uintptr_t flags */ + tprints(", "); + printflags64(riscv_flush_icache_flags, tcp->u_arg[2], + "SYS_RISCV_FLUSH_ICACHE_???"); + + return RVAL_DECODED; } + +#endif /* RISCV */ diff --git a/rt_sigframe.c b/rt_sigframe.c index d9bcb4ff..6375dbcb 100644 --- a/rt_sigframe.c +++ b/rt_sigframe.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2017-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,8 +27,8 @@ */ #include "defs.h" -#include "regs.h" #include "ptrace.h" +#include "regs.h" #define DEF_FUNC_GET_RT_SIGFRAME_ADDR \ kernel_ulong_t get_rt_sigframe_addr(struct tcb *tcp) diff --git a/rtnl_addr.c b/rtnl_addr.c index a05cfbed..6594cc61 100644 --- a/rtnl_addr.c +++ b/rtnl_addr.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2016 Fabien Siron <fabien.siron@epita.fr> * Copyright (c) 2017 JingPiao Chen <chenjingpiao@gmail.com> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -115,7 +115,7 @@ DECL_NETLINK_ROUTE_DECODER(decode_ifaddrmsg) if (len >= sizeof(ifaddr)) { if (!umoven_or_printaddr(tcp, addr + offset, sizeof(ifaddr) - offset, - (void *) &ifaddr + offset)) { + (char *) &ifaddr + offset)) { PRINT_FIELD_U("", ifaddr, ifa_prefixlen); PRINT_FIELD_FLAGS(", ", ifaddr, ifa_flags, ifaddrflags, "IFA_F_???"); diff --git a/rtnl_addrlabel.c b/rtnl_addrlabel.c index 7fc48751..d4187668 100644 --- a/rtnl_addrlabel.c +++ b/rtnl_addrlabel.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2016 Fabien Siron <fabien.siron@epita.fr> * Copyright (c) 2017 JingPiao Chen <chenjingpiao@gmail.com> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -70,7 +70,7 @@ DECL_NETLINK_ROUTE_DECODER(decode_ifaddrlblmsg) if (len >= sizeof(ifal)) { if (!umoven_or_printaddr(tcp, addr + offset, sizeof(ifal) - offset, - (void *) &ifal + offset)) { + (char *) &ifal + offset)) { PRINT_FIELD_U("", ifal, ifal_prefixlen); PRINT_FIELD_U(", ", ifal, ifal_flags); PRINT_FIELD_IFINDEX(", ", ifal, ifal_index); @@ -1,7 +1,7 @@ /* * Copyright (c) 2016 Fabien Siron <fabien.siron@epita.fr> * Copyright (c) 2017 JingPiao Chen <chenjingpiao@gmail.com> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,7 +53,7 @@ DECL_NETLINK_ROUTE_DECODER(decode_dcbmsg) if (len >= sizeof(dcb)) { if (!umoven_or_printaddr(tcp, addr + offset, sizeof(dcb) - offset, - (void *) &dcb + offset)) { + (char *) &dcb + offset)) { PRINT_FIELD_XVAL("", dcb, cmd, dcb_commands, "DCB_CMD_???"); decode_nla = true; diff --git a/rtnl_link.c b/rtnl_link.c index 13e56e0d..2e13fce5 100644 --- a/rtnl_link.c +++ b/rtnl_link.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2016 Fabien Siron <fabien.siron@epita.fr> * Copyright (c) 2017 JingPiao Chen <chenjingpiao@gmail.com> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -356,7 +356,7 @@ decode_ifla_xdp_flags(struct tcb *const tcp, } static const nla_decoder_t ifla_xdp_nla_decoders[] = { - [IFLA_XDP_FD] = decode_nla_s32, + [IFLA_XDP_FD] = decode_nla_fd, [IFLA_XDP_ATTACHED] = decode_nla_u8, [IFLA_XDP_FLAGS] = decode_ifla_xdp_flags, [IFLA_XDP_PROG_ID] = decode_nla_u32 @@ -403,7 +403,7 @@ static const nla_decoder_t ifinfomsg_nla_decoders[] = { [IFLA_PORT_SELF] = decode_ifla_port, [IFLA_AF_SPEC] = NULL, /* unimplemented */ [IFLA_GROUP] = decode_nla_u32, - [IFLA_NET_NS_FD] = decode_nla_u32, + [IFLA_NET_NS_FD] = decode_nla_fd, [IFLA_EXT_MASK] = decode_nla_u32, [IFLA_PROMISCUITY] = decode_nla_u32, [IFLA_NUM_TX_QUEUES] = decode_nla_u32, @@ -434,7 +434,7 @@ DECL_NETLINK_ROUTE_DECODER(decode_ifinfomsg) if (len >= sizeof(ifinfo)) { if (!umoven_or_printaddr(tcp, addr + offset, sizeof(ifinfo) - offset, - (void *) &ifinfo + offset)) { + (char *) &ifinfo + offset)) { PRINT_FIELD_XVAL("", ifinfo, ifi_type, arp_hardware_types, "ARPHRD_???"); PRINT_FIELD_IFINDEX(", ", ifinfo, ifi_index); @@ -1,7 +1,7 @@ /* * Copyright (c) 2016 Fabien Siron <fabien.siron@epita.fr> * Copyright (c) 2017 JingPiao Chen <chenjingpiao@gmail.com> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -215,7 +215,7 @@ DECL_NETLINK_ROUTE_DECODER(decode_br_port_msg) if (len >= sizeof(bpm)) { if (!umoven_or_printaddr(tcp, addr + offset, sizeof(bpm) - offset, - (void *) &bpm + offset)) { + (char *) &bpm + offset)) { PRINT_FIELD_IFINDEX("", bpm, ifindex); decode_nla = true; } diff --git a/rtnl_neigh.c b/rtnl_neigh.c index 0eaadc59..31087748 100644 --- a/rtnl_neigh.c +++ b/rtnl_neigh.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2016 Fabien Siron <fabien.siron@epita.fr> * Copyright (c) 2017 JingPiao Chen <chenjingpiao@gmail.com> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -102,7 +102,7 @@ DECL_NETLINK_ROUTE_DECODER(decode_ndmsg) if (len >= sizeof(ndmsg)) { if (!umoven_or_printaddr(tcp, addr + offset, sizeof(ndmsg) - offset, - (void *) &ndmsg + offset)) { + (char *) &ndmsg + offset)) { PRINT_FIELD_IFINDEX("", ndmsg, ndm_ifindex); PRINT_FIELD_FLAGS(", ", ndmsg, ndm_state, neighbor_cache_entry_states, diff --git a/rtnl_nsid.c b/rtnl_nsid.c index 51ce37b4..cf8cc995 100644 --- a/rtnl_nsid.c +++ b/rtnl_nsid.c @@ -40,7 +40,7 @@ static const nla_decoder_t rtgenmsg_nla_decoders[] = { [NETNSA_NSID] = decode_nla_s32, [NETNSA_PID] = decode_nla_u32, - [NETNSA_FD] = decode_nla_u32 + [NETNSA_FD] = decode_nla_fd }; DECL_NETLINK_ROUTE_DECODER(decode_rtgenmsg) diff --git a/rtnl_route.c b/rtnl_route.c index 102b8057..93205c9b 100644 --- a/rtnl_route.c +++ b/rtnl_route.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2016 Fabien Siron <fabien.siron@epita.fr> * Copyright (c) 2017 JingPiao Chen <chenjingpiao@gmail.com> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -283,7 +283,7 @@ DECL_NETLINK_ROUTE_DECODER(decode_rtmsg) if (len >= sizeof(rtmsg)) { if (!umoven_or_printaddr(tcp, addr + offset, sizeof(rtmsg) - offset, - (void *) &rtmsg + offset)) { + (char *) &rtmsg + offset)) { PRINT_FIELD_U("", rtmsg, rtm_dst_len); PRINT_FIELD_U(", ", rtmsg, rtm_src_len); PRINT_FIELD_FLAGS(", ", rtmsg, rtm_tos, diff --git a/rtnl_rule.c b/rtnl_rule.c index bd955ea6..1ab4fd26 100644 --- a/rtnl_rule.c +++ b/rtnl_rule.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2016 Fabien Siron <fabien.siron@epita.fr> * Copyright (c) 2017 JingPiao Chen <chenjingpiao@gmail.com> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -116,7 +116,7 @@ DECL_NETLINK_ROUTE_DECODER(decode_fib_rule_hdr) if (len >= sizeof(msg)) { if (!umoven_or_printaddr(tcp, addr + offset, sizeof(msg) - offset, - (void *) &msg + offset)) { + (char *) &msg + offset)) { tprintf("dst_len=%u, src_len=%u", msg.rtm_dst_len, msg.rtm_src_len); tprints(", tos="); @@ -1,7 +1,7 @@ /* * Copyright (c) 2016 Fabien Siron <fabien.siron@epita.fr> * Copyright (c) 2017 JingPiao Chen <chenjingpiao@gmail.com> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -308,7 +308,7 @@ DECL_NETLINK_ROUTE_DECODER(decode_tcmsg) if (len >= sizeof(tcmsg)) { if (!umoven_or_printaddr(tcp, addr + offset, sizeof(tcmsg) - offset, - (void *) &tcmsg + offset)) { + (char *) &tcmsg + offset)) { PRINT_FIELD_IFINDEX("", tcmsg, tcm_ifindex); PRINT_FIELD_U(", ", tcmsg, tcm_handle); PRINT_FIELD_U(", ", tcmsg, tcm_parent); @@ -0,0 +1,1277 @@ +/* + * s390-specific syscalls decoders. + * + * Copyright (c) 2018 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "defs.h" + +#if defined S390 || defined S390X + +#include <sys/user.h> + +#include "print_fields.h" + +#include "xlat/s390_guarded_storage_commands.h" +#include "xlat/s390_runtime_instr_commands.h" +#include "xlat/s390_sthyi_function_codes.h" + +/* + * Since, for some reason, kernel doesn't expose all these nice constants and + * structures in UAPI, we have to re-declare them ourselves. + */ + +/** + * "The header section is placed at the beginning of the response buffer and + * identifies the location and length of all other sections. Valid sections have + * nonzero offset values in the header. Each section provides information about + * validity of fields within that section." + */ +struct sthyi_hdr { + /** + * Header Flag Byte 1 - These flag settings indicate the environment + * that the instruction was executed in and may influence the value of + * the validity bits. The validity bits, and not these flags, should be + * used to determine if a field is valid. + * - 0x80 - Global Performance Data unavailable + * - 0x40 - One or more hypervisor levels below this level does not + * support the STHYI instruction. When this flag is set the + * value of INFGPDU is not meaningful because the state of the + * Global Performance Data setting cannot be determined. + * - 0x20 - Virtualization stack is incomplete. This bit indicates one + * of two cases: + * - One or more hypervisor levels does not support the STHYI + * instruction. For this case, INFSTHYI will also be set. + * - There were more than three levels of guest/hypervisor information + * to report. + * - 0x10 - Execution environment is not within a logical partition. + */ + uint8_t infhflg1; + uint8_t infhflg2; /**< Header Flag Byte 2 reserved for IBM(R) use */ + uint8_t infhval1; /**< Header Validity Byte 1 reserved for IBM use */ + uint8_t infhval2; /**< Header Validity Byte 2 reserved for IBM use */ + char reserved_1__[3]; /**< Reserved for future IBM use */ + uint8_t infhygct; /**< Count of Hypervisor and Guest Sections */ + uint16_t infhtotl; /**< Total length of response buffer */ + uint16_t infhdln; /**< Length of Header Section mapped by INF0HDR */ + uint16_t infmoff; /**< Offset to Machine Section mapped by INF0MAC */ + uint16_t infmlen; /**< Length of Machine Section */ + uint16_t infpoff; /**< Offset to Partition Section mapped by INF0PAR */ + uint16_t infplen; /**< Length of Partition Section */ + uint16_t infhoff1; /**< Offset to Hypervisor Section1 mapped by INF0HYP */ + uint16_t infhlen1; /**< Length of Hypervisor Section1 */ + uint16_t infgoff1; /**< Offset to Guest Section1 mapped by INF0GST */ + uint16_t infglen1; /**< Length of Guest Section1 */ + uint16_t infhoff2; /**< Offset to Hypervisor Section2 mapped by INF0HYP */ + uint16_t infhlen2; /**< Length of Hypervisor Section2 */ + uint16_t infgoff2; /**< Offset to Guest Section2 mapped by INF0GST */ + uint16_t infglen2; /**< Length of Guest Section2 */ + uint16_t infhoff3; /**< Offset to Hypervisor Section3 mapped by INF0HYP */ + uint16_t infhlen3; /**< Length of Hypervisor Section3 */ + uint16_t infgoff3; /**< Offset to Guest Section3 mapped by INF0GST */ + uint16_t infglen3; /**< Length of Guest Section3 */ + /* 44 bytes in total */ +} ATTRIBUTE_PACKED; + +struct sthyi_machine { + uint8_t infmflg1; /**< Machine Flag Byte 1 reserved for IBM use */ + uint8_t infmflg2; /**< Machine Flag Byte 2 reserved for IBM use */ + /** + * Machine Validity Byte 1 + * - 0x80 - Processor Count Validity. When this bit is on, it indicates + * that INFMSCPS, INFMDCPS, INFMSIFL, and INFMDIFL contain + * valid counts. The validity bit may be off when: + * - STHYI support is not available on a lower level hypervisor, or + * - Global Performance Data is not enabled. + * - 0x40 - Machine ID Validity. This bit being on indicates that a + * SYSIB 1.1.1 was obtained from STSI and information reported + * in the following fields is valid: INFMTYPE, INFMMANU, + * INFMSEQ, and INFMPMAN. + * - 0x20 - Machine Name Validity. This bit being on indicates that the + * INFMNAME field is valid. + */ + uint8_t infmval1; + uint8_t infmval2; /**< Machine Validity Byte 2 reserved for IBM use */ + /** + * Number of shared CPs configured in the machine or in the physical + * partition if the system is physically partitioned. + */ + uint16_t infmscps; + /** + * Number of dedicated CPs configured in this machine or in the physical + * partition if the system is physically partitioned. + */ + uint16_t infmdcps; + /** + * Number of shared IFLs configured in this machine or in the physical + * partition if the system is physically partitioned. + */ + uint16_t infmsifl; + /** + * Number of dedicated IFLs configured in this machine or in the + * physical partition if the system is physically partitioned. + */ + uint16_t infmdifl; + char infmname[8]; /**< EBCDIC Machine Name */ + char infmtype[4]; /**< EBCDIC Type */ + char infmmanu[16]; /**< EBCDIC Manufacturer */ + char infmseq[16]; /**< EBCDIC Sequence Code */ + char infmpman[4]; /**< EBCDIC Plant of Manufacture */ + /* 60 bytes in total*/ +} ATTRIBUTE_PACKED; + +struct sthyi_partition { + /** + * Partition Flag Byte 1 + * - 0x80 - Multithreading (MT) is enabled. + */ + uint8_t infpflg1; + /** Partition Flag Byte 2 reserved for IBM use */ + uint8_t infpflg2; + /** + * Partition Validity Byte 1 + * - 0x80 - Processor count validity. This bit being on indicates that + * INFPSCPS, INFPDCPS, INFPSIFL, and INFPDIFL contain valid + * counts. + * - 0x40 - Partition weight-based capped capacity validity. This bit + * being on indicates that INFPWBCP and INFPWBIF are valid + * - 0x20 - Partition absolute capped capacity validity. This bit being + * on indicates that INFPABCP and INFPABIF are valid. + * - 0x10 - Partition ID validity. This bit being on indicates that a + * SYSIB 2.2.2 was obtained from STSI and information reported + * in the following fields is valid: INFPPNUM and INFPPNAM. + * - 0x08 - LPAR group absolute capacity capping information validity. + * This bit being on indicates that INFPLGNM, INFPLGCP, and + * INFPLGIF are valid. + */ + uint8_t infpval1; + /** Partition Validity Byte 2 reserved for IBM use */ + uint8_t infpval2; + /** Logical partition number */ + uint16_t infppnum; + /** + * Number of shared logical CPs configured for this partition. Count + * of cores when MT is enabled. + */ + uint16_t infpscps; + /** + * Number of dedicated logical CPs configured for this partition. Count + * of cores when MT is enabled. + */ + uint16_t infpdcps; + /** + * Number of shared logical IFLs configured for this partition. Count + * of cores when MT is enabled. + */ + uint16_t infpsifl; + /** + * Number of dedicated logical IFLs configured for this partition. + * Count of cores when MT is enabled. + */ + uint16_t infpdifl; + /** Reserved for future IBM use */ + char reserved_1__[2]; + /** EBCIDIC Logical partition name */ + char infppnam[8]; + /** + * Partition weight-based capped capacity for CPs, a scaled number where + * 0x00010000 represents one core. Zero if not capped. + */ + uint32_t infpwbcp; + /** + * Partition absolute capped capacity for CPs, a scaled number where + * 0x00010000 represents one core. Zero if not capped. + */ + uint32_t infpabcp; + /** + * Partition weight-based capped capacity for IFLs, a scaled number + * where 0x00010000 represents one core. Zero if not capped. + */ + uint32_t infpwbif; + /** + * Partition absolute capped capacity for IFLs, a scaled number where + * 0x00010000 represents one core. Zero if not capped. + */ + uint32_t infpabif; + /** + * EBCIDIC LPAR group name. Binary zeros when the partition is not in + * an LPAR group. EBCDIC and padded with blanks on the right when in a + * group. The group name is reported only when there is a group cap on + * CP or IFL CPU types and the partition has the capped CPU type. + */ + char infplgnm[8]; + /** + * LPAR group absolute capacity value for CP CPU type when nonzero. This + * field will be nonzero only when INFPLGNM is nonzero and a cap is + * defined for the LPAR group for the CP CPU type. When nonzero, + * contains a scaled number where 0x00010000 represents one core. + */ + uint32_t infplgcp; + /** + * LPAR group absolute capacity value for IFL CPU type when nonzero. + * This field will be nonzero only when INFPLGNM is nonzero and a cap + * is defined for the LPAR group for the IFL CPU type. When nonzero, + * contains a scaled number where 0x00010000 represents one core. + */ + uint32_t infplgif; + /* 56 bytes */ +} ATTRIBUTE_PACKED; + +struct sthyi_hypervisor { + /** + * Hypervisor Flag Byte 1 + * - 0x80 - Guest CPU usage hard limiting is using the consumption + * method. + * - 0x40 - If on, LIMITHARD caps use prorated core time for capping. + * If off, raw CPU time is used. + */ + uint8_t infyflg1; + uint8_t infyflg2; /**< Hypervisor Flag Byte 2 reserved for IBM use */ + uint8_t infyval1; /**< Hypervisor Validity Byte 1 reserved for IBM use */ + uint8_t infyval2; /**< Hypervisor Validity Byte 2 reserved for IBM use */ + /** + * Hypervisor Type + * - 1 - z/VM is the hypervisor. + */ + uint8_t infytype; + char reserved_1__[1]; /**< Reserved for future IBM use */ + /** + * Threads in use per CP core. Only valid when MT enabled + * (INFPFLG1 0x80 is ON). + */ + uint8_t infycpt; + /** + * Threads in use per IFL core. Only valid when MT enabled + * (INFPFLG1 0x80 is ON). + */ + uint8_t infyiflt; + /** + * EBCID System Identifier. Left justified and padded with blanks. + * This field will be blanks if non-existent. + */ + char infysyid[8]; + /** + * EBCID Cluster Name. Left justified and padded with blanks. This is + * the name on the SSI statement in the system configuration file. This + * field will be blanks if nonexistent. + */ + char infyclnm[8]; + /** + * Total number of CPs shared among guests of this hypervisor. + * Number of cores when MT enabled. + */ + uint16_t infyscps; + /** + * Total number of CPs dedicated to guests of this hypervisor. + * Number of cores when MT enabled. + */ + uint16_t infydcps; + /** + * Total number of IFLs shared among guests of this hypervisor. + * Number of cores when MT enabled. + */ + uint16_t infysifl; + /** + * Total number of IFLs dedicated to guests of this hypervisor. + * Number of cores when MT enabled. + */ + uint16_t infydifl; + /* 32 bytes */ +} ATTRIBUTE_PACKED; + +struct sthyi_guest { + /** + * Guest Flag Byte 1 + * - 0x80 - Guest is mobility enabled + * - 0x40 - Guest has multiple virtual CPU types + * - 0x20 - Guest CP dispatch type has LIMITHARD cap + * - 0x10 - Guest IFL dispatch type has LIMITHARD cap + * - 0x08 - Virtual CPs are thread dispatched + * - 0x04 - Virtual IFLs are thread dispatched + */ + uint8_t infgflg1; + uint8_t infgflg2; /**< Guest Flag Byte 2 reserved for IBM use */ + uint8_t infgval1; /**< Guest Validity Byte 1 reserved for IBM use */ + uint8_t infgval2; /**< Guest Validity Byte 2 reserved for IBM use */ + char infgusid[8]; /**< EBCDIC Userid */ + uint16_t infgscps; /**< Number of guest shared CPs */ + uint16_t infgdcps; /**< Number of guest dedicated CPs */ + /** + * Dispatch type for guest CPs. This field is valid if INFGSCPS or + * INFGDCPS is greater than zero. + * - 0 - General Purpose (CP) + */ + uint8_t infgcpdt; + char reserved_1__[3]; /**< Reserved for future IBM use */ + /** + * Guest current capped capacity for shared virtual CPs, a scaled number + * where 0x00010000 represents one core. This field is zero to + * indicate not capped when: + * - There is no CP individual limit (that is, the "Guest CP dispatch + * type has LIMITHARD cap" bit in field INFGFLG1 is OFF). + * - There are no shared CPs on the system (that is, INFYSCPS = 0). + * If there is a CP limit but there are no shared CPs or virtual CPs, + * the limit is meaningless and does not apply to anything. + */ + uint32_t infgcpcc; + uint16_t infgsifl; /**< Number of guest shared IFLs */ + uint16_t infgdifl; /**< Number of guest dedicated IFLs */ + /** + * Dispatch type for guest IFLs. This field is valid if INFGSIFL or + * INFGDIFL is greater than zero. + * - 0 - General Purpose (CP) + * - 3 - Integrated Facility for Linux (IFL) + */ + uint8_t infgifdt; + char reserved_2__[3]; /**< Reserved for future IBM use */ + /** + * Guest current capped capacity for shared virtual IFLs, a scaled + * number where 0x00010000 represents one core. This field is zero + * to indicate not capped with an IFL limit when: + * - There is no IFL individual limit (that is, the "Guest IFL dispatch + * type has LIMITHARD cap" bit in field INFGFLG1 is OFF). + * - The guest's IFLs are dispatched on CPs (that is, INFGIFDT = 00). + * When the guest's IFLs are dispatched on CPs, the CP individual + * limit (in INFGCPCC) is applied to the guest's virtual IFLs and + * virtual CPs. + */ + uint32_t infgifcc; + /** + * CPU Pool Capping Flags + * - 0x80 - CPU Pool's CP virtual type has LIMITHARD cap + * - 0x40 - CPU Pool's CP virtual type has CAPACITY cap + * - 0x20 - CPU Pool's IFL virtual type has LIMITHARD cap + * - 0x10 - CPU Pool's IFL virtual type has CAPACITY cap + * - 0x08 - CPU Pool uses prorated core time. + */ + uint8_t infgpflg; + char reserved_3__[3]; /**< Reserved for future IBM use */ + /** + * EBCDIC CPU Pool Name. This field will be blanks if the guest is not + * in a CPU Pool. + */ + char infgpnam[8]; + /** + * CPU Pool capped capacity for shared virtual CPs, a scaled number + * where 0x00010000 represents one core. This field will be zero if + * not capped. + */ + uint32_t infgpccc; + /** + * CPU Pool capped capacity for shared virtual IFLs, a scaled number + * where 0x00010000 represents one core. This field will be zero if + * not capped. + */ + uint32_t infgpicc; + /* 56 bytes */ +} ATTRIBUTE_PACKED; + + +static void +decode_ebcdic(const char *ebcdic, char *ascii, size_t size) +{ + /* + * This is mostly Linux's EBCDIC-ASCII conversion table, except for + * various non-representable characters that are converted to spaces for + * readability purposes, as it is intended to be a hint for the string + * contents and not precise conversion. + */ + static char conv_table[] = + "\0\1\2\3 \11 \177 \13\14\15\16\17" + "\20\21\22\23 \n\10 \30\31 \34\35\36\37" + " \34 \n\27\33 \5\6\7" + " \26 \4 \24\25 \32" + " " " .<(+|" + "& " "!$*);~" + "-/ " "|,%_>?" + " `" ":#@'=\"" + " abcdefghi" " " + " jklmnopqr" " " + " ~stuvwxyz" " " + "^ " "[] " + "{ABCDEFGHI" " " + "}JKLMNOPQR" " " + "\\ STUVWXYZ" " " + "0123456789" " "; + + while (size--) + *ascii++ = conv_table[(unsigned char) *ebcdic++]; +} + +#define DECODE_EBCDIC(ebcdic_, ascii_) \ + decode_ebcdic((ebcdic_), (ascii_), \ + sizeof(ebcdic_) + MUST_BE_ARRAY(ebcdic_)) +#define PRINT_EBCDIC(ebcdic_) \ + do { \ + char ascii_str[sizeof(ebcdic_) + MUST_BE_ARRAY(ebcdic_)]; \ + \ + DECODE_EBCDIC(ebcdic_, ascii_str); \ + print_quoted_string(ascii_str, sizeof(ascii_str), \ + QUOTE_EMIT_COMMENT); \ + } while (0) + +#define PRINT_FIELD_EBCDIC(prefix_, where_, field_) \ + do { \ + PRINT_FIELD_HEX_ARRAY(prefix_, where_, field_); \ + PRINT_EBCDIC((where_).field_); \ + } while (0) + +#define PRINT_FIELD_WEIGHT(prefix_, where_, field_) \ + do { \ + PRINT_FIELD_X(prefix_, where_, field_); \ + if ((where_).field_) \ + tprintf_comment("%u %u/65536 cores", \ + (where_).field_ >> 16, \ + (where_).field_ & 0xFFFF); \ + else \ + tprints_comment("unlimited"); \ + } while (0) + + +static bool +is_filled(char *ptr, char fill, size_t size) +{ + while (size--) + if (*ptr++ != fill) + return false; + + return true; +} + +#define IS_ZERO(arr_) \ + is_filled(arr_, '\0', sizeof(arr_) + MUST_BE_ARRAY(arr_)) +#define IS_BLANK(arr_) /* 0x40 is space in EBCDIC */ \ + is_filled(arr_, '\x40', sizeof(arr_) + MUST_BE_ARRAY(arr_)) + +#define CHECK_SIZE(hdr_, size_, name_, ...) \ + do { \ + if ((size_) < sizeof(*(hdr_))) { \ + tprintf_comment("Invalid " name_ " with size " \ + "%hu < %zu expected", \ + ##__VA_ARGS__, \ + (size_), sizeof(*(hdr_))); \ + print_quoted_string((char *) (hdr_), (size_), \ + QUOTE_FORCE_HEX); \ + \ + return; \ + } \ + } while (0) + +#define PRINT_UNKNOWN_TAIL(hdr_, size_) \ + do { \ + if ((size_) > sizeof(*(hdr_)) && \ + !is_filled((char *) ((hdr_) + 1), '\0', \ + (size_) - sizeof(*(hdr_)))) \ + print_quoted_string((char *) ((hdr_) + 1), \ + (size_) - sizeof(*(hdr_)), \ + QUOTE_FORCE_HEX); \ + } while (0) + +static void +print_sthyi_machine(struct tcb *tcp, struct sthyi_machine *hdr, uint16_t size, + bool *dummy) +{ + int cnt_val, name_val, id_val; + + CHECK_SIZE(hdr, size, "machine structure"); + + tprints("/* machine */ {"); + if (!abbrev(tcp)) { + if (hdr->infmflg1) { /* Reserved */ + PRINT_FIELD_0X("", *hdr, infmflg1); + tprints(", "); + } + if (hdr->infmflg2) { /* Reserved */ + PRINT_FIELD_0X(", ", *hdr, infmflg2); + tprints(", "); + } + } + + PRINT_FIELD_0X("", *hdr, infmval1); + cnt_val = !!(hdr->infmval1 & 0x80); + id_val = !!(hdr->infmval1 & 0x40); + name_val = !!(hdr->infmval1 & 0x20); + + if (!abbrev(tcp)) { + if (hdr->infmval1) + tprintf_comment("processor count validity: %d, " + "machine ID validity: %d, " + "machine name validity: %d%s%#.0x%s", + cnt_val, id_val, name_val, + hdr->infmval1 & 0x1F ? ", " : "", + hdr->infmval1 & 0x1F, + hdr->infmval1 & 0x1F ? " - ???" : ""); + if (hdr->infmval2) + PRINT_FIELD_0X(", ", *hdr, infmval2); + } + + if (cnt_val || hdr->infmscps) + PRINT_FIELD_U(", ", *hdr, infmscps); + if (cnt_val || hdr->infmdcps) + PRINT_FIELD_U(", ", *hdr, infmdcps); + if (cnt_val || hdr->infmsifl) + PRINT_FIELD_U(", ", *hdr, infmsifl); + if (cnt_val || hdr->infmdifl) + PRINT_FIELD_U(", ", *hdr, infmdifl); + + if (!abbrev(tcp)) { + if (name_val || hdr->infmname) + PRINT_FIELD_EBCDIC(", ", *hdr, infmname); + + if (id_val || !IS_ZERO(hdr->infmtype)) + PRINT_FIELD_EBCDIC(", ", *hdr, infmtype); + if (id_val || !IS_ZERO(hdr->infmmanu)) + PRINT_FIELD_EBCDIC(", ", *hdr, infmmanu); + if (id_val || !IS_ZERO(hdr->infmseq)) + PRINT_FIELD_EBCDIC(", ", *hdr, infmseq); + if (id_val || !IS_ZERO(hdr->infmpman)) + PRINT_FIELD_EBCDIC(", ", *hdr, infmpman); + + PRINT_UNKNOWN_TAIL(hdr, size); + } else { + tprints(", ..."); + } + + tprints("}"); +} + +static void +print_sthyi_partition(struct tcb *tcp, struct sthyi_partition *hdr, + uint16_t size, bool *mt) +{ + int cnt_val, wcap_val, acap_val, id_val, lpar_val; + + *mt = false; + + CHECK_SIZE(hdr, size, "partition structure"); + + *mt = !!(hdr->infpflg1 & 0x80); + + PRINT_FIELD_0X("/* partition */ {", *hdr, infpflg1); + if (!abbrev(tcp) && hdr->infpflg1) + tprintf_comment("%s%s%#.0x%s", + hdr->infpflg1 & 0x80 ? + "0x80 - multithreading is enabled" : "", + (hdr->infpflg1 & 0x80) && (hdr->infpflg1 & 0x7F) ? + ", " : "", + hdr->infpflg1 & 0x7F, + hdr->infpflg1 & 0x7F ? " - ???" : ""); + if (!abbrev(tcp) && hdr->infpflg2) /* Reserved */ + PRINT_FIELD_0X(", ", *hdr, infpflg2); + + PRINT_FIELD_0X(", ", *hdr, infpval1); + cnt_val = !!(hdr->infpval1 & 0x80); + wcap_val = !!(hdr->infpval1 & 0x40); + acap_val = !!(hdr->infpval1 & 0x20); + id_val = !!(hdr->infpval1 & 0x10); + lpar_val = !!(hdr->infpval1 & 0x08); + + if (!abbrev(tcp) && hdr->infpval1) + tprintf_comment("processor count validity: %d, " + "partition weight-based capacity validity: %d, " + "partition absolute capacity validity: %d, " + "partition ID validity: %d, " + "LPAR group absolute capacity capping " + "information validity: %d%s%#.0x%s", + cnt_val, wcap_val, acap_val, id_val, lpar_val, + hdr->infpval1 & 0x07 ? ", " : "", + hdr->infpval1 & 0x07, + hdr->infpval1 & 0x07 ? " - ???" : ""); + if (!abbrev(tcp) && hdr->infpval2) /* Reserved */ + PRINT_FIELD_0X(", ", *hdr, infpval2); + + if (id_val || hdr->infppnum) + PRINT_FIELD_U(", ", *hdr, infppnum); + + if (cnt_val || hdr->infpscps) + PRINT_FIELD_U(", ", *hdr, infpscps); + if (cnt_val || hdr->infpdcps) + PRINT_FIELD_U(", ", *hdr, infpdcps); + if (cnt_val || hdr->infpsifl) + PRINT_FIELD_U(", ", *hdr, infpsifl); + if (cnt_val || hdr->infpdifl) + PRINT_FIELD_U(", ", *hdr, infpdifl); + + if (!abbrev(tcp) && !IS_ZERO(hdr->reserved_1__)) + PRINT_FIELD_HEX_ARRAY(", ", *hdr, reserved_1__); + + if (id_val || !IS_ZERO(hdr->infppnam)) + PRINT_FIELD_EBCDIC(", ", *hdr, infppnam); + + if (!abbrev(tcp)) { + if (wcap_val || hdr->infpwbcp) + PRINT_FIELD_WEIGHT(", ", *hdr, infpwbcp); + if (acap_val || hdr->infpabcp) + PRINT_FIELD_WEIGHT(", ", *hdr, infpabcp); + if (wcap_val || hdr->infpwbif) + PRINT_FIELD_WEIGHT(", ", *hdr, infpwbif); + if (acap_val || hdr->infpabif) + PRINT_FIELD_WEIGHT(", ", *hdr, infpabif); + + if (!IS_ZERO(hdr->infplgnm)) { + PRINT_FIELD_EBCDIC(", ", *hdr, infplgnm); + + PRINT_FIELD_WEIGHT(", ", *hdr, infplgcp); + PRINT_FIELD_WEIGHT(", ", *hdr, infplgif); + } else { + if (lpar_val) + PRINT_FIELD_HEX_ARRAY(", ", *hdr, infplgnm); + if (hdr->infplgcp) + PRINT_FIELD_X(", ", *hdr, infplgcp); + if (hdr->infplgif) + PRINT_FIELD_X(", ", *hdr, infplgif); + } + + PRINT_UNKNOWN_TAIL(hdr, size); + } else { + tprints(", ..."); + } + + tprints("}"); +} + +static void +print_sthyi_hypervisor(struct tcb *tcp, struct sthyi_hypervisor *hdr, + uint16_t size, int num, bool mt) +{ + CHECK_SIZE(hdr, size, "hypervisor %d structure", num); + + tprintf("/* hypervisor %d */ ", num); + PRINT_FIELD_0X("{", *hdr, infyflg1); + if (!abbrev(tcp) && hdr->infyflg1) + tprintf_comment("%s%s%s%s%#.0x%s", + hdr->infyflg1 & 0x80 ? + "0x80 - guest CPU usage had limiting is using " + "the consumption method" : "", + (hdr->infyflg1 & 0x80) && (hdr->infyflg1 & 0x40) ? + ", " : "", + hdr->infyflg1 & 0x40 ? + "0x40 - LIMITHARD caps use prorated core time " + "for capping" : "", + (hdr->infyflg1 & 0xC0) && (hdr->infyflg1 & 0x3F) ? + ", " : "", + hdr->infyflg1 & 0x3F, + hdr->infyflg1 & 0x3F ? " - ???" : ""); + + if (!abbrev(tcp)) { + if (hdr->infyflg2) /* Reserved */ + PRINT_FIELD_0X(", ", *hdr, infyflg2); + if (hdr->infyval1) /* Reserved */ + PRINT_FIELD_0X(", ", *hdr, infyval1); + if (hdr->infyval2) /* Reserved */ + PRINT_FIELD_0X(", ", *hdr, infyval2); + + PRINT_FIELD_U(", ", *hdr, infytype); + switch (hdr->infytype) { + case 1: + tprints_comment("z/VM is the hypervisor"); + break; + default: + tprints_comment("unknown hypervisor type"); + } + + if (!IS_ZERO(hdr->reserved_1__)) + PRINT_FIELD_HEX_ARRAY(", ", *hdr, reserved_1__); + + if (mt || hdr->infycpt) + PRINT_FIELD_U(", ", *hdr, infycpt); + if (mt || hdr->infyiflt) + PRINT_FIELD_U(", ", *hdr, infyiflt); + } + + if (!abbrev(tcp) || !IS_BLANK(hdr->infysyid)) + PRINT_FIELD_EBCDIC(", ", *hdr, infysyid); + if (!abbrev(tcp) || !IS_BLANK(hdr->infyclnm)) + PRINT_FIELD_EBCDIC(", ", *hdr, infyclnm); + + if (!abbrev(tcp) || hdr->infyscps) + PRINT_FIELD_U(", ", *hdr, infyscps); + if (!abbrev(tcp) || hdr->infydcps) + PRINT_FIELD_U(", ", *hdr, infydcps); + if (!abbrev(tcp) || hdr->infysifl) + PRINT_FIELD_U(", ", *hdr, infysifl); + if (!abbrev(tcp) || hdr->infydifl) + PRINT_FIELD_U(", ", *hdr, infydifl); + + if (!abbrev(tcp)) { + PRINT_UNKNOWN_TAIL(hdr, size); + } else { + tprints(", ..."); + } + + tprints("}"); +} + +static void +print_sthyi_guest(struct tcb *tcp, struct sthyi_guest *hdr, uint16_t size, + int num, bool mt) +{ + CHECK_SIZE(hdr, size, "guest %d structure", num); + + tprintf("/* guest %d */ ", num); + PRINT_FIELD_0X("{", *hdr, infgflg1); + if (!abbrev(tcp) && hdr->infgflg1) + tprintf_comment("%s%s%s%s%s%s%s%s%s%s%s%s%#.0x%s", + hdr->infgflg1 & 0x80 ? + "0x80 - guest is mobility enabled" : "", + (hdr->infgflg1 & 0x80) && (hdr->infgflg1 & 0x40) ? + ", " : "", + hdr->infgflg1 & 0x40 ? + "0x40 - guest has multiple virtual CPU types" : + "", + (hdr->infgflg1 & 0xC0) && (hdr->infgflg1 & 0x20) ? + ", " : "", + hdr->infgflg1 & 0x20 ? + "0x20 - guest CP dispatch type has LIMITHARD " + "cap" : "", + (hdr->infgflg1 & 0xE0) && (hdr->infgflg1 & 0x10) ? + ", " : "", + hdr->infgflg1 & 0x10 ? + "0x10 - guest IFL dispatch type has LIMITHARD " + "cap" : "", + (hdr->infgflg1 & 0xF0) && (hdr->infgflg1 & 0x08) ? + ", " : "", + hdr->infgflg1 & 0x08 ? + "0x08 - virtual CPs are thread dispatched" : + "", + (hdr->infgflg1 & 0xF8) && (hdr->infgflg1 & 0x04) ? + ", " : "", + hdr->infgflg1 & 0x04 ? + "0x04 - virtual IFLs are thread dispatched" : + "", + (hdr->infgflg1 & 0xFC) && (hdr->infgflg1 & 0x03) ? + ", " : "", + hdr->infgflg1 & 0x03, + hdr->infgflg1 & 0x03 ? " - ???" : ""); + if (!abbrev(tcp)) { + if (hdr->infgflg2) /* Reserved */ + PRINT_FIELD_0X(", ", *hdr, infgflg2); + if (hdr->infgval1) /* Reserved */ + PRINT_FIELD_0X(", ", *hdr, infgval1); + if (hdr->infgval2) /* Reserved */ + PRINT_FIELD_0X(", ", *hdr, infgval2); + } + + PRINT_FIELD_EBCDIC(", ", *hdr, infgusid); + + if (!abbrev(tcp) || hdr->infgscps) + PRINT_FIELD_U(", ", *hdr, infgscps); + if (!abbrev(tcp) || hdr->infgdcps) + PRINT_FIELD_U(", ", *hdr, infgdcps); + + if (!abbrev(tcp)) { + PRINT_FIELD_U(", ", *hdr, infgcpdt); + switch (hdr->infgcpdt) { + case 0: + tprints_comment("General Purpose (CP)"); + break; + default: + tprints_comment("unknown"); + } + + if (!IS_ZERO(hdr->reserved_1__)) + PRINT_FIELD_HEX_ARRAY(", ", *hdr, reserved_1__); + } + + if (!abbrev(tcp) || hdr->infgcpcc) + PRINT_FIELD_WEIGHT(", ", *hdr, infgcpcc); + + if (!abbrev(tcp) || hdr->infgsifl) + PRINT_FIELD_U(", ", *hdr, infgsifl); + if (!abbrev(tcp) || hdr->infgdifl) + PRINT_FIELD_U(", ", *hdr, infgdifl); + + if (!abbrev(tcp)) { + PRINT_FIELD_U(", ", *hdr, infgifdt); + switch (hdr->infgifdt) { + case 0: + tprints_comment("General Purpose (CP)"); + break; + case 3: + tprints_comment("Integrated Facility for Linux (IFL)"); + break; + default: + tprints_comment("unknown"); + } + + if (!IS_ZERO(hdr->reserved_2__)) + PRINT_FIELD_HEX_ARRAY(", ", *hdr, reserved_2__); + } + + if (!abbrev(tcp) || hdr->infgifcc) + PRINT_FIELD_WEIGHT(", ", *hdr, infgifcc); + + PRINT_FIELD_0X(", ", *hdr, infgpflg); + if (!abbrev(tcp) && hdr->infgpflg) + tprintf_comment("%s%s%s%s%s%s%s%s%s%s%#.0x%s", + hdr->infgpflg & 0x80 ? + "0x80 - CPU pool's CP virtual type has " + "LIMITHARD cap" : "", + (hdr->infgpflg & 0x80) && (hdr->infgpflg & 0x40) ? + ", " : "", + hdr->infgpflg & 0x40 ? + "0x40 - CPU pool's CP virtual type has " + "CAPACITY cap" : "", + (hdr->infgpflg & 0xC0) && (hdr->infgpflg & 0x20) ? + ", " : "", + hdr->infgpflg & 0x20 ? + "0x20 - CPU pool's IFL virtual type has " + "LIMITHARD cap" : "", + (hdr->infgpflg & 0xE0) && (hdr->infgpflg & 0x10) ? + ", " : "", + hdr->infgpflg & 0x10 ? + "0x10 - CPU pool's IFL virtual type has " + "CAPACITY cap" : "", + (hdr->infgpflg & 0xF0) && (hdr->infgpflg & 0x08) ? + ", " : "", + hdr->infgpflg & 0x08 ? + "0x08 - CPU pool uses prorated core time" : "", + (hdr->infgpflg & 0xF8) && (hdr->infgpflg & 0x07) ? + ", " : "", + hdr->infgpflg & 0x07, + hdr->infgpflg & 0x07 ? " - ???" : ""); + + if (!abbrev(tcp)) { + if (!IS_ZERO(hdr->reserved_3__)) + PRINT_FIELD_HEX_ARRAY(", ", *hdr, reserved_3__); + + if (!IS_BLANK(hdr->infgpnam)) + PRINT_FIELD_EBCDIC(", ", *hdr, infgpnam); + + PRINT_FIELD_WEIGHT(", ", *hdr, infgpccc); + PRINT_FIELD_WEIGHT(", ", *hdr, infgpicc); + + PRINT_UNKNOWN_TAIL(hdr, size); + } else { + tprints(", ..."); + } + + tprints("}"); +} + +#define STHYI_PRINT_STRUCT(l_, name_) \ + do { \ + if (hdr->inf ##l_## off && hdr->inf ##l_## off + \ + hdr->inf ##l_## len <= sizeof(data)) { \ + tprints(", "); \ + print_sthyi_ ##name_(tcp, (struct sthyi_ ##name_ *) \ + (data + hdr->inf ##l_## off), \ + hdr->inf ##l_## len, &mt); \ + } \ + } while (0) + +#define STHYI_PRINT_HV_STRUCT(l_, n_, name_) \ + do { \ + if (hdr->inf ##l_## off ##n_ && hdr->inf ##l_## off ##n_ + \ + hdr->inf ##l_## len ##n_ <= sizeof(data)) { \ + tprints(", "); \ + print_sthyi_ ##name_(tcp, (struct sthyi_ ##name_ *) \ + (data + hdr->inf ##l_## off ##n_), \ + hdr->inf ##l_## len ##n_, n_, mt); \ + } \ + } while (0) + +static void +print_sthyi_buf(struct tcb *tcp, kernel_ulong_t ptr) +{ + char data[PAGE_SIZE]; + struct sthyi_hdr *hdr = (struct sthyi_hdr *) data; + bool mt = false; + + if (umove_or_printaddr(tcp, ptr, &data)) + return; + + tprints("{"); + + /* Header */ + PRINT_FIELD_0X("/* header */ {", *hdr, infhflg1); + + if (abbrev(tcp)) { + tprints(", ..."); + goto sthyi_sections; + } + + if (hdr->infhflg1) + tprintf_comment("%s%s%s%s%s%s%s%s%#.0x%s", + hdr->infhflg1 & 0x80 ? + "0x80 - Global Performance Data unavailable" : + "", + (hdr->infhflg1 & 0x80) && (hdr->infhflg1 & 0x40) ? + ", " : "", + hdr->infhflg1 & 0x40 ? + "0x40 - One or more hypervisor levels below " + "this level does not support the STHYI " + "instruction" : "", + (hdr->infhflg1 & 0xC0) && (hdr->infhflg1 & 0x20) ? + ", " : "", + hdr->infhflg1 & 0x20 ? + "0x20 - Virtualization stack is incomplete" : + "", + (hdr->infhflg1 & 0xE0) && (hdr->infhflg1 & 0x10) ? + ", " : "", + hdr->infhflg1 & 0x10 ? + "0x10 - Execution environment is not within " + "a logical partition" : "", + (hdr->infhflg1 & 0xF0) && (hdr->infhflg1 & 0x0F) ? + ", " : "", + hdr->infhflg1 & 0x0F, + hdr->infhflg1 & 0x0F ? " - ???" : ""); + if (hdr->infhflg2) /* Reserved */ + PRINT_FIELD_0X(", ", *hdr, infhflg2); + if (hdr->infhval1) /* Reserved */ + PRINT_FIELD_0X(", ", *hdr, infhval1); + if (hdr->infhval2) /* Reserved */ + PRINT_FIELD_0X(", ", *hdr, infhval2); + + if (!IS_ZERO(hdr->reserved_1__)) + PRINT_FIELD_HEX_ARRAY(", ", *hdr, reserved_1__); + + PRINT_FIELD_U(", ", *hdr, infhygct); + PRINT_FIELD_U(", ", *hdr, infhtotl); + + PRINT_FIELD_U(", ", *hdr, infhdln); + PRINT_FIELD_U(", ", *hdr, infmoff); + PRINT_FIELD_U(", ", *hdr, infmlen); + PRINT_FIELD_U(", ", *hdr, infpoff); + PRINT_FIELD_U(", ", *hdr, infplen); + + PRINT_FIELD_U(", ", *hdr, infhoff1); + PRINT_FIELD_U(", ", *hdr, infhlen1); + PRINT_FIELD_U(", ", *hdr, infgoff1); + PRINT_FIELD_U(", ", *hdr, infglen1); + PRINT_FIELD_U(", ", *hdr, infhoff2); + PRINT_FIELD_U(", ", *hdr, infhlen2); + PRINT_FIELD_U(", ", *hdr, infgoff2); + PRINT_FIELD_U(", ", *hdr, infglen2); + PRINT_FIELD_U(", ", *hdr, infhoff3); + PRINT_FIELD_U(", ", *hdr, infhlen3); + PRINT_FIELD_U(", ", *hdr, infgoff3); + PRINT_FIELD_U(", ", *hdr, infglen3); + + PRINT_UNKNOWN_TAIL(hdr, hdr->infhdln); + +sthyi_sections: + tprints("}"); + + STHYI_PRINT_STRUCT(m, machine); + STHYI_PRINT_STRUCT(p, partition); + + STHYI_PRINT_HV_STRUCT(h, 1, hypervisor); + STHYI_PRINT_HV_STRUCT(g, 1, guest); + STHYI_PRINT_HV_STRUCT(h, 2, hypervisor); + STHYI_PRINT_HV_STRUCT(g, 2, guest); + STHYI_PRINT_HV_STRUCT(h, 3, hypervisor); + STHYI_PRINT_HV_STRUCT(g, 3, guest); + + tprints("}"); +} + +/** + * Wrapper for the s390 STHYI instruction that provides hypervisor information. + * + * See https://www.ibm.com/support/knowledgecenter/SSB27U_6.3.0/com.ibm.zvm.v630.hcpb4/hcpb4sth.htm + * for the instruction documentation. + * + * The difference in the kernel wrapper is that it doesn't require the 4K + * alignment for the resp_buffer page (as it just copies from the internal + * cache). + */ +SYS_FUNC(s390_sthyi) +{ + /* in, function ID from s390_sthyi_function_codes */ + kernel_ulong_t function_code = tcp->u_arg[0]; + /* out, pointer to page-sized buffer */ + kernel_ulong_t resp_buffer_ptr = tcp->u_arg[1]; + /* out, pointer to u64 containing function result */ + kernel_ulong_t return_code_ptr = tcp->u_arg[2]; + /* in, should be 0, at the moment */ + kernel_ulong_t flags = tcp->u_arg[3]; + + if (entering(tcp)) { + printxval64(s390_sthyi_function_codes, function_code, + "STHYI_FC_???"); + tprints(", "); + } else { + switch (function_code) { + case STHYI_FC_CP_IFL_CAP: + print_sthyi_buf(tcp, resp_buffer_ptr); + break; + + default: + printaddr(resp_buffer_ptr); + } + + tprints(", "); + printnum_int64(tcp, return_code_ptr, "%" PRIu64); + tprintf(", %#" PRI_klx, flags); + } + + return 0; +} + + +/* + * Structures are written based on + * https://www-304.ibm.com/support/docview.wss?uid=isg29c69415c1e82603c852576700058075a&aid=1#page=85 + */ + +struct guard_storage_control_block { + uint64_t reserved; + /** + * Guard Storage Designation + * - Bits 0..J, J == 64-GSC - Guard Storage Origin (GSO) + * - Bits 53..55 - Guard Load Shift (GLS) + * - Bits 58..63 - Guard Storage Characteristic (GSC), this is J from + * the first item, valud values are 25..56. + */ + uint64_t gsd; + uint64_t gssm; /**< Guard Storage Section Mask */ + uint64_t gs_epl_a; /**< Guard Storage Event Parameter List Address */ +}; + +struct guard_storage_event_parameter_list { + uint8_t pad1; + /** + * Guard Storage Event Addressing Mode + * - 0x40 - Extended addressing mode (E) + * - 0x80 - Basic addressing mode (B) + */ + uint8_t gs_eam; + /** + * Guard Storage Event Cause indication + * - 0x01 - CPU was in transaction execution mode (TX) + * - 0x02 - CPU was in constrained transaction execution mode (CX) + * - 0x80 - Instruction causing the event: 0 - LGG, 1 - LLGFGS + */ + uint8_t gs_eci; + /** + * Guard Storage Event Access Information + * - 0x01 - DAT mode + * - Bits 1..2 - Address space indication + * - Bits 4..7 - AR number + */ + uint8_t gs_eai; + uint32_t pad2; + uint64_t gs_eha; /**< Guard Storage Event Handler Address */ + uint64_t gs_eia; /**< Guard Storage Event Instruction Address */ + uint64_t gs_eoa; /**< Guard Storage Event Operation Address */ + uint64_t gs_eir; /**< Guard Storage Event Intermediate Result */ + uint64_t gs_era; /**< Guard Storage Event Return Address */ +}; + +static void +guard_storage_print_gsepl(struct tcb *tcp, uint64_t addr) +{ + struct guard_storage_event_parameter_list gsepl; + + /* Since it is 64-bit even on 31-bit s390... */ + if (sizeof(addr) > current_klongsize && + addr >= (1ULL << (current_klongsize * 8))) { + tprintf("%#" PRIx64, addr); + + return; + } + + if (umove_or_printaddr(tcp, addr, &gsepl)) + return; + + tprints("[{"); + + if (!abbrev(tcp)) { + if (gsepl.pad1) { + PRINT_FIELD_0X("", gsepl, pad1); + tprints(", "); + } + + PRINT_FIELD_0X("", gsepl, gs_eam); + tprintf_comment("extended addressing mode: %u, " + "basic addressing mode: %u", + !!(gsepl.gs_eam & 0x2), !!(gsepl.gs_eam & 0x1)); + + PRINT_FIELD_0X(", ", gsepl, gs_eci); + tprintf_comment("CPU in TX: %u, CPU in CX: %u, instruction: %s", + !!(gsepl.gs_eci & 0x80), + !!(gsepl.gs_eci & 0x40), + gsepl.gs_eci & 0x01 ? "LLGFGS" : "LGG"); + + PRINT_FIELD_0X(", ", gsepl, gs_eai); + tprintf_comment("DAT: %u, address space indication: %u, " + "AR number: %u", + !!(gsepl.gs_eai & 0x40), + (gsepl.gs_eai >> 4) & 0x3, + gsepl.gs_eai & 0xF); + + if (gsepl.pad2) + PRINT_FIELD_0X(", ", gsepl, pad2); + + tprints(", "); + } + + PRINT_FIELD_X("", gsepl, gs_eha); + + if (!abbrev(tcp)) { + PRINT_FIELD_X(", ", gsepl, gs_eia); + PRINT_FIELD_X(", ", gsepl, gs_eoa); + PRINT_FIELD_X(", ", gsepl, gs_eir); + PRINT_FIELD_X(", ", gsepl, gs_era); + } else { + tprints(", ..."); + } + + tprints("}]"); +} + +# define DIV_ROUND_UP(x,y) (((x) + ((y) - 1)) / (y)) + +static void +guard_storage_print_gscb(struct tcb *tcp, kernel_ulong_t addr) +{ + struct guard_storage_control_block gscb; + + if (umove_or_printaddr(tcp, addr, &gscb)) + return; + + tprints("{"); + + if (gscb.reserved) { + PRINT_FIELD_0X("", gscb, reserved); + tprints(", "); + } + + PRINT_FIELD_0X("", gscb, gsd); + + if (!abbrev(tcp)) { + unsigned int gsc = gscb.gsd & 0x3F; + bool gsc_valid = gsc >= 25 && gsc <= 56; + tprintf_comment("GS origin: %#*.*" PRIx64 "%s, " + "guard load shift: %" PRIu64 ", " + "GS characteristic: %u", + gsc_valid ? 2 + DIV_ROUND_UP(64 - gsc, 4) : 0, + gsc_valid ? DIV_ROUND_UP(64 - gsc, 4) : 0, + gsc_valid ? gscb.gsd >> gsc : 0, + gsc_valid ? "" : "[invalid]", + (gscb.gsd >> 8) & 0x7, gsc); + } + + PRINT_FIELD_0X(", ", gscb, gssm); + + tprints(", gs_epl_a="); + guard_storage_print_gsepl(tcp, gscb.gs_epl_a); + + tprints("}"); +} + +SYS_FUNC(s390_guarded_storage) +{ + int command = (int) tcp->u_arg[0]; + kernel_ulong_t gs_cb = tcp->u_arg[1]; + + printxval(s390_guarded_storage_commands, command, "GS_???"); + + switch (command) { + case GS_ENABLE: + case GS_DISABLE: + case GS_CLEAR_BC_CB: + case GS_BROADCAST: + break; + + case GS_SET_BC_CB: + tprints(", "); + guard_storage_print_gscb(tcp, gs_cb); + break; + + default: + tprints(", "); + printaddr(gs_cb); + } + + return RVAL_DECODED; +} + +SYS_FUNC(s390_runtime_instr) +{ + int command = (int) tcp->u_arg[0]; + int signum = (int) tcp->u_arg[1]; + + const char *command_descr = + xlookup(s390_runtime_instr_commands, command); + + tprintf("%d", command); + tprints_comment(command_descr ? command_descr : + "S390_RUNTIME_INSTR_???"); + + /* + * signum is ignored since Linux 4.4, but let's print it for start + * command anyway. + */ + switch (command) { + case S390_RUNTIME_INSTR_START: + tprints(", "); + tprints(signame(signum)); + break; + + case S390_RUNTIME_INSTR_STOP: + default: + break; + } + + return RVAL_DECODED; +} + +SYS_FUNC(s390_pci_mmio_write) +{ + kernel_ulong_t mmio_addr = tcp->u_arg[0]; + kernel_ulong_t user_buf = tcp->u_arg[1]; + kernel_ulong_t length = tcp->u_arg[2]; + + tprintf("%#" PRI_klx ", ", mmio_addr); + printstr_ex(tcp, user_buf, length, QUOTE_FORCE_HEX); + tprintf(", %" PRI_klu, length); + + return RVAL_DECODED; +} + +SYS_FUNC(s390_pci_mmio_read) +{ + kernel_ulong_t mmio_addr = tcp->u_arg[0]; + kernel_ulong_t user_buf = tcp->u_arg[1]; + kernel_ulong_t length = tcp->u_arg[2]; + + if (entering(tcp)) { + tprintf("%#" PRI_klx ", ", mmio_addr); + } else { + if (!syserror(tcp)) + printstr_ex(tcp, user_buf, length, QUOTE_FORCE_HEX); + else + printaddr(user_buf); + + tprintf(", %" PRI_klu, length); + } + + return 0; +} + +#endif /* defined S390 || defined S390X */ @@ -270,6 +270,7 @@ SEN_renameat, SEN_renameat2, SEN_request_key, SEN_restart_syscall, +SEN_riscv_flush_icache, SEN_rmdir, SEN_rt_sigaction, SEN_rt_sigpending, @@ -279,6 +280,11 @@ SEN_rt_sigreturn, SEN_rt_sigsuspend, SEN_rt_sigtimedwait, SEN_rt_tgsigqueueinfo, +SEN_s390_guarded_storage, +SEN_s390_pci_mmio_read, +SEN_s390_pci_mmio_write, +SEN_s390_runtime_instr, +SEN_s390_sthyi, SEN_sched_get_priority_max, SEN_sched_get_priority_min, SEN_sched_getaffinity, @@ -6,7 +6,7 @@ * Copyright (c) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation * Linux for s390 port by D.J. Barrow * <barrow_dj@mail.yahoo.com,djbarrow@de.ibm.com> - * Copyright (c) 2001-2017 The strace developers. + * Copyright (c) 2001-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,6 +34,7 @@ #include "defs.h" #include "nsig.h" +#include "xstring.h" /* The libc headers do not define this constant since it should only be used by the implementation. So we define it here. */ @@ -50,19 +51,15 @@ * Some architectures, otherwise, do not define SA_RESTORER in their headers, * but actually have sa_restorer. */ -#ifdef SA_RESTORER -# if defined HPPA || defined IA64 -# define HAVE_SA_RESTORER 0 -# else -# define HAVE_SA_RESTORER 1 -# endif -#else /* !SA_RESTORER */ -# if defined SPARC || defined SPARC64 || defined M68K +#ifdef HAVE_ARCH_SA_RESTORER +# define HAVE_SA_RESTORER HAVE_ARCH_SA_RESTORER +#else /* !HAVE_ARCH_SA_RESTORER */ +# ifdef SA_RESTORER # define HAVE_SA_RESTORER 1 # else # define HAVE_SA_RESTORER 0 # endif -#endif +#endif /* HAVE_ARCH_SA_RESTORER */ #include "xlat/sa_handler_values.h" #include "xlat/sigact_flags.h" @@ -137,12 +134,12 @@ signame(const int sig) return signalent[s]; #ifdef ASM_SIGRTMAX if (s >= ASM_SIGRTMIN && s <= (unsigned int) ASM_SIGRTMAX) { - sprintf(buf, "SIGRT_%u", s - ASM_SIGRTMIN); + xsprintf(buf, "SIGRT_%u", s - ASM_SIGRTMIN); return buf; } #endif } - sprintf(buf, "%d", sig); + xsprintf(buf, "%d", sig); return buf; } @@ -209,11 +206,11 @@ sprintsigmask_n(const char *prefix, const void *sig_mask, unsigned int bytes) } #ifdef ASM_SIGRTMAX else if (i >= ASM_SIGRTMIN && i <= ASM_SIGRTMAX) { - s += sprintf(s, "RT_%u", i - ASM_SIGRTMIN); + s = xappendstr(outstr, s, "RT_%u", i - ASM_SIGRTMIN); } #endif else { - s += sprintf(s, "%u", i); + s = xappendstr(outstr, s, "%u", i); } sep = ' '; } @@ -682,7 +679,7 @@ SYS_FUNC(rt_sigtimedwait) } } return 0; -}; +} SYS_FUNC(restart_syscall) { diff --git a/sigreturn.c b/sigreturn.c index b2eeb7a4..bfc6f17b 100644 --- a/sigreturn.c +++ b/sigreturn.c @@ -1,7 +1,7 @@ #include "defs.h" +#include "ptrace.h" #include "nsig.h" #include "regs.h" -#include "ptrace.h" #if defined HAVE_ASM_SIGCONTEXT_H && !defined HAVE_STRUCT_SIGCONTEXT # include <asm/sigcontext.h> diff --git a/socketutils.c b/socketutils.c index ce4e5249..c6c42c1a 100644 --- a/socketutils.c +++ b/socketutils.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2014 Zubin Mithra <zubin.mithra@gmail.com> * Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2014-2017 The strace developers. + * Copyright (c) 2014-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -46,6 +46,8 @@ # define UNIX_PATH_MAX sizeof(((struct sockaddr_un *) 0)->sun_path) #endif +#include "xstring.h" + typedef struct { unsigned long inode; char *details; @@ -85,7 +87,7 @@ print_sockaddr_by_inode_cached(const unsigned long inode) } static bool -send_query(const int fd, void *req, size_t req_size) +send_query(struct tcb *tcp, const int fd, void *req, size_t req_size) { struct sockaddr_nl nladdr = { .nl_family = AF_NETLINK @@ -112,7 +114,8 @@ send_query(const int fd, void *req, size_t req_size) } static bool -inet_send_query(const int fd, const int family, const int proto) +inet_send_query(struct tcb *tcp, const int fd, const int family, + const int proto) { struct { const struct nlmsghdr nlh; @@ -129,7 +132,7 @@ inet_send_query(const int fd, const int family, const int proto) .idiag_states = -1 } }; - return send_query(fd, &req, sizeof(req)); + return send_query(tcp, fd, &req, sizeof(req)); } static int @@ -188,7 +191,7 @@ inet_parse_response(const void *const data, const int data_len, } static bool -receive_responses(const int fd, const unsigned long inode, +receive_responses(struct tcb *tcp, const int fd, const unsigned long inode, const unsigned long expected_msg_type, int (*parser)(const void *, int, unsigned long, void *), @@ -241,7 +244,7 @@ receive_responses(const int fd, const unsigned long inode, } static bool -unix_send_query(const int fd, const unsigned long inode) +unix_send_query(struct tcb *tcp, const int fd, const unsigned long inode) { struct { const struct nlmsghdr nlh; @@ -259,7 +262,7 @@ unix_send_query(const int fd, const unsigned long inode) .udiag_show = UDIAG_SHOW_NAME | UDIAG_SHOW_PEER } }; - return send_query(fd, &req, sizeof(req)); + return send_query(tcp, fd, &req, sizeof(req)); } static int @@ -310,7 +313,7 @@ unix_parse_response(const void *data, const int data_len, char peer_str[3 + sizeof(peer) * 3]; if (peer) - snprintf(peer_str, sizeof(peer_str), "->%u", peer); + xsprintf(peer_str, "->%u", peer); else peer_str[0] = '\0'; @@ -341,7 +344,7 @@ unix_parse_response(const void *data, const int data_len, } static bool -netlink_send_query(const int fd, const unsigned long inode) +netlink_send_query(struct tcb *tcp, const int fd, const unsigned long inode) { struct { const struct nlmsghdr nlh; @@ -358,7 +361,7 @@ netlink_send_query(const int fd, const unsigned long inode) .ndiag_show = NDIAG_SHOW_MEMINFO } }; - return send_query(fd, &req, sizeof(req)); + return send_query(tcp, fd, &req, sizeof(req)); } static int @@ -396,60 +399,60 @@ netlink_parse_response(const void *data, const int data_len, } static const char * -unix_get(const int fd, const unsigned long inode) +unix_get(struct tcb *tcp, const int fd, const unsigned long inode) { - return unix_send_query(fd, inode) - && receive_responses(fd, inode, SOCK_DIAG_BY_FAMILY, + return unix_send_query(tcp, fd, inode) + && receive_responses(tcp, fd, inode, SOCK_DIAG_BY_FAMILY, unix_parse_response, (void *) "UNIX") ? get_sockaddr_by_inode_cached(inode) : NULL; } static const char * -inet_get(const int fd, const int family, const int protocol, +inet_get(struct tcb *tcp, const int fd, const int family, const int protocol, const unsigned long inode, const char *proto_name) { - return inet_send_query(fd, family, protocol) - && receive_responses(fd, inode, SOCK_DIAG_BY_FAMILY, + return inet_send_query(tcp, fd, family, protocol) + && receive_responses(tcp, fd, inode, SOCK_DIAG_BY_FAMILY, inet_parse_response, (void *) proto_name) ? get_sockaddr_by_inode_cached(inode) : NULL; } static const char * -tcp_v4_get(const int fd, const unsigned long inode) +tcp_v4_get(struct tcb *tcp, const int fd, const unsigned long inode) { - return inet_get(fd, AF_INET, IPPROTO_TCP, inode, "TCP"); + return inet_get(tcp, fd, AF_INET, IPPROTO_TCP, inode, "TCP"); } static const char * -udp_v4_get(const int fd, const unsigned long inode) +udp_v4_get(struct tcb *tcp, const int fd, const unsigned long inode) { - return inet_get(fd, AF_INET, IPPROTO_UDP, inode, "UDP"); + return inet_get(tcp, fd, AF_INET, IPPROTO_UDP, inode, "UDP"); } static const char * -tcp_v6_get(const int fd, const unsigned long inode) +tcp_v6_get(struct tcb *tcp, const int fd, const unsigned long inode) { - return inet_get(fd, AF_INET6, IPPROTO_TCP, inode, "TCPv6"); + return inet_get(tcp, fd, AF_INET6, IPPROTO_TCP, inode, "TCPv6"); } static const char * -udp_v6_get(const int fd, const unsigned long inode) +udp_v6_get(struct tcb *tcp, const int fd, const unsigned long inode) { - return inet_get(fd, AF_INET6, IPPROTO_UDP, inode, "UDPv6"); + return inet_get(tcp, fd, AF_INET6, IPPROTO_UDP, inode, "UDPv6"); } static const char * -netlink_get(const int fd, const unsigned long inode) +netlink_get(struct tcb *tcp, const int fd, const unsigned long inode) { - return netlink_send_query(fd, inode) - && receive_responses(fd, inode, SOCK_DIAG_BY_FAMILY, + return netlink_send_query(tcp, fd, inode) + && receive_responses(tcp, fd, inode, SOCK_DIAG_BY_FAMILY, netlink_parse_response, (void *) "NETLINK") ? get_sockaddr_by_inode_cached(inode) : NULL; } static const struct { const char *const name; - const char * (*const get)(int, unsigned long); + const char * (*const get)(struct tcb *, int, unsigned long); } protocols[] = { [SOCK_PROTO_UNIX] = { "UNIX", unix_get }, [SOCK_PROTO_TCP] = { "TCP", tcp_v4_get }, @@ -472,7 +475,7 @@ get_proto_by_name(const char *const name) } static const char * -get_sockaddr_by_inode_uncached(const unsigned long inode, +get_sockaddr_by_inode_uncached(struct tcb *tcp, const unsigned long inode, const enum sock_proto proto) { if ((unsigned int) proto >= ARRAY_SIZE(protocols) || @@ -485,14 +488,14 @@ get_sockaddr_by_inode_uncached(const unsigned long inode, const char *details = NULL; if (proto != SOCK_PROTO_UNKNOWN) { - details = protocols[proto].get(fd, inode); + details = protocols[proto].get(tcp, fd, inode); } else { unsigned int i; for (i = (unsigned int) SOCK_PROTO_UNKNOWN + 1; i < ARRAY_SIZE(protocols); ++i) { if (!protocols[i].get) continue; - details = protocols[i].get(fd, inode); + details = protocols[i].get(tcp, fd, inode); if (details) break; } @@ -503,10 +506,10 @@ get_sockaddr_by_inode_uncached(const unsigned long inode, } static bool -print_sockaddr_by_inode_uncached(const unsigned long inode, +print_sockaddr_by_inode_uncached(struct tcb *tcp, const unsigned long inode, const enum sock_proto proto) { - const char *details = get_sockaddr_by_inode_uncached(inode, proto); + const char *details = get_sockaddr_by_inode_uncached(tcp, inode, proto); if (details) { tprints(details); @@ -529,7 +532,7 @@ get_sockaddr_by_inode(struct tcb *const tcp, const int fd, { const char *details = get_sockaddr_by_inode_cached(inode); return details ? details : - get_sockaddr_by_inode_uncached(inode, getfdproto(tcp, fd)); + get_sockaddr_by_inode_uncached(tcp, inode, getfdproto(tcp, fd)); } /* Given an inode number of a socket, print out its protocol details. */ @@ -538,7 +541,8 @@ print_sockaddr_by_inode(struct tcb *const tcp, const int fd, const unsigned long inode) { return print_sockaddr_by_inode_cached(inode) ? true : - print_sockaddr_by_inode_uncached(inode, getfdproto(tcp, fd)); + print_sockaddr_by_inode_uncached(tcp, inode, + getfdproto(tcp, fd)); } #ifdef HAVE_LINUX_GENETLINK_H @@ -552,7 +556,7 @@ print_sockaddr_by_inode(struct tcb *const tcp, const int fd, * codes are building xlat(dyxlat) at runtime. */ static bool -genl_send_dump_families(const int fd) +genl_send_dump_families(struct tcb *tcp, const int fd) { struct { const struct nlmsghdr nlh; @@ -567,7 +571,7 @@ genl_send_dump_families(const int fd) .cmd = CTRL_CMD_GETFAMILY, } }; - return send_query(fd, &req, sizeof(req)); + return send_query(tcp, fd, &req, sizeof(req)); } static int @@ -618,7 +622,7 @@ genl_parse_families_response(const void *const data, } const struct xlat * -genl_families_xlat(void) +genl_families_xlat(struct tcb *tcp) { static struct dyxlat *dyxlat; @@ -629,8 +633,8 @@ genl_families_xlat(void) if (fd < 0) goto out; - if (genl_send_dump_families(fd)) - receive_responses(fd, 0, GENL_ID_CTRL, + if (genl_send_dump_families(tcp, fd)) + receive_responses(tcp, fd, 0, GENL_ID_CTRL, genl_parse_families_response, dyxlat); close(fd); } @@ -642,7 +646,7 @@ out: #else /* !HAVE_LINUX_GENETLINK_H */ const struct xlat * -genl_families_xlat(void) +genl_families_xlat(struct tcb *tcp) { return NULL; } diff --git a/strace-log-merge b/strace-log-merge index 8ab24091..7c0c0a11 100755 --- a/strace-log-merge +++ b/strace-log-merge @@ -1,4 +1,31 @@ #!/bin/sh +# +# This script processes strace -ff -tt output. It merges the contents of all +# STRACE_LOG.PID files and sorts them, printing result on the standard output. +# +# Copyright (c) 2012-2017 The strace developers. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. show_usage() { @@ -13,6 +40,9 @@ option which prints timestamps (otherwise sorting won't do any good). __EOF__ } +dd='\([0-9][0-9]\)' +ds='\([0-9][0-9]*\)' + if [ $# -ne 1 ]; then show_usage >&2 exit 1 @@ -32,10 +62,10 @@ for file in "$logfile".*; do # Some strace logs have last line which is not '\n' terminated, # so add extra newline to every file. # grep -v '^$' removes empty lines which may result. - sed "s/^/$pid /" < "$file" + sed -n "s/^\($dd:\)\?\($dd:\)\?\($ds\.\)\?$ds /\2\4\6\7 $pid \0/p" < "$file" echo done \ -| sort -s -k2,2 | grep -v '^$' +| sort -s -n -k1,1 | sed -n 's/^[0-9][0-9]* //p' rc=$? [ $rc -eq 1 ] && diff --git a/strace-log-merge.1 b/strace-log-merge.1 new file mode 100644 index 00000000..9bdee734 --- /dev/null +++ b/strace-log-merge.1 @@ -0,0 +1,146 @@ +.\" Copyright (c) 2017 The strace developers. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" Required option. +.de OR +. ie \\n(.$-1 \ +. RI "\fB\\$1\fP" "\ \\$2" +. el \ +. BR "\\$1" +.. +.\" +.TH STRACE-LOG-MERGE 1 "2018-02-11" "strace 4.21" +.\" +.SH NAME +strace-log-merge \- merge strace \-ff \-tt output +.\" +.SH SYNOPSIS +.SY strace\-log\-merge +.IR STRACE_LOG +.YS +.SY strace\-log\-merge +.OR \-\-help +.YS +.\" +.SH DESCRIPTION +.B strace\-log\-merge +merges the output of +.B strace \-ff \-tt[t] +command, prepending PID to each line and sorting the result using time stamp as +a key. +.\" +.SH OPTIONS +.\" +.TP +.B \-\-help +Show program usage and exit. +.TP +.I STRACE_LOG +Output file name prefix of files produced by a +.B strace -ff -tt[t] +command. +.SH EXIT STATUS +.TP +.B 0 +Success +.TP +.B Non-zero +Error occurred: either no argument specified (in that case a usage is printed), +or something went wrong during the processing of +.IR STRACE_LOG ".*" +files. +.\" +.SH USAGE EXAMPLE +.sp +.nf +.ft CW +$ strace -o sleepy -ff -tt -e trace=execve,nanosleep \\ + sh -c 'sleep 0.1 & sleep 0.2 & sleep 0.3' +$ strace-log-merge sleepy | fold -w 72 -s +13475 21:13:52.040837 execve("/bin/sh", ["sh", "-c", "sleep 0.1 & sleep +0.2 & sleep 0."...], 0x7ffde54b2450 /* 33 vars */) = 0 +13478 21:13:52.044050 execve("/bin/sleep", ["sleep", "0.3"], +0x5631be4f87a8 /* 33 vars */) = 0 +13476 21:13:52.044269 execve("/bin/sleep", ["sleep", "0.1"], +0x5631be4f87a8 /* 33 vars */) = 0 +13477 21:13:52.044389 execve("/bin/sleep", ["sleep", "0.2"], +0x5631be4f87a8 /* 33 vars */) = 0 +13478 21:13:52.046207 nanosleep({tv_sec=0, tv_nsec=300000000}, NULL) = 0 +13476 21:13:52.046303 nanosleep({tv_sec=0, tv_nsec=100000000}, NULL) = 0 +13477 21:13:52.046318 nanosleep({tv_sec=0, tv_nsec=200000000}, NULL) = 0 +13476 21:13:52.146852 +++ exited with 0 +++ +13475 21:13:52.146942 --- SIGCHLD {si_signo=SIGCHLD, +si_code=CLD_EXITED, si_pid=13476, si_uid=1000, si_status=0, si_utime=0, +si_stime=0} --- +13477 21:13:52.247782 +++ exited with 0 +++ +13475 21:13:52.247885 --- SIGCHLD {si_signo=SIGCHLD, +si_code=CLD_EXITED, si_pid=13477, si_uid=1000, si_status=0, si_utime=0, +si_stime=0} --- +13478 21:13:52.347680 +++ exited with 0 +++ +13475 21:13:52.347786 --- SIGCHLD {si_signo=SIGCHLD, +si_code=CLD_EXITED, si_pid=13478, si_uid=1000, si_status=0, si_utime=0, +si_stime=0} --- +13475 21:13:52.348069 +++ exited with 0 +++ +.ft R +.fi +.sp +.\" +.SH NOTES +.I strace-log-merge +does not work well with +.B strace +logs generated by +.B strace -tt +invocation that pass midnight, as those lack the information required +for the proper sorting. +Employing the +.B -ttt +option in the respective +.B strace +invocation should solve the problem. +.\" +.SH BUGS +.I strace-log-merge +does not perform any checks whether the files specified are in the correct +format and implies that only files from a single +.I strace +session match +.IR STRACE_LOG ".*" +glob pattern. +.\" +.SH HISTORY +The initial version of +.I strace-log-merge +was written by Denys Vlasenko in 2012. +.\" +.SH REPORTING BUGS +Problems with +.B strace-log-merge +should be reported to the +.B strace +mailing list at <strace\-devel@lists.sourceforge.net>. +.\" +.SH "SEE ALSO" +.BR strace (1) diff --git a/strace-log-merge.1.in b/strace-log-merge.1.in new file mode 100644 index 00000000..c5f6d29f --- /dev/null +++ b/strace-log-merge.1.in @@ -0,0 +1,146 @@ +.\" Copyright (c) 2017 The strace developers. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" Required option. +.de OR +. ie \\n(.$-1 \ +. RI "\fB\\$1\fP" "\ \\$2" +. el \ +. BR "\\$1" +.. +.\" +.TH STRACE-LOG-MERGE 1 "@MANPAGE_DATE@" "strace @VERSION@" +.\" +.SH NAME +strace-log-merge \- merge strace \-ff \-tt output +.\" +.SH SYNOPSIS +.SY strace\-log\-merge +.IR STRACE_LOG +.YS +.SY strace\-log\-merge +.OR \-\-help +.YS +.\" +.SH DESCRIPTION +.B strace\-log\-merge +merges the output of +.B strace \-ff \-tt[t] +command, prepending PID to each line and sorting the result using time stamp as +a key. +.\" +.SH OPTIONS +.\" +.TP +.B \-\-help +Show program usage and exit. +.TP +.I STRACE_LOG +Output file name prefix of files produced by a +.B strace -ff -tt[t] +command. +.SH EXIT STATUS +.TP +.B 0 +Success +.TP +.B Non-zero +Error occurred: either no argument specified (in that case a usage is printed), +or something went wrong during the processing of +.IR STRACE_LOG ".*" +files. +.\" +.SH USAGE EXAMPLE +.sp +.nf +.ft CW +$ strace -o sleepy -ff -tt -e trace=execve,nanosleep \\ + sh -c 'sleep 0.1 & sleep 0.2 & sleep 0.3' +$ strace-log-merge sleepy | fold -w 72 -s +13475 21:13:52.040837 execve("/bin/sh", ["sh", "-c", "sleep 0.1 & sleep +0.2 & sleep 0."...], 0x7ffde54b2450 /* 33 vars */) = 0 +13478 21:13:52.044050 execve("/bin/sleep", ["sleep", "0.3"], +0x5631be4f87a8 /* 33 vars */) = 0 +13476 21:13:52.044269 execve("/bin/sleep", ["sleep", "0.1"], +0x5631be4f87a8 /* 33 vars */) = 0 +13477 21:13:52.044389 execve("/bin/sleep", ["sleep", "0.2"], +0x5631be4f87a8 /* 33 vars */) = 0 +13478 21:13:52.046207 nanosleep({tv_sec=0, tv_nsec=300000000}, NULL) = 0 +13476 21:13:52.046303 nanosleep({tv_sec=0, tv_nsec=100000000}, NULL) = 0 +13477 21:13:52.046318 nanosleep({tv_sec=0, tv_nsec=200000000}, NULL) = 0 +13476 21:13:52.146852 +++ exited with 0 +++ +13475 21:13:52.146942 --- SIGCHLD {si_signo=SIGCHLD, +si_code=CLD_EXITED, si_pid=13476, si_uid=1000, si_status=0, si_utime=0, +si_stime=0} --- +13477 21:13:52.247782 +++ exited with 0 +++ +13475 21:13:52.247885 --- SIGCHLD {si_signo=SIGCHLD, +si_code=CLD_EXITED, si_pid=13477, si_uid=1000, si_status=0, si_utime=0, +si_stime=0} --- +13478 21:13:52.347680 +++ exited with 0 +++ +13475 21:13:52.347786 --- SIGCHLD {si_signo=SIGCHLD, +si_code=CLD_EXITED, si_pid=13478, si_uid=1000, si_status=0, si_utime=0, +si_stime=0} --- +13475 21:13:52.348069 +++ exited with 0 +++ +.ft R +.fi +.sp +.\" +.SH NOTES +.I strace-log-merge +does not work well with +.B strace +logs generated by +.B strace -tt +invocation that pass midnight, as those lack the information required +for the proper sorting. +Employing the +.B -ttt +option in the respective +.B strace +invocation should solve the problem. +.\" +.SH BUGS +.I strace-log-merge +does not perform any checks whether the files specified are in the correct +format and implies that only files from a single +.I strace +session match +.IR STRACE_LOG ".*" +glob pattern. +.\" +.SH HISTORY +The initial version of +.I strace-log-merge +was written by Denys Vlasenko in 2012. +.\" +.SH REPORTING BUGS +Problems with +.B strace-log-merge +should be reported to the +.B strace +mailing list at <strace\-devel@lists.sourceforge.net>. +.\" +.SH "SEE ALSO" +.BR strace (1) @@ -53,7 +53,7 @@ . el \ . BR "\\$1" .. -.TH STRACE 1 "2017-08-28" "strace 4.20" +.TH STRACE 1 "2018-02-11" "strace 4.21" .SH NAME strace \- trace system calls and signals .SH SYNOPSIS @@ -165,39 +165,50 @@ read(0, 0x7ffff72cf5cf, 1) = ? ERESTARTSYS (To be restarted) rt_sigreturn(0xe) = 0 read(0, "", 1) = 0 .CE -Arguments are printed in symbolic form with a passion. +Arguments are printed in symbolic form with passion. This example shows the shell performing ">>xyzzy" output redirection: .CW open("xyzzy", O_WRONLY|O_APPEND|O_CREAT, 0666) = 3 .CE -Here the third argument of open is decoded by breaking down the +Here, the third argument of open is decoded by breaking down the flag argument into its three bitwise-OR constituents and printing the -mode value in octal by tradition. Where traditional or native +mode value in octal by tradition. Where the traditional or native usage differs from ANSI or POSIX, the latter forms are preferred. In some cases, .B strace -output has proven to be more readable than the source. +output is proven to be more readable than the source. .LP Structure pointers are dereferenced and the members are displayed -as appropriate. In all cases arguments are formatted in the most C-like +as appropriate. In most cases, arguments are formatted in the most C-like fashion possible. For example, the essence of the command "ls \-l /dev/null" is captured as: .CW lstat("/dev/null", {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 3), ...}) = 0 .CE Notice how the 'struct stat' argument is dereferenced and how each member is -displayed symbolically. In particular, observe how the st_mode member -is carefully decoded into a bitwise-OR of symbolic and numeric values. -Also notice in this example that the first argument to lstat is an input -to the system call and the second argument is an output. Since output -arguments are not modified if the system call fails, arguments may not -always be dereferenced. For example, retrying the "ls \-l" example +displayed symbolically. In particular, observe how the +.B st_mode +member is carefully decoded into a bitwise-OR of symbolic and numeric values. +Also notice in this example that the first argument to +.B lstat +is an input to the system call and the second argument is an output. +Since output arguments are not modified if the system call fails, arguments may +not always be dereferenced. For example, retrying the "ls \-l" example with a non-existent file produces the following line: .CW lstat("/foo/bar", 0xb004) = \-1 ENOENT (No such file or directory) .CE In this case the porch light is on but nobody is home. .LP +Syscalls unknown to +.B strace +are printed raw, with the unknown system call number printed in hexadecimal form +and prefixed with "syscall_": +.CW +syscall_0xbad(0xfedcba9876543210, 0xfedcba9876543211, 0xfedcba9876543212, +0xfedcba9876543213, 0xfedcba9876543214, 0xfedcba9876543215) = -1 (errno 38) +.CE +.LP Character pointers are dereferenced and printed as C strings. Non-printing characters in strings are normally represented by ordinary C escape codes. @@ -219,19 +230,20 @@ supplementary group ids: getgroups(32, [100, 0]) = 2 .CE On the other hand, bit-sets are also shown using square brackets -but set elements are separated only by a space. Here is the shell +but set elements are separated only by a space. Here is the shell, preparing to execute an external command: .CW sigprocmask(SIG_BLOCK, [CHLD TTOU], []) = 0 .CE -Here the second argument is a bit-set of two signals, SIGCHLD and SIGTTOU. -In some cases the bit-set is so full that printing out the unset +Here, the second argument is a bit-set of two signals, +.BR SIGCHLD " and " SIGTTOU . +In some cases, the bit-set is so full that printing out the unset elements is more valuable. In that case, the bit-set is prefixed by a tilde like this: .CW sigprocmask(SIG_UNBLOCK, ~[], NULL) = 0 .CE -Here the second argument represents the full set of all signals. +Here, the second argument represents the full set of all signals. .SH OPTIONS .SS Output format .TP 12 @@ -251,15 +263,17 @@ is built with libunwind. Write the trace output to the file .I filename rather than to stderr. -Use -.I filename.pid -if +.IR filename . pid +form is used if .B \-ff -is used. -If the argument begins with '|' or with '!' then the rest of the +option is supplied. +If the argument begins with '|' or '!', the rest of the argument is treated as a command and all output is piped to it. This is convenient for piping the debugging output to a program without affecting the redirections of executed programs. +The latter is not compatible with +.B \-ff +option currently. .TP .B \-q Suppress messages about attaching, detaching etc. This happens @@ -280,7 +294,7 @@ that filenames are not considered strings and are always printed in full. .TP .B \-t -Prefix each line of the trace with the time of day. +Prefix each line of the trace with the wall clock time. .TP .B \-tt If given twice, the time printed will include the microseconds. @@ -309,14 +323,12 @@ Print protocol specific information associated with socket file descriptors. .TP 12 .B \-c Count time, calls, and errors for each system call and report a summary on -program exit. On Linux, this attempts to show system time (CPU time spent -running in the kernel) independent of wall clock time. If +program exit. This attempts to show system time (CPU time spent running +in the kernel) independent of wall clock time. If .B \-c is used with -.B \-f -or -.B \-F -, only aggregate totals for all traced processes are kept. +.BR \-f , +only aggregate totals for all traced processes are kept. .TP .B \-C Like @@ -497,6 +509,19 @@ and ustat). The same effect can be achieved with .BR "\-e\ trace" = /statv?fs|fsstat|ustat regular expression. .TP +.BR "\-e\ trace" = %pure +Trace syscalls that always succeed and have no arguments. +Currently, this list includes +.BR arc_gettls "(2), " getdtablesize "(2), " getegid "(2), " getegid32 "(2)," +.BR geteuid "(2), " geteuid32 "(2), " getgid "(2), " getgid32 "(2)," +.BR getpagesize "(2), " getpgrp "(2), " getpid "(2), " getppid "(2)," +.BR get_thread_area (2) +(on architectures other than x86), +.BR gettid "(2), " get_tls "(2), " getuid "(2), " getuid32 "(2)," +.BR getxgid "(2), " getxpid "(2), " getxuid "(2), " kern_features "(2), and" +.BR metag_get_tls "(2)" +syscalls. +.TP \fB\-e\ abbrev\fR=\,\fIset\fR Abbreviate the output from printing each member of large structures. The default is @@ -522,10 +547,12 @@ argument. Trace only the specified subset of signals. The default is .BR signal = all . For example, -.B signal "=!" SIGIO +.BR signal "=!" SIGIO (or .BR signal "=!" io ) -causes SIGIO signals not to be traced. +causes +.B SIGIO +signals not to be traced. .TP \fB\-e\ read\fR=\,\fIset\fR Perform a full hexadecimal and ASCII dump of all the data read from @@ -730,6 +757,10 @@ where pid is the numeric process id of each process. This is incompatible with .BR \-c , since no per-process counts are kept. + +One might want to consider using +.BR strace-log-merge (1) +to obtain a combined strace log view. .TP .BI "\-I " interruptible When strace can be interrupted by signals (such as pressing ^C). @@ -787,8 +818,15 @@ Show some debugging output of itself on the standard error. .TP .B \-F -This option is now obsolete and it has the same functionality as -.BR \-f . +This option is deprecated. It is retained for backward compatibility only +and may be removed in future releases. +Usage of multiple instances of +.B \-F +option is still equivalent to a single +.BR \-f , +and it is ignored at all if used along with one or more instances of +.B \-f +option. .TP .B \-h Print the help summary. @@ -846,9 +884,69 @@ where members of the .B trace group are trusted users. If you do use this feature, please remember to install -a non-setuid version of +a regular non-setuid version of +.B strace +for ordinary users to use. +.SH "MULTIPLE PERSONALITY SUPPORT" +On some architectures, +.B strace +supports decoding of syscalls for processes that use different ABI rather than +the one +.B strace +uses. +Specifically, in addition to decoding native ABI, +.B strace +can decode the following ABIs on the following architectures: +.TS H +allbox; +lb lb +l l. +Architecture ABIs supported +x86_64 i386, x32 (when built as an x86_64 application); i386 (when built as an x32 application) +AArch64 ARM 32-bit EABI +PowerPC 64-bit PowerPC 32-bit +RISC-V 64-bit RISC-V 32-bit +s390x s390 +SPARC 64-bit SPARC 32-bit +TILE 64-bit TILE 32-bit +.TE +.PP +This support is optional and relies on ability to generate and parse structure +definitions during the build time. +Please refer to the output of the +.B strace \-V +command in order to figure out what support is available in your strace build +("non-native" refers to an ABI that differs from the ABI strace has): +.TP 15 +.B m32-mpers .B strace -for ordinary lusers to use. +can trace and properly decode non-native 32-bit binaries. +.TP +.B no-m32-mpers +.B strace +can trace, but cannot properly decode non-native 32-bit binaries. +.TP +.B mx32-mpers +.B strace +can trace and properly decode non-native 32-on-64-bit binaries. +.TP +.B no-mx32-mpers +.B strace +can trace, but cannot properly decode non-native 32-on-64-bit binaries. +.PP +If the output contains neither +.B m32-mpers +nor +.BR no-m32-mpers , +then decoding of non-native 32-bit binaries is not implemented at all +or not applicable. +.PP +Likewise, if the output contains neither +.B mx32-mpers +nor +.BR no-mx32-mpers , +then decoding of non-native 32-on-64-bit binaries is not implemented at all +or not applicable. .SH NOTES It is a pity that so much tracing clutter is produced by systems employing shared libraries. @@ -867,7 +965,7 @@ system call does not have argument, and the .BR setrlimit (2) library function uses -.BR prlimit (2) +.BR prlimit64 (2) system call on modern (2.6.38+) kernels. These discrepancies are normal but idiosyncratic characteristics of the system call interface and are accounted for by C library wrapper @@ -912,7 +1010,9 @@ may be left running after an interrupt signal (\c The original .B strace was written by Paul Kranenburg -for SunOS and was inspired by its trace utility. +for SunOS and was inspired by its +.B trace +utility. The SunOS version of .B strace was ported to Linux and enhanced @@ -938,6 +1038,45 @@ automatic configuration support. In 1995 he ported .B strace to Irix and tired of writing about himself in the third person. +.PP +Beginning with 1996, +.B strace +was maintained by Wichert Akkerman. +During his tenure, +.B strace +development migrated to CVS; ports to FreeBSD and many architectures on Linux +(including ARM, IA-64, MIPS, PA-RISC, PowerPC, s390, SPARC) were introduced. +In 2002, the burden of +.B strace +maintainership was transferred to Ronald McGrath. +Since then, +.B strace +gained support for several new Linux architectures (AMD64, s390x, SuperH), +bi-architecture support for some of them, and received numerous additions and +improvements in syscalls decoders on Linux; +.B strace +development migrated to +.B git +during that period. +Since 2009, +.B strace +is actively maintained by Dmitry Levin. +.B strace +gained support for AArch64, ARC, AVR32, Blackfin, Meta, Nios II, OpenSISC 1000, +RISC-V, Tile/TileGx, Xtensa architectures since that time. +In 2012, unmaintained and apparently broken support for non-Linux operating +systems was removed. +Also, in 2012 +.B strace +gained support for path tracing and file descriptor path decoding. +In 2014, support for stack traces printing was added. +In 2016, syscall fault injection was implemented. +.PP +For the additional information, please refer to the +.B NEWS +file and +.B strace +repository commit log. .SH REPORTING BUGS Problems with .B strace @@ -945,7 +1084,10 @@ should be reported to the .B strace mailing list at <strace\-devel@lists.sourceforge.net>. .SH "SEE ALSO" +.BR strace-log-merge (1), .BR ltrace (1), +.BR perf-trace (1), +.BR trace-cmd (1), .BR time (1), .BR ptrace (2), .BR proc (5) diff --git a/strace.1.in b/strace.1.in index 61293cfa..5d45e616 100644 --- a/strace.1.in +++ b/strace.1.in @@ -165,39 +165,50 @@ read(0, 0x7ffff72cf5cf, 1) = ? ERESTARTSYS (To be restarted) rt_sigreturn(0xe) = 0 read(0, "", 1) = 0 .CE -Arguments are printed in symbolic form with a passion. +Arguments are printed in symbolic form with passion. This example shows the shell performing ">>xyzzy" output redirection: .CW open("xyzzy", O_WRONLY|O_APPEND|O_CREAT, 0666) = 3 .CE -Here the third argument of open is decoded by breaking down the +Here, the third argument of open is decoded by breaking down the flag argument into its three bitwise-OR constituents and printing the -mode value in octal by tradition. Where traditional or native +mode value in octal by tradition. Where the traditional or native usage differs from ANSI or POSIX, the latter forms are preferred. In some cases, .B strace -output has proven to be more readable than the source. +output is proven to be more readable than the source. .LP Structure pointers are dereferenced and the members are displayed -as appropriate. In all cases arguments are formatted in the most C-like +as appropriate. In most cases, arguments are formatted in the most C-like fashion possible. For example, the essence of the command "ls \-l /dev/null" is captured as: .CW lstat("/dev/null", {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 3), ...}) = 0 .CE Notice how the 'struct stat' argument is dereferenced and how each member is -displayed symbolically. In particular, observe how the st_mode member -is carefully decoded into a bitwise-OR of symbolic and numeric values. -Also notice in this example that the first argument to lstat is an input -to the system call and the second argument is an output. Since output -arguments are not modified if the system call fails, arguments may not -always be dereferenced. For example, retrying the "ls \-l" example +displayed symbolically. In particular, observe how the +.B st_mode +member is carefully decoded into a bitwise-OR of symbolic and numeric values. +Also notice in this example that the first argument to +.B lstat +is an input to the system call and the second argument is an output. +Since output arguments are not modified if the system call fails, arguments may +not always be dereferenced. For example, retrying the "ls \-l" example with a non-existent file produces the following line: .CW lstat("/foo/bar", 0xb004) = \-1 ENOENT (No such file or directory) .CE In this case the porch light is on but nobody is home. .LP +Syscalls unknown to +.B strace +are printed raw, with the unknown system call number printed in hexadecimal form +and prefixed with "syscall_": +.CW +syscall_0xbad(0xfedcba9876543210, 0xfedcba9876543211, 0xfedcba9876543212, +0xfedcba9876543213, 0xfedcba9876543214, 0xfedcba9876543215) = -1 (errno 38) +.CE +.LP Character pointers are dereferenced and printed as C strings. Non-printing characters in strings are normally represented by ordinary C escape codes. @@ -219,19 +230,20 @@ supplementary group ids: getgroups(32, [100, 0]) = 2 .CE On the other hand, bit-sets are also shown using square brackets -but set elements are separated only by a space. Here is the shell +but set elements are separated only by a space. Here is the shell, preparing to execute an external command: .CW sigprocmask(SIG_BLOCK, [CHLD TTOU], []) = 0 .CE -Here the second argument is a bit-set of two signals, SIGCHLD and SIGTTOU. -In some cases the bit-set is so full that printing out the unset +Here, the second argument is a bit-set of two signals, +.BR SIGCHLD " and " SIGTTOU . +In some cases, the bit-set is so full that printing out the unset elements is more valuable. In that case, the bit-set is prefixed by a tilde like this: .CW sigprocmask(SIG_UNBLOCK, ~[], NULL) = 0 .CE -Here the second argument represents the full set of all signals. +Here, the second argument represents the full set of all signals. .SH OPTIONS .SS Output format .TP 12 @@ -251,15 +263,17 @@ is built with libunwind. Write the trace output to the file .I filename rather than to stderr. -Use -.I filename.pid -if +.IR filename . pid +form is used if .B \-ff -is used. -If the argument begins with '|' or with '!' then the rest of the +option is supplied. +If the argument begins with '|' or '!', the rest of the argument is treated as a command and all output is piped to it. This is convenient for piping the debugging output to a program without affecting the redirections of executed programs. +The latter is not compatible with +.B \-ff +option currently. .TP .B \-q Suppress messages about attaching, detaching etc. This happens @@ -280,7 +294,7 @@ that filenames are not considered strings and are always printed in full. .TP .B \-t -Prefix each line of the trace with the time of day. +Prefix each line of the trace with the wall clock time. .TP .B \-tt If given twice, the time printed will include the microseconds. @@ -309,14 +323,12 @@ Print protocol specific information associated with socket file descriptors. .TP 12 .B \-c Count time, calls, and errors for each system call and report a summary on -program exit. On Linux, this attempts to show system time (CPU time spent -running in the kernel) independent of wall clock time. If +program exit. This attempts to show system time (CPU time spent running +in the kernel) independent of wall clock time. If .B \-c is used with -.B \-f -or -.B \-F -, only aggregate totals for all traced processes are kept. +.BR \-f , +only aggregate totals for all traced processes are kept. .TP .B \-C Like @@ -497,6 +509,19 @@ and ustat). The same effect can be achieved with .BR "\-e\ trace" = /statv?fs|fsstat|ustat regular expression. .TP +.BR "\-e\ trace" = %pure +Trace syscalls that always succeed and have no arguments. +Currently, this list includes +.BR arc_gettls "(2), " getdtablesize "(2), " getegid "(2), " getegid32 "(2)," +.BR geteuid "(2), " geteuid32 "(2), " getgid "(2), " getgid32 "(2)," +.BR getpagesize "(2), " getpgrp "(2), " getpid "(2), " getppid "(2)," +.BR get_thread_area (2) +(on architectures other than x86), +.BR gettid "(2), " get_tls "(2), " getuid "(2), " getuid32 "(2)," +.BR getxgid "(2), " getxpid "(2), " getxuid "(2), " kern_features "(2), and" +.BR metag_get_tls "(2)" +syscalls. +.TP \fB\-e\ abbrev\fR=\,\fIset\fR Abbreviate the output from printing each member of large structures. The default is @@ -522,10 +547,12 @@ argument. Trace only the specified subset of signals. The default is .BR signal = all . For example, -.B signal "=!" SIGIO +.BR signal "=!" SIGIO (or .BR signal "=!" io ) -causes SIGIO signals not to be traced. +causes +.B SIGIO +signals not to be traced. .TP \fB\-e\ read\fR=\,\fIset\fR Perform a full hexadecimal and ASCII dump of all the data read from @@ -730,6 +757,10 @@ where pid is the numeric process id of each process. This is incompatible with .BR \-c , since no per-process counts are kept. + +One might want to consider using +.BR strace-log-merge (1) +to obtain a combined strace log view. .TP .BI "\-I " interruptible When strace can be interrupted by signals (such as pressing ^C). @@ -787,8 +818,15 @@ Show some debugging output of itself on the standard error. .TP .B \-F -This option is now obsolete and it has the same functionality as -.BR \-f . +This option is deprecated. It is retained for backward compatibility only +and may be removed in future releases. +Usage of multiple instances of +.B \-F +option is still equivalent to a single +.BR \-f , +and it is ignored at all if used along with one or more instances of +.B \-f +option. .TP .B \-h Print the help summary. @@ -846,9 +884,69 @@ where members of the .B trace group are trusted users. If you do use this feature, please remember to install -a non-setuid version of +a regular non-setuid version of +.B strace +for ordinary users to use. +.SH "MULTIPLE PERSONALITY SUPPORT" +On some architectures, +.B strace +supports decoding of syscalls for processes that use different ABI rather than +the one +.B strace +uses. +Specifically, in addition to decoding native ABI, +.B strace +can decode the following ABIs on the following architectures: +.TS H +allbox; +lb lb +l l. +Architecture ABIs supported +x86_64 i386, x32 (when built as an x86_64 application); i386 (when built as an x32 application) +AArch64 ARM 32-bit EABI +PowerPC 64-bit PowerPC 32-bit +RISC-V 64-bit RISC-V 32-bit +s390x s390 +SPARC 64-bit SPARC 32-bit +TILE 64-bit TILE 32-bit +.TE +.PP +This support is optional and relies on ability to generate and parse structure +definitions during the build time. +Please refer to the output of the +.B strace \-V +command in order to figure out what support is available in your strace build +("non-native" refers to an ABI that differs from the ABI strace has): +.TP 15 +.B m32-mpers .B strace -for ordinary lusers to use. +can trace and properly decode non-native 32-bit binaries. +.TP +.B no-m32-mpers +.B strace +can trace, but cannot properly decode non-native 32-bit binaries. +.TP +.B mx32-mpers +.B strace +can trace and properly decode non-native 32-on-64-bit binaries. +.TP +.B no-mx32-mpers +.B strace +can trace, but cannot properly decode non-native 32-on-64-bit binaries. +.PP +If the output contains neither +.B m32-mpers +nor +.BR no-m32-mpers , +then decoding of non-native 32-bit binaries is not implemented at all +or not applicable. +.PP +Likewise, if the output contains neither +.B mx32-mpers +nor +.BR no-mx32-mpers , +then decoding of non-native 32-on-64-bit binaries is not implemented at all +or not applicable. .SH NOTES It is a pity that so much tracing clutter is produced by systems employing shared libraries. @@ -867,7 +965,7 @@ system call does not have argument, and the .BR setrlimit (2) library function uses -.BR prlimit (2) +.BR prlimit64 (2) system call on modern (2.6.38+) kernels. These discrepancies are normal but idiosyncratic characteristics of the system call interface and are accounted for by C library wrapper @@ -912,7 +1010,9 @@ may be left running after an interrupt signal (\c The original .B strace was written by Paul Kranenburg -for SunOS and was inspired by its trace utility. +for SunOS and was inspired by its +.B trace +utility. The SunOS version of .B strace was ported to Linux and enhanced @@ -938,6 +1038,45 @@ automatic configuration support. In 1995 he ported .B strace to Irix and tired of writing about himself in the third person. +.PP +Beginning with 1996, +.B strace +was maintained by Wichert Akkerman. +During his tenure, +.B strace +development migrated to CVS; ports to FreeBSD and many architectures on Linux +(including ARM, IA-64, MIPS, PA-RISC, PowerPC, s390, SPARC) were introduced. +In 2002, the burden of +.B strace +maintainership was transferred to Ronald McGrath. +Since then, +.B strace +gained support for several new Linux architectures (AMD64, s390x, SuperH), +bi-architecture support for some of them, and received numerous additions and +improvements in syscalls decoders on Linux; +.B strace +development migrated to +.B git +during that period. +Since 2009, +.B strace +is actively maintained by Dmitry Levin. +.B strace +gained support for AArch64, ARC, AVR32, Blackfin, Meta, Nios II, OpenSISC 1000, +RISC-V, Tile/TileGx, Xtensa architectures since that time. +In 2012, unmaintained and apparently broken support for non-Linux operating +systems was removed. +Also, in 2012 +.B strace +gained support for path tracing and file descriptor path decoding. +In 2014, support for stack traces printing was added. +In 2016, syscall fault injection was implemented. +.PP +For the additional information, please refer to the +.B NEWS +file and +.B strace +repository commit log. .SH REPORTING BUGS Problems with .B strace @@ -945,7 +1084,10 @@ should be reported to the .B strace mailing list at <strace\-devel@lists.sourceforge.net>. .SH "SEE ALSO" +.BR strace-log-merge (1), .BR ltrace (1), +.BR perf-trace (1), +.BR trace-cmd (1), .BR time (1), .BR ptrace (2), .BR proc (5) @@ -3,7 +3,7 @@ * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl> * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com> * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl> - * Copyright (c) 1999-2017 The strace developers. + * Copyright (c) 1999-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,12 +31,16 @@ #include "defs.h" #include <stdarg.h> -#include <sys/param.h> +#include <limits.h> #include <fcntl.h> +#include "ptrace.h" #include <signal.h> #include <sys/resource.h> #include <sys/wait.h> #include <sys/stat.h> +#ifdef HAVE_PATHS_H +# include <paths.h> +#endif #include <pwd.h> #include <grp.h> #include <dirent.h> @@ -46,10 +50,12 @@ #endif #include <asm/unistd.h> +#include "largefile_wrappers.h" #include "number_set.h" #include "scno.h" -#include "ptrace.h" #include "printsiginfo.h" +#include "trace_event.h" +#include "xstring.h" /* In some libc, these aren't declared. Do it ourself: */ extern char **environ; @@ -151,7 +157,8 @@ struct tcb *printing_tcp; static struct tcb *current_tcp; static struct tcb **tcbtab; -static unsigned int nprocs, tcbtabsize; +static unsigned int nprocs; +static size_t tcbtabsize; #ifndef HAVE_PROGRAM_INVOCATION_NAME char *program_invocation_name; @@ -183,7 +190,7 @@ strerror(int err_no) static char buf[sizeof("Unknown error %d") + sizeof(int)*3]; if (err_no < 1 || err_no >= sys_nerr) { - sprintf(buf, "Unknown error %d", err_no); + xsprintf(buf, "Unknown error %d", err_no); return buf; } return sys_errlist[err_no]; @@ -198,6 +205,23 @@ print_version(void) #ifdef USE_LIBUNWIND " stack-unwind" #endif /* USE_LIBUNWIND */ +#ifdef USE_DEMANGLE + " stack-demangle" +#endif /* USE_DEMANGLE */ +#if SUPPORTED_PERSONALITIES > 1 +# if defined HAVE_M32_MPERS + " m32-mpers" +# else + " no-m32-mpers" +# endif +#endif /* SUPPORTED_PERSONALITIES > 1 */ +#if SUPPORTED_PERSONALITIES > 2 +# if defined HAVE_MX32_MPERS + " mx32-mpers" +# else + " no-mx32-mpers" +# endif +#endif /* SUPPORTED_PERSONALITIES > 2 */ ""; printf("%s -- version %s\n" @@ -293,8 +317,10 @@ die(void) if (strace_tracer_pid == getpid()) { cflag = 0; cleanup(); + exit(1); } - exit(1); + + _exit(1); } static void @@ -422,28 +448,6 @@ swap_uid(void) } } -#ifdef _LARGEFILE64_SOURCE -# ifdef HAVE_FOPEN64 -# define fopen_for_output fopen64 -# else -# define fopen_for_output fopen -# endif -# define struct_stat struct stat64 -# define stat_file stat64 -# define struct_dirent struct dirent64 -# define read_dir readdir64 -# define struct_rlimit struct rlimit64 -# define set_rlimit setrlimit64 -#else -# define fopen_for_output fopen -# define struct_stat struct stat -# define stat_file stat -# define struct_dirent struct dirent -# define read_dir readdir -# define struct_rlimit struct rlimit -# define set_rlimit setrlimit -#endif - static FILE * strace_fopen(const char *path) { @@ -508,6 +512,19 @@ strace_popen(const char *command) return fp; } +static void +outf_perror(const struct tcb * const tcp) +{ + if (tcp->outf == stderr) + return; + + /* This is ugly, but we don't store separate file names */ + if (followfork >= 2) + perror_msg("%s.%u", outfname, tcp->pid); + else + perror_msg("%s", outfname); +} + ATTRIBUTE_FORMAT((printf, 1, 0)) static void tvprintf(const char *const fmt, va_list args) @@ -516,8 +533,7 @@ tvprintf(const char *const fmt, va_list args) int n = vfprintf(current_tcp->outf, fmt, args); if (n < 0) { /* very unlikely due to vfprintf buffering */ - if (current_tcp->outf != stderr) - perror_msg("%s", outfname); + outf_perror(current_tcp); } else current_tcp->curcol += n; } @@ -546,8 +562,7 @@ tprints(const char *str) return; } /* very unlikely due to fputs_unlocked buffering */ - if (current_tcp->outf != stderr) - perror_msg("%s", outfname); + outf_perror(current_tcp); } } @@ -575,8 +590,8 @@ tprintf_comment(const char *fmt, ...) static void flush_tcp_output(const struct tcb *const tcp) { - if (fflush(tcp->outf) && tcp->outf != stderr) - perror_msg("%s", outfname); + if (fflush(tcp->outf)) + outf_perror(tcp); } void @@ -593,6 +608,16 @@ line_ended(void) } void +set_current_tcp(const struct tcb *tcp) +{ + current_tcp = (struct tcb *) tcp; + + /* Sync current_personality and stuff */ + if (current_tcp) + set_personality(current_tcp->currpers); +} + +void printleader(struct tcb *tcp) { /* If -ff, "previous tcb we printed" is always the same as current, @@ -602,7 +627,7 @@ printleader(struct tcb *tcp) printing_tcp = tcp; if (printing_tcp) { - current_tcp = printing_tcp; + set_current_tcp(printing_tcp); if (printing_tcp->curcol != 0 && (followfork < 2 || printing_tcp == tcp)) { /* * case 1: we have a shared log (i.e. not -ff), and last line @@ -616,7 +641,7 @@ printleader(struct tcb *tcp) } printing_tcp = tcp; - current_tcp = tcp; + set_current_tcp(tcp); current_tcp->curcol = 0; if (print_pid_pfx) @@ -669,8 +694,8 @@ newoutf(struct tcb *tcp) { tcp->outf = shared_log; /* if not -ff mode, the same file is for all */ if (followfork >= 2) { - char name[520 + sizeof(int) * 3]; - sprintf(name, "%.512s.%u", outfname, tcp->pid); + char name[PATH_MAX]; + xsprintf(name, "%s.%u", outfname, tcp->pid); tcp->outf = strace_fopen(name); } } @@ -683,20 +708,18 @@ expand_tcbtab(void) callers have pointers and it would be a pain. So tcbtab is a table of pointers. Since we never free the TCBs, we allocate a single chunk of many. */ - unsigned int new_tcbtabsize, alloc_tcbtabsize; + size_t old_tcbtabsize; struct tcb *newtcbs; + struct tcb **tcb_ptr; - if (tcbtabsize) { - alloc_tcbtabsize = tcbtabsize; - new_tcbtabsize = tcbtabsize * 2; - } else { - new_tcbtabsize = alloc_tcbtabsize = 1; - } + old_tcbtabsize = tcbtabsize; - newtcbs = xcalloc(alloc_tcbtabsize, sizeof(newtcbs[0])); - tcbtab = xreallocarray(tcbtab, new_tcbtabsize, sizeof(tcbtab[0])); - while (tcbtabsize < new_tcbtabsize) - tcbtab[tcbtabsize++] = newtcbs++; + tcbtab = xgrowarray(tcbtab, &tcbtabsize, sizeof(tcbtab[0])); + newtcbs = xcalloc(tcbtabsize - old_tcbtabsize, sizeof(newtcbs[0])); + + for (tcb_ptr = tcbtab + old_tcbtabsize; + tcb_ptr < tcbtab + tcbtabsize; tcb_ptr++, newtcbs++) + *tcb_ptr = newtcbs; } static struct tcb * @@ -723,9 +746,8 @@ alloctcb(int pid) #endif nprocs++; - if (debug_flag) - error_msg("new tcb for pid %d, active tcbs:%d", - tcp->pid, nprocs); + debug_msg("new tcb for pid %d, active tcbs:%d", + tcp->pid, nprocs); return tcp; } } @@ -782,9 +804,7 @@ droptcb(struct tcb *tcp) #endif nprocs--; - if (debug_flag) - error_msg("dropped tcb for pid %d, %d remain", - tcp->pid, nprocs); + debug_msg("dropped tcb for pid %d, %d remain", tcp->pid, nprocs); if (tcp->outf) { if (followfork >= 2) { @@ -799,7 +819,7 @@ droptcb(struct tcb *tcp) } if (current_tcp == tcp) - current_tcp = NULL; + set_current_tcp(NULL); if (printing_tcp == tcp) printing_tcp = NULL; @@ -840,14 +860,14 @@ detach(struct tcb *tcp) } if (errno != ESRCH) { /* Shouldn't happen. */ - perror_msg("detach: ptrace(PTRACE_DETACH,%u)", tcp->pid); + perror_func_msg("ptrace(PTRACE_DETACH,%u)", tcp->pid); goto drop; } /* ESRCH: process is either not stopped or doesn't exist. */ if (my_tkill(tcp->pid, 0) < 0) { if (errno != ESRCH) /* Shouldn't happen. */ - perror_msg("detach: tkill(%u,0)", tcp->pid); + perror_func_msg("tkill(%u,0)", tcp->pid); /* else: process doesn't exist. */ goto drop; } @@ -863,13 +883,13 @@ detach(struct tcb *tcp) if (!error) goto wait_loop; if (errno != ESRCH) - perror_msg("detach: ptrace(PTRACE_INTERRUPT,%u)", tcp->pid); + perror_func_msg("ptrace(PTRACE_INTERRUPT,%u)", tcp->pid); } else { error = my_tkill(tcp->pid, SIGSTOP); if (!error) goto wait_loop; if (errno != ESRCH) - perror_msg("detach: tkill(%u,SIGSTOP)", tcp->pid); + perror_func_msg("tkill(%u,SIGSTOP)", tcp->pid); } /* Either process doesn't exist, or some weird error. */ goto drop; @@ -890,7 +910,7 @@ detach(struct tcb *tcp) * ^^^ WRONG! We expect this PID to exist, * and want to emit a message otherwise: */ - perror_msg("detach: waitpid(%u)", tcp->pid); + perror_func_msg("waitpid(%u)", tcp->pid); break; } if (!WIFSTOPPED(status)) { @@ -907,9 +927,8 @@ detach(struct tcb *tcp) break; } sig = WSTOPSIG(status); - if (debug_flag) - error_msg("detach wait: event:%d sig:%d", - (unsigned)status >> 16, sig); + debug_msg("detach wait: event:%d sig:%d", + (unsigned) status >> 16, sig); if (use_seize) { unsigned event = (unsigned)status >> 16; if (event == PTRACE_EVENT_STOP /*&& sig == SIGTRAP*/) { @@ -1005,17 +1024,18 @@ attach_tcb(struct tcb *const tcp) return; } - tcp->flags |= TCB_ATTACHED | TCB_STARTUP | post_attach_sigstop; + tcp->flags |= TCB_ATTACHED | TCB_GRABBED | TCB_STARTUP | + post_attach_sigstop; newoutf(tcp); - if (debug_flag) - error_msg("attach to pid %d (main) succeeded", tcp->pid); + debug_msg("attach to pid %d (main) succeeded", tcp->pid); - char procdir[sizeof("/proc/%d/task") + sizeof(int) * 3]; + static const char task_path[] = "/proc/%d/task"; + char procdir[sizeof(task_path) + sizeof(int) * 3]; DIR *dir; unsigned int ntid = 0, nerr = 0; if (followfork && tcp->pid != strace_child && - sprintf(procdir, "/proc/%d/task", tcp->pid) > 0 && + xsprintf(procdir, task_path, tcp->pid) > 0 && (dir = opendir(procdir)) != NULL) { struct_dirent *de; @@ -1030,17 +1050,15 @@ attach_tcb(struct tcb *const tcp) ++ntid; if (ptrace_attach_or_seize(tid) < 0) { ++nerr; - if (debug_flag) - perror_msg("attach: ptrace(%s, %d)", - ptrace_attach_cmd, tid); + debug_perror_msg("attach: ptrace(%s, %d)", + ptrace_attach_cmd, tid); continue; } - if (debug_flag) - error_msg("attach to pid %d succeeded", tid); + debug_msg("attach to pid %d succeeded", tid); struct tcb *tid_tcp = alloctcb(tid); - tid_tcp->flags |= TCB_ATTACHED | TCB_STARTUP | - post_attach_sigstop; + tid_tcp->flags |= TCB_ATTACHED | TCB_GRABBED | + TCB_STARTUP | post_attach_sigstop; newoutf(tid_tcp); } @@ -1076,9 +1094,9 @@ startup_attach(void) if (daemonized_tracer) { pid_t pid = fork(); - if (pid < 0) { - perror_msg_and_die("fork"); - } + if (pid < 0) + perror_func_msg_and_die("fork"); + if (pid) { /* parent */ /* * Wait for grandchild to attach to straced process @@ -1217,7 +1235,7 @@ open_dummy_desc(void) int fds[2]; if (pipe(fds)) - perror_msg_and_die("pipe"); + perror_func_msg_and_die("pipe"); close(fds[1]); set_cloexec_flag(fds[0]); return fds[0]; @@ -1355,9 +1373,9 @@ startup_child(char **argv) #endif pid = fork(); - if (pid < 0) { - perror_msg_and_die("fork"); - } + if (pid < 0) + perror_func_msg_and_die("fork"); + if ((pid != 0 && daemonized_tracer) || (pid == 0 && !daemonized_tracer) ) { @@ -1465,7 +1483,7 @@ test_ptrace_seize(void) pid = fork(); if (pid < 0) - perror_msg_and_die("fork"); + perror_func_msg_and_die("fork"); if (pid == 0) { pause(); @@ -1478,8 +1496,8 @@ test_ptrace_seize(void) */ if (ptrace(PTRACE_SEIZE, pid, 0, 0) == 0) { post_attach_sigstop = 0; /* this sets use_seize to 1 */ - } else if (debug_flag) { - error_msg("PTRACE_SEIZE doesn't work"); + } else { + debug_msg("PTRACE_SEIZE doesn't work"); } kill(pid, SIGKILL); @@ -1492,14 +1510,13 @@ test_ptrace_seize(void) if (tracee_pid <= 0) { if (errno == EINTR) continue; - perror_msg_and_die("%s: unexpected wait result %d", - __func__, tracee_pid); + perror_func_msg_and_die("unexpected wait result %d", + tracee_pid); } - if (WIFSIGNALED(status)) { + if (WIFSIGNALED(status)) return; - } - error_msg_and_die("%s: unexpected wait status %#x", - __func__, status); + + error_func_msg_and_die("unexpected wait status %#x", status); } } #else /* !USE_SEIZE */ @@ -1540,7 +1557,7 @@ get_os_release(void) } static void -set_sigaction(int signo, void (*sighandler)(int), struct sigaction *oldact) +set_sighandler(int signo, void (*sighandler)(int), struct sigaction *oldact) { /* if signal handler is a function, add the signal to blocked_set */ if (sighandler != SIG_IGN && sighandler != SIG_DFL) @@ -1567,7 +1584,7 @@ init(int argc, char *argv[]) if (!program_invocation_name || !*program_invocation_name) { static char name[] = "strace"; program_invocation_name = - (argv[0] && *argv[0]) ? argv[0] : name; + (argc > 0 && argv[0] && *argv[0]) ? argv[0] : name; } strace_tracer_pid = getpid(); @@ -1584,14 +1601,17 @@ init(int argc, char *argv[]) # error Bug in DEFAULT_QUAL_FLAGS #endif qualify("signal=all"); - while ((c = getopt(argc, argv, - "+b:cCdfFhiqrtTvVwxyz" + while ((c = getopt(argc, argv, "+" #ifdef USE_LIBUNWIND - "k" + "k" #endif - "D" - "a:e:o:O:p:s:S:u:E:P:I:")) != EOF) { + "a:b:cCdDe:E:fFhiI:o:O:p:P:qrs:S:tTu:vVwxyz")) != EOF) { switch (c) { + case 'a': + acolumn = string_to_uint(optarg); + if (acolumn < 0) + error_opt_arg(c, optarg); + break; case 'b': if (strcmp(optarg, "execve") != 0) error_msg_and_die("Syscall '%s' for -b isn't supported", @@ -1616,57 +1636,35 @@ init(int argc, char *argv[]) case 'D': daemonized_tracer = 1; break; - case 'F': - optF = 1; + case 'e': + qualify(optarg); + break; + case 'E': + if (putenv(optarg) < 0) + perror_msg_and_die("putenv"); break; case 'f': followfork++; break; + case 'F': + optF = 1; + break; case 'h': usage(); break; case 'i': iflag = 1; break; - case 'q': - qflag++; - break; - case 'r': - rflag = 1; - break; - case 't': - tflag++; - break; - case 'T': - Tflag = 1; - break; - case 'w': - count_wallclock = 1; - break; - case 'x': - xflag++; - break; - case 'y': - show_fd_path++; - break; - case 'v': - qualify("abbrev=none"); - break; - case 'V': - print_version(); - exit(0); - break; - case 'z': - not_failing_only = 1; - break; - case 'a': - acolumn = string_to_uint(optarg); - if (acolumn < 0) + case 'I': + opt_intr = string_to_uint_upto(optarg, NUM_INTR_OPTS - 1); + if (opt_intr <= 0) error_opt_arg(c, optarg); break; - case 'e': - qualify(optarg); +#ifdef USE_LIBUNWIND + case 'k': + stack_trace_enabled = true; break; +#endif case 'o': outfname = optarg; break; @@ -1682,6 +1680,12 @@ init(int argc, char *argv[]) case 'P': pathtrace_select(optarg); break; + case 'q': + qflag++; + break; + case 'r': + rflag = 1; + break; case 's': i = string_to_uint(optarg); if (i < 0 || (unsigned int) i > -1U / 4) @@ -1691,22 +1695,33 @@ init(int argc, char *argv[]) case 'S': set_sortby(optarg); break; + case 't': + tflag++; + break; + case 'T': + Tflag = 1; + break; case 'u': username = optarg; break; -#ifdef USE_LIBUNWIND - case 'k': - stack_trace_enabled = true; + case 'v': + qualify("abbrev=none"); break; -#endif - case 'E': - if (putenv(optarg) < 0) - perror_msg_and_die("putenv"); + case 'V': + print_version(); + exit(0); break; - case 'I': - opt_intr = string_to_uint_upto(optarg, NUM_INTR_OPTS - 1); - if (opt_intr <= 0) - error_opt_arg(c, optarg); + case 'w': + count_wallclock = 1; + break; + case 'x': + xflag++; + break; + case 'y': + show_fd_path++; + break; + case 'z': + not_failing_only = 1; break; default: error_msg_and_help(NULL); @@ -1717,16 +1732,23 @@ init(int argc, char *argv[]) argv += optind; argc -= optind; - if (argc < 0 || (!argv[0] && !nprocs)) { + if (argc < 0 || (!nprocs && !argc)) { error_msg_and_help("must have PROG [ARGS] or -p PID"); } - if (!argv[0] && daemonized_tracer) { + if (!argc && daemonized_tracer) { error_msg_and_help("PROG [ARGS] must be specified with -D"); } - if (!followfork) - followfork = optF; + if (optF) { + if (followfork) { + error_msg("deprecated option -F ignored"); + } else { + error_msg("option -F is deprecated, " + "please use -f instead"); + followfork = optF; + } + } if (followfork >= 2 && cflag) { error_msg_and_help("(-c or -C) and -ff are mutually exclusive"); @@ -1766,7 +1788,7 @@ init(int argc, char *argv[]) sigprocmask(SIG_SETMASK, NULL, &start_set); memcpy(&blocked_set, &start_set, sizeof(blocked_set)); - set_sigaction(SIGCHLD, SIG_DFL, ¶ms_for_tracee.child_sa); + set_sighandler(SIGCHLD, SIG_DFL, ¶ms_for_tracee.child_sa); #ifdef USE_LIBUNWIND if (stack_trace_enabled) { @@ -1801,8 +1823,7 @@ init(int argc, char *argv[]) ptrace_setoptions |= PTRACE_O_TRACECLONE | PTRACE_O_TRACEFORK | PTRACE_O_TRACEVFORK; - if (debug_flag) - error_msg("ptrace_setoptions = %#x", ptrace_setoptions); + debug_msg("ptrace_setoptions = %#x", ptrace_setoptions); test_ptrace_seize(); /* @@ -1827,10 +1848,15 @@ init(int argc, char *argv[]) * when using popen, so prohibit it. */ if (followfork >= 2) - error_msg_and_help("piping the output and -ff are mutually exclusive"); + error_msg_and_help("piping the output and -ff " + "are mutually exclusive"); shared_log = strace_popen(outfname + 1); - } else if (followfork < 2) + } else if (followfork < 2) { shared_log = strace_fopen(outfname); + } else if (strlen(outfname) >= PATH_MAX - sizeof(int) * 3) { + errno = ENAMETOOLONG; + perror_msg_and_die("%s", outfname); + } } else { /* -ff without -o FILE is the same as single -f */ if (followfork >= 2) @@ -1849,7 +1875,7 @@ init(int argc, char *argv[]) * no 1 1 INTR_WHILE_WAIT */ - if (outfname && argv[0]) { + if (outfname && argc) { if (!opt_intr) opt_intr = INTR_NEVER; if (!qflag) @@ -1864,26 +1890,26 @@ init(int argc, char *argv[]) * Also we do not need to be protected by them as during interruption * in the startup_child() mode we kill the spawned process anyway. */ - if (argv[0]) { + if (argc) { startup_child(argv); } - set_sigaction(SIGTTOU, SIG_IGN, NULL); - set_sigaction(SIGTTIN, SIG_IGN, NULL); + set_sighandler(SIGTTOU, SIG_IGN, NULL); + set_sighandler(SIGTTIN, SIG_IGN, NULL); if (opt_intr != INTR_ANYWHERE) { if (opt_intr == INTR_BLOCK_TSTP_TOO) - set_sigaction(SIGTSTP, SIG_IGN, NULL); + set_sighandler(SIGTSTP, SIG_IGN, NULL); /* * In interactive mode (if no -o OUTFILE, or -p PID is used), * fatal signals are blocked while syscall stop is processed, * and acted on in between, when waiting for new syscall stops. * In non-interactive mode, signals are ignored. */ - set_sigaction(SIGHUP, interactive ? interrupt : SIG_IGN, NULL); - set_sigaction(SIGINT, interactive ? interrupt : SIG_IGN, NULL); - set_sigaction(SIGQUIT, interactive ? interrupt : SIG_IGN, NULL); - set_sigaction(SIGPIPE, interactive ? interrupt : SIG_IGN, NULL); - set_sigaction(SIGTERM, interactive ? interrupt : SIG_IGN, NULL); + set_sighandler(SIGHUP, interactive ? interrupt : SIG_IGN, NULL); + set_sighandler(SIGINT, interactive ? interrupt : SIG_IGN, NULL); + set_sighandler(SIGQUIT, interactive ? interrupt : SIG_IGN, NULL); + set_sighandler(SIGPIPE, interactive ? interrupt : SIG_IGN, NULL); + set_sighandler(SIGTERM, interactive ? interrupt : SIG_IGN, NULL); } if (nprocs != 0 || daemonized_tracer) @@ -1930,8 +1956,7 @@ cleanup(void) tcp = tcbtab[i]; if (!tcp->pid) continue; - if (debug_flag) - error_msg("cleanup: looking at pid %u", tcp->pid); + debug_func_msg("looking at pid %u", tcp->pid); if (tcp->pid == strace_child) { kill(tcp->pid, SIGCONT); kill(tcp->pid, fatal_sig); @@ -1958,17 +1983,17 @@ print_debug_info(const int pid, int status) strcpy(buf, "???"); if (WIFSIGNALED(status)) #ifdef WCOREDUMP - sprintf(buf, "WIFSIGNALED,%ssig=%s", + xsprintf(buf, "WIFSIGNALED,%ssig=%s", WCOREDUMP(status) ? "core," : "", signame(WTERMSIG(status))); #else - sprintf(buf, "WIFSIGNALED,sig=%s", + xsprintf(buf, "WIFSIGNALED,sig=%s", signame(WTERMSIG(status))); #endif if (WIFEXITED(status)) - sprintf(buf, "WIFEXITED,exitcode=%u", WEXITSTATUS(status)); + xsprintf(buf, "WIFEXITED,exitcode=%u", WEXITSTATUS(status)); if (WIFSTOPPED(status)) - sprintf(buf, "WIFSTOPPED,sig=%s", signame(WSTOPSIG(status))); + xsprintf(buf, "WIFSTOPPED,sig=%s", signame(WSTOPSIG(status))); evbuf[0] = '\0'; if (event != 0) { static const char *const event_names[] = { @@ -1985,7 +2010,7 @@ print_debug_info(const int pid, int status) e = event_names[event]; else if (event == PTRACE_EVENT_STOP) e = "STOP"; - sprintf(evbuf, ",EVENT_%s (%u)", e, event); + xsprintf(evbuf, ",EVENT_%s (%u)", e, event); } error_msg("[wait(0x%06x) = %u] %s%s", status, pid, buf, evbuf); } @@ -2136,15 +2161,13 @@ print_stopped(struct tcb *tcp, const siginfo_t *si, const unsigned int sig) static void startup_tcb(struct tcb *tcp) { - if (debug_flag) - error_msg("pid %d has TCB_STARTUP, initializing it", tcp->pid); + debug_msg("pid %d has TCB_STARTUP, initializing it", tcp->pid); tcp->flags &= ~TCB_STARTUP; if (!use_seize) { - if (debug_flag) - error_msg("setting opts 0x%x on pid %d", - ptrace_setoptions, tcp->pid); + debug_msg("setting opts 0x%x on pid %d", + ptrace_setoptions, tcp->pid); if (ptrace(PTRACE_SETOPTIONS, tcp->pid, NULL, ptrace_setoptions) < 0) { if (errno != ESRCH) { /* Should never happen, really */ @@ -2153,7 +2176,7 @@ startup_tcb(struct tcb *tcp) } } - if (get_scno(tcp) == 1) + if ((tcp->flags & TCB_GRABBED) && (get_scno(tcp) == 1)) tcp->s_prev_ent = tcp->s_ent; } @@ -2167,11 +2190,11 @@ print_event_exit(struct tcb *tcp) if (followfork < 2 && printing_tcp && printing_tcp != tcp && printing_tcp->curcol != 0) { - current_tcp = printing_tcp; + set_current_tcp(printing_tcp); tprints(" <unfinished ...>\n"); flush_tcp_output(printing_tcp); printing_tcp->curcol = 0; - current_tcp = tcp; + set_current_tcp(tcp); } if ((followfork < 2 && printing_tcp != tcp) @@ -2188,70 +2211,14 @@ print_event_exit(struct tcb *tcp) */ tprints(" <unfinished ...>"); } + + printing_tcp = tcp; tprints(") "); tabto(); tprints("= ?\n"); line_ended(); } -enum trace_event { - /* Break the main loop. */ - TE_BREAK, - - /* Call next_event() again. */ - TE_NEXT, - - /* Restart the tracee with signal 0 and call next_event() again. */ - TE_RESTART, - - /* - * For all the events below, current_tcp is set to current tracee's - * tcb. All the suggested actions imply that you want to continue - * tracing of the current tracee; alternatively, you can detach it. - */ - - /* - * Syscall entry or exit. - * Restart the tracee with signal 0, or with an injected signal number. - */ - TE_SYSCALL_STOP, - - /* - * Tracee received signal with number WSTOPSIG(*pstatus); signal info - * is written to *si. Restart the tracee (with that signal number - * if you want to deliver it). - */ - TE_SIGNAL_DELIVERY_STOP, - - /* - * Tracee was killed by a signal with number WTERMSIG(*pstatus). - */ - TE_SIGNALLED, - - /* - * Tracee was stopped by a signal with number WSTOPSIG(*pstatus). - * Restart the tracee with that signal number. - */ - TE_GROUP_STOP, - - /* - * Tracee exited with status WEXITSTATUS(*pstatus). - */ - TE_EXITED, - - /* - * Tracee is going to perform execve(). - * Restart the tracee with signal 0. - */ - TE_STOP_BEFORE_EXECVE, - - /* - * Tracee is going to terminate. - * Restart the tracee with signal 0. - */ - TE_STOP_BEFORE_EXIT, -}; - static enum trace_event next_event(int *pstatus, siginfo_t *si) { @@ -2325,10 +2292,10 @@ next_event(int *pstatus, siginfo_t *si) return TE_NEXT; } - clear_regs(); + clear_regs(tcp); /* Set current output file */ - current_tcp = tcp; + set_current_tcp(tcp); if (cflag) { tv_sub(&tcp->dtime, &ru.ru_stime, &tcp->stime); @@ -2364,8 +2331,7 @@ next_event(int *pstatus, siginfo_t *si) * just before the process takes a signal. */ if (sig == SIGSTOP && (tcp->flags & TCB_IGNORE_ONE_SIGSTOP)) { - if (debug_flag) - error_msg("ignored SIGSTOP on pid %d", tcp->pid); + debug_func_msg("ignored SIGSTOP on pid %d", tcp->pid); tcp->flags &= ~TCB_IGNORE_ONE_SIGSTOP; return TE_RESTART; } else if (sig == syscall_trap_sig) { @@ -2496,6 +2462,31 @@ dispatch_event(enum trace_event ret, int *pstatus, siginfo_t *si) case TE_STOP_BEFORE_EXECVE: /* + * Check that we are inside syscall now (next event after + * PTRACE_EVENT_EXEC should be for syscall exiting). If it is + * not the case, we might have a situation when we attach to a + * process and the first thing we see is a PTRACE_EVENT_EXEC + * and all the following syscall state tracking is screwed up + * otherwise. + */ + if (entering(current_tcp)) { + int ret; + + error_msg("Stray PTRACE_EVENT_EXEC from pid %d" + ", trying to recover...", + current_tcp->pid); + + current_tcp->flags |= TCB_RECOVERING; + ret = trace_syscall(current_tcp, &restart_sig); + current_tcp->flags &= ~TCB_RECOVERING; + + if (ret < 0) { + /* The reason is described in TE_SYSCALL_STOP */ + return true; + } + } + + /* * Under Linux, execve changes pid to thread leader's pid, * and we see this changed pid on EVENT_EXEC and later, * execve sysexit. Leader "disappears" without exit @@ -2511,7 +2502,8 @@ dispatch_event(enum trace_event ret, int *pstatus, siginfo_t *si) * On 2.6 and earlier, it can return garbage. */ if (os_release >= KERNEL_VERSION(3, 0, 0)) - current_tcp = maybe_switch_tcbs(current_tcp, current_tcp->pid); + set_current_tcp(maybe_switch_tcbs(current_tcp, + current_tcp->pid)); if (detach_on_execve) { if (current_tcp->flags & TCB_SKIP_DETACH_ON_FIRST_EXEC) { diff --git a/strace.spec b/strace.spec index 63958fb6..548ce88e 100644 --- a/strace.spec +++ b/strace.spec @@ -1,13 +1,16 @@ Summary: Tracks and displays system calls associated with a running process Name: strace -Version: 4.20 +Version: 4.21 Release: 1%{?dist} License: BSD Group: Development/Debuggers URL: https://strace.io Source: https://downloads.sourceforge.net/strace/%{name}-%{version}.tar.xz +%if 0%{?fedora} >= 18 || 0%{?centos} >= 8 || 0%{?rhel} >= 8 || 0%{?suse_version} >= 1200 +BuildRequires: pkgconfig(bluez) +%endif %if 0%{?fedora} >= 20 || 0%{?centos} >= 8 || 0%{?rhel} >= 8 || 0%{?suse_version} >= 1300 -%define buildrequires_libunwind_devel BuildRequires: libunwind-devel +%define buildrequires_libunwind_devel BuildRequires: libunwind-devel binutils-devel %endif %ifarch x86_64 # for experimental -k option @@ -48,8 +51,8 @@ The `strace' program in the `strace' package is for 32-bit processes. %prep %setup -q echo -n %version-%release > .tarball-version -echo -n 2017 > .year -echo -n 2017-08-28 > .strace.1.in.date +echo -n 2018 > .year +echo -n 2018-02-11 > .strace.1.in.date %build echo 'BEGIN OF BUILD ENVIRONMENT INFORMATION' @@ -62,7 +65,7 @@ kver="$(echo -e '#include <linux/version.h>\nLINUX_VERSION_CODE' | gcc -E -P -)" printf 'kernel-headers %%s.%%s.%%s\n' $(($kver/65536)) $(($kver/256%%256)) $(($kver%%256)) echo 'END OF BUILD ENVIRONMENT INFORMATION' -%configure +%configure --enable-mpers=check make %{?_smp_mflags} %install @@ -83,6 +86,7 @@ rm -f %{buildroot}%{_bindir}/strace-graph %endif %check +%{buildroot}%{_bindir}/strace -V make %{?_smp_mflags} -k check VERBOSE=1 echo 'BEGIN OF TEST SUITE INFORMATION' tail -n 99999 -- tests*/test-suite.log tests*/ksysent.log @@ -102,8 +106,11 @@ echo 'END OF TEST SUITE INFORMATION' %endif %changelog -* Mon Nov 13 2017 strace-devel@lists.sourceforge.net - 4.20-1 -- strace 4.20 snapshot. +* Tue Feb 13 2018 strace-devel@lists.sourceforge.net - 4.21-1 +- strace 4.21 snapshot. + +* Mon Nov 13 2017 Dmitry V. Levin <ldv@altlinux.org> - 4.20-1 +- v4.19 -> v4.20. * Tue Sep 05 2017 Dmitry V. Levin <ldv@altlinux.org> - 4.19-1 - v4.18 -> v4.19. diff --git a/strace.spec.in b/strace.spec.in index 08dd2d3a..a2a169f4 100644 --- a/strace.spec.in +++ b/strace.spec.in @@ -6,8 +6,11 @@ License: BSD Group: Development/Debuggers URL: https://strace.io Source: https://downloads.sourceforge.net/strace/%{name}-%{version}.tar.xz +%if 0%{?fedora} >= 18 || 0%{?centos} >= 8 || 0%{?rhel} >= 8 || 0%{?suse_version} >= 1200 +BuildRequires: pkgconfig(bluez) +%endif %if 0%{?fedora} >= 20 || 0%{?centos} >= 8 || 0%{?rhel} >= 8 || 0%{?suse_version} >= 1300 -%define buildrequires_libunwind_devel BuildRequires: libunwind-devel +%define buildrequires_libunwind_devel BuildRequires: libunwind-devel binutils-devel %endif %ifarch x86_64 # for experimental -k option @@ -62,7 +65,7 @@ kver="$(echo -e '#include <linux/version.h>\nLINUX_VERSION_CODE' | gcc -E -P -)" printf 'kernel-headers %%s.%%s.%%s\n' $(($kver/65536)) $(($kver/256%%256)) $(($kver%%256)) echo 'END OF BUILD ENVIRONMENT INFORMATION' -%configure +%configure --enable-mpers=check make %{?_smp_mflags} %install @@ -83,6 +86,7 @@ rm -f %{buildroot}%{_bindir}/strace-graph %endif %check +%{buildroot}%{_bindir}/strace -V make %{?_smp_mflags} -k check VERBOSE=1 echo 'BEGIN OF TEST SUITE INFORMATION' tail -n 99999 -- tests*/test-suite.log tests*/ksysent.log @@ -105,6 +109,9 @@ echo 'END OF TEST SUITE INFORMATION' * @RPM_CHANGELOGTIME@ @PACKAGE_BUGREPORT@ - @PACKAGE_VERSION@-1 - @PACKAGE_STRING@ snapshot. +* Mon Nov 13 2017 Dmitry V. Levin <ldv@altlinux.org> - 4.20-1 +- v4.19 -> v4.20. + * Tue Sep 05 2017 Dmitry V. Levin <ldv@altlinux.org> - 4.19-1 - v4.18 -> v4.19. diff --git a/string_to_uint.c b/string_to_uint.c index 223f68ad..2d3c1235 100644 --- a/string_to_uint.c +++ b/string_to_uint.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2017 The strace developers. + * Copyright (c) 2001-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,27 +30,27 @@ #endif #include <errno.h> -#include <limits.h> #include <stdlib.h> #include <string.h> #include "string_to_uint.h" -int +long long string_to_uint_ex(const char *const str, char **const endptr, - const unsigned int max_val, const char *const accepted_ending) + const unsigned long long max_val, + const char *const accepted_ending) { char *end; - long val; + long long val; if (!*str) return -1; errno = 0; - val = strtol(str, &end, 10); + val = strtoll(str, &end, 10); - if (str == end || val < 0 || (unsigned long) val > max_val - || (val == LONG_MAX && errno == ERANGE)) + if (str == end || val < 0 || (unsigned long long) val > max_val + || (val == LLONG_MAX && errno == ERANGE)) return -1; if (*end && (!accepted_ending || !strchr(accepted_ending, *end))) @@ -59,11 +59,5 @@ string_to_uint_ex(const char *const str, char **const endptr, if (endptr) *endptr = end; - return (int) val; -} - -int -string_to_uint(const char *const str) -{ - return string_to_uint_upto(str, INT_MAX); + return val; } diff --git a/string_to_uint.h b/string_to_uint.h index 6d26776f..daea1fa7 100644 --- a/string_to_uint.h +++ b/string_to_uint.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2017 The strace developers. + * Copyright (c) 2001-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -28,17 +28,42 @@ #ifndef STRACE_STRING_TO_UINT_H #define STRACE_STRING_TO_UINT_H -extern int -string_to_uint(const char *str); +#include <limits.h> -extern int +#include "kernel_types.h" + +extern long long string_to_uint_ex(const char *str, char **endptr, - unsigned int max_val, const char *accepted_ending); + unsigned long long max_val, const char *accepted_ending); -static inline int -string_to_uint_upto(const char *const str, const unsigned int max_val) +static inline long long +string_to_uint_upto(const char *const str, const unsigned long long max_val) { return string_to_uint_ex(str, NULL, max_val, NULL); } +static inline int +string_to_uint(const char *str) +{ + return string_to_uint_upto(str, INT_MAX); +} + +static inline long +string_to_ulong(const char *str) +{ + return string_to_uint_upto(str, LONG_MAX); +} + +static inline kernel_long_t +string_to_kulong(const char *str) +{ + return string_to_uint_upto(str, ((kernel_ulong_t) -1ULL) >> 1); +} + +static inline long long +string_to_ulonglong(const char *str) +{ + return string_to_uint_upto(str, LLONG_MAX); +} + #endif /* !STRACE_STRING_TO_UINT_H */ @@ -205,6 +205,7 @@ extern SYS_FUNC(renameat); extern SYS_FUNC(renameat2); extern SYS_FUNC(request_key); extern SYS_FUNC(restart_syscall); +extern SYS_FUNC(riscv_flush_icache); extern SYS_FUNC(rt_sigaction); extern SYS_FUNC(rt_sigpending); extern SYS_FUNC(rt_sigprocmask); @@ -213,6 +214,11 @@ extern SYS_FUNC(rt_sigreturn); extern SYS_FUNC(rt_sigsuspend); extern SYS_FUNC(rt_sigtimedwait); extern SYS_FUNC(rt_tgsigqueueinfo); +extern SYS_FUNC(s390_guarded_storage); +extern SYS_FUNC(s390_pci_mmio_read); +extern SYS_FUNC(s390_pci_mmio_write); +extern SYS_FUNC(s390_runtime_instr); +extern SYS_FUNC(s390_sthyi); extern SYS_FUNC(sched_getaffinity); extern SYS_FUNC(sched_getattr); extern SYS_FUNC(sched_getparam); @@ -6,7 +6,7 @@ * Copyright (c) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation * Linux for s390 port by D.J. Barrow * <barrow_dj@mail.yahoo.com,djbarrow@de.ibm.com> - * Copyright (c) 1999-2017 The strace developers. + * Copyright (c) 1999-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,9 +34,10 @@ #include "defs.h" #include "native_defs.h" +#include "ptrace.h" #include "nsig.h" #include "number_set.h" -#include <sys/param.h> +#include <limits.h> /* for struct iovec */ #include <sys/uio.h> @@ -45,7 +46,6 @@ #include <asm/unistd.h> #include "regs.h" -#include "ptrace.h" #if defined(SPARC64) # undef PTRACE_GETREGS @@ -54,21 +54,12 @@ # define PTRACE_SETREGS PTRACE_SETREGS64 #endif -#if defined SPARC64 -# include <asm/psrcompat.h> -#elif defined SPARC -# include <asm/psr.h> -#endif - -#ifdef IA64 -# include <asm/rse.h> -#endif - #ifndef NT_PRSTATUS # define NT_PRSTATUS 1 #endif #include "syscall.h" +#include "xstring.h" /* Define these shorthand notations to simplify the syscallent files. */ #include "sysent_shorthand_defs.h" @@ -222,11 +213,24 @@ const struct_sysent *const sysent_vec[SUPPORTED_PERSONALITIES] = { #endif }; +const char *const personality_names[] = +# if defined X86_64 + {"64 bit", "32 bit", "x32"} +# elif defined X32 + {"x32", "32 bit"} +# elif SUPPORTED_PERSONALITIES == 2 + {"64 bit", "32 bit"} +# else + {STRINGIFY_VAL(__WORDSIZE) " bit"} +# endif + ; + #if SUPPORTED_PERSONALITIES > 1 + unsigned current_personality; # ifndef current_wordsize -unsigned current_wordsize; +unsigned current_wordsize = PERSONALITY0_WORDSIZE; static const int personality_wordsize[SUPPORTED_PERSONALITIES] = { PERSONALITY0_WORDSIZE, PERSONALITY1_WORDSIZE, @@ -237,7 +241,7 @@ static const int personality_wordsize[SUPPORTED_PERSONALITIES] = { # endif # ifndef current_klongsize -unsigned current_klongsize; +unsigned current_klongsize = PERSONALITY0_KLONGSIZE; static const int personality_klongsize[SUPPORTED_PERSONALITIES] = { PERSONALITY0_KLONGSIZE, PERSONALITY1_KLONGSIZE, @@ -248,8 +252,15 @@ static const int personality_klongsize[SUPPORTED_PERSONALITIES] = { # endif void -set_personality(int personality) +set_personality(unsigned int personality) { + if (personality == current_personality) + return; + + if (personality >= SUPPORTED_PERSONALITIES) + error_msg_and_die("Requested switch to unsupported personality " + "%u", personality); + nsyscalls = nsyscall_vec[personality]; sysent = sysent_vec[personality]; @@ -299,29 +310,26 @@ set_personality(int personality) static void update_personality(struct tcb *tcp, unsigned int personality) { - if (personality == current_personality) - return; + static bool need_mpers_warning[] = + { false, !HAVE_PERSONALITY_1_MPERS, !HAVE_PERSONALITY_2_MPERS }; + set_personality(personality); if (personality == tcp->currpers) return; tcp->currpers = personality; -# undef PERSONALITY_NAMES -# if defined X86_64 -# define PERSONALITY_NAMES {"64 bit", "32 bit", "x32"} -# elif defined X32 -# define PERSONALITY_NAMES {"x32", "32 bit"} -# elif SUPPORTED_PERSONALITIES == 2 -# define PERSONALITY_NAMES {"64 bit", "32 bit"} -# endif -# ifdef PERSONALITY_NAMES if (!qflag) { - static const char *const names[] = PERSONALITY_NAMES; error_msg("[ Process PID=%d runs in %s mode. ]", - tcp->pid, names[personality]); + tcp->pid, personality_names[personality]); + } + + if (need_mpers_warning[personality]) { + error_msg("WARNING: Proper structure decoding for this " + "personality is not supported, please consider " + "building strace with mpers support enabled."); + need_mpers_warning[personality] = false; } -# endif } #endif @@ -350,7 +358,7 @@ decode_socket_subcall(struct tcb *tcp) tcp->u_arg[i] = (sizeof(uint32_t) == current_wordsize) ? ((uint32_t *) (void *) buf)[i] : buf[i]; } -#endif +#endif /* SYS_socket_subcall */ #ifdef SYS_ipc_subcall static void @@ -390,11 +398,11 @@ decode_ipc_subcall(struct tcb *tcp) for (i = 0; i < n; i++) tcp->u_arg[i] = tcp->u_arg[i + 1]; } -#endif +#endif /* SYS_ipc_subcall */ -#ifdef LINUX_MIPSO32 +#ifdef SYS_syscall_subcall static void -decode_mips_subcall(struct tcb *tcp) +decode_syscall_subcall(struct tcb *tcp) { if (!scno_is_valid(tcp->u_arg[0])) return; @@ -403,6 +411,7 @@ decode_mips_subcall(struct tcb *tcp) tcp->s_ent = &sysent[tcp->scno]; memmove(&tcp->u_arg[0], &tcp->u_arg[1], sizeof(tcp->u_arg) - sizeof(tcp->u_arg[0])); +# ifdef LINUX_MIPSO32 /* * Fetching the last arg of 7-arg syscalls (fadvise64_64 * and sync_file_range) requires additional code, @@ -415,8 +424,9 @@ decode_mips_subcall(struct tcb *tcp) &tcp->u_arg[MAX_ARGS - 1]) < 0) tcp->u_arg[MAX_ARGS - 1] = 0; } +# endif /* LINUX_MIPSO32 */ } -#endif /* LINUX_MIPSO32 */ +#endif /* SYS_syscall_subcall */ static void dumpio(struct tcb *tcp) @@ -476,41 +486,6 @@ dumpio(struct tcb *tcp) } } -/* - * Shuffle syscall numbers so that we don't have huge gaps in syscall table. - * The shuffling should be an involution: shuffle_scno(shuffle_scno(n)) == n. - */ -static kernel_ulong_t -shuffle_scno(kernel_ulong_t scno) -{ -#if defined(ARM) || defined(AARCH64) /* So far only 32-bit ARM needs this */ - if (scno < ARM_FIRST_SHUFFLED_SYSCALL) - return scno; - - /* __ARM_NR_cmpxchg? Swap with LAST_ORDINARY+1 */ - if (scno == ARM_FIRST_SHUFFLED_SYSCALL) - return 0x000ffff0; - if (scno == 0x000ffff0) - return ARM_FIRST_SHUFFLED_SYSCALL; - -# define ARM_SECOND_SHUFFLED_SYSCALL (ARM_FIRST_SHUFFLED_SYSCALL + 1) - /* - * Is it ARM specific syscall? - * Swap [0x000f0000, 0x000f0000 + LAST_SPECIAL] range - * with [SECOND_SHUFFLED, SECOND_SHUFFLED + LAST_SPECIAL] range. - */ - if (scno >= 0x000f0000 && - scno <= 0x000f0000 + ARM_LAST_SPECIAL_SYSCALL) { - return scno - 0x000f0000 + ARM_SECOND_SHUFFLED_SYSCALL; - } - if (scno <= ARM_SECOND_SHUFFLED_SYSCALL + ARM_LAST_SPECIAL_SYSCALL) { - return scno + 0x000f0000 - ARM_SECOND_SHUFFLED_SYSCALL; - } -#endif /* ARM || AARCH64 */ - - return scno; -} - const char * err_name(unsigned long err) { @@ -520,15 +495,7 @@ err_name(unsigned long err) return NULL; } -static long get_regs_error; - -void -clear_regs(void) -{ - get_regs_error = -1; -} - -static void get_regs(pid_t pid); +static long get_regs(struct tcb *); static int get_syscall_args(struct tcb *); static int get_syscall_result(struct tcb *); static int arch_get_scno(struct tcb *tcp); @@ -570,10 +537,13 @@ tamper_with_syscall_entering(struct tcb *tcp, unsigned int *signo) opts->first = opts->step; - if (opts->data.flags & INJECT_F_SIGNAL) - *signo = opts->data.signo; - if (opts->data.flags & INJECT_F_RETVAL && !arch_set_scno(tcp, -1)) - tcp->flags |= TCB_TAMPERED; + if (!recovering(tcp)) { + if (opts->data.flags & INJECT_F_SIGNAL) + *signo = opts->data.signo; + if (opts->data.flags & INJECT_F_RETVAL && + !arch_set_scno(tcp, -1)) + tcp->flags |= TCB_TAMPERED; + } return 0; } @@ -581,7 +551,16 @@ tamper_with_syscall_entering(struct tcb *tcp, unsigned int *signo) static long tamper_with_syscall_exiting(struct tcb *tcp) { + if (!syserror(tcp)) { + error_msg("Failed to tamper with process %d: got no error " + "(return value %#" PRI_klx ")", + tcp->pid, tcp->u_rval); + + return 1; + } + struct inject_opts *opts = tcb_inject_opts(tcp); + bool update_tcb = false; if (!opts) return 0; @@ -593,6 +572,7 @@ tamper_with_syscall_exiting(struct tcb *tcp) if (arch_set_success(tcp)) { tcp->u_rval = u_rval; } else { + update_tcb = true; tcp->u_error = 0; } } else { @@ -604,10 +584,17 @@ tamper_with_syscall_exiting(struct tcb *tcp) tcp->u_error = new_error; if (arch_set_error(tcp)) { tcp->u_error = u_error; + } else { + update_tcb = true; } } } + if (update_tcb) { + tcp->u_error = 0; + get_error(tcp, !(tcp->s_ent->sys_flags & SYSCALL_NEVER_FAILS)); + } + return 0; } @@ -636,23 +623,30 @@ syscall_entering_decode(struct tcb *tcp) return res; } -#ifdef LINUX_MIPSO32 - if (SEN_syscall == tcp->s_ent->sen) - decode_mips_subcall(tcp); -#endif - -#if defined(SYS_socket_subcall) || defined(SYS_ipc_subcall) - switch (tcp->s_ent->sen) { +#if defined SYS_ipc_subcall \ + || defined SYS_socket_subcall \ + || defined SYS_syscall_subcall + for (;;) { + switch (tcp->s_ent->sen) { +# ifdef SYS_ipc_subcall + case SEN_ipc: + decode_ipc_subcall(tcp); + break; +# endif # ifdef SYS_socket_subcall case SEN_socketcall: decode_socket_subcall(tcp); break; # endif -# ifdef SYS_ipc_subcall - case SEN_ipc: - decode_ipc_subcall(tcp); +# ifdef SYS_syscall_subcall + case SEN_syscall: + decode_syscall_subcall(tcp); + if (tcp->s_ent->sen != SEN_syscall) + continue; break; # endif + } + break; } #endif @@ -719,12 +713,6 @@ syscall_entering_finish(struct tcb *tcp, int res) gettimeofday(&tcp->etime, NULL); } -static bool -syscall_tampered(struct tcb *tcp) -{ - return tcp->flags & TCB_TAMPERED; -} - /* Returns: * 0: "bail out". * 1: ok. @@ -750,17 +738,17 @@ syscall_exiting_decode(struct tcb *tcp, struct timeval *ptv) if (filtered(tcp) || hide_log(tcp)) return 0; - get_regs(tcp->pid); #if SUPPORTED_PERSONALITIES > 1 update_personality(tcp, tcp->currpers); #endif - return get_regs_error ? -1 : get_syscall_result(tcp); + + return get_syscall_result(tcp); } int syscall_exiting_trace(struct tcb *tcp, struct timeval tv, int res) { - if (syserror(tcp) && syscall_tampered(tcp)) + if (syscall_tampered(tcp)) tamper_with_syscall_exiting(tcp); if (cflag) { @@ -820,6 +808,7 @@ syscall_exiting_trace(struct tcb *tcp, struct timeval tv, int res) tprints(") "); tabto(); unsigned long u_error = tcp->u_error; + kernel_long_t u_rval; if (raw(tcp)) { if (u_error) { @@ -887,13 +876,15 @@ syscall_exiting_trace(struct tcb *tcp, struct timeval tv, int res) tprints("= ? ERESTART_RESTARTBLOCK (Interrupted by signal)"); break; default: + u_rval = sys_res & RVAL_PRINT_ERR_VAL ? + tcp->u_rval : -1; u_error_str = err_name(u_error); if (u_error_str) - tprintf("= -1 %s (%s)", - u_error_str, strerror(u_error)); + tprintf("= %" PRI_kld " %s (%s)", + u_rval, u_error_str, strerror(u_error)); else - tprintf("= -1 %lu (%s)", - u_error, strerror(u_error)); + tprintf("= %" PRI_kld " %lu (%s)", + u_rval, u_error, strerror(u_error)); break; } if (syscall_tampered(tcp)) @@ -907,7 +898,7 @@ syscall_exiting_trace(struct tcb *tcp, struct timeval tv, int res) switch (sys_res & RVAL_MASK) { case RVAL_HEX: #if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG - if (current_wordsize < sizeof(tcp->u_rval)) { + if (current_klongsize < sizeof(tcp->u_rval)) { tprintf("= %#x", (unsigned int) tcp->u_rval); } else @@ -922,7 +913,7 @@ syscall_exiting_trace(struct tcb *tcp, struct timeval tv, int res) break; case RVAL_UDECIMAL: #if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG - if (current_wordsize < sizeof(tcp->u_rval)) { + if (current_klongsize < sizeof(tcp->u_rval)) { tprintf("= %u", (unsigned int) tcp->u_rval); } else @@ -1006,7 +997,7 @@ restore_cleared_syserror(struct tcb *tcp) #include "arch_regs.c" -#ifdef HAVE_GETRVAL2 +#if HAVE_ARCH_GETRVAL2 # include "arch_getrval2.c" #endif @@ -1018,12 +1009,11 @@ print_pc(struct tcb *tcp) #elif defined ARCH_PC_PEEK_ADDR kernel_ulong_t pc; # define ARCH_PC_REG pc -# define ARCH_GET_PC upeek(tcp->pid, ARCH_PC_PEEK_ADDR, &pc) +# define ARCH_GET_PC upeek(tcp, ARCH_PC_PEEK_ADDR, &pc) #else # error Neither ARCH_PC_REG nor ARCH_PC_PEEK_ADDR is defined #endif - get_regs(tcp->pid); - if (get_regs_error || ARCH_GET_PC) + if (get_regs(tcp) < 0 || ARCH_GET_PC) tprints(current_wordsize == 4 ? "[????????] " : "[????????????????] "); else @@ -1108,14 +1098,25 @@ ptrace_setregs(pid_t pid) #endif /* ARCH_REGS_FOR_GETREGSET || ARCH_REGS_FOR_GETREGS */ -static void -get_regs(pid_t pid) +#ifdef ptrace_getregset_or_getregs +static long get_regs_error; +#endif + +void +clear_regs(struct tcb *tcp) +{ +#ifdef ptrace_getregset_or_getregs + get_regs_error = -1; +#endif +} + +static long +get_regs(struct tcb *const tcp) { -#undef USE_GET_SYSCALL_RESULT_REGS #ifdef ptrace_getregset_or_getregs if (get_regs_error != -1) - return; + return get_regs_error; # ifdef HAVE_GETREGS_OLD /* @@ -1124,29 +1125,57 @@ get_regs(pid_t pid) */ static int use_getregs_old; if (use_getregs_old < 0) { - get_regs_error = ptrace_getregset_or_getregs(pid); - return; + return get_regs_error = ptrace_getregset_or_getregs(tcp->pid); } else if (use_getregs_old == 0) { - get_regs_error = ptrace_getregset_or_getregs(pid); + get_regs_error = ptrace_getregset_or_getregs(tcp->pid); if (get_regs_error >= 0) { use_getregs_old = -1; - return; + return get_regs_error; } if (errno == EPERM || errno == ESRCH) - return; + return get_regs_error; use_getregs_old = 1; } - get_regs_error = getregs_old(pid); + return get_regs_error = getregs_old(tcp); # else /* !HAVE_GETREGS_OLD */ /* Assume that PTRACE_GETREGSET/PTRACE_GETREGS works. */ - get_regs_error = ptrace_getregset_or_getregs(pid); + get_regs_error = ptrace_getregset_or_getregs(tcp->pid); + +# if defined ARCH_PERSONALITY_0_IOV_SIZE + if (get_regs_error) + return get_regs_error; + + switch (ARCH_IOVEC_FOR_GETREGSET.iov_len) { + case ARCH_PERSONALITY_0_IOV_SIZE: + update_personality(tcp, 0); + break; + case ARCH_PERSONALITY_1_IOV_SIZE: + update_personality(tcp, 1); + break; + default: { + static bool printed = false; + + if (!printed) { + error_msg("Unsupported regset size returned by " + "PTRACE_GETREGSET: %zu", + ARCH_IOVEC_FOR_GETREGSET.iov_len); + + printed = true; + } + + update_personality(tcp, 0); + } + } +# endif /* ARCH_PERSONALITY_0_IOV_SIZE */ + + return get_regs_error; + # endif /* !HAVE_GETREGS_OLD */ #else /* !ptrace_getregset_or_getregs */ -# define USE_GET_SYSCALL_RESULT_REGS 1 # warning get_regs is not implemented for this architecture yet - get_regs_error = 0; + return 0; #endif /* !ptrace_getregset_or_getregs */ } @@ -1162,7 +1191,7 @@ set_regs(pid_t pid) struct sysent_buf { struct tcb *tcp; struct_sysent ent; - char buf[sizeof("syscall_%lu") + sizeof(kernel_ulong_t) * 3]; + char buf[sizeof("syscall_0x") + sizeof(kernel_ulong_t) * 2]; }; static void @@ -1184,15 +1213,15 @@ free_sysent_buf(void *ptr) int get_scno(struct tcb *tcp) { - get_regs(tcp->pid); - - if (get_regs_error) + if (get_regs(tcp) < 0) return -1; int rc = arch_get_scno(tcp); if (rc != 1) return rc; + tcp->scno = shuffle_scno(tcp->scno); + if (scno_is_valid(tcp->scno)) { tcp->s_ent = &sysent[tcp->scno]; tcp->qual_flg = qual_flags(tcp->scno); @@ -1204,21 +1233,31 @@ get_scno(struct tcb *tcp) s->ent.sen = SEN_printargs; s->ent.sys_func = printargs; s->ent.sys_name = s->buf; - sprintf(s->buf, "syscall_%" PRI_klu, shuffle_scno(tcp->scno)); + xsprintf(s->buf, "syscall_%#" PRI_klx, shuffle_scno(tcp->scno)); tcp->s_ent = &s->ent; tcp->qual_flg = QUAL_RAW | DEFAULT_QUAL_FLAGS; set_tcb_priv_data(tcp, s, free_sysent_buf); - if (debug_flag) - error_msg("pid %d invalid syscall %" PRI_kld, - tcp->pid, tcp->scno); + debug_msg("pid %d invalid syscall %#" PRI_klx, + tcp->pid, shuffle_scno(tcp->scno)); } + + /* + * We refrain from argument decoding during recovering + * as tracee memory mappings has changed and the registers + * are very likely pointing to garbage already. + */ + if (recovering(tcp)) + tcp->qual_flg |= QUAL_RAW; + return 1; } -#ifdef USE_GET_SYSCALL_RESULT_REGS +#ifdef ptrace_getregset_or_getregs +# define get_syscall_result_regs get_regs +#else static int get_syscall_result_regs(struct tcb *); #endif @@ -1230,12 +1269,12 @@ static int get_syscall_result_regs(struct tcb *); static int get_syscall_result(struct tcb *tcp) { -#ifdef USE_GET_SYSCALL_RESULT_REGS - if (get_syscall_result_regs(tcp)) + if (get_syscall_result_regs(tcp) < 0) return -1; -#endif tcp->u_error = 0; - get_error(tcp, !(tcp->s_ent->sys_flags & SYSCALL_NEVER_FAILS)); + get_error(tcp, + !(tcp->s_ent->sys_flags & SYSCALL_NEVER_FAILS) + || syscall_tampered(tcp)); return 1; } @@ -1243,7 +1282,7 @@ get_syscall_result(struct tcb *tcp) #include "get_scno.c" #include "set_scno.c" #include "get_syscall_args.c" -#ifdef USE_GET_SYSCALL_RESULT_REGS +#ifndef ptrace_getregset_or_getregs # include "get_syscall_result.c" #endif #include "get_error.c" @@ -1251,13 +1290,10 @@ get_syscall_result(struct tcb *tcp) #ifdef HAVE_GETREGS_OLD # include "getregs_old.c" #endif +#include "shuffle_scno.c" const char * syscall_name(kernel_ulong_t scno) { -#if defined X32_PERSONALITY_NUMBER && defined __X32_SYSCALL_BIT - if (current_personality == X32_PERSONALITY_NUMBER) - scno &= ~__X32_SYSCALL_BIT; -#endif return scno_is_valid(scno) ? sysent[scno].sys_name : NULL; } @@ -28,5 +28,6 @@ typedef struct sysent { #define TRACE_STATFS_LIKE 00200000 /* Trace statfs-like, fstatfs-like and ustat syscalls. */ #define TRACE_FSTAT 00400000 /* Trace *fstat{,at}{,64} syscalls. */ #define TRACE_STAT_LIKE 01000000 /* Trace *{,l,f}stat{,x,at}{,64} syscalls. */ +#define TRACE_PURE 02000000 /* Trace getter syscalls with no arguments. */ #endif /* !STRACE_SYSENT_H */ diff --git a/sysent_shorthand_defs.h b/sysent_shorthand_defs.h index 911fc33d..ce435504 100644 --- a/sysent_shorthand_defs.h +++ b/sysent_shorthand_defs.h @@ -14,6 +14,7 @@ # define TSF 0 # define TFSF 0 # define TSFA 0 +# define PU 0 # define NF 0 # define MA 0 # define SI 0 @@ -37,6 +38,7 @@ # define TSF TRACE_STATFS # define TFSF TRACE_FSTATFS # define TSFA TRACE_STATFS_LIKE +# define PU TRACE_PURE # define NF SYSCALL_NEVER_FAILS # define MA MAX_ARGS # define SI STACKTRACE_INVALIDATE_CACHE diff --git a/tests-m32/Makefile.am b/tests-m32/Makefile.am index e5aa0773..f0aed3f3 100644 --- a/tests-m32/Makefile.am +++ b/tests-m32/Makefile.am @@ -1,7 +1,7 @@ # Automake input for strace tests. # # Copyright (c) 2011-2016 Dmitry V. Levin <ldv@altlinux.org> -# Copyright (c) 2011-2017 The strace developers. +# Copyright (c) 2011-2018 The strace developers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -28,8 +28,12 @@ OS = linux ARCH = @arch_m32@ +NATIVE_ARCH = @arch_native@ +SIZEOF_KERNEL_LONG_T = 4 +SIZEOF_LONG = 4 MPERS_NAME = m32 -ARCH_MFLAGS = -DMPERS_IS_$(MPERS_NAME) -m32 +MPERS_CC_FLAGS = @cc_flags_m32@ +ARCH_MFLAGS = -DMPERS_IS_$(MPERS_NAME) $(MPERS_CC_FLAGS) AM_CFLAGS = $(WARN_CFLAGS) AM_CPPFLAGS = $(ARCH_MFLAGS) \ -I$(builddir) \ @@ -80,6 +84,7 @@ LDADD = libtests.a include pure_executables.am check_PROGRAMS = $(PURE_EXECUTABLES) \ + _newselect-P \ answer \ attach-f-p \ attach-f-p-cmd \ @@ -117,6 +122,9 @@ check_PROGRAMS = $(PURE_EXECUTABLES) \ netlink_netlink_diag \ netlink_unix_diag \ nsyscalls \ + nsyscalls-d \ + oldselect-P \ + oldselect-efault-P \ pc \ perf_event_open_nonverbose \ perf_event_open_unabbrev \ @@ -137,12 +145,14 @@ check_PROGRAMS = $(PURE_EXECUTABLES) \ scm_rights \ seccomp-filter-v \ seccomp-strict \ + select-P \ set_ptracer_any \ set_sigblock \ set_sigign \ signal_receive \ sleep \ stack-fcall \ + stack-fcall-mangled \ threads-execve \ unblock_reset_raise \ unix-pair-send-recv \ @@ -182,10 +192,17 @@ uio_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64 stack_fcall_SOURCES = stack-fcall.c \ stack-fcall-0.c stack-fcall-1.c stack-fcall-2.c stack-fcall-3.c +stack_fcall_mangled_SOURCES = stack-fcall-mangled.c \ + stack-fcall-mangled-0.c stack-fcall-mangled-1.c \ + stack-fcall-mangled-2.c stack-fcall-mangled-3.c + include gen_tests.am if USE_LIBUNWIND LIBUNWIND_TESTS = strace-k.test +if USE_DEMANGLE +LIBUNWIND_TESTS += strace-k-demangle.test +endif else LIBUNWIND_TESTS = endif @@ -204,11 +221,6 @@ DECODER_TESTS = \ futex.test \ getuid.test \ ioctl.test \ - ioctl_dm-v.test \ - ioctl_dm.test \ - ioctl_loop-nv.test \ - ioctl_nsfs.test \ - ioctl_sock_gifconf.test \ ipc_msgbuf.test \ llseek.test \ lseek.test \ @@ -220,9 +232,11 @@ DECODER_TESTS = \ net.test \ netlink_sock_diag.test \ nsyscalls.test \ - oldselect.test \ + nsyscalls-d.test \ + nsyscalls-nd.test \ personality.test \ pipe.test \ + poll-P.test \ poll.test \ prctl-arg2-intptr.test \ prctl-dumpable.test \ @@ -241,6 +255,7 @@ DECODER_TESTS = \ seccomp-strict.test \ sigaltstack.test \ sun_path.test \ + xet_thread_area_x86.test \ uio.test \ umount.test \ umount2.test \ @@ -263,6 +278,8 @@ MISC_TESTS = \ detach-sleeping.test \ detach-stopped.test \ filter-unavailable.test \ + filtering_fd-syntax.test \ + filtering_syscall-syntax.test \ fflush.test \ get_regs.test \ interactive_block.test \ @@ -309,13 +326,18 @@ XFAIL_TESTS_x32 = int_0x80.gen.test XFAIL_TESTS = $(XFAIL_TESTS_$(MPERS_NAME)) $(XFAIL_TESTS_$(ARCH)) TEST_LOG_COMPILER = env -AM_TEST_LOG_FLAGS = STRACE_ARCH=$(ARCH) MIPS_ABI=$(MIPS_ABI) $(srcdir)/run.sh +AM_TEST_LOG_FLAGS = STRACE_ARCH=$(ARCH) STRACE_NATIVE_ARCH=$(NATIVE_ARCH) \ + SIZEOF_KERNEL_LONG_T=$(SIZEOF_KERNEL_LONG_T) \ + SIZEOF_LONG=$(SIZEOF_LONG) \ + MIPS_ABI=$(MIPS_ABI) $(srcdir)/run.sh @VALGRIND_CHECK_RULES@ VALGRIND_FLAGS = --quiet VALGRIND_SUPPRESSIONS_FILES = $(abs_srcdir)/strace.supp EXTRA_DIST = \ + accept_compat.h \ + attach-p-cmd.h \ caps-abbrev.awk \ caps.awk \ clock.in \ @@ -331,7 +353,6 @@ EXTRA_DIST = \ getresugid.c \ init.sh \ init_delete_module.h \ - ioctl-v.sh \ ipc.sh \ ipc_msgbuf.expected \ ksysent.sed \ @@ -339,8 +360,8 @@ EXTRA_DIST = \ match.awk \ net.expected \ netlink_sock_diag-v.sh \ - oldselect.expected \ pipe.expected \ + print_user_desc.c \ process_vm_readv_writev.c \ pure_executables.list \ qual_fault-exit_group.expected \ @@ -358,10 +379,12 @@ EXTRA_DIST = \ setugid.c \ sigaltstack.expected \ sockname.c \ + stack-fcall.h \ strace-C.expected \ strace-E.expected \ strace-T.expected \ strace-ff.expected \ + strace-k-demangle.test \ strace-k.test \ strace-r.expected \ strace.supp \ diff --git a/tests-m32/Makefile.in b/tests-m32/Makefile.in index 7c52fbaf..9469c444 100644 --- a/tests-m32/Makefile.in +++ b/tests-m32/Makefile.in @@ -17,7 +17,7 @@ # Automake input for strace tests. # # Copyright (c) 2011-2016 Dmitry V. Levin <ldv@altlinux.org> -# Copyright (c) 2011-2017 The strace developers. +# Copyright (c) 2011-2018 The strace developers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -136,23 +136,25 @@ DIST_COMMON = $(srcdir)/pure_executables.am $(srcdir)/gen_tests.am \ $(srcdir)/../scno.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am $(top_srcdir)/depcomp \ $(top_srcdir)/test-driver -check_PROGRAMS = $(am__EXEEXT_1) answer$(EXEEXT) attach-f-p$(EXEEXT) \ - attach-f-p-cmd$(EXEEXT) attach-p-cmd-cmd$(EXEEXT) \ - attach-p-cmd-p$(EXEEXT) block_reset_raise_run$(EXEEXT) \ - caps-abbrev$(EXEEXT) check_sigblock$(EXEEXT) \ - check_sigign$(EXEEXT) clone_parent$(EXEEXT) \ - clone_ptrace$(EXEEXT) count-f$(EXEEXT) execve-v$(EXEEXT) \ - execveat-v$(EXEEXT) filter-unavailable$(EXEEXT) \ - fork-f$(EXEEXT) getpid$(EXEEXT) getppid$(EXEEXT) \ - gettid$(EXEEXT) int_0x80$(EXEEXT) ioctl_dm-v$(EXEEXT) \ - ioctl_evdev-v$(EXEEXT) ioctl_loop-nv$(EXEEXT) \ - ioctl_loop-v$(EXEEXT) ioctl_nsfs$(EXEEXT) ioctl_rtc-v$(EXEEXT) \ +check_PROGRAMS = $(am__EXEEXT_1) _newselect-P$(EXEEXT) answer$(EXEEXT) \ + attach-f-p$(EXEEXT) attach-f-p-cmd$(EXEEXT) \ + attach-p-cmd-cmd$(EXEEXT) attach-p-cmd-p$(EXEEXT) \ + block_reset_raise_run$(EXEEXT) caps-abbrev$(EXEEXT) \ + check_sigblock$(EXEEXT) check_sigign$(EXEEXT) \ + clone_parent$(EXEEXT) clone_ptrace$(EXEEXT) count-f$(EXEEXT) \ + execve-v$(EXEEXT) execveat-v$(EXEEXT) \ + filter-unavailable$(EXEEXT) fork-f$(EXEEXT) getpid$(EXEEXT) \ + getppid$(EXEEXT) gettid$(EXEEXT) int_0x80$(EXEEXT) \ + ioctl_dm-v$(EXEEXT) ioctl_evdev-v$(EXEEXT) \ + ioctl_loop-nv$(EXEEXT) ioctl_loop-v$(EXEEXT) \ + ioctl_nsfs$(EXEEXT) ioctl_rtc-v$(EXEEXT) \ is_linux_mips_n64$(EXEEXT) ksysent$(EXEEXT) \ list_sigaction_signum$(EXEEXT) mmsg-silent$(EXEEXT) \ mmsg_name-v$(EXEEXT) msg_control-v$(EXEEXT) \ net-accept-connect$(EXEEXT) netlink_inet_diag$(EXEEXT) \ netlink_netlink_diag$(EXEEXT) netlink_unix_diag$(EXEEXT) \ - nsyscalls$(EXEEXT) pc$(EXEEXT) \ + nsyscalls$(EXEEXT) nsyscalls-d$(EXEEXT) oldselect-P$(EXEEXT) \ + oldselect-efault-P$(EXEEXT) pc$(EXEEXT) \ perf_event_open_nonverbose$(EXEEXT) \ perf_event_open_unabbrev$(EXEEXT) ppoll-v$(EXEEXT) \ prctl-seccomp-filter-v$(EXEEXT) prctl-seccomp-strict$(EXEEXT) \ @@ -163,19 +165,21 @@ check_PROGRAMS = $(am__EXEEXT_1) answer$(EXEEXT) attach-f-p$(EXEEXT) \ redirect-fds$(EXEEXT) restart_syscall$(EXEEXT) \ run_expect_termsig$(EXEEXT) scm_rights$(EXEEXT) \ seccomp-filter-v$(EXEEXT) seccomp-strict$(EXEEXT) \ - set_ptracer_any$(EXEEXT) set_sigblock$(EXEEXT) \ - set_sigign$(EXEEXT) signal_receive$(EXEEXT) sleep$(EXEEXT) \ - stack-fcall$(EXEEXT) threads-execve$(EXEEXT) \ + select-P$(EXEEXT) set_ptracer_any$(EXEEXT) \ + set_sigblock$(EXEEXT) set_sigign$(EXEEXT) \ + signal_receive$(EXEEXT) sleep$(EXEEXT) stack-fcall$(EXEEXT) \ + stack-fcall-mangled$(EXEEXT) threads-execve$(EXEEXT) \ unblock_reset_raise$(EXEEXT) unix-pair-send-recv$(EXEEXT) \ unix-pair-sendto-recvfrom$(EXEEXT) vfork-f$(EXEEXT) \ wait4-v$(EXEEXT) waitid-v$(EXEEXT) zeroargc$(EXEEXT) +@USE_DEMANGLE_TRUE@@USE_LIBUNWIND_TRUE@am__append_1 = strace-k-demangle.test TESTS = $(GEN_TESTS) $(DECODER_TESTS) $(MISC_TESTS) $(am__EXEEXT_2) subdir = tests-m32 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_prog_cc_for_build.m4 \ $(top_srcdir)/m4/ax_valgrind_check.m4 \ - $(top_srcdir)/m4/mpers.m4 $(top_srcdir)/m4/st_bpf.m4 \ + $(top_srcdir)/m4/mpers.m4 \ $(top_srcdir)/m4/st_save_restore_var.m4 \ $(top_srcdir)/m4/st_warn_cflags.m4 \ $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/configure.ac @@ -250,8 +254,9 @@ am__EXEEXT_1 = _newselect$(EXEEXT) accept$(EXEEXT) accept4$(EXEEXT) \ getxxid$(EXEEXT) group_req$(EXEEXT) inet-cmsg$(EXEEXT) \ init_module$(EXEEXT) inotify$(EXEEXT) inotify_init1$(EXEEXT) \ ioctl$(EXEEXT) ioctl_block$(EXEEXT) ioctl_dm$(EXEEXT) \ - ioctl_evdev$(EXEEXT) ioctl_loop$(EXEEXT) ioctl_mtd$(EXEEXT) \ - ioctl_rtc$(EXEEXT) ioctl_scsi$(EXEEXT) ioctl_sg_io_v3$(EXEEXT) \ + ioctl_evdev$(EXEEXT) ioctl_kvm_run$(EXEEXT) \ + ioctl_loop$(EXEEXT) ioctl_mtd$(EXEEXT) ioctl_rtc$(EXEEXT) \ + ioctl_scsi$(EXEEXT) ioctl_sg_io_v3$(EXEEXT) \ ioctl_sg_io_v4$(EXEEXT) ioctl_sock_gifconf$(EXEEXT) \ ioctl_uffdio$(EXEEXT) ioctl_v4l2$(EXEEXT) ioperm$(EXEEXT) \ iopl$(EXEEXT) ioprio$(EXEEXT) ip_mreq$(EXEEXT) ipc$(EXEEXT) \ @@ -266,12 +271,12 @@ am__EXEEXT_1 = _newselect$(EXEEXT) accept$(EXEEXT) accept4$(EXEEXT) \ mkdir$(EXEEXT) mkdirat$(EXEEXT) mknod$(EXEEXT) \ mknodat$(EXEEXT) mlock$(EXEEXT) mlock2$(EXEEXT) \ mlockall$(EXEEXT) mmap$(EXEEXT) mmap64$(EXEEXT) mmsg$(EXEEXT) \ - mmsg_name$(EXEEXT) mount$(EXEEXT) move_pages$(EXEEXT) \ - mq$(EXEEXT) mq_sendrecv$(EXEEXT) mq_sendrecv-read$(EXEEXT) \ - mq_sendrecv-write$(EXEEXT) msg_control$(EXEEXT) \ - msg_name$(EXEEXT) munlockall$(EXEEXT) nanosleep$(EXEEXT) \ - net-icmp_filter$(EXEEXT) net-sockaddr$(EXEEXT) \ - net-y-unix$(EXEEXT) net-yy-inet$(EXEEXT) \ + mmsg_name$(EXEEXT) modify_ldt$(EXEEXT) mount$(EXEEXT) \ + move_pages$(EXEEXT) mq$(EXEEXT) mq_sendrecv$(EXEEXT) \ + mq_sendrecv-read$(EXEEXT) mq_sendrecv-write$(EXEEXT) \ + msg_control$(EXEEXT) msg_name$(EXEEXT) munlockall$(EXEEXT) \ + nanosleep$(EXEEXT) net-icmp_filter$(EXEEXT) \ + net-sockaddr$(EXEEXT) net-y-unix$(EXEEXT) net-yy-inet$(EXEEXT) \ net-yy-netlink$(EXEEXT) net-yy-unix$(EXEEXT) \ netlink_audit$(EXEEXT) netlink_crypto$(EXEEXT) \ netlink_generic$(EXEEXT) netlink_kobject_uevent$(EXEEXT) \ @@ -301,16 +306,18 @@ am__EXEEXT_1 = _newselect$(EXEEXT) accept$(EXEEXT) accept4$(EXEEXT) \ nlattr_tc_stats$(EXEEXT) nlattr_tca_stab$(EXEEXT) \ nlattr_tcamsg$(EXEEXT) nlattr_tcmsg$(EXEEXT) \ nlattr_unix_diag_msg$(EXEEXT) old_mmap$(EXEEXT) \ - oldfstat$(EXEEXT) oldlstat$(EXEEXT) oldselect$(EXEEXT) \ + old_mmap-P$(EXEEXT) old_mmap-v-none$(EXEEXT) oldfstat$(EXEEXT) \ + oldlstat$(EXEEXT) oldselect$(EXEEXT) oldselect-efault$(EXEEXT) \ oldstat$(EXEEXT) open$(EXEEXT) openat$(EXEEXT) \ osf_utimes$(EXEEXT) pause$(EXEEXT) perf_event_open$(EXEEXT) \ personality$(EXEEXT) pipe$(EXEEXT) pipe2$(EXEEXT) \ pkey_alloc$(EXEEXT) pkey_free$(EXEEXT) pkey_mprotect$(EXEEXT) \ - poll$(EXEEXT) ppoll$(EXEEXT) prctl-arg2-intptr$(EXEEXT) \ - prctl-dumpable$(EXEEXT) prctl-name$(EXEEXT) \ - prctl-no-args$(EXEEXT) prctl-pdeathsig$(EXEEXT) \ - prctl-securebits$(EXEEXT) prctl-tid_address$(EXEEXT) \ - prctl-tsc$(EXEEXT) pread64-pwrite64$(EXEEXT) preadv$(EXEEXT) \ + poll$(EXEEXT) poll-P$(EXEEXT) ppoll$(EXEEXT) ppoll-P$(EXEEXT) \ + prctl-arg2-intptr$(EXEEXT) prctl-dumpable$(EXEEXT) \ + prctl-name$(EXEEXT) prctl-no-args$(EXEEXT) \ + prctl-pdeathsig$(EXEEXT) prctl-securebits$(EXEEXT) \ + prctl-tid_address$(EXEEXT) prctl-tsc$(EXEEXT) \ + pread64-pwrite64$(EXEEXT) preadv$(EXEEXT) \ preadv-pwritev$(EXEEXT) preadv2-pwritev2$(EXEEXT) \ printpath-umovestr$(EXEEXT) \ printpath-umovestr-peekdata$(EXEEXT) \ @@ -324,11 +331,15 @@ am__EXEEXT_1 = _newselect$(EXEEXT) accept$(EXEEXT) accept4$(EXEEXT) \ readlinkat$(EXEEXT) readv$(EXEEXT) reboot$(EXEEXT) \ recvfrom$(EXEEXT) recvmmsg-timeout$(EXEEXT) recvmsg$(EXEEXT) \ remap_file_pages$(EXEEXT) rename$(EXEEXT) renameat$(EXEEXT) \ - renameat2$(EXEEXT) request_key$(EXEEXT) rmdir$(EXEEXT) \ + renameat2$(EXEEXT) request_key$(EXEEXT) \ + riscv_flush_icache$(EXEEXT) rmdir$(EXEEXT) \ rt_sigaction$(EXEEXT) rt_sigpending$(EXEEXT) \ rt_sigprocmask$(EXEEXT) rt_sigqueueinfo$(EXEEXT) \ rt_sigreturn$(EXEEXT) rt_sigsuspend$(EXEEXT) \ rt_sigtimedwait$(EXEEXT) rt_tgsigqueueinfo$(EXEEXT) \ + s390_guarded_storage$(EXEEXT) s390_guarded_storage-v$(EXEEXT) \ + s390_pci_mmio_read_write$(EXEEXT) s390_runtime_instr$(EXEEXT) \ + s390_sthyi$(EXEEXT) s390_sthyi-v$(EXEEXT) \ sched_get_priority_mxx$(EXEEXT) sched_rr_get_interval$(EXEEXT) \ sched_xetaffinity$(EXEEXT) sched_xetattr$(EXEEXT) \ sched_xetparam$(EXEEXT) sched_xetscheduler$(EXEEXT) \ @@ -348,30 +359,34 @@ am__EXEEXT_1 = _newselect$(EXEEXT) accept$(EXEEXT) accept4$(EXEEXT) \ signalfd4$(EXEEXT) sigpending$(EXEEXT) sigprocmask$(EXEEXT) \ sigreturn$(EXEEXT) sigsuspend$(EXEEXT) so_linger$(EXEEXT) \ so_peercred$(EXEEXT) sock_filter-v$(EXEEXT) \ - socketcall$(EXEEXT) splice$(EXEEXT) stat$(EXEEXT) \ - stat64$(EXEEXT) statfs$(EXEEXT) statfs64$(EXEEXT) \ - statx$(EXEEXT) swap$(EXEEXT) sxetmask$(EXEEXT) \ - symlink$(EXEEXT) symlinkat$(EXEEXT) sync$(EXEEXT) \ - sync_file_range$(EXEEXT) sync_file_range2$(EXEEXT) \ - sysinfo$(EXEEXT) syslog$(EXEEXT) tee$(EXEEXT) time$(EXEEXT) \ - timer_create$(EXEEXT) timer_xettime$(EXEEXT) \ - timerfd_xettime$(EXEEXT) times$(EXEEXT) times-fail$(EXEEXT) \ - truncate$(EXEEXT) truncate64$(EXEEXT) ugetrlimit$(EXEEXT) \ - uio$(EXEEXT) umask$(EXEEXT) umount$(EXEEXT) umount2$(EXEEXT) \ - umoven-illptr$(EXEEXT) umovestr$(EXEEXT) \ - umovestr-illptr$(EXEEXT) umovestr2$(EXEEXT) umovestr3$(EXEEXT) \ - uname$(EXEEXT) unlink$(EXEEXT) unlinkat$(EXEEXT) \ - unshare$(EXEEXT) userfaultfd$(EXEEXT) ustat$(EXEEXT) \ - utime$(EXEEXT) utimensat$(EXEEXT) utimes$(EXEEXT) \ - vhangup$(EXEEXT) vmsplice$(EXEEXT) wait4$(EXEEXT) \ - waitid$(EXEEXT) waitpid$(EXEEXT) xattr$(EXEEXT) \ + socketcall$(EXEEXT) sockopt-sol_netlink$(EXEEXT) \ + splice$(EXEEXT) stat$(EXEEXT) stat64$(EXEEXT) statfs$(EXEEXT) \ + statfs64$(EXEEXT) statx$(EXEEXT) swap$(EXEEXT) \ + sxetmask$(EXEEXT) symlink$(EXEEXT) symlinkat$(EXEEXT) \ + sync$(EXEEXT) sync_file_range$(EXEEXT) \ + sync_file_range2$(EXEEXT) sysinfo$(EXEEXT) syslog$(EXEEXT) \ + tee$(EXEEXT) time$(EXEEXT) timer_create$(EXEEXT) \ + timer_xettime$(EXEEXT) timerfd_xettime$(EXEEXT) times$(EXEEXT) \ + times-fail$(EXEEXT) truncate$(EXEEXT) truncate64$(EXEEXT) \ + ugetrlimit$(EXEEXT) uio$(EXEEXT) umask$(EXEEXT) \ + umount$(EXEEXT) umount2$(EXEEXT) umoven-illptr$(EXEEXT) \ + umovestr$(EXEEXT) umovestr-illptr$(EXEEXT) umovestr2$(EXEEXT) \ + umovestr3$(EXEEXT) uname$(EXEEXT) unlink$(EXEEXT) \ + unlinkat$(EXEEXT) unshare$(EXEEXT) userfaultfd$(EXEEXT) \ + ustat$(EXEEXT) utime$(EXEEXT) utimensat$(EXEEXT) \ + utimes$(EXEEXT) vhangup$(EXEEXT) vmsplice$(EXEEXT) \ + wait4$(EXEEXT) waitid$(EXEEXT) waitpid$(EXEEXT) xattr$(EXEEXT) \ xattr-strings$(EXEEXT) xet_robust_list$(EXEEXT) \ - xetitimer$(EXEEXT) xetpgid$(EXEEXT) xetpriority$(EXEEXT) \ - xettimeofday$(EXEEXT) + xet_thread_area_x86$(EXEEXT) xetitimer$(EXEEXT) \ + xetpgid$(EXEEXT) xetpriority$(EXEEXT) xettimeofday$(EXEEXT) _newselect_SOURCES = _newselect.c _newselect_OBJECTS = _newselect.$(OBJEXT) _newselect_LDADD = $(LDADD) _newselect_DEPENDENCIES = libtests.a +_newselect_P_SOURCES = _newselect-P.c +_newselect_P_OBJECTS = _newselect-P.$(OBJEXT) +_newselect_P_LDADD = $(LDADD) +_newselect_P_DEPENDENCIES = libtests.a accept_SOURCES = accept.c accept_OBJECTS = accept.$(OBJEXT) accept_LDADD = $(LDADD) @@ -860,6 +875,10 @@ ioctl_evdev_v_SOURCES = ioctl_evdev-v.c ioctl_evdev_v_OBJECTS = ioctl_evdev-v.$(OBJEXT) ioctl_evdev_v_LDADD = $(LDADD) ioctl_evdev_v_DEPENDENCIES = libtests.a +ioctl_kvm_run_SOURCES = ioctl_kvm_run.c +ioctl_kvm_run_OBJECTS = ioctl_kvm_run.$(OBJEXT) +ioctl_kvm_run_LDADD = $(LDADD) +ioctl_kvm_run_DEPENDENCIES = libtests.a ioctl_loop_SOURCES = ioctl_loop.c ioctl_loop_OBJECTS = ioctl_loop.$(OBJEXT) ioctl_loop_LDADD = $(LDADD) @@ -1096,6 +1115,10 @@ mmsg_name_v_SOURCES = mmsg_name-v.c mmsg_name_v_OBJECTS = mmsg_name-v.$(OBJEXT) mmsg_name_v_LDADD = $(LDADD) mmsg_name_v_DEPENDENCIES = libtests.a +modify_ldt_SOURCES = modify_ldt.c +modify_ldt_OBJECTS = modify_ldt.$(OBJEXT) +modify_ldt_LDADD = $(LDADD) +modify_ldt_DEPENDENCIES = libtests.a mount_SOURCES = mount.c mount_OBJECTS = mount.$(OBJEXT) mount_LDADD = $(LDADD) @@ -1389,10 +1412,22 @@ nsyscalls_SOURCES = nsyscalls.c nsyscalls_OBJECTS = nsyscalls.$(OBJEXT) nsyscalls_LDADD = $(LDADD) nsyscalls_DEPENDENCIES = libtests.a +nsyscalls_d_SOURCES = nsyscalls-d.c +nsyscalls_d_OBJECTS = nsyscalls-d.$(OBJEXT) +nsyscalls_d_LDADD = $(LDADD) +nsyscalls_d_DEPENDENCIES = libtests.a old_mmap_SOURCES = old_mmap.c old_mmap_OBJECTS = old_mmap.$(OBJEXT) old_mmap_LDADD = $(LDADD) old_mmap_DEPENDENCIES = libtests.a +old_mmap_P_SOURCES = old_mmap-P.c +old_mmap_P_OBJECTS = old_mmap-P.$(OBJEXT) +old_mmap_P_LDADD = $(LDADD) +old_mmap_P_DEPENDENCIES = libtests.a +old_mmap_v_none_SOURCES = old_mmap-v-none.c +old_mmap_v_none_OBJECTS = old_mmap-v-none.$(OBJEXT) +old_mmap_v_none_LDADD = $(LDADD) +old_mmap_v_none_DEPENDENCIES = libtests.a oldfstat_SOURCES = oldfstat.c oldfstat_OBJECTS = oldfstat.$(OBJEXT) oldfstat_LDADD = $(LDADD) @@ -1405,6 +1440,18 @@ oldselect_SOURCES = oldselect.c oldselect_OBJECTS = oldselect.$(OBJEXT) oldselect_LDADD = $(LDADD) oldselect_DEPENDENCIES = libtests.a +oldselect_P_SOURCES = oldselect-P.c +oldselect_P_OBJECTS = oldselect-P.$(OBJEXT) +oldselect_P_LDADD = $(LDADD) +oldselect_P_DEPENDENCIES = libtests.a +oldselect_efault_SOURCES = oldselect-efault.c +oldselect_efault_OBJECTS = oldselect-efault.$(OBJEXT) +oldselect_efault_LDADD = $(LDADD) +oldselect_efault_DEPENDENCIES = libtests.a +oldselect_efault_P_SOURCES = oldselect-efault-P.c +oldselect_efault_P_OBJECTS = oldselect-efault-P.$(OBJEXT) +oldselect_efault_P_LDADD = $(LDADD) +oldselect_efault_P_DEPENDENCIES = libtests.a oldstat_SOURCES = oldstat.c oldstat_OBJECTS = oldstat.$(OBJEXT) oldstat_LDADD = $(LDADD) @@ -1470,10 +1517,18 @@ poll_SOURCES = poll.c poll_OBJECTS = poll.$(OBJEXT) poll_LDADD = $(LDADD) poll_DEPENDENCIES = libtests.a +poll_P_SOURCES = poll-P.c +poll_P_OBJECTS = poll-P.$(OBJEXT) +poll_P_LDADD = $(LDADD) +poll_P_DEPENDENCIES = libtests.a ppoll_SOURCES = ppoll.c ppoll_OBJECTS = ppoll.$(OBJEXT) ppoll_LDADD = $(LDADD) ppoll_DEPENDENCIES = libtests.a +ppoll_P_SOURCES = ppoll-P.c +ppoll_P_OBJECTS = ppoll-P.$(OBJEXT) +ppoll_P_LDADD = $(LDADD) +ppoll_P_DEPENDENCIES = libtests.a ppoll_v_SOURCES = ppoll-v.c ppoll_v_OBJECTS = ppoll-v.$(OBJEXT) ppoll_v_LDADD = $(LDADD) @@ -1700,6 +1755,10 @@ restart_syscall_SOURCES = restart_syscall.c restart_syscall_OBJECTS = restart_syscall.$(OBJEXT) restart_syscall_LDADD = $(LDADD) restart_syscall_DEPENDENCIES = libtests.a +riscv_flush_icache_SOURCES = riscv_flush_icache.c +riscv_flush_icache_OBJECTS = riscv_flush_icache.$(OBJEXT) +riscv_flush_icache_LDADD = $(LDADD) +riscv_flush_icache_DEPENDENCIES = libtests.a rmdir_SOURCES = rmdir.c rmdir_OBJECTS = rmdir.$(OBJEXT) rmdir_LDADD = $(LDADD) @@ -1740,6 +1799,30 @@ run_expect_termsig_SOURCES = run_expect_termsig.c run_expect_termsig_OBJECTS = run_expect_termsig.$(OBJEXT) run_expect_termsig_LDADD = $(LDADD) run_expect_termsig_DEPENDENCIES = libtests.a +s390_guarded_storage_SOURCES = s390_guarded_storage.c +s390_guarded_storage_OBJECTS = s390_guarded_storage.$(OBJEXT) +s390_guarded_storage_LDADD = $(LDADD) +s390_guarded_storage_DEPENDENCIES = libtests.a +s390_guarded_storage_v_SOURCES = s390_guarded_storage-v.c +s390_guarded_storage_v_OBJECTS = s390_guarded_storage-v.$(OBJEXT) +s390_guarded_storage_v_LDADD = $(LDADD) +s390_guarded_storage_v_DEPENDENCIES = libtests.a +s390_pci_mmio_read_write_SOURCES = s390_pci_mmio_read_write.c +s390_pci_mmio_read_write_OBJECTS = s390_pci_mmio_read_write.$(OBJEXT) +s390_pci_mmio_read_write_LDADD = $(LDADD) +s390_pci_mmio_read_write_DEPENDENCIES = libtests.a +s390_runtime_instr_SOURCES = s390_runtime_instr.c +s390_runtime_instr_OBJECTS = s390_runtime_instr.$(OBJEXT) +s390_runtime_instr_LDADD = $(LDADD) +s390_runtime_instr_DEPENDENCIES = libtests.a +s390_sthyi_SOURCES = s390_sthyi.c +s390_sthyi_OBJECTS = s390_sthyi.$(OBJEXT) +s390_sthyi_LDADD = $(LDADD) +s390_sthyi_DEPENDENCIES = libtests.a +s390_sthyi_v_SOURCES = s390_sthyi-v.c +s390_sthyi_v_OBJECTS = s390_sthyi-v.$(OBJEXT) +s390_sthyi_v_LDADD = $(LDADD) +s390_sthyi_v_DEPENDENCIES = libtests.a sched_get_priority_mxx_SOURCES = sched_get_priority_mxx.c sched_get_priority_mxx_OBJECTS = sched_get_priority_mxx.$(OBJEXT) sched_get_priority_mxx_LDADD = $(LDADD) @@ -1792,6 +1875,10 @@ select_SOURCES = select.c select_OBJECTS = select.$(OBJEXT) select_LDADD = $(LDADD) select_DEPENDENCIES = libtests.a +select_P_SOURCES = select-P.c +select_P_OBJECTS = select-P.$(OBJEXT) +select_P_LDADD = $(LDADD) +select_P_DEPENDENCIES = libtests.a semop_SOURCES = semop.c semop_OBJECTS = semop.$(OBJEXT) semop_LDADD = $(LDADD) @@ -1976,6 +2063,10 @@ socketcall_SOURCES = socketcall.c socketcall_OBJECTS = socketcall.$(OBJEXT) socketcall_LDADD = $(LDADD) socketcall_DEPENDENCIES = libtests.a +sockopt_sol_netlink_SOURCES = sockopt-sol_netlink.c +sockopt_sol_netlink_OBJECTS = sockopt-sol_netlink.$(OBJEXT) +sockopt_sol_netlink_LDADD = $(LDADD) +sockopt_sol_netlink_DEPENDENCIES = libtests.a splice_SOURCES = splice.c splice_OBJECTS = splice.$(OBJEXT) splice_LDADD = $(LDADD) @@ -1986,6 +2077,14 @@ am_stack_fcall_OBJECTS = stack-fcall.$(OBJEXT) stack-fcall-0.$(OBJEXT) \ stack_fcall_OBJECTS = $(am_stack_fcall_OBJECTS) stack_fcall_LDADD = $(LDADD) stack_fcall_DEPENDENCIES = libtests.a +am_stack_fcall_mangled_OBJECTS = stack-fcall-mangled.$(OBJEXT) \ + stack-fcall-mangled-0.$(OBJEXT) \ + stack-fcall-mangled-1.$(OBJEXT) \ + stack-fcall-mangled-2.$(OBJEXT) \ + stack-fcall-mangled-3.$(OBJEXT) +stack_fcall_mangled_OBJECTS = $(am_stack_fcall_mangled_OBJECTS) +stack_fcall_mangled_LDADD = $(LDADD) +stack_fcall_mangled_DEPENDENCIES = libtests.a stat_SOURCES = stat.c stat_OBJECTS = stat.$(OBJEXT) stat_LDADD = $(LDADD) @@ -2213,6 +2312,10 @@ xet_robust_list_SOURCES = xet_robust_list.c xet_robust_list_OBJECTS = xet_robust_list.$(OBJEXT) xet_robust_list_LDADD = $(LDADD) xet_robust_list_DEPENDENCIES = libtests.a +xet_thread_area_x86_SOURCES = xet_thread_area_x86.c +xet_thread_area_x86_OBJECTS = xet_thread_area_x86.$(OBJEXT) +xet_thread_area_x86_LDADD = $(LDADD) +xet_thread_area_x86_DEPENDENCIES = libtests.a xetitimer_SOURCES = xetitimer.c xetitimer_OBJECTS = xetitimer.$(OBJEXT) xetitimer_LDADD = $(LDADD) @@ -2265,9 +2368,9 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ - access.c acct.c add_key.c adjtimex.c aio.c alarm.c answer.c \ - attach-f-p.c attach-f-p-cmd.c attach-p-cmd-cmd.c \ +SOURCES = $(libtests_a_SOURCES) _newselect.c _newselect-P.c accept.c \ + accept4.c access.c acct.c add_key.c adjtimex.c aio.c alarm.c \ + answer.c attach-f-p.c attach-f-p-cmd.c attach-p-cmd-cmd.c \ attach-p-cmd-p.c block_reset_raise_run.c bpf.c bpf-v.c brk.c \ btrfs.c caps.c caps-abbrev.c check_sigblock.c check_sigign.c \ chmod.c chown.c chown32.c chroot.c clock_adjtime.c \ @@ -2291,9 +2394,9 @@ SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ gettid.c getuid.c getuid32.c getxxid.c group_req.c inet-cmsg.c \ init_module.c inotify.c inotify_init1.c int_0x80.c ioctl.c \ ioctl_block.c ioctl_dm.c ioctl_dm-v.c ioctl_evdev.c \ - ioctl_evdev-v.c ioctl_loop.c ioctl_loop-nv.c ioctl_loop-v.c \ - ioctl_mtd.c ioctl_nsfs.c ioctl_rtc.c ioctl_rtc-v.c \ - ioctl_scsi.c ioctl_sg_io_v3.c ioctl_sg_io_v4.c \ + ioctl_evdev-v.c ioctl_kvm_run.c ioctl_loop.c ioctl_loop-nv.c \ + ioctl_loop-v.c ioctl_mtd.c ioctl_nsfs.c ioctl_rtc.c \ + ioctl_rtc-v.c ioctl_scsi.c ioctl_sg_io_v3.c ioctl_sg_io_v4.c \ ioctl_sock_gifconf.c ioctl_uffdio.c ioctl_v4l2.c ioperm.c \ iopl.c ioprio.c ip_mreq.c ipc.c ipc_msg.c ipc_msgbuf.c \ ipc_sem.c ipc_shm.c is_linux_mips_n64.c kcmp.c kcmp-y.c \ @@ -2303,13 +2406,13 @@ SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ mbind.c membarrier.c memfd_create.c migrate_pages.c mincore.c \ mkdir.c mkdirat.c mknod.c mknodat.c mlock.c mlock2.c \ mlockall.c mmap.c mmap64.c mmsg.c mmsg-silent.c mmsg_name.c \ - mmsg_name-v.c mount.c move_pages.c mq.c mq_sendrecv.c \ - mq_sendrecv-read.c mq_sendrecv-write.c msg_control.c \ - msg_control-v.c msg_name.c munlockall.c nanosleep.c \ - net-accept-connect.c net-icmp_filter.c net-sockaddr.c \ - net-y-unix.c net-yy-inet.c net-yy-netlink.c net-yy-unix.c \ - netlink_audit.c netlink_crypto.c netlink_generic.c \ - netlink_inet_diag.c netlink_kobject_uevent.c \ + mmsg_name-v.c modify_ldt.c mount.c move_pages.c mq.c \ + mq_sendrecv.c mq_sendrecv-read.c mq_sendrecv-write.c \ + msg_control.c msg_control-v.c msg_name.c munlockall.c \ + nanosleep.c net-accept-connect.c net-icmp_filter.c \ + net-sockaddr.c net-y-unix.c net-yy-inet.c net-yy-netlink.c \ + net-yy-unix.c netlink_audit.c netlink_crypto.c \ + netlink_generic.c netlink_inet_diag.c netlink_kobject_uevent.c \ netlink_netfilter.c netlink_netlink_diag.c netlink_protocol.c \ netlink_route.c netlink_selinux.c netlink_sock_diag.c \ netlink_unix_diag.c netlink_xfrm.c newfstatat.c \ @@ -2328,13 +2431,16 @@ SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ nlattr_packet_diag_msg.c nlattr_rtgenmsg.c nlattr_rtmsg.c \ nlattr_smc_diag_msg.c nlattr_tc_stats.c nlattr_tca_stab.c \ nlattr_tcamsg.c nlattr_tcmsg.c nlattr_unix_diag_msg.c \ - nsyscalls.c old_mmap.c oldfstat.c oldlstat.c oldselect.c \ + nsyscalls.c nsyscalls-d.c old_mmap.c old_mmap-P.c \ + old_mmap-v-none.c oldfstat.c oldlstat.c oldselect.c \ + oldselect-P.c oldselect-efault.c oldselect-efault-P.c \ oldstat.c open.c openat.c osf_utimes.c pause.c pc.c \ perf_event_open.c perf_event_open_nonverbose.c \ perf_event_open_unabbrev.c personality.c pipe.c pipe2.c \ - pkey_alloc.c pkey_free.c pkey_mprotect.c poll.c ppoll.c \ - ppoll-v.c prctl-arg2-intptr.c prctl-dumpable.c prctl-name.c \ - prctl-no-args.c prctl-pdeathsig.c prctl-seccomp-filter-v.c \ + pkey_alloc.c pkey_free.c pkey_mprotect.c poll.c poll-P.c \ + ppoll.c ppoll-P.c ppoll-v.c prctl-arg2-intptr.c \ + prctl-dumpable.c prctl-name.c prctl-no-args.c \ + prctl-pdeathsig.c prctl-seccomp-filter-v.c \ prctl-seccomp-strict.c prctl-securebits.c prctl-tid_address.c \ prctl-tsc.c pread64-pwrite64.c preadv.c preadv-pwritev.c \ preadv2-pwritev2.c print_maxfd.c printpath-umovestr.c \ @@ -2348,28 +2454,32 @@ SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ readdir.c readlink.c readlinkat.c readv.c reboot.c recvfrom.c \ recvmmsg-timeout.c recvmsg.c redirect-fds.c remap_file_pages.c \ rename.c renameat.c renameat2.c request_key.c \ - restart_syscall.c rmdir.c rt_sigaction.c rt_sigpending.c \ - rt_sigprocmask.c rt_sigqueueinfo.c rt_sigreturn.c \ - rt_sigsuspend.c rt_sigtimedwait.c rt_tgsigqueueinfo.c \ - run_expect_termsig.c sched_get_priority_mxx.c \ + restart_syscall.c riscv_flush_icache.c rmdir.c rt_sigaction.c \ + rt_sigpending.c rt_sigprocmask.c rt_sigqueueinfo.c \ + rt_sigreturn.c rt_sigsuspend.c rt_sigtimedwait.c \ + rt_tgsigqueueinfo.c run_expect_termsig.c \ + s390_guarded_storage.c s390_guarded_storage-v.c \ + s390_pci_mmio_read_write.c s390_runtime_instr.c s390_sthyi.c \ + s390_sthyi-v.c sched_get_priority_mxx.c \ sched_rr_get_interval.c sched_xetaffinity.c sched_xetattr.c \ sched_xetparam.c sched_xetscheduler.c sched_yield.c \ scm_rights.c seccomp-filter.c seccomp-filter-v.c \ - seccomp-strict.c seccomp_get_action_avail.c select.c semop.c \ - sendfile.c sendfile64.c set_mempolicy.c set_ptracer_any.c \ - set_sigblock.c set_sigign.c setdomainname.c setfsgid.c \ - setfsgid32.c setfsuid.c setfsuid32.c setgid.c setgid32.c \ - setgroups.c setgroups32.c sethostname.c setns.c setregid.c \ - setregid32.c setresgid.c setresgid32.c setresuid.c \ + seccomp-strict.c seccomp_get_action_avail.c select.c \ + select-P.c semop.c sendfile.c sendfile64.c set_mempolicy.c \ + set_ptracer_any.c set_sigblock.c set_sigign.c setdomainname.c \ + setfsgid.c setfsgid32.c setfsuid.c setfsuid32.c setgid.c \ + setgid32.c setgroups.c setgroups32.c sethostname.c setns.c \ + setregid.c setregid32.c setresgid.c setresgid32.c setresuid.c \ setresuid32.c setreuid.c setreuid32.c setrlimit.c setuid.c \ setuid32.c shmxt.c shutdown.c sigaction.c sigaltstack.c \ siginfo.c signal.c signal_receive.c signalfd4.c sigpending.c \ sigprocmask.c sigreturn.c sigsuspend.c sleep.c so_linger.c \ - so_peercred.c sock_filter-v.c socketcall.c splice.c \ - $(stack_fcall_SOURCES) stat.c stat64.c statfs.c statfs64.c \ - statx.c swap.c sxetmask.c symlink.c symlinkat.c sync.c \ - sync_file_range.c sync_file_range2.c sysinfo.c syslog.c tee.c \ - threads-execve.c time.c timer_create.c timer_xettime.c \ + so_peercred.c sock_filter-v.c socketcall.c \ + sockopt-sol_netlink.c splice.c $(stack_fcall_SOURCES) \ + $(stack_fcall_mangled_SOURCES) stat.c stat64.c statfs.c \ + statfs64.c statx.c swap.c sxetmask.c symlink.c symlinkat.c \ + sync.c sync_file_range.c sync_file_range2.c sysinfo.c syslog.c \ + tee.c threads-execve.c time.c timer_create.c timer_xettime.c \ timerfd_xettime.c times.c times-fail.c truncate.c truncate64.c \ ugetrlimit.c uio.c umask.c umount.c umount2.c umoven-illptr.c \ umovestr.c umovestr-illptr.c umovestr2.c umovestr3.c uname.c \ @@ -2378,16 +2488,17 @@ SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ userfaultfd.c ustat.c utime.c utimensat.c utimes.c vfork-f.c \ vhangup.c vmsplice.c wait4.c wait4-v.c waitid.c waitid-v.c \ waitpid.c xattr.c xattr-strings.c xet_robust_list.c \ - xetitimer.c xetpgid.c xetpriority.c xettimeofday.c zeroargc.c -DIST_SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ - access.c acct.c add_key.c adjtimex.c aio.c alarm.c answer.c \ - attach-f-p.c attach-f-p-cmd.c attach-p-cmd-cmd.c \ - attach-p-cmd-p.c block_reset_raise_run.c bpf.c bpf-v.c brk.c \ - btrfs.c caps.c caps-abbrev.c check_sigblock.c check_sigign.c \ - chmod.c chown.c chown32.c chroot.c clock_adjtime.c \ - clock_nanosleep.c clock_xettime.c clone_parent.c \ - clone_ptrace.c copy_file_range.c count-f.c creat.c \ - delete_module.c dup.c dup2.c dup3.c epoll_create.c \ + xet_thread_area_x86.c xetitimer.c xetpgid.c xetpriority.c \ + xettimeofday.c zeroargc.c +DIST_SOURCES = $(libtests_a_SOURCES) _newselect.c _newselect-P.c \ + accept.c accept4.c access.c acct.c add_key.c adjtimex.c aio.c \ + alarm.c answer.c attach-f-p.c attach-f-p-cmd.c \ + attach-p-cmd-cmd.c attach-p-cmd-p.c block_reset_raise_run.c \ + bpf.c bpf-v.c brk.c btrfs.c caps.c caps-abbrev.c \ + check_sigblock.c check_sigign.c chmod.c chown.c chown32.c \ + chroot.c clock_adjtime.c clock_nanosleep.c clock_xettime.c \ + clone_parent.c clone_ptrace.c copy_file_range.c count-f.c \ + creat.c delete_module.c dup.c dup2.c dup3.c epoll_create.c \ epoll_create1.c epoll_ctl.c epoll_pwait.c epoll_wait.c \ erestartsys.c eventfd.c execve.c execve-v.c execveat.c \ execveat-v.c faccessat.c fadvise64.c fadvise64_64.c \ @@ -2405,9 +2516,9 @@ DIST_SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ gettid.c getuid.c getuid32.c getxxid.c group_req.c inet-cmsg.c \ init_module.c inotify.c inotify_init1.c int_0x80.c ioctl.c \ ioctl_block.c ioctl_dm.c ioctl_dm-v.c ioctl_evdev.c \ - ioctl_evdev-v.c ioctl_loop.c ioctl_loop-nv.c ioctl_loop-v.c \ - ioctl_mtd.c ioctl_nsfs.c ioctl_rtc.c ioctl_rtc-v.c \ - ioctl_scsi.c ioctl_sg_io_v3.c ioctl_sg_io_v4.c \ + ioctl_evdev-v.c ioctl_kvm_run.c ioctl_loop.c ioctl_loop-nv.c \ + ioctl_loop-v.c ioctl_mtd.c ioctl_nsfs.c ioctl_rtc.c \ + ioctl_rtc-v.c ioctl_scsi.c ioctl_sg_io_v3.c ioctl_sg_io_v4.c \ ioctl_sock_gifconf.c ioctl_uffdio.c ioctl_v4l2.c ioperm.c \ iopl.c ioprio.c ip_mreq.c ipc.c ipc_msg.c ipc_msgbuf.c \ ipc_sem.c ipc_shm.c is_linux_mips_n64.c kcmp.c kcmp-y.c \ @@ -2417,13 +2528,13 @@ DIST_SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ mbind.c membarrier.c memfd_create.c migrate_pages.c mincore.c \ mkdir.c mkdirat.c mknod.c mknodat.c mlock.c mlock2.c \ mlockall.c mmap.c mmap64.c mmsg.c mmsg-silent.c mmsg_name.c \ - mmsg_name-v.c mount.c move_pages.c mq.c mq_sendrecv.c \ - mq_sendrecv-read.c mq_sendrecv-write.c msg_control.c \ - msg_control-v.c msg_name.c munlockall.c nanosleep.c \ - net-accept-connect.c net-icmp_filter.c net-sockaddr.c \ - net-y-unix.c net-yy-inet.c net-yy-netlink.c net-yy-unix.c \ - netlink_audit.c netlink_crypto.c netlink_generic.c \ - netlink_inet_diag.c netlink_kobject_uevent.c \ + mmsg_name-v.c modify_ldt.c mount.c move_pages.c mq.c \ + mq_sendrecv.c mq_sendrecv-read.c mq_sendrecv-write.c \ + msg_control.c msg_control-v.c msg_name.c munlockall.c \ + nanosleep.c net-accept-connect.c net-icmp_filter.c \ + net-sockaddr.c net-y-unix.c net-yy-inet.c net-yy-netlink.c \ + net-yy-unix.c netlink_audit.c netlink_crypto.c \ + netlink_generic.c netlink_inet_diag.c netlink_kobject_uevent.c \ netlink_netfilter.c netlink_netlink_diag.c netlink_protocol.c \ netlink_route.c netlink_selinux.c netlink_sock_diag.c \ netlink_unix_diag.c netlink_xfrm.c newfstatat.c \ @@ -2442,13 +2553,16 @@ DIST_SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ nlattr_packet_diag_msg.c nlattr_rtgenmsg.c nlattr_rtmsg.c \ nlattr_smc_diag_msg.c nlattr_tc_stats.c nlattr_tca_stab.c \ nlattr_tcamsg.c nlattr_tcmsg.c nlattr_unix_diag_msg.c \ - nsyscalls.c old_mmap.c oldfstat.c oldlstat.c oldselect.c \ + nsyscalls.c nsyscalls-d.c old_mmap.c old_mmap-P.c \ + old_mmap-v-none.c oldfstat.c oldlstat.c oldselect.c \ + oldselect-P.c oldselect-efault.c oldselect-efault-P.c \ oldstat.c open.c openat.c osf_utimes.c pause.c pc.c \ perf_event_open.c perf_event_open_nonverbose.c \ perf_event_open_unabbrev.c personality.c pipe.c pipe2.c \ - pkey_alloc.c pkey_free.c pkey_mprotect.c poll.c ppoll.c \ - ppoll-v.c prctl-arg2-intptr.c prctl-dumpable.c prctl-name.c \ - prctl-no-args.c prctl-pdeathsig.c prctl-seccomp-filter-v.c \ + pkey_alloc.c pkey_free.c pkey_mprotect.c poll.c poll-P.c \ + ppoll.c ppoll-P.c ppoll-v.c prctl-arg2-intptr.c \ + prctl-dumpable.c prctl-name.c prctl-no-args.c \ + prctl-pdeathsig.c prctl-seccomp-filter-v.c \ prctl-seccomp-strict.c prctl-securebits.c prctl-tid_address.c \ prctl-tsc.c pread64-pwrite64.c preadv.c preadv-pwritev.c \ preadv2-pwritev2.c print_maxfd.c printpath-umovestr.c \ @@ -2462,28 +2576,32 @@ DIST_SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ readdir.c readlink.c readlinkat.c readv.c reboot.c recvfrom.c \ recvmmsg-timeout.c recvmsg.c redirect-fds.c remap_file_pages.c \ rename.c renameat.c renameat2.c request_key.c \ - restart_syscall.c rmdir.c rt_sigaction.c rt_sigpending.c \ - rt_sigprocmask.c rt_sigqueueinfo.c rt_sigreturn.c \ - rt_sigsuspend.c rt_sigtimedwait.c rt_tgsigqueueinfo.c \ - run_expect_termsig.c sched_get_priority_mxx.c \ + restart_syscall.c riscv_flush_icache.c rmdir.c rt_sigaction.c \ + rt_sigpending.c rt_sigprocmask.c rt_sigqueueinfo.c \ + rt_sigreturn.c rt_sigsuspend.c rt_sigtimedwait.c \ + rt_tgsigqueueinfo.c run_expect_termsig.c \ + s390_guarded_storage.c s390_guarded_storage-v.c \ + s390_pci_mmio_read_write.c s390_runtime_instr.c s390_sthyi.c \ + s390_sthyi-v.c sched_get_priority_mxx.c \ sched_rr_get_interval.c sched_xetaffinity.c sched_xetattr.c \ sched_xetparam.c sched_xetscheduler.c sched_yield.c \ scm_rights.c seccomp-filter.c seccomp-filter-v.c \ - seccomp-strict.c seccomp_get_action_avail.c select.c semop.c \ - sendfile.c sendfile64.c set_mempolicy.c set_ptracer_any.c \ - set_sigblock.c set_sigign.c setdomainname.c setfsgid.c \ - setfsgid32.c setfsuid.c setfsuid32.c setgid.c setgid32.c \ - setgroups.c setgroups32.c sethostname.c setns.c setregid.c \ - setregid32.c setresgid.c setresgid32.c setresuid.c \ + seccomp-strict.c seccomp_get_action_avail.c select.c \ + select-P.c semop.c sendfile.c sendfile64.c set_mempolicy.c \ + set_ptracer_any.c set_sigblock.c set_sigign.c setdomainname.c \ + setfsgid.c setfsgid32.c setfsuid.c setfsuid32.c setgid.c \ + setgid32.c setgroups.c setgroups32.c sethostname.c setns.c \ + setregid.c setregid32.c setresgid.c setresgid32.c setresuid.c \ setresuid32.c setreuid.c setreuid32.c setrlimit.c setuid.c \ setuid32.c shmxt.c shutdown.c sigaction.c sigaltstack.c \ siginfo.c signal.c signal_receive.c signalfd4.c sigpending.c \ sigprocmask.c sigreturn.c sigsuspend.c sleep.c so_linger.c \ - so_peercred.c sock_filter-v.c socketcall.c splice.c \ - $(stack_fcall_SOURCES) stat.c stat64.c statfs.c statfs64.c \ - statx.c swap.c sxetmask.c symlink.c symlinkat.c sync.c \ - sync_file_range.c sync_file_range2.c sysinfo.c syslog.c tee.c \ - threads-execve.c time.c timer_create.c timer_xettime.c \ + so_peercred.c sock_filter-v.c socketcall.c \ + sockopt-sol_netlink.c splice.c $(stack_fcall_SOURCES) \ + $(stack_fcall_mangled_SOURCES) stat.c stat64.c statfs.c \ + statfs64.c statx.c swap.c sxetmask.c symlink.c symlinkat.c \ + sync.c sync_file_range.c sync_file_range2.c sysinfo.c syslog.c \ + tee.c threads-execve.c time.c timer_create.c timer_xettime.c \ timerfd_xettime.c times.c times-fail.c truncate.c truncate64.c \ ugetrlimit.c uio.c umask.c umount.c umount2.c umoven-illptr.c \ umovestr.c umovestr-illptr.c umovestr2.c umovestr3.c uname.c \ @@ -2492,7 +2610,8 @@ DIST_SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ userfaultfd.c ustat.c utime.c utimensat.c utimes.c vfork-f.c \ vhangup.c vmsplice.c wait4.c wait4-v.c waitid.c waitid-v.c \ waitpid.c xattr.c xattr-strings.c xet_robust_list.c \ - xetitimer.c xetpgid.c xetpriority.c xettimeofday.c zeroargc.c + xet_thread_area_x86.c xetitimer.c xetpgid.c xetpriority.c \ + xettimeofday.c zeroargc.c am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -2705,7 +2824,7 @@ am__set_TESTS_bases = \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck -@USE_LIBUNWIND_TRUE@am__EXEEXT_2 = strace-k.test +@USE_LIBUNWIND_TRUE@am__EXEEXT_2 = strace-k.test $(am__append_1) TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test am__test_logs1 = $(TESTS:=.log) @@ -2793,10 +2912,13 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ RANLIB = @RANLIB@ +READELF = @READELF@ RPM_CHANGELOGTIME = @RPM_CHANGELOGTIME@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SIZEOF_KERNEL_LONG_T = 4 +SIZEOF_LONG = 4 STRIP = @STRIP@ VALGRIND = @VALGRIND@ VALGRIND_ENABLED = @VALGRIND_ENABLED@ @@ -2817,6 +2939,7 @@ am__untar = @am__untar@ arch = @arch@ arch_m32 = @arch_m32@ arch_mx32 = @arch_mx32@ +arch_native = @arch_native@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -2824,6 +2947,8 @@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ +cc_flags_m32 = @cc_flags_m32@ +cc_flags_mx32 = @cc_flags_mx32@ datadir = @datadir@ datarootdir = @datarootdir@ dl_LIBS = @dl_LIBS@ @@ -2841,6 +2966,9 @@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +libiberty_CPPFLAGS = @libiberty_CPPFLAGS@ +libiberty_LDFLAGS = @libiberty_LDFLAGS@ +libiberty_LIBS = @libiberty_LIBS@ libunwind_CPPFLAGS = @libunwind_CPPFLAGS@ libunwind_LDFLAGS = @libunwind_LDFLAGS@ libunwind_LIBS = @libunwind_LIBS@ @@ -2865,8 +2993,10 @@ valgrind_enabled_tools = @valgrind_enabled_tools@ valgrind_tools = @valgrind_tools@ OS = linux ARCH = @arch_m32@ +NATIVE_ARCH = @arch_native@ MPERS_NAME = m32 -ARCH_MFLAGS = -DMPERS_IS_$(MPERS_NAME) -m32 +MPERS_CC_FLAGS = @cc_flags_m32@ +ARCH_MFLAGS = -DMPERS_IS_$(MPERS_NAME) $(MPERS_CC_FLAGS) AM_CFLAGS = $(WARN_CFLAGS) AM_CPPFLAGS = $(ARCH_MFLAGS) \ -I$(builddir) \ @@ -3021,6 +3151,7 @@ PURE_EXECUTABLES = \ ioctl_block \ ioctl_dm \ ioctl_evdev \ + ioctl_kvm_run \ ioctl_loop \ ioctl_mtd \ ioctl_rtc \ @@ -3071,6 +3202,7 @@ PURE_EXECUTABLES = \ mmap64 \ mmsg \ mmsg_name \ + modify_ldt \ mount \ move_pages \ mq \ @@ -3140,9 +3272,12 @@ PURE_EXECUTABLES = \ nlattr_tcmsg \ nlattr_unix_diag_msg \ old_mmap \ + old_mmap-P \ + old_mmap-v-none \ oldfstat \ oldlstat \ oldselect \ + oldselect-efault \ oldstat \ open \ openat \ @@ -3156,7 +3291,9 @@ PURE_EXECUTABLES = \ pkey_free \ pkey_mprotect \ poll \ + poll-P \ ppoll \ + ppoll-P \ prctl-arg2-intptr \ prctl-dumpable \ prctl-name \ @@ -3199,6 +3336,7 @@ PURE_EXECUTABLES = \ renameat \ renameat2 \ request_key \ + riscv_flush_icache \ rmdir \ rt_sigaction \ rt_sigpending \ @@ -3208,6 +3346,12 @@ PURE_EXECUTABLES = \ rt_sigsuspend \ rt_sigtimedwait \ rt_tgsigqueueinfo \ + s390_guarded_storage \ + s390_guarded_storage-v \ + s390_pci_mmio_read_write \ + s390_runtime_instr \ + s390_sthyi \ + s390_sthyi-v \ sched_get_priority_mxx \ sched_rr_get_interval \ sched_xetaffinity \ @@ -3259,6 +3403,7 @@ PURE_EXECUTABLES = \ so_peercred \ sock_filter-v \ socketcall \ + sockopt-sol_netlink \ splice \ stat \ stat64 \ @@ -3310,6 +3455,7 @@ PURE_EXECUTABLES = \ xattr \ xattr-strings \ xet_robust_list \ + xet_thread_area_x86 \ xetitimer \ xetpgid \ xetpriority \ @@ -3344,13 +3490,17 @@ uio_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64 stack_fcall_SOURCES = stack-fcall.c \ stack-fcall-0.c stack-fcall-1.c stack-fcall-2.c stack-fcall-3.c +stack_fcall_mangled_SOURCES = stack-fcall-mangled.c \ + stack-fcall-mangled-0.c stack-fcall-mangled-1.c \ + stack-fcall-mangled-2.c stack-fcall-mangled-3.c + # Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in; do not edit. -GEN_TESTS = _newselect.gen.test accept.gen.test accept4.gen.test \ - access.gen.test acct.gen.test add_key.gen.test \ - adjtimex.gen.test aio.gen.test alarm.gen.test bpf.gen.test \ - bpf-v.gen.test btrfs.gen.test chmod.gen.test chown.gen.test \ - chown32.gen.test chroot.gen.test clock.gen.test \ +GEN_TESTS = _newselect.gen.test _newselect-P.gen.test accept.gen.test \ + accept4.gen.test access.gen.test acct.gen.test \ + add_key.gen.test adjtimex.gen.test aio.gen.test alarm.gen.test \ + bpf.gen.test bpf-v.gen.test btrfs.gen.test chmod.gen.test \ + chown.gen.test chown32.gen.test chroot.gen.test clock.gen.test \ clock_adjtime.gen.test clock_nanosleep.gen.test \ clock_xettime.gen.test copy_file_range.gen.test creat.gen.test \ delete_module.gen.test dup.gen.test dup2.gen.test \ @@ -3378,46 +3528,49 @@ GEN_TESTS = _newselect.gen.test accept.gen.test accept4.gen.test \ gettid.gen.test getuid32.gen.test getxxid.gen.test \ group_req.gen.test inet-cmsg.gen.test init_module.gen.test \ inotify.gen.test inotify_init1.gen.test int_0x80.gen.test \ - ioctl_block.gen.test ioctl_evdev.gen.test \ - ioctl_evdev-v.gen.test ioctl_loop.gen.test \ - ioctl_loop-v.gen.test ioctl_mtd.gen.test ioctl_rtc.gen.test \ + ioctl_block.gen.test ioctl_dm.gen.test ioctl_dm-v.gen.test \ + ioctl_evdev.gen.test ioctl_evdev-v.gen.test \ + ioctl_kvm_run.gen.test ioctl_loop.gen.test \ + ioctl_loop-nv.gen.test ioctl_loop-v.gen.test \ + ioctl_mtd.gen.test ioctl_nsfs.gen.test ioctl_rtc.gen.test \ ioctl_rtc-v.gen.test ioctl_scsi.gen.test \ ioctl_sg_io_v3.gen.test ioctl_sg_io_v4.gen.test \ - ioctl_uffdio.gen.test ioctl_v4l2.gen.test ioperm.gen.test \ - iopl.gen.test ioprio.gen.test ip_mreq.gen.test ipc.gen.test \ - ipc_msg.gen.test ipc_sem.gen.test ipc_shm.gen.test \ - kcmp.gen.test kcmp-y.gen.test kexec_file_load.gen.test \ - kexec_load.gen.test keyctl.gen.test kill.gen.test \ - lchown.gen.test lchown32.gen.test link.gen.test \ - linkat.gen.test lookup_dcookie.gen.test lstat.gen.test \ - lstat64.gen.test madvise.gen.test mbind.gen.test \ - membarrier.gen.test memfd_create.gen.test \ - migrate_pages.gen.test mincore.gen.test mkdir.gen.test \ - mkdirat.gen.test mknod.gen.test mknodat.gen.test \ - mlock.gen.test mlock2.gen.test mlockall.gen.test \ - mmap64.gen.test mmsg.gen.test mmsg-silent.gen.test \ - mmsg_name.gen.test mmsg_name-v.gen.test mount.gen.test \ - move_pages.gen.test mq.gen.test mq_sendrecv.gen.test \ - mq_sendrecv-read.gen.test mq_sendrecv-write.gen.test \ - msg_control.gen.test msg_control-v.gen.test msg_name.gen.test \ - munlockall.gen.test nanosleep.gen.test \ - net-icmp_filter.gen.test net-sockaddr.gen.test \ - netlink_audit.gen.test netlink_crypto.gen.test \ - netlink_generic.gen.test netlink_kobject_uevent.gen.test \ - netlink_netfilter.gen.test netlink_protocol.gen.test \ - netlink_route.gen.test netlink_selinux.gen.test \ - netlink_xfrm.gen.test newfstatat.gen.test nlattr.gen.test \ - nfnetlink_acct.gen.test nfnetlink_cthelper.gen.test \ - nfnetlink_ctnetlink.gen.test nfnetlink_ctnetlink_exp.gen.test \ - nfnetlink_cttimeout.gen.test nfnetlink_ipset.gen.test \ - nfnetlink_nft_compat.gen.test nfnetlink_nftables.gen.test \ - nfnetlink_osf.gen.test nfnetlink_queue.gen.test \ - nfnetlink_ulog.gen.test nlattr_crypto_user_alg.gen.test \ - nlattr_br_port_msg.gen.test nlattr_dcbmsg.gen.test \ - nlattr_fib_rule_hdr.gen.test nlattr_ifaddrlblmsg.gen.test \ - nlattr_ifaddrmsg.gen.test nlattr_ifinfomsg.gen.test \ - nlattr_ifla_brport.gen.test nlattr_ifla_port.gen.test \ - nlattr_ifla_xdp.gen.test nlattr_inet_diag_msg.gen.test \ + ioctl_sock_gifconf.gen.test ioctl_uffdio.gen.test \ + ioctl_v4l2.gen.test ioperm.gen.test iopl.gen.test \ + ioprio.gen.test ip_mreq.gen.test ipc.gen.test ipc_msg.gen.test \ + ipc_sem.gen.test ipc_shm.gen.test kcmp.gen.test \ + kcmp-y.gen.test kexec_file_load.gen.test kexec_load.gen.test \ + keyctl.gen.test kill.gen.test lchown.gen.test \ + lchown32.gen.test link.gen.test linkat.gen.test \ + lookup_dcookie.gen.test lstat.gen.test lstat64.gen.test \ + madvise.gen.test mbind.gen.test membarrier.gen.test \ + memfd_create.gen.test migrate_pages.gen.test mincore.gen.test \ + mkdir.gen.test mkdirat.gen.test mknod.gen.test \ + mknodat.gen.test mlock.gen.test mlock2.gen.test \ + mlockall.gen.test mmap64.gen.test mmsg.gen.test \ + mmsg-silent.gen.test mmsg_name.gen.test mmsg_name-v.gen.test \ + modify_ldt.gen.test mount.gen.test move_pages.gen.test \ + mq.gen.test mq_sendrecv.gen.test mq_sendrecv-read.gen.test \ + mq_sendrecv-write.gen.test msg_control.gen.test \ + msg_control-v.gen.test msg_name.gen.test munlockall.gen.test \ + nanosleep.gen.test net-icmp_filter.gen.test \ + net-sockaddr.gen.test netlink_audit.gen.test \ + netlink_crypto.gen.test netlink_generic.gen.test \ + netlink_kobject_uevent.gen.test netlink_netfilter.gen.test \ + netlink_protocol.gen.test netlink_route.gen.test \ + netlink_selinux.gen.test netlink_xfrm.gen.test \ + newfstatat.gen.test nlattr.gen.test nfnetlink_acct.gen.test \ + nfnetlink_cthelper.gen.test nfnetlink_ctnetlink.gen.test \ + nfnetlink_ctnetlink_exp.gen.test nfnetlink_cttimeout.gen.test \ + nfnetlink_ipset.gen.test nfnetlink_nft_compat.gen.test \ + nfnetlink_nftables.gen.test nfnetlink_osf.gen.test \ + nfnetlink_queue.gen.test nfnetlink_ulog.gen.test \ + nlattr_crypto_user_alg.gen.test nlattr_br_port_msg.gen.test \ + nlattr_dcbmsg.gen.test nlattr_fib_rule_hdr.gen.test \ + nlattr_ifaddrlblmsg.gen.test nlattr_ifaddrmsg.gen.test \ + nlattr_ifinfomsg.gen.test nlattr_ifla_brport.gen.test \ + nlattr_ifla_port.gen.test nlattr_ifla_xdp.gen.test \ + nlattr_inet_diag_msg.gen.test \ nlattr_inet_diag_req_compat.gen.test \ nlattr_inet_diag_req_v2.gen.test \ nlattr_mdba_mdb_entry.gen.test \ @@ -3429,16 +3582,18 @@ GEN_TESTS = _newselect.gen.test accept.gen.test accept4.gen.test \ nlattr_tc_stats.gen.test nlattr_tca_stab.gen.test \ nlattr_tcamsg.gen.test nlattr_tcmsg.gen.test \ nlattr_unix_diag_msg.gen.test old_mmap.gen.test \ - oldfstat.gen.test oldlstat.gen.test oldstat.gen.test \ - open.gen.test openat.gen.test osf_utimes.gen.test \ - pause.gen.test perf_event_open.gen.test \ + old_mmap-P.gen.test old_mmap-v-none.gen.test oldfstat.gen.test \ + oldlstat.gen.test oldselect.gen.test oldselect-P.gen.test \ + oldselect-efault.gen.test oldselect-efault-P.gen.test \ + oldstat.gen.test open.gen.test openat.gen.test \ + osf_utimes.gen.test pause.gen.test perf_event_open.gen.test \ perf_event_open_nonverbose.gen.test \ perf_event_open_unabbrev.gen.test pipe2.gen.test \ pkey_alloc.gen.test pkey_free.gen.test pkey_mprotect.gen.test \ - ppoll.gen.test ppoll-v.gen.test pread64-pwrite64.gen.test \ - preadv.gen.test preadv-pwritev.gen.test \ - preadv2-pwritev2.gen.test printstr.gen.test \ - printpath-umovestr.gen.test \ + ppoll.gen.test ppoll-P.gen.test ppoll-v.gen.test \ + pread64-pwrite64.gen.test preadv.gen.test \ + preadv-pwritev.gen.test preadv2-pwritev2.gen.test \ + printstr.gen.test printpath-umovestr.gen.test \ printpath-umovestr-peekdata.gen.test \ printpath-umovestr-undumpable.gen.test \ printstrn-umoven.gen.test printstrn-umoven-peekdata.gen.test \ @@ -3451,44 +3606,48 @@ GEN_TESTS = _newselect.gen.test accept.gen.test accept4.gen.test \ reboot.gen.test recvfrom.gen.test recvmmsg-timeout.gen.test \ recvmsg.gen.test regex.gen.test remap_file_pages.gen.test \ rename.gen.test renameat.gen.test renameat2.gen.test \ - request_key.gen.test rmdir.gen.test rt_sigpending.gen.test \ - rt_sigprocmask.gen.test rt_sigqueueinfo.gen.test \ - rt_sigreturn.gen.test rt_sigsuspend.gen.test \ - rt_sigtimedwait.gen.test rt_tgsigqueueinfo.gen.test \ - sched.gen.test sched_get_priority_mxx.gen.test \ - sched_rr_get_interval.gen.test sched_xetaffinity.gen.test \ - sched_xetattr.gen.test sched_xetparam.gen.test \ - sched_xetscheduler.gen.test sched_yield.gen.test \ - seccomp-filter.gen.test seccomp-filter-v.gen.test \ - seccomp_get_action_avail.gen.test select.gen.test \ - semop.gen.test sendfile.gen.test sendfile64.gen.test \ - set_mempolicy.gen.test setdomainname.gen.test \ - setfsgid.gen.test setfsgid32.gen.test setfsuid.gen.test \ - setfsuid32.gen.test setgid.gen.test setgid32.gen.test \ - setgroups.gen.test setgroups32.gen.test sethostname.gen.test \ - setns.gen.test setregid.gen.test setregid32.gen.test \ - setresgid.gen.test setresgid32.gen.test setresuid.gen.test \ - setresuid32.gen.test setreuid.gen.test setreuid32.gen.test \ - setrlimit.gen.test setuid.gen.test setuid32.gen.test \ - shmxt.gen.test shutdown.gen.test sigaction.gen.test \ - siginfo.gen.test signal.gen.test signal_receive.gen.test \ - signalfd4.gen.test sigpending.gen.test sigprocmask.gen.test \ - sigreturn.gen.test sigsuspend.gen.test so_linger.gen.test \ - so_peercred.gen.test sock_filter-v.gen.test \ - socketcall.gen.test splice.gen.test stat.gen.test \ - stat64.gen.test statfs.gen.test statfs64.gen.test \ - statx.gen.test swap.gen.test sxetmask.gen.test \ - symlink.gen.test symlinkat.gen.test sync.gen.test \ - sync_file_range.gen.test sync_file_range2.gen.test \ - sysinfo.gen.test syslog.gen.test tee.gen.test time.gen.test \ - timer_create.gen.test timer_xettime.gen.test \ - timerfd_xettime.gen.test times.gen.test times-fail.gen.test \ - trace_fstat.gen.test trace_fstatfs.gen.test \ - trace_lstat.gen.test trace_question.gen.test \ - trace_stat.gen.test trace_stat_like.gen.test \ - trace_statfs.gen.test trace_statfs_like.gen.test \ - truncate.gen.test truncate64.gen.test ugetrlimit.gen.test \ - umask.gen.test umoven-illptr.gen.test umovestr-illptr.gen.test \ + request_key.gen.test riscv_flush_icache.gen.test \ + rmdir.gen.test rt_sigpending.gen.test rt_sigprocmask.gen.test \ + rt_sigqueueinfo.gen.test rt_sigreturn.gen.test \ + rt_sigsuspend.gen.test rt_sigtimedwait.gen.test \ + rt_tgsigqueueinfo.gen.test s390_guarded_storage.gen.test \ + s390_guarded_storage-v.gen.test \ + s390_pci_mmio_read_write.gen.test s390_runtime_instr.gen.test \ + s390_sthyi.gen.test s390_sthyi-v.gen.test sched.gen.test \ + sched_get_priority_mxx.gen.test sched_rr_get_interval.gen.test \ + sched_xetaffinity.gen.test sched_xetattr.gen.test \ + sched_xetparam.gen.test sched_xetscheduler.gen.test \ + sched_yield.gen.test seccomp-filter.gen.test \ + seccomp-filter-v.gen.test seccomp_get_action_avail.gen.test \ + select.gen.test select-P.gen.test semop.gen.test \ + sendfile.gen.test sendfile64.gen.test set_mempolicy.gen.test \ + setdomainname.gen.test setfsgid.gen.test setfsgid32.gen.test \ + setfsuid.gen.test setfsuid32.gen.test setgid.gen.test \ + setgid32.gen.test setgroups.gen.test setgroups32.gen.test \ + sethostname.gen.test setns.gen.test setregid.gen.test \ + setregid32.gen.test setresgid.gen.test setresgid32.gen.test \ + setresuid.gen.test setresuid32.gen.test setreuid.gen.test \ + setreuid32.gen.test setrlimit.gen.test setuid.gen.test \ + setuid32.gen.test shmxt.gen.test shutdown.gen.test \ + sigaction.gen.test siginfo.gen.test signal.gen.test \ + signal_receive.gen.test signalfd4.gen.test sigpending.gen.test \ + sigprocmask.gen.test sigreturn.gen.test sigsuspend.gen.test \ + so_linger.gen.test so_peercred.gen.test sock_filter-v.gen.test \ + socketcall.gen.test sockopt-sol_netlink.gen.test \ + splice.gen.test stat.gen.test stat64.gen.test statfs.gen.test \ + statfs64.gen.test statx.gen.test swap.gen.test \ + sxetmask.gen.test symlink.gen.test symlinkat.gen.test \ + sync.gen.test sync_file_range.gen.test \ + sync_file_range2.gen.test sysinfo.gen.test syslog.gen.test \ + tee.gen.test time.gen.test timer_create.gen.test \ + timer_xettime.gen.test timerfd_xettime.gen.test times.gen.test \ + times-fail.gen.test trace_fstat.gen.test \ + trace_fstatfs.gen.test trace_lstat.gen.test \ + trace_question.gen.test trace_stat.gen.test \ + trace_stat_like.gen.test trace_statfs.gen.test \ + trace_statfs_like.gen.test truncate.gen.test \ + truncate64.gen.test ugetrlimit.gen.test umask.gen.test \ + umoven-illptr.gen.test umovestr-illptr.gen.test \ umovestr3.gen.test unlink.gen.test unlinkat.gen.test \ unshare.gen.test userfaultfd.gen.test ustat.gen.test \ utime.gen.test utimensat.gen.test utimes.gen.test \ @@ -3499,7 +3658,7 @@ GEN_TESTS = _newselect.gen.test accept.gen.test accept4.gen.test \ xetitimer.gen.test xetpgid.gen.test xetpriority.gen.test \ xettimeofday.gen.test @USE_LIBUNWIND_FALSE@LIBUNWIND_TESTS = -@USE_LIBUNWIND_TRUE@LIBUNWIND_TESTS = strace-k.test +@USE_LIBUNWIND_TRUE@LIBUNWIND_TESTS = strace-k.test $(am__append_1) DECODER_TESTS = \ brk.test \ btrfs-v.test \ @@ -3514,11 +3673,6 @@ DECODER_TESTS = \ futex.test \ getuid.test \ ioctl.test \ - ioctl_dm-v.test \ - ioctl_dm.test \ - ioctl_loop-nv.test \ - ioctl_nsfs.test \ - ioctl_sock_gifconf.test \ ipc_msgbuf.test \ llseek.test \ lseek.test \ @@ -3530,9 +3684,11 @@ DECODER_TESTS = \ net.test \ netlink_sock_diag.test \ nsyscalls.test \ - oldselect.test \ + nsyscalls-d.test \ + nsyscalls-nd.test \ personality.test \ pipe.test \ + poll-P.test \ poll.test \ prctl-arg2-intptr.test \ prctl-dumpable.test \ @@ -3551,6 +3707,7 @@ DECODER_TESTS = \ seccomp-strict.test \ sigaltstack.test \ sun_path.test \ + xet_thread_area_x86.test \ uio.test \ umount.test \ umount2.test \ @@ -3573,6 +3730,8 @@ MISC_TESTS = \ detach-sleeping.test \ detach-stopped.test \ filter-unavailable.test \ + filtering_fd-syntax.test \ + filtering_syscall-syntax.test \ fflush.test \ get_regs.test \ interactive_block.test \ @@ -3616,10 +3775,16 @@ XFAIL_TESTS_x86_64 = int_0x80.gen.test XFAIL_TESTS_x32 = int_0x80.gen.test XFAIL_TESTS = $(XFAIL_TESTS_$(MPERS_NAME)) $(XFAIL_TESTS_$(ARCH)) TEST_LOG_COMPILER = env -AM_TEST_LOG_FLAGS = STRACE_ARCH=$(ARCH) MIPS_ABI=$(MIPS_ABI) $(srcdir)/run.sh +AM_TEST_LOG_FLAGS = STRACE_ARCH=$(ARCH) STRACE_NATIVE_ARCH=$(NATIVE_ARCH) \ + SIZEOF_KERNEL_LONG_T=$(SIZEOF_KERNEL_LONG_T) \ + SIZEOF_LONG=$(SIZEOF_LONG) \ + MIPS_ABI=$(MIPS_ABI) $(srcdir)/run.sh + VALGRIND_FLAGS = --quiet VALGRIND_SUPPRESSIONS_FILES = $(abs_srcdir)/strace.supp EXTRA_DIST = \ + accept_compat.h \ + attach-p-cmd.h \ caps-abbrev.awk \ caps.awk \ clock.in \ @@ -3635,7 +3800,6 @@ EXTRA_DIST = \ getresugid.c \ init.sh \ init_delete_module.h \ - ioctl-v.sh \ ipc.sh \ ipc_msgbuf.expected \ ksysent.sed \ @@ -3643,8 +3807,8 @@ EXTRA_DIST = \ match.awk \ net.expected \ netlink_sock_diag-v.sh \ - oldselect.expected \ pipe.expected \ + print_user_desc.c \ process_vm_readv_writev.c \ pure_executables.list \ qual_fault-exit_group.expected \ @@ -3662,10 +3826,12 @@ EXTRA_DIST = \ setugid.c \ sigaltstack.expected \ sockname.c \ + stack-fcall.h \ strace-C.expected \ strace-E.expected \ strace-T.expected \ strace-ff.expected \ + strace-k-demangle.test \ strace-k.test \ strace-r.expected \ strace.supp \ @@ -3756,6 +3922,10 @@ _newselect$(EXEEXT): $(_newselect_OBJECTS) $(_newselect_DEPENDENCIES) $(EXTRA__n @rm -f _newselect$(EXEEXT) $(AM_V_CCLD)$(LINK) $(_newselect_OBJECTS) $(_newselect_LDADD) $(LIBS) +_newselect-P$(EXEEXT): $(_newselect_P_OBJECTS) $(_newselect_P_DEPENDENCIES) $(EXTRA__newselect_P_DEPENDENCIES) + @rm -f _newselect-P$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(_newselect_P_OBJECTS) $(_newselect_P_LDADD) $(LIBS) + accept$(EXEEXT): $(accept_OBJECTS) $(accept_DEPENDENCIES) $(EXTRA_accept_DEPENDENCIES) @rm -f accept$(EXEEXT) $(AM_V_CCLD)$(LINK) $(accept_OBJECTS) $(accept_LDADD) $(LIBS) @@ -4248,6 +4418,10 @@ ioctl_evdev-v$(EXEEXT): $(ioctl_evdev_v_OBJECTS) $(ioctl_evdev_v_DEPENDENCIES) $ @rm -f ioctl_evdev-v$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ioctl_evdev_v_OBJECTS) $(ioctl_evdev_v_LDADD) $(LIBS) +ioctl_kvm_run$(EXEEXT): $(ioctl_kvm_run_OBJECTS) $(ioctl_kvm_run_DEPENDENCIES) $(EXTRA_ioctl_kvm_run_DEPENDENCIES) + @rm -f ioctl_kvm_run$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ioctl_kvm_run_OBJECTS) $(ioctl_kvm_run_LDADD) $(LIBS) + ioctl_loop$(EXEEXT): $(ioctl_loop_OBJECTS) $(ioctl_loop_DEPENDENCIES) $(EXTRA_ioctl_loop_DEPENDENCIES) @rm -f ioctl_loop$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ioctl_loop_OBJECTS) $(ioctl_loop_LDADD) $(LIBS) @@ -4484,6 +4658,10 @@ mmsg_name-v$(EXEEXT): $(mmsg_name_v_OBJECTS) $(mmsg_name_v_DEPENDENCIES) $(EXTRA @rm -f mmsg_name-v$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mmsg_name_v_OBJECTS) $(mmsg_name_v_LDADD) $(LIBS) +modify_ldt$(EXEEXT): $(modify_ldt_OBJECTS) $(modify_ldt_DEPENDENCIES) $(EXTRA_modify_ldt_DEPENDENCIES) + @rm -f modify_ldt$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(modify_ldt_OBJECTS) $(modify_ldt_LDADD) $(LIBS) + mount$(EXEEXT): $(mount_OBJECTS) $(mount_DEPENDENCIES) $(EXTRA_mount_DEPENDENCIES) @rm -f mount$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mount_OBJECTS) $(mount_LDADD) $(LIBS) @@ -4780,10 +4958,22 @@ nsyscalls$(EXEEXT): $(nsyscalls_OBJECTS) $(nsyscalls_DEPENDENCIES) $(EXTRA_nsysc @rm -f nsyscalls$(EXEEXT) $(AM_V_CCLD)$(LINK) $(nsyscalls_OBJECTS) $(nsyscalls_LDADD) $(LIBS) +nsyscalls-d$(EXEEXT): $(nsyscalls_d_OBJECTS) $(nsyscalls_d_DEPENDENCIES) $(EXTRA_nsyscalls_d_DEPENDENCIES) + @rm -f nsyscalls-d$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(nsyscalls_d_OBJECTS) $(nsyscalls_d_LDADD) $(LIBS) + old_mmap$(EXEEXT): $(old_mmap_OBJECTS) $(old_mmap_DEPENDENCIES) $(EXTRA_old_mmap_DEPENDENCIES) @rm -f old_mmap$(EXEEXT) $(AM_V_CCLD)$(LINK) $(old_mmap_OBJECTS) $(old_mmap_LDADD) $(LIBS) +old_mmap-P$(EXEEXT): $(old_mmap_P_OBJECTS) $(old_mmap_P_DEPENDENCIES) $(EXTRA_old_mmap_P_DEPENDENCIES) + @rm -f old_mmap-P$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(old_mmap_P_OBJECTS) $(old_mmap_P_LDADD) $(LIBS) + +old_mmap-v-none$(EXEEXT): $(old_mmap_v_none_OBJECTS) $(old_mmap_v_none_DEPENDENCIES) $(EXTRA_old_mmap_v_none_DEPENDENCIES) + @rm -f old_mmap-v-none$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(old_mmap_v_none_OBJECTS) $(old_mmap_v_none_LDADD) $(LIBS) + oldfstat$(EXEEXT): $(oldfstat_OBJECTS) $(oldfstat_DEPENDENCIES) $(EXTRA_oldfstat_DEPENDENCIES) @rm -f oldfstat$(EXEEXT) $(AM_V_CCLD)$(LINK) $(oldfstat_OBJECTS) $(oldfstat_LDADD) $(LIBS) @@ -4796,6 +4986,18 @@ oldselect$(EXEEXT): $(oldselect_OBJECTS) $(oldselect_DEPENDENCIES) $(EXTRA_oldse @rm -f oldselect$(EXEEXT) $(AM_V_CCLD)$(LINK) $(oldselect_OBJECTS) $(oldselect_LDADD) $(LIBS) +oldselect-P$(EXEEXT): $(oldselect_P_OBJECTS) $(oldselect_P_DEPENDENCIES) $(EXTRA_oldselect_P_DEPENDENCIES) + @rm -f oldselect-P$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(oldselect_P_OBJECTS) $(oldselect_P_LDADD) $(LIBS) + +oldselect-efault$(EXEEXT): $(oldselect_efault_OBJECTS) $(oldselect_efault_DEPENDENCIES) $(EXTRA_oldselect_efault_DEPENDENCIES) + @rm -f oldselect-efault$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(oldselect_efault_OBJECTS) $(oldselect_efault_LDADD) $(LIBS) + +oldselect-efault-P$(EXEEXT): $(oldselect_efault_P_OBJECTS) $(oldselect_efault_P_DEPENDENCIES) $(EXTRA_oldselect_efault_P_DEPENDENCIES) + @rm -f oldselect-efault-P$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(oldselect_efault_P_OBJECTS) $(oldselect_efault_P_LDADD) $(LIBS) + oldstat$(EXEEXT): $(oldstat_OBJECTS) $(oldstat_DEPENDENCIES) $(EXTRA_oldstat_DEPENDENCIES) @rm -f oldstat$(EXEEXT) $(AM_V_CCLD)$(LINK) $(oldstat_OBJECTS) $(oldstat_LDADD) $(LIBS) @@ -4860,10 +5062,18 @@ poll$(EXEEXT): $(poll_OBJECTS) $(poll_DEPENDENCIES) $(EXTRA_poll_DEPENDENCIES) @rm -f poll$(EXEEXT) $(AM_V_CCLD)$(LINK) $(poll_OBJECTS) $(poll_LDADD) $(LIBS) +poll-P$(EXEEXT): $(poll_P_OBJECTS) $(poll_P_DEPENDENCIES) $(EXTRA_poll_P_DEPENDENCIES) + @rm -f poll-P$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(poll_P_OBJECTS) $(poll_P_LDADD) $(LIBS) + ppoll$(EXEEXT): $(ppoll_OBJECTS) $(ppoll_DEPENDENCIES) $(EXTRA_ppoll_DEPENDENCIES) @rm -f ppoll$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ppoll_OBJECTS) $(ppoll_LDADD) $(LIBS) +ppoll-P$(EXEEXT): $(ppoll_P_OBJECTS) $(ppoll_P_DEPENDENCIES) $(EXTRA_ppoll_P_DEPENDENCIES) + @rm -f ppoll-P$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ppoll_P_OBJECTS) $(ppoll_P_LDADD) $(LIBS) + ppoll-v$(EXEEXT): $(ppoll_v_OBJECTS) $(ppoll_v_DEPENDENCIES) $(EXTRA_ppoll_v_DEPENDENCIES) @rm -f ppoll-v$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ppoll_v_OBJECTS) $(ppoll_v_LDADD) $(LIBS) @@ -5084,6 +5294,10 @@ restart_syscall$(EXEEXT): $(restart_syscall_OBJECTS) $(restart_syscall_DEPENDENC @rm -f restart_syscall$(EXEEXT) $(AM_V_CCLD)$(LINK) $(restart_syscall_OBJECTS) $(restart_syscall_LDADD) $(LIBS) +riscv_flush_icache$(EXEEXT): $(riscv_flush_icache_OBJECTS) $(riscv_flush_icache_DEPENDENCIES) $(EXTRA_riscv_flush_icache_DEPENDENCIES) + @rm -f riscv_flush_icache$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(riscv_flush_icache_OBJECTS) $(riscv_flush_icache_LDADD) $(LIBS) + rmdir$(EXEEXT): $(rmdir_OBJECTS) $(rmdir_DEPENDENCIES) $(EXTRA_rmdir_DEPENDENCIES) @rm -f rmdir$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rmdir_OBJECTS) $(rmdir_LDADD) $(LIBS) @@ -5124,6 +5338,30 @@ run_expect_termsig$(EXEEXT): $(run_expect_termsig_OBJECTS) $(run_expect_termsig_ @rm -f run_expect_termsig$(EXEEXT) $(AM_V_CCLD)$(LINK) $(run_expect_termsig_OBJECTS) $(run_expect_termsig_LDADD) $(LIBS) +s390_guarded_storage$(EXEEXT): $(s390_guarded_storage_OBJECTS) $(s390_guarded_storage_DEPENDENCIES) $(EXTRA_s390_guarded_storage_DEPENDENCIES) + @rm -f s390_guarded_storage$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(s390_guarded_storage_OBJECTS) $(s390_guarded_storage_LDADD) $(LIBS) + +s390_guarded_storage-v$(EXEEXT): $(s390_guarded_storage_v_OBJECTS) $(s390_guarded_storage_v_DEPENDENCIES) $(EXTRA_s390_guarded_storage_v_DEPENDENCIES) + @rm -f s390_guarded_storage-v$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(s390_guarded_storage_v_OBJECTS) $(s390_guarded_storage_v_LDADD) $(LIBS) + +s390_pci_mmio_read_write$(EXEEXT): $(s390_pci_mmio_read_write_OBJECTS) $(s390_pci_mmio_read_write_DEPENDENCIES) $(EXTRA_s390_pci_mmio_read_write_DEPENDENCIES) + @rm -f s390_pci_mmio_read_write$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(s390_pci_mmio_read_write_OBJECTS) $(s390_pci_mmio_read_write_LDADD) $(LIBS) + +s390_runtime_instr$(EXEEXT): $(s390_runtime_instr_OBJECTS) $(s390_runtime_instr_DEPENDENCIES) $(EXTRA_s390_runtime_instr_DEPENDENCIES) + @rm -f s390_runtime_instr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(s390_runtime_instr_OBJECTS) $(s390_runtime_instr_LDADD) $(LIBS) + +s390_sthyi$(EXEEXT): $(s390_sthyi_OBJECTS) $(s390_sthyi_DEPENDENCIES) $(EXTRA_s390_sthyi_DEPENDENCIES) + @rm -f s390_sthyi$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(s390_sthyi_OBJECTS) $(s390_sthyi_LDADD) $(LIBS) + +s390_sthyi-v$(EXEEXT): $(s390_sthyi_v_OBJECTS) $(s390_sthyi_v_DEPENDENCIES) $(EXTRA_s390_sthyi_v_DEPENDENCIES) + @rm -f s390_sthyi-v$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(s390_sthyi_v_OBJECTS) $(s390_sthyi_v_LDADD) $(LIBS) + sched_get_priority_mxx$(EXEEXT): $(sched_get_priority_mxx_OBJECTS) $(sched_get_priority_mxx_DEPENDENCIES) $(EXTRA_sched_get_priority_mxx_DEPENDENCIES) @rm -f sched_get_priority_mxx$(EXEEXT) $(AM_V_CCLD)$(LINK) $(sched_get_priority_mxx_OBJECTS) $(sched_get_priority_mxx_LDADD) $(LIBS) @@ -5176,6 +5414,10 @@ select$(EXEEXT): $(select_OBJECTS) $(select_DEPENDENCIES) $(EXTRA_select_DEPENDE @rm -f select$(EXEEXT) $(AM_V_CCLD)$(LINK) $(select_OBJECTS) $(select_LDADD) $(LIBS) +select-P$(EXEEXT): $(select_P_OBJECTS) $(select_P_DEPENDENCIES) $(EXTRA_select_P_DEPENDENCIES) + @rm -f select-P$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(select_P_OBJECTS) $(select_P_LDADD) $(LIBS) + semop$(EXEEXT): $(semop_OBJECTS) $(semop_DEPENDENCIES) $(EXTRA_semop_DEPENDENCIES) @rm -f semop$(EXEEXT) $(AM_V_CCLD)$(LINK) $(semop_OBJECTS) $(semop_LDADD) $(LIBS) @@ -5360,6 +5602,10 @@ socketcall$(EXEEXT): $(socketcall_OBJECTS) $(socketcall_DEPENDENCIES) $(EXTRA_so @rm -f socketcall$(EXEEXT) $(AM_V_CCLD)$(LINK) $(socketcall_OBJECTS) $(socketcall_LDADD) $(LIBS) +sockopt-sol_netlink$(EXEEXT): $(sockopt_sol_netlink_OBJECTS) $(sockopt_sol_netlink_DEPENDENCIES) $(EXTRA_sockopt_sol_netlink_DEPENDENCIES) + @rm -f sockopt-sol_netlink$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(sockopt_sol_netlink_OBJECTS) $(sockopt_sol_netlink_LDADD) $(LIBS) + splice$(EXEEXT): $(splice_OBJECTS) $(splice_DEPENDENCIES) $(EXTRA_splice_DEPENDENCIES) @rm -f splice$(EXEEXT) $(AM_V_CCLD)$(LINK) $(splice_OBJECTS) $(splice_LDADD) $(LIBS) @@ -5368,6 +5614,10 @@ stack-fcall$(EXEEXT): $(stack_fcall_OBJECTS) $(stack_fcall_DEPENDENCIES) $(EXTRA @rm -f stack-fcall$(EXEEXT) $(AM_V_CCLD)$(LINK) $(stack_fcall_OBJECTS) $(stack_fcall_LDADD) $(LIBS) +stack-fcall-mangled$(EXEEXT): $(stack_fcall_mangled_OBJECTS) $(stack_fcall_mangled_DEPENDENCIES) $(EXTRA_stack_fcall_mangled_DEPENDENCIES) + @rm -f stack-fcall-mangled$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(stack_fcall_mangled_OBJECTS) $(stack_fcall_mangled_LDADD) $(LIBS) + stat$(EXEEXT): $(stat_OBJECTS) $(stat_DEPENDENCIES) $(EXTRA_stat_DEPENDENCIES) @rm -f stat$(EXEEXT) $(AM_V_CCLD)$(LINK) $(stat_OBJECTS) $(stat_LDADD) $(LIBS) @@ -5596,6 +5846,10 @@ xet_robust_list$(EXEEXT): $(xet_robust_list_OBJECTS) $(xet_robust_list_DEPENDENC @rm -f xet_robust_list$(EXEEXT) $(AM_V_CCLD)$(LINK) $(xet_robust_list_OBJECTS) $(xet_robust_list_LDADD) $(LIBS) +xet_thread_area_x86$(EXEEXT): $(xet_thread_area_x86_OBJECTS) $(xet_thread_area_x86_DEPENDENCIES) $(EXTRA_xet_thread_area_x86_DEPENDENCIES) + @rm -f xet_thread_area_x86$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(xet_thread_area_x86_OBJECTS) $(xet_thread_area_x86_LDADD) $(LIBS) + xetitimer$(EXEEXT): $(xetitimer_OBJECTS) $(xetitimer_DEPENDENCIES) $(EXTRA_xetitimer_DEPENDENCIES) @rm -f xetitimer$(EXEEXT) $(AM_V_CCLD)$(LINK) $(xetitimer_OBJECTS) $(xetitimer_LDADD) $(LIBS) @@ -5622,6 +5876,7 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_newselect-P.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_newselect.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/accept.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/accept4.Po@am__quote@ @@ -5746,6 +6001,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_dm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_evdev-v.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_evdev.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_kvm_run.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_loop-nv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_loop-v.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_loop.Po@am__quote@ @@ -5831,6 +6087,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmsg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmsg_name-v.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmsg_name.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modify_ldt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mount.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/move_pages.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mq.Po@am__quote@ @@ -5904,10 +6161,16 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nlattr_tcamsg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nlattr_tcmsg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nlattr_unix_diag_msg.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nsyscalls-d.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nsyscalls.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/old_mmap-P.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/old_mmap-v-none.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/old_mmap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oldfstat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oldlstat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oldselect-P.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oldselect-efault-P.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oldselect-efault.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oldselect.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oldstat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/open.Po@am__quote@ @@ -5924,7 +6187,9 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkey_alloc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkey_free.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkey_mprotect.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/poll-P.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/poll.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppoll-P.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppoll-v.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppoll.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prctl-arg2-intptr.Po@am__quote@ @@ -5981,6 +6246,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/renameat2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/request_key.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/restart_syscall.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/riscv_flush_icache.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rmdir.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rt_sigaction.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rt_sigpending.Po@am__quote@ @@ -5991,6 +6257,12 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rt_sigtimedwait.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rt_tgsigqueueinfo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run_expect_termsig.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_guarded_storage-v.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_guarded_storage.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_pci_mmio_read_write.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_runtime_instr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_sthyi-v.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_sthyi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched_get_priority_mxx.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched_rr_get_interval.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched_xetaffinity.Po@am__quote@ @@ -6003,6 +6275,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seccomp-filter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seccomp-strict.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seccomp_get_action_avail.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/select-P.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/select.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/semop.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sendfile.Po@am__quote@ @@ -6050,11 +6323,17 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/so_peercred.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sock_filter-v.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/socketcall.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sockopt-sol_netlink.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splice.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-0.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-3.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled-0.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled-1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled-2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled-3.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat64-stat64.Po@am__quote@ @@ -6113,6 +6392,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xattr-strings.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xattr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xet_robust_list.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xet_thread_area_x86.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xetitimer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xetpgid.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xetpriority.Po@am__quote@ @@ -7094,6 +7374,9 @@ uninstall-am: $(srcdir)/_newselect.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/_newselect-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/accept.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -7385,21 +7668,36 @@ $(srcdir)/int_0x80.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(srcdir)/ioctl_block.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_dm.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/ioctl_dm-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_evdev.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ $(srcdir)/ioctl_evdev-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_kvm_run.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_loop.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_loop-nv.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_loop-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ $(srcdir)/ioctl_mtd.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_nsfs.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_rtc.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -7415,6 +7713,9 @@ $(srcdir)/ioctl_sg_io_v3.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_test $(srcdir)/ioctl_sg_io_v4.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_sock_gifconf.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_uffdio.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -7538,6 +7839,9 @@ $(srcdir)/mmsg_name.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(srcdir)/mmsg_name-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/modify_ldt.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/mount.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -7733,12 +8037,30 @@ $(srcdir)/nlattr_unix_diag_msg.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/ge $(srcdir)/old_mmap.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/old_mmap-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/old_mmap-v-none.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/oldfstat.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ $(srcdir)/oldlstat.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/oldselect.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/oldselect-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/oldselect-efault.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/oldselect-efault-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/oldstat.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -7778,6 +8100,9 @@ $(srcdir)/pkey_mprotect.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests $(srcdir)/ppoll.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ppoll-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ppoll-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -7889,6 +8214,9 @@ $(srcdir)/renameat2.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(srcdir)/request_key.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/riscv_flush_icache.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/rmdir.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -7913,6 +8241,24 @@ $(srcdir)/rt_sigtimedwait.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tes $(srcdir)/rt_tgsigqueueinfo.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/s390_guarded_storage.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_guarded_storage-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_pci_mmio_read_write.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_runtime_instr.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_sthyi.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_sthyi-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/sched.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -7949,6 +8295,9 @@ $(srcdir)/seccomp_get_action_avail.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir $(srcdir)/select.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/select-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/semop.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -8072,6 +8421,9 @@ $(srcdir)/sock_filter-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests $(srcdir)/socketcall.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/sockopt-sol_netlink.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/splice.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ diff --git a/tests-m32/_newselect-P.c b/tests-m32/_newselect-P.c new file mode 100644 index 00000000..561fbfe2 --- /dev/null +++ b/tests-m32/_newselect-P.c @@ -0,0 +1,2 @@ +#define PATH_TRACING_FD 9 +#include "_newselect.c" diff --git a/tests-m32/_newselect-P.gen.test b/tests-m32/_newselect-P.gen.test new file mode 100755 index 00000000..9c4247a1 --- /dev/null +++ b/tests-m32/_newselect-P.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (_newselect-P -e trace=_newselect -P /dev/full 9>>/dev/full); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -e trace=_newselect -P /dev/full 9>>/dev/full diff --git a/tests-m32/_newselect.gen.test b/tests-m32/_newselect.gen.test index 490abe46..8e4d5f24 100755 --- a/tests-m32/_newselect.gen.test +++ b/tests-m32/_newselect.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (_newselect ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (_newselect ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/accept.c b/tests-m32/accept.c index 8d42ba15..40b45db2 100644 --- a/tests-m32/accept.c +++ b/tests-m32/accept.c @@ -2,6 +2,7 @@ * Check decoding of accept syscall. * * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,9 +28,34 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef TEST_SYSCALL_NAME -# define TEST_SYSCALL_NAME accept -#endif +#include "tests.h" + +#include <unistd.h> + +#include <asm/unistd.h> + +#if defined __NR_accept + +# ifndef TEST_SYSCALL_NAME +# define TEST_SYSCALL_NAME do_accept + +# ifndef TEST_SYSCALL_STR +# define TEST_SYSCALL_STR "accept" +# endif + +int do_accept(int sockfd, void *addr, void *addrlen) +{ + return syscall(__NR_accept, sockfd, addr, addrlen); +} +# endif /* !TEST_SYSCALL_NAME */ + +#else /* !__NR_accept */ + +# ifndef TEST_SYSCALL_NAME +# define TEST_SYSCALL_NAME accept +# endif + +#endif /* __NR_accept */ #define TEST_SYSCALL_PREPARE connect_un() static void connect_un(void); diff --git a/tests-m32/accept.gen.test b/tests-m32/accept.gen.test index 3ebba3b5..45d9239e 100755 --- a/tests-m32/accept.gen.test +++ b/tests-m32/accept.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (accept -a22); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (accept -a22 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a22 +run_strace_match_diff -a22 diff --git a/tests-m32/accept4.gen.test b/tests-m32/accept4.gen.test index 5bd7fe6c..71199703 100755 --- a/tests-m32/accept4.gen.test +++ b/tests-m32/accept4.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (accept4 -a37); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (accept4 -a37 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a37 +run_strace_match_diff -a37 diff --git a/tests-m32/accept_compat.h b/tests-m32/accept_compat.h new file mode 100644 index 00000000..c45b2551 --- /dev/null +++ b/tests-m32/accept_compat.h @@ -0,0 +1,25 @@ +#ifndef _STRACE_TESTS_ACCEPT_COMPAT_H_ +#define _STRACE_TESTS_ACCEPT_COMPAT_H_ + +#include <unistd.h> +#include <sys/socket.h> +#include <asm/unistd.h> + +#if defined __NR_socketcall && defined __sparc__ +/* + * Work around the fact that + * - glibc >= 2.26 uses accept4 syscall to implement accept() call on sparc; + * - accept syscall had not been wired up on sparc until v4.4-rc8~4^2~1. + */ +static inline int +do_accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen) +{ + const long args[] = { sockfd, (long) addr, (long) addrlen }; + + return syscall(__NR_socketcall, 5, args); +} +#else +# define do_accept accept +#endif + +#endif /* !_STRACE_TESTS_ACCEPT_COMPAT_H_ */ diff --git a/tests-m32/acct.gen.test b/tests-m32/acct.gen.test index fa14e85b..4a98dd46 100755 --- a/tests-m32/acct.gen.test +++ b/tests-m32/acct.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (acct -a20); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (acct -a20 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a20 +run_strace_match_diff -a20 diff --git a/tests-m32/adjtimex.gen.test b/tests-m32/adjtimex.gen.test index 8db59f29..e6024431 100755 --- a/tests-m32/adjtimex.gen.test +++ b/tests-m32/adjtimex.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (adjtimex -a15); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (adjtimex -a15 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a15 +run_strace_match_diff -a15 diff --git a/tests-m32/alarm.gen.test b/tests-m32/alarm.gen.test index ba1dea8b..25982e14 100755 --- a/tests-m32/alarm.gen.test +++ b/tests-m32/alarm.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (alarm -a10); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (alarm -a10 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a10 +run_strace_match_diff -a10 diff --git a/tests-m32/attach-p-cmd-cmd.c b/tests-m32/attach-p-cmd-cmd.c index d0f824e9..70e3a2de 100644 --- a/tests-m32/attach-p-cmd-cmd.c +++ b/tests-m32/attach-p-cmd-cmd.c @@ -1,7 +1,7 @@ /* * This file is part of attach-p-cmd strace test. * - * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2017 Dmitry V. Levin <ldv@altlinux.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,19 +32,41 @@ #include <stdio.h> #include <sys/stat.h> #include <unistd.h> +#include "attach-p-cmd.h" -int -main(void) +static void +write_pidfile(const pid_t pid) +{ + FILE *fp = fopen(pidfile, "w"); + if (!fp) + perror_msg_and_fail("fopen: %s", pidfile); + + if (fprintf(fp, "%d", pid) < 0) + perror_msg_and_fail("fprintf: %s", pidfile); + + if (fclose(fp)) + perror_msg_and_fail("fclose: %s", pidfile); +} + +static void +wait_for_peer_invocation(void) { - static const char lockdir[] = "attach-p-cmd.test-lock"; /* wait for the lock directory to be created by peer */ while (rmdir(lockdir)) { if (ENOENT != errno) perror_msg_and_fail("rmdir: %s", lockdir); } +} + +int +main(void) +{ + const pid_t pid = getpid(); + write_pidfile(pid); + + wait_for_peer_invocation(); static const char dir[] = "attach-p-cmd.test cmd"; - pid_t pid = getpid(); int rc = chdir(dir); printf("%-5d chdir(\"%s\") = %s\n" diff --git a/tests-m32/attach-p-cmd-p.c b/tests-m32/attach-p-cmd-p.c index 254d19ae..843db957 100644 --- a/tests-m32/attach-p-cmd-p.c +++ b/tests-m32/attach-p-cmd-p.c @@ -1,7 +1,7 @@ /* * This file is part of attach-p-cmd strace test. * - * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2017 Dmitry V. Levin <ldv@altlinux.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,27 +33,14 @@ #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> +#include <time.h> #include <unistd.h> +#include "attach-p-cmd.h" static void -handler(int signo) +wait_for_peer_invocation(void) { -} - -int -main(void) -{ - const struct sigaction act = { .sa_handler = handler }; - if (sigaction(SIGALRM, &act, NULL)) - perror_msg_and_fail("sigaction"); - - sigset_t mask = {}; - sigaddset(&mask, SIGALRM); - if (sigprocmask(SIG_UNBLOCK, &mask, NULL)) - perror_msg_and_fail("sigprocmask"); - - static const char lockdir[] = "attach-p-cmd.test-lock"; - /* create a lock directory */ + /* create the lock directory */ if (mkdir(lockdir, 0700)) perror_msg_and_fail("mkdir: %s", lockdir); @@ -63,21 +50,51 @@ main(void) perror_msg_and_fail("mkdir: %s", lockdir); } - /* remove the lock directory */ + /* cleanup the lock directory */ if (rmdir(lockdir)) perror_msg_and_fail("rmdir: %s", lockdir); +} + +static void +wait_for_peer_termination(void) +{ + FILE *fp = fopen(pidfile, "r"); + if (!fp) + perror_msg_and_fail("fopen: %s", pidfile); + + pid_t pid; + if (fscanf(fp, "%d", &pid) < 0) + perror_msg_and_fail("fscanf: %s", pidfile); + if (pid < 0) + error_msg_and_fail("pid = %d", pid); + + if (fclose(fp)) + perror_msg_and_fail("fclose: %s", pidfile); + + if (unlink(pidfile)) + perror_msg_and_fail("unlink: %s", pidfile); + + while (kill(pid, 0) == 0) + ; +} + +int +main(void) +{ + wait_for_peer_invocation(); + wait_for_peer_termination(); - alarm(1); - pause(); + static const struct timespec ts = { .tv_nsec = 123456789 }; + if (nanosleep(&ts, NULL)) + perror_msg_and_fail("nanosleep"); static const char dir[] = "attach-p-cmd.test -p"; pid_t pid = getpid(); int rc = chdir(dir); - printf("%-5d --- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---\n" - "%-5d chdir(\"%s\") = %d %s (%m)\n" + printf("%-5d chdir(\"%s\") = %s\n" "%-5d +++ exited with 0 +++\n", - pid, pid, dir, rc, errno2name(), pid); + pid, dir, sprintrc(rc), pid); return 0; } diff --git a/tests-m32/attach-p-cmd.h b/tests-m32/attach-p-cmd.h new file mode 100644 index 00000000..e04af38f --- /dev/null +++ b/tests-m32/attach-p-cmd.h @@ -0,0 +1,2 @@ +static const char lockdir[] = "attach-p-cmd.test-lock"; +static const char pidfile[] = "attach-p-cmd.test-pid"; diff --git a/tests-m32/bpf.c b/tests-m32/bpf.c index bec30f87..3f963fa3 100644 --- a/tests-m32/bpf.c +++ b/tests-m32/bpf.c @@ -34,8 +34,11 @@ && (defined HAVE_UNION_BPF_ATTR_ATTACH_FLAGS \ || defined HAVE_UNION_BPF_ATTR_BPF_FD \ || defined HAVE_UNION_BPF_ATTR_FLAGS \ - || defined HAVE_UNION_BPF_ATTR_INNER_MAP_FD \ - || defined HAVE_UNION_BPF_ATTR_PROG_FLAGS) + || defined HAVE_UNION_BPF_ATTR_INFO_INFO \ + || defined HAVE_UNION_BPF_ATTR_NEXT_ID \ + || defined HAVE_UNION_BPF_ATTR_NUMA_NODE \ + || defined HAVE_UNION_BPF_ATTR_PROG_FLAGS \ + || defined HAVE_UNION_BPF_ATTR_TEST_DURATION) # include <stddef.h> # include <stdio.h> @@ -43,6 +46,7 @@ # include <string.h> # include <unistd.h> # include <linux/bpf.h> +# include "print_fields.h" static const kernel_ulong_t long_bits = (kernel_ulong_t) 0xfacefeed00000000ULL; static const char *errstr; @@ -183,18 +187,22 @@ sys_bpf(kernel_ulong_t cmd, kernel_ulong_t attr, kernel_ulong_t size) init_ ## cmd_ ## _attr, print_ ## cmd_ ## _attr) \ /* End of TEST_BPF definition. */ -# ifdef HAVE_UNION_BPF_ATTR_INNER_MAP_FD +#define DEF_BPF_INIT_FIRST(cmd_, field_, value_) \ + static unsigned int \ + init_ ## cmd_ ## _first(const unsigned long eop) \ + { \ + static const union bpf_attr attr = { .field_ = value_ };\ + static const unsigned int offset = sizeof(attr.field_); \ + const unsigned long addr = eop - offset; \ + \ + memcpy((void *) addr, &attr.field_, offset); \ + return offset; \ + } \ + /* End of DEF_INIT_FIRST definition. */ -static unsigned int -init_BPF_MAP_CREATE_first(const unsigned long eop) -{ - static const union bpf_attr attr = { .map_type = 2 }; - static const unsigned int offset = sizeof(attr.map_type); - const unsigned long addr = eop - offset; +# ifdef HAVE_UNION_BPF_ATTR_NUMA_NODE - memcpy((void *) addr, &attr.map_type, offset); - return offset; -} +DEF_BPF_INIT_FIRST(BPF_MAP_CREATE, map_type, 2) static void print_BPF_MAP_CREATE_first(const unsigned long addr) @@ -211,11 +219,12 @@ init_BPF_MAP_CREATE_attr(const unsigned long eop) .key_size = 4, .value_size = 8, .max_entries = 256, - .map_flags = 1, - .inner_map_fd = -1 + .map_flags = 7, + .inner_map_fd = -1, + .numa_node = 42 }; static const unsigned int offset = - offsetofend(union bpf_attr, inner_map_fd); + offsetofend(union bpf_attr, numa_node); const unsigned long addr = eop - offset; memcpy((void *) addr, &attr, offset); @@ -227,23 +236,15 @@ print_BPF_MAP_CREATE_attr(const unsigned long addr) { printf("map_type=BPF_MAP_TYPE_HASH, key_size=4" ", value_size=8, max_entries=256" - ", map_flags=BPF_F_NO_PREALLOC, inner_map_fd=-1"); + ", map_flags=BPF_F_NO_PREALLOC|BPF_F_NO_COMMON_LRU" + "|BPF_F_NUMA_NODE, inner_map_fd=-1, numa_node=42"); } -# endif /* HAVE_UNION_BPF_ATTR_INNER_MAP_FD */ +# endif /* HAVE_UNION_BPF_ATTR_NUMA_NODE */ # ifdef HAVE_UNION_BPF_ATTR_FLAGS -static unsigned int -init_BPF_MAP_LOOKUP_ELEM_first(const unsigned long eop) -{ - static const union bpf_attr attr = { .map_fd = -1 }; - static const unsigned int offset = sizeof(attr.map_fd); - const unsigned long addr = eop - offset; - - memcpy((void *) addr, &attr.map_fd, offset); - return offset; -} +DEF_BPF_INIT_FIRST(BPF_MAP_LOOKUP_ELEM, map_fd, -1) static void print_BPF_MAP_LOOKUP_ELEM_first(const unsigned long addr) @@ -367,16 +368,7 @@ print_BPF_MAP_GET_NEXT_KEY_attr(const unsigned long addr) # ifdef HAVE_UNION_BPF_ATTR_PROG_FLAGS -static unsigned int -init_BPF_PROG_LOAD_first(const unsigned long eop) -{ - static const union bpf_attr attr = { .prog_type = 1 }; - static const unsigned int offset = sizeof(attr.prog_type); - const unsigned long addr = eop - offset; - - memcpy((void *) addr, &attr.prog_type, offset); - return offset; -} +DEF_BPF_INIT_FIRST(BPF_PROG_LOAD, prog_type, 1) static void print_BPF_PROG_LOAD_first(const unsigned long addr) @@ -435,16 +427,7 @@ print_BPF_PROG_LOAD_attr(const unsigned long addr) */ # ifdef HAVE_UNION_BPF_ATTR_BPF_FD -static unsigned int -init_BPF_OBJ_PIN_first(const unsigned long eop) -{ - static const union bpf_attr attr = {}; - static const unsigned int offset = sizeof(attr.pathname); - const unsigned long addr = eop - offset; - - memcpy((void *) addr, &attr.pathname, offset); - return offset; -} +DEF_BPF_INIT_FIRST(BPF_OBJ_PIN, pathname, 0) static void print_BPF_OBJ_PIN_first(const unsigned long addr) @@ -484,16 +467,7 @@ print_BPF_OBJ_PIN_attr(const unsigned long addr) /* BPF_PROG_ATTACH and BPF_PROG_DETACH commands appear in kernel 4.10. */ # ifdef HAVE_UNION_BPF_ATTR_ATTACH_FLAGS -static unsigned int -init_BPF_PROG_ATTACH_first(const unsigned long eop) -{ - static const union bpf_attr attr = { .target_fd = -1 }; - static const unsigned int offset = sizeof(attr.target_fd); - const unsigned long addr = eop - offset; - - memcpy((void *) addr, &attr.target_fd, offset); - return offset; -} +DEF_BPF_INIT_FIRST(BPF_PROG_ATTACH, target_fd, -1) static void print_BPF_PROG_ATTACH_first(const unsigned long addr) @@ -559,13 +533,171 @@ print_BPF_PROG_DETACH_attr(const unsigned long addr) # endif /* HAVE_UNION_BPF_ATTR_ATTACH_FLAGS */ +/* BPF_PROG_TEST_RUN command appears in kernel 4.12. */ +# ifdef HAVE_UNION_BPF_ATTR_TEST_DURATION + +DEF_BPF_INIT_FIRST(BPF_PROG_TEST_RUN, test.prog_fd, -1) + +static void +print_BPF_PROG_TEST_RUN_first(const unsigned long addr) +{ + printf("test={prog_fd=-1, retval=0, data_size_in=0, data_size_out=0" + ", data_in=0, data_out=0, repeat=0, duration=0}"); +} + +static const union bpf_attr sample_BPF_PROG_TEST_RUN_attr = { + .test = { + .prog_fd = -1, + .retval = 0xfac1fed2, + .data_size_in = 0xfac3fed4, + .data_size_out = 0xfac5fed6, + .data_in = (uint64_t) 0xfacef11dbadc2ded, + .data_out = (uint64_t) 0xfacef33dbadc4ded, + .repeat = 0xfac7fed8, + .duration = 0xfac9feda + } +}; +static unsigned int +init_BPF_PROG_TEST_RUN_attr(const unsigned long eop) +{ + static const unsigned int offset = + offsetofend(union bpf_attr, test); + const unsigned long addr = eop - offset; + + memcpy((void *) addr, &sample_BPF_PROG_TEST_RUN_attr, offset); + return offset; +} + +static void +print_BPF_PROG_TEST_RUN_attr(const unsigned long addr) +{ + PRINT_FIELD_D("test={", sample_BPF_PROG_TEST_RUN_attr.test, prog_fd); + PRINT_FIELD_U(", ", sample_BPF_PROG_TEST_RUN_attr.test, retval); + PRINT_FIELD_U(", ", sample_BPF_PROG_TEST_RUN_attr.test, data_size_in); + PRINT_FIELD_U(", ", sample_BPF_PROG_TEST_RUN_attr.test, data_size_out); + PRINT_FIELD_X(", ", sample_BPF_PROG_TEST_RUN_attr.test, data_in); + PRINT_FIELD_X(", ", sample_BPF_PROG_TEST_RUN_attr.test, data_out); + PRINT_FIELD_U(", ", sample_BPF_PROG_TEST_RUN_attr.test, repeat); + PRINT_FIELD_U(", ", sample_BPF_PROG_TEST_RUN_attr.test, duration); + printf("}"); +} + +# endif /* HAVE_UNION_BPF_ATTR_TEST_DURATION */ + +# ifdef HAVE_UNION_BPF_ATTR_NEXT_ID + +DEF_BPF_INIT_FIRST(BPF_PROG_GET_NEXT_ID, start_id, 0xdeadbeef) + +static void +print_BPF_PROG_GET_NEXT_ID_first(const unsigned long addr) +{ + printf("start_id=%u, next_id=0", 0xdeadbeef); +} + +static unsigned int +init_BPF_PROG_GET_NEXT_ID_attr(const unsigned long eop) +{ + static const union bpf_attr attr = { + .start_id = 0xbadc0ded, + .next_id = 0xcafef00d + }; + static const unsigned int offset = + offsetofend(union bpf_attr, next_id); + const unsigned long addr = eop - offset; + + memcpy((void *) addr, &attr, offset); + return offset; +} + +static void +print_BPF_PROG_GET_NEXT_ID_attr(const unsigned long addr) +{ + printf("start_id=%u, next_id=%u", 0xbadc0ded, 0xcafef00d); +} + +# define init_BPF_MAP_GET_NEXT_ID_first init_BPF_PROG_GET_NEXT_ID_first +# define print_BPF_MAP_GET_NEXT_ID_first print_BPF_PROG_GET_NEXT_ID_first +# define init_BPF_MAP_GET_NEXT_ID_attr init_BPF_PROG_GET_NEXT_ID_attr +# define print_BPF_MAP_GET_NEXT_ID_attr print_BPF_PROG_GET_NEXT_ID_attr + +# define init_BPF_PROG_GET_FD_BY_ID_first init_BPF_PROG_GET_NEXT_ID_first +# define init_BPF_PROG_GET_FD_BY_ID_attr init_BPF_PROG_GET_NEXT_ID_attr + +static void +print_BPF_PROG_GET_FD_BY_ID_first(const unsigned long addr) +{ + printf("prog_id=%u, next_id=0", 0xdeadbeef); +} + +static void +print_BPF_PROG_GET_FD_BY_ID_attr(const unsigned long addr) +{ + printf("prog_id=%u, next_id=%u", 0xbadc0ded, 0xcafef00d); +} + +# define init_BPF_MAP_GET_FD_BY_ID_first init_BPF_PROG_GET_NEXT_ID_first +# define init_BPF_MAP_GET_FD_BY_ID_attr init_BPF_PROG_GET_NEXT_ID_attr + +static void +print_BPF_MAP_GET_FD_BY_ID_first(const unsigned long addr) +{ + printf("map_id=%u, next_id=0", 0xdeadbeef); +} + +static void +print_BPF_MAP_GET_FD_BY_ID_attr(const unsigned long addr) +{ + printf("map_id=%u, next_id=%u", 0xbadc0ded, 0xcafef00d); +} + +# endif /* HAVE_UNION_BPF_ATTR_NEXT_ID */ + +# ifdef HAVE_UNION_BPF_ATTR_INFO_INFO + +DEF_BPF_INIT_FIRST(BPF_OBJ_GET_INFO_BY_FD, info.bpf_fd, -1) + +static void +print_BPF_OBJ_GET_INFO_BY_FD_first(const unsigned long addr) +{ + printf("info={bpf_fd=-1, info_len=0, info=0}"); +} + +static const union bpf_attr sample_BPF_OBJ_GET_INFO_BY_FD_attr = { + .info = { + .bpf_fd = -1, + .info_len = 0xdeadbeef, + .info = (uint64_t) 0xfacefeedbadc0ded + } +}; +static unsigned int +init_BPF_OBJ_GET_INFO_BY_FD_attr(const unsigned long eop) +{ + static const unsigned int offset = + offsetofend(union bpf_attr, info); + const unsigned long addr = eop - offset; + + memcpy((void *) addr, &sample_BPF_OBJ_GET_INFO_BY_FD_attr, offset); + return offset; +} + +static void +print_BPF_OBJ_GET_INFO_BY_FD_attr(const unsigned long addr) +{ + PRINT_FIELD_D("info={", sample_BPF_OBJ_GET_INFO_BY_FD_attr.info, bpf_fd); + PRINT_FIELD_U(", ", sample_BPF_OBJ_GET_INFO_BY_FD_attr.info, info_len); + PRINT_FIELD_X(", ", sample_BPF_OBJ_GET_INFO_BY_FD_attr.info, info); + printf("}"); +} + +# endif /* HAVE_UNION_BPF_ATTR_INFO_INFO */ + int main(void) { page_size = get_page_size(); end_of_page = (unsigned long) tail_alloc(1) + 1; -# ifdef HAVE_UNION_BPF_ATTR_INNER_MAP_FD +# ifdef HAVE_UNION_BPF_ATTR_NUMA_NODE TEST_BPF(BPF_MAP_CREATE); # endif @@ -590,6 +722,21 @@ main(void) TEST_BPF(BPF_PROG_DETACH); # endif +# ifdef HAVE_UNION_BPF_ATTR_TEST_DURATION + TEST_BPF(BPF_PROG_TEST_RUN); +# endif + +# ifdef HAVE_UNION_BPF_ATTR_NEXT_ID + TEST_BPF(BPF_PROG_GET_NEXT_ID); + TEST_BPF(BPF_MAP_GET_NEXT_ID); + TEST_BPF(BPF_PROG_GET_FD_BY_ID); + TEST_BPF(BPF_MAP_GET_FD_BY_ID); +# endif + +# ifdef HAVE_UNION_BPF_ATTR_INFO_INFO + TEST_BPF(BPF_OBJ_GET_INFO_BY_FD); +# endif + sys_bpf(0xfacefeed, end_of_page, 40); printf("bpf(0xfacefeed /* BPF_??? */, %#lx, 40) = %s\n", end_of_page, errstr); diff --git a/tests-m32/bpf.gen.test b/tests-m32/bpf.gen.test index 7ee9e7f3..1391d6b8 100755 --- a/tests-m32/bpf.gen.test +++ b/tests-m32/bpf.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (bpf -a20); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (bpf -a20 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a20 +run_strace_match_diff -a20 diff --git a/tests-m32/btrfs.gen.test b/tests-m32/btrfs.gen.test index a7118efa..3976cf5d 100755 --- a/tests-m32/btrfs.gen.test +++ b/tests-m32/btrfs.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (btrfs +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (btrfs +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests-m32/chmod.gen.test b/tests-m32/chmod.gen.test index 438665ad..40330885 100755 --- a/tests-m32/chmod.gen.test +++ b/tests-m32/chmod.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (chmod -a28); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (chmod -a28 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a28 +run_strace_match_diff -a28 diff --git a/tests-m32/chown.gen.test b/tests-m32/chown.gen.test index 46889a13..87cc0f02 100755 --- a/tests-m32/chown.gen.test +++ b/tests-m32/chown.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (chown -a28); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (chown -a28 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a28 +run_strace_match_diff -a28 diff --git a/tests-m32/chown32.gen.test b/tests-m32/chown32.gen.test index f0f603e3..8d9d8916 100755 --- a/tests-m32/chown32.gen.test +++ b/tests-m32/chown32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (chown32 -a31); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (chown32 -a31 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a31 +run_strace_match_diff -a31 diff --git a/tests-m32/chroot.gen.test b/tests-m32/chroot.gen.test index 6ea81dd2..40eb55ba 100755 --- a/tests-m32/chroot.gen.test +++ b/tests-m32/chroot.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (chroot -a24); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (chroot -a24 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a24 +run_strace_match_diff -a24 diff --git a/tests-m32/clock_adjtime.gen.test b/tests-m32/clock_adjtime.gen.test index 735e3af5..22d5dbcd 100755 --- a/tests-m32/clock_adjtime.gen.test +++ b/tests-m32/clock_adjtime.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (clock_adjtime -a37); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (clock_adjtime -a37 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a37 +run_strace_match_diff -a37 diff --git a/tests-m32/copy_file_range.gen.test b/tests-m32/copy_file_range.gen.test index 4f3063ba..e90c6c18 100755 --- a/tests-m32/copy_file_range.gen.test +++ b/tests-m32/copy_file_range.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (copy_file_range ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (copy_file_range ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/creat.gen.test b/tests-m32/creat.gen.test index d2e47d31..baff9169 100755 --- a/tests-m32/creat.gen.test +++ b/tests-m32/creat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (creat -a20); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (creat -a20 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a20 +run_strace_match_diff -a20 diff --git a/tests-m32/delete_module.gen.test b/tests-m32/delete_module.gen.test index 4e4c6712..028515ff 100755 --- a/tests-m32/delete_module.gen.test +++ b/tests-m32/delete_module.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (delete_module -a23); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (delete_module -a23 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a23 +run_strace_match_diff -a23 diff --git a/tests-m32/dup.gen.test b/tests-m32/dup.gen.test index e5729c0f..e559cdbc 100755 --- a/tests-m32/dup.gen.test +++ b/tests-m32/dup.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (dup -a8); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (dup -a8 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a8 +run_strace_match_diff -a8 diff --git a/tests-m32/dup2.gen.test b/tests-m32/dup2.gen.test index fd1f5c97..6a6d2f58 100755 --- a/tests-m32/dup2.gen.test +++ b/tests-m32/dup2.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (dup2 -a13); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (dup2 -a13 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a13 +run_strace_match_diff -a13 diff --git a/tests-m32/dup3.gen.test b/tests-m32/dup3.gen.test index d6ff7d7a..776b9a79 100755 --- a/tests-m32/dup3.gen.test +++ b/tests-m32/dup3.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (dup3 -a24); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (dup3 -a24 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a24 +run_strace_match_diff -a24 diff --git a/tests-m32/epoll_create.gen.test b/tests-m32/epoll_create.gen.test index 841da6d0..277a5aab 100755 --- a/tests-m32/epoll_create.gen.test +++ b/tests-m32/epoll_create.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_create -a17); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_create -a17 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a17 +run_strace_match_diff -a17 diff --git a/tests-m32/epoll_create1.gen.test b/tests-m32/epoll_create1.gen.test index c5e62a06..c510c322 100755 --- a/tests-m32/epoll_create1.gen.test +++ b/tests-m32/epoll_create1.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_create1 -a28); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_create1 -a28 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a28 +run_strace_match_diff -a28 diff --git a/tests-m32/epoll_ctl.gen.test b/tests-m32/epoll_ctl.gen.test index 68c96eb8..dba65f7d 100755 --- a/tests-m32/epoll_ctl.gen.test +++ b/tests-m32/epoll_ctl.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_ctl ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_ctl ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/epoll_pwait.gen.test b/tests-m32/epoll_pwait.gen.test index c558efc4..f98e2b55 100755 --- a/tests-m32/epoll_pwait.gen.test +++ b/tests-m32/epoll_pwait.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_pwait ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_pwait ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/epoll_wait.gen.test b/tests-m32/epoll_wait.gen.test index 024cc0fd..d90fbeb9 100755 --- a/tests-m32/epoll_wait.gen.test +++ b/tests-m32/epoll_wait.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_wait -a26); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_wait -a26 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a26 +run_strace_match_diff -a26 diff --git a/tests-m32/error_msg.c b/tests-m32/error_msg.c index 498a8821..9cb3e80c 100644 --- a/tests-m32/error_msg.c +++ b/tests-m32/error_msg.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -25,6 +26,9 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#define perror_msg_and_fail perror_msg_and_fail +#define error_msg_and_fail error_msg_and_fail + #include "tests.h" #include <errno.h> #include <stdarg.h> diff --git a/tests-m32/execveat.gen.test b/tests-m32/execveat.gen.test index c92e4d65..180b8299 100755 --- a/tests-m32/execveat.gen.test +++ b/tests-m32/execveat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (execveat ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (execveat ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/fadvise64_64.gen.test b/tests-m32/fadvise64_64.gen.test index 5f95b3c2..e46bf810 100755 --- a/tests-m32/fadvise64_64.gen.test +++ b/tests-m32/fadvise64_64.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fadvise64_64 +fadvise64.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fadvise64_64 +fadvise64.test ); do not edit. +set -- . "${srcdir=.}/fadvise64.test" diff --git a/tests-m32/fallocate.gen.test b/tests-m32/fallocate.gen.test index c6cfdb79..3bb5bbf0 100755 --- a/tests-m32/fallocate.gen.test +++ b/tests-m32/fallocate.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fallocate -a18); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fallocate -a18 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a18 +run_strace_match_diff -a18 diff --git a/tests-m32/fanotify_init.gen.test b/tests-m32/fanotify_init.gen.test index ee519e66..69807a7a 100755 --- a/tests-m32/fanotify_init.gen.test +++ b/tests-m32/fanotify_init.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fanotify_init ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fanotify_init ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/fanotify_mark.gen.test b/tests-m32/fanotify_mark.gen.test index ce16a551..46512608 100755 --- a/tests-m32/fanotify_mark.gen.test +++ b/tests-m32/fanotify_mark.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fanotify_mark -a32); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fanotify_mark -a32 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a32 +run_strace_match_diff -a32 diff --git a/tests-m32/fchdir.gen.test b/tests-m32/fchdir.gen.test index c80e141f..a352a21b 100755 --- a/tests-m32/fchdir.gen.test +++ b/tests-m32/fchdir.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchdir -a11); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchdir -a11 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a11 +run_strace_match_diff -a11 diff --git a/tests-m32/fchmod.gen.test b/tests-m32/fchmod.gen.test index f327fb7a..828c9b50 100755 --- a/tests-m32/fchmod.gen.test +++ b/tests-m32/fchmod.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchmod -a15); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchmod -a15 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a15 +run_strace_match_diff -a15 diff --git a/tests-m32/fchmodat.gen.test b/tests-m32/fchmodat.gen.test index 9ee1f013..36461858 100755 --- a/tests-m32/fchmodat.gen.test +++ b/tests-m32/fchmodat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchmodat ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchmodat ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/fchown.gen.test b/tests-m32/fchown.gen.test index 63ee5454..ec7f7c54 100755 --- a/tests-m32/fchown.gen.test +++ b/tests-m32/fchown.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchown -a16); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchown -a16 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a16 +run_strace_match_diff -a16 diff --git a/tests-m32/fchown32.gen.test b/tests-m32/fchown32.gen.test index d8167dd4..16705832 100755 --- a/tests-m32/fchown32.gen.test +++ b/tests-m32/fchown32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchown32 -a18); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchown32 -a18 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a18 +run_strace_match_diff -a18 diff --git a/tests-m32/fchownat.gen.test b/tests-m32/fchownat.gen.test index 2ec9e32c..54bd0430 100755 --- a/tests-m32/fchownat.gen.test +++ b/tests-m32/fchownat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchownat ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchownat ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/fcntl.gen.test b/tests-m32/fcntl.gen.test index 83a1af48..9de26c00 100755 --- a/tests-m32/fcntl.gen.test +++ b/tests-m32/fcntl.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fcntl -a8); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fcntl -a8 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a8 +run_strace_match_diff -a8 diff --git a/tests-m32/fcntl64.gen.test b/tests-m32/fcntl64.gen.test index 9d3b98ad..fee01b66 100755 --- a/tests-m32/fcntl64.gen.test +++ b/tests-m32/fcntl64.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fcntl64 -a8); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fcntl64 -a8 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a8 +run_strace_match_diff -a8 diff --git a/tests-m32/fdatasync.gen.test b/tests-m32/fdatasync.gen.test index 0dbea8ad..9aa5f2a6 100755 --- a/tests-m32/fdatasync.gen.test +++ b/tests-m32/fdatasync.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fdatasync -a14); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fdatasync -a14 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a14 +run_strace_match_diff -a14 diff --git a/tests-m32/file_ioctl.gen.test b/tests-m32/file_ioctl.gen.test index f7e58f59..0abab81a 100755 --- a/tests-m32/file_ioctl.gen.test +++ b/tests-m32/file_ioctl.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (file_ioctl +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (file_ioctl +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/m4/st_bpf.m4 b/tests-m32/filtering_fd-syntax.test index ae44d287..4f4e9c73 100644..100755 --- a/m4/st_bpf.m4 +++ b/tests-m32/filtering_fd-syntax.test @@ -1,6 +1,9 @@ -#!/usr/bin/m4 +#!/bin/sh # -# Copyright (c) 2015-2017 Dmitry V. Levin <ldv@altlinux.org> +# Check descriptor set parsing syntax. +# +# Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> +# Copyright (c) 2016-2018 The strace developers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -25,26 +28,33 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -AC_DEFUN([st_CHECK_UNION_BPF_ATTR],[ +. "${srcdir=.}/syntax.sh" -pushdef([ATTR_NAME], translit([$1], [a-z], [A-Z])) -pushdef([attr_text], [union bpf_attr.][$1]) -pushdef([have_attr], [st_cv_member_union_bpf_attr_][$1]) +check_fd_qualify() +{ + check_e "invalid descriptor '$1'" -e"read=$2" + check_e "invalid descriptor '$1'" -e "read=$2" + check_e "invalid descriptor '$1'" -e"write=$2" + check_e "invalid descriptor '$1'" -e "write=$2" +} -AC_CACHE_CHECK([whether attr_text initialization works], - [have_attr], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#include <linux/bpf.h>]], - [union bpf_attr a = { .$1 = 0 };])], - [have_attr=yes], - [have_attr=no])]) +for arg in '' , ,, ,,, ; do + check_fd_qualify "$arg" "$arg" + check_fd_qualify "!$arg" "!$arg" +done -if test $have_attr = yes; then - AC_DEFINE([HAVE_UNION_BPF_ATTR_]ATTR_NAME, [1], - [Define to 1 if attr_text initialization works]) -fi +for arg in -1 -42 \ + not_fd \ + 2147483648 \ + 4294967296 \ + ; do + check_fd_qualify "$arg" "$arg" + check_fd_qualify "$arg" "1,$arg" + check_fd_qualify "$arg" "$arg,1" + check_fd_qualify "$arg" "!$arg" +done -popdef([have_attr]) -popdef([attr_text]) -popdef([ATTR_NAME]) -]) +for arg in ! all none; do + check_fd_qualify "$arg" "1,$arg" + check_fd_qualify "!$arg" "1,!$arg" +done diff --git a/tests-m32/filtering_syscall-syntax.test b/tests-m32/filtering_syscall-syntax.test new file mode 100755 index 00000000..8fda8dc2 --- /dev/null +++ b/tests-m32/filtering_syscall-syntax.test @@ -0,0 +1,121 @@ +#!/bin/sh +# +# Check syscall set parsing syntax. +# +# Copyright (c) 2016-2018 Dmitry V. Levin <ldv@altlinux.org> +# Copyright (c) 2017 Nikolay Marchuk <marchuk.nikolay.a@gmail.com> +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +. "${srcdir=.}/syntax.sh" + +check_syscall() +{ + [ -z "$2" ] || check_e "invalid system call '$1'" -e"$2" + + check_e "invalid system call '$1'" -e "$2" + check_e "invalid system call '$1'" -etrace="$2" + check_e "invalid system call '$1'" -e trace="$2" + + check_e "invalid system call '$1'" -eabbrev="$2" + check_e "invalid system call '$1'" -e abbrev="$2" + + check_e "invalid system call '$1'" -everbose="$2" + check_e "invalid system call '$1'" -e verbose="$2" + + check_e "invalid system call '$1'" -eraw="$2" + check_e "invalid system call '$1'" -e raw="$2" + + check_e "invalid system call '$1'" -einject="$2" + check_e "invalid system call '$1'" -e inject="$2" + check_e "invalid system call '$1'" -einject="$2:" + check_e "invalid system call '$1'" -einject="$2::" + check_e "invalid system call '$1'" -einject="$2:::" + check_e "invalid system call '$1'" -e inject="$2:" + check_e "invalid system call '$1'" -e inject="$2::" + check_e "invalid system call '$1'" -e inject="$2:::" + check_e "invalid system call '$1'" -einject="$2:when=3" + check_e "invalid system call '$1'" -e inject="$2:when=3" + + check_e "invalid system call '$1'" -efault="$2" + check_e "invalid system call '$1'" -e fault="$2" + check_e "invalid system call '$1'" -efault="$2:" + check_e "invalid system call '$1'" -efault="$2::" + check_e "invalid system call '$1'" -efault="$2:::" + check_e "invalid system call '$1'" -e fault="$2:" + check_e "invalid system call '$1'" -e fault="$2::" + check_e "invalid system call '$1'" -e fault="$2:::" + check_e "invalid system call '$1'" -efault="$2:when=4" + check_e "invalid system call '$1'" -e fault="$2:when=4" +} + +for arg in '' , ,, ,,, ; do + check_syscall "$arg" "$arg" + check_syscall "!$arg" "!$arg" +done + +for arg in -1 -2 -3 -4 -5 \ + invalid_syscall_name \ + 0x 0y \ + 32767 \ + 2147483647 \ + 2147483648 \ + 4294967295 \ + 4294967296 \ + /non_syscall \ + % %not_a_class \ + ; do + check_syscall "$arg" "$arg" + check_syscall "$arg" "!$arg" + check_syscall "$arg" "1,$arg" +done + +for arg in '!chdir' none all; do + check_syscall "$arg" "1,$arg" +done + +# invalid syscall, multiple syscalls +for arg in %desc \ + %file \ + %memory \ + %process \ + %network \ + chdir \ + 1 \ + ?32767 \ + ?invalid \ + ?%not_a_class \ + ?/non_syscall \ + ; do + check_syscall nonsense "$arg,nonsense" + check_syscall nonsense "!$arg,nonsense" + check_syscall nonsense "nonsense,$arg" + check_syscall nonsense "!nonsense,$arg" +done + +check_e_using_grep 'regcomp: \+id: [[:alpha:]].+' -e trace='/+id' +check_e_using_grep 'regcomp: \*id: [[:alpha:]].+' -e trace='/*id' +check_e_using_grep 'regcomp: \{id: [[:alpha:]].+' -e trace='/{id' +check_e_using_grep 'regcomp: \(id: [[:alpha:]].+' -e trace='/(id' +check_e_using_grep 'regcomp: \[id: [[:alpha:]].+' -e trace='/[id' diff --git a/tests-m32/finit_module.gen.test b/tests-m32/finit_module.gen.test index f2e56afc..5ffafd32 100755 --- a/tests-m32/finit_module.gen.test +++ b/tests-m32/finit_module.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (finit_module -a25); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (finit_module -a25 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a25 +run_strace_match_diff -a25 diff --git a/tests-m32/flock.gen.test b/tests-m32/flock.gen.test index dff2bac4..67a9d8c6 100755 --- a/tests-m32/flock.gen.test +++ b/tests-m32/flock.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (flock -a19); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (flock -a19 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a19 +run_strace_match_diff -a19 diff --git a/tests-m32/fstatfs.gen.test b/tests-m32/fstatfs.gen.test index 3dd04d8b..27deaf34 100755 --- a/tests-m32/fstatfs.gen.test +++ b/tests-m32/fstatfs.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fstatfs -a18); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fstatfs -a18 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a18 +run_strace_match_diff -a18 diff --git a/tests-m32/fstatfs64.gen.test b/tests-m32/fstatfs64.gen.test index b9527beb..d6937269 100755 --- a/tests-m32/fstatfs64.gen.test +++ b/tests-m32/fstatfs64.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fstatfs64 -a24); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fstatfs64 -a24 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a24 +run_strace_match_diff -a24 diff --git a/tests-m32/fsync.gen.test b/tests-m32/fsync.gen.test index 921e804c..5e72cc25 100755 --- a/tests-m32/fsync.gen.test +++ b/tests-m32/fsync.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fsync -a10); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fsync -a10 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a10 +run_strace_match_diff -a10 diff --git a/tests-m32/ftruncate.gen.test b/tests-m32/ftruncate.gen.test index 709a8511..6e5926b2 100755 --- a/tests-m32/ftruncate.gen.test +++ b/tests-m32/ftruncate.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ftruncate -a24); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ftruncate -a24 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a24 +run_strace_match_diff -a24 diff --git a/tests-m32/ftruncate64.gen.test b/tests-m32/ftruncate64.gen.test index 4cb1fe7a..d910f617 100755 --- a/tests-m32/ftruncate64.gen.test +++ b/tests-m32/ftruncate64.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ftruncate64 -a36); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ftruncate64 -a36 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a36 +run_strace_match_diff -a36 diff --git a/tests-m32/futex.c b/tests-m32/futex.c index e1dbcb74..0c095b8f 100644 --- a/tests-m32/futex.c +++ b/tests-m32/futex.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -57,10 +57,11 @@ # include "xlat/futexwakecmps.h" void futex_error(int *uaddr, int op, unsigned long val, unsigned long timeout, - int *uaddr2, unsigned long val3, int rc) + int *uaddr2, unsigned long val3, int rc, const char *func, int line) { - perror_msg_and_fail("futex(%p, %#x, %#x, %#lx, %p, %#x) = %d", - uaddr, op, (unsigned) val, timeout, uaddr, (unsigned) val3, rc); + perror_msg_and_fail("%s:%d: futex(%p, %#x, %#x, %#lx, %p, %#x) = %d", + func, line, uaddr, op, (unsigned) val, timeout, uaddr, + (unsigned) val3, rc); } # define CHECK_FUTEX_GENERIC(uaddr, op, val, timeout, uaddr2, val3, check, \ @@ -77,7 +78,7 @@ void futex_error(int *uaddr, int op, unsigned long val, unsigned long timeout, if (!(check)) \ futex_error((uaddr), (op), (val), \ (unsigned long) (timeout), (int *) (uaddr2), \ - (val3), rc); \ + (val3), rc, __func__, __LINE__); \ } while (0) # define CHECK_FUTEX_ENOSYS(uaddr, op, val, timeout, uaddr2, val3, check) \ @@ -151,14 +152,20 @@ void invalid_op(int *val, int op, uint32_t argmask, ...) } while (0) /* Value which differs from one stored in int *val */ -# define VAL ((unsigned long) 0xbadda7a0facefeedLLU) -# define VAL_PR ((unsigned) VAL) +# define VAL ((unsigned long) 0xbadda7a0facefeedLLU) +# define VAL_PR ((unsigned) VAL) -# define VAL2 ((unsigned long) 0xbadda7a0ca7b100dLLU) -# define VAL2_PR ((unsigned) VAL2) +# define VALP ((unsigned long) 0xbadda7a01acefeedLLU) +# define VALP_PR ((unsigned) VALP) -# define VAL3 ((unsigned long) 0xbadda7a09caffee1LLU) -# define VAL3_PR ((unsigned) VAL3) +# define VAL2 ((unsigned long) 0xbadda7a0ca7b100dLLU) +# define VAL2_PR ((unsigned) VAL2) + +# define VAL2P ((unsigned long) 0xbadda7a07a7b100dLLU) +# define VAL2P_PR ((unsigned) VAL2P) + +# define VAL3 ((unsigned long) 0xbadda7a09caffee1LLU) +# define VAL3_PR ((unsigned) VAL3) int main(int argc, char *argv[]) @@ -418,16 +425,26 @@ main(int argc, char *argv[]) /* Trying to re-queue some processes but there's nothing to re-queue */ CHECK_FUTEX(uaddr, FUTEX_REQUEUE, VAL, VAL2, uaddr2, VAL3, - (rc == 0)); + (rc == 0) || ((rc == -1) && (errno == EINVAL))); printf("futex(%p, FUTEX_REQUEUE, %u, %u, %p) = %s\n", uaddr, VAL_PR, VAL2_PR, uaddr2, sprintrc(rc)); + CHECK_FUTEX(uaddr, FUTEX_REQUEUE, VALP, VAL2P, uaddr2, VAL3, + (rc == 0)); + printf("futex(%p, FUTEX_REQUEUE, %u, %u, %p) = %s\n", + uaddr, VALP_PR, VAL2P_PR, uaddr2, sprintrc(rc)); + /* Trying to re-queue some processes but there's nothing to re-queue */ CHECK_FUTEX_ENOSYS(uaddr, FUTEX_PRIVATE_FLAG | FUTEX_REQUEUE, VAL, VAL2, - uaddr2, VAL3, (rc == 0)); + uaddr2, VAL3, (rc == 0) || ((rc == -1) && (errno == EINVAL))); printf("futex(%p, FUTEX_REQUEUE_PRIVATE, %u, %u, %p) = %s\n", uaddr, VAL_PR, VAL2_PR, uaddr2, sprintrc(rc)); + CHECK_FUTEX_ENOSYS(uaddr, FUTEX_PRIVATE_FLAG | FUTEX_REQUEUE, VALP, + VAL2P, uaddr2, VAL3, (rc == 0)); + printf("futex(%p, FUTEX_REQUEUE_PRIVATE, %u, %u, %p) = %s\n", + uaddr, VALP_PR, VAL2P_PR, uaddr2, sprintrc(rc)); + CHECK_INVALID_CLOCKRT(FUTEX_REQUEUE, ARG3 | ARG4 | ARG5, "%u", "%u", "%#lx"); @@ -444,22 +461,38 @@ main(int argc, char *argv[]) /* Comparison re-queue with wrong val value */ CHECK_FUTEX(uaddr, FUTEX_CMP_REQUEUE, VAL, VAL2, uaddr2, VAL3, - (rc == -1) && (errno == EAGAIN)); + (rc == -1) && (errno == EAGAIN || errno == EINVAL)); printf("futex(%p, FUTEX_CMP_REQUEUE, %u, %u, %p, %u) = %s\n", uaddr, VAL_PR, VAL2_PR, uaddr2, VAL3_PR, sprintrc(rc)); + CHECK_FUTEX(uaddr, FUTEX_CMP_REQUEUE, VALP, VAL2P, uaddr2, VAL3, + (rc == -1) && (errno == EAGAIN)); + printf("futex(%p, FUTEX_CMP_REQUEUE, %u, %u, %p, %u) = %s\n", + uaddr, VALP_PR, VAL2P_PR, uaddr2, VAL3_PR, sprintrc(rc)); + /* Successful comparison re-queue */ CHECK_FUTEX(uaddr, FUTEX_CMP_REQUEUE, VAL, VAL2, uaddr2, *uaddr, - (rc == 0)); + (rc == 0) || ((rc == -1) && (errno == EINVAL))); printf("futex(%p, FUTEX_CMP_REQUEUE, %u, %u, %p, %u) = %s\n", uaddr, VAL_PR, VAL2_PR, uaddr2, *uaddr, sprintrc(rc)); + CHECK_FUTEX(uaddr, FUTEX_CMP_REQUEUE, VALP, VAL2P, uaddr2, *uaddr, + (rc == 0)); + printf("futex(%p, FUTEX_CMP_REQUEUE, %u, %u, %p, %u) = %s\n", + uaddr, VALP_PR, VAL2P_PR, uaddr2, *uaddr, sprintrc(rc)); + /* Successful comparison re-queue */ CHECK_FUTEX_ENOSYS(uaddr, FUTEX_PRIVATE_FLAG | FUTEX_CMP_REQUEUE, VAL, - VAL2, uaddr2, *uaddr, (rc == 0)); + VAL2, uaddr2, *uaddr, + (rc == 0) || ((rc == -1) && (errno == EINVAL))); printf("futex(%p, FUTEX_CMP_REQUEUE_PRIVATE, %u, %u, %p, %u) = %s\n", uaddr, VAL_PR, VAL2_PR, uaddr2, *uaddr, sprintrc(rc)); + CHECK_FUTEX_ENOSYS(uaddr, FUTEX_PRIVATE_FLAG | FUTEX_CMP_REQUEUE, VALP, + VAL2P, uaddr2, *uaddr, (rc == 0)); + printf("futex(%p, FUTEX_CMP_REQUEUE_PRIVATE, %u, %u, %p, %u) = %s\n", + uaddr, VALP_PR, VAL2P_PR, uaddr2, *uaddr, sprintrc(rc)); + CHECK_INVALID_CLOCKRT(FUTEX_CMP_REQUEUE, ARG3 | ARG4 | ARG5 | ARG6, "%u", "%u", "%#lx", "%u"); diff --git a/tests-m32/futimesat.gen.test b/tests-m32/futimesat.gen.test index c3add8c3..80d7a8bc 100755 --- a/tests-m32/futimesat.gen.test +++ b/tests-m32/futimesat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (futimesat -a28); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (futimesat -a28 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a28 +run_strace_match_diff -a28 diff --git a/tests-m32/gen_tests.am b/tests-m32/gen_tests.am index 71e00135..29d8c643 100644 --- a/tests-m32/gen_tests.am +++ b/tests-m32/gen_tests.am @@ -1,9 +1,12 @@ # Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in; do not edit. -GEN_TESTS = _newselect.gen.test accept.gen.test accept4.gen.test access.gen.test acct.gen.test add_key.gen.test adjtimex.gen.test aio.gen.test alarm.gen.test bpf.gen.test bpf-v.gen.test btrfs.gen.test chmod.gen.test chown.gen.test chown32.gen.test chroot.gen.test clock.gen.test clock_adjtime.gen.test clock_nanosleep.gen.test clock_xettime.gen.test copy_file_range.gen.test creat.gen.test delete_module.gen.test dup.gen.test dup2.gen.test dup3.gen.test epoll_create.gen.test epoll_create1.gen.test epoll_ctl.gen.test epoll_pwait.gen.test epoll_wait.gen.test erestartsys.gen.test execveat.gen.test execveat-v.gen.test faccessat.gen.test fadvise64_64.gen.test fallocate.gen.test fanotify_init.gen.test fanotify_mark.gen.test fchdir.gen.test fchmod.gen.test fchmodat.gen.test fchown.gen.test fchown32.gen.test fchownat.gen.test fcntl.gen.test fcntl64.gen.test fdatasync.gen.test file_handle.gen.test file_ioctl.gen.test finit_module.gen.test flock.gen.test fork-f.gen.test fstat.gen.test fstat64.gen.test fstatat64.gen.test fstatfs.gen.test fstatfs64.gen.test fsync.gen.test ftruncate.gen.test ftruncate64.gen.test futimesat.gen.test get_mempolicy.gen.test getcpu.gen.test getcwd.gen.test getdents.gen.test getdents64.gen.test getegid.gen.test getegid32.gen.test geteuid.gen.test geteuid32.gen.test getgid.gen.test getgid32.gen.test getgroups.gen.test getgroups32.gen.test getpeername.gen.test getpgrp.gen.test getpid.gen.test getppid.gen.test getrandom.gen.test getresgid.gen.test getresgid32.gen.test getresuid.gen.test getresuid32.gen.test getrlimit.gen.test getrusage.gen.test getsid.gen.test getsockname.gen.test gettid.gen.test getuid32.gen.test getxxid.gen.test group_req.gen.test inet-cmsg.gen.test init_module.gen.test inotify.gen.test inotify_init1.gen.test int_0x80.gen.test ioctl_block.gen.test ioctl_evdev.gen.test ioctl_evdev-v.gen.test ioctl_loop.gen.test ioctl_loop-v.gen.test ioctl_mtd.gen.test ioctl_rtc.gen.test ioctl_rtc-v.gen.test ioctl_scsi.gen.test ioctl_sg_io_v3.gen.test ioctl_sg_io_v4.gen.test ioctl_uffdio.gen.test ioctl_v4l2.gen.test ioperm.gen.test iopl.gen.test ioprio.gen.test ip_mreq.gen.test ipc.gen.test ipc_msg.gen.test ipc_sem.gen.test ipc_shm.gen.test kcmp.gen.test kcmp-y.gen.test kexec_file_load.gen.test kexec_load.gen.test keyctl.gen.test kill.gen.test lchown.gen.test lchown32.gen.test link.gen.test linkat.gen.test lookup_dcookie.gen.test lstat.gen.test lstat64.gen.test madvise.gen.test mbind.gen.test membarrier.gen.test memfd_create.gen.test migrate_pages.gen.test mincore.gen.test mkdir.gen.test mkdirat.gen.test mknod.gen.test mknodat.gen.test mlock.gen.test mlock2.gen.test mlockall.gen.test mmap64.gen.test mmsg.gen.test mmsg-silent.gen.test mmsg_name.gen.test mmsg_name-v.gen.test mount.gen.test move_pages.gen.test mq.gen.test mq_sendrecv.gen.test mq_sendrecv-read.gen.test mq_sendrecv-write.gen.test msg_control.gen.test msg_control-v.gen.test msg_name.gen.test munlockall.gen.test nanosleep.gen.test net-icmp_filter.gen.test net-sockaddr.gen.test netlink_audit.gen.test netlink_crypto.gen.test netlink_generic.gen.test netlink_kobject_uevent.gen.test netlink_netfilter.gen.test netlink_protocol.gen.test netlink_route.gen.test netlink_selinux.gen.test netlink_xfrm.gen.test newfstatat.gen.test nlattr.gen.test nfnetlink_acct.gen.test nfnetlink_cthelper.gen.test nfnetlink_ctnetlink.gen.test nfnetlink_ctnetlink_exp.gen.test nfnetlink_cttimeout.gen.test nfnetlink_ipset.gen.test nfnetlink_nft_compat.gen.test nfnetlink_nftables.gen.test nfnetlink_osf.gen.test nfnetlink_queue.gen.test nfnetlink_ulog.gen.test nlattr_crypto_user_alg.gen.test nlattr_br_port_msg.gen.test nlattr_dcbmsg.gen.test nlattr_fib_rule_hdr.gen.test nlattr_ifaddrlblmsg.gen.test nlattr_ifaddrmsg.gen.test nlattr_ifinfomsg.gen.test nlattr_ifla_brport.gen.test nlattr_ifla_port.gen.test nlattr_ifla_xdp.gen.test nlattr_inet_diag_msg.gen.test nlattr_inet_diag_req_compat.gen.test nlattr_inet_diag_req_v2.gen.test nlattr_mdba_mdb_entry.gen.test nlattr_mdba_router_port.gen.test nlattr_ndmsg.gen.test nlattr_ndtmsg.gen.test nlattr_netconfmsg.gen.test nlattr_netlink_diag_msg.gen.test nlattr_nlmsgerr.gen.test nlattr_packet_diag_msg.gen.test nlattr_rtgenmsg.gen.test nlattr_rtmsg.gen.test nlattr_smc_diag_msg.gen.test nlattr_tc_stats.gen.test nlattr_tca_stab.gen.test nlattr_tcamsg.gen.test nlattr_tcmsg.gen.test nlattr_unix_diag_msg.gen.test old_mmap.gen.test oldfstat.gen.test oldlstat.gen.test oldstat.gen.test open.gen.test openat.gen.test osf_utimes.gen.test pause.gen.test perf_event_open.gen.test perf_event_open_nonverbose.gen.test perf_event_open_unabbrev.gen.test pipe2.gen.test pkey_alloc.gen.test pkey_free.gen.test pkey_mprotect.gen.test ppoll.gen.test ppoll-v.gen.test pread64-pwrite64.gen.test preadv.gen.test preadv-pwritev.gen.test preadv2-pwritev2.gen.test printstr.gen.test printpath-umovestr.gen.test printpath-umovestr-peekdata.gen.test printpath-umovestr-undumpable.gen.test printstrn-umoven.gen.test printstrn-umoven-peekdata.gen.test printstrn-umoven-undumpable.gen.test prlimit64.gen.test process_vm_readv.gen.test process_vm_writev.gen.test pselect6.gen.test ptrace.gen.test pwritev.gen.test quotactl.gen.test quotactl-v.gen.test quotactl-xfs.gen.test quotactl-xfs-v.gen.test read-write.gen.test readahead.gen.test readdir.gen.test readlink.gen.test readlinkat.gen.test reboot.gen.test recvfrom.gen.test recvmmsg-timeout.gen.test recvmsg.gen.test regex.gen.test remap_file_pages.gen.test rename.gen.test renameat.gen.test renameat2.gen.test request_key.gen.test rmdir.gen.test rt_sigpending.gen.test rt_sigprocmask.gen.test rt_sigqueueinfo.gen.test rt_sigreturn.gen.test rt_sigsuspend.gen.test rt_sigtimedwait.gen.test rt_tgsigqueueinfo.gen.test sched.gen.test sched_get_priority_mxx.gen.test sched_rr_get_interval.gen.test sched_xetaffinity.gen.test sched_xetattr.gen.test sched_xetparam.gen.test sched_xetscheduler.gen.test sched_yield.gen.test seccomp-filter.gen.test seccomp-filter-v.gen.test seccomp_get_action_avail.gen.test select.gen.test semop.gen.test sendfile.gen.test sendfile64.gen.test set_mempolicy.gen.test setdomainname.gen.test setfsgid.gen.test setfsgid32.gen.test setfsuid.gen.test setfsuid32.gen.test setgid.gen.test setgid32.gen.test setgroups.gen.test setgroups32.gen.test sethostname.gen.test setns.gen.test setregid.gen.test setregid32.gen.test setresgid.gen.test setresgid32.gen.test setresuid.gen.test setresuid32.gen.test setreuid.gen.test setreuid32.gen.test setrlimit.gen.test setuid.gen.test setuid32.gen.test shmxt.gen.test shutdown.gen.test sigaction.gen.test siginfo.gen.test signal.gen.test signal_receive.gen.test signalfd4.gen.test sigpending.gen.test sigprocmask.gen.test sigreturn.gen.test sigsuspend.gen.test so_linger.gen.test so_peercred.gen.test sock_filter-v.gen.test socketcall.gen.test splice.gen.test stat.gen.test stat64.gen.test statfs.gen.test statfs64.gen.test statx.gen.test swap.gen.test sxetmask.gen.test symlink.gen.test symlinkat.gen.test sync.gen.test sync_file_range.gen.test sync_file_range2.gen.test sysinfo.gen.test syslog.gen.test tee.gen.test time.gen.test timer_create.gen.test timer_xettime.gen.test timerfd_xettime.gen.test times.gen.test times-fail.gen.test trace_fstat.gen.test trace_fstatfs.gen.test trace_lstat.gen.test trace_question.gen.test trace_stat.gen.test trace_stat_like.gen.test trace_statfs.gen.test trace_statfs_like.gen.test truncate.gen.test truncate64.gen.test ugetrlimit.gen.test umask.gen.test umoven-illptr.gen.test umovestr-illptr.gen.test umovestr3.gen.test unlink.gen.test unlinkat.gen.test unshare.gen.test userfaultfd.gen.test ustat.gen.test utime.gen.test utimensat.gen.test utimes.gen.test vfork-f.gen.test vhangup.gen.test vmsplice.gen.test wait4.gen.test wait4-v.gen.test waitid.gen.test waitid-v.gen.test waitpid.gen.test xattr.gen.test xattr-strings.gen.test xet_robust_list.gen.test xetitimer.gen.test xetpgid.gen.test xetpriority.gen.test xettimeofday.gen.test +GEN_TESTS = _newselect.gen.test _newselect-P.gen.test accept.gen.test accept4.gen.test access.gen.test acct.gen.test add_key.gen.test adjtimex.gen.test aio.gen.test alarm.gen.test bpf.gen.test bpf-v.gen.test btrfs.gen.test chmod.gen.test chown.gen.test chown32.gen.test chroot.gen.test clock.gen.test clock_adjtime.gen.test clock_nanosleep.gen.test clock_xettime.gen.test copy_file_range.gen.test creat.gen.test delete_module.gen.test dup.gen.test dup2.gen.test dup3.gen.test epoll_create.gen.test epoll_create1.gen.test epoll_ctl.gen.test epoll_pwait.gen.test epoll_wait.gen.test erestartsys.gen.test execveat.gen.test execveat-v.gen.test faccessat.gen.test fadvise64_64.gen.test fallocate.gen.test fanotify_init.gen.test fanotify_mark.gen.test fchdir.gen.test fchmod.gen.test fchmodat.gen.test fchown.gen.test fchown32.gen.test fchownat.gen.test fcntl.gen.test fcntl64.gen.test fdatasync.gen.test file_handle.gen.test file_ioctl.gen.test finit_module.gen.test flock.gen.test fork-f.gen.test fstat.gen.test fstat64.gen.test fstatat64.gen.test fstatfs.gen.test fstatfs64.gen.test fsync.gen.test ftruncate.gen.test ftruncate64.gen.test futimesat.gen.test get_mempolicy.gen.test getcpu.gen.test getcwd.gen.test getdents.gen.test getdents64.gen.test getegid.gen.test getegid32.gen.test geteuid.gen.test geteuid32.gen.test getgid.gen.test getgid32.gen.test getgroups.gen.test getgroups32.gen.test getpeername.gen.test getpgrp.gen.test getpid.gen.test getppid.gen.test getrandom.gen.test getresgid.gen.test getresgid32.gen.test getresuid.gen.test getresuid32.gen.test getrlimit.gen.test getrusage.gen.test getsid.gen.test getsockname.gen.test gettid.gen.test getuid32.gen.test getxxid.gen.test group_req.gen.test inet-cmsg.gen.test init_module.gen.test inotify.gen.test inotify_init1.gen.test int_0x80.gen.test ioctl_block.gen.test ioctl_dm.gen.test ioctl_dm-v.gen.test ioctl_evdev.gen.test ioctl_evdev-v.gen.test ioctl_kvm_run.gen.test ioctl_loop.gen.test ioctl_loop-nv.gen.test ioctl_loop-v.gen.test ioctl_mtd.gen.test ioctl_nsfs.gen.test ioctl_rtc.gen.test ioctl_rtc-v.gen.test ioctl_scsi.gen.test ioctl_sg_io_v3.gen.test ioctl_sg_io_v4.gen.test ioctl_sock_gifconf.gen.test ioctl_uffdio.gen.test ioctl_v4l2.gen.test ioperm.gen.test iopl.gen.test ioprio.gen.test ip_mreq.gen.test ipc.gen.test ipc_msg.gen.test ipc_sem.gen.test ipc_shm.gen.test kcmp.gen.test kcmp-y.gen.test kexec_file_load.gen.test kexec_load.gen.test keyctl.gen.test kill.gen.test lchown.gen.test lchown32.gen.test link.gen.test linkat.gen.test lookup_dcookie.gen.test lstat.gen.test lstat64.gen.test madvise.gen.test mbind.gen.test membarrier.gen.test memfd_create.gen.test migrate_pages.gen.test mincore.gen.test mkdir.gen.test mkdirat.gen.test mknod.gen.test mknodat.gen.test mlock.gen.test mlock2.gen.test mlockall.gen.test mmap64.gen.test mmsg.gen.test mmsg-silent.gen.test mmsg_name.gen.test mmsg_name-v.gen.test modify_ldt.gen.test mount.gen.test move_pages.gen.test mq.gen.test mq_sendrecv.gen.test mq_sendrecv-read.gen.test mq_sendrecv-write.gen.test msg_control.gen.test msg_control-v.gen.test msg_name.gen.test munlockall.gen.test nanosleep.gen.test net-icmp_filter.gen.test net-sockaddr.gen.test netlink_audit.gen.test netlink_crypto.gen.test netlink_generic.gen.test netlink_kobject_uevent.gen.test netlink_netfilter.gen.test netlink_protocol.gen.test netlink_route.gen.test netlink_selinux.gen.test netlink_xfrm.gen.test newfstatat.gen.test nlattr.gen.test nfnetlink_acct.gen.test nfnetlink_cthelper.gen.test nfnetlink_ctnetlink.gen.test nfnetlink_ctnetlink_exp.gen.test nfnetlink_cttimeout.gen.test nfnetlink_ipset.gen.test nfnetlink_nft_compat.gen.test nfnetlink_nftables.gen.test nfnetlink_osf.gen.test nfnetlink_queue.gen.test nfnetlink_ulog.gen.test nlattr_crypto_user_alg.gen.test nlattr_br_port_msg.gen.test nlattr_dcbmsg.gen.test nlattr_fib_rule_hdr.gen.test nlattr_ifaddrlblmsg.gen.test nlattr_ifaddrmsg.gen.test nlattr_ifinfomsg.gen.test nlattr_ifla_brport.gen.test nlattr_ifla_port.gen.test nlattr_ifla_xdp.gen.test nlattr_inet_diag_msg.gen.test nlattr_inet_diag_req_compat.gen.test nlattr_inet_diag_req_v2.gen.test nlattr_mdba_mdb_entry.gen.test nlattr_mdba_router_port.gen.test nlattr_ndmsg.gen.test nlattr_ndtmsg.gen.test nlattr_netconfmsg.gen.test nlattr_netlink_diag_msg.gen.test nlattr_nlmsgerr.gen.test nlattr_packet_diag_msg.gen.test nlattr_rtgenmsg.gen.test nlattr_rtmsg.gen.test nlattr_smc_diag_msg.gen.test nlattr_tc_stats.gen.test nlattr_tca_stab.gen.test nlattr_tcamsg.gen.test nlattr_tcmsg.gen.test nlattr_unix_diag_msg.gen.test old_mmap.gen.test old_mmap-P.gen.test old_mmap-v-none.gen.test oldfstat.gen.test oldlstat.gen.test oldselect.gen.test oldselect-P.gen.test oldselect-efault.gen.test oldselect-efault-P.gen.test oldstat.gen.test open.gen.test openat.gen.test osf_utimes.gen.test pause.gen.test perf_event_open.gen.test perf_event_open_nonverbose.gen.test perf_event_open_unabbrev.gen.test pipe2.gen.test pkey_alloc.gen.test pkey_free.gen.test pkey_mprotect.gen.test ppoll.gen.test ppoll-P.gen.test ppoll-v.gen.test pread64-pwrite64.gen.test preadv.gen.test preadv-pwritev.gen.test preadv2-pwritev2.gen.test printstr.gen.test printpath-umovestr.gen.test printpath-umovestr-peekdata.gen.test printpath-umovestr-undumpable.gen.test printstrn-umoven.gen.test printstrn-umoven-peekdata.gen.test printstrn-umoven-undumpable.gen.test prlimit64.gen.test process_vm_readv.gen.test process_vm_writev.gen.test pselect6.gen.test ptrace.gen.test pwritev.gen.test quotactl.gen.test quotactl-v.gen.test quotactl-xfs.gen.test quotactl-xfs-v.gen.test read-write.gen.test readahead.gen.test readdir.gen.test readlink.gen.test readlinkat.gen.test reboot.gen.test recvfrom.gen.test recvmmsg-timeout.gen.test recvmsg.gen.test regex.gen.test remap_file_pages.gen.test rename.gen.test renameat.gen.test renameat2.gen.test request_key.gen.test riscv_flush_icache.gen.test rmdir.gen.test rt_sigpending.gen.test rt_sigprocmask.gen.test rt_sigqueueinfo.gen.test rt_sigreturn.gen.test rt_sigsuspend.gen.test rt_sigtimedwait.gen.test rt_tgsigqueueinfo.gen.test s390_guarded_storage.gen.test s390_guarded_storage-v.gen.test s390_pci_mmio_read_write.gen.test s390_runtime_instr.gen.test s390_sthyi.gen.test s390_sthyi-v.gen.test sched.gen.test sched_get_priority_mxx.gen.test sched_rr_get_interval.gen.test sched_xetaffinity.gen.test sched_xetattr.gen.test sched_xetparam.gen.test sched_xetscheduler.gen.test sched_yield.gen.test seccomp-filter.gen.test seccomp-filter-v.gen.test seccomp_get_action_avail.gen.test select.gen.test select-P.gen.test semop.gen.test sendfile.gen.test sendfile64.gen.test set_mempolicy.gen.test setdomainname.gen.test setfsgid.gen.test setfsgid32.gen.test setfsuid.gen.test setfsuid32.gen.test setgid.gen.test setgid32.gen.test setgroups.gen.test setgroups32.gen.test sethostname.gen.test setns.gen.test setregid.gen.test setregid32.gen.test setresgid.gen.test setresgid32.gen.test setresuid.gen.test setresuid32.gen.test setreuid.gen.test setreuid32.gen.test setrlimit.gen.test setuid.gen.test setuid32.gen.test shmxt.gen.test shutdown.gen.test sigaction.gen.test siginfo.gen.test signal.gen.test signal_receive.gen.test signalfd4.gen.test sigpending.gen.test sigprocmask.gen.test sigreturn.gen.test sigsuspend.gen.test so_linger.gen.test so_peercred.gen.test sock_filter-v.gen.test socketcall.gen.test sockopt-sol_netlink.gen.test splice.gen.test stat.gen.test stat64.gen.test statfs.gen.test statfs64.gen.test statx.gen.test swap.gen.test sxetmask.gen.test symlink.gen.test symlinkat.gen.test sync.gen.test sync_file_range.gen.test sync_file_range2.gen.test sysinfo.gen.test syslog.gen.test tee.gen.test time.gen.test timer_create.gen.test timer_xettime.gen.test timerfd_xettime.gen.test times.gen.test times-fail.gen.test trace_fstat.gen.test trace_fstatfs.gen.test trace_lstat.gen.test trace_question.gen.test trace_stat.gen.test trace_stat_like.gen.test trace_statfs.gen.test trace_statfs_like.gen.test truncate.gen.test truncate64.gen.test ugetrlimit.gen.test umask.gen.test umoven-illptr.gen.test umovestr-illptr.gen.test umovestr3.gen.test unlink.gen.test unlinkat.gen.test unshare.gen.test userfaultfd.gen.test ustat.gen.test utime.gen.test utimensat.gen.test utimes.gen.test vfork-f.gen.test vhangup.gen.test vmsplice.gen.test wait4.gen.test wait4-v.gen.test waitid.gen.test waitid-v.gen.test waitpid.gen.test xattr.gen.test xattr-strings.gen.test xet_robust_list.gen.test xetitimer.gen.test xetpgid.gen.test xetpriority.gen.test xettimeofday.gen.test $(srcdir)/_newselect.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/_newselect-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/accept.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -295,21 +298,36 @@ $(srcdir)/int_0x80.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(srcdir)/ioctl_block.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_dm.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/ioctl_dm-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_evdev.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ $(srcdir)/ioctl_evdev-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_kvm_run.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_loop.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_loop-nv.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_loop-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ $(srcdir)/ioctl_mtd.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_nsfs.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_rtc.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -325,6 +343,9 @@ $(srcdir)/ioctl_sg_io_v3.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_test $(srcdir)/ioctl_sg_io_v4.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_sock_gifconf.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_uffdio.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -448,6 +469,9 @@ $(srcdir)/mmsg_name.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(srcdir)/mmsg_name-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/modify_ldt.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/mount.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -643,12 +667,30 @@ $(srcdir)/nlattr_unix_diag_msg.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/ge $(srcdir)/old_mmap.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/old_mmap-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/old_mmap-v-none.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/oldfstat.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ $(srcdir)/oldlstat.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/oldselect.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/oldselect-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/oldselect-efault.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/oldselect-efault-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/oldstat.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -688,6 +730,9 @@ $(srcdir)/pkey_mprotect.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests $(srcdir)/ppoll.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ppoll-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ppoll-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -799,6 +844,9 @@ $(srcdir)/renameat2.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(srcdir)/request_key.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/riscv_flush_icache.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/rmdir.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -823,6 +871,24 @@ $(srcdir)/rt_sigtimedwait.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tes $(srcdir)/rt_tgsigqueueinfo.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/s390_guarded_storage.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_guarded_storage-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_pci_mmio_read_write.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_runtime_instr.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_sthyi.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_sthyi-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/sched.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -859,6 +925,9 @@ $(srcdir)/seccomp_get_action_avail.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir $(srcdir)/select.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/select-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/semop.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -982,6 +1051,9 @@ $(srcdir)/sock_filter-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests $(srcdir)/socketcall.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/sockopt-sol_netlink.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/splice.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ diff --git a/tests-m32/gen_tests.in b/tests-m32/gen_tests.in index 091bbe59..ea33892f 100644 --- a/tests-m32/gen_tests.in +++ b/tests-m32/gen_tests.in @@ -1,6 +1,6 @@ # Input for gen_tests.sh # -# Copyright (c) 2017 The strace developers. +# Copyright (c) 2017-2018 The strace developers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -26,6 +26,7 @@ # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. _newselect +_newselect-P -e trace=_newselect -P /dev/full 9>>/dev/full accept -a22 accept4 -a37 access -a30 -P access_sample @@ -123,16 +124,22 @@ inotify -a23 -e trace=inotify_add_watch,inotify_rm_watch inotify_init1 -a27 int_0x80 -a11 -e trace=getgid32 ioctl_block +ioctl.test +ioctl_dm +ioctl.test -s9 +ioctl_dm-v +ioctl.test -v -s9 ioctl_evdev +ioctl.test -ioctl_evdev-v +ioctl-v.sh +ioctl_evdev-v +ioctl.test -v +ioctl_kvm_run +ioctl.test -a36 -y ioctl_loop +ioctl.test -ioctl_loop-v +ioctl-v.sh +ioctl_loop-nv +ioctl.test -a22 -e verbose=none +ioctl_loop-v +ioctl.test -v ioctl_mtd +ioctl.test +ioctl_nsfs +ioctl.test -esignal=none ioctl_rtc +ioctl.test -ioctl_rtc-v +ioctl-v.sh +ioctl_rtc-v +ioctl.test -v ioctl_scsi +ioctl.test ioctl_sg_io_v3 +ioctl.test ioctl_sg_io_v4 +ioctl.test +ioctl_sock_gifconf +ioctl.test -a28 -s1 ioctl_uffdio +ioctl.test ioctl_v4l2 +ioctl.test ioperm -a27 @@ -174,6 +181,7 @@ mmsg -e read=0 -e write=1 -e trace=recvmmsg,sendmmsg mmsg-silent -a25 -e verbose=none -e trace=sendmmsg,recvmmsg mmsg_name -a25 -e trace=sendmmsg,recvmmsg mmsg_name-v -v -a25 -e trace=sendmmsg,recvmmsg +modify_ldt -a23 mount move_pages -s3 mq -a32 -e trace=mq_getsetattr,mq_open,mq_unlink @@ -239,11 +247,17 @@ nlattr_tcamsg +netlink_sock_diag.test nlattr_tcmsg +netlink_sock_diag.test nlattr_unix_diag_msg +netlink_sock_diag.test old_mmap -a11 -e trace=mmap +old_mmap-P -e trace=mmap -P "/dev/full" 9>>/dev/full +old_mmap-v-none -a11 -e trace=mmap -e verbose=none oldfstat -a18 -v -P stat.sample oldlstat -a32 -v -P stat.sample -P /dev/full +oldselect -a13 -e trace=select +oldselect-P -a13 -e trace=select -P /dev/full 9>>/dev/full +oldselect-efault -a13 -e trace=select +oldselect-efault-P -a13 -e trace=select -P /dev/full 9>>/dev/full oldstat -a32 -v -P stat.sample -P /dev/full open -a30 -P $NAME.sample -openat -P $NAME.sample +openat -a36 -P $NAME.sample osf_utimes -a21 pause -a8 -esignal=none perf_event_open -a1 @@ -254,6 +268,7 @@ pkey_alloc -a17 pkey_free -a13 pkey_mprotect -a37 ppoll -s2 +ppoll-P -s2 -e trace=ppoll -P /dev/full 9>>/dev/full ppoll-v -v -s2 -e trace=ppoll pread64-pwrite64 -a21 -eread=0 -ewrite=1 -e trace=pread64,pwrite64 -P pread64-pwrite64-tmpfile -P /dev/zero -P /dev/null preadv -a21 @@ -281,7 +296,7 @@ readahead -a1 readdir -a16 readlink -xx readlinkat -xx -reboot +reboot -s 256 recvfrom -a35 recvmmsg-timeout -a25 -e trace=recvmmsg recvmsg -eread=0 -ewrite=1 -e trace=recvmsg,sendmsg @@ -291,6 +306,7 @@ rename -a35 renameat renameat2 request_key -a33 -s12 +riscv_flush_icache -a34 rmdir -a22 rt_sigpending -a20 rt_sigprocmask @@ -299,6 +315,12 @@ rt_sigreturn -esignal='!USR1' rt_sigsuspend -a20 -esignal=none rt_sigtimedwait -a38 rt_tgsigqueueinfo -esignal=none +s390_guarded_storage -a32 +s390_guarded_storage-v -e trace=s390_guarded_storage -a32 -v +s390_pci_mmio_read_write -e trace=s390_pci_mmio_read,s390_pci_mmio_write -a30 +s390_runtime_instr -a50 +s390_sthyi -a47 +s390_sthyi-v -e trace=s390_sthyi -a47 -v sched test_trace_expr times -e/sched sched_get_priority_mxx -a33 -e trace=sched_get_priority_min,sched_get_priority_max sched_rr_get_interval -a31 @@ -311,6 +333,7 @@ seccomp-filter -e trace=seccomp seccomp-filter-v -v -e trace=seccomp seccomp_get_action_avail -e trace=seccomp select -a36 +select-P -a36 -e trace=select -P /dev/full 9>>/dev/full semop -a32 -e trace=semop,semtimedop sendfile -a27 sendfile64 -a29 @@ -352,6 +375,7 @@ so_linger -e trace=getsockopt,setsockopt so_peercred -e trace=getsockopt sock_filter-v -v -e trace=getsockopt,setsockopt socketcall -a20 +sockopt-sol_netlink -e trace=getsockopt,setsockopt splice stat -a32 -v -P stat.sample -P /dev/full stat64 -a32 -v -P stat.sample -P /dev/full diff --git a/tests-m32/gen_tests.sh b/tests-m32/gen_tests.sh index b0624365..b41983ee 100755 --- a/tests-m32/gen_tests.sh +++ b/tests-m32/gen_tests.sh @@ -1,6 +1,7 @@ #!/bin/sh -efu # # Copyright (c) 2017 Dmitry V. Levin <ldv@altlinux.org> +# Copyright (c) 2017-2018 The strace developers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -54,7 +55,7 @@ fi names= -while read -r name args; do { +while read -r name arg0 args; do { [ -n "${name###*}" ] || continue if [ -z "$match" ]; then names="$names $name" @@ -65,13 +66,14 @@ while read -r name args; do { hdr="\ #!/bin/sh -efu -# Generated by $0 from $input ($name $args); do not edit." +# Generated by $0 from $input ($name $arg0 $args); do not edit." - case "$args" in + case "$arg0" in +*) cat <<-EOF $hdr - . "\${srcdir=.}/${args#+}" + set -- $args + . "\${srcdir=.}/${arg0#+}" EOF ;; @@ -79,7 +81,7 @@ while read -r name args; do { cat <<-EOF $hdr . "\${srcdir=.}/init.sh" - run_strace_match_diff $args + run_strace_match_diff $arg0 $args EOF ;; @@ -87,7 +89,7 @@ while read -r name args; do { cat <<-EOF $hdr . "\${srcdir=.}/init.sh" - $args + $arg0 $args EOF ;; esac > "$output" diff --git a/tests-m32/get_regs.test b/tests-m32/get_regs.test index c673fe95..eb69137b 100755 --- a/tests-m32/get_regs.test +++ b/tests-m32/get_regs.test @@ -36,7 +36,7 @@ run_prog ../gettid > /dev/null run_strace -qq -esignal=none -eraw=all -etrace=none ../gettid > /dev/null run_strace -qq -esignal=none -eraw=all -eptrace -o '|grep -c ^ptrace > less' \ - -- ${STRACE##* } -o "$LOG" $args > /dev/null + -- "$STRACE_EXE" -o "$LOG" $args > /dev/null [ "$(cat less)" -gt 0 ] || fail_ "$STRACE $args failed to catch any ptrace syscalls" @@ -44,7 +44,7 @@ run_strace -qq -esignal=none -eraw=all -eptrace -o '|grep -c ^ptrace > less' \ run_strace -qq -esignal=none -eraw=all -etrace=all ../gettid > /dev/null run_strace -qq -esignal=none -eraw=all -eptrace -o '|grep -c ^ptrace > more' \ - -- ${STRACE##* } -o "$LOG" $args > /dev/null + -- "$STRACE_EXE" -o "$LOG" $args > /dev/null [ "$(cat more)" -gt 0 ] || fail_ "$STRACE $args failed to catch any ptrace syscalls" diff --git a/tests-m32/getcpu.gen.test b/tests-m32/getcpu.gen.test index 44d9a4b8..ae38aaa0 100755 --- a/tests-m32/getcpu.gen.test +++ b/tests-m32/getcpu.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getcpu -a25); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getcpu -a25 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a25 +run_strace_match_diff -a25 diff --git a/tests-m32/getcwd.c b/tests-m32/getcwd.c index 0c32f8dd..2020df40 100644 --- a/tests-m32/getcwd.c +++ b/tests-m32/getcwd.c @@ -4,9 +4,9 @@ #ifdef __NR_getcwd +# include <limits.h> # include <stdio.h> # include <unistd.h> -# include <sys/param.h> int main(void) diff --git a/tests-m32/getcwd.gen.test b/tests-m32/getcwd.gen.test index af2ff083..f783a5b1 100755 --- a/tests-m32/getcwd.gen.test +++ b/tests-m32/getcwd.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getcwd -a18); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getcwd -a18 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a18 +run_strace_match_diff -a18 diff --git a/tests-m32/getegid.gen.test b/tests-m32/getegid.gen.test index d6fecc23..ddf8fa9a 100755 --- a/tests-m32/getegid.gen.test +++ b/tests-m32/getegid.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getegid +getuid.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getegid +getuid.test ); do not edit. +set -- . "${srcdir=.}/getuid.test" diff --git a/tests-m32/getegid32.gen.test b/tests-m32/getegid32.gen.test index 38c4a4b2..a773f56a 100755 --- a/tests-m32/getegid32.gen.test +++ b/tests-m32/getegid32.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getegid32 +getuid.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getegid32 +getuid.test ); do not edit. +set -- . "${srcdir=.}/getuid.test" diff --git a/tests-m32/geteuid.gen.test b/tests-m32/geteuid.gen.test index 9e8c12f8..c7da2aa9 100755 --- a/tests-m32/geteuid.gen.test +++ b/tests-m32/geteuid.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (geteuid +getuid.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (geteuid +getuid.test ); do not edit. +set -- . "${srcdir=.}/getuid.test" diff --git a/tests-m32/geteuid32.gen.test b/tests-m32/geteuid32.gen.test index 5b783311..75c3f12e 100755 --- a/tests-m32/geteuid32.gen.test +++ b/tests-m32/geteuid32.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (geteuid32 +getuid.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (geteuid32 +getuid.test ); do not edit. +set -- . "${srcdir=.}/getuid.test" diff --git a/tests-m32/getgid.gen.test b/tests-m32/getgid.gen.test index 5a87aeeb..fc6ac3bc 100755 --- a/tests-m32/getgid.gen.test +++ b/tests-m32/getgid.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getgid +getuid.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getgid +getuid.test ); do not edit. +set -- . "${srcdir=.}/getuid.test" diff --git a/tests-m32/getgid32.gen.test b/tests-m32/getgid32.gen.test index 05e2d70c..b3a87561 100755 --- a/tests-m32/getgid32.gen.test +++ b/tests-m32/getgid32.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getgid32 +getuid.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getgid32 +getuid.test ); do not edit. +set -- . "${srcdir=.}/getuid.test" diff --git a/tests-m32/getgroups.gen.test b/tests-m32/getgroups.gen.test index 48b09be9..ae196d05 100755 --- a/tests-m32/getgroups.gen.test +++ b/tests-m32/getgroups.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getgroups -a17); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getgroups -a17 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a17 +run_strace_match_diff -a17 diff --git a/tests-m32/getgroups32.gen.test b/tests-m32/getgroups32.gen.test index 74637d0e..54b71d5f 100755 --- a/tests-m32/getgroups32.gen.test +++ b/tests-m32/getgroups32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getgroups32 -a19); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getgroups32 -a19 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a19 +run_strace_match_diff -a19 diff --git a/tests-m32/getpeername.gen.test b/tests-m32/getpeername.gen.test index 66fb0a92..020583ab 100755 --- a/tests-m32/getpeername.gen.test +++ b/tests-m32/getpeername.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getpeername -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getpeername -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests-m32/getpgrp.gen.test b/tests-m32/getpgrp.gen.test index 1ec48e9c..26989cdb 100755 --- a/tests-m32/getpgrp.gen.test +++ b/tests-m32/getpgrp.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getpgrp -a10); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getpgrp -a10 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a10 +run_strace_match_diff -a10 diff --git a/tests-m32/getpid.gen.test b/tests-m32/getpid.gen.test index 46917749..2a3eb1cf 100755 --- a/tests-m32/getpid.gen.test +++ b/tests-m32/getpid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getpid -a9); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getpid -a9 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a9 +run_strace_match_diff -a9 diff --git a/tests-m32/getppid.gen.test b/tests-m32/getppid.gen.test index 52116a0a..655b0b7d 100755 --- a/tests-m32/getppid.gen.test +++ b/tests-m32/getppid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getppid -a10); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getppid -a10 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a10 +run_strace_match_diff -a10 diff --git a/tests-m32/getresgid.gen.test b/tests-m32/getresgid.gen.test index f53bccce..dc32c62c 100755 --- a/tests-m32/getresgid.gen.test +++ b/tests-m32/getresgid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getresgid -a25); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getresgid -a25 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a25 +run_strace_match_diff -a25 diff --git a/tests-m32/getresgid32.gen.test b/tests-m32/getresgid32.gen.test index 5f00506f..0ee28299 100755 --- a/tests-m32/getresgid32.gen.test +++ b/tests-m32/getresgid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getresgid32 -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getresgid32 -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests-m32/getresuid.gen.test b/tests-m32/getresuid.gen.test index e947a94e..b0f478ce 100755 --- a/tests-m32/getresuid.gen.test +++ b/tests-m32/getresuid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getresuid -a25); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getresuid -a25 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a25 +run_strace_match_diff -a25 diff --git a/tests-m32/getresuid32.gen.test b/tests-m32/getresuid32.gen.test index b088a220..1b2f232c 100755 --- a/tests-m32/getresuid32.gen.test +++ b/tests-m32/getresuid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getresuid32 -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getresuid32 -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests-m32/getrlimit.gen.test b/tests-m32/getrlimit.gen.test index b97c176b..08daf2d0 100755 --- a/tests-m32/getrlimit.gen.test +++ b/tests-m32/getrlimit.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getrlimit -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getrlimit -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests-m32/getrusage.gen.test b/tests-m32/getrusage.gen.test index c4fb182b..161818aa 100755 --- a/tests-m32/getrusage.gen.test +++ b/tests-m32/getrusage.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getrusage -v); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getrusage -v ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -v +run_strace_match_diff -v diff --git a/tests-m32/getsid.gen.test b/tests-m32/getsid.gen.test index 123f1775..2b9084a4 100755 --- a/tests-m32/getsid.gen.test +++ b/tests-m32/getsid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getsid -a10); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getsid -a10 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a10 +run_strace_match_diff -a10 diff --git a/tests-m32/getsockname.gen.test b/tests-m32/getsockname.gen.test index cd40d3ef..64cdeea8 100755 --- a/tests-m32/getsockname.gen.test +++ b/tests-m32/getsockname.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getsockname -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getsockname -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests-m32/gettid.gen.test b/tests-m32/gettid.gen.test index 1ceaa53d..f5ad317e 100755 --- a/tests-m32/gettid.gen.test +++ b/tests-m32/gettid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (gettid -a9); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (gettid -a9 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a9 +run_strace_match_diff -a9 diff --git a/tests-m32/getuid32.gen.test b/tests-m32/getuid32.gen.test index ac0d0ad6..e81eb064 100755 --- a/tests-m32/getuid32.gen.test +++ b/tests-m32/getuid32.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getuid32 +getuid.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getuid32 +getuid.test ); do not edit. +set -- . "${srcdir=.}/getuid.test" diff --git a/tests-m32/group_req.c b/tests-m32/group_req.c index 946fe5c0..eb56cb7e 100644 --- a/tests-m32/group_req.c +++ b/tests-m32/group_req.c @@ -2,6 +2,7 @@ * Check decoding of MCAST_JOIN_GROUP/MCAST_LEAVE_GROUP. * * Copyright (c) 2015-2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2017-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,9 +34,9 @@ #if defined MCAST_JOIN_GROUP && defined MCAST_LEAVE_GROUP +# include <limits.h> # include <stdio.h> # include <unistd.h> -# include <sys/param.h> # include <sys/socket.h> # include <arpa/inet.h> diff --git a/tests-m32/init_module.gen.test b/tests-m32/init_module.gen.test index 8948e2ec..b6961be6 100755 --- a/tests-m32/init_module.gen.test +++ b/tests-m32/init_module.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (init_module -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (init_module -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests-m32/inode_of_sockfd.c b/tests-m32/inode_of_sockfd.c index b227f306..6a523c79 100644 --- a/tests-m32/inode_of_sockfd.c +++ b/tests-m32/inode_of_sockfd.c @@ -2,6 +2,7 @@ * This file is part of strace test suite. * * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,11 +30,11 @@ #include "tests.h" #include <assert.h> +#include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <sys/param.h> unsigned long inode_of_sockfd(const int fd) diff --git a/tests-m32/inotify_init1.gen.test b/tests-m32/inotify_init1.gen.test index d847b500..a1060c5d 100755 --- a/tests-m32/inotify_init1.gen.test +++ b/tests-m32/inotify_init1.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (inotify_init1 -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (inotify_init1 -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests-m32/ioctl-v.sh b/tests-m32/ioctl-v.sh deleted file mode 100755 index be896712..00000000 --- a/tests-m32/ioctl-v.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# Check non-abbreviated decoding of ioctls. - -. "${srcdir=.}/init.sh" - -check_prog grep -run_prog > /dev/null -run_strace -a16 -v -eioctl $args > "$EXP" -grep -v '^ioctl([012],' < "$LOG" > "$OUT" -match_diff "$OUT" "$EXP" diff --git a/tests-m32/ioctl.c b/tests-m32/ioctl.c index 3c666b0d..af5f9ba2 100644 --- a/tests-m32/ioctl.c +++ b/tests-m32/ioctl.c @@ -86,8 +86,13 @@ main(void) " = -1 EBADF (%m)\n", &data); (void) ioctl(-1, _IOR('M', 13, int), &data); +# ifdef HAVE_STRUCT_MTD_WRITE_REQ printf("ioctl(-1, MIXER_READ(13) or OTPSELECT, [MTD_OTP_OFF])" " = -1 EBADF (%m)\n"); +# else + printf("ioctl(-1, MIXER_READ(13) or OTPSELECT, %p)" + " = -1 EBADF (%m)\n", &data); +# endif (void) ioctl(-1, _IOC(_IOC_WRITE, 0xde, 0, 0), (kernel_ulong_t) -1ULL); printf("ioctl(-1, _IOC(_IOC_WRITE, 0xde, 0, 0), %#lx)" diff --git a/tests-m32/ioctl.test b/tests-m32/ioctl.test index 1eb469ee..cbbadc83 100755 --- a/tests-m32/ioctl.test +++ b/tests-m32/ioctl.test @@ -6,6 +6,6 @@ check_prog grep run_prog > /dev/null -run_strace -a16 -eioctl $args > "$EXP" +run_strace -a16 -eioctl "$@" $args > "$EXP" grep -v '^ioctl([012],' < "$LOG" > "$OUT" match_diff "$OUT" "$EXP" diff --git a/tests-m32/ioctl_block.gen.test b/tests-m32/ioctl_block.gen.test index 0ffec6f6..8b2c3df6 100755 --- a/tests-m32/ioctl_block.gen.test +++ b/tests-m32/ioctl_block.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_block +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_block +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests-m32/ioctl_dm-v.gen.test b/tests-m32/ioctl_dm-v.gen.test new file mode 100755 index 00000000..66fa5856 --- /dev/null +++ b/tests-m32/ioctl_dm-v.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_dm-v +ioctl.test -v -s9); do not edit. +set -- -v -s9 +. "${srcdir=.}/ioctl.test" diff --git a/tests-m32/ioctl_dm-v.test b/tests-m32/ioctl_dm-v.test deleted file mode 100755 index eed37c27..00000000 --- a/tests-m32/ioctl_dm-v.test +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# Check unabbreviated decoding of DM* ioctls. - -. "${srcdir=.}/init.sh" - -check_prog grep -run_prog > /dev/null -run_strace -a16 -s9 -veioctl $args > "$EXP" -grep -v '^ioctl([012],' < "$LOG" > "$OUT" -match_diff "$OUT" "$EXP" diff --git a/tests-m32/ioctl_dm.c b/tests-m32/ioctl_dm.c index 1e831dfe..bbdc00c6 100644 --- a/tests-m32/ioctl_dm.c +++ b/tests-m32/ioctl_dm.c @@ -3,7 +3,7 @@ * * Copyright (c) 2016 Mikulas Patocka <mpatocka@redhat.com> * Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -143,7 +143,7 @@ init_dm_target_spec(struct dm_target_spec *ptr, uint32_t id) ptr->length = dts_length_base + dts_length_step * id; ptr->status = dts_status_base + dts_status_step * id; - strncpy(ptr->target_type, str129 + + memcpy(ptr->target_type, str129 + id % (sizeof(str129) - sizeof(ptr->target_type)), id % (sizeof(ptr->target_type) + 1)); if (id % (sizeof(ptr->target_type) + 1) < sizeof(ptr->target_type)) @@ -252,8 +252,8 @@ main(void) /* Unterminated name/uuid */ init_s(dm_arg, min_sizeof_dm_ioctl, 0); - strncpy(dm_arg->name, str129, sizeof(dm_arg->name)); - strncpy(dm_arg->uuid, str129, sizeof(dm_arg->uuid)); + memcpy(dm_arg->name, str129, sizeof(dm_arg->name)); + memcpy(dm_arg->uuid, str129, sizeof(dm_arg->uuid)); ioctl(-1, DM_VERSION, dm_arg); printf("ioctl(-1, DM_VERSION, {version=4.1.2, data_size=%zu, " "dev=makedev(18, 52), name=\"%.127s\"..., uuid=\"%.128s\"..., " @@ -511,7 +511,7 @@ main(void) target##id_next) - \ offsetof(struct dm_table_open_test, \ target##id); \ - strncpy(dm_arg_open3->param##id, str129 + id * 2, id); \ + memcpy(dm_arg_open3->param##id, str129 + id * 2, id); \ dm_arg_open3->param##id[id] = '\0'; \ } while (0) #define PRINT_DM_TARGET(id) \ diff --git a/tests-m32/ioctl_dm.gen.test b/tests-m32/ioctl_dm.gen.test new file mode 100755 index 00000000..b60c7175 --- /dev/null +++ b/tests-m32/ioctl_dm.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_dm +ioctl.test -s9); do not edit. +set -- -s9 +. "${srcdir=.}/ioctl.test" diff --git a/tests-m32/ioctl_dm.test b/tests-m32/ioctl_dm.test deleted file mode 100755 index e9cca03b..00000000 --- a/tests-m32/ioctl_dm.test +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# Check decoding of DM* ioctls. - -. "${srcdir=.}/init.sh" - -check_prog grep -run_prog > /dev/null -run_strace -a16 -s9 -eioctl $args > "$EXP" -grep -v '^ioctl([012],' < "$LOG" > "$OUT" -match_diff "$OUT" "$EXP" diff --git a/tests-m32/ioctl_evdev-v.gen.test b/tests-m32/ioctl_evdev-v.gen.test index fc7e2f0b..bf74ef4c 100755 --- a/tests-m32/ioctl_evdev-v.gen.test +++ b/tests-m32/ioctl_evdev-v.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_evdev-v +ioctl-v.sh); do not edit. -. "${srcdir=.}/ioctl-v.sh" +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_evdev-v +ioctl.test -v); do not edit. +set -- -v +. "${srcdir=.}/ioctl.test" diff --git a/tests-m32/ioctl_evdev.gen.test b/tests-m32/ioctl_evdev.gen.test index 26f0a288..68a43f7c 100755 --- a/tests-m32/ioctl_evdev.gen.test +++ b/tests-m32/ioctl_evdev.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_evdev +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_evdev +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests-m32/ioctl_kvm_run.c b/tests-m32/ioctl_kvm_run.c new file mode 100644 index 00000000..17946143 --- /dev/null +++ b/tests-m32/ioctl_kvm_run.c @@ -0,0 +1,242 @@ +/* + * Check decoding of KVM_* commands of ioctl syscall using /dev/kvm API. + * Based on kvmtest.c from https://lwn.net/Articles/658512/ + * + * kvmtest.c author: Josh Triplett <josh@joshtriplett.org> + * Copyright (c) 2015 Intel Corporation + * Copyright (c) 2017-2018 The strace developers. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "tests.h" + +#if defined HAVE_LINUX_KVM_H \ + && defined HAVE_STRUCT_KVM_REGS \ + && defined HAVE_STRUCT_KVM_SREGS \ + && defined HAVE_STRUCT_KVM_USERSPACE_MEMORY_REGION \ + &&(defined __x86_64__ || defined __i386__) + +# include <fcntl.h> +# include <stdint.h> +# include <stdio.h> +# include <stdlib.h> +# include <string.h> +# include <sys/ioctl.h> +# include <sys/mman.h> +# include <linux/kvm.h> + +static int +kvm_ioctl(int fd, unsigned long cmd, const char *cmd_str, void *arg) +{ + int rc = ioctl(fd, cmd, arg); + if (rc < 0) + perror_msg_and_skip("%s", cmd_str); + return rc; +} + +#define KVM_IOCTL(fd_, cmd_, arg_) \ + kvm_ioctl((fd_), (cmd_), #cmd_, (arg_)) + +static const char dev[] = "/dev/kvm"; +static const char vm_dev[] = "anon_inode:kvm-vm"; +static const char vcpu_dev[] = "anon_inode:kvm-vcpu"; +static size_t page_size; + +extern const char code[]; +extern const unsigned short code_size; + +__asm__( + ".type code, @object \n" + "code: \n" + " mov $0xd80003f8, %edx \n" + " mov $'\n', %al \n" + " out %al, (%dx) \n" + " hlt \n" + ".size code, . - code \n" + ".type code_size, @object \n" + "code_size: \n" + " .short . - code \n" + ".size code_size, . - code_size \n" + ); + + +static void +run_kvm(const int vcpu_fd, struct kvm_run *const run, const size_t mmap_size, + void *const mem) +{ + /* Initialize CS to point at 0, via a read-modify-write of sregs. */ + struct kvm_sregs sregs; + KVM_IOCTL(vcpu_fd, KVM_GET_SREGS, &sregs); + printf("ioctl(%d<%s>, KVM_GET_SREGS, {cs={base=%#jx, limit=%u, selector=%u" + ", type=%u, present=%u, dpl=%u, db=%u, s=%u, l=%u, g=%u, avl=%u}" + ", ...}) = 0\n", vcpu_fd, vcpu_dev, (uintmax_t) sregs.cs.base, + sregs.cs.limit, sregs.cs.selector, sregs.cs.type, + sregs.cs.present, sregs.cs.dpl, sregs.cs.db, sregs.cs.s, + sregs.cs.l, sregs.cs.g, sregs.cs.avl); + + sregs.cs.base = 0; + sregs.cs.selector = 0; + KVM_IOCTL(vcpu_fd, KVM_SET_SREGS, &sregs); + printf("ioctl(%d<%s>, KVM_SET_SREGS, {cs={base=%#jx, limit=%u" + ", selector=%u, type=%u, present=%u, dpl=%u, db=%u, s=%u" + ", l=%u, g=%u, avl=%u}, ...}) = 0\n", + vcpu_fd, vcpu_dev, (uintmax_t) sregs.cs.base, + sregs.cs.limit, sregs.cs.selector, sregs.cs.type, + sregs.cs.present, sregs.cs.dpl, sregs.cs.db, sregs.cs.s, + sregs.cs.l, sregs.cs.g, sregs.cs.avl); + + /* + * Initialize registers: instruction pointer for our code, addends, + * and initial flags required by x86 architecture. + */ + struct kvm_regs regs = { + .rip = page_size, + .rax = 2, + .rbx = 2, + .rflags = 0x2, + }; + KVM_IOCTL(vcpu_fd, KVM_SET_REGS, ®s); + printf("ioctl(%d<%s>, KVM_SET_REGS, {rax=%#jx, ..." + ", rsp=%#jx, rbp=%#jx, ..., rip=%#jx, rflags=%#jx}) = 0\n", + vcpu_fd, vcpu_dev, (uintmax_t) regs.rax, + (uintmax_t) regs.rsp, (uintmax_t) regs.rbp, + (uintmax_t) regs.rip, (uintmax_t) regs.rflags); + + /* Copy the code */ + memcpy(mem, code, code_size); + + const char *p = "\n"; + + /* Repeatedly run code and handle VM exits. */ + for (;;) { + KVM_IOCTL(vcpu_fd, KVM_RUN, NULL); + printf("ioctl(%d<%s>, KVM_RUN, 0) = 0\n", vcpu_fd, vcpu_dev); + + switch (run->exit_reason) { + case KVM_EXIT_HLT: + if (p) + error_msg_and_fail("premature KVM_EXIT_HLT"); + return; + case KVM_EXIT_IO: + if (run->io.direction == KVM_EXIT_IO_OUT + && run->io.size == 1 + && run->io.port == 0x03f8 + && run->io.count == 1 + && run->io.data_offset < mmap_size + && p && *p == ((char *) run)[run->io.data_offset]) + p = NULL; + else + error_msg_and_fail("unhandled KVM_EXIT_IO"); + break; + case KVM_EXIT_MMIO: + error_msg_and_fail("Got an unexpected MMIO exit:" + " phys_addr %#llx," + " data %02x %02x %02x %02x" + " %02x %02x %02x %02x," + " len %u, is_write %hhu", + (unsigned long long) run->mmio.phys_addr, + run->mmio.data[0], run->mmio.data[1], + run->mmio.data[2], run->mmio.data[3], + run->mmio.data[4], run->mmio.data[5], + run->mmio.data[6], run->mmio.data[7], + run->mmio.len, run->mmio.is_write); + + default: + error_msg_and_fail("exit_reason = %#x", + run->exit_reason); + } + } +} + +int +main(void) +{ + skip_if_unavailable("/proc/self/fd/"); + + int kvm = open(dev, O_RDWR); + if (kvm < 0) + perror_msg_and_skip("open: %s", dev); + + /* Make sure we have the stable version of the API */ + int ret = KVM_IOCTL(kvm, KVM_GET_API_VERSION, 0); + if (ret != KVM_API_VERSION) + error_msg_and_skip("KVM_GET_API_VERSION returned %d" + ", KVM_API_VERSION is %d", + kvm, KVM_API_VERSION); + printf("ioctl(%d<%s>, KVM_GET_API_VERSION, 0) = %d\n", + kvm, dev, ret); + + int vm_fd = KVM_IOCTL(kvm, KVM_CREATE_VM, 0); + printf("ioctl(%d<%s>, KVM_CREATE_VM, 0) = %d<%s>\n", + kvm, dev, vm_fd, vm_dev); + + /* Allocate one aligned page of guest memory to hold the code. */ + page_size = get_page_size(); + void *const mem = mmap(NULL, page_size, PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_ANONYMOUS, -1, 0); + if (mem == MAP_FAILED) + perror_msg_and_fail("mmap page"); + + /* Map it to the second page frame (to avoid the real-mode IDT at 0). */ + struct kvm_userspace_memory_region region = { + .slot = 0, + .guest_phys_addr = page_size, + .memory_size = page_size, + .userspace_addr = (uintptr_t) mem, + }; + KVM_IOCTL(vm_fd, KVM_SET_USER_MEMORY_REGION, ®ion); + printf("ioctl(%d<%s>, KVM_SET_USER_MEMORY_REGION" + ", {slot=0, flags=0, guest_phys_addr=%#lx, memory_size=%lu" + ", userspace_addr=%p}) = 0\n", vm_fd, vm_dev, + (unsigned long) page_size, (unsigned long) page_size, mem); + + int vcpu_fd = KVM_IOCTL(vm_fd, KVM_CREATE_VCPU, NULL); + printf("ioctl(%d<%s>, KVM_CREATE_VCPU, 0) = %d<%s>\n", + vm_fd, vm_dev, vcpu_fd, vcpu_dev); + + /* Map the shared kvm_run structure and following data. */ + ret = KVM_IOCTL(kvm, KVM_GET_VCPU_MMAP_SIZE, NULL); + struct kvm_run *run; + if (ret < (int) sizeof(*run)) + error_msg_and_fail("KVM_GET_VCPU_MMAP_SIZE returned %d < %d", + ret, (int) sizeof(*run)); + printf("ioctl(%d<%s>, KVM_GET_VCPU_MMAP_SIZE, 0) = %d\n", + kvm, dev, ret); + + const size_t mmap_size = (ret + page_size - 1) & -page_size; + run = mmap(NULL, mmap_size, PROT_READ | PROT_WRITE, + MAP_SHARED, vcpu_fd, 0); + if (run == MAP_FAILED) + perror_msg_and_fail("mmap vcpu"); + + run_kvm(vcpu_fd, run, mmap_size, mem); + + puts("+++ exited with 0 +++"); + return 0; +} + +#else /* !HAVE_LINUX_KVM_H */ + +SKIP_MAIN_UNDEFINED("HAVE_LINUX_KVM_H && HAVE_STRUCT_KVM_REGS && " + "HAVE_STRUCT_KVM_SREGS && " + "HAVE_STRUCT_KVM_USERSPACE_MEMORY_REGION && " + "(__x86_64__ || __i386__)") + +#endif diff --git a/tests-m32/ioctl_kvm_run.gen.test b/tests-m32/ioctl_kvm_run.gen.test new file mode 100755 index 00000000..7ab473ba --- /dev/null +++ b/tests-m32/ioctl_kvm_run.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_kvm_run +ioctl.test -a36 -y); do not edit. +set -- -a36 -y +. "${srcdir=.}/ioctl.test" diff --git a/tests-m32/ioctl_loop-nv.gen.test b/tests-m32/ioctl_loop-nv.gen.test new file mode 100755 index 00000000..d9da86a2 --- /dev/null +++ b/tests-m32/ioctl_loop-nv.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_loop-nv +ioctl.test -a22 -e verbose=none); do not edit. +set -- -a22 -e verbose=none +. "${srcdir=.}/ioctl.test" diff --git a/tests-m32/ioctl_loop-nv.test b/tests-m32/ioctl_loop-nv.test deleted file mode 100755 index 7d59cc2b..00000000 --- a/tests-m32/ioctl_loop-nv.test +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# Check non-verbose decoding of LOOP_* ioctls. - -. "${srcdir=.}/init.sh" - -check_prog grep -run_prog > /dev/null -run_strace -a22 -eioctl -e verbose=none $args > "$EXP" -grep -v '^ioctl([012],' < "$LOG" > "$OUT" -match_diff "$OUT" "$EXP" diff --git a/tests-m32/ioctl_loop-v.gen.test b/tests-m32/ioctl_loop-v.gen.test index 7fd9f661..b03bf784 100755 --- a/tests-m32/ioctl_loop-v.gen.test +++ b/tests-m32/ioctl_loop-v.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_loop-v +ioctl-v.sh); do not edit. -. "${srcdir=.}/ioctl-v.sh" +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_loop-v +ioctl.test -v); do not edit. +set -- -v +. "${srcdir=.}/ioctl.test" diff --git a/tests-m32/ioctl_loop.gen.test b/tests-m32/ioctl_loop.gen.test index f7aee8e5..d4ec35ac 100755 --- a/tests-m32/ioctl_loop.gen.test +++ b/tests-m32/ioctl_loop.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_loop +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_loop +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests-m32/ioctl_mtd.c b/tests-m32/ioctl_mtd.c index 6a7d94a7..1b5be755 100644 --- a/tests-m32/ioctl_mtd.c +++ b/tests-m32/ioctl_mtd.c @@ -30,22 +30,20 @@ #include "tests.h" -#include <errno.h> -#include <inttypes.h> -#include <stdio.h> -#include <string.h> -#include <sys/ioctl.h> -#include <linux/ioctl.h> -#include <linux/version.h> -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) -# include "mtd-abi.h" -#else +#ifdef HAVE_STRUCT_MTD_WRITE_REQ + +# include <errno.h> +# include <inttypes.h> +# include <stdio.h> +# include <string.h> +# include <sys/ioctl.h> +# include <linux/ioctl.h> +# include <linux/version.h> # include <mtd/mtd-abi.h> -#endif static const unsigned long lmagic = (unsigned long) 0xdeadbeefbadc0dedULL; -#define TEST_NULL_ARG(cmd) \ +# define TEST_NULL_ARG(cmd) \ do { \ ioctl(-1, cmd, 0); \ if (_IOC_DIR(cmd) == _IOC_WRITE) \ @@ -60,7 +58,7 @@ static const unsigned long lmagic = (unsigned long) 0xdeadbeefbadc0dedULL; printf("ioctl(-1, %s, NULL) = -1 EBADF (%m)\n", #cmd); \ } while (0) -#define TEST_erase_info_user(cmd, eiu) \ +# define TEST_erase_info_user(cmd, eiu) \ do { \ ioctl(-1, cmd, eiu); \ printf("ioctl(-1, MIXER_%s(%u) or %s, {start=%#x, length=%#x})" \ @@ -122,9 +120,9 @@ main(void) ioctl(-1, MEMGETREGIONINFO, riu); printf("ioctl(-1, %s, {regionindex=%#x}) = -1 EBADF (%m)\n", "MEMGETREGIONINFO" -#ifdef __i386__ +# ifdef __i386__ " or MTRRIOC_GET_PAGE_ENTRY" -#endif +# endif , riu->regionindex); TAIL_ALLOC_OBJECT_CONST_PTR(struct erase_info_user, eiu); @@ -198,3 +196,9 @@ main(void) puts("+++ exited with 0 +++"); return 0; } + +#else + +SKIP_MAIN_UNDEFINED("HAVE_STRUCT_MTD_WRITE_REQ") + +#endif diff --git a/tests-m32/ioctl_mtd.gen.test b/tests-m32/ioctl_mtd.gen.test index cbc31047..65b00037 100755 --- a/tests-m32/ioctl_mtd.gen.test +++ b/tests-m32/ioctl_mtd.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_mtd +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_mtd +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests-m32/ioctl_nsfs.gen.test b/tests-m32/ioctl_nsfs.gen.test new file mode 100755 index 00000000..f9adc5f0 --- /dev/null +++ b/tests-m32/ioctl_nsfs.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_nsfs +ioctl.test -esignal=none); do not edit. +set -- -esignal=none +. "${srcdir=.}/ioctl.test" diff --git a/tests-m32/ioctl_nsfs.test b/tests-m32/ioctl_nsfs.test deleted file mode 100755 index acdfb618..00000000 --- a/tests-m32/ioctl_nsfs.test +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# Check decoding of NS_* ioctls. - -. "${srcdir=.}/init.sh" - -check_prog grep -run_prog > /dev/null -run_strace -a16 -eioctl -esignal=none $args > "$EXP" -grep -v '^ioctl([012],' < "$LOG" > "$OUT" -match_diff "$OUT" "$EXP" diff --git a/tests-m32/ioctl_rtc-v.gen.test b/tests-m32/ioctl_rtc-v.gen.test index b534a025..820181b0 100755 --- a/tests-m32/ioctl_rtc-v.gen.test +++ b/tests-m32/ioctl_rtc-v.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_rtc-v +ioctl-v.sh); do not edit. -. "${srcdir=.}/ioctl-v.sh" +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_rtc-v +ioctl.test -v); do not edit. +set -- -v +. "${srcdir=.}/ioctl.test" diff --git a/tests-m32/ioctl_rtc.gen.test b/tests-m32/ioctl_rtc.gen.test index e430a82c..310b5588 100755 --- a/tests-m32/ioctl_rtc.gen.test +++ b/tests-m32/ioctl_rtc.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_rtc +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_rtc +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests-m32/ioctl_scsi.gen.test b/tests-m32/ioctl_scsi.gen.test index 23ac307b..499bfc49 100755 --- a/tests-m32/ioctl_scsi.gen.test +++ b/tests-m32/ioctl_scsi.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_scsi +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_scsi +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests-m32/ioctl_sg_io_v3.gen.test b/tests-m32/ioctl_sg_io_v3.gen.test index e7e5ea50..ef8fd14d 100755 --- a/tests-m32/ioctl_sg_io_v3.gen.test +++ b/tests-m32/ioctl_sg_io_v3.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_sg_io_v3 +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_sg_io_v3 +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests-m32/ioctl_sg_io_v4.gen.test b/tests-m32/ioctl_sg_io_v4.gen.test index 575ad96a..4aa4e4e9 100755 --- a/tests-m32/ioctl_sg_io_v4.gen.test +++ b/tests-m32/ioctl_sg_io_v4.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_sg_io_v4 +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_sg_io_v4 +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests-m32/ioctl_sock_gifconf.gen.test b/tests-m32/ioctl_sock_gifconf.gen.test new file mode 100755 index 00000000..5d6fe2f4 --- /dev/null +++ b/tests-m32/ioctl_sock_gifconf.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_sock_gifconf +ioctl.test -a28 -s1); do not edit. +set -- -a28 -s1 +. "${srcdir=.}/ioctl.test" diff --git a/tests-m32/ioctl_sock_gifconf.test b/tests-m32/ioctl_sock_gifconf.test deleted file mode 100755 index 22d7ea46..00000000 --- a/tests-m32/ioctl_sock_gifconf.test +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# Check decoding of SIOCGIFCONF ioctl. - -. "${srcdir=.}/init.sh" - -check_prog grep -run_prog > /dev/null -run_strace -a28 -s1 -eioctl $args > "$EXP" -grep -v '^ioctl([012],' < "$LOG" > "$OUT" -match_diff "$OUT" "$EXP" diff --git a/tests-m32/ioctl_uffdio.gen.test b/tests-m32/ioctl_uffdio.gen.test index 80fd2a64..ed73c5f0 100755 --- a/tests-m32/ioctl_uffdio.gen.test +++ b/tests-m32/ioctl_uffdio.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_uffdio +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_uffdio +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests-m32/ioctl_v4l2.gen.test b/tests-m32/ioctl_v4l2.gen.test index cbd36ba6..4c571447 100755 --- a/tests-m32/ioctl_v4l2.gen.test +++ b/tests-m32/ioctl_v4l2.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_v4l2 +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_v4l2 +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests-m32/ioperm.gen.test b/tests-m32/ioperm.gen.test index 154d60ae..bc69f69e 100755 --- a/tests-m32/ioperm.gen.test +++ b/tests-m32/ioperm.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioperm -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioperm -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests-m32/iopl.gen.test b/tests-m32/iopl.gen.test index 3d9704cb..f7769d23 100755 --- a/tests-m32/iopl.gen.test +++ b/tests-m32/iopl.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (iopl -a8); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (iopl -a8 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a8 +run_strace_match_diff -a8 diff --git a/tests-m32/ip_mreq.c b/tests-m32/ip_mreq.c index 3f4648ca..12cc2611 100644 --- a/tests-m32/ip_mreq.c +++ b/tests-m32/ip_mreq.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2015-2017 The strace developers. + * Copyright (c) 2015-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,9 +32,9 @@ #if defined IP_ADD_MEMBERSHIP && defined IPV6_ADD_MEMBERSHIP \ && defined IPV6_JOIN_ANYCAST +# include <limits.h> # include <stdio.h> # include <unistd.h> -# include <sys/param.h> # include <sys/socket.h> # include <arpa/inet.h> # include <net/if.h> diff --git a/tests-m32/ipc.gen.test b/tests-m32/ipc.gen.test index 5ed1f0d2..0aa75789 100755 --- a/tests-m32/ipc.gen.test +++ b/tests-m32/ipc.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ipc -a19); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ipc -a19 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a19 +run_strace_match_diff -a19 diff --git a/tests-m32/ipc_msg.gen.test b/tests-m32/ipc_msg.gen.test index f4fec80b..b1f1f7e8 100755 --- a/tests-m32/ipc_msg.gen.test +++ b/tests-m32/ipc_msg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ipc_msg +ipc.sh); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ipc_msg +ipc.sh ); do not edit. +set -- . "${srcdir=.}/ipc.sh" diff --git a/tests-m32/ipc_msgbuf.c b/tests-m32/ipc_msgbuf.c index d1083899..c4af1bef 100644 --- a/tests-m32/ipc_msgbuf.c +++ b/tests-m32/ipc_msgbuf.c @@ -38,11 +38,16 @@ static int msqid = -1; -static void +static int cleanup(void) { - msgctl(msqid, IPC_RMID, 0); - msqid = -1; + if (msqid != -1) { + int rc = msgctl(msqid, IPC_RMID, 0); + msqid = -1; + if (rc == -1) + return 77; + } + return 0; } int @@ -59,10 +64,11 @@ main(void) msqid = msgget(IPC_PRIVATE, IPC_CREAT | S_IRWXU); if (msqid == -1) perror_msg_and_skip("msgget"); - atexit(cleanup); + typedef void (*atexit_func)(void); + atexit((atexit_func) cleanup); if (msgsnd(msqid, &msg, msgsz, 0) == -1) perror_msg_and_skip("msgsnd"); if (msgrcv(msqid, &msg, msgsz, mtype, 0) != msgsz) perror_msg_and_skip("msgrcv"); - return 0; + return cleanup(); } diff --git a/tests-m32/ipc_sem.gen.test b/tests-m32/ipc_sem.gen.test index 54159a64..a1c03d2b 100755 --- a/tests-m32/ipc_sem.gen.test +++ b/tests-m32/ipc_sem.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ipc_sem +ipc.sh); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ipc_sem +ipc.sh ); do not edit. +set -- . "${srcdir=.}/ipc.sh" diff --git a/tests-m32/ipc_shm.c b/tests-m32/ipc_shm.c index 66960ff9..c7931388 100644 --- a/tests-m32/ipc_shm.c +++ b/tests-m32/ipc_shm.c @@ -1,6 +1,7 @@ /* * Copyright (c) 2015 Elvira Khabirova <lineprinter0@gmail.com> * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2015-2017 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,6 +33,14 @@ #include <stdlib.h> #include <sys/shm.h> +#ifndef SHM_HUGE_SHIFT +# define SHM_HUGE_SHIFT 26 +#endif + +#ifndef SHM_HUGE_MASK +# define SHM_HUGE_MASK 0x3f +#endif + #include "xlat.h" #include "xlat/shm_resource_flags.h" @@ -64,18 +73,54 @@ main(void) #else (size_t) 0x1e55c0de5dec0dedULL; #endif - static const int bogus_flags = 0xface1e55; - + static const unsigned int bogus_ipc_shm_flags = + IPC_CREAT | IPC_EXCL | SHM_HUGETLB | SHM_NORESERVE; + static const unsigned int huge_mask = SHM_HUGE_MASK << SHM_HUGE_SHIFT; + static const unsigned int huge_flags = 21 << SHM_HUGE_SHIFT; + int bogus_flags; int rc; struct shmid_ds ds; + rc = shmget(bogus_key, bogus_size, 0); + printf("shmget\\(%#llx, %zu, 000\\) += %s\n", + zero_extend_signed_to_ull(bogus_key), bogus_size, + sprintrc_grep(rc)); + + rc = shmget(bogus_key, bogus_size, huge_flags); + printf("shmget\\(%#llx, %zu, %s\\|%#03o\\) += %s\n", + zero_extend_signed_to_ull(bogus_key), bogus_size, + "21<<SHM_HUGE_SHIFT", 0, sprintrc_grep(rc)); + + bogus_flags = 0xface1e55 & ~(bogus_ipc_shm_flags | huge_mask); + rc = shmget(bogus_key, bogus_size, bogus_flags); + printf("shmget\\(%#llx, %zu, %#x\\|%#03o\\) += %s\n", + zero_extend_signed_to_ull(bogus_key), bogus_size, + bogus_flags & ~0777, + bogus_flags & 0777, sprintrc_grep(rc)); + + bogus_flags |= bogus_ipc_shm_flags; + rc = shmget(bogus_key, bogus_size, bogus_flags); + printf("shmget\\(%#llx, %zu, %s\\|%#x\\|%#03o\\) += %s\n", + zero_extend_signed_to_ull(bogus_key), bogus_size, + "IPC_CREAT\\|IPC_EXCL\\|SHM_HUGETLB\\|SHM_NORESERVE", + bogus_flags & ~(0777 | bogus_ipc_shm_flags), + bogus_flags & 0777, sprintrc_grep(rc)); + + bogus_flags |= huge_flags; + rc = shmget(bogus_key, bogus_size, bogus_flags); + printf("shmget\\(%#llx, %zu, %s\\|%#x\\|%s\\|%#03o\\) += %s\n", + zero_extend_signed_to_ull(bogus_key), bogus_size, + "IPC_CREAT\\|IPC_EXCL\\|SHM_HUGETLB\\|SHM_NORESERVE", + bogus_flags & ~(0777 | bogus_ipc_shm_flags | huge_mask), + "21<<SHM_HUGE_SHIFT", + bogus_flags & 0777, sprintrc_grep(rc)); + + bogus_flags &= ~bogus_ipc_shm_flags; rc = shmget(bogus_key, bogus_size, bogus_flags); - printf("shmget\\(%#llx, %zu, %s%s%s%#x\\|%#04o\\) += %s\n", + printf("shmget\\(%#llx, %zu, %#x\\|%s\\|%#03o\\) += %s\n", zero_extend_signed_to_ull(bogus_key), bogus_size, - IPC_CREAT & bogus_flags ? "IPC_CREAT\\|" : "", - IPC_EXCL & bogus_flags ? "IPC_EXCL\\|" : "", - SHM_HUGETLB & bogus_flags ? "SHM_HUGETLB\\|" : "", - bogus_flags & ~(0777 | IPC_CREAT | IPC_EXCL | SHM_HUGETLB), + bogus_flags & ~(0777 | huge_mask), + "21<<SHM_HUGE_SHIFT", bogus_flags & 0777, sprintrc_grep(rc)); id = shmget(private_key, 1, 0600); diff --git a/tests-m32/ipc_shm.gen.test b/tests-m32/ipc_shm.gen.test index 505eabaf..8c6df9b3 100755 --- a/tests-m32/ipc_shm.gen.test +++ b/tests-m32/ipc_shm.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ipc_shm +ipc.sh); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ipc_shm +ipc.sh ); do not edit. +set -- . "${srcdir=.}/ipc.sh" diff --git a/tests-m32/kcmp.gen.test b/tests-m32/kcmp.gen.test index c073a39e..139e909b 100755 --- a/tests-m32/kcmp.gen.test +++ b/tests-m32/kcmp.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (kcmp -a22); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (kcmp -a22 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a22 +run_strace_match_diff -a22 diff --git a/tests-m32/kexec_file_load.gen.test b/tests-m32/kexec_file_load.gen.test index aefaab38..11013497 100755 --- a/tests-m32/kexec_file_load.gen.test +++ b/tests-m32/kexec_file_load.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (kexec_file_load -s9); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (kexec_file_load -s9 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -s9 +run_strace_match_diff -s9 diff --git a/tests-m32/kexec_load.gen.test b/tests-m32/kexec_load.gen.test index 0af95271..6ce18317 100755 --- a/tests-m32/kexec_load.gen.test +++ b/tests-m32/kexec_load.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (kexec_load -s9); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (kexec_load -s9 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -s9 +run_strace_match_diff -s9 diff --git a/tests-m32/lchown.gen.test b/tests-m32/lchown.gen.test index b31e29d1..d346c76d 100755 --- a/tests-m32/lchown.gen.test +++ b/tests-m32/lchown.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (lchown -a30); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (lchown -a30 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a30 +run_strace_match_diff -a30 diff --git a/tests-m32/lchown32.gen.test b/tests-m32/lchown32.gen.test index 83be4bca..5da2349c 100755 --- a/tests-m32/lchown32.gen.test +++ b/tests-m32/lchown32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (lchown32 -a32); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (lchown32 -a32 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a32 +run_strace_match_diff -a32 diff --git a/tests-m32/link.gen.test b/tests-m32/link.gen.test index b6db34d0..2ec3f5b8 100755 --- a/tests-m32/link.gen.test +++ b/tests-m32/link.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (link ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (link ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/linkat.gen.test b/tests-m32/linkat.gen.test index 54b12b94..8bdf78b4 100755 --- a/tests-m32/linkat.gen.test +++ b/tests-m32/linkat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (linkat ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (linkat ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/llseek.test b/tests-m32/llseek.test index 8dcd65d6..9db68e3a 100755 --- a/tests-m32/llseek.test +++ b/tests-m32/llseek.test @@ -7,5 +7,5 @@ check_prog grep run_prog > /dev/null run_strace -e_llseek $args > "$EXP" -grep -v '^lseek([0-9]' < "$LOG" > "$OUT" +grep -v '^_llseek([0-9]' < "$LOG" > "$OUT" match_diff "$OUT" "$EXP" diff --git a/tests-m32/lookup_dcookie.gen.test b/tests-m32/lookup_dcookie.gen.test index 6357e19d..616c7057 100755 --- a/tests-m32/lookup_dcookie.gen.test +++ b/tests-m32/lookup_dcookie.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (lookup_dcookie -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (lookup_dcookie -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests-m32/madvise.gen.test b/tests-m32/madvise.gen.test index bd36dada..a549cf94 100755 --- a/tests-m32/madvise.gen.test +++ b/tests-m32/madvise.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (madvise -a33); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (madvise -a33 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a33 +run_strace_match_diff -a33 diff --git a/tests-m32/mbind.gen.test b/tests-m32/mbind.gen.test index a0d144df..c47e0fc1 100755 --- a/tests-m32/mbind.gen.test +++ b/tests-m32/mbind.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mbind ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mbind ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/membarrier.c b/tests-m32/membarrier.c index 73dd3b02..43f99f88 100644 --- a/tests-m32/membarrier.c +++ b/tests-m32/membarrier.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2015-2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2015-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,28 +45,49 @@ main(void) printf("membarrier(0x3 /* MEMBARRIER_CMD_??? */, 255) = %s\n", sprintrc(-1)); if (saved_errno != ENOSYS) { + const char *text_global; const char *text; int rc = syscall(__NR_membarrier, 0, 0); - switch (rc) { - case 1: - text = "MEMBARRIER_CMD_SHARED"; + assert(rc >= 0); + + text_global = rc & 1 ? "MEMBARRIER_CMD_GLOBAL" : ""; + + switch (rc & ~1) { + case 0: + text = ""; break; - case 1|8: - text = "MEMBARRIER_CMD_SHARED|" - "MEMBARRIER_CMD_PRIVATE_EXPEDITED"; + case 8: + text = "MEMBARRIER_CMD_PRIVATE_EXPEDITED"; break; - case 1|8|16: - text = "MEMBARRIER_CMD_SHARED|" + case 8|16: + text = "MEMBARRIER_CMD_PRIVATE_EXPEDITED|" + "MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED"; + break; + + case 2|4|8|16: + text = "MEMBARRIER_CMD_GLOBAL_EXPEDITED|" + "MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED|" "MEMBARRIER_CMD_PRIVATE_EXPEDITED|" "MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED"; break; + + case 2|4|8|16|32|64: + text = "MEMBARRIER_CMD_GLOBAL_EXPEDITED|" + "MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED|" + "MEMBARRIER_CMD_PRIVATE_EXPEDITED|" + "MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED|" + "MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE|" + "MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE"; + break; + default: error_msg_and_fail("membarrier returned %#x, does" " the test have to be updated?", rc); } - printf("membarrier(MEMBARRIER_CMD_QUERY, 0) = %#x (%s)\n", - rc, text); + printf("membarrier(MEMBARRIER_CMD_QUERY, 0) = %#x (%s%s%s)\n", + rc, text_global, text[0] && text_global[0] ? "|" : "", + text); } puts("+++ exited with 0 +++"); return 0; diff --git a/tests-m32/membarrier.gen.test b/tests-m32/membarrier.gen.test index 7a6ea10d..6ae6e915 100755 --- a/tests-m32/membarrier.gen.test +++ b/tests-m32/membarrier.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (membarrier -a36); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (membarrier -a36 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a36 +run_strace_match_diff -a36 diff --git a/tests-m32/memfd_create.c b/tests-m32/memfd_create.c index 4559b426..8334af84 100644 --- a/tests-m32/memfd_create.c +++ b/tests-m32/memfd_create.c @@ -1,3 +1,32 @@ +/* + * Check decoding of memfd_create syscall. + * + * Copyright (c) 2015-2017 Dmitry V. Levin <ldv@altlinux.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + #include "tests.h" #include <asm/unistd.h> #include "scno.h" @@ -5,17 +34,62 @@ #ifdef __NR_memfd_create # include <stdio.h> +# include <stdint.h> # include <unistd.h> +# ifdef HAVE_LINUX_MEMFD_H +# include <linux/memfd.h> +# endif + +# ifndef MFD_HUGE_SHIFT +# define MFD_HUGE_SHIFT 26 +# endif + +# ifndef MFD_HUGE_MASK +# define MFD_HUGE_MASK 0x3f +# endif + +static const char *errstr; + +static long +k_memfd_create(const kernel_ulong_t name, const kernel_ulong_t flags) +{ + const long rc = syscall(__NR_memfd_create, name, flags); + errstr = sprintrc(rc); + return rc; +} + int main(void) { - static const char text[] = "strace"; - int rc = syscall(__NR_memfd_create, text, 0xf); + const size_t size = 255 - (sizeof("memfd:") - 1) + 1; + char *pattern = tail_alloc(size); + fill_memory_ex(pattern, size, '0', 10); + + k_memfd_create((uintptr_t) pattern, 0); + printf("memfd_create(\"%.*s\"..., 0) = %s\n", + (int) size - 1, pattern, errstr); + + kernel_ulong_t flags = (kernel_ulong_t) 0xfacefeed00000007ULL; + k_memfd_create((uintptr_t) pattern, flags); + printf("memfd_create(\"%.*s\"..., %s) = %s\n", + (int) size - 1, pattern, + "MFD_CLOEXEC|MFD_ALLOW_SEALING|MFD_HUGETLB", + errstr); + + pattern[size - 1] = '\0'; + flags = 30 << MFD_HUGE_SHIFT; + k_memfd_create((uintptr_t) pattern, flags); + printf("memfd_create(\"%s\", 30<<MFD_HUGE_SHIFT) = %s\n", + pattern, errstr); - printf("memfd_create(\"%s\", %s) = %s\n", - text, "MFD_CLOEXEC|MFD_ALLOW_SEALING|MFD_HUGETLB|0x8", - sprintrc(rc)); + pattern += size - 1; + flags = (kernel_ulong_t) -1ULL; + k_memfd_create(0, flags); + flags = -1U & ~(7 | (MFD_HUGE_MASK << MFD_HUGE_SHIFT)); + printf("memfd_create(NULL, MFD_CLOEXEC|MFD_ALLOW_SEALING|MFD_HUGETLB" + "|%#x|%u<<MFD_HUGE_SHIFT) = %s\n", + (unsigned int) flags, MFD_HUGE_MASK, errstr); puts("+++ exited with 0 +++"); return 0; diff --git a/tests-m32/memfd_create.gen.test b/tests-m32/memfd_create.gen.test index 11762bea..ccb5b52e 100755 --- a/tests-m32/memfd_create.gen.test +++ b/tests-m32/memfd_create.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (memfd_create ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (memfd_create ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/migrate_pages.gen.test b/tests-m32/migrate_pages.gen.test index 20b7cad9..0ea017d0 100755 --- a/tests-m32/migrate_pages.gen.test +++ b/tests-m32/migrate_pages.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (migrate_pages -a33); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (migrate_pages -a33 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a33 +run_strace_match_diff -a33 diff --git a/tests-m32/mincore.gen.test b/tests-m32/mincore.gen.test index dc407261..45e43e25 100755 --- a/tests-m32/mincore.gen.test +++ b/tests-m32/mincore.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mincore -a22); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mincore -a22 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a22 +run_strace_match_diff -a22 diff --git a/tests-m32/mkdir.gen.test b/tests-m32/mkdir.gen.test index 80b49957..8d34c8b2 100755 --- a/tests-m32/mkdir.gen.test +++ b/tests-m32/mkdir.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mkdir -a20); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mkdir -a20 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a20 +run_strace_match_diff -a20 diff --git a/tests-m32/mkdirat.gen.test b/tests-m32/mkdirat.gen.test index 0f3fdae2..eef8e526 100755 --- a/tests-m32/mkdirat.gen.test +++ b/tests-m32/mkdirat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mkdirat -a28); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mkdirat -a28 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a28 +run_strace_match_diff -a28 diff --git a/tests-m32/mknod.gen.test b/tests-m32/mknod.gen.test index 870c88b4..ce08e99f 100755 --- a/tests-m32/mknod.gen.test +++ b/tests-m32/mknod.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mknod -a18); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mknod -a18 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a18 +run_strace_match_diff -a18 diff --git a/tests-m32/mknodat.gen.test b/tests-m32/mknodat.gen.test index 747fcbee..dce7d449 100755 --- a/tests-m32/mknodat.gen.test +++ b/tests-m32/mknodat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mknodat -a35); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mknodat -a35 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a35 +run_strace_match_diff -a35 diff --git a/tests-m32/mlock2.gen.test b/tests-m32/mlock2.gen.test index aa1818e1..ff94eb89 100755 --- a/tests-m32/mlock2.gen.test +++ b/tests-m32/mlock2.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mlock2 ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mlock2 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/mlockall.gen.test b/tests-m32/mlockall.gen.test index 06d8ca44..59ef67f8 100755 --- a/tests-m32/mlockall.gen.test +++ b/tests-m32/mlockall.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mlockall -a12); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mlockall -a12 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a12 +run_strace_match_diff -a12 diff --git a/tests-m32/mmap64.gen.test b/tests-m32/mmap64.gen.test index 5e747b02..0ecd5294 100755 --- a/tests-m32/mmap64.gen.test +++ b/tests-m32/mmap64.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mmap64 +mmap.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mmap64 +mmap.test ); do not edit. +set -- . "${srcdir=.}/mmap.test" diff --git a/tests-m32/modify_ldt.c b/tests-m32/modify_ldt.c new file mode 100644 index 00000000..1e26bda4 --- /dev/null +++ b/tests-m32/modify_ldt.c @@ -0,0 +1,137 @@ +/* + * Check decoding of modify_ldt syscall. + * + * Copyright (c) 2018 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" + +#include <asm/unistd.h> + +#if defined __NR_modify_ldt && defined HAVE_STRUCT_USER_DESC + +# include <errno.h> +# include <stdio.h> +# include <unistd.h> + +# include "print_user_desc.c" + +void +printrc(long rc) +{ +#ifdef __x86_64__ + int err = -rc; + + /* Thanks, long return type of syscall(2) */ + printf("%lld", zero_extend_signed_to_ull(rc)); + + if (err > 0 && err < 0x1000) { + errno = err; + printf(" %s (%m)", errno2name()); + } +#else + printf("%s", sprintrc(rc)); +#endif + + puts(""); +} + +int +main(void) +{ + static const kernel_ulong_t bogus_func = + (kernel_ulong_t) 0xbadc0dedda7a1057ULL; + static const kernel_ulong_t bogus_bytecount = + (kernel_ulong_t) 0xdeadfacefa57beefULL; + + struct user_desc *us = tail_alloc(sizeof(*us)); + unsigned int *bogus_int = tail_alloc(sizeof(*bogus_int)); + long rc; + + fill_memory(us, sizeof(*us)); + + rc = syscall(__NR_modify_ldt, 0, 0, 0); + printf("modify_ldt(0, NULL, 0) = "); + printrc(rc); + + rc = syscall(__NR_modify_ldt, bogus_func, (kernel_long_t) -1, + bogus_bytecount); + printf("modify_ldt(%d, %#llx, %llu) = ", + (int) bogus_func, + zero_extend_signed_to_ull((kernel_long_t) -1), + (unsigned long long) bogus_bytecount); + printrc(rc); + + rc = syscall(__NR_modify_ldt, bogus_func, us + 1, 0); + printf("modify_ldt(%d, %p, 0) = ", (int) bogus_func, us + 1); + printrc(rc); + + rc = syscall(__NR_modify_ldt, bogus_func, us, 42); + printf("modify_ldt(%d, %p, 42) = ", (int) bogus_func, us); + printrc(rc); + + rc = syscall(__NR_modify_ldt, bogus_func, us + 1, sizeof(*us)); + printf("modify_ldt(%d, %p, %zu) = ", + (int) bogus_func, us + 1, sizeof(*us)); + printrc(rc); + + /* + * print_user_desc handles entry_number field in a special way for + * get_thread_area syscall, so let's also check here that we don't + * retrieve it accidentally. + */ + rc = syscall(__NR_modify_ldt, bogus_func, bogus_int, sizeof(*us)); + printf("modify_ldt(%d, %p, %zu) = ", + (int) bogus_func, bogus_int, sizeof(*us)); + printrc(rc); + + rc = syscall(__NR_modify_ldt, bogus_func, us, sizeof(*us)); + printf("modify_ldt(%d, ", (int) bogus_func); + print_user_desc(us, NULL); + printf(", %zu) = ", sizeof(*us)); + printrc(rc); + + fill_memory_ex(us, sizeof(*us), 0x55, 80); + us->entry_number = -1; + us->base_addr = 0; + us->limit = 0; + + rc = syscall(__NR_modify_ldt, bogus_func, us, sizeof(*us)); + printf("modify_ldt(%d, ", (int) bogus_func); + print_user_desc(us, "-1"); + printf(", %zu) = ", sizeof(*us)); + printrc(rc); + + puts("+++ exited with 0 +++"); + + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_modify_ldt && HAVE_STRUCT_USER_DESC"); + +#endif diff --git a/tests-m32/modify_ldt.gen.test b/tests-m32/modify_ldt.gen.test new file mode 100755 index 00000000..1a85b067 --- /dev/null +++ b/tests-m32/modify_ldt.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (modify_ldt -a23 ); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a23 diff --git a/tests-m32/mount.gen.test b/tests-m32/mount.gen.test index 0b124bc2..69bc99be 100755 --- a/tests-m32/mount.gen.test +++ b/tests-m32/mount.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mount ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mount ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/move_pages.gen.test b/tests-m32/move_pages.gen.test index 2f060fa8..9d472ef9 100755 --- a/tests-m32/move_pages.gen.test +++ b/tests-m32/move_pages.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (move_pages -s3); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (move_pages -s3 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -s3 +run_strace_match_diff -s3 diff --git a/tests-m32/munlockall.gen.test b/tests-m32/munlockall.gen.test index 18343cba..2e4e0c4f 100755 --- a/tests-m32/munlockall.gen.test +++ b/tests-m32/munlockall.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (munlockall -a13); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (munlockall -a13 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a13 +run_strace_match_diff -a13 diff --git a/tests-m32/nanosleep.gen.test b/tests-m32/nanosleep.gen.test index ea5b19ae..41928ded 100755 --- a/tests-m32/nanosleep.gen.test +++ b/tests-m32/nanosleep.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nanosleep -a20); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nanosleep -a20 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a20 +run_strace_match_diff -a20 diff --git a/tests-m32/net-accept-connect.c b/tests-m32/net-accept-connect.c index 4045e056..0756c9be 100644 --- a/tests-m32/net-accept-connect.c +++ b/tests-m32/net-accept-connect.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2013-2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2013-2017 The strace developers. + * Copyright (c) 2013-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,15 +49,16 @@ main(int ac, const char **av) struct sockaddr_un addr = { .sun_family = AF_UNIX, }; - socklen_t len; assert(ac == 2); - assert(strlen(av[1]) > 0); + socklen_t len = strlen(av[1]); + assert(len > 0 && len <= sizeof(addr.sun_path)); - strncpy(addr.sun_path, av[1], sizeof(addr.sun_path)); - len = offsetof(struct sockaddr_un, sun_path) + strlen(av[1]) + 1; - if (len > sizeof(addr)) - len = sizeof(addr); + if (++len > sizeof(addr.sun_path)) + len = sizeof(addr.sun_path); + + memcpy(addr.sun_path, av[1], len); + len += offsetof(struct sockaddr_un, sun_path); unlink(av[1]); close(0); diff --git a/tests-m32/net-y-unix.c b/tests-m32/net-y-unix.c index fbdf5900..847c7354 100644 --- a/tests-m32/net-y-unix.c +++ b/tests-m32/net-y-unix.c @@ -2,6 +2,7 @@ * This file is part of net-y-unix strace test. * * Copyright (c) 2013-2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,10 +35,11 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <sys/param.h> #include <sys/socket.h> #include <sys/un.h> +#include "accept_compat.h" + #define TEST_SOCKET "net-y-unix.socket" int @@ -106,7 +108,7 @@ main(void) struct sockaddr * const accept_sa = tail_alloc(sizeof(addr)); memset(accept_sa, 0, sizeof(addr)); *len = sizeof(addr); - int accept_fd = accept(listen_fd, accept_sa, len); + int accept_fd = do_accept(listen_fd, accept_sa, len); if (accept_fd < 0) perror_msg_and_fail("accept"); unsigned long accept_inode = inode_of_sockfd(accept_fd); @@ -177,7 +179,7 @@ main(void) memset(accept_sa, 0, sizeof(addr)); *len = sizeof(addr); - accept_fd = accept(listen_fd, accept_sa, len); + accept_fd = do_accept(listen_fd, accept_sa, len); if (accept_fd < 0) perror_msg_and_fail("accept"); accept_inode = inode_of_sockfd(accept_fd); diff --git a/tests-m32/net-yy-inet.c b/tests-m32/net-yy-inet.c index c043920d..c69bb173 100644 --- a/tests-m32/net-yy-inet.c +++ b/tests-m32/net-yy-inet.c @@ -2,7 +2,7 @@ * This file is part of net-yy-inet strace test. * * Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,6 +39,8 @@ #include <netinet/tcp.h> #include <arpa/inet.h> +#include "accept_compat.h" + int main(void) { @@ -105,7 +107,7 @@ main(void) struct sockaddr * const accept_sa = tail_alloc(sizeof(addr)); memset(accept_sa, 0, sizeof(addr)); *len = sizeof(addr); - const int accept_fd = accept(listen_fd, accept_sa, len); + const int accept_fd = do_accept(listen_fd, accept_sa, len); if (accept_fd < 0) perror_msg_and_fail("accept"); const unsigned int connect_port = diff --git a/tests-m32/net-yy-unix.c b/tests-m32/net-yy-unix.c index 21822db9..40ac3a63 100644 --- a/tests-m32/net-yy-unix.c +++ b/tests-m32/net-yy-unix.c @@ -2,6 +2,7 @@ * This file is part of net-yy-unix strace test. * * Copyright (c) 2013-2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,10 +35,11 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <sys/param.h> #include <sys/socket.h> #include <sys/un.h> +#include "accept_compat.h" + #define TEST_SOCKET "net-yy-unix.socket" int @@ -107,7 +109,7 @@ main(void) struct sockaddr * const accept_sa = tail_alloc(sizeof(addr)); memset(accept_sa, 0, sizeof(addr)); *len = sizeof(addr); - int accept_fd = accept(listen_fd, accept_sa, len); + int accept_fd = do_accept(listen_fd, accept_sa, len); if (accept_fd < 0) perror_msg_and_fail("accept"); unsigned long accept_inode = inode_of_sockfd(accept_fd); @@ -180,7 +182,7 @@ main(void) memset(accept_sa, 0, sizeof(addr)); *len = sizeof(addr); - accept_fd = accept(listen_fd, accept_sa, len); + accept_fd = do_accept(listen_fd, accept_sa, len); if (accept_fd < 0) perror_msg_and_fail("accept"); accept_inode = inode_of_sockfd(accept_fd); diff --git a/tests-m32/net.expected b/tests-m32/net.expected index 80dd0701..e33e2966 100644 --- a/tests-m32/net.expected +++ b/tests-m32/net.expected @@ -3,5 +3,5 @@ [1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +bind\(0, \{sa_family=AF_(LOCAL|UNIX|FILE), sun_path="net-local-stream"\}, 19\) += 0 [1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +listen\(0, 5\) += 0 [1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +getsockname\(0, \{sa_family=AF_(LOCAL|UNIX|FILE), sun_path="net-local-stream"\}, \[19\]\) += 0 -[1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +accept\(0, \{sa_family=AF_(LOCAL|UNIX|FILE)\}, \[19->2\]\) += 1 +[1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +accept4?\(0, \{sa_family=AF_(LOCAL|UNIX|FILE)\}, \[19->2\](, 0)?\) += 1 [1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +connect\(1, \{sa_family=AF_(LOCAL|UNIX|FILE), sun_path="net-local-stream"\}, 19\) += 0 diff --git a/tests-m32/netlink_audit.gen.test b/tests-m32/netlink_audit.gen.test index 65110672..5c17038e 100755 --- a/tests-m32/netlink_audit.gen.test +++ b/tests-m32/netlink_audit.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_audit +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_audit +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/netlink_crypto.gen.test b/tests-m32/netlink_crypto.gen.test index b1380991..fcb4c3d9 100755 --- a/tests-m32/netlink_crypto.gen.test +++ b/tests-m32/netlink_crypto.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_crypto +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_crypto +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/netlink_generic.gen.test b/tests-m32/netlink_generic.gen.test index e51f15ce..6f304d3a 100755 --- a/tests-m32/netlink_generic.gen.test +++ b/tests-m32/netlink_generic.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_generic +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_generic +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/netlink_kobject_uevent.gen.test b/tests-m32/netlink_kobject_uevent.gen.test index 310a70b8..46bdebd1 100755 --- a/tests-m32/netlink_kobject_uevent.gen.test +++ b/tests-m32/netlink_kobject_uevent.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_kobject_uevent +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_kobject_uevent +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/netlink_netfilter.gen.test b/tests-m32/netlink_netfilter.gen.test index fffb72b4..94b3f369 100755 --- a/tests-m32/netlink_netfilter.gen.test +++ b/tests-m32/netlink_netfilter.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_netfilter +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_netfilter +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/netlink_route.gen.test b/tests-m32/netlink_route.gen.test index 298dbf1a..bd9c0d95 100755 --- a/tests-m32/netlink_route.gen.test +++ b/tests-m32/netlink_route.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_route +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_route +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/netlink_selinux.gen.test b/tests-m32/netlink_selinux.gen.test index a8871d6d..484ffae7 100755 --- a/tests-m32/netlink_selinux.gen.test +++ b/tests-m32/netlink_selinux.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_selinux +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_selinux +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/netlink_xfrm.gen.test b/tests-m32/netlink_xfrm.gen.test index 17f7444b..36918982 100755 --- a/tests-m32/netlink_xfrm.gen.test +++ b/tests-m32/netlink_xfrm.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_xfrm +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_xfrm +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nfnetlink_acct.gen.test b/tests-m32/nfnetlink_acct.gen.test index 7db22769..e3aa8892 100755 --- a/tests-m32/nfnetlink_acct.gen.test +++ b/tests-m32/nfnetlink_acct.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_acct +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_acct +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nfnetlink_cthelper.gen.test b/tests-m32/nfnetlink_cthelper.gen.test index 661c949c..fa26e14a 100755 --- a/tests-m32/nfnetlink_cthelper.gen.test +++ b/tests-m32/nfnetlink_cthelper.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_cthelper +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_cthelper +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nfnetlink_ctnetlink.gen.test b/tests-m32/nfnetlink_ctnetlink.gen.test index d4c4daaf..9e9ad153 100755 --- a/tests-m32/nfnetlink_ctnetlink.gen.test +++ b/tests-m32/nfnetlink_ctnetlink.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_ctnetlink +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_ctnetlink +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nfnetlink_ctnetlink_exp.gen.test b/tests-m32/nfnetlink_ctnetlink_exp.gen.test index a5d83f9b..4ed3707e 100755 --- a/tests-m32/nfnetlink_ctnetlink_exp.gen.test +++ b/tests-m32/nfnetlink_ctnetlink_exp.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_ctnetlink_exp +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_ctnetlink_exp +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nfnetlink_cttimeout.gen.test b/tests-m32/nfnetlink_cttimeout.gen.test index e197f000..ab42fc78 100755 --- a/tests-m32/nfnetlink_cttimeout.gen.test +++ b/tests-m32/nfnetlink_cttimeout.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_cttimeout +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_cttimeout +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nfnetlink_ipset.gen.test b/tests-m32/nfnetlink_ipset.gen.test index 418437a7..ea129fbc 100755 --- a/tests-m32/nfnetlink_ipset.gen.test +++ b/tests-m32/nfnetlink_ipset.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_ipset +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_ipset +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nfnetlink_nft_compat.gen.test b/tests-m32/nfnetlink_nft_compat.gen.test index c3dc8907..aff04c5f 100755 --- a/tests-m32/nfnetlink_nft_compat.gen.test +++ b/tests-m32/nfnetlink_nft_compat.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_nft_compat +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_nft_compat +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nfnetlink_nftables.gen.test b/tests-m32/nfnetlink_nftables.gen.test index 25e90e85..c23ad330 100755 --- a/tests-m32/nfnetlink_nftables.gen.test +++ b/tests-m32/nfnetlink_nftables.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_nftables +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_nftables +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nfnetlink_osf.gen.test b/tests-m32/nfnetlink_osf.gen.test index 2689574a..aa540907 100755 --- a/tests-m32/nfnetlink_osf.gen.test +++ b/tests-m32/nfnetlink_osf.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_osf +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_osf +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nfnetlink_queue.gen.test b/tests-m32/nfnetlink_queue.gen.test index 739fb17d..965e0d24 100755 --- a/tests-m32/nfnetlink_queue.gen.test +++ b/tests-m32/nfnetlink_queue.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_queue +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_queue +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nfnetlink_ulog.gen.test b/tests-m32/nfnetlink_ulog.gen.test index 850ebafc..825ad9f6 100755 --- a/tests-m32/nfnetlink_ulog.gen.test +++ b/tests-m32/nfnetlink_ulog.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_ulog +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_ulog +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr.gen.test b/tests-m32/nlattr.gen.test index 105801b9..0ea2f185 100755 --- a/tests-m32/nlattr.gen.test +++ b/tests-m32/nlattr.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_br_port_msg.gen.test b/tests-m32/nlattr_br_port_msg.gen.test index f843797a..c9572759 100755 --- a/tests-m32/nlattr_br_port_msg.gen.test +++ b/tests-m32/nlattr_br_port_msg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_br_port_msg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_br_port_msg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_crypto_user_alg.gen.test b/tests-m32/nlattr_crypto_user_alg.gen.test index 81d866e0..e52b6be7 100755 --- a/tests-m32/nlattr_crypto_user_alg.gen.test +++ b/tests-m32/nlattr_crypto_user_alg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_crypto_user_alg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_crypto_user_alg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_dcbmsg.gen.test b/tests-m32/nlattr_dcbmsg.gen.test index d78bfcf6..f9ef39f7 100755 --- a/tests-m32/nlattr_dcbmsg.gen.test +++ b/tests-m32/nlattr_dcbmsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_dcbmsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_dcbmsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_fib_rule_hdr.gen.test b/tests-m32/nlattr_fib_rule_hdr.gen.test index cbdad4d5..fb61343d 100755 --- a/tests-m32/nlattr_fib_rule_hdr.gen.test +++ b/tests-m32/nlattr_fib_rule_hdr.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_fib_rule_hdr +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_fib_rule_hdr +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_ifaddrlblmsg.gen.test b/tests-m32/nlattr_ifaddrlblmsg.gen.test index 0c41dbe5..0f51430f 100755 --- a/tests-m32/nlattr_ifaddrlblmsg.gen.test +++ b/tests-m32/nlattr_ifaddrlblmsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifaddrlblmsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifaddrlblmsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_ifaddrmsg.gen.test b/tests-m32/nlattr_ifaddrmsg.gen.test index d659e001..3fb81bdb 100755 --- a/tests-m32/nlattr_ifaddrmsg.gen.test +++ b/tests-m32/nlattr_ifaddrmsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifaddrmsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifaddrmsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_ifinfomsg.gen.test b/tests-m32/nlattr_ifinfomsg.gen.test index 618df143..b9a6456a 100755 --- a/tests-m32/nlattr_ifinfomsg.gen.test +++ b/tests-m32/nlattr_ifinfomsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifinfomsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifinfomsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_ifla_brport.gen.test b/tests-m32/nlattr_ifla_brport.gen.test index 48bfed4b..6758d8d1 100755 --- a/tests-m32/nlattr_ifla_brport.gen.test +++ b/tests-m32/nlattr_ifla_brport.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifla_brport +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifla_brport +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_ifla_port.gen.test b/tests-m32/nlattr_ifla_port.gen.test index 605bf045..ecea89a4 100755 --- a/tests-m32/nlattr_ifla_port.gen.test +++ b/tests-m32/nlattr_ifla_port.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifla_port +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifla_port +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_ifla_xdp.gen.test b/tests-m32/nlattr_ifla_xdp.gen.test index a30e8436..c6e0fab3 100755 --- a/tests-m32/nlattr_ifla_xdp.gen.test +++ b/tests-m32/nlattr_ifla_xdp.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifla_xdp +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifla_xdp +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_inet_diag_msg.gen.test b/tests-m32/nlattr_inet_diag_msg.gen.test index 953a7675..953a23df 100755 --- a/tests-m32/nlattr_inet_diag_msg.gen.test +++ b/tests-m32/nlattr_inet_diag_msg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_inet_diag_msg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_inet_diag_msg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_inet_diag_req_compat.gen.test b/tests-m32/nlattr_inet_diag_req_compat.gen.test index bf8b65c8..7b577dc9 100755 --- a/tests-m32/nlattr_inet_diag_req_compat.gen.test +++ b/tests-m32/nlattr_inet_diag_req_compat.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_inet_diag_req_compat +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_inet_diag_req_compat +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_inet_diag_req_v2.gen.test b/tests-m32/nlattr_inet_diag_req_v2.gen.test index 0260bc4a..01c73a13 100755 --- a/tests-m32/nlattr_inet_diag_req_v2.gen.test +++ b/tests-m32/nlattr_inet_diag_req_v2.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_inet_diag_req_v2 +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_inet_diag_req_v2 +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_mdba_mdb_entry.gen.test b/tests-m32/nlattr_mdba_mdb_entry.gen.test index 67253e8e..8d09a033 100755 --- a/tests-m32/nlattr_mdba_mdb_entry.gen.test +++ b/tests-m32/nlattr_mdba_mdb_entry.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_mdba_mdb_entry +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_mdba_mdb_entry +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_mdba_router_port.gen.test b/tests-m32/nlattr_mdba_router_port.gen.test index ce9ea148..97230e84 100755 --- a/tests-m32/nlattr_mdba_router_port.gen.test +++ b/tests-m32/nlattr_mdba_router_port.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_mdba_router_port +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_mdba_router_port +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_ndmsg.gen.test b/tests-m32/nlattr_ndmsg.gen.test index 06b8f1a4..1d2763b0 100755 --- a/tests-m32/nlattr_ndmsg.gen.test +++ b/tests-m32/nlattr_ndmsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ndmsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ndmsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_ndtmsg.gen.test b/tests-m32/nlattr_ndtmsg.gen.test index d75ad57b..bf7d122a 100755 --- a/tests-m32/nlattr_ndtmsg.gen.test +++ b/tests-m32/nlattr_ndtmsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ndtmsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ndtmsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_netconfmsg.gen.test b/tests-m32/nlattr_netconfmsg.gen.test index 9a061cb4..27f3a66b 100755 --- a/tests-m32/nlattr_netconfmsg.gen.test +++ b/tests-m32/nlattr_netconfmsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_netconfmsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_netconfmsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_netlink_diag_msg.gen.test b/tests-m32/nlattr_netlink_diag_msg.gen.test index aa6aabf4..eacc6df4 100755 --- a/tests-m32/nlattr_netlink_diag_msg.gen.test +++ b/tests-m32/nlattr_netlink_diag_msg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_netlink_diag_msg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_netlink_diag_msg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_nlmsgerr.gen.test b/tests-m32/nlattr_nlmsgerr.gen.test index 23df5001..f06ea429 100755 --- a/tests-m32/nlattr_nlmsgerr.gen.test +++ b/tests-m32/nlattr_nlmsgerr.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_nlmsgerr +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_nlmsgerr +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_packet_diag_msg.gen.test b/tests-m32/nlattr_packet_diag_msg.gen.test index 6af8749a..7177ea2a 100755 --- a/tests-m32/nlattr_packet_diag_msg.gen.test +++ b/tests-m32/nlattr_packet_diag_msg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_packet_diag_msg +netlink_sock_diag-v.sh); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_packet_diag_msg +netlink_sock_diag-v.sh ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag-v.sh" diff --git a/tests-m32/nlattr_rtgenmsg.gen.test b/tests-m32/nlattr_rtgenmsg.gen.test index 0ff6d130..37ec8425 100755 --- a/tests-m32/nlattr_rtgenmsg.gen.test +++ b/tests-m32/nlattr_rtgenmsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_rtgenmsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_rtgenmsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_rtmsg.gen.test b/tests-m32/nlattr_rtmsg.gen.test index 55251431..f075529a 100755 --- a/tests-m32/nlattr_rtmsg.gen.test +++ b/tests-m32/nlattr_rtmsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_rtmsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_rtmsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_smc_diag_msg.gen.test b/tests-m32/nlattr_smc_diag_msg.gen.test index 3e6407e5..e64d21e2 100755 --- a/tests-m32/nlattr_smc_diag_msg.gen.test +++ b/tests-m32/nlattr_smc_diag_msg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_smc_diag_msg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_smc_diag_msg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_tc_stats.gen.test b/tests-m32/nlattr_tc_stats.gen.test index 72780d4a..11cadd2d 100755 --- a/tests-m32/nlattr_tc_stats.gen.test +++ b/tests-m32/nlattr_tc_stats.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_tc_stats +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_tc_stats +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_tca_stab.gen.test b/tests-m32/nlattr_tca_stab.gen.test index 14cd1a54..81d36c70 100755 --- a/tests-m32/nlattr_tca_stab.gen.test +++ b/tests-m32/nlattr_tca_stab.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_tca_stab +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_tca_stab +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_tcamsg.gen.test b/tests-m32/nlattr_tcamsg.gen.test index 7c302073..1a6408d9 100755 --- a/tests-m32/nlattr_tcamsg.gen.test +++ b/tests-m32/nlattr_tcamsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_tcamsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_tcamsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_tcmsg.gen.test b/tests-m32/nlattr_tcmsg.gen.test index f5bf7a92..7e70ca26 100755 --- a/tests-m32/nlattr_tcmsg.gen.test +++ b/tests-m32/nlattr_tcmsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_tcmsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_tcmsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nlattr_unix_diag_msg.gen.test b/tests-m32/nlattr_unix_diag_msg.gen.test index d913afc1..fd5b8286 100755 --- a/tests-m32/nlattr_unix_diag_msg.gen.test +++ b/tests-m32/nlattr_unix_diag_msg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_unix_diag_msg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_unix_diag_msg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-m32/nsyscalls-d.c b/tests-m32/nsyscalls-d.c new file mode 100644 index 00000000..1525dea0 --- /dev/null +++ b/tests-m32/nsyscalls-d.c @@ -0,0 +1,2 @@ +#define DEBUG_PRINT 1 +#include "nsyscalls.c" diff --git a/tests-m32/nsyscalls-d.test b/tests-m32/nsyscalls-d.test new file mode 100755 index 00000000..2cca32f1 --- /dev/null +++ b/tests-m32/nsyscalls-d.test @@ -0,0 +1,26 @@ +#!/bin/sh + +# Check decoding of out-of-range syscalls along with debug ouput + +. "${srcdir=.}/init.sh" + +: ${debug_flag=-d} +NAME=nsyscalls-d + +if [ "$MIPS_ABI" = "o32" ]; then + syscall=syscall + [ -z "$debug_flag" ] || + skip_ "mips $MIPS_ABI is not supported by this test yet" +else + syscall=none +fi + +run_strace $debug_flag -e trace=$syscall ../$NAME "$STRACE_EXE" 9 \ + 2> "$LOG-err-all" > "$EXP" 9> "$EXP-err" + +[ -n "$debug_flag" ] || > "$EXP-err" + +grep "invalid syscall" "$LOG-err-all" > "$LOG-err" + +match_diff "$LOG" "$EXP" +match_diff "$LOG-err" "$EXP-err" diff --git a/tests-m32/nsyscalls-nd.test b/tests-m32/nsyscalls-nd.test new file mode 100755 index 00000000..7d2f1e1f --- /dev/null +++ b/tests-m32/nsyscalls-nd.test @@ -0,0 +1,4 @@ +#!/bin/sh + +debug_flag= +. "${srcdir=.}"/nsyscalls-d.test diff --git a/tests-m32/nsyscalls.c b/tests-m32/nsyscalls.c index 29f444a2..9f748673 100644 --- a/tests-m32/nsyscalls.c +++ b/tests-m32/nsyscalls.c @@ -2,7 +2,7 @@ * Check decoding of out-of-range syscalls. * * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,6 +32,7 @@ #include "sysent.h" #include <errno.h> #include <stdio.h> +#include <stdlib.h> #include <unistd.h> #include <asm/unistd.h> @@ -43,6 +44,10 @@ static const struct_sysent syscallent[] = { #include "sysent_shorthand_undefs.h" +#ifndef DEBUG_PRINT +# define DEBUG_PRINT 0 +#endif + #if defined __X32_SYSCALL_BIT && defined __NR_read \ && (__X32_SYSCALL_BIT & __NR_read) != 0 # define SYSCALL_BIT __X32_SYSCALL_BIT @@ -50,6 +55,11 @@ static const struct_sysent syscallent[] = { # define SYSCALL_BIT 0 #endif +#if DEBUG_PRINT +static const char *strace_name; +static FILE *debug_out; +#endif + static void test_syscall(const unsigned long nr) { @@ -64,13 +74,19 @@ test_syscall(const unsigned long nr) long rc = syscall(nr | SYSCALL_BIT, a[0], a[1], a[2], a[3], a[4], a[5]); + +#if DEBUG_PRINT + fprintf(debug_out, "%s: pid %d invalid syscall %#lx\n", + strace_name, getpid(), nr | SYSCALL_BIT); +#endif + #ifdef LINUX_MIPSO32 printf("syscall(%#lx, %#lx, %#lx, %#lx, %#lx, %#lx, %#lx)" " = %ld ENOSYS (%m)\n", nr | SYSCALL_BIT, a[0], a[1], a[2], a[3], a[4], a[5], rc); #else - printf("syscall_%lu(%#llx, %#llx, %#llx, %#llx, %#llx, %#llx)" - " = %ld (errno %d)\n", nr, + printf("syscall_%#lx(%#llx, %#llx, %#llx, %#llx, %#llx, %#llx)" + " = %ld (errno %d)\n", nr | SYSCALL_BIT, (unsigned long long) a[0], (unsigned long long) a[1], (unsigned long long) a[2], @@ -82,8 +98,26 @@ test_syscall(const unsigned long nr) } int -main(void) +main(int argc, char *argv[]) { +#if DEBUG_PRINT + if (argc < 3) + error_msg_and_fail("Not enough arguments. " + "Usage: %s STRACE_NAME DEBUG_OUT_FD", + argv[0]); + + strace_name = argv[1]; + + errno = 0; + int debug_out_fd = strtol(argv[2], NULL, 0); + if (errno) + error_msg_and_fail("Not a number: %s", argv[2]); + + debug_out = fdopen(debug_out_fd, "a"); + if (!debug_out) + perror_msg_and_fail("fdopen: %d", debug_out_fd); +#endif + test_syscall(ARRAY_SIZE(syscallent)); #ifdef SYS_socket_subcall diff --git a/tests-m32/old_mmap-P.c b/tests-m32/old_mmap-P.c new file mode 100644 index 00000000..bb28e889 --- /dev/null +++ b/tests-m32/old_mmap-P.c @@ -0,0 +1,3 @@ +#define TEST_FD 9 +#define PATH_TRACING +#include "old_mmap.c" diff --git a/tests-m32/old_mmap-P.gen.test b/tests-m32/old_mmap-P.gen.test new file mode 100755 index 00000000..b1de9345 --- /dev/null +++ b/tests-m32/old_mmap-P.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (old_mmap-P -e trace=mmap -P "/dev/full" 9>>/dev/full); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -e trace=mmap -P "/dev/full" 9>>/dev/full diff --git a/tests-m32/old_mmap-v-none.c b/tests-m32/old_mmap-v-none.c new file mode 100644 index 00000000..033503cc --- /dev/null +++ b/tests-m32/old_mmap-v-none.c @@ -0,0 +1 @@ +#include "old_mmap.c" diff --git a/tests-m32/old_mmap-v-none.gen.test b/tests-m32/old_mmap-v-none.gen.test new file mode 100755 index 00000000..a568d989 --- /dev/null +++ b/tests-m32/old_mmap-v-none.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (old_mmap-v-none -a11 -e trace=mmap -e verbose=none); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a11 -e trace=mmap -e verbose=none diff --git a/tests-m32/old_mmap.c b/tests-m32/old_mmap.c index 2725fb75..35ec4288 100644 --- a/tests-m32/old_mmap.c +++ b/tests-m32/old_mmap.c @@ -2,6 +2,7 @@ * Check decoding of "old mmap" edition of mmap syscall. * * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,57 +37,64 @@ * it would require additional efforts to filter out mmap calls made by glibc. */ -#if defined __NR_mmap && \ -( defined __arm__ \ - || defined __i386__ \ - || (defined __s390__ && !defined __s390x__) \ -) +#if defined __NR_mmap \ + && (defined __arm__ || defined __i386__ || defined __m68k__ \ + || defined __s390__ || defined __s390x__) \ + && (defined PATH_TRACING || !(defined __s390x__ || defined __m68k__)) # include <stdio.h> # include <string.h> # include <sys/mman.h> # include <unistd.h> +# ifndef TEST_FD +# define TEST_FD -2LU +# endif + int main(void) { long rc = syscall(__NR_mmap, 0); +# ifndef PATH_TRACING printf("mmap(NULL) = %ld %s (%m)\n", rc, errno2name()); +# endif - const unsigned int args1_c[6] = { - 0xdeadbeef, /* addr */ - 0xfacefeed, /* len */ + const unsigned long args1_c[6] = { + (unsigned long) 0xbadc0deddeadbeefULL, /* addr */ + (unsigned long) 0xdeefacedfacefeedULL, /* len */ PROT_READ|PROT_EXEC, /* prot */ MAP_FILE|MAP_FIXED, /* flags */ - -2U, /* fd */ - 0xbadc0ded /* offset */ + TEST_FD, /* fd */ + (unsigned long) 0xdecaffedbadc0dedULL /* offset */ }; - const unsigned int page_size = get_page_size(); - const unsigned int args2_c[6] = { + const unsigned long page_size = get_page_size(); + const unsigned long args2_c[6] = { 0, page_size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, - -1U, - 0xfaced000 & -page_size + -1LU, + (unsigned long) 0xda7a1057faced000ULL & -page_size }; void *args = tail_memdup(args1_c, sizeof(args1_c)); rc = syscall(__NR_mmap, args); - printf("mmap(%#x, %u, PROT_READ|PROT_EXEC, MAP_FILE|MAP_FIXED" - ", %d, %#x) = %ld %s (%m)\n", - args1_c[0], args1_c[1], args1_c[4], args1_c[5], + printf("mmap(%#lx, %lu, PROT_READ|PROT_EXEC, MAP_FILE|MAP_FIXED" + ", %d, %#lx) = %ld %s (%m)\n", + args1_c[0], args1_c[1], (int) args1_c[4], args1_c[5], rc, errno2name()); memcpy(args, args2_c, sizeof(args2_c)); rc = syscall(__NR_mmap, args); - printf("mmap(NULL, %u, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS" - ", %d, %#x) = %#lx\n", - args2_c[1], args2_c[4], args2_c[5], rc); +# ifndef PATH_TRACING + printf("mmap(NULL, %lu, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS" + ", %d, %#lx) = %#lx\n", + args2_c[1], (int) args2_c[4], args2_c[5], rc); +# endif void *addr = (void *) rc; if (mprotect(addr, page_size, PROT_NONE)) - perror_msg_and_fail("mprotect(%p, %u, PROT_NONE)", + perror_msg_and_fail("mprotect(%p, %lu, PROT_NONE)", addr, page_size); puts("+++ exited with 0 +++"); @@ -95,7 +103,9 @@ main(void) #else -SKIP_MAIN_UNDEFINED("__NR_mmap && (__arm__ || __i386__" - " || (__s390__ && !__s390x__))") +SKIP_MAIN_UNDEFINED("defined __NR_mmap " + "&& (defined __arm__ || defined __i386__ || defined __m68k__ " + "|| defined __s390__ || defined __s390x__) " + "&& (defined PATH_TRACING || !(defined __s390x__ || defined __m68k__))") #endif diff --git a/tests-m32/oldselect-P.c b/tests-m32/oldselect-P.c new file mode 100644 index 00000000..67e21343 --- /dev/null +++ b/tests-m32/oldselect-P.c @@ -0,0 +1,2 @@ +#define PATH_TRACING_FD 9 +#include "oldselect.c" diff --git a/tests-m32/oldselect-P.gen.test b/tests-m32/oldselect-P.gen.test new file mode 100755 index 00000000..3486ffd6 --- /dev/null +++ b/tests-m32/oldselect-P.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (oldselect-P -a13 -e trace=select -P /dev/full 9>>/dev/full); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a13 -e trace=select -P /dev/full 9>>/dev/full diff --git a/tests-m32/oldselect-efault-P.c b/tests-m32/oldselect-efault-P.c new file mode 100644 index 00000000..9ebf73d2 --- /dev/null +++ b/tests-m32/oldselect-efault-P.c @@ -0,0 +1,2 @@ +#define PATH_TRACING_FD 9 +#include "oldselect-efault.c" diff --git a/tests-m32/oldselect-efault-P.gen.test b/tests-m32/oldselect-efault-P.gen.test new file mode 100755 index 00000000..a3d71768 --- /dev/null +++ b/tests-m32/oldselect-efault-P.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (oldselect-efault-P -a13 -e trace=select -P /dev/full 9>>/dev/full); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a13 -e trace=select -P /dev/full 9>>/dev/full diff --git a/tests-m32/oldselect-efault.c b/tests-m32/oldselect-efault.c new file mode 100644 index 00000000..3c443341 --- /dev/null +++ b/tests-m32/oldselect-efault.c @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2015-2018 Dmitry V. Levin <ldv@altlinux.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" +#include <asm/unistd.h> + +#if defined __NR_select && defined __NR__newselect \ + && __NR_select != __NR__newselect \ + && !defined __sparc__ + +# include <stdint.h> +# include <stdio.h> +# include <string.h> +# include <unistd.h> +# include <sys/select.h> + +static const char *errstr; + +static long +xselect(const kernel_ulong_t args) +{ + static const kernel_ulong_t dummy = F8ILL_KULONG_MASK | 0xfacefeed; + long rc = syscall(__NR_select, args, dummy, dummy, dummy, dummy, dummy); + errstr = sprintrc(rc); + return rc; +} + +int +main(void) +{ + unsigned long *const args = tail_alloc(sizeof(*args) * 4); + memset(args, 0, sizeof(*args) * 4); + + xselect(0); +#ifndef PATH_TRACING_FD + printf("select(NULL) = %s\n", errstr); +#endif + + xselect((uintptr_t) args); +#ifndef PATH_TRACING_FD + printf("select(%p) = %s\n", args, errstr); +#endif + + puts("+++ exited with 0 +++"); + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_select && __NR__newselect" + " && __NR_select != __NR__newselect" + " && !defined __sparc__") + +#endif diff --git a/tests-m32/oldselect-efault.gen.test b/tests-m32/oldselect-efault.gen.test new file mode 100755 index 00000000..bfeb5571 --- /dev/null +++ b/tests-m32/oldselect-efault.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (oldselect-efault -a13 -e trace=select); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a13 -e trace=select diff --git a/tests-m32/oldselect.c b/tests-m32/oldselect.c index 7413fc33..7f548f81 100644 --- a/tests-m32/oldselect.c +++ b/tests-m32/oldselect.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2015-2018 Dmitry V. Levin <ldv@altlinux.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,37 +30,38 @@ #if defined __NR_select && defined __NR__newselect \ && __NR_select != __NR__newselect \ - && !defined SPARC + && !defined __sparc__ -# include <unistd.h> -# include <sys/select.h> +# define TEST_SYSCALL_NR __NR_select +# define TEST_SYSCALL_STR "select" +# define xselect xselect +# include "xselect.c" -int -main(void) -{ - int fds[2]; - fd_set r = {}, w = {}; - struct timeval timeout = { .tv_sec = 0, .tv_usec = 42 }; - long args[] = { - 2, (long) &r, (long) &w, 0, (long) &timeout, - 0xdeadbeef, 0xbadc0ded, 0xdeadbeef, 0xbadc0ded, 0xdeadbeef - }; - - (void) close(0); - (void) close(1); - if (pipe(fds)) - perror_msg_and_fail("pipe"); +static uint32_t *args; - FD_SET(0, &w); - FD_SET(1, &r); - if (syscall(__NR_select, args)) - perror_msg_and_skip("select"); - - return 0; +static long +xselect(const kernel_ulong_t nfds, + const kernel_ulong_t rs, + const kernel_ulong_t ws, + const kernel_ulong_t es, + const kernel_ulong_t tv) +{ + if (!args) + args = tail_alloc(sizeof(*args) * 5); + args[0] = nfds; + args[1] = rs; + args[2] = ws; + args[3] = es; + args[4] = tv; + long rc = syscall(TEST_SYSCALL_NR, args); + errstr = sprintrc(rc); + return rc; } #else -SKIP_MAIN_UNDEFINED("__NR_select && __NR__newselect") +SKIP_MAIN_UNDEFINED("__NR_select && __NR__newselect" + " && __NR_select != __NR__newselect" + " && !defined __sparc__") #endif diff --git a/tests-m32/oldselect.expected b/tests-m32/oldselect.expected deleted file mode 100644 index d6e7f3c4..00000000 --- a/tests-m32/oldselect.expected +++ /dev/null @@ -1,2 +0,0 @@ -select(2, [1], [0], NULL, {tv_sec=0, tv_usec=42}) = 0 (Timeout) -+++ exited with 0 +++ diff --git a/tests-m32/oldselect.gen.test b/tests-m32/oldselect.gen.test new file mode 100755 index 00000000..1f10cbe3 --- /dev/null +++ b/tests-m32/oldselect.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (oldselect -a13 -e trace=select); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a13 -e trace=select diff --git a/tests-m32/oldselect.test b/tests-m32/oldselect.test deleted file mode 100755 index 35661ad4..00000000 --- a/tests-m32/oldselect.test +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# Check old select syscall decoding. - -. "${srcdir=.}/init.sh" - -run_prog -run_strace -a34 -eselect $args -match_diff - -exit 0 diff --git a/tests-m32/open.c b/tests-m32/open.c index 01e89b0f..fe486c58 100644 --- a/tests-m32/open.c +++ b/tests-m32/open.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,7 +31,7 @@ #ifdef __NR_open -# include <fcntl.h> +# include <asm/fcntl.h> # include <stdio.h> # include <unistd.h> @@ -56,16 +57,11 @@ main(void) sample, sprintrc(fd)); } -#ifdef O_TMPFILE -# if O_TMPFILE == (O_TMPFILE & ~O_DIRECTORY) -# define STR_O_TMPFILE "O_TMPFILE" -# else -# define STR_O_TMPFILE "O_DIRECTORY|O_TMPFILE" -# endif +# ifdef O_TMPFILE fd = syscall(__NR_open, sample, O_WRONLY|O_TMPFILE, 0600); - printf("open(\"%s\", O_WRONLY|%s, 0600) = %s\n", - sample, STR_O_TMPFILE, sprintrc(fd)); -#endif /* O_TMPFILE */ + printf("open(\"%s\", O_WRONLY|O_TMPFILE, 0600) = %s\n", + sample, sprintrc(fd)); +# endif /* O_TMPFILE */ puts("+++ exited with 0 +++"); return 0; diff --git a/tests-m32/openat.c b/tests-m32/openat.c index 1d6765cf..8c97441a 100644 --- a/tests-m32/openat.c +++ b/tests-m32/openat.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2016 Katerina Koukiou <k.koukiou@gmail.com> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -28,17 +29,36 @@ #include "tests.h" #include <asm/unistd.h> -#if defined __NR_openat +#ifdef __NR_openat -# include <fcntl.h> +# include <asm/fcntl.h> # include <stdio.h> # include <unistd.h> +#ifdef O_TMPFILE +/* The kernel & C libraries often inline O_DIRECTORY. */ +# define STRACE_O_TMPFILE (O_TMPFILE & ~O_DIRECTORY) +#else +# define STRACE_O_TMPFILE 0 +#endif + +static const char sample[] = "openat.sample"; + +static void +test_mode_flag(unsigned int mode_val, const char *mode_str, + unsigned int flag_val, const char *flag_str) +{ + long rc = syscall(__NR_openat, -1, sample, mode_val | flag_val, 0); + printf("openat(-1, \"%s\", %s%s%s%s) = %s\n", + sample, mode_str, + flag_val ? "|" : "", flag_str, + flag_val & (O_CREAT | STRACE_O_TMPFILE) ? ", 000" : "", + sprintrc(rc)); +} + int main(void) { - static const char sample[] = "openat.sample"; - long fd = syscall(__NR_openat, -100, sample, O_RDONLY|O_CREAT, 0400); printf("openat(AT_FDCWD, \"%s\", O_RDONLY|O_CREAT, 0400) = %s\n", sample, sprintrc(fd)); @@ -53,6 +73,54 @@ main(void) sample, sprintrc(fd)); } + struct { + unsigned int val; + const char *str; + } modes[] = { + { ARG_STR(O_RDONLY) }, + { ARG_STR(O_WRONLY) }, + { ARG_STR(O_RDWR) }, + { ARG_STR(O_ACCMODE) } + }, flags[] = { + { ARG_STR(O_APPEND) }, + { ARG_STR(O_DIRECT) }, + { ARG_STR(O_DIRECTORY) }, + { ARG_STR(O_EXCL) }, + { ARG_STR(O_LARGEFILE) }, + { ARG_STR(O_NOATIME) }, + { ARG_STR(O_NOCTTY) }, + { ARG_STR(O_NOFOLLOW) }, + { ARG_STR(O_NONBLOCK) }, + { ARG_STR(O_SYNC) }, + { ARG_STR(O_TRUNC) }, + { ARG_STR(O_CREAT) }, +# ifdef O_CLOEXEC + { ARG_STR(O_CLOEXEC) }, +# endif +# ifdef O_DSYNC + { ARG_STR(O_DSYNC) }, +# endif +# ifdef __O_SYNC + { ARG_STR(__O_SYNC) }, +# endif +# ifdef O_PATH + { ARG_STR(O_PATH) }, +# endif +# ifdef O_TMPFILE + { ARG_STR(O_TMPFILE) }, +# endif +# ifdef __O_TMPFILE + { ARG_STR(__O_TMPFILE) }, +# endif + { ARG_STR(0x80000000) }, + { 0, "" } + }; + + for (unsigned int m = 0; m < ARRAY_SIZE(modes); ++m) + for (unsigned int f = 0; f < ARRAY_SIZE(flags); ++f) + test_mode_flag(modes[m].val, modes[m].str, + flags[f].val, flags[f].str); + puts("+++ exited with 0 +++"); return 0; } diff --git a/tests-m32/openat.gen.test b/tests-m32/openat.gen.test index fe29e1ca..29dd3491 100755 --- a/tests-m32/openat.gen.test +++ b/tests-m32/openat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (openat -P $NAME.sample); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (openat -a36 -P $NAME.sample); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -P $NAME.sample +run_strace_match_diff -a36 -P $NAME.sample diff --git a/tests-m32/options-syntax.test b/tests-m32/options-syntax.test index 2e459c96..f81dd992 100755 --- a/tests-m32/options-syntax.test +++ b/tests-m32/options-syntax.test @@ -3,7 +3,7 @@ # Check strace options syntax. # # Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> -# Copyright (c) 2016-2017 The strace developers. +# Copyright (c) 2016-2018 The strace developers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -37,33 +37,10 @@ check_e "Invalid process id: 'a'" -p 1,a check_e "Syscall 'chdir' for -b isn't supported" -b chdir check_e "Syscall 'chdir' for -b isn't supported" -b execve -b chdir -check_e "invalid system call '-1'" -e-1 -check_e "invalid system call '-2'" -e -2 -check_e "invalid system call '-3'" -etrace=-3 -check_e "invalid system call '-4'" -e trace=-4 -check_e "invalid system call '-5'" -e trace=1,-5 -check_e "invalid system call '/non_syscall'" -e trace=/non_syscall -check_e "invalid system call '2147483647'" -e 2147483647 -check_e "invalid system call '2147483648'" -e 2147483648 -check_e "invalid system call '4294967295'" -e 4294967295 -check_e "invalid system call '4294967296'" -e 4294967296 +check_e_using_grep 'exec: File *name too long' "$(printf '%4096s' ' ')" -check_e "invalid descriptor '-1'" -eread=-1 -check_e "invalid descriptor '-42'" -ewrite=-42 -check_e "invalid descriptor '2147483648'" -eread=2147483648 -check_e "invalid descriptor '4294967296'" -ewrite=4294967296 -check_e "invalid descriptor 'foo'" -eread=foo -check_e "invalid descriptor ''" -ewrite= -check_e "invalid descriptor ','" -eread=, -check_e "invalid descriptor '!'" -ewrite='!' -check_e "invalid descriptor '!'" -eread='0,!' -check_e "invalid descriptor '!,'" -ewrite='!,' - -check_e_using_grep 'regcomp: \+id: [[:alpha:]].+' -e trace='/+id' -check_e_using_grep 'regcomp: \*id: [[:alpha:]].+' -e trace='/*id' -check_e_using_grep 'regcomp: \{id: [[:alpha:]].+' -e trace='/{id' -check_e_using_grep 'regcomp: \(id: [[:alpha:]].+' -e trace='/(id' -check_e_using_grep 'regcomp: \[id: [[:alpha:]].+' -e trace='/[id' +ff_name="$(printf '%4084s' ' ')" +check_e_using_grep "$ff_name: File *name too long" -ff -o "$ff_name" true check_h 'must have PROG [ARGS] or -p PID' check_h 'PROG [ARGS] must be specified with -D' -D -p $$ @@ -80,12 +57,12 @@ check_h "invalid -s argument: '-42'" -s -42 check_h "invalid -s argument: '1073741824'" -s 1073741824 check_h "invalid -I argument: '5'" -I 5 -../zeroargc "$strace_exp" /bin/true 2> "$LOG" && +../zeroargc "$STRACE_EXE" /bin/true 2> "$LOG" && dump_log_and_fail_with \ 'zeroargc strace failed to handle the error properly' cat > "$EXP" << __EOF__ -$strace_exp: must have PROG [ARGS] or -p PID -Try '$strace_exp -h' for more information. +$STRACE_EXE: must have PROG [ARGS] or -p PID +Try '$STRACE_EXE -h' for more information. __EOF__ diff -u -- "$EXP" "$LOG" > /dev/null || { cat > "$EXP" <<- '__EOF__' @@ -107,17 +84,17 @@ if [ -n "${UID-}" ]; then for c in i r t T y; do check_e "-$c has no effect with -c -$strace_exp: $umsg" -u :nosuchuser: -c -$c true +$STRACE_EXE: $umsg" -u :nosuchuser: -c -$c true done check_e "-i has no effect with -c -$strace_exp: -r has no effect with -c -$strace_exp: -t has no effect with -c -$strace_exp: -T has no effect with -c -$strace_exp: -y has no effect with -c -$strace_exp: $umsg" -u :nosuchuser: -cirtTy true +$STRACE_EXE: -r has no effect with -c +$STRACE_EXE: -t has no effect with -c +$STRACE_EXE: -T has no effect with -c +$STRACE_EXE: -y has no effect with -c +$STRACE_EXE: $umsg" -u :nosuchuser: -cirtTy true check_e "-tt has no effect with -r -$strace_exp: $umsg" -u :nosuchuser: -r -tt true +$STRACE_EXE: $umsg" -u :nosuchuser: -r -tt true fi args='-p 2147483647' @@ -127,7 +104,7 @@ $STRACE $args 2> "$LOG" && for cmd in PTRACE_SEIZE PTRACE_ATTACH; do cat > "$EXP" << __EOF__ -$strace_exp: attach: ptrace($cmd, 2147483647): No such process +$STRACE_EXE: attach: ptrace($cmd, 2147483647): No such process __EOF__ diff -- "$EXP" "$LOG" || continue diff --git a/tests-m32/osf_utimes.gen.test b/tests-m32/osf_utimes.gen.test index b6be305d..9e683b47 100755 --- a/tests-m32/osf_utimes.gen.test +++ b/tests-m32/osf_utimes.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (osf_utimes -a21); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (osf_utimes -a21 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a21 +run_strace_match_diff -a21 diff --git a/tests-m32/perf_event_open.c b/tests-m32/perf_event_open.c index 74ff9527..667c31f4 100644 --- a/tests-m32/perf_event_open.c +++ b/tests-m32/perf_event_open.c @@ -2,7 +2,7 @@ * Check verbose decoding of perf_event_open syscall. * * Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -102,7 +102,8 @@ struct pea_flags { use_clockid :1, context_switch :1, write_backward :1, - __reserved_1 :36; + namespaces :1, + __reserved_1 :35; }; static const char * @@ -351,9 +352,17 @@ print_event_attr(struct perf_event_attr *attr_ptr, size_t size, # endif printf(", write_backward=%" PRIu64, val); + val = +# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_NAMESPACES + attr->namespaces; +# else + flags_data.flags.namespaces; +# endif + printf(", namespaces=%" PRIu64, val); + val = flags_data.flags.__reserved_1; if (val) - printf(", __reserved_1=%#" PRIx64 " /* Bits 63..28 */", val); + printf(", __reserved_1=%#" PRIx64 " /* Bits 63..29 */", val); printf(", %s=%u", attr->watermark ? "wakeup_watermark" : "wakeup_events", @@ -523,7 +532,8 @@ end: "PERF_SAMPLE_BRANCH_IND_JUMP|" \ "PERF_SAMPLE_BRANCH_CALL|" \ "PERF_SAMPLE_BRANCH_NO_FLAGS|" \ - "PERF_SAMPLE_BRANCH_NO_CYCLES" + "PERF_SAMPLE_BRANCH_NO_CYCLES|" \ + "PERF_SAMPLE_BRANCH_TYPE_SAVE" int main(void) @@ -608,7 +618,7 @@ main(void) static const struct u64_val_str sample_types[] = { { ARG_STR(0) }, { 0x800, "PERF_SAMPLE_BRANCH_STACK" }, - { ARG_ULL_STR(0xdeadc0deda780000) " /* PERF_SAMPLE_??? */" }, + { ARG_ULL_STR(0xdeadc0deda700000) " /* PERF_SAMPLE_??? */" }, { 0xffffffffffffffffULL, "PERF_SAMPLE_IP|PERF_SAMPLE_TID|PERF_SAMPLE_TIME|" "PERF_SAMPLE_ADDR|PERF_SAMPLE_READ|" @@ -618,7 +628,8 @@ main(void) "PERF_SAMPLE_REGS_USER|PERF_SAMPLE_STACK_USER|" "PERF_SAMPLE_WEIGHT|PERF_SAMPLE_DATA_SRC|" "PERF_SAMPLE_IDENTIFIER|PERF_SAMPLE_TRANSACTION|" - "PERF_SAMPLE_REGS_INTR|0xfffffffffff80000" }, + "PERF_SAMPLE_REGS_INTR|PERF_SAMPLE_PHYS_ADDR|" + "0xfffffffffff00000" }, }; static const struct u64_val_str read_formats[] = { { ARG_STR(0) }, @@ -650,11 +661,11 @@ main(void) static const struct u64_val_str branch_sample_types[] = { { ARG_STR(0) }, { 0x80, "PERF_SAMPLE_BRANCH_ABORT_TX" }, - { 0xffff, BRANCH_TYPE_ALL }, - { ARG_ULL_STR(0xdeadcaffeeed0000) + { 0x1ffff, BRANCH_TYPE_ALL }, + { ARG_ULL_STR(0xdeadcaffeeec0000) " /* PERF_SAMPLE_BRANCH_??? */" }, { 0xffffffffffffffffULL, - BRANCH_TYPE_ALL "|0xffffffffffff0000" } + BRANCH_TYPE_ALL "|0xfffffffffffe0000" } }; static const struct s32_val_str clockids[] = { { 11, "CLOCK_TAI" }, diff --git a/tests-m32/perf_event_open.gen.test b/tests-m32/perf_event_open.gen.test index 85336c3e..02d468ab 100755 --- a/tests-m32/perf_event_open.gen.test +++ b/tests-m32/perf_event_open.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (perf_event_open -a1); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (perf_event_open -a1 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a1 +run_strace_match_diff -a1 diff --git a/tests-m32/pipe2.gen.test b/tests-m32/pipe2.gen.test index 5a06c030..50b8fd64 100755 --- a/tests-m32/pipe2.gen.test +++ b/tests-m32/pipe2.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pipe2 -a15); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pipe2 -a15 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a15 +run_strace_match_diff -a15 diff --git a/tests-m32/pkey_alloc.c b/tests-m32/pkey_alloc.c index 45772787..4a0aa720 100644 --- a/tests-m32/pkey_alloc.c +++ b/tests-m32/pkey_alloc.c @@ -2,6 +2,7 @@ * Check decoding of pkey_alloc syscall. * * Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,10 +54,12 @@ main(void) sizeof(kernel_ulong_t) > sizeof(int) ? "PKEY_DISABLE_WRITE|0xbadc0ded00000000" : "PKEY_DISABLE_WRITE" }, - { 0xdec0ded, "PKEY_DISABLE_ACCESS|0xdec0dec" }, - { 0x3, "PKEY_DISABLE_ACCESS|PKEY_DISABLE_WRITE" }, + { 0xdec0ded, "PKEY_DISABLE_ACCESS|PKEY_DISABLE_EXECUTE|" + "0xdec0de8" }, + { 0x7, "PKEY_DISABLE_ACCESS|PKEY_DISABLE_WRITE|" + "PKEY_DISABLE_EXECUTE" }, { ARG_STR(0) }, - { 0xbadc0dec, "0xbadc0dec /* PKEY_??? */" }, + { 0xbadc0de8, "0xbadc0de8 /* PKEY_??? */" }, }; long rc; diff --git a/tests-m32/pkey_alloc.gen.test b/tests-m32/pkey_alloc.gen.test index b3e58692..fb554efc 100755 --- a/tests-m32/pkey_alloc.gen.test +++ b/tests-m32/pkey_alloc.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pkey_alloc -a17); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pkey_alloc -a17 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a17 +run_strace_match_diff -a17 diff --git a/tests-m32/pkey_free.gen.test b/tests-m32/pkey_free.gen.test index 588d1aa6..0374cc73 100755 --- a/tests-m32/pkey_free.gen.test +++ b/tests-m32/pkey_free.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pkey_free -a13); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pkey_free -a13 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a13 +run_strace_match_diff -a13 diff --git a/tests-m32/pkey_mprotect.gen.test b/tests-m32/pkey_mprotect.gen.test index 14be2311..11a902a5 100755 --- a/tests-m32/pkey_mprotect.gen.test +++ b/tests-m32/pkey_mprotect.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pkey_mprotect -a37); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pkey_mprotect -a37 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a37 +run_strace_match_diff -a37 diff --git a/tests-m32/poll-P.c b/tests-m32/poll-P.c new file mode 100644 index 00000000..7bbeb795 --- /dev/null +++ b/tests-m32/poll-P.c @@ -0,0 +1,2 @@ +#define PATH_TRACING_FD 9 +#include "poll.c" diff --git a/tests-m32/poll-P.test b/tests-m32/poll-P.test new file mode 100755 index 00000000..a1905723 --- /dev/null +++ b/tests-m32/poll-P.test @@ -0,0 +1,17 @@ +#!/bin/sh + +# Check path tracing of poll syscall. + +. "${srcdir=.}/init.sh" + +run_prog > /dev/null +run_strace -a16 -vepoll -P /dev/full 9>>/dev/full \ + $args > "$EXP" +match_diff "$LOG" "$EXP" + +for abbrev in 0 1 2 3 4 5; do + run_prog "../$NAME" $abbrev > /dev/null + run_strace -a16 -epoll -s$abbrev -P /dev/full 9>>/dev/full \ + $args > "$EXP" + match_diff "$LOG" "$EXP" +done diff --git a/tests-m32/poll.c b/tests-m32/poll.c index 2bf8c1a1..c5930a3e 100644 --- a/tests-m32/poll.c +++ b/tests-m32/poll.c @@ -1,8 +1,7 @@ /* - * This file is part of poll strace test. + * Check decoding of poll syscall. * - * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 Dmitry V. Levin <ldv@altlinux.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,6 +37,7 @@ # include <poll.h> # include <stdio.h> # include <stdlib.h> +# include <string.h> # include <unistd.h> #define PRINT_EVENT(flag, member) \ @@ -163,12 +163,19 @@ print_pollfd_array_exiting(const struct pollfd *const pfd, int main(int ac, char **av) { +# ifdef PATH_TRACING_FD + skip_if_unavailable("/proc/self/fd/"); +# endif + tprintf("%s", ""); assert(syscall(__NR_poll, NULL, 42, 0) == -1); if (ENOSYS == errno) perror_msg_and_skip("poll"); + +# ifndef PATH_TRACING_FD tprintf("poll(NULL, 42, 0) = -1 EFAULT (%m)\n"); +# endif int fds[2]; if (pipe(fds) || pipe(fds)) @@ -187,11 +194,14 @@ main(int ac, char **av) int rc = syscall(__NR_poll, tail_fds0, 0, timeout); assert(rc == 0); +# ifndef PATH_TRACING_FD tprintf("poll([], 0, %d) = %d (Timeout)\n", timeout, rc); +# endif rc = syscall(__NR_poll, tail_fds0, ARRAY_SIZE(pfds0), timeout); assert(rc == 3); +# ifndef PATH_TRACING_FD tprintf("poll("); print_pollfd_array_entering(tail_fds0, ARRAY_SIZE(pfds0), ARRAY_SIZE(pfds0), abbrev); @@ -199,6 +209,7 @@ main(int ac, char **av) (unsigned int) ARRAY_SIZE(pfds0), timeout, rc); print_pollfd_array_exiting(tail_fds0, ARRAY_SIZE(pfds0), abbrev); tprintf(")\n"); +# endif /* !PATH_TRACING_FD */ tail_fds0[0].fd = -1; tail_fds0[2].fd = -3; @@ -206,6 +217,7 @@ main(int ac, char **av) rc = syscall(__NR_poll, tail_fds0, ARRAY_SIZE(pfds0), timeout); assert(rc == 2); +# ifndef PATH_TRACING_FD tprintf("poll("); print_pollfd_array_entering(tail_fds0, ARRAY_SIZE(pfds0), ARRAY_SIZE(pfds0), abbrev); @@ -213,12 +225,14 @@ main(int ac, char **av) (unsigned int) ARRAY_SIZE(pfds0), timeout, rc); print_pollfd_array_exiting(tail_fds0, ARRAY_SIZE(pfds0), abbrev); tprintf(")\n"); +# endif /* !PATH_TRACING_FD */ tail_fds0[1].fd = -2; tail_fds0[4].fd = -5; rc = syscall(__NR_poll, tail_fds0, ARRAY_SIZE(pfds0), timeout); assert(rc == 1); +# ifndef PATH_TRACING_FD tprintf("poll("); print_pollfd_array_entering(tail_fds0, ARRAY_SIZE(pfds0), ARRAY_SIZE(pfds0), abbrev); @@ -226,6 +240,7 @@ main(int ac, char **av) (unsigned int) ARRAY_SIZE(pfds0), timeout, rc); print_pollfd_array_exiting(tail_fds0, ARRAY_SIZE(pfds0), abbrev); tprintf(")\n"); +# endif /* !PATH_TRACING_FD */ struct pollfd pfds1[] = { { .fd = 1, .events = POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND }, @@ -235,25 +250,58 @@ main(int ac, char **av) rc = syscall(__NR_poll, tail_fds1, ARRAY_SIZE(pfds1), timeout); assert(rc == 0); +# ifndef PATH_TRACING_FD tprintf("poll("); print_pollfd_array_entering(tail_fds1, ARRAY_SIZE(pfds1), ARRAY_SIZE(pfds1), abbrev); tprintf(", %u, %d) = %d (Timeout)\n", (unsigned int) ARRAY_SIZE(pfds1), timeout, rc); +# endif /* !PATH_TRACING_FD */ const void *const efault = tail_fds0 + ARRAY_SIZE(pfds0); rc = syscall(__NR_poll, efault, 1, 0); assert(rc == -1); + +# ifndef PATH_TRACING_FD tprintf("poll(%p, 1, 0) = -1 EFAULT (%m)\n", efault); +# endif const unsigned int valid = 1; const void *const epfds = tail_fds0 + ARRAY_SIZE(pfds0) - valid; rc = syscall(__NR_poll, epfds, valid + 1, 0); assert(rc == -1); + +# ifndef PATH_TRACING_FD + tprintf("poll("); + print_pollfd_array_entering(epfds, valid + 1, valid, abbrev); + errno = EFAULT; + tprintf(", %u, 0) = -1 EFAULT (%m)\n", valid + 1); +# endif /* !PATH_TRACING_FD */ + +# ifdef PATH_TRACING_FD + memcpy(tail_fds0, pfds0, sizeof(pfds0)); + tail_fds0[4].fd = PATH_TRACING_FD; + + rc = syscall(__NR_poll, tail_fds0, ARRAY_SIZE(pfds0), timeout); + assert(rc == 3); + + tprintf("poll("); + print_pollfd_array_entering(tail_fds0, ARRAY_SIZE(pfds0), + ARRAY_SIZE(pfds0), abbrev); + tprintf(", %u, %d) = %d (", + (unsigned int) ARRAY_SIZE(pfds0), timeout, rc); + print_pollfd_array_exiting(tail_fds0, ARRAY_SIZE(pfds0), abbrev); + tprintf(")\n"); + + rc = syscall(__NR_poll, epfds, valid + 1, 0); + assert(rc == -1); + + /* the 1st pollfd element is readable and contains PATH_TRACING_FD */ tprintf("poll("); print_pollfd_array_entering(epfds, valid + 1, valid, abbrev); errno = EFAULT; tprintf(", %u, 0) = -1 EFAULT (%m)\n", valid + 1); +# endif /* PATH_TRACING_FD */ tprintf("+++ exited with 0 +++\n"); return 0; diff --git a/tests-m32/ppoll-P.c b/tests-m32/ppoll-P.c new file mode 100644 index 00000000..c2c572e2 --- /dev/null +++ b/tests-m32/ppoll-P.c @@ -0,0 +1,2 @@ +#define PATH_TRACING_FD 9 +#include "ppoll.c" diff --git a/tests-m32/ppoll-P.gen.test b/tests-m32/ppoll-P.gen.test new file mode 100755 index 00000000..25a97048 --- /dev/null +++ b/tests-m32/ppoll-P.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ppoll-P -s2 -e trace=ppoll -P /dev/full 9>>/dev/full); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -s2 -e trace=ppoll -P /dev/full 9>>/dev/full diff --git a/tests-m32/ppoll.c b/tests-m32/ppoll.c index 62241839..b33f9593 100644 --- a/tests-m32/ppoll.c +++ b/tests-m32/ppoll.c @@ -1,7 +1,7 @@ /* * Check decoding of ppoll syscall. * - * Copyright (c) 2015-2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2015-2018 Dmitry V. Levin <ldv@altlinux.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -56,6 +56,10 @@ sys_ppoll(const kernel_ulong_t ufds, int main(void) { +# ifdef PATH_TRACING_FD + skip_if_unavailable("/proc/self/fd/"); +# endif + static const kernel_ulong_t bogus_nfds = (kernel_ulong_t) 0xdeadbeeffacefeedULL; static const kernel_ulong_t bogus_sigsetsize = @@ -76,28 +80,36 @@ main(void) sys_ppoll(0, bogus_nfds, 0, 0, bogus_sigsetsize); if (ENOSYS == errno) perror_msg_and_skip("ppoll"); +# ifndef PATH_TRACING_FD printf("ppoll(NULL, %u, NULL, NULL, %llu) = %s\n", (unsigned) bogus_nfds, (unsigned long long) bogus_sigsetsize, errstr); +# endif sys_ppoll((unsigned long) efault, 42, (unsigned long) efault + 8, (unsigned long) efault + 16, sigset_size); +# ifndef PATH_TRACING_FD printf("ppoll(%p, %u, %p, %p, %u) = %s\n", efault, 42, efault + 8, efault + 16, sigset_size, errstr); +# endif ts->tv_sec = 0xdeadbeefU; ts->tv_nsec = 0xfacefeedU; sys_ppoll(0, 0, (unsigned long) ts, 0, sigset_size); +# ifndef PATH_TRACING_FD printf("ppoll(NULL, 0, {tv_sec=%lld, tv_nsec=%llu}, NULL, %u) = %s\n", (long long) ts->tv_sec, zero_extend_signed_to_ull(ts->tv_nsec), sigset_size, errstr); +# endif ts->tv_sec = (time_t) 0xcafef00ddeadbeefLL; ts->tv_nsec = (long) 0xbadc0dedfacefeedL; sys_ppoll(0, 0, (unsigned long) ts, 0, sigset_size); +# ifndef PATH_TRACING_FD printf("ppoll(NULL, 0, {tv_sec=%lld, tv_nsec=%llu}, NULL, %u) = %s\n", (long long) ts->tv_sec, zero_extend_signed_to_ull(ts->tv_nsec), sigset_size, errstr); +# endif if (pipe(pipe_fd) || pipe(pipe_fd + 2)) perror_msg_and_fail("pipe"); @@ -124,24 +136,56 @@ main(void) (unsigned long) sigmask, sigset_size); if (rc != 2) perror_msg_and_fail("ppoll 1"); +# ifndef PATH_TRACING_FD printf("ppoll([{fd=%d, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}" ", {fd=%d, events=POLLOUT%s|POLLWRBAND}" -#if VERBOSE +# if VERBOSE ", {fd=%d, events=POLLIN|POLLPRI}, {fd=%d, events=POLLOUT}]" -#else +# else ", ...]" -#endif +# endif ", %u, {tv_sec=42, tv_nsec=999999999}, [%s], %u) = %ld" " ([{fd=%d, revents=POLLOUT%s}, {fd=%d, revents=POLLOUT}]" ", left {tv_sec=%u, tv_nsec=%u})\n", pipe_fd[0], pipe_fd[1], POLLWRNORM_str, -#if VERBOSE +# if VERBOSE pipe_fd[2], pipe_fd[3], -#endif +# endif (unsigned int) ARRAY_SIZE(fds1), USR2_CHLD_str, (unsigned int) sigset_size, rc, pipe_fd[1], POLLWRNORM_str, pipe_fd[3], (unsigned int) ts->tv_sec, (unsigned int) ts->tv_nsec); +# endif /* !PATH_TRACING_FD */ + +# ifdef PATH_TRACING_FD + ts->tv_sec = 123; + ts->tv_nsec = 987654321; + fds[3].fd = PATH_TRACING_FD; + + rc = sys_ppoll((unsigned long) fds, + F8ILL_KULONG_MASK | ARRAY_SIZE(fds1), (unsigned long) ts, + (unsigned long) sigmask, sigset_size); + if (rc != 2) + perror_msg_and_fail("ppoll -P"); + printf("ppoll([{fd=%d, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}" + ", {fd=%d, events=POLLOUT%s|POLLWRBAND}" +# if VERBOSE + ", {fd=%d, events=POLLIN|POLLPRI}, {fd=%d, events=POLLOUT}]" +# else + ", ...]" +# endif + ", %u, {tv_sec=123, tv_nsec=987654321}, [%s], %u) = %ld" + " ([{fd=%d, revents=POLLOUT%s}, {fd=%d, revents=POLLOUT}]" + ", left {tv_sec=%u, tv_nsec=%u})\n", + pipe_fd[0], pipe_fd[1], POLLWRNORM_str, +# if VERBOSE + pipe_fd[2], PATH_TRACING_FD, +# endif + (unsigned int) ARRAY_SIZE(fds1), USR2_CHLD_str, + (unsigned int) sigset_size, rc, pipe_fd[1], POLLWRNORM_str, + PATH_TRACING_FD, (unsigned int) ts->tv_sec, + (unsigned int) ts->tv_nsec); +# endif /* PATH_TRACING_FD */ ts->tv_sec = 0; ts->tv_nsec = 999; @@ -163,23 +207,27 @@ main(void) (unsigned long) sigmask, sigset_size); if (rc != 0) perror_msg_and_fail("ppoll 2"); +# ifndef PATH_TRACING_FD printf("ppoll([{fd=%d, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}" ", {fd=%d, events=POLLOUT%s|POLLWRBAND}], %u" ", {tv_sec=0, tv_nsec=999}, ~[HUP KILL STOP], %u)" " = %ld (Timeout)\n", pipe_fd[1], pipe_fd[0], POLLWRNORM_str, (unsigned) ARRAY_SIZE(fds2), sigset_size, rc); +# endif /* !PATH_TRACING_FD */ if (F8ILL_KULONG_SUPPORTED) { sys_ppoll(f8ill_ptr_to_kulong(fds), ARRAY_SIZE(fds2), f8ill_ptr_to_kulong(ts), f8ill_ptr_to_kulong(sigmask), sigset_size); +# ifndef PATH_TRACING_FD printf("ppoll(%#llx, %u, %#llx, %#llx, %u) = %s\n", (unsigned long long) f8ill_ptr_to_kulong(fds), (unsigned) ARRAY_SIZE(fds2), (unsigned long long) f8ill_ptr_to_kulong(ts), (unsigned long long) f8ill_ptr_to_kulong(sigmask), (unsigned) sigset_size, errstr); +# endif /* !PATH_TRACING_FD */ } puts("+++ exited with 0 +++"); diff --git a/tests-m32/ppoll.gen.test b/tests-m32/ppoll.gen.test index 4c075989..120e9536 100755 --- a/tests-m32/ppoll.gen.test +++ b/tests-m32/ppoll.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ppoll -s2); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ppoll -s2 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -s2 +run_strace_match_diff -s2 diff --git a/tests-m32/prctl-dumpable.c b/tests-m32/prctl-dumpable.c index 1049bcee..52c16680 100644 --- a/tests-m32/prctl-dumpable.c +++ b/tests-m32/prctl-dumpable.c @@ -3,6 +3,7 @@ * * Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com> * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,7 +33,8 @@ #include <asm/unistd.h> #include <linux/prctl.h> -#if defined __NR_prctl && defined PR_GET_DUMPABLE && defined PR_SET_DUMPABLE +#if defined __NR_prctl && defined PR_GET_DUMPABLE && defined PR_SET_DUMPABLE \ + && !defined __ia64__ # include <stdio.h> # include <unistd.h> @@ -101,6 +103,7 @@ main(void) #else -SKIP_MAIN_UNDEFINED("__NR_prctl && PR_GET_DUMPABLE && PR_SET_DUMPABLE") +SKIP_MAIN_UNDEFINED("__NR_prctl && PR_GET_DUMPABLE && PR_SET_DUMPABLE" + " && !__ia64__") #endif diff --git a/tests-m32/preadv.gen.test b/tests-m32/preadv.gen.test index 8fb7b540..c3fabe6f 100755 --- a/tests-m32/preadv.gen.test +++ b/tests-m32/preadv.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (preadv -a21); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (preadv -a21 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a21 +run_strace_match_diff -a21 diff --git a/tests-m32/print_user_desc.c b/tests-m32/print_user_desc.c new file mode 100644 index 00000000..2dac3879 --- /dev/null +++ b/tests-m32/print_user_desc.c @@ -0,0 +1,78 @@ +/* + * Auxiliary printing function for the struct user_desc type. + * Used by modify_ldt and xet_thread_area tests. + * + * Copyright (c) 2018 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" + +#ifdef HAVE_STRUCT_USER_DESC + +# include <asm/ldt.h> + +/** + * Print user_desc structure. + * + * @param us Pointer to struct user_desc to print. + * @param entry_str If not NULL, the string is printed as a value of + * entry_number field. + */ +static void +print_user_desc(struct user_desc *us, const char *entry_str) +{ + if (entry_str) + printf("{entry_number=%s", entry_str); + else + printf("{entry_number=%u", us->entry_number); + + printf(", base_addr=%#08x" + ", limit=%#08x" + ", seg_32bit=%u" + ", contents=%u" + ", read_exec_only=%u" + ", limit_in_pages=%u" + ", seg_not_present=%u" + ", useable=%u" +# ifdef __x86_64__ + ", lm=%u" +# endif + "}", + us->base_addr, + us->limit, + us->seg_32bit, + us->contents, + us->read_exec_only, + us->limit_in_pages, + us->seg_not_present, + us->useable +# ifdef __x86_64__ + , us->lm +# endif + ); +} + +#endif /* HAVE_STRUCT_USER_DESC */ diff --git a/tests-m32/printpath-umovestr.c b/tests-m32/printpath-umovestr.c index a7251e5e..0d5955ff 100644 --- a/tests-m32/printpath-umovestr.c +++ b/tests-m32/printpath-umovestr.c @@ -2,6 +2,7 @@ * Test regular printpath/umovestr. * * Copyright (c) 2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2017-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,8 +30,8 @@ #include "tests.h" #include "test_ucopy.h" +#include <limits.h> #include <stdio.h> -#include <sys/param.h> int main(void) diff --git a/tests-m32/prlimit64.gen.test b/tests-m32/prlimit64.gen.test index 11964a5e..2c94fc9d 100755 --- a/tests-m32/prlimit64.gen.test +++ b/tests-m32/prlimit64.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (prlimit64 ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (prlimit64 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/pselect6.gen.test b/tests-m32/pselect6.gen.test index c89e7054..29d38963 100755 --- a/tests-m32/pselect6.gen.test +++ b/tests-m32/pselect6.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pselect6 ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pselect6 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/ptrace.c b/tests-m32/ptrace.c index d776dcdd..c70d5689 100644 --- a/tests-m32/ptrace.c +++ b/tests-m32/ptrace.c @@ -2,7 +2,7 @@ * Check decoding of ptrace syscall. * * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,12 +32,12 @@ #include <asm/unistd.h> #include <errno.h> +#include "ptrace.h" #include <signal.h> #include <stdio.h> #include <string.h> #include <sys/wait.h> #include <unistd.h> -#include "ptrace.h" #include <linux/audit.h> static const char *errstr; diff --git a/tests-m32/pure_executables.am b/tests-m32/pure_executables.am index 2cae9ae5..128028fe 100644 --- a/tests-m32/pure_executables.am +++ b/tests-m32/pure_executables.am @@ -104,6 +104,7 @@ PURE_EXECUTABLES = \ ioctl_block \ ioctl_dm \ ioctl_evdev \ + ioctl_kvm_run \ ioctl_loop \ ioctl_mtd \ ioctl_rtc \ @@ -154,6 +155,7 @@ PURE_EXECUTABLES = \ mmap64 \ mmsg \ mmsg_name \ + modify_ldt \ mount \ move_pages \ mq \ @@ -223,9 +225,12 @@ PURE_EXECUTABLES = \ nlattr_tcmsg \ nlattr_unix_diag_msg \ old_mmap \ + old_mmap-P \ + old_mmap-v-none \ oldfstat \ oldlstat \ oldselect \ + oldselect-efault \ oldstat \ open \ openat \ @@ -239,7 +244,9 @@ PURE_EXECUTABLES = \ pkey_free \ pkey_mprotect \ poll \ + poll-P \ ppoll \ + ppoll-P \ prctl-arg2-intptr \ prctl-dumpable \ prctl-name \ @@ -282,6 +289,7 @@ PURE_EXECUTABLES = \ renameat \ renameat2 \ request_key \ + riscv_flush_icache \ rmdir \ rt_sigaction \ rt_sigpending \ @@ -291,6 +299,12 @@ PURE_EXECUTABLES = \ rt_sigsuspend \ rt_sigtimedwait \ rt_tgsigqueueinfo \ + s390_guarded_storage \ + s390_guarded_storage-v \ + s390_pci_mmio_read_write \ + s390_runtime_instr \ + s390_sthyi \ + s390_sthyi-v \ sched_get_priority_mxx \ sched_rr_get_interval \ sched_xetaffinity \ @@ -342,6 +356,7 @@ PURE_EXECUTABLES = \ so_peercred \ sock_filter-v \ socketcall \ + sockopt-sol_netlink \ splice \ stat \ stat64 \ @@ -393,6 +408,7 @@ PURE_EXECUTABLES = \ xattr \ xattr-strings \ xet_robust_list \ + xet_thread_area_x86 \ xetitimer \ xetpgid \ xetpriority \ diff --git a/tests-m32/pure_executables.list b/tests-m32/pure_executables.list index d98b17db..2f602a93 100755 --- a/tests-m32/pure_executables.list +++ b/tests-m32/pure_executables.list @@ -103,6 +103,7 @@ ioctl ioctl_block ioctl_dm ioctl_evdev +ioctl_kvm_run ioctl_loop ioctl_mtd ioctl_rtc @@ -153,6 +154,7 @@ mmap mmap64 mmsg mmsg_name +modify_ldt mount move_pages mq @@ -222,9 +224,12 @@ nlattr_tcamsg nlattr_tcmsg nlattr_unix_diag_msg old_mmap +old_mmap-P +old_mmap-v-none oldfstat oldlstat oldselect +oldselect-efault oldstat open openat @@ -238,7 +243,9 @@ pkey_alloc pkey_free pkey_mprotect poll +poll-P ppoll +ppoll-P prctl-arg2-intptr prctl-dumpable prctl-name @@ -281,6 +288,7 @@ rename renameat renameat2 request_key +riscv_flush_icache rmdir rt_sigaction rt_sigpending @@ -290,6 +298,12 @@ rt_sigreturn rt_sigsuspend rt_sigtimedwait rt_tgsigqueueinfo +s390_guarded_storage +s390_guarded_storage-v +s390_pci_mmio_read_write +s390_runtime_instr +s390_sthyi +s390_sthyi-v sched_get_priority_mxx sched_rr_get_interval sched_xetaffinity @@ -341,6 +355,7 @@ so_linger so_peercred sock_filter-v socketcall +sockopt-sol_netlink splice stat stat64 @@ -392,6 +407,7 @@ waitpid xattr xattr-strings xet_robust_list +xet_thread_area_x86 xetitimer xetpgid xetpriority diff --git a/tests-m32/qual_fault-syntax.test b/tests-m32/qual_fault-syntax.test index 0cce539a..43ade769 100755 --- a/tests-m32/qual_fault-syntax.test +++ b/tests-m32/qual_fault-syntax.test @@ -2,7 +2,7 @@ # # Check -e fault= syntax. # -# Copyright (c) 2016-2017 Dmitry V. Levin <ldv@altlinux.org> +# Copyright (c) 2016-2018 Dmitry V. Levin <ldv@altlinux.org> # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -40,16 +40,7 @@ fail_with() "strace -e fault=$* failed to handle an argument error properly" } -for arg in '' , ,, ,,, : :: ::: \! \!, \!: \ - invalid_syscall_name \ - invalid_syscall_name:when=3 \ - -1 \!-1 \ - -1:when=4 \ - -2 \ - -2:when=5 \ - 32767 \!32767 \ - 32767:when=6 \ - chdir:42 \!chdir:42 \ +for arg in chdir:42 \!chdir:42 \ chdir:42:when=7 \ chdir:invalid \ chdir:invalid:when=8 \ @@ -92,12 +83,6 @@ for arg in '' , ,, ,,, : :: ::: \! \!, \!: \ chdir:when=65536:error=30 \ chdir:when=1+65536 \ chdir:when=1+65536:error=31 \ - file,nonsense \ - \!desc,nonsense \ - chdir,nonsense \ - \!chdir,nonsense \ - 1,nonsense \ - \!1,nonsense \ chdir:retval=0 \ chdir:signal=1 \ chdir:error=1:error=2 \ diff --git a/tests-m32/qual_fault.c b/tests-m32/qual_fault.c index 05401dec..670d9fe7 100644 --- a/tests-m32/qual_fault.c +++ b/tests-m32/qual_fault.c @@ -2,7 +2,7 @@ * Check that fault injection works properly. * * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,11 +33,11 @@ #include <assert.h> #include <errno.h> #include <fcntl.h> +#include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <sys/param.h> #include <sys/stat.h> #include <sys/uio.h> #include <sys/wait.h> diff --git a/tests-m32/qual_inject-syntax.test b/tests-m32/qual_inject-syntax.test index 7aa61809..46cead28 100755 --- a/tests-m32/qual_inject-syntax.test +++ b/tests-m32/qual_inject-syntax.test @@ -2,7 +2,7 @@ # # Check -e inject= syntax. # -# Copyright (c) 2016-2017 Dmitry V. Levin <ldv@altlinux.org> +# Copyright (c) 2016-2018 Dmitry V. Levin <ldv@altlinux.org> # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -40,17 +40,7 @@ fail_with() "strace -e inject=$* failed to handle an argument error properly" } -for arg in '' , ,, ,,, : :: ::: \! \!, \!: \ - invalid_syscall_name \ - invalid_syscall_name:when=3 \ - -1 \!-1 \ - -1:when=4 \ - -2 \ - -2:when=5 \ - 32767 \!32767 \ - 32767:when=6 \ - 42 \ - chdir \ +for arg in 42 chdir \ chdir:42 \!chdir:42 \ chdir:42:when=7 \ chdir:invalid \ @@ -94,12 +84,6 @@ for arg in '' , ,, ,,, : :: ::: \! \!, \!: \ chdir:when=65536:error=30 \ chdir:when=1+65536 \ chdir:when=1+65536:error=31 \ - file,nonsense \ - \!desc,nonsense \ - chdir,nonsense \ - \!chdir,nonsense \ - 1,nonsense \ - \!1,nonsense \ chdir:retval=-1 \ chdir:signal=0 \ chdir:signal=129 \ diff --git a/tests-m32/quotactl.gen.test b/tests-m32/quotactl.gen.test index c6ad6e1e..6d2dc754 100755 --- a/tests-m32/quotactl.gen.test +++ b/tests-m32/quotactl.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (quotactl ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (quotactl ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/readahead.gen.test b/tests-m32/readahead.gen.test index 4e88efa6..c27ab0d0 100755 --- a/tests-m32/readahead.gen.test +++ b/tests-m32/readahead.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readahead -a1); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readahead -a1 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a1 +run_strace_match_diff -a1 diff --git a/tests-m32/readdir.gen.test b/tests-m32/readdir.gen.test index 10da83b2..09aad4f6 100755 --- a/tests-m32/readdir.gen.test +++ b/tests-m32/readdir.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readdir -a16); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readdir -a16 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a16 +run_strace_match_diff -a16 diff --git a/tests-m32/readlink.gen.test b/tests-m32/readlink.gen.test index 755fc8b3..42632341 100755 --- a/tests-m32/readlink.gen.test +++ b/tests-m32/readlink.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readlink -xx); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readlink -xx ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -xx +run_strace_match_diff -xx diff --git a/tests-m32/readlinkat.gen.test b/tests-m32/readlinkat.gen.test index 2a502999..d7de9932 100755 --- a/tests-m32/readlinkat.gen.test +++ b/tests-m32/readlinkat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readlinkat -xx); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readlinkat -xx ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -xx +run_strace_match_diff -xx diff --git a/tests-m32/reboot.c b/tests-m32/reboot.c index ce651dc7..3f819ce8 100644 --- a/tests-m32/reboot.c +++ b/tests-m32/reboot.c @@ -10,21 +10,83 @@ # define INVALID_MAGIC 319887762 # define INVALID_CMD 0x01234568 +# define STR32 "AbCdEfGhIjKlMnOpQrStUvWxYz012345" +# define STR128 STR32 STR32 STR32 STR32 + int main(void) { + static const kernel_ulong_t bogus_magic1 = + (kernel_ulong_t) 0xFFFFFFFFFFFFFFFFULL; + static const kernel_ulong_t bogus_magic2 = + (kernel_ulong_t) 0xdeadfacefa57beefULL; + static const kernel_ulong_t bogus_cmd = + (kernel_ulong_t) 0xbadda7a09caffee1ULL; static const char buf[] = "reboot"; - long rc = syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, + static const char str256_buf[] = STR128 STR128; + + long rc; + char *str256 = tail_memdup(str256_buf, sizeof(str256_buf) - 1); + + rc = syscall(__NR_reboot, 0, 0, 0, 0); + printf("reboot(0 /* LINUX_REBOOT_MAGIC_??? */, " + "0 /* LINUX_REBOOT_MAGIC_??? */, " + "LINUX_REBOOT_CMD_CAD_OFF) = %s\n", + sprintrc(rc)); + + rc = syscall(__NR_reboot, bogus_magic1, bogus_magic2, bogus_cmd, -1); + printf("reboot(%#x /* LINUX_REBOOT_MAGIC_??? */, " + "%#x /* LINUX_REBOOT_MAGIC_??? */, " + "%#x /* LINUX_REBOOT_CMD_??? */) = %s\n", + (unsigned int) bogus_magic1, (unsigned int) bogus_magic2, + (unsigned int) bogus_cmd, sprintrc(rc)); + + rc = syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, INVALID_MAGIC, LINUX_REBOOT_CMD_RESTART2, buf); printf("reboot(LINUX_REBOOT_MAGIC1, %#x /* LINUX_REBOOT_MAGIC_??? */," - " LINUX_REBOOT_CMD_RESTART2, \"%s\") = %ld %s (%m)\n", - INVALID_MAGIC, buf, rc, errno2name()); + " LINUX_REBOOT_CMD_RESTART2, \"%s\") = %s\n", + INVALID_MAGIC, buf, sprintrc(rc)); rc = syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, INVALID_CMD); printf("reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2," - " %#x /* LINUX_REBOOT_CMD_??? */) = %ld %s (%m)\n", - INVALID_CMD, rc, errno2name()); + " %#x /* LINUX_REBOOT_CMD_??? */) = %s\n", + INVALID_CMD, sprintrc(rc)); + + rc = syscall(__NR_reboot, INVALID_MAGIC, LINUX_REBOOT_MAGIC2A, + LINUX_REBOOT_CMD_RESTART2, str256); + printf("reboot(%#x /* LINUX_REBOOT_MAGIC_??? */, LINUX_REBOOT_MAGIC2A, " + "LINUX_REBOOT_CMD_RESTART2, \"%.255s\"...) = %s\n", + INVALID_MAGIC, str256, sprintrc(rc)); + + rc = syscall(__NR_reboot, INVALID_MAGIC, LINUX_REBOOT_MAGIC2B, + LINUX_REBOOT_CMD_RESTART2, str256 + 1); + printf("reboot(%#x /* LINUX_REBOOT_MAGIC_??? */, LINUX_REBOOT_MAGIC2B, " + "LINUX_REBOOT_CMD_RESTART2, \"%.255s\"...) = %s\n", + INVALID_MAGIC, str256 + 1, sprintrc(rc)); + + rc = syscall(__NR_reboot, INVALID_MAGIC, LINUX_REBOOT_MAGIC2C, + LINUX_REBOOT_CMD_RESTART2, str256 + 2); + printf("reboot(%#x /* LINUX_REBOOT_MAGIC_??? */, LINUX_REBOOT_MAGIC2C, " + "LINUX_REBOOT_CMD_RESTART2, %p) = %s\n", + INVALID_MAGIC, str256 + 2, sprintrc(rc)); + + str256[255] = '\0'; + rc = syscall(__NR_reboot, INVALID_MAGIC, bogus_magic1, + LINUX_REBOOT_CMD_RESTART2, str256); + printf("reboot(%#x /* LINUX_REBOOT_MAGIC_??? */, " + "%#x /* LINUX_REBOOT_MAGIC_??? */, " + "LINUX_REBOOT_CMD_RESTART2, \"%.255s\"...) = %s\n", + INVALID_MAGIC, (unsigned int) bogus_magic1, str256, + sprintrc(rc)); + + rc = syscall(__NR_reboot, INVALID_MAGIC, bogus_magic1, + LINUX_REBOOT_CMD_RESTART2, str256 + 1); + printf("reboot(%#x /* LINUX_REBOOT_MAGIC_??? */, " + "%#x /* LINUX_REBOOT_MAGIC_??? */, " + "LINUX_REBOOT_CMD_RESTART2, \"%.254s\") = %s\n", + INVALID_MAGIC, (unsigned int) bogus_magic1, str256 + 1, + sprintrc(rc)); puts("+++ exited with 0 +++"); return 0; diff --git a/tests-m32/reboot.gen.test b/tests-m32/reboot.gen.test index 0a48dea7..06d2f0cb 100755 --- a/tests-m32/reboot.gen.test +++ b/tests-m32/reboot.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (reboot ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (reboot -s 256); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff -s 256 diff --git a/tests-m32/recvfrom.gen.test b/tests-m32/recvfrom.gen.test index c23780c9..2741d210 100755 --- a/tests-m32/recvfrom.gen.test +++ b/tests-m32/recvfrom.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (recvfrom -a35); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (recvfrom -a35 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a35 +run_strace_match_diff -a35 diff --git a/tests-m32/remap_file_pages.c b/tests-m32/remap_file_pages.c index 452d2de7..4e409630 100644 --- a/tests-m32/remap_file_pages.c +++ b/tests-m32/remap_file_pages.c @@ -1,7 +1,7 @@ /* * Check decoding of remap_file_pages syscall. * - * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2017 Dmitry V. Levin <ldv@altlinux.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,22 +33,62 @@ #ifdef __NR_remap_file_pages # include <stdio.h> -# include <sys/mman.h> +# include <stdint.h> # include <unistd.h> +# include <linux/mman.h> + +static const char *errstr; + +static long +k_remap_file_pages(const kernel_ulong_t addr, + const kernel_ulong_t size, + const kernel_ulong_t prot, + const kernel_ulong_t pgoff, + const kernel_ulong_t flags) +{ + const long rc = syscall(__NR_remap_file_pages, + addr, size, prot, pgoff, flags); + errstr = sprintrc(rc); + return rc; +} int main(void) { - const unsigned long addr = (unsigned long) 0xfacefeeddeadbeefULL; - const unsigned long size = (unsigned long) 0xdefaced1bad2f00dULL; - const unsigned long prot = PROT_READ|PROT_WRITE|PROT_EXEC; - const unsigned long pgoff = (unsigned long) 0xcaf3babebad4deedULL; - const unsigned long flags = MAP_PRIVATE|MAP_ANONYMOUS; - - long rc = syscall(__NR_remap_file_pages, addr, size, prot, pgoff, flags); - printf("remap_file_pages(%#lx, %lu, %s, %lu, %s) = %ld %s (%m)\n", - addr, size, "PROT_READ|PROT_WRITE|PROT_EXEC", pgoff, - "MAP_PRIVATE|MAP_ANONYMOUS", rc, errno2name()); + kernel_ulong_t addr = (kernel_ulong_t) 0xfacefeeddeadbeefULL; + kernel_ulong_t size = (kernel_ulong_t) 0xdefaced1bad2f00dULL; + kernel_ulong_t prot = PROT_READ|PROT_WRITE|PROT_EXEC; + kernel_ulong_t pgoff = (kernel_ulong_t) 0xcaf3babebad4deedULL; + kernel_ulong_t flags = MAP_PRIVATE|MAP_ANONYMOUS; + + k_remap_file_pages(addr, size, prot, pgoff, flags); + printf("remap_file_pages(%#jx, %ju, %s, %ju, %s) = %s\n", + (uintmax_t) addr, (uintmax_t) size, + "PROT_READ|PROT_WRITE|PROT_EXEC", + (uintmax_t) pgoff, "MAP_PRIVATE|MAP_ANONYMOUS", errstr); + +#ifdef MAP_HUGETLB +# ifndef MAP_HUGE_2MB +# ifndef MAP_HUGE_SHIFT +# define MAP_HUGE_SHIFT 26 +# endif +# define MAP_HUGE_2MB (21 << MAP_HUGE_SHIFT) +# endif /* !MAP_HUGE_2MB */ + addr = (kernel_ulong_t) 0xfacefeeddeadf00dULL; + size = (kernel_ulong_t) 0xdefaced1bad2beefULL; + prot = (kernel_ulong_t) 0xdefaced00000000ULL | PROT_NONE; + flags = MAP_TYPE | MAP_FIXED | MAP_NORESERVE | MAP_HUGETLB | MAP_HUGE_2MB; + + k_remap_file_pages(addr, size, prot, pgoff, flags); + printf("remap_file_pages(%#jx, %ju, %s, %ju" + ", %#x /* MAP_??? */" + "|MAP_FIXED|MAP_NORESERVE|MAP_HUGETLB|21<<MAP_HUGE_SHIFT)" + " = %s\n", + (uintmax_t) addr, (uintmax_t) size, + prot == PROT_NONE ? "PROT_NONE" : + "0xdefaced00000000 /* PROT_??? */", + (uintmax_t) pgoff, MAP_TYPE, errstr); +#endif /* MAP_HUGETLB */ puts("+++ exited with 0 +++"); return 0; diff --git a/tests-m32/remap_file_pages.gen.test b/tests-m32/remap_file_pages.gen.test index e4894736..b3589886 100755 --- a/tests-m32/remap_file_pages.gen.test +++ b/tests-m32/remap_file_pages.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (remap_file_pages ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (remap_file_pages ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/rename.gen.test b/tests-m32/rename.gen.test index 07f01801..81fb0398 100755 --- a/tests-m32/rename.gen.test +++ b/tests-m32/rename.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rename -a35); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rename -a35 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a35 +run_strace_match_diff -a35 diff --git a/tests-m32/renameat.gen.test b/tests-m32/renameat.gen.test index f2879cdc..dbc6e05b 100755 --- a/tests-m32/renameat.gen.test +++ b/tests-m32/renameat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (renameat ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (renameat ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/renameat2.gen.test b/tests-m32/renameat2.gen.test index cd7c34ca..78251cb2 100755 --- a/tests-m32/renameat2.gen.test +++ b/tests-m32/renameat2.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (renameat2 ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (renameat2 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/riscv_flush_icache.c b/tests-m32/riscv_flush_icache.c new file mode 100644 index 00000000..8aaeda51 --- /dev/null +++ b/tests-m32/riscv_flush_icache.c @@ -0,0 +1,93 @@ +/* + * Check decoding of riscv_flush_icache syscall. + * + * Copyright (c) 2018 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" + +#include <asm/unistd.h> + +#include "scno.h" + +#ifdef __NR_riscv_flush_icache + +# include <stdint.h> +# include <stdio.h> +# include <unistd.h> + +int main(void) +{ + static struct { + kernel_ulong_t addr; + const char *str; + } addrs[] = { + { (kernel_ulong_t) (uintptr_t) ARG_STR(NULL) }, + { (kernel_ulong_t) 0xbadc0deddeadf157ULL, + sizeof(kernel_ulong_t) == 8 ? "0xbadc0deddeadf157" : + "0xdeadf157" }, + }; + static struct { + kernel_ulong_t val; + const char *str; + } flags[] = { + { ARG_STR(0) }, + { 1, "SYS_RISCV_FLUSH_ICACHE_LOCAL" }, + { (kernel_ulong_t) 0xfacefeedfffffffeULL, + sizeof(kernel_ulong_t) == 8 ? + "0xfacefeedfffffffe /* SYS_RISCV_FLUSH_ICACHE_??? */" : + "0xfffffffe /* SYS_RISCV_FLUSH_ICACHE_??? */" }, + { (kernel_ulong_t) 0xfacefeedffffffffULL, + sizeof(kernel_ulong_t) == 8 ? + "SYS_RISCV_FLUSH_ICACHE_LOCAL|0xfacefeedfffffffe" : + "SYS_RISCV_FLUSH_ICACHE_LOCAL|0xfffffffe" }, + }; + + for (size_t i = 0; i < ARRAY_SIZE(addrs); i++) { + for (size_t j = 0; j < ARRAY_SIZE(addrs); j++) { + for (size_t k = 0; k < ARRAY_SIZE(flags); k++) { + long rc = syscall(__NR_riscv_flush_icache, + addrs[i].addr, + addrs[j].addr, + flags[k].val); + + printf("riscv_flush_icache(%s, %s, %s) = %s\n", + addrs[i].str, addrs[j].str, flags[k].str, + sprintrc(rc)); + } + } + } + + puts("+++ exited with 0 +++"); + + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_riscv_flush_icache"); + +#endif diff --git a/tests-m32/riscv_flush_icache.gen.test b/tests-m32/riscv_flush_icache.gen.test new file mode 100755 index 00000000..1a1f793a --- /dev/null +++ b/tests-m32/riscv_flush_icache.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (riscv_flush_icache -a34 ); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a34 diff --git a/tests-m32/rmdir.gen.test b/tests-m32/rmdir.gen.test index b511039d..8b346af9 100755 --- a/tests-m32/rmdir.gen.test +++ b/tests-m32/rmdir.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rmdir -a22); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rmdir -a22 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a22 +run_strace_match_diff -a22 diff --git a/tests-m32/rt_sigpending.gen.test b/tests-m32/rt_sigpending.gen.test index 0458876b..d52858af 100755 --- a/tests-m32/rt_sigpending.gen.test +++ b/tests-m32/rt_sigpending.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigpending -a20); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigpending -a20 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a20 +run_strace_match_diff -a20 diff --git a/tests-m32/rt_sigprocmask.gen.test b/tests-m32/rt_sigprocmask.gen.test index a21c6dbb..67fcdc0f 100755 --- a/tests-m32/rt_sigprocmask.gen.test +++ b/tests-m32/rt_sigprocmask.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigprocmask ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigprocmask ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/rt_sigqueueinfo.gen.test b/tests-m32/rt_sigqueueinfo.gen.test index 7baf0e48..d11eecc0 100755 --- a/tests-m32/rt_sigqueueinfo.gen.test +++ b/tests-m32/rt_sigqueueinfo.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigqueueinfo -esignal=none); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigqueueinfo -esignal=none ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -esignal=none +run_strace_match_diff -esignal=none diff --git a/tests-m32/rt_sigreturn.gen.test b/tests-m32/rt_sigreturn.gen.test index 0672f113..d8b153e3 100755 --- a/tests-m32/rt_sigreturn.gen.test +++ b/tests-m32/rt_sigreturn.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigreturn -esignal='!USR1'); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigreturn -esignal='!USR1' ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -esignal='!USR1' +run_strace_match_diff -esignal='!USR1' diff --git a/tests-m32/rt_sigtimedwait.gen.test b/tests-m32/rt_sigtimedwait.gen.test index 2b18e7af..a9409ae9 100755 --- a/tests-m32/rt_sigtimedwait.gen.test +++ b/tests-m32/rt_sigtimedwait.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigtimedwait -a38); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigtimedwait -a38 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a38 +run_strace_match_diff -a38 diff --git a/tests-m32/rt_tgsigqueueinfo.gen.test b/tests-m32/rt_tgsigqueueinfo.gen.test index 407bbffa..0539e35a 100755 --- a/tests-m32/rt_tgsigqueueinfo.gen.test +++ b/tests-m32/rt_tgsigqueueinfo.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_tgsigqueueinfo -esignal=none); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_tgsigqueueinfo -esignal=none ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -esignal=none +run_strace_match_diff -esignal=none diff --git a/tests-m32/run.sh b/tests-m32/run.sh index d1b796ca..208aa0f9 100755 --- a/tests-m32/run.sh +++ b/tests-m32/run.sh @@ -9,4 +9,9 @@ TIMEOUT="timeout -k 5 -s XCPU $TIMEOUT_DURATION" $TIMEOUT true > /dev/null 2>&1 || TIMEOUT= -exec $TIMEOUT "$@" +if [ $# -eq 0 ]; then + echo 'No command or test-file specified' >&2 + exit 1 +fi + +exec $TIMEOUT "$@" < /dev/null diff --git a/tests-m32/s390_guarded_storage-v.c b/tests-m32/s390_guarded_storage-v.c new file mode 100644 index 00000000..05afd9fe --- /dev/null +++ b/tests-m32/s390_guarded_storage-v.c @@ -0,0 +1,2 @@ +#define VERBOSE 1 +#include "s390_guarded_storage.c" diff --git a/tests-m32/s390_guarded_storage-v.gen.test b/tests-m32/s390_guarded_storage-v.gen.test new file mode 100755 index 00000000..045ff762 --- /dev/null +++ b/tests-m32/s390_guarded_storage-v.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (s390_guarded_storage-v -e trace=s390_guarded_storage -a32 -v); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -e trace=s390_guarded_storage -a32 -v diff --git a/tests-m32/s390_guarded_storage.c b/tests-m32/s390_guarded_storage.c new file mode 100644 index 00000000..ab67c158 --- /dev/null +++ b/tests-m32/s390_guarded_storage.c @@ -0,0 +1,229 @@ +/* + * Check decoding of s390_guarded_storage syscall. + * + * Copyright (c) 2018 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" +#include <asm/unistd.h> + +#if defined __NR_s390_guarded_storage && defined HAVE_ASM_GUARDED_STORAGE_H + +# include <inttypes.h> +# include <stdbool.h> +# include <stdint.h> +# include <stdio.h> +# include <unistd.h> + +# include <asm/guarded_storage.h> + +# ifndef VERBOSE +# define VERBOSE 0 +# endif + +static void +gs_no_arg(kernel_ulong_t val, const char *val_str) +{ + static const kernel_ulong_t bogus_addr = + (kernel_ulong_t) 0xcaffeedadeadbed5ULL; + static const kernel_ulong_t bogus_cmd_mask = + (kernel_ulong_t) 0xbadc0ded00000000ULL; + long rc; + + rc = syscall(__NR_s390_guarded_storage, val | bogus_cmd_mask, + bogus_addr); + printf("s390_guarded_storage(%s) = %s\n", val_str, sprintrc(rc)); +} + +static void +gs_print_epl(uint64_t addr, bool valid, const char *str) +{ + if (!valid) { + if (str) + printf("%s", str); + else + printf("%#" PRIx64, addr); + + return; + } + + struct gs_epl *gsepl = (struct gs_epl *) (uintptr_t) addr; + + printf("[{"); + +# if VERBOSE + if (gsepl->pad1) + printf("pad1=%#02x, ", gsepl->pad1); + + printf("gs_eam=%#02x /* extended addressing mode: %u, " + "basic addressing mode: %u */" + ", gs_eci=%#02x /* CPU in TX: %u, CPU in CX: %u, " + "instruction: %s */" + ", gs_eai=%#02x /* DAT: %u, address space indication: %u, " + "AR number: %u */, ", + gsepl->gs_eam, gsepl->e, gsepl->b, + gsepl->gs_eci, gsepl->tx, gsepl->cx, + gsepl->in ? "LLGFGS": "LGG", + gsepl->gs_eai, gsepl->t, gsepl->as, gsepl->ar); + + if (gsepl->pad2) + printf("pad2=%#08x, ", gsepl->pad2); +# endif /* VERBOSE */ + + printf("gs_eha=%#llx, ", (unsigned long long) gsepl->gs_eha); + +# if VERBOSE + printf("gs_eia=%#llx, gs_eoa=%#llx, gs_eir=%#llx, gs_era=%#llx", + (unsigned long long) gsepl->gs_eia, + (unsigned long long) gsepl->gs_eoa, + (unsigned long long) gsepl->gs_eir, + (unsigned long long) gsepl->gs_era); +# else /* !VERBOSE */ + printf("..."); +# endif /* VERBOSE */ + + printf("}]"); +} + +static void +gs_set_cb(kernel_ulong_t addr, bool valid, bool epl_valid, + const char *bc_str, const char *epl_str) +{ + static const kernel_ulong_t bogus_cmd_mask = + (kernel_ulong_t) 0xda7a105700000000ULL; + + long rc; + + printf("s390_guarded_storage(GS_SET_BC_CB, "); + + if (valid) { + struct gs_cb *gscb = (struct gs_cb *) (uintptr_t) addr; + + printf("{"); + + if (gscb->reserved) + printf("reserved=%#016llx, ", + (unsigned long long) gscb->reserved); + + printf("gsd=%#16llx", + (unsigned long long) gscb->gsd); +# if VERBOSE + printf(" /* GS origin: "); + + unsigned int gsc = gscb->gsd & 0x3F; + unsigned int gls = (gscb->gsd >> 8) & 7; + bool gsc_valid = gsc >= 25 && gsc <= 56; + + if (gsc_valid) { + uint64_t gls = gscb->gsd >> gsc; + int field_size = 2 + (67 - gsc) / 4; + + printf("%#0*" PRIx64, field_size, gls); + } else { + printf("[invalid]"); + } + + printf(", guard load shift: %u, GS characteristic: %u */", + gls, gsc); +# endif /* VERBOSE */ + + printf(", gssm=%#016llx, gs_epl_a=", + (unsigned long long) gscb->gssm); + + gs_print_epl(gscb->gs_epl_a, epl_valid, epl_str); + + printf("}"); + } else { + if (bc_str) + printf("%s", bc_str); + else + printf("%#llx", (unsigned long long) addr); + } + + rc = syscall(__NR_s390_guarded_storage, + GS_SET_BC_CB | bogus_cmd_mask, addr); + printf(") = %s\n", sprintrc(rc)); +} + +int +main(void) +{ + static const kernel_ulong_t bogus_cmd = + (kernel_ulong_t) 0xdeafbeefdeadc0deULL; + static const kernel_ulong_t bogus_addr = + (kernel_ulong_t) 0xfacefeedac0ffeedULL; + + struct gs_cb *gscb = tail_alloc(sizeof(*gscb)); + struct gs_epl *gsepl = tail_alloc(sizeof(*gsepl)); + + long rc; + + rc = syscall(__NR_s390_guarded_storage, 5, 0); + printf("s390_guarded_storage(0x5 /* GS_??? */, NULL) = %s\n", + sprintrc(rc)); + + rc = syscall(__NR_s390_guarded_storage, bogus_cmd, bogus_addr); + printf("s390_guarded_storage(%#x /* GS_??? */, %#lx) = %s\n", + (unsigned) bogus_cmd, (unsigned long) bogus_addr, sprintrc(rc)); + + gs_no_arg(ARG_STR(GS_BROADCAST)); + gs_no_arg(ARG_STR(GS_CLEAR_BC_CB)); + gs_no_arg(ARG_STR(GS_DISABLE)); + gs_no_arg(ARG_STR(GS_ENABLE)); + + fill_memory(gscb, sizeof(*gscb)); + fill_memory_ex(gsepl, sizeof(*gsepl), 0xA5, 0x5A); + + gs_set_cb(0, false, false, "NULL", NULL); + gs_set_cb((uintptr_t) (gscb + 1), false, false, NULL, NULL); + + gscb->gs_epl_a = 0; + gs_set_cb((uintptr_t) gscb, true, false, NULL, "NULL"); + + fill_memory_ex(gscb, sizeof(*gscb), 0x5A, 0xA5); + gscb->gs_epl_a = (uintptr_t) (gsepl + 1) | + (sizeof(kernel_ulong_t) < sizeof(uint64_t) ? + 0xc0debad000000000ULL : 0); + gs_set_cb((uintptr_t) gscb, true, false, NULL, NULL); + + fill_memory_ex(gscb, sizeof(*gscb), 0xA7, 0xA5); + gscb->gs_epl_a = (uintptr_t) gsepl; + gs_set_cb((uintptr_t) gscb, true, true, NULL, NULL); + + fill_memory_ex(gscb, sizeof(*gscb), 0x55, 0xAA); + fill_memory_ex(gsepl, sizeof(*gsepl), 0x5A, 0xA5); + gscb->gs_epl_a = (uintptr_t) gsepl; + gs_set_cb((uintptr_t) gscb, true, true, NULL, NULL); + + puts("+++ exited with 0 +++"); + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_s390_guarded_storage && HAVE_ASM_GUARDED_STORAGE_H") + +#endif diff --git a/tests-m32/s390_guarded_storage.gen.test b/tests-m32/s390_guarded_storage.gen.test new file mode 100755 index 00000000..28b59814 --- /dev/null +++ b/tests-m32/s390_guarded_storage.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (s390_guarded_storage -a32 ); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a32 diff --git a/tests-m32/s390_pci_mmio_read_write.c b/tests-m32/s390_pci_mmio_read_write.c new file mode 100644 index 00000000..b493948d --- /dev/null +++ b/tests-m32/s390_pci_mmio_read_write.c @@ -0,0 +1,155 @@ +/* + * Check decoding of s390_pci_mmio_read and s390_pci_mmio_write syscalls. + * + * Copyright (c) 2018 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" +#include <asm/unistd.h> + +#if defined __NR_s390_pci_mmio_read && defined __NR_s390_pci_mmio_write + +# include <errno.h> +# include <stdbool.h> +# include <stdint.h> +# include <stdio.h> +# include <unistd.h> + +static void +do_call(bool wr, kernel_ulong_t mmio_addr, kernel_ulong_t buf, + kernel_ulong_t len, bool buf_valid, const char *buf_str) +{ + long saved_errno = 0; + long rc = 0; + + printf("s390_pci_mmio_%s(%#llx, ", wr ? "write" : "read", + (unsigned long long) mmio_addr); + + if (!wr) { + rc = syscall(__NR_s390_pci_mmio_read, mmio_addr, buf, len); + saved_errno = errno; + } + + if (buf_valid && !rc) { + char *buf_ptr = (char *) (uintptr_t) buf; + + print_quoted_hex(buf_ptr, + len > DEFAULT_STRLEN ? DEFAULT_STRLEN : len); + + if (len > DEFAULT_STRLEN) + printf("..."); + } else { + if (buf_str) + printf("%s", buf_str); + else + printf("%#llx", (unsigned long long) buf); + } + + printf(", %llu) = ", (unsigned long long) len); + + if (wr) + rc = syscall(__NR_s390_pci_mmio_write, mmio_addr, buf, len); + else + errno = saved_errno; + + puts(sprintrc(rc)); +} + +int +main(void) +{ + static const size_t buf_size = DEFAULT_STRLEN + 10; + + char *buf = tail_alloc(buf_size); + + bool bools[] = { true, false }; + + kernel_ulong_t addrs[] = { + 0, + (kernel_ulong_t) 0xdeafbeefdeadc0deULL, + }; + + struct { + kernel_ulong_t buf; + const char *str; + size_t size; + } bufs[] = { + { (kernel_ulong_t) ARG_STR(NULL), 0 }, + { (kernel_ulong_t) (buf + buf_size), NULL, 0 }, + { (kernel_ulong_t) (buf), NULL, buf_size }, + { (kernel_ulong_t) (buf + 9), NULL, buf_size - 9 }, + { (kernel_ulong_t) (buf + 10), NULL, buf_size - 10 }, + { (kernel_ulong_t) (buf + 16), NULL, buf_size - 16 }, + { (kernel_ulong_t) (buf + 26), NULL, buf_size - 26 }, + { (kernel_ulong_t) (buf + 28), NULL, buf_size - 28 }, + }; + + kernel_ulong_t sizes[] = { + 0, + DEFAULT_STRLEN / 2, + DEFAULT_STRLEN - 10, + DEFAULT_STRLEN, + DEFAULT_STRLEN + 1, + buf_size, + buf_size + 10, + (kernel_ulong_t) 0xfacefeedac0ffeedULL, + }; + + unsigned int i, j, k, l; + unsigned int ctr = 0; + + for (i = 0; i < ARRAY_SIZE(addrs); i++) { + for (j = 0; j < ARRAY_SIZE(bufs); j++) { + for (k = 0; k < ARRAY_SIZE(sizes); k++) { + for (l = 0; l < ARRAY_SIZE(bools); l++) { + bool valid = bufs[j].buf && + bufs[j].size >= + MIN(sizes[k], + DEFAULT_STRLEN + 1); + + if (bufs[j].size && bools[l]) + fill_memory_ex((char *) buf, + bufs[j].size, + 0xC0 + ctr, 255); + + do_call(bools[l], addrs[i], bufs[j].buf, + sizes[k], valid, bufs[j].str); + + ctr++; + } + } + } + } + + puts("+++ exited with 0 +++"); + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_s390_pci_mmio_read && __NR_s390_pci_mmio_write"); + +#endif diff --git a/tests-m32/s390_pci_mmio_read_write.gen.test b/tests-m32/s390_pci_mmio_read_write.gen.test new file mode 100755 index 00000000..cf32e0b3 --- /dev/null +++ b/tests-m32/s390_pci_mmio_read_write.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (s390_pci_mmio_read_write -e trace=s390_pci_mmio_read,s390_pci_mmio_write -a30); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -e trace=s390_pci_mmio_read,s390_pci_mmio_write -a30 diff --git a/tests-m32/s390_runtime_instr.c b/tests-m32/s390_runtime_instr.c new file mode 100644 index 00000000..861bbd4a --- /dev/null +++ b/tests-m32/s390_runtime_instr.c @@ -0,0 +1,99 @@ +/* + * Check decoding of s390_runtime_instr syscall. + * + * Copyright (c) 2018 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" +#include <asm/unistd.h> + +#if defined __NR_s390_runtime_instr + +# include <errno.h> +# include <signal.h> +# include <stdio.h> +# include <unistd.h> + +int +main(void) +{ + static struct { + kernel_ulong_t cmd; + const char * cmd_str; + } cmd_args[] = { + { 0, "???" }, + { 4, "???" }, + { (kernel_ulong_t) 0xdeafbeefdeadc0deULL, "???" }, + { 2, "STOP", }, + }; + + static struct { + kernel_ulong_t sig; + const char * sig_str; + } start_sig_args[] = { + { 0, "SIG_0" }, + { (kernel_ulong_t) 0xfacefeedac0ffeedULL, NULL }, + { ARG_STR(SIGALRM) }, + { 33, "SIGRT_1" }, + { 63, "SIGRT_31" }, + }; + + unsigned int i; + long rc; + + for (i = 0; i < ARRAY_SIZE(cmd_args); i++) { + rc = syscall(__NR_s390_runtime_instr, cmd_args[i].cmd, 0xdead); + printf("s390_runtime_instr(%d /* S390_RUNTIME_INSTR_%s */) = " + "%s\n", + (int) cmd_args[i].cmd, cmd_args[i].cmd_str, + sprintrc(rc)); + } + + for (i = 0; i < ARRAY_SIZE(start_sig_args); i++) { + long saved_errno; + + rc = syscall(__NR_s390_runtime_instr, 1, start_sig_args[i].sig); + saved_errno = errno; + printf("s390_runtime_instr(1 /* S390_RUNTIME_INSTR_START */, "); + + if (start_sig_args[i].sig_str) + printf("%s", start_sig_args[i].sig_str); + else + printf("%d", (int) start_sig_args[i].sig); + + errno = saved_errno; + printf(") = %s\n", sprintrc(rc)); + } + + puts("+++ exited with 0 +++"); + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_s390_runtime_instr") + +#endif diff --git a/tests-m32/s390_runtime_instr.gen.test b/tests-m32/s390_runtime_instr.gen.test new file mode 100755 index 00000000..9197dc33 --- /dev/null +++ b/tests-m32/s390_runtime_instr.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (s390_runtime_instr -a50 ); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a50 diff --git a/tests-m32/s390_sthyi-v.c b/tests-m32/s390_sthyi-v.c new file mode 100644 index 00000000..86055203 --- /dev/null +++ b/tests-m32/s390_sthyi-v.c @@ -0,0 +1,2 @@ +#define VERBOSE 1 +#include "s390_sthyi.c" diff --git a/tests-m32/s390_sthyi-v.gen.test b/tests-m32/s390_sthyi-v.gen.test new file mode 100755 index 00000000..27ab447b --- /dev/null +++ b/tests-m32/s390_sthyi-v.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (s390_sthyi-v -e trace=s390_sthyi -a47 -v); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -e trace=s390_sthyi -a47 -v diff --git a/tests-m32/s390_sthyi.c b/tests-m32/s390_sthyi.c new file mode 100644 index 00000000..8b241dd2 --- /dev/null +++ b/tests-m32/s390_sthyi.c @@ -0,0 +1,786 @@ +/* + * Check decoding of s390_sthyi syscall. + * + * Copyright (c) 2018 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" +#include <asm/unistd.h> + +#if defined HAVE_ICONV_H && defined HAVE_ICONV_OPEN && defined __NR_s390_sthyi + +# include <errno.h> +# include <iconv.h> +# include <inttypes.h> +# include <stdbool.h> +# include <stdint.h> +# include <stdio.h> +# include <unistd.h> + +# include <sys/user.h> + +# define EBCDIC_MAX_LEN 16 + +# ifndef VERBOSE +# define VERBOSE 0 +# endif + +static bool +print_0x8(const char *prefix, unsigned char *buf, unsigned int offs, bool zero) +{ + if (!zero && !buf[offs]) + return false; + + printf("%s=%#02hhx", prefix, buf[offs]); + + return true; +} + +static bool +print_u8(const char *prefix, unsigned char *buf, unsigned int offs, bool zero) +{ + if (!zero && !buf[offs]) + return false; + + printf("%s=%hhu", prefix, buf[offs]); + + return true; +} + +static bool +print_u16(const char *prefix, unsigned char *buf, unsigned int offs, bool zero) +{ + uint16_t val = *(uint16_t *) (buf + offs); + + if (!zero && !val) + return false; + + printf("%s=%" PRIu16, prefix, val); + + return true; +} + +static bool +print_x32(const char *prefix, unsigned char *buf, unsigned int offs, bool zero) +{ + uint32_t val = *(uint32_t *) (buf + offs); + + if (!zero && !val) + return false; + + printf("%s=%#" PRIx32, prefix, val); + + return true; +} + +static bool +print_weight(const char *prefix, unsigned char *buf, unsigned int offs, + bool zero) +{ + uint32_t val = *(uint32_t *) (buf + offs); + + if (print_x32(prefix, buf, offs, zero)) { + if (val) + printf(" /* %u %u/65536 cores */", + val >> 16, val & 0xFFFF); + else + printf(" /* unlimited */"); + + return true; + } + + return false; +} + +static char * +ebcdic2ascii(unsigned char *ebcdic, size_t size) +{ + static char ascii_buf[EBCDIC_MAX_LEN]; + + char *ebcdic_pos = (char *) ebcdic; + char *ascii_pos = ascii_buf; + size_t ebcdic_left = size; + size_t ascii_left = size; + size_t ret; + + iconv_t cd = iconv_open("ASCII", "EBCDICUS"); + + if (size > sizeof(ascii_buf)) + error_msg_and_fail("ebcdic2ascii: EBCDIC string is too big: " + "%zu (maximum is %zu)", + size, sizeof(ascii_buf)); + if (cd == (iconv_t) -1) + perror_msg_and_fail("ebcdic2ascii: unable to allocate a " + "conversion descriptior for converting " + "EBCDIC to ASCII"); + + while ((ret = iconv(cd, &ebcdic_pos, &ebcdic_left, + &ascii_pos, &ascii_left)) == (size_t) -1) { + switch (errno) { + case EILSEQ: + case EINVAL: /* That one is quite unexpected, actually */ + if (!ebcdic_left || !ascii_left) + goto ebcdic2ascii_end; + + *ascii_pos++ = ' '; + ebcdic_pos++; + ebcdic_left--; + + break; + + case E2BIG: + perror_msg_and_fail("ebcdic2ascii: ran out of " + "ASCII buffer unexpectedly"); + default: + perror_msg_and_fail("ebcdic2ascii: unexpected error"); + } + } + +ebcdic2ascii_end: + iconv_close(cd); + + if (ebcdic_left != ascii_left) + error_msg_and_fail("ebcdic2ascii: ASCII string differs in size " + "from EBCDIC"); + + return ascii_buf; +} + +# if VERBOSE +static bool +is_empty(unsigned char *ptr, size_t size) +{ + size_t i; + + for (i = 0; !*ptr && i < size; ptr++, i++) + ; + + return i == size; +} +# endif /* !VERBOSE */ + +static bool +print_ebcdic(const char *prefix, unsigned char *addr, unsigned int offs, + size_t size, bool zero, bool blank) +{ + const char *ascii = ebcdic2ascii(addr + offs, size); + + if (!zero) { + size_t i; + + for (i = 0; (addr[offs + i] == (blank ? 64 : 0)) && (i < size); + i++) + ; + + if (i == size) + return false; + } + + printf("%s=", prefix); + print_quoted_hex((char *) (addr + offs), size); + printf(" /* "); + print_quoted_memory(ascii, size); + printf(" */"); + + return true; +} + +static void +print_hypervisor_header(unsigned char *buf, int level, unsigned int offs_pos, + unsigned int len_pos, bool mt) +{ + uint16_t offs = *(uint16_t *) (buf + offs_pos); + uint16_t hdr_size = *(uint16_t *) (buf + len_pos); + unsigned char *cur; + + if (!offs) + return; + if (hdr_size < 32) + error_msg_and_fail("sthyi: hypervisor %d section is too small " + "(got %hu, 32 expected)", level, hdr_size); + + cur = buf + offs; + + printf(", /* hypervisor %d */ {infyflg1", level); + print_0x8("", cur, 0, true); +# if VERBOSE + if (cur[0]) { + bool printed = false; + + printf(" /* "); + if (cur[0] & 0x80) { + printf("0x80 - guest CPU usage had limiting is using " + "the consumption method"); + printed = true; + } + if (cur[0] & 0x40) { + if (printed) + printf(", "); + printf("0x40 - LIMITHARD caps use prorated core time " + "for capping"); + printed = true; + } + if (cur[0] & 0x3F) { + if (printed) + printf(", "); + printf("%#hhx - ???", cur[0] & 0x3F); + } + printf(" */"); + } + + print_0x8(", infyflg2", cur, 1, false); + print_0x8(", infyval1", cur, 2, false); + print_0x8(", infyval2", cur, 3, false); + + print_u8(", infytype", cur, 4, true); + if (cur[4] == 1) + printf(" /* z/VM is the hypervisor */"); + else + printf(" /* unknown hypervisor type */"); + + if (cur[5]) + printf(", reserved_1__=\"\\x%#02hhx\"", cur[5]); + + print_u8(", infycpt", cur, 6, mt); + print_u8(", infyiflt", cur, 7, mt); +# endif /* !VERBOSE */ + + print_ebcdic(", infysyid", cur, 8, 8, VERBOSE, true); + print_ebcdic(", infyclnm", cur, 16, 8, VERBOSE, true); + + print_u16(", infyscps", cur, 24, VERBOSE); + print_u16(", infydcps", cur, 26, VERBOSE); + print_u16(", infysifl", cur, 28, VERBOSE); + print_u16(", infydifl", cur, 30, VERBOSE); + +# if VERBOSE + if (hdr_size > 32 && !is_empty(cur + 32, hdr_size - 32)) { + printf(", "); + print_quoted_hex((char *) (cur + 32), hdr_size - 32); + } +# else /* !VERBOSE */ + printf(", ..."); +# endif /* !VERBOSE */ + + printf("}"); +} + +static void +print_guest_header(unsigned char *buf, int level, unsigned int offs_pos, + unsigned int len_pos) +{ + uint16_t offs = *(uint16_t *) (buf + offs_pos); + uint16_t hdr_size = *(uint16_t *) (buf + len_pos); + unsigned char *cur; + + if (!offs) + return; + if (hdr_size < 56) + error_msg_and_fail("sthyi: guest %d section is too small " + "(got %hu, 56 expected)", level, hdr_size); + + cur = buf + offs; + + printf(", /* guest %d */ {infgflg1", level); + print_0x8("", cur, 0, true); +# if VERBOSE + if (cur[0]) { + bool printed = false; + + printf(" /* "); + if (cur[0] & 0x80) { + printf("0x80 - guest is mobility enabled"); + printed = true; + } + if (cur[0] & 0x40) { + if (printed) + printf(", "); + printf("0x40 - guest has multiple virtual CPU types"); + printed = true; + } + if (cur[0] & 0x20) { + if (printed) + printf(", "); + printf("0x20 - guest CP dispatch type has LIMITHARD " + "cap"); + printed = true; + } + if (cur[0] & 0x10) { + if (printed) + printf(", "); + printf("0x10 - guest IFL dispatch type has LIMITHARD " + "cap"); + printed = true; + } + if (cur[0] & 0x08) { + if (printed) + printf(", "); + printf("0x08 - virtual CPs are thread dispatched"); + printed = true; + } + if (cur[0] & 0x04) { + if (printed) + printf(", "); + printf("0x04 - virtual IFLs are thread dispatched"); + printed = true; + } + if (cur[0] & 0x3) { + if (printed) + printf(", "); + printf("%#hhx - ???", cur[0] & 0x3); + } + printf(" */"); + } + + print_0x8(", infgflg2", cur, 1, false); + print_0x8(", infgval1", cur, 2, false); + print_0x8(", infgval2", cur, 3, false); +# endif /* !VERBOSE */ + + print_ebcdic(", infgusid", cur, 4, 8, true, false); + + print_u16(", infgscps", cur, 12, VERBOSE); + print_u16(", infgdcps", cur, 14, VERBOSE); + +# if VERBOSE + print_u8(", infgcpdt", cur, 16, true); + if (cur[16] == 0) + printf(" /* General Purpose (CP) */"); + else + printf(" /* unknown */"); + + if (cur[17] || cur[18] || cur[19]) + printf(", reserved_1__=\"\\x%#02hhx\\x%#02hhx\\x%#02hhx\"", + cur[17], cur[18], cur[19]); +# endif /* !VERBOSE */ + + print_weight(", infgcpcc", cur, 20, VERBOSE); + + print_u16(", infgsifl", cur, 24, VERBOSE); + print_u16(", infgdifl", cur, 26, VERBOSE); + +# if VERBOSE + print_u8(", infgifdt", cur, 28, true); + if (cur[28] == 0) + printf(" /* General Purpose (CP) */"); + else if (cur[28] == 3) + printf(" /* Integrated Facility for Linux (IFL) */"); + else + printf(" /* unknown */"); + + if (cur[29] || cur[30] || cur[31]) + printf(", reserved_2__=\"\\x%#02hhx\\x%#02hhx\\x%#02hhx\"", + cur[29], cur[30], cur[31]); +# endif /* !VERBOSE */ + + print_weight(", infgifcc", cur, 32, VERBOSE); + + print_0x8(", infgpflg", cur, 36, true); +# if VERBOSE + if (cur[36]) { + bool printed = false; + + printf(" /* "); + if (cur[36] & 0x80) { + printf("0x80 - CPU pool's CP virtual type has " + "LIMITHARD cap"); + printed = true; + } + if (cur[36] & 0x40) { + if (printed) + printf(", "); + printf("0x40 - CPU pool's CP virtual type has " + "CAPACITY cap"); + printed = true; + } + if (cur[36] & 0x20) { + if (printed) + printf(", "); + printf("0x20 - CPU pool's IFL virtual type has " + "LIMITHARD cap"); + printed = true; + } + if (cur[36] & 0x10) { + if (printed) + printf(", "); + printf("0x10 - CPU pool's IFL virtual type has " + "CAPACITY cap"); + printed = true; + } + if (cur[36] & 0x08) { + if (printed) + printf(", "); + printf("0x08 - CPU pool uses prorated core time"); + printed = true; + } + if (cur[36] & 0x7) { + if (printed) + printf(", "); + printf("%#hhx - ???", cur[36] & 0x7); + } + printf(" */"); + } + + if (cur[37] || cur[38] || cur[39]) + printf(", reserved_3__=\"\\x%#02hhx\\x%#02hhx\\x%#02hhx\"", + cur[37], cur[38], cur[39]); + + print_ebcdic(", infgpnam", cur, 40, 8, false, true); + + print_weight(", infgpccc", cur, 48, true); + print_weight(", infgpicc", cur, 52, true); + + if (hdr_size > 56 && !is_empty(cur + 56, hdr_size - 56)) { + printf(", "); + print_quoted_hex((char *) (cur + 56), hdr_size - 56); + } +# else /* !VERBOSE */ + printf(", ..."); +# endif /* !VERBOSE */ + + printf("}"); +} + +static void +print_sthyi(unsigned char *buf) +{ + unsigned char *cur; + uint16_t hdr_size; + uint16_t offs; + bool mt = false; + + hdr_size = *(uint16_t *) (buf + 10); + if (hdr_size < 44) + error_msg_and_fail("sthyi: header section is too small " + "(got %hu, 44 expected)", hdr_size); + + /* INFHFLG1 */ + print_0x8("{/* header */ {infhflg1", buf, 0, true); +# if VERBOSE + if (buf[0]) { + bool printed = false; + + printf(" /* "); + if (buf[0] & 0x80) { + printf("0x80 - Global Performance Data unavailable"); + printed = true; + } + if (buf[0] & 0x40) { + if (printed) + printf(", "); + printf("0x40 - One or more hypervisor levels below " + "this level does not support the STHYI " + "instruction"); + printed = true; + } + if (buf[0] & 0x20) { + if (printed) + printf(", "); + printf("0x20 - Virtualization stack is incomplete"); + printed = true; + } + if (buf[0] & 0x10) { + if (printed) + printf(", "); + printf("0x10 - Execution environment is not within a " + "logical partition"); + printed = true; + } + if (buf[0] & 0xF) { + if (printed) + printf(", "); + printf("%#hhx - ???", buf[0] & 0xF); + } + printf(" */"); + } + + print_0x8(", infhflg2", buf, 1, false); + print_0x8(", infhval1", buf, 2, false); + print_0x8(", infhval2", buf, 3, false); + + /* Reserved */ + if (buf[4] || buf[5] || buf[6]) + printf(", reserved_1__=\"\\x%#02hhx\\x%#02hhx\\x%#02hhx\"", + buf[4], buf[5], buf[6]); + + print_u8(", infhygct", buf, 7, true); + print_u16(", infhtotl", buf, 8, true); + print_u16(", infhdln", buf, 10, true); + print_u16(", infmoff", buf, 12, true); + print_u16(", infmlen", buf, 14, true); + print_u16(", infpoff", buf, 16, true); + print_u16(", infplen", buf, 18, true); + print_u16(", infhoff1", buf, 20, true); + print_u16(", infhlen1", buf, 22, true); + print_u16(", infgoff1", buf, 24, true); + print_u16(", infglen1", buf, 26, true); + print_u16(", infhoff2", buf, 28, true); + print_u16(", infhlen2", buf, 30, true); + print_u16(", infgoff2", buf, 32, true); + print_u16(", infglen2", buf, 34, true); + print_u16(", infhoff3", buf, 36, true); + print_u16(", infhlen3", buf, 38, true); + print_u16(", infgoff3", buf, 40, true); + print_u16(", infglen3", buf, 42, true); + + if (hdr_size > 44 && !is_empty(buf + 44, hdr_size - 44)) { + printf(", "); + print_quoted_hex((char *) (buf + 44), hdr_size - 44); + } +# else /* !VERBOSE */ + printf(", ..."); +# endif /* !VERBOSE */ + + printf("}"); + + /* Machine header */ + offs = *(uint16_t *) (buf + 12); + if (!offs) + goto partition_hdr; + + hdr_size = *(uint16_t *) (buf + 14); + if (hdr_size < 60) + error_msg_and_fail("sthyi: machine section is too small " + "(got %hu, 60 expected)", hdr_size); + + cur = buf + offs; + + printf(", /* machine */ {"); + +# if VERBOSE + print_0x8("infmflg1", cur, 0, false); + if (cur[0]) + printf(", "); + print_0x8("infmflg2", cur, 1, false); + if (cur[1]) + printf(", "); +# endif /* !VERBOSE */ + print_0x8("infmval1", cur, 2, true); + + bool cnt_valid = cur[2] & 0x80; +# if VERBOSE + bool id_valid = cur[2] & 0x40; + bool name_valid = cur[2] & 0x20; + + printf(" /* processor count validity: %d, machine ID validity: %d, " + "machine name validity: %d", + !!cnt_valid, !!id_valid, !!name_valid); + if (cur[2] & 0x1F) + printf(", %#hhx - ???", cur[2] & 0x1F); + printf(" */"); + print_0x8(", infmval2", cur, 3, false); +# endif /* !VERBOSE */ + + print_u16(", infmscps", cur, 4, cnt_valid); + print_u16(", infmdcps", cur, 6, cnt_valid); + print_u16(", infmsifl", cur, 8, cnt_valid); + print_u16(", infmdifl", cur, 10, cnt_valid); + +# if VERBOSE + print_ebcdic(", infmname", cur, 12, 8, name_valid, false); + + print_ebcdic(", infmtype", cur, 20, 4, id_valid, false); + print_ebcdic(", infmmanu", cur, 24, 16, id_valid, false); + print_ebcdic(", infmseq", cur, 40, 16, id_valid, false); + print_ebcdic(", infmpman", cur, 56, 4, id_valid, false); + + if (hdr_size > 60 && !is_empty(cur + 60, hdr_size - 60)) { + printf(", "); + print_quoted_hex((char *) (cur + 60), hdr_size - 60); + } +# else /* !VERBOSE */ + printf(", ..."); +# endif /* !VERBOSE */ + + printf("}"); + +partition_hdr: + /* Partition header */ + offs = *(uint16_t *) (buf + 16); + if (!offs) + goto hv_hdr; + + hdr_size = *(uint16_t *) (buf + 18); + if (hdr_size < 56) + error_msg_and_fail("sthyi: partition section is too small " + "(got %hu, 56 expected)", hdr_size); + + cur = buf + offs; + + print_0x8(", /* partition */ {infpflg1", cur, 0, true); + mt = !!(cur[0] & 0x80); +# if VERBOSE + if (cur[0]) { + bool printed = false; + + printf(" /* "); + if (cur[0] & 0x80) { + printf("0x80 - multithreading is enabled"); + printed = true; + } + if (cur[0] & 0x7F) { + if (printed) + printf(", "); + printf("%#hhx - ???", cur[0] & 0x7F); + } + printf(" */"); + } + print_0x8(", infpflg2", cur, 1, false); +# endif /* !VERBOSE */ + print_0x8(", infpval1", cur, 2, true); + + bool pcnt_valid = cur[2] & 0x80; + bool pid_valid = cur[2] & 0x10; +# if VERBOSE + bool pwcap_valid = cur[2] & 0x40; + bool pacap_valid = cur[2] & 0x20; + bool lpar_valid = cur[2] & 0x08; +# endif /* !VERBOSE */ + +# if VERBOSE + printf(" /* processor count validity: %d, partition weight-based " + "capacity validity: %d, partition absolute capacity validity: " + "%d, partition ID validity: %d, LPAR group absolute capacity " + "capping information validity: %d", + !!pcnt_valid, !!pwcap_valid, !!pacap_valid, !!pid_valid, + !!lpar_valid); + if (cur[2] & 0x7) + printf(", %#hhx - ???", cur[2] & 0x7); + printf(" */"); + + print_0x8(", infpval2", cur, 3, false); +# endif /* !VERBOSE */ + + print_u16(", infppnum", cur, 4, pid_valid); + + print_u16(", infpscps", cur, 6, pcnt_valid); + print_u16(", infpdcps", cur, 8, pcnt_valid); + print_u16(", infpsifl", cur, 10, pcnt_valid); + print_u16(", infpdifl", cur, 12, pcnt_valid); + +# if VERBOSE + if (cur[14] || cur[15]) + printf(", reserved_1__=\"\\x%#02hhx\\x%#02hhx\"", + cur[14], cur[15]); +# endif /* !VERBOSE */ + + print_ebcdic(", infppnam", cur, 16, 8, pid_valid, false); + +# if VERBOSE + print_weight(", infpwbcp", cur, 24, pwcap_valid); + print_weight(", infpabcp", cur, 28, pacap_valid); + print_weight(", infpwbif", cur, 32, pwcap_valid); + print_weight(", infpabif", cur, 36, pacap_valid); + + if (print_ebcdic(", infplgnm", cur, 40, 8, false, false)) { + + print_weight(", infplgcp", cur, 48, false); + print_weight(", infplgif", cur, 52, false); + } else { + if (lpar_valid) { + printf(", infplgnm="); + print_quoted_hex((char *) (cur + 40), 8); + } + + print_x32(", infplgcp", cur, 48, false); + print_x32(", infplgif", cur, 52, false); + } + + if (hdr_size > 56 && !is_empty(cur + 56, hdr_size - 56)) { + printf(", "); + print_quoted_hex((char *) (cur + 56), hdr_size - 56); + } +# else /* !VERBOSE */ + printf(", ..."); +# endif /* !VERBOSE */ + + printf("}"); + +hv_hdr: + /* Hypervisor/guest headers */ + print_hypervisor_header(buf, 1, 20, 22, mt); + print_guest_header(buf, 1, 24, 26); + print_hypervisor_header(buf, 2, 28, 30, mt); + print_guest_header(buf, 2, 32, 34); + print_hypervisor_header(buf, 3, 36, 38, mt); + print_guest_header(buf, 3, 40, 42); + + printf("}"); +} + +int +main(void) +{ + static const kernel_ulong_t bogus_func = + (kernel_ulong_t) 0xdeafbeefdeadc0deULL; + static const kernel_ulong_t bogus_resp_buf = + (kernel_ulong_t) 0xfacefeedac0ffeedULL; + static const kernel_ulong_t bogus_ret_code = + (kernel_ulong_t) 0xf00dfa57decaffedULL; + static const kernel_ulong_t bogus_flags = + (kernel_ulong_t) 0xfee1deadfa57beefULL; + + unsigned char *buf = tail_alloc(PAGE_SIZE); + uint64_t *ret = tail_alloc(sizeof(*ret)); + + long rc; + + rc = syscall(__NR_s390_sthyi, 0, 0, 0, 0); + printf("s390_sthyi(STHYI_FC_CP_IFL_CAP, NULL, NULL, 0) = %s\n", + sprintrc(rc)); + + rc = syscall(__NR_s390_sthyi, bogus_func, bogus_resp_buf, + bogus_ret_code, bogus_flags); + printf("s390_sthyi(%#llx /* STHYI_FC_??? */, %#llx, %#llx, %#llx) = " + "%s\n", + (unsigned long long) bogus_func, + (unsigned long long) bogus_resp_buf, + (unsigned long long) bogus_ret_code, + (unsigned long long) bogus_flags, + sprintrc(rc)); + + rc = syscall(__NR_s390_sthyi, bogus_func, buf, ret, 0); + printf("s390_sthyi(%#llx /* STHYI_FC_??? */, %p, %p, 0) = %s\n", + (unsigned long long) bogus_func, buf, ret, sprintrc(rc)); + + rc = syscall(__NR_s390_sthyi, 0, buf, ret, 0); + if (rc) + error_msg_and_fail("syscall(__NR_s390_sthyi, 0, buf, ret, 0) " + "returned unexpected value of %ld", rc); + + printf("s390_sthyi(STHYI_FC_CP_IFL_CAP, "); + print_sthyi(buf); + printf(", [0], 0) = 0\n"); + + puts("+++ exited with 0 +++"); + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("HAVE_ICONV_H && HAVE_ICONV_OPEN && __NR_s390_sthyi") + +#endif diff --git a/tests-m32/s390_sthyi.gen.test b/tests-m32/s390_sthyi.gen.test new file mode 100755 index 00000000..cf271374 --- /dev/null +++ b/tests-m32/s390_sthyi.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (s390_sthyi -a47 ); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a47 diff --git a/tests-m32/sched_rr_get_interval.gen.test b/tests-m32/sched_rr_get_interval.gen.test index 493de644..02aad002 100755 --- a/tests-m32/sched_rr_get_interval.gen.test +++ b/tests-m32/sched_rr_get_interval.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sched_rr_get_interval -a31); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sched_rr_get_interval -a31 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a31 +run_strace_match_diff -a31 diff --git a/tests-m32/sched_yield.gen.test b/tests-m32/sched_yield.gen.test index 3f4542ff..4b035fd8 100755 --- a/tests-m32/sched_yield.gen.test +++ b/tests-m32/sched_yield.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sched_yield -a14); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sched_yield -a14 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a14 +run_strace_match_diff -a14 diff --git a/tests-m32/select-P.c b/tests-m32/select-P.c new file mode 100644 index 00000000..868deed6 --- /dev/null +++ b/tests-m32/select-P.c @@ -0,0 +1,2 @@ +#define PATH_TRACING_FD 9 +#include "select.c" diff --git a/tests-m32/select-P.gen.test b/tests-m32/select-P.gen.test new file mode 100755 index 00000000..2f6fc7bc --- /dev/null +++ b/tests-m32/select-P.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (select-P -a36 -e trace=select -P /dev/full 9>>/dev/full); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a36 -e trace=select -P /dev/full 9>>/dev/full diff --git a/tests-m32/select.gen.test b/tests-m32/select.gen.test index cb3b8f15..23836149 100755 --- a/tests-m32/select.gen.test +++ b/tests-m32/select.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (select -a36); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (select -a36 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a36 +run_strace_match_diff -a36 diff --git a/tests-m32/sendfile.gen.test b/tests-m32/sendfile.gen.test index 433878f8..d32ef3ad 100755 --- a/tests-m32/sendfile.gen.test +++ b/tests-m32/sendfile.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sendfile -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sendfile -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests-m32/sendfile64.gen.test b/tests-m32/sendfile64.gen.test index 1655dd32..24f0746f 100755 --- a/tests-m32/sendfile64.gen.test +++ b/tests-m32/sendfile64.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sendfile64 -a29); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sendfile64 -a29 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a29 +run_strace_match_diff -a29 diff --git a/tests-m32/set_ptracer_any.c b/tests-m32/set_ptracer_any.c index 3b4ea2cb..3c112961 100644 --- a/tests-m32/set_ptracer_any.c +++ b/tests-m32/set_ptracer_any.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2013-2015 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2013-2017 The strace developers. + * Copyright (c) 2013-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,10 +37,16 @@ int main(int argc, char **argv) { if (argc < 2) return 99; -#if defined HAVE_PRCTL && defined PR_SET_PTRACER && defined PR_SET_PTRACER_ANY - /* Turn off restrictions on tracing if applicable. If the options +#ifdef HAVE_PRCTL + /* Turn off restrictions on tracing if applicable. If the command * aren't available on this system, that's OK too. */ - (void) prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY); +# ifndef PR_SET_PTRACER +# define PR_SET_PTRACER 0x59616d61 +# endif +# ifndef PR_SET_PTRACER_ANY +# define PR_SET_PTRACER_ANY -1UL +# endif + (void) prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY, 0, 0, 0); #endif if (write(1, "\n", 1) != 1) { perror("write"); diff --git a/tests-m32/setdomainname.gen.test b/tests-m32/setdomainname.gen.test index 2b12e082..1f29563f 100755 --- a/tests-m32/setdomainname.gen.test +++ b/tests-m32/setdomainname.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setdomainname -a24); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setdomainname -a24 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a24 +run_strace_match_diff -a24 diff --git a/tests-m32/setfsgid.gen.test b/tests-m32/setfsgid.gen.test index caff4012..bbb30cc1 100755 --- a/tests-m32/setfsgid.gen.test +++ b/tests-m32/setfsgid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setfsgid -a12); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setfsgid -a12 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a12 +run_strace_match_diff -a12 diff --git a/tests-m32/setfsgid32.gen.test b/tests-m32/setfsgid32.gen.test index fae29e01..63b3eca0 100755 --- a/tests-m32/setfsgid32.gen.test +++ b/tests-m32/setfsgid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setfsgid32 -a14); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setfsgid32 -a14 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a14 +run_strace_match_diff -a14 diff --git a/tests-m32/setfsuid.gen.test b/tests-m32/setfsuid.gen.test index e4c4d209..5896b303 100755 --- a/tests-m32/setfsuid.gen.test +++ b/tests-m32/setfsuid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setfsuid -a12); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setfsuid -a12 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a12 +run_strace_match_diff -a12 diff --git a/tests-m32/setfsuid32.gen.test b/tests-m32/setfsuid32.gen.test index b6cd67d7..52d0820f 100755 --- a/tests-m32/setfsuid32.gen.test +++ b/tests-m32/setfsuid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setfsuid32 -a14); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setfsuid32 -a14 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a14 +run_strace_match_diff -a14 diff --git a/tests-m32/setgid.gen.test b/tests-m32/setgid.gen.test index f10add65..be188d1f 100755 --- a/tests-m32/setgid.gen.test +++ b/tests-m32/setgid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setgid -a10); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setgid -a10 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a10 +run_strace_match_diff -a10 diff --git a/tests-m32/setgid32.gen.test b/tests-m32/setgid32.gen.test index 26f194ec..9020b809 100755 --- a/tests-m32/setgid32.gen.test +++ b/tests-m32/setgid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setgid32 -a12); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setgid32 -a12 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a12 +run_strace_match_diff -a12 diff --git a/tests-m32/sethostname.gen.test b/tests-m32/sethostname.gen.test index 2827b1dc..d68ed189 100755 --- a/tests-m32/sethostname.gen.test +++ b/tests-m32/sethostname.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sethostname -a22); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sethostname -a22 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a22 +run_strace_match_diff -a22 diff --git a/tests-m32/setns.gen.test b/tests-m32/setns.gen.test index 45fcc601..e25738bf 100755 --- a/tests-m32/setns.gen.test +++ b/tests-m32/setns.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setns -a21); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setns -a21 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a21 +run_strace_match_diff -a21 diff --git a/tests-m32/setregid.gen.test b/tests-m32/setregid.gen.test index 0125d7a9..f84b1acb 100755 --- a/tests-m32/setregid.gen.test +++ b/tests-m32/setregid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setregid -a15); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setregid -a15 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a15 +run_strace_match_diff -a15 diff --git a/tests-m32/setregid32.gen.test b/tests-m32/setregid32.gen.test index 24f1505b..7320c8cf 100755 --- a/tests-m32/setregid32.gen.test +++ b/tests-m32/setregid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setregid32 -a17); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setregid32 -a17 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a17 +run_strace_match_diff -a17 diff --git a/tests-m32/setresgid.gen.test b/tests-m32/setresgid.gen.test index ca5bc6b7..792313c2 100755 --- a/tests-m32/setresgid.gen.test +++ b/tests-m32/setresgid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setresgid -a19); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setresgid -a19 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a19 +run_strace_match_diff -a19 diff --git a/tests-m32/setresgid32.gen.test b/tests-m32/setresgid32.gen.test index a5edb905..6ecf936b 100755 --- a/tests-m32/setresgid32.gen.test +++ b/tests-m32/setresgid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setresgid32 -a21); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setresgid32 -a21 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a21 +run_strace_match_diff -a21 diff --git a/tests-m32/setresuid.gen.test b/tests-m32/setresuid.gen.test index a6e06641..a0dcb4ba 100755 --- a/tests-m32/setresuid.gen.test +++ b/tests-m32/setresuid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setresuid -a19); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setresuid -a19 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a19 +run_strace_match_diff -a19 diff --git a/tests-m32/setresuid32.gen.test b/tests-m32/setresuid32.gen.test index 3fbf36be..a9f43969 100755 --- a/tests-m32/setresuid32.gen.test +++ b/tests-m32/setresuid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setresuid32 -a21); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setresuid32 -a21 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a21 +run_strace_match_diff -a21 diff --git a/tests-m32/setreuid.gen.test b/tests-m32/setreuid.gen.test index 4c3dc930..0ecaef0b 100755 --- a/tests-m32/setreuid.gen.test +++ b/tests-m32/setreuid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setreuid -a15); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setreuid -a15 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a15 +run_strace_match_diff -a15 diff --git a/tests-m32/setreuid32.gen.test b/tests-m32/setreuid32.gen.test index d1790538..3eb0e95a 100755 --- a/tests-m32/setreuid32.gen.test +++ b/tests-m32/setreuid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setreuid32 -a17); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setreuid32 -a17 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a17 +run_strace_match_diff -a17 diff --git a/tests-m32/setrlimit.gen.test b/tests-m32/setrlimit.gen.test index dfe2da38..0d1508d3 100755 --- a/tests-m32/setrlimit.gen.test +++ b/tests-m32/setrlimit.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setrlimit -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setrlimit -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests-m32/setugid.c b/tests-m32/setugid.c index aba277c5..6ceec7fc 100644 --- a/tests-m32/setugid.c +++ b/tests-m32/setugid.c @@ -2,6 +2,7 @@ * Check decoding of setuid/setgid/setuid32/setgid32 syscalls. * * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -61,6 +62,8 @@ main(void) const unsigned int num = (unsigned UGID_TYPE) tests[i]; long expected; + errno = 0; + if (num == ugid) expected = 0; else if ((UGID_TYPE) num == (UGID_TYPE) -1U) @@ -77,8 +80,9 @@ main(void) SYSCALL_NAME, ugid, errstr); break; } - perror_msg_and_fail("%s(%#lx) != %ld", - SYSCALL_NAME, tests[i], expected); + perror_msg_and_fail("%s(%#lx) = %ld != %ld", + SYSCALL_NAME, tests[i], + rc, expected); } printf("%s(", SYSCALL_NAME); diff --git a/tests-m32/setuid.gen.test b/tests-m32/setuid.gen.test index 98d470fd..00aeb7a2 100755 --- a/tests-m32/setuid.gen.test +++ b/tests-m32/setuid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setuid -a10); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setuid -a10 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a10 +run_strace_match_diff -a10 diff --git a/tests-m32/setuid32.gen.test b/tests-m32/setuid32.gen.test index 7d15495c..ac8df8f2 100755 --- a/tests-m32/setuid32.gen.test +++ b/tests-m32/setuid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setuid32 -a12); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setuid32 -a12 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a12 +run_strace_match_diff -a12 diff --git a/tests-m32/shmxt.c b/tests-m32/shmxt.c index 23cc7ccf..398667c8 100644 --- a/tests-m32/shmxt.c +++ b/tests-m32/shmxt.c @@ -18,6 +18,10 @@ cleanup(void) # define SHMAT "shmat" #endif +#ifndef SHM_EXEC +# define SHM_EXEC 0100000 +#endif + int main(void) { @@ -34,8 +38,8 @@ main(void) atexit(cleanup); rc = (long) shmat(bogus_shmid, bogus_shmaddr, bogus_shmflg); - printf("%s(%d, %p, SHM_REMAP|SHM_RDONLY|SHM_RND|%#x) = %s\n", - SHMAT, bogus_shmid, bogus_shmaddr, bogus_shmflg & ~0x7000, + printf("%s(%d, %p, SHM_RDONLY|SHM_RND|SHM_REMAP|SHM_EXEC|%#x) = %s\n", + SHMAT, bogus_shmid, bogus_shmaddr, bogus_shmflg & ~0xf000, sprintrc(rc)); shmat(id, NULL, SHM_REMAP); @@ -50,18 +54,31 @@ main(void) rc = shmdt(NULL); printf("shmdt(NULL) = %s\n", sprintrc(rc)); - if (shmdt(shmaddr)) - perror_msg_and_skip("shmdt"); - printf("shmdt(%p) = 0\n", shmaddr); + rc = shmdt(shmaddr); + printf("shmdt(%p) = %s\n", shmaddr, sprintrc(rc)); ++shmaddr; void *shmaddr2 = shmat(id, shmaddr, SHM_RND); if (shmaddr2 == (void *)(-1)) printf("%s(%d, %p, SHM_RND) = -1 %s (%m)\n", SHMAT, id, shmaddr, errno2name()); - else + else { printf("%s(%d, %p, SHM_RND) = %p\n", SHMAT, id, shmaddr, shmaddr2); + rc = shmdt(shmaddr2); + printf("shmdt(%p) = %s\n", shmaddr2, sprintrc(rc)); + } + + shmaddr = shmat(id, NULL, SHM_RDONLY|SHM_EXEC); + if (shmaddr == (void *)(-1)) + printf("%s(%d, NULL, SHM_RDONLY|SHM_EXEC) = %s\n", + SHMAT, id, sprintrc(-1)); + else { + printf("%s(%d, NULL, SHM_RDONLY|SHM_EXEC) = %p\n", + SHMAT, id, shmaddr); + rc = shmdt(shmaddr); + printf("shmdt(%p) = %s\n", shmaddr, sprintrc(rc)); + } puts("+++ exited with 0 +++"); return 0; diff --git a/tests-m32/shutdown.gen.test b/tests-m32/shutdown.gen.test index 3412513f..7fde46ee 100755 --- a/tests-m32/shutdown.gen.test +++ b/tests-m32/shutdown.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (shutdown -a24); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (shutdown -a24 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a24 +run_strace_match_diff -a24 diff --git a/tests-m32/sigaction.gen.test b/tests-m32/sigaction.gen.test index dee340e8..1db6b3aa 100755 --- a/tests-m32/sigaction.gen.test +++ b/tests-m32/sigaction.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sigaction -a31); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sigaction -a31 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a31 +run_strace_match_diff -a31 diff --git a/tests-m32/signalfd4.gen.test b/tests-m32/signalfd4.gen.test index e91a9fe4..dee4274c 100755 --- a/tests-m32/signalfd4.gen.test +++ b/tests-m32/signalfd4.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (signalfd4 ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (signalfd4 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/sigpending.gen.test b/tests-m32/sigpending.gen.test index 0f4259a3..c061868c 100755 --- a/tests-m32/sigpending.gen.test +++ b/tests-m32/sigpending.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sigpending -a15); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sigpending -a15 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a15 +run_strace_match_diff -a15 diff --git a/tests-m32/sigprocmask.gen.test b/tests-m32/sigprocmask.gen.test index 44a508ce..065b74d7 100755 --- a/tests-m32/sigprocmask.gen.test +++ b/tests-m32/sigprocmask.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sigprocmask -a34); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sigprocmask -a34 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a34 +run_strace_match_diff -a34 diff --git a/tests-m32/sigreturn.gen.test b/tests-m32/sigreturn.gen.test index f317e893..3b67c9d0 100755 --- a/tests-m32/sigreturn.gen.test +++ b/tests-m32/sigreturn.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sigreturn -esignal='!USR1'); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sigreturn -esignal='!USR1' ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -esignal='!USR1' +run_strace_match_diff -esignal='!USR1' diff --git a/tests-m32/socketcall.gen.test b/tests-m32/socketcall.gen.test index 95c45fd7..d18b0364 100755 --- a/tests-m32/socketcall.gen.test +++ b/tests-m32/socketcall.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (socketcall -a20); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (socketcall -a20 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a20 +run_strace_match_diff -a20 diff --git a/tests-m32/sockname.c b/tests-m32/sockname.c index 58726712..bba9a892 100644 --- a/tests-m32/sockname.c +++ b/tests-m32/sockname.c @@ -2,7 +2,7 @@ * Check decoding of sockname family syscalls. * * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,7 +42,9 @@ # error TEST_SYSCALL_NAME must be defined #endif -#define TEST_SYSCALL_STR STRINGIFY_VAL(TEST_SYSCALL_NAME) +#ifndef TEST_SYSCALL_STR +# define TEST_SYSCALL_STR STRINGIFY_VAL(TEST_SYSCALL_NAME) +#endif #define TEST_SOCKET TEST_SYSCALL_STR ".socket" #ifdef TEST_SYSCALL_PREPARE diff --git a/tests-m32/sockopt-sol_netlink.c b/tests-m32/sockopt-sol_netlink.c new file mode 100644 index 00000000..066920c6 --- /dev/null +++ b/tests-m32/sockopt-sol_netlink.c @@ -0,0 +1,213 @@ +/* + * Check decoding of getsockopt and setsockopt for SOL_NETLINK level. + * + * Copyright (c) 2017 Dmitry V. Levin <ldv@altlinux.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" +#include "netlink.h" +#include <stdio.h> + +#ifndef SOL_NETLINK +# define SOL_NETLINK 270 +#endif + +static int rc; +static const char *errstr; + +static int +get_sockopt(int fd, int name, void *val, socklen_t *len) +{ + rc = getsockopt(fd, SOL_NETLINK, name, val, len); + errstr = sprintrc(rc); + return rc; +} + +static int +set_sockopt(int fd, int name, void *val, socklen_t len) +{ + rc = setsockopt(fd, SOL_NETLINK, name, val, len); + errstr = sprintrc(rc); + return rc; +} + +int +main(void) +{ + static const struct { + int val; + const char *str; + } names[] = { +#ifdef NETLINK_ADD_MEMBERSHIP + { ARG_STR(NETLINK_ADD_MEMBERSHIP) }, +#endif +#ifdef NETLINK_DROP_MEMBERSHIP + { ARG_STR(NETLINK_DROP_MEMBERSHIP) }, +#endif +#ifdef NETLINK_PKTINFO + { ARG_STR(NETLINK_PKTINFO) }, +#endif +#ifdef NETLINK_BROADCAST_ERROR + { ARG_STR(NETLINK_BROADCAST_ERROR) }, +#endif +#ifdef NETLINK_NO_ENOBUFS + { ARG_STR(NETLINK_NO_ENOBUFS) }, +#endif +#ifdef NETLINK_RX_RING + { ARG_STR(NETLINK_RX_RING) }, +#endif +#ifdef NETLINK_TX_RING + { ARG_STR(NETLINK_TX_RING) }, +#endif +#ifdef NETLINK_LISTEN_ALL_NSID + { ARG_STR(NETLINK_LISTEN_ALL_NSID) }, +#endif +#ifdef NETLINK_LIST_MEMBERSHIPS + { ARG_STR(NETLINK_LIST_MEMBERSHIPS) }, +#endif +#ifdef NETLINK_CAP_ACK + { ARG_STR(NETLINK_CAP_ACK) }, +#endif +#ifdef NETLINK_EXT_ACK + { ARG_STR(NETLINK_EXT_ACK) }, +#endif + }; + + TAIL_ALLOC_OBJECT_CONST_PTR(int, val); + TAIL_ALLOC_OBJECT_CONST_PTR(socklen_t, len); + void *const efault = val + 1; + int fd = socket(AF_NETLINK, SOCK_RAW, 0); + if (fd < 0) + perror_msg_and_skip("socket AF_NETLINK SOCK_RAW"); + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(names); ++i) { + /* getsockopt */ + + /* classic */ + *len = sizeof(*val); + get_sockopt(fd, names[i].val, val, len); + printf("getsockopt(%d, SOL_NETLINK, %s, ", fd, names[i].str); + if (rc) + printf("%p", val); + else + printf("[%d]", *val); + printf(", [%d]) = %s\n", *len, errstr); + + /* optlen larger than necessary - shortened */ + *len = sizeof(*val) + 1; + get_sockopt(fd, names[i].val, val, len); + printf("getsockopt(%d, SOL_NETLINK, %s, ", fd, names[i].str); + if (rc) + printf("%p", val); + else + printf("[%d]", *val); + printf(", [%d", (int) sizeof(*val) + 1); + if ((int) sizeof(*val) + 1 != *len) + printf("->%d", *len); + printf("]) = %s\n", errstr); + + /* zero optlen - print returned optlen */ + *len = 0; + get_sockopt(fd, names[i].val, NULL, len); + printf("getsockopt(%d, SOL_NETLINK, %s, NULL, [0", + fd, names[i].str); + if (*len) + printf("->%d", *len); + printf("]) = %s\n", errstr); + +#ifdef NETLINK_LIST_MEMBERSHIPS + if (names[i].val != NETLINK_LIST_MEMBERSHIPS) { +#endif + /* optlen shorter than necessary - print address */ + *len = sizeof(*val) - 1; + get_sockopt(fd, names[i].val, val, len); + printf("getsockopt(%d, SOL_NETLINK, %s, %p, [%d", + fd, names[i].str, val, (int) sizeof(*val) - 1); + if ((int) sizeof(*val) - 1 != *len) + printf("->%d", *len); + printf("]) = %s\n", errstr); +#ifdef NETLINK_LIST_MEMBERSHIPS + } else { + /* optlen shorter than required for the first element */ + *len = sizeof(*val) - 1; + get_sockopt(fd, names[i].val, efault, len); + printf("getsockopt(%d, SOL_NETLINK, %s, ", + fd, names[i].str); + if (rc) + printf("%p", efault); + else + printf("[]"); + printf(", [%d", (int) sizeof(*val) - 1); + if ((int) sizeof(*val) - 1 != *len) + printf("->%d", *len); + printf("]) = %s\n", errstr); + } +#endif + + /* optval EFAULT - print address */ + *len = sizeof(*val); + get_sockopt(fd, names[i].val, efault, len); + printf("getsockopt(%d, SOL_NETLINK, %s, %p, [%d]) = %s\n", + fd, names[i].str, efault, *len, errstr); + + /* optlen EFAULT - print address */ + get_sockopt(fd, names[i].val, val, len + 1); + printf("getsockopt(%d, SOL_NETLINK, %s, %p, %p) = %s\n", + fd, names[i].str, val, len + 1, errstr); + + /* setsockopt */ + + /* classic */ + *val = 0xdefaced; + set_sockopt(fd, names[i].val, val, sizeof(*val)); + printf("setsockopt(%d, SOL_NETLINK, %s, [%d], %d) = %s\n", + fd, names[i].str, *val, (int) sizeof(*val), errstr); + + /* optlen larger than necessary - shortened */ + set_sockopt(fd, names[i].val, val, sizeof(*val) + 1); + printf("setsockopt(%d, SOL_NETLINK, %s, [%d], %d) = %s\n", + fd, names[i].str, *val, (int) sizeof(*val) + 1, errstr); + + /* optlen < 0 - print address */ + set_sockopt(fd, names[i].val, val, -1U); + printf("setsockopt(%d, SOL_NETLINK, %s, %p, -1) = %s\n", + fd, names[i].str, val, errstr); + + /* optlen smaller than necessary - print address */ + set_sockopt(fd, names[i].val, val, sizeof(*val) - 1); + printf("setsockopt(%d, SOL_NETLINK, %s, %p, %d) = %s\n", + fd, names[i].str, val, (int) sizeof(*val) - 1, errstr); + + /* optval EFAULT - print address */ + set_sockopt(fd, names[i].val, efault, sizeof(*val)); + printf("setsockopt(%d, SOL_NETLINK, %s, %p, %d) = %s\n", + fd, names[i].str, efault, (int) sizeof(*val), errstr); + } + + puts("+++ exited with 0 +++"); + return 0; +} diff --git a/tests-m32/sockopt-sol_netlink.gen.test b/tests-m32/sockopt-sol_netlink.gen.test new file mode 100755 index 00000000..a2ba06dd --- /dev/null +++ b/tests-m32/sockopt-sol_netlink.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sockopt-sol_netlink -e trace=getsockopt,setsockopt); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -e trace=getsockopt,setsockopt diff --git a/tests-m32/splice.gen.test b/tests-m32/splice.gen.test index 83c84064..75660806 100755 --- a/tests-m32/splice.gen.test +++ b/tests-m32/splice.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (splice ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (splice ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/stack-fcall-0.c b/tests-m32/stack-fcall-0.c index 12a260de..edd6d326 100644 --- a/tests-m32/stack-fcall-0.c +++ b/tests-m32/stack-fcall-0.c @@ -1,4 +1,4 @@ -int f1(int i); +#include "stack-fcall.h" int f0(int i) { diff --git a/tests-m32/stack-fcall-1.c b/tests-m32/stack-fcall-1.c index 8716702d..5d0bf0e6 100644 --- a/tests-m32/stack-fcall-1.c +++ b/tests-m32/stack-fcall-1.c @@ -1,4 +1,4 @@ -int f2(int i); +#include "stack-fcall.h" int f1(int i) { diff --git a/tests-m32/stack-fcall-2.c b/tests-m32/stack-fcall-2.c index 19f8cf83..e1643207 100644 --- a/tests-m32/stack-fcall-2.c +++ b/tests-m32/stack-fcall-2.c @@ -1,4 +1,4 @@ -int f3(int i); +#include "stack-fcall.h" int f2(int i) { diff --git a/tests-m32/stack-fcall-3.c b/tests-m32/stack-fcall-3.c index 3af1667f..98726d8f 100644 --- a/tests-m32/stack-fcall-3.c +++ b/tests-m32/stack-fcall-3.c @@ -1,4 +1,5 @@ #include <unistd.h> +#include "stack-fcall.h" int f3(int i) { diff --git a/tests-m32/stack-fcall-mangled-0.c b/tests-m32/stack-fcall-mangled-0.c new file mode 100644 index 00000000..47549401 --- /dev/null +++ b/tests-m32/stack-fcall-mangled-0.c @@ -0,0 +1,2 @@ +#define MANGLE +#include "stack-fcall-0.c" diff --git a/tests-m32/stack-fcall-mangled-1.c b/tests-m32/stack-fcall-mangled-1.c new file mode 100644 index 00000000..492c562b --- /dev/null +++ b/tests-m32/stack-fcall-mangled-1.c @@ -0,0 +1,2 @@ +#define MANGLE +#include "stack-fcall-1.c" diff --git a/tests-m32/stack-fcall-mangled-2.c b/tests-m32/stack-fcall-mangled-2.c new file mode 100644 index 00000000..eb7c3624 --- /dev/null +++ b/tests-m32/stack-fcall-mangled-2.c @@ -0,0 +1,2 @@ +#define MANGLE +#include "stack-fcall-2.c" diff --git a/tests-m32/stack-fcall-mangled-3.c b/tests-m32/stack-fcall-mangled-3.c new file mode 100644 index 00000000..98f738b4 --- /dev/null +++ b/tests-m32/stack-fcall-mangled-3.c @@ -0,0 +1,2 @@ +#define MANGLE +#include "stack-fcall-3.c" diff --git a/tests-m32/stack-fcall-mangled.c b/tests-m32/stack-fcall-mangled.c new file mode 100644 index 00000000..67862059 --- /dev/null +++ b/tests-m32/stack-fcall-mangled.c @@ -0,0 +1,2 @@ +#define MANGLE +#include "stack-fcall.c" diff --git a/tests-m32/stack-fcall.c b/tests-m32/stack-fcall.c index fc9ee5f9..e0ec3b1a 100644 --- a/tests-m32/stack-fcall.c +++ b/tests-m32/stack-fcall.c @@ -1,4 +1,4 @@ -int f0(int i); +#include "stack-fcall.h" int main(int argc, char **argv) { diff --git a/tests-m32/stack-fcall.h b/tests-m32/stack-fcall.h new file mode 100644 index 00000000..1a83bad4 --- /dev/null +++ b/tests-m32/stack-fcall.h @@ -0,0 +1,13 @@ +#ifdef MANGLE + +#define f0 _ZN2ns2f0Ei +#define f1 _ZN2ns2f1Ei +#define f2 _ZN2ns2f2Ei +#define f3 _ZN2ns2f3Ei + +#endif + +int f0(int i); +int f1(int i); +int f2(int i); +int f3(int i); diff --git a/tests-m32/statfs.gen.test b/tests-m32/statfs.gen.test index 19b26dd8..32204a14 100755 --- a/tests-m32/statfs.gen.test +++ b/tests-m32/statfs.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (statfs -a17); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (statfs -a17 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a17 +run_strace_match_diff -a17 diff --git a/tests-m32/statfs64.gen.test b/tests-m32/statfs64.gen.test index 66409f9c..8f6f06f7 100755 --- a/tests-m32/statfs64.gen.test +++ b/tests-m32/statfs64.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (statfs64 -a23); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (statfs64 -a23 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a23 +run_strace_match_diff -a23 diff --git a/tests-m32/strace-V.test b/tests-m32/strace-V.test index ec1ca059..eb05e865 100755 --- a/tests-m32/strace-V.test +++ b/tests-m32/strace-V.test @@ -39,8 +39,21 @@ config_year=$(getstr COPYRIGHT_YEAR) } option_unwind=$(getoption USE_LIBUNWIND " stack-unwind") +option_demangle=$(getoption USE_DEMANGLE " stack-demangle") -features="${option_unwind}" +option_m32= +option_mx32= +case "$STRACE_NATIVE_ARCH" in +x86_64) + option_m32=$(getoption HAVE_M32_MPERS ' m32-mpers' ' no-m32-mpers') + option_mx32=$(getoption HAVE_MX32_MPERS ' mx32-mpers' ' no-mx32-mpers') + ;; +aarch64|powerpc64|riscv|s390x|sparc64|tile|x32) + option_m32=$(getoption HAVE_M32_MPERS ' m32-mpers' ' no-m32-mpers') + ;; +esac + +features="${option_unwind}${option_demangle}${option_m32}${option_mx32}" [ -n "$features" ] || features=" (none)" cat > "$EXP" << __EOF__ diff --git a/tests-m32/strace-k-demangle.test b/tests-m32/strace-k-demangle.test new file mode 100755 index 00000000..1616449f --- /dev/null +++ b/tests-m32/strace-k-demangle.test @@ -0,0 +1,7 @@ +#!/bin/sh +# Check strace -k symbol names demangling. + +test_prog=../stack-fcall-mangled +expected='getpid ns::f3(int) ns::f2(int) ns::f1(int) ns::f0(int) main ' + +. "${srcdir=.}"/strace-k.test diff --git a/tests-m32/strace-k.test b/tests-m32/strace-k.test index e68951e8..2a21a9db 100755 --- a/tests-m32/strace-k.test +++ b/tests-m32/strace-k.test @@ -38,11 +38,13 @@ check_prog sed check_prog tr -run_prog ../stack-fcall +: ${test_prog=../stack-fcall} +: ${expected='getpid f3 f2 f1 f0 main '} + +run_prog "$test_prog" run_strace -e getpid -k $args -expected='getpid f3 f2 f1 f0 main ' -result=$(sed -r -n '1,/\(main\+0x[a-f0-9]+\) .*/ s/^.*\(([^+]+)\+0x[a-f0-9]+\) .*/\1/p' "$LOG" | +result=$(sed -r -n '1,/\(main\+0x[a-f0-9]+\) .*/ s/^[^(]+\(([^+]+)\+0x[a-f0-9]+\) .*/\1/p' "$LOG" | tr '\n' ' ') test "$result" = "$expected" || { @@ -50,5 +52,3 @@ test "$result" = "$expected" || { echo "result: \"$result\"" dump_log_and_fail_with "$STRACE $args output mismatch" } - -exit 0 diff --git a/tests-m32/symlink.gen.test b/tests-m32/symlink.gen.test index f41668c3..8cedfbf4 100755 --- a/tests-m32/symlink.gen.test +++ b/tests-m32/symlink.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (symlink -a34); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (symlink -a34 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a34 +run_strace_match_diff -a34 diff --git a/tests-m32/symlinkat.gen.test b/tests-m32/symlinkat.gen.test index 39e624ab..12455dd9 100755 --- a/tests-m32/symlinkat.gen.test +++ b/tests-m32/symlinkat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (symlinkat ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (symlinkat ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/sync.gen.test b/tests-m32/sync.gen.test index 4aaf8c7f..8436a1fa 100755 --- a/tests-m32/sync.gen.test +++ b/tests-m32/sync.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sync -a7); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sync -a7 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a7 +run_strace_match_diff -a7 diff --git a/tests-m32/sync_file_range.gen.test b/tests-m32/sync_file_range.gen.test index 0693c12e..2f41c7db 100755 --- a/tests-m32/sync_file_range.gen.test +++ b/tests-m32/sync_file_range.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sync_file_range ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sync_file_range ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/sync_file_range2.gen.test b/tests-m32/sync_file_range2.gen.test index 23046b6b..d432647a 100755 --- a/tests-m32/sync_file_range2.gen.test +++ b/tests-m32/sync_file_range2.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sync_file_range2 ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sync_file_range2 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/syntax.sh b/tests-m32/syntax.sh index 0a0d2a57..b1c8fdc1 100644 --- a/tests-m32/syntax.sh +++ b/tests-m32/syntax.sh @@ -50,13 +50,11 @@ check_exit_status_and_stderr_using_grep() "strace $* failed to print expected diagnostics" } -strace_exp="${STRACE##* }" - check_e() { local pattern="$1"; shift cat > "$EXP" << __EOF__ -$strace_exp: $pattern +$STRACE_EXE: $pattern __EOF__ check_exit_status_and_stderr "$@" } @@ -65,7 +63,7 @@ check_e_using_grep() { local pattern="$1"; shift cat > "$EXP" << __EOF__ -$strace_exp: $pattern +$STRACE_EXE: $pattern __EOF__ check_exit_status_and_stderr_using_grep "$@" } @@ -74,8 +72,8 @@ check_h() { local pattern="$1"; shift cat > "$EXP" << __EOF__ -$strace_exp: $pattern -Try '$strace_exp -h' for more information. +$STRACE_EXE: $pattern +Try '$STRACE_EXE -h' for more information. __EOF__ check_exit_status_and_stderr "$@" } diff --git a/tests-m32/sysinfo.gen.test b/tests-m32/sysinfo.gen.test index e6469d55..fa462376 100755 --- a/tests-m32/sysinfo.gen.test +++ b/tests-m32/sysinfo.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sysinfo -a14); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sysinfo -a14 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a14 +run_strace_match_diff -a14 diff --git a/tests-m32/syslog.gen.test b/tests-m32/syslog.gen.test index 5423d5bb..5707a3e2 100755 --- a/tests-m32/syslog.gen.test +++ b/tests-m32/syslog.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (syslog -a36); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (syslog -a36 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a36 +run_strace_match_diff -a36 diff --git a/tests-m32/tee.gen.test b/tests-m32/tee.gen.test index 2a87fae3..b5fbfc05 100755 --- a/tests-m32/tee.gen.test +++ b/tests-m32/tee.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (tee ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (tee ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/test_printpath.c b/tests-m32/test_printpath.c index 5f482f25..c485a26f 100644 --- a/tests-m32/test_printpath.c +++ b/tests-m32/test_printpath.c @@ -2,6 +2,7 @@ * Test printpath/umovestr. * * Copyright (c) 2015-2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2017-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,10 +30,10 @@ #include "tests.h" +#include <limits.h> #include <stdio.h> #include <string.h> #include <unistd.h> -#include <sys/param.h> #include "test_ucopy.h" diff --git a/tests-m32/test_ucopy.c b/tests-m32/test_ucopy.c index 9ddffbca..09f809a2 100644 --- a/tests-m32/test_ucopy.c +++ b/tests-m32/test_ucopy.c @@ -2,6 +2,7 @@ * Test whether process_vm_readv and PTRACE_PEEKDATA work. * * Copyright (c) 2016-2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2017-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,10 +31,10 @@ #include "tests.h" #include <errno.h> +#include <sys/ptrace.h> #include <signal.h> #include <stdlib.h> #include <unistd.h> -#include <sys/ptrace.h> #include <sys/uio.h> #include <sys/wait.h> diff --git a/tests-m32/tests.h b/tests-m32/tests.h index d453e3e0..1c66c265 100644 --- a/tests-m32/tests.h +++ b/tests-m32/tests.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -75,6 +75,15 @@ void error_msg_and_skip(const char *, ...) void perror_msg_and_skip(const char *, ...) ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN; +#ifndef perror_msg_and_fail +# define perror_msg_and_fail(fmt_, ...) \ + perror_msg_and_fail("%s:%d: " fmt_, __FILE__, __LINE__, ##__VA_ARGS__) +#endif +#ifndef perror_msg_and_fail +# define error_msg_and_fail(fmt_, ...) \ + error_msg_and_fail("%s:%d: " fmt_, __FILE__, __LINE__, ##__VA_ARGS__) +#endif + /* Stat the specified file and skip the test if the stat call failed. */ void skip_if_unavailable(const char *); diff --git a/tests-m32/time.gen.test b/tests-m32/time.gen.test index ed7ec69a..3269b164 100755 --- a/tests-m32/time.gen.test +++ b/tests-m32/time.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (time -a10); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (time -a10 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a10 +run_strace_match_diff -a10 diff --git a/tests-m32/timer_create.gen.test b/tests-m32/timer_create.gen.test index 6b4c543d..bf652612 100755 --- a/tests-m32/timer_create.gen.test +++ b/tests-m32/timer_create.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (timer_create ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (timer_create ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/times.gen.test b/tests-m32/times.gen.test index ca4ebbe5..06b036fc 100755 --- a/tests-m32/times.gen.test +++ b/tests-m32/times.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (times -esignal=none); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (times -esignal=none ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -esignal=none +run_strace_match_diff -esignal=none diff --git a/tests-m32/truncate.gen.test b/tests-m32/truncate.gen.test index 0410e73d..7a631ef0 100755 --- a/tests-m32/truncate.gen.test +++ b/tests-m32/truncate.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (truncate ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (truncate ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/truncate64.gen.test b/tests-m32/truncate64.gen.test index dae0fe6f..2b368f44 100755 --- a/tests-m32/truncate64.gen.test +++ b/tests-m32/truncate64.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (truncate64 ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (truncate64 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-m32/ugetrlimit.gen.test b/tests-m32/ugetrlimit.gen.test index ff27134a..a412fe6a 100755 --- a/tests-m32/ugetrlimit.gen.test +++ b/tests-m32/ugetrlimit.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ugetrlimit -a28); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ugetrlimit -a28 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a28 +run_strace_match_diff -a28 diff --git a/tests-m32/umask.gen.test b/tests-m32/umask.gen.test index 60af5e9a..5d6c3187 100755 --- a/tests-m32/umask.gen.test +++ b/tests-m32/umask.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (umask -a11); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (umask -a11 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a11 +run_strace_match_diff -a11 diff --git a/tests-m32/umovestr3.c b/tests-m32/umovestr3.c index cf2fa7d4..74f0e934 100644 --- a/tests-m32/umovestr3.c +++ b/tests-m32/umovestr3.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,9 +27,9 @@ */ #include "tests.h" +#include <limits.h> #include <stdio.h> #include <unistd.h> -#include <sys/param.h> int main(void) diff --git a/tests-m32/unlink.gen.test b/tests-m32/unlink.gen.test index 7b8522b4..63bc0c42 100755 --- a/tests-m32/unlink.gen.test +++ b/tests-m32/unlink.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (unlink -a24); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (unlink -a24 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a24 +run_strace_match_diff -a24 diff --git a/tests-m32/unlinkat.gen.test b/tests-m32/unlinkat.gen.test index 5a77c6ab..5de79084 100755 --- a/tests-m32/unlinkat.gen.test +++ b/tests-m32/unlinkat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (unlinkat -a35); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (unlinkat -a35 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a35 +run_strace_match_diff -a35 diff --git a/tests-m32/unshare.gen.test b/tests-m32/unshare.gen.test index 077a4580..782ce47a 100755 --- a/tests-m32/unshare.gen.test +++ b/tests-m32/unshare.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (unshare -a11); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (unshare -a11 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a11 +run_strace_match_diff -a11 diff --git a/tests-m32/userfaultfd.gen.test b/tests-m32/userfaultfd.gen.test index 47351466..61b6988e 100755 --- a/tests-m32/userfaultfd.gen.test +++ b/tests-m32/userfaultfd.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (userfaultfd -a38); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (userfaultfd -a38 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a38 +run_strace_match_diff -a38 diff --git a/tests-m32/ustat.gen.test b/tests-m32/ustat.gen.test index f64b28d9..2b09f7e9 100755 --- a/tests-m32/ustat.gen.test +++ b/tests-m32/ustat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ustat -a33); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ustat -a33 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a33 +run_strace_match_diff -a33 diff --git a/tests-m32/utime.gen.test b/tests-m32/utime.gen.test index 72705566..58ebc5ac 100755 --- a/tests-m32/utime.gen.test +++ b/tests-m32/utime.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (utime -a16); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (utime -a16 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a16 +run_strace_match_diff -a16 diff --git a/tests-m32/utimensat.gen.test b/tests-m32/utimensat.gen.test index a4d6656e..07dffa37 100755 --- a/tests-m32/utimensat.gen.test +++ b/tests-m32/utimensat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (utimensat -a33); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (utimensat -a33 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a33 +run_strace_match_diff -a33 diff --git a/tests-m32/utimes.gen.test b/tests-m32/utimes.gen.test index 37ed29cd..559243e9 100755 --- a/tests-m32/utimes.gen.test +++ b/tests-m32/utimes.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (utimes -a17); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (utimes -a17 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a17 +run_strace_match_diff -a17 diff --git a/tests-m32/vhangup.gen.test b/tests-m32/vhangup.gen.test index 7ac84e57..da192169 100755 --- a/tests-m32/vhangup.gen.test +++ b/tests-m32/vhangup.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (vhangup -a10); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (vhangup -a10 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a10 +run_strace_match_diff -a10 diff --git a/tests-m32/vmsplice.gen.test b/tests-m32/vmsplice.gen.test index fe6a07d3..0dc18b63 100755 --- a/tests-m32/vmsplice.gen.test +++ b/tests-m32/vmsplice.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (vmsplice -ewrite=1); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (vmsplice -ewrite=1 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -ewrite=1 +run_strace_match_diff -ewrite=1 diff --git a/tests-m32/wait4.gen.test b/tests-m32/wait4.gen.test index ae04915f..22a982fd 100755 --- a/tests-m32/wait4.gen.test +++ b/tests-m32/wait4.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (wait4 -esignal=none); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (wait4 -esignal=none ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -esignal=none +run_strace_match_diff -esignal=none diff --git a/tests-m32/waitid.gen.test b/tests-m32/waitid.gen.test index 59f40228..22edd673 100755 --- a/tests-m32/waitid.gen.test +++ b/tests-m32/waitid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (waitid -esignal=none); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (waitid -esignal=none ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -esignal=none +run_strace_match_diff -esignal=none diff --git a/tests-m32/waitpid.gen.test b/tests-m32/waitpid.gen.test index d91e2985..a5678a1a 100755 --- a/tests-m32/waitpid.gen.test +++ b/tests-m32/waitpid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (waitpid -a28); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (waitpid -a28 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a28 +run_strace_match_diff -a28 diff --git a/tests-m32/xet_thread_area_x86.c b/tests-m32/xet_thread_area_x86.c new file mode 100644 index 00000000..68f495cb --- /dev/null +++ b/tests-m32/xet_thread_area_x86.c @@ -0,0 +1,227 @@ +/* + * Check decoding of set_thread_area and get_thread_area syscalls on x86 + * architecture. + * + * Copyright (c) 2018 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" + +#include <asm/unistd.h> + +#if defined __NR_get_thread_area && defined __NR_set_thread_area \ + && defined HAVE_STRUCT_USER_DESC + +# include <assert.h> +# include <errno.h> +# include <stdbool.h> +# include <stdio.h> +# include <stdint.h> +# include <string.h> +# include <unistd.h> + +# include "print_user_desc.c" + +long errnum; + +static void +printptr(kernel_ulong_t ptr, const char *ptr_str) +{ + if (ptr_str) + printf("%s", ptr_str); + else + printf("%#llx", zero_extend_signed_to_ull(ptr)); +} + +/** + * Perform set_thread_area call along with printing the expected output. + * + * @param ptr_val Pointer to thread area argument. + * @param ptr_str Explicit string representation of the argument. + * @param valid Whether argument points to the valid memory and its contents + * should be decoded. + * @param entry_number_str explicit decoding of the entry_number field. + */ +static long +set_thread_area(kernel_ulong_t ptr_val, const char *ptr_str, bool valid, + const char *entry_number_str) +{ + struct user_desc *ptr = (struct user_desc *) (uintptr_t) ptr_val; + long rc = -1; + int saved_errno; + + rc = syscall(__NR_set_thread_area, ptr_val); + saved_errno = errno; + printf("set_thread_area("); + + if (valid) + print_user_desc(ptr, entry_number_str); + else + printptr(ptr_val, ptr_str); + + errno = saved_errno; + printf(") = %s", sprintrc(rc)); + if (!rc) + printf(" (entry_number=%u)", ptr->entry_number); + + puts(""); + + return rc; +} + +/** + * Perform get_thread_are call along with printing the expected output and + * checking the result against the argument of the previous set_thread_area + * call, if it had place. + * + * @param ptr_val Pointer to thread area argument. + * @param ptr_str Explicit string representation of the argument. + * @param valid Whether argument points to the valid memory and its contents + * should be decoded. + * @param set_rc Return code of the previous set_thread_area call. + * @param expected The value of the argument passed to the previous + * set_thread_area call. + */ +static void +get_thread_area(kernel_ulong_t ptr_val, const char *ptr_str, bool valid, + long set_rc, kernel_ulong_t expected) +{ + struct user_desc *ptr = (struct user_desc *) (uintptr_t) ptr_val; + struct user_desc *expected_ptr = + (struct user_desc *) (uintptr_t) expected; + int saved_errno; + long rc; + + rc = syscall(__NR_get_thread_area, ptr_val); + saved_errno = errno; + + printf("get_thread_area("); + + if (valid && !rc) { + if (!set_rc) { + assert(ptr->entry_number == expected_ptr->entry_number); + assert(ptr->base_addr == expected_ptr->base_addr); + assert(ptr->limit == expected_ptr->limit); + assert(ptr->seg_32bit == expected_ptr->seg_32bit); + assert(ptr->contents == expected_ptr->contents); + assert(ptr->read_exec_only == + expected_ptr->read_exec_only); + assert(ptr->limit_in_pages == + expected_ptr->limit_in_pages); + assert(ptr->seg_not_present == + expected_ptr->seg_not_present); + assert(ptr->useable == expected_ptr->useable); + /* + * We do not check lm as 32-bit processes ignore it, and + * only 32-bit processes can successfully execute + * get_thread_area. + */ + } + + print_user_desc(ptr, + (int) ptr->entry_number == -1 ? "-1" : NULL); + } else { + printptr(ptr_val, ptr_str); + } + + errno = saved_errno; + printf(") = %s\n", sprintrc(rc)); +} + +int main(void) +{ + struct user_desc *ta1 = tail_alloc(sizeof(*ta1)); + struct user_desc *ta2 = tail_alloc(sizeof(*ta2)); + unsigned *bogus_entry_number = tail_alloc(sizeof(*bogus_entry_number)); + + long set_rc = -1; + + /* + * Let's do some weird syscall, it will mark the beginning of our + * expected output. + */ + syscall(__NR_reboot, 0, 0, 0, 0); + + set_rc = set_thread_area((uintptr_t) ARG_STR(NULL), false, NULL); + get_thread_area((uintptr_t) ARG_STR(NULL), false, set_rc, + (uintptr_t) NULL); + + set_rc = set_thread_area(-1, NULL, false, NULL); + get_thread_area(-1, NULL, false, set_rc, -1); + + fill_memory(ta1, sizeof(*ta1)); + fill_memory_ex(ta2, sizeof(*ta2), 0xA5, 0x5A); + + set_thread_area((uintptr_t) (ta1 + 1), NULL, false, NULL); + + set_thread_area((uintptr_t) bogus_entry_number, NULL, false, NULL); + + set_thread_area((uintptr_t) ta1, NULL, true, NULL); + + ta1->entry_number = -1; + ta1->base_addr = 0; + ta1->limit = 0; + ta1->contents = 1; + ta1->seg_32bit = 1; + ta1->seg_not_present = 0; + + set_rc = set_thread_area((uintptr_t) ta1, NULL, true, "-1"); + + *bogus_entry_number = 2718281828U; + get_thread_area((uintptr_t) bogus_entry_number, + "{entry_number=2718281828, ...}", + false, set_rc, (uintptr_t) ta1); + + /* That one should return -EFAULT on i386 */ + *bogus_entry_number = 12; + get_thread_area((uintptr_t) bogus_entry_number, + "{entry_number=12, ...}", + false, set_rc, (uintptr_t) ta1); + + ta2->entry_number = 3141592653U; + get_thread_area((uintptr_t) ta2, "{entry_number=3141592653, ...}", + false, set_rc, (uintptr_t) ta1); + + ta2->entry_number = -1; + get_thread_area((uintptr_t) ta2, "{entry_number=-1, ...}", + false, set_rc, (uintptr_t) ta1); + + ta2->entry_number = ta1->entry_number; + assert(set_rc == 0 || (int) ta2->entry_number == -1); + get_thread_area((uintptr_t) ta2, "{entry_number=-1, ...}", + true, set_rc, (uintptr_t) ta1); + + puts("+++ exited with 0 +++"); + + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_get_thread_area && __NR_set_thread_area" + " && HAVE_STRUCT_USER_DESC"); + +#endif diff --git a/tests-m32/xet_thread_area_x86.test b/tests-m32/xet_thread_area_x86.test new file mode 100755 index 00000000..863f7e21 --- /dev/null +++ b/tests-m32/xet_thread_area_x86.test @@ -0,0 +1,11 @@ +#!/bin/sh + +# Check decoding of set_thread_area and get_thread_area syscalls on x86. + +. "${srcdir=.}/init.sh" + +check_prog sed +run_prog > /dev/null +run_strace -a22 -e trace=reboot,/[gs]et_thread_area $args > "$EXP" +sed '0,/^reboot/d' "$LOG" > "$OUT" +match_diff "$OUT" "$EXP" diff --git a/tests-m32/xselect.c b/tests-m32/xselect.c index a25ebcc6..b1e37662 100644 --- a/tests-m32/xselect.c +++ b/tests-m32/xselect.c @@ -1,5 +1,7 @@ /* - * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org> + * Check decoding of select/_newselect syscalls. + * + * Copyright (c) 2015-2018 Dmitry V. Levin <ldv@altlinux.org> * Copyright (c) 2015-2017 The strace developers. * All rights reserved. * @@ -30,127 +32,442 @@ * Based on test by Dr. David Alan Gilbert <dave@treblig.org> */ -#include <assert.h> +#include <errno.h> +#include <limits.h> +#include <stdint.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <sys/select.h> -static fd_set set[0x1000000 / sizeof(fd_set)]; +static const char *errstr; -int main(void) +static long +xselect(const kernel_ulong_t nfds, + const kernel_ulong_t rs, + const kernel_ulong_t ws, + const kernel_ulong_t es, + const kernel_ulong_t tv) +#ifndef xselect { - TAIL_ALLOC_OBJECT_CONST_PTR(struct timeval, tv); - struct timeval tv_in; - int fds[2]; - long rc; + long rc = syscall(TEST_SYSCALL_NR, + F8ILL_KULONG_MASK | nfds, rs, ws, es, tv); + errstr = sprintrc(rc); + return rc; +} +#else + ; +#endif + +#define XSELECT(expected_, ...) \ + do { \ + long rc = xselect(__VA_ARGS__); \ + if (rc != (expected_)) \ + perror_msg_and_fail(TEST_SYSCALL_STR \ + ": expected %d" \ + ", returned %ld", \ + (expected_), rc); \ + } while (0) \ +/* End of XSELECT definition. */ + +int +main(void) +{ +#ifdef PATH_TRACING_FD + skip_if_unavailable("/proc/self/fd/"); +#endif + + for (int i = 3; i < FD_SETSIZE; ++i) { +#ifdef PATH_TRACING_FD + if (i == PATH_TRACING_FD) + continue; +#endif + (void) close(i); + } + int fds[2]; if (pipe(fds)) perror_msg_and_fail("pipe"); + static const int smallset_size = sizeof(kernel_ulong_t) * 8; + const int nfds = fds[1] + 1; + if (nfds > smallset_size) + error_msg_and_fail("nfds[%d] > smallset_size[%d]\n", + nfds, smallset_size); + + struct timeval tv_in = { 0, 123 }; + struct timeval *const tv = tail_memdup(&tv_in, sizeof(tv_in)); + const uintptr_t a_tv = (uintptr_t) tv; + + TAIL_ALLOC_OBJECT_VAR_PTR(kernel_ulong_t, l_rs); + fd_set *const rs = (void *) l_rs; + const uintptr_t a_rs = (uintptr_t) rs; + + TAIL_ALLOC_OBJECT_VAR_PTR(kernel_ulong_t, l_ws); + fd_set *const ws = (void *) l_ws; + const uintptr_t a_ws = (uintptr_t) ws; + + TAIL_ALLOC_OBJECT_VAR_PTR(kernel_ulong_t, l_es); + fd_set *const es = (void *) l_es; + const uintptr_t a_es = (uintptr_t) es; + + long rc; + /* - * Start with a nice simple select. + * An equivalent of nanosleep. */ - FD_ZERO(set); - FD_SET(fds[0], set); - FD_SET(fds[1], set); - rc = syscall(TEST_SYSCALL_NR, fds[1] + 1, set, set, set, NULL); - if (rc < 0) - perror_msg_and_skip(TEST_SYSCALL_STR); - assert(rc == 1); - printf("%s(%d, [%d %d], [%d %d], [%d %d], NULL) = 1 ()\n", - TEST_SYSCALL_STR, fds[1] + 1, fds[0], fds[1], - fds[0], fds[1], fds[0], fds[1]); + if (xselect(0, 0, 0, 0, a_tv)) { + if (errno == ENOSYS) + perror_msg_and_skip(TEST_SYSCALL_STR); + else + perror_msg_and_fail(TEST_SYSCALL_STR); + } +#ifndef PATH_TRACING_FD + printf("%s(0, NULL, NULL, NULL, {tv_sec=%lld, tv_usec=%llu})" + " = 0 (Timeout)\n", + TEST_SYSCALL_STR, (long long) tv_in.tv_sec, + zero_extend_signed_to_ull(tv_in.tv_usec)); +#endif + + /* EFAULT on tv argument */ + XSELECT(-1, 0, 0, 0, 0, a_tv + 1); +#ifndef PATH_TRACING_FD + printf("%s(0, NULL, NULL, NULL, %#lx) = %s\n", + TEST_SYSCALL_STR, (unsigned long) a_tv + 1, errstr); +#endif + + /* + * Start with a nice simple select with the same set. + */ + for (int i = nfds; i <= smallset_size; ++i) { + *l_rs = (1UL << fds[0]) | (1UL << fds[1]); + XSELECT(1, i, a_rs, a_rs, a_rs, 0); +#ifndef PATH_TRACING_FD + printf("%s(%d, [%d %d], [%d %d], [%d %d], NULL) = 1 ()\n", + TEST_SYSCALL_STR, i, fds[0], fds[1], + fds[0], fds[1], fds[0], fds[1]); +#else + *l_rs = (1UL << fds[0]) | (1UL << fds[1]) | + (1UL << PATH_TRACING_FD); + XSELECT(i > PATH_TRACING_FD ? 3 : 1, i, a_rs, a_rs, a_rs, 0); + if (i > PATH_TRACING_FD) { + printf("%s(%d, [%d %d %d], [%d %d %d], [%d %d %d]" + ", NULL) = 3 ()\n", + TEST_SYSCALL_STR, i, + fds[0], fds[1], PATH_TRACING_FD, + fds[0], fds[1], PATH_TRACING_FD, + fds[0], fds[1], PATH_TRACING_FD); + } +#endif + } /* * Odd timeout. */ - FD_SET(fds[0], set); - FD_SET(fds[1], set); - tv->tv_sec = 0xdeadbeefU; - tv->tv_usec = 0xfacefeedU; - memcpy(&tv_in, tv, sizeof(tv_in)); - rc = syscall(TEST_SYSCALL_NR, fds[1] + 1, set, set, set, tv); + *l_rs = (1UL << fds[0]) | (1UL << fds[1]); + tv_in.tv_sec = 0xdeadbeefU; + tv_in.tv_usec = 0xfacefeedU; + memcpy(tv, &tv_in, sizeof(tv_in)); + rc = xselect(nfds, a_rs, a_rs, a_rs, a_tv); if (rc < 0) { +#ifndef PATH_TRACING_FD printf("%s(%d, [%d %d], [%d %d], [%d %d]" ", {tv_sec=%lld, tv_usec=%llu}) = %s\n", - TEST_SYSCALL_STR, fds[1] + 1, fds[0], fds[1], - fds[0], fds[1], fds[0], fds[1], (long long) tv->tv_sec, - zero_extend_signed_to_ull(tv->tv_usec), sprintrc(rc)); + TEST_SYSCALL_STR, nfds, fds[0], fds[1], + fds[0], fds[1], fds[0], fds[1], + (long long) tv_in.tv_sec, + zero_extend_signed_to_ull(tv_in.tv_usec), + errstr); +#endif /* !PATH_TRACING_FD */ } else { +#ifndef PATH_TRACING_FD printf("%s(%d, [%d %d], [%d %d], [%d %d]" ", {tv_sec=%lld, tv_usec=%llu}) = %ld" " (left {tv_sec=%lld, tv_usec=%llu})\n", - TEST_SYSCALL_STR, fds[1] + 1, fds[0], fds[1], - fds[0], fds[1], fds[0], fds[1], (long long) tv_in.tv_sec, + TEST_SYSCALL_STR, nfds, fds[0], fds[1], + fds[0], fds[1], fds[0], fds[1], + (long long) tv_in.tv_sec, zero_extend_signed_to_ull(tv_in.tv_usec), rc, (long long) tv->tv_sec, zero_extend_signed_to_ull(tv->tv_usec)); +#endif /* !PATH_TRACING_FD */ } - FD_SET(fds[0], set); - FD_SET(fds[1], set); - tv->tv_sec = (time_t) 0xcafef00ddeadbeefLL; - tv->tv_usec = (suseconds_t) 0xbadc0dedfacefeedLL; - memcpy(&tv_in, tv, sizeof(tv_in)); - rc = syscall(TEST_SYSCALL_NR, fds[1] + 1, set, set, set, tv); + /* + * Very odd timeout. + */ + *l_rs = (1UL << fds[0]) | (1UL << fds[1]); + tv_in.tv_sec = (time_t) 0xcafef00ddeadbeefLL; + tv_in.tv_usec = (suseconds_t) 0xbadc0dedfacefeedLL; + memcpy(tv, &tv_in, sizeof(tv_in)); + rc = xselect(nfds, a_rs, a_rs, a_rs, a_tv); if (rc < 0) { +#ifndef PATH_TRACING_FD printf("%s(%d, [%d %d], [%d %d], [%d %d]" ", {tv_sec=%lld, tv_usec=%llu}) = %s\n", - TEST_SYSCALL_STR, fds[1] + 1, fds[0], fds[1], - fds[0], fds[1], fds[0], fds[1], (long long) tv->tv_sec, - zero_extend_signed_to_ull(tv->tv_usec), sprintrc(rc)); + TEST_SYSCALL_STR, nfds, fds[0], fds[1], + fds[0], fds[1], fds[0], fds[1], + (long long) tv_in.tv_sec, + zero_extend_signed_to_ull(tv_in.tv_usec), + errstr); +#endif /* PATH_TRACING_FD */ } else { +#ifndef PATH_TRACING_FD printf("%s(%d, [%d %d], [%d %d], [%d %d]" ", {tv_sec=%lld, tv_usec=%llu}) = %ld" " (left {tv_sec=%lld, tv_usec=%llu})\n", - TEST_SYSCALL_STR, fds[1] + 1, fds[0], fds[1], - fds[0], fds[1], fds[0], fds[1], (long long) tv_in.tv_sec, + TEST_SYSCALL_STR, nfds, fds[0], fds[1], + fds[0], fds[1], fds[0], fds[1], + (long long) tv_in.tv_sec, zero_extend_signed_to_ull(tv_in.tv_usec), rc, (long long) tv->tv_sec, zero_extend_signed_to_ull(tv->tv_usec)); +#endif /* PATH_TRACING_FD */ } /* * Another simple one, with a timeout. */ - FD_SET(1, set); - FD_SET(2, set); - FD_SET(fds[0], set); - FD_SET(fds[1], set); - tv->tv_sec = 0xc0de1; - tv->tv_usec = 0xc0de2; - memcpy(&tv_in, tv, sizeof(tv_in)); - assert(syscall(TEST_SYSCALL_NR, fds[1] + 1, NULL, set, NULL, tv) == 3); - printf("%s(%d, NULL, [1 2 %d %d], NULL, {tv_sec=%lld, tv_usec=%llu})" - " = 3 (out [1 2 %d], left {tv_sec=%lld, tv_usec=%llu})\n", - TEST_SYSCALL_STR, fds[1] + 1, fds[0], fds[1], - (long long) tv_in.tv_sec, - zero_extend_signed_to_ull(tv_in.tv_usec), - fds[1], - (long long) tv->tv_sec, - zero_extend_signed_to_ull(tv->tv_usec)); + for (int i = nfds; i <= smallset_size; ++i) { + *l_rs = (1UL << fds[0]) | (1UL << fds[1]); + *l_ws = (1UL << 1) | (1UL << 2) | + (1UL << fds[0]) | (1UL << fds[1]); + *l_es = 0; + tv_in.tv_sec = 0xc0de1; + tv_in.tv_usec = 0xc0de2; + memcpy(tv, &tv_in, sizeof(tv_in)); + XSELECT(3, i, a_rs, a_ws, a_es, a_tv); +#ifndef PATH_TRACING_FD + printf("%s(%d, [%d %d], [%d %d %d %d], []" + ", {tv_sec=%lld, tv_usec=%llu}) = 3 (out [1 2 %d]" + ", left {tv_sec=%lld, tv_usec=%llu})\n", + TEST_SYSCALL_STR, i, fds[0], fds[1], + 1, 2, fds[0], fds[1], + (long long) tv_in.tv_sec, + zero_extend_signed_to_ull(tv_in.tv_usec), + fds[1], + (long long) tv->tv_sec, + zero_extend_signed_to_ull(tv->tv_usec)); +#else + *l_rs = (1UL << fds[0]) | (1UL << fds[1]) | + (1UL << PATH_TRACING_FD); + *l_ws = (1UL << 1) | (1UL << 2) | + (1UL << fds[0]) | (1UL << fds[1]); + tv_in.tv_sec = 0xc0de1; + tv_in.tv_usec = 0xc0de2; + memcpy(tv, &tv_in, sizeof(tv_in)); + XSELECT(3 + (i > PATH_TRACING_FD), i, a_rs, a_ws, a_es, a_tv); + if (i > PATH_TRACING_FD) { + printf("%s(%d, [%d %d %d], [%d %d %d %d], []" + ", {tv_sec=%lld, tv_usec=%llu})" + " = 4 (in [%d], out [1 2 %d]" + ", left {tv_sec=%lld, tv_usec=%llu})\n", + TEST_SYSCALL_STR, i, + fds[0], fds[1], PATH_TRACING_FD, + 1, 2, fds[0], fds[1], + (long long) tv_in.tv_sec, + zero_extend_signed_to_ull(tv_in.tv_usec), + PATH_TRACING_FD, fds[1], + (long long) tv->tv_sec, + zero_extend_signed_to_ull(tv->tv_usec)); + } + + *l_rs = (1UL << fds[0]) | (1UL << fds[1]); + *l_ws = (1UL << 1) | (1UL << 2) | + (1UL << fds[0]) | (1UL << fds[1]) | + (1UL << PATH_TRACING_FD); + tv_in.tv_sec = 0xc0de1; + tv_in.tv_usec = 0xc0de2; + memcpy(tv, &tv_in, sizeof(tv_in)); + XSELECT(3 + (i > PATH_TRACING_FD), i, a_rs, a_ws, a_es, a_tv); + if (i > PATH_TRACING_FD) { + printf("%s(%d, [%d %d], [%d %d %d %d %d], []" + ", {tv_sec=%lld, tv_usec=%llu})" + " = 4 (out [1 2 %d %d]" + ", left {tv_sec=%lld, tv_usec=%llu})\n", + TEST_SYSCALL_STR, i, + fds[0], fds[1], + 1, 2, fds[0], fds[1], PATH_TRACING_FD, + (long long) tv_in.tv_sec, + zero_extend_signed_to_ull(tv_in.tv_usec), + fds[1], PATH_TRACING_FD, + (long long) tv->tv_sec, + zero_extend_signed_to_ull(tv->tv_usec)); + } + + *l_rs = (1UL << fds[0]) | (1UL << fds[1]); + *l_ws = (1UL << 1) | (1UL << 2) | + (1UL << fds[0]) | (1UL << fds[1]); + *l_es = (1UL << PATH_TRACING_FD); + tv_in.tv_sec = 0xc0de1; + tv_in.tv_usec = 0xc0de2; + memcpy(tv, &tv_in, sizeof(tv_in)); + XSELECT(3, i, a_rs, a_ws, a_es, a_tv); + if (i > PATH_TRACING_FD) { + printf("%s(%d, [%d %d], [%d %d %d %d], [%d]" + ", {tv_sec=%lld, tv_usec=%llu}) = 3 (out [1 2 %d]" + ", left {tv_sec=%lld, tv_usec=%llu})\n", + TEST_SYSCALL_STR, i, + fds[0], fds[1], + 1, 2, fds[0], fds[1], PATH_TRACING_FD, + (long long) tv_in.tv_sec, + zero_extend_signed_to_ull(tv_in.tv_usec), + fds[1], + (long long) tv->tv_sec, + zero_extend_signed_to_ull(tv->tv_usec)); + } + +#endif /* PATH_TRACING_FD */ + } /* * Now the crash case that trinity found, negative nfds * but with a pointer to a large chunk of valid memory. */ - FD_ZERO(set); + static fd_set set[0x1000000 / sizeof(fd_set)]; FD_SET(fds[1], set); - assert(syscall(TEST_SYSCALL_NR, -1, NULL, set, NULL, NULL) == -1); - printf("%s(-1, NULL, %p, NULL, NULL) = -1 EINVAL (%m)\n", - TEST_SYSCALL_STR, set); + XSELECT(-1, -1U, 0, (uintptr_t) set, 0, 0); +#ifndef PATH_TRACING_FD + printf("%s(-1, NULL, %p, NULL, NULL) = %s\n", + TEST_SYSCALL_STR, set, errstr); +#endif /* - * Another variant, with nfds exceeding FD_SETSIZE limit. + * Big sets, nfds exceeds FD_SETSIZE limit. */ - FD_ZERO(set); + const size_t big_size = sizeof(fd_set) + sizeof(long); + fd_set *const big_rs = tail_alloc(big_size); + const uintptr_t a_big_rs = (uintptr_t) big_rs; + + fd_set *const big_ws = tail_alloc(big_size); + const uintptr_t a_big_ws = (uintptr_t) big_ws; + + for (unsigned int i = FD_SETSIZE; i <= big_size * 8; ++i) { + memset(big_rs, 0, big_size); + memset(big_ws, 0, big_size); + FD_SET(fds[0], big_rs); + tv->tv_sec = 0; + tv->tv_usec = 10 + (i - FD_SETSIZE); + XSELECT(0, i, a_big_rs, a_big_ws, 0, a_tv); +#ifndef PATH_TRACING_FD + printf("%s(%d, [%d], [], NULL, {tv_sec=0, tv_usec=%d})" + " = 0 (Timeout)\n", + TEST_SYSCALL_STR, i, fds[0], 10 + (i - FD_SETSIZE)); +#else + FD_SET(fds[0], big_rs); + FD_SET(PATH_TRACING_FD, big_rs); + tv->tv_sec = 0; + tv->tv_usec = 10 + (i - FD_SETSIZE); + XSELECT(1, i, a_big_rs, a_big_ws, 0, a_tv); + printf("%s(%d, [%d %d], [], NULL, {tv_sec=0, tv_usec=%d})" + " = 1 (in [%d], left {tv_sec=0, tv_usec=%llu})\n", + TEST_SYSCALL_STR, i, fds[0], PATH_TRACING_FD, + 10 + (i - FD_SETSIZE), PATH_TRACING_FD, + zero_extend_signed_to_ull(tv->tv_usec)); +#endif /* PATH_TRACING_FD */ + } + + /* + * Huge sets, nfds equals to INT_MAX. + */ + FD_SET(fds[0], set); + FD_SET(fds[1], set); + tv->tv_sec = 0; + tv->tv_usec = 123; + XSELECT(0, INT_MAX, (uintptr_t) set, (uintptr_t) &set[1], + (uintptr_t) &set[2], a_tv); +#ifndef PATH_TRACING_FD + printf("%s(%d, [%d %d], [], [], {tv_sec=0, tv_usec=123})" + " = 0 (Timeout)\n", + TEST_SYSCALL_STR, INT_MAX, fds[0], fds[1]); +#else FD_SET(fds[0], set); + FD_SET(fds[1], set); + FD_SET(PATH_TRACING_FD, set); tv->tv_sec = 0; tv->tv_usec = 123; - assert(syscall(TEST_SYSCALL_NR, FD_SETSIZE + 1, set, set + 1, NULL, tv) == 0); - printf("%s(%d, [%d], [], NULL, {tv_sec=0, tv_usec=123}) = 0 (Timeout)\n", - TEST_SYSCALL_STR, FD_SETSIZE + 1, fds[0]); + XSELECT(1, INT_MAX, (uintptr_t) set, (uintptr_t) &set[1], + (uintptr_t) &set[2], a_tv); + printf("%s(%d, [%d %d %d], [], [], {tv_sec=0, tv_usec=123})" + " = 1 (in [%d], left {tv_sec=0, tv_usec=%llu})\n", + TEST_SYSCALL_STR, INT_MAX, fds[0], fds[1], PATH_TRACING_FD, + PATH_TRACING_FD, zero_extend_signed_to_ull(tv->tv_usec)); +#endif /* PATH_TRACING_FD */ + + /* + * Small sets, nfds exceeds FD_SETSIZE limit. + * The kernel seems to be fine with it but strace cannot follow. + */ + *l_rs = (1UL << fds[0]) | (1UL << fds[1]) +#ifdef PATH_TRACING_FD + | (1UL << PATH_TRACING_FD) +#endif + ; + *l_ws = (1UL << fds[0]); + *l_es = (1UL << fds[0]) | (1UL << fds[1]) +#ifdef PATH_TRACING_FD + | (1UL << PATH_TRACING_FD) +#endif + ; + tv->tv_sec = 0; + tv->tv_usec = 123; + rc = xselect(FD_SETSIZE + 1, a_rs, a_ws, a_es, a_tv); + if (rc < 0) { +#ifndef PATH_TRACING_FD + printf("%s(%d, %p, %p, %p, {tv_sec=0, tv_usec=123}) = %s\n", + TEST_SYSCALL_STR, FD_SETSIZE + 1, rs, ws, es, errstr); +#endif + } else { +#ifndef PATH_TRACING_FD + printf("%s(%d, %p, %p, %p, {tv_sec=0, tv_usec=123})" + " = 0 (Timeout)\n", + TEST_SYSCALL_STR, FD_SETSIZE + 1, rs, ws, es); +#endif + } + + /* + * Small sets, one of allocated descriptors exceeds smallset_size. + */ + if (dup2(fds[1], smallset_size) != smallset_size) + perror_msg_and_fail("dup2"); +#ifdef PATH_TRACING_FD + FD_SET(PATH_TRACING_FD, rs); + FD_SET(PATH_TRACING_FD, ws); + FD_SET(PATH_TRACING_FD, es); +#endif + XSELECT(-1, smallset_size + 1, a_rs, a_ws, a_es, 0); +#ifndef PATH_TRACING_FD + printf("%s(%d, %p, %p, %p, NULL) = %s\n", + TEST_SYSCALL_STR, smallset_size + 1, rs, ws, es, errstr); +#endif + + /* + * Small and big sets, + * one of allocated descriptors exceeds smallset_size. + */ + memset(big_rs, 0, big_size); + FD_SET(fds[0], big_rs); + FD_SET(smallset_size, big_rs); + memset(big_ws, 0, big_size); + FD_SET(fds[1], big_ws); + FD_SET(smallset_size, big_ws); + XSELECT(-1, smallset_size + 1, a_big_rs, a_big_ws, a_es, 0); +#ifndef PATH_TRACING_FD + printf("%s(%d, [%d %d], [%d %d], %p, NULL) = %s\n", + TEST_SYSCALL_STR, smallset_size + 1, + fds[0], smallset_size, + fds[1], smallset_size, + es, errstr); +#endif /* !PATH_TRACING_FD */ + XSELECT(-1, smallset_size + 1, a_es, a_big_ws, a_big_rs, 0); +#ifndef PATH_TRACING_FD + printf("%s(%d, %p, [%d %d], [%d %d], NULL) = %s\n", + TEST_SYSCALL_STR, smallset_size + 1, + es, + fds[1], smallset_size, + fds[0], smallset_size, + errstr); +#endif /* !PATH_TRACING_FD */ puts("+++ exited with 0 +++"); return 0; diff --git a/tests-mx32/Makefile.am b/tests-mx32/Makefile.am index c445353c..fcfbf96a 100644 --- a/tests-mx32/Makefile.am +++ b/tests-mx32/Makefile.am @@ -1,7 +1,7 @@ # Automake input for strace tests. # # Copyright (c) 2011-2016 Dmitry V. Levin <ldv@altlinux.org> -# Copyright (c) 2011-2017 The strace developers. +# Copyright (c) 2011-2018 The strace developers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -28,8 +28,12 @@ OS = linux ARCH = @arch_mx32@ +NATIVE_ARCH = @arch_native@ +SIZEOF_KERNEL_LONG_T = @SIZEOF_KERNEL_LONG_T@ +SIZEOF_LONG = 4 MPERS_NAME = mx32 -ARCH_MFLAGS = -DMPERS_IS_$(MPERS_NAME) -mx32 +MPERS_CC_FLAGS = @cc_flags_mx32@ +ARCH_MFLAGS = -DMPERS_IS_$(MPERS_NAME) $(MPERS_CC_FLAGS) AM_CFLAGS = $(WARN_CFLAGS) AM_CPPFLAGS = $(ARCH_MFLAGS) \ -I$(builddir) \ @@ -80,6 +84,7 @@ LDADD = libtests.a include pure_executables.am check_PROGRAMS = $(PURE_EXECUTABLES) \ + _newselect-P \ answer \ attach-f-p \ attach-f-p-cmd \ @@ -117,6 +122,9 @@ check_PROGRAMS = $(PURE_EXECUTABLES) \ netlink_netlink_diag \ netlink_unix_diag \ nsyscalls \ + nsyscalls-d \ + oldselect-P \ + oldselect-efault-P \ pc \ perf_event_open_nonverbose \ perf_event_open_unabbrev \ @@ -137,12 +145,14 @@ check_PROGRAMS = $(PURE_EXECUTABLES) \ scm_rights \ seccomp-filter-v \ seccomp-strict \ + select-P \ set_ptracer_any \ set_sigblock \ set_sigign \ signal_receive \ sleep \ stack-fcall \ + stack-fcall-mangled \ threads-execve \ unblock_reset_raise \ unix-pair-send-recv \ @@ -182,10 +192,17 @@ uio_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64 stack_fcall_SOURCES = stack-fcall.c \ stack-fcall-0.c stack-fcall-1.c stack-fcall-2.c stack-fcall-3.c +stack_fcall_mangled_SOURCES = stack-fcall-mangled.c \ + stack-fcall-mangled-0.c stack-fcall-mangled-1.c \ + stack-fcall-mangled-2.c stack-fcall-mangled-3.c + include gen_tests.am if USE_LIBUNWIND LIBUNWIND_TESTS = strace-k.test +if USE_DEMANGLE +LIBUNWIND_TESTS += strace-k-demangle.test +endif else LIBUNWIND_TESTS = endif @@ -204,11 +221,6 @@ DECODER_TESTS = \ futex.test \ getuid.test \ ioctl.test \ - ioctl_dm-v.test \ - ioctl_dm.test \ - ioctl_loop-nv.test \ - ioctl_nsfs.test \ - ioctl_sock_gifconf.test \ ipc_msgbuf.test \ llseek.test \ lseek.test \ @@ -220,9 +232,11 @@ DECODER_TESTS = \ net.test \ netlink_sock_diag.test \ nsyscalls.test \ - oldselect.test \ + nsyscalls-d.test \ + nsyscalls-nd.test \ personality.test \ pipe.test \ + poll-P.test \ poll.test \ prctl-arg2-intptr.test \ prctl-dumpable.test \ @@ -241,6 +255,7 @@ DECODER_TESTS = \ seccomp-strict.test \ sigaltstack.test \ sun_path.test \ + xet_thread_area_x86.test \ uio.test \ umount.test \ umount2.test \ @@ -263,6 +278,8 @@ MISC_TESTS = \ detach-sleeping.test \ detach-stopped.test \ filter-unavailable.test \ + filtering_fd-syntax.test \ + filtering_syscall-syntax.test \ fflush.test \ get_regs.test \ interactive_block.test \ @@ -309,13 +326,18 @@ XFAIL_TESTS_x32 = int_0x80.gen.test XFAIL_TESTS = $(XFAIL_TESTS_$(MPERS_NAME)) $(XFAIL_TESTS_$(ARCH)) TEST_LOG_COMPILER = env -AM_TEST_LOG_FLAGS = STRACE_ARCH=$(ARCH) MIPS_ABI=$(MIPS_ABI) $(srcdir)/run.sh +AM_TEST_LOG_FLAGS = STRACE_ARCH=$(ARCH) STRACE_NATIVE_ARCH=$(NATIVE_ARCH) \ + SIZEOF_KERNEL_LONG_T=$(SIZEOF_KERNEL_LONG_T) \ + SIZEOF_LONG=$(SIZEOF_LONG) \ + MIPS_ABI=$(MIPS_ABI) $(srcdir)/run.sh @VALGRIND_CHECK_RULES@ VALGRIND_FLAGS = --quiet VALGRIND_SUPPRESSIONS_FILES = $(abs_srcdir)/strace.supp EXTRA_DIST = \ + accept_compat.h \ + attach-p-cmd.h \ caps-abbrev.awk \ caps.awk \ clock.in \ @@ -331,7 +353,6 @@ EXTRA_DIST = \ getresugid.c \ init.sh \ init_delete_module.h \ - ioctl-v.sh \ ipc.sh \ ipc_msgbuf.expected \ ksysent.sed \ @@ -339,8 +360,8 @@ EXTRA_DIST = \ match.awk \ net.expected \ netlink_sock_diag-v.sh \ - oldselect.expected \ pipe.expected \ + print_user_desc.c \ process_vm_readv_writev.c \ pure_executables.list \ qual_fault-exit_group.expected \ @@ -358,10 +379,12 @@ EXTRA_DIST = \ setugid.c \ sigaltstack.expected \ sockname.c \ + stack-fcall.h \ strace-C.expected \ strace-E.expected \ strace-T.expected \ strace-ff.expected \ + strace-k-demangle.test \ strace-k.test \ strace-r.expected \ strace.supp \ diff --git a/tests-mx32/Makefile.in b/tests-mx32/Makefile.in index 272fa470..1082a832 100644 --- a/tests-mx32/Makefile.in +++ b/tests-mx32/Makefile.in @@ -17,7 +17,7 @@ # Automake input for strace tests. # # Copyright (c) 2011-2016 Dmitry V. Levin <ldv@altlinux.org> -# Copyright (c) 2011-2017 The strace developers. +# Copyright (c) 2011-2018 The strace developers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -136,23 +136,25 @@ DIST_COMMON = $(srcdir)/pure_executables.am $(srcdir)/gen_tests.am \ $(srcdir)/../scno.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am $(top_srcdir)/depcomp \ $(top_srcdir)/test-driver -check_PROGRAMS = $(am__EXEEXT_1) answer$(EXEEXT) attach-f-p$(EXEEXT) \ - attach-f-p-cmd$(EXEEXT) attach-p-cmd-cmd$(EXEEXT) \ - attach-p-cmd-p$(EXEEXT) block_reset_raise_run$(EXEEXT) \ - caps-abbrev$(EXEEXT) check_sigblock$(EXEEXT) \ - check_sigign$(EXEEXT) clone_parent$(EXEEXT) \ - clone_ptrace$(EXEEXT) count-f$(EXEEXT) execve-v$(EXEEXT) \ - execveat-v$(EXEEXT) filter-unavailable$(EXEEXT) \ - fork-f$(EXEEXT) getpid$(EXEEXT) getppid$(EXEEXT) \ - gettid$(EXEEXT) int_0x80$(EXEEXT) ioctl_dm-v$(EXEEXT) \ - ioctl_evdev-v$(EXEEXT) ioctl_loop-nv$(EXEEXT) \ - ioctl_loop-v$(EXEEXT) ioctl_nsfs$(EXEEXT) ioctl_rtc-v$(EXEEXT) \ +check_PROGRAMS = $(am__EXEEXT_1) _newselect-P$(EXEEXT) answer$(EXEEXT) \ + attach-f-p$(EXEEXT) attach-f-p-cmd$(EXEEXT) \ + attach-p-cmd-cmd$(EXEEXT) attach-p-cmd-p$(EXEEXT) \ + block_reset_raise_run$(EXEEXT) caps-abbrev$(EXEEXT) \ + check_sigblock$(EXEEXT) check_sigign$(EXEEXT) \ + clone_parent$(EXEEXT) clone_ptrace$(EXEEXT) count-f$(EXEEXT) \ + execve-v$(EXEEXT) execveat-v$(EXEEXT) \ + filter-unavailable$(EXEEXT) fork-f$(EXEEXT) getpid$(EXEEXT) \ + getppid$(EXEEXT) gettid$(EXEEXT) int_0x80$(EXEEXT) \ + ioctl_dm-v$(EXEEXT) ioctl_evdev-v$(EXEEXT) \ + ioctl_loop-nv$(EXEEXT) ioctl_loop-v$(EXEEXT) \ + ioctl_nsfs$(EXEEXT) ioctl_rtc-v$(EXEEXT) \ is_linux_mips_n64$(EXEEXT) ksysent$(EXEEXT) \ list_sigaction_signum$(EXEEXT) mmsg-silent$(EXEEXT) \ mmsg_name-v$(EXEEXT) msg_control-v$(EXEEXT) \ net-accept-connect$(EXEEXT) netlink_inet_diag$(EXEEXT) \ netlink_netlink_diag$(EXEEXT) netlink_unix_diag$(EXEEXT) \ - nsyscalls$(EXEEXT) pc$(EXEEXT) \ + nsyscalls$(EXEEXT) nsyscalls-d$(EXEEXT) oldselect-P$(EXEEXT) \ + oldselect-efault-P$(EXEEXT) pc$(EXEEXT) \ perf_event_open_nonverbose$(EXEEXT) \ perf_event_open_unabbrev$(EXEEXT) ppoll-v$(EXEEXT) \ prctl-seccomp-filter-v$(EXEEXT) prctl-seccomp-strict$(EXEEXT) \ @@ -163,19 +165,21 @@ check_PROGRAMS = $(am__EXEEXT_1) answer$(EXEEXT) attach-f-p$(EXEEXT) \ redirect-fds$(EXEEXT) restart_syscall$(EXEEXT) \ run_expect_termsig$(EXEEXT) scm_rights$(EXEEXT) \ seccomp-filter-v$(EXEEXT) seccomp-strict$(EXEEXT) \ - set_ptracer_any$(EXEEXT) set_sigblock$(EXEEXT) \ - set_sigign$(EXEEXT) signal_receive$(EXEEXT) sleep$(EXEEXT) \ - stack-fcall$(EXEEXT) threads-execve$(EXEEXT) \ + select-P$(EXEEXT) set_ptracer_any$(EXEEXT) \ + set_sigblock$(EXEEXT) set_sigign$(EXEEXT) \ + signal_receive$(EXEEXT) sleep$(EXEEXT) stack-fcall$(EXEEXT) \ + stack-fcall-mangled$(EXEEXT) threads-execve$(EXEEXT) \ unblock_reset_raise$(EXEEXT) unix-pair-send-recv$(EXEEXT) \ unix-pair-sendto-recvfrom$(EXEEXT) vfork-f$(EXEEXT) \ wait4-v$(EXEEXT) waitid-v$(EXEEXT) zeroargc$(EXEEXT) +@USE_DEMANGLE_TRUE@@USE_LIBUNWIND_TRUE@am__append_1 = strace-k-demangle.test TESTS = $(GEN_TESTS) $(DECODER_TESTS) $(MISC_TESTS) $(am__EXEEXT_2) subdir = tests-mx32 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_prog_cc_for_build.m4 \ $(top_srcdir)/m4/ax_valgrind_check.m4 \ - $(top_srcdir)/m4/mpers.m4 $(top_srcdir)/m4/st_bpf.m4 \ + $(top_srcdir)/m4/mpers.m4 \ $(top_srcdir)/m4/st_save_restore_var.m4 \ $(top_srcdir)/m4/st_warn_cflags.m4 \ $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/configure.ac @@ -250,8 +254,9 @@ am__EXEEXT_1 = _newselect$(EXEEXT) accept$(EXEEXT) accept4$(EXEEXT) \ getxxid$(EXEEXT) group_req$(EXEEXT) inet-cmsg$(EXEEXT) \ init_module$(EXEEXT) inotify$(EXEEXT) inotify_init1$(EXEEXT) \ ioctl$(EXEEXT) ioctl_block$(EXEEXT) ioctl_dm$(EXEEXT) \ - ioctl_evdev$(EXEEXT) ioctl_loop$(EXEEXT) ioctl_mtd$(EXEEXT) \ - ioctl_rtc$(EXEEXT) ioctl_scsi$(EXEEXT) ioctl_sg_io_v3$(EXEEXT) \ + ioctl_evdev$(EXEEXT) ioctl_kvm_run$(EXEEXT) \ + ioctl_loop$(EXEEXT) ioctl_mtd$(EXEEXT) ioctl_rtc$(EXEEXT) \ + ioctl_scsi$(EXEEXT) ioctl_sg_io_v3$(EXEEXT) \ ioctl_sg_io_v4$(EXEEXT) ioctl_sock_gifconf$(EXEEXT) \ ioctl_uffdio$(EXEEXT) ioctl_v4l2$(EXEEXT) ioperm$(EXEEXT) \ iopl$(EXEEXT) ioprio$(EXEEXT) ip_mreq$(EXEEXT) ipc$(EXEEXT) \ @@ -266,12 +271,12 @@ am__EXEEXT_1 = _newselect$(EXEEXT) accept$(EXEEXT) accept4$(EXEEXT) \ mkdir$(EXEEXT) mkdirat$(EXEEXT) mknod$(EXEEXT) \ mknodat$(EXEEXT) mlock$(EXEEXT) mlock2$(EXEEXT) \ mlockall$(EXEEXT) mmap$(EXEEXT) mmap64$(EXEEXT) mmsg$(EXEEXT) \ - mmsg_name$(EXEEXT) mount$(EXEEXT) move_pages$(EXEEXT) \ - mq$(EXEEXT) mq_sendrecv$(EXEEXT) mq_sendrecv-read$(EXEEXT) \ - mq_sendrecv-write$(EXEEXT) msg_control$(EXEEXT) \ - msg_name$(EXEEXT) munlockall$(EXEEXT) nanosleep$(EXEEXT) \ - net-icmp_filter$(EXEEXT) net-sockaddr$(EXEEXT) \ - net-y-unix$(EXEEXT) net-yy-inet$(EXEEXT) \ + mmsg_name$(EXEEXT) modify_ldt$(EXEEXT) mount$(EXEEXT) \ + move_pages$(EXEEXT) mq$(EXEEXT) mq_sendrecv$(EXEEXT) \ + mq_sendrecv-read$(EXEEXT) mq_sendrecv-write$(EXEEXT) \ + msg_control$(EXEEXT) msg_name$(EXEEXT) munlockall$(EXEEXT) \ + nanosleep$(EXEEXT) net-icmp_filter$(EXEEXT) \ + net-sockaddr$(EXEEXT) net-y-unix$(EXEEXT) net-yy-inet$(EXEEXT) \ net-yy-netlink$(EXEEXT) net-yy-unix$(EXEEXT) \ netlink_audit$(EXEEXT) netlink_crypto$(EXEEXT) \ netlink_generic$(EXEEXT) netlink_kobject_uevent$(EXEEXT) \ @@ -301,16 +306,18 @@ am__EXEEXT_1 = _newselect$(EXEEXT) accept$(EXEEXT) accept4$(EXEEXT) \ nlattr_tc_stats$(EXEEXT) nlattr_tca_stab$(EXEEXT) \ nlattr_tcamsg$(EXEEXT) nlattr_tcmsg$(EXEEXT) \ nlattr_unix_diag_msg$(EXEEXT) old_mmap$(EXEEXT) \ - oldfstat$(EXEEXT) oldlstat$(EXEEXT) oldselect$(EXEEXT) \ + old_mmap-P$(EXEEXT) old_mmap-v-none$(EXEEXT) oldfstat$(EXEEXT) \ + oldlstat$(EXEEXT) oldselect$(EXEEXT) oldselect-efault$(EXEEXT) \ oldstat$(EXEEXT) open$(EXEEXT) openat$(EXEEXT) \ osf_utimes$(EXEEXT) pause$(EXEEXT) perf_event_open$(EXEEXT) \ personality$(EXEEXT) pipe$(EXEEXT) pipe2$(EXEEXT) \ pkey_alloc$(EXEEXT) pkey_free$(EXEEXT) pkey_mprotect$(EXEEXT) \ - poll$(EXEEXT) ppoll$(EXEEXT) prctl-arg2-intptr$(EXEEXT) \ - prctl-dumpable$(EXEEXT) prctl-name$(EXEEXT) \ - prctl-no-args$(EXEEXT) prctl-pdeathsig$(EXEEXT) \ - prctl-securebits$(EXEEXT) prctl-tid_address$(EXEEXT) \ - prctl-tsc$(EXEEXT) pread64-pwrite64$(EXEEXT) preadv$(EXEEXT) \ + poll$(EXEEXT) poll-P$(EXEEXT) ppoll$(EXEEXT) ppoll-P$(EXEEXT) \ + prctl-arg2-intptr$(EXEEXT) prctl-dumpable$(EXEEXT) \ + prctl-name$(EXEEXT) prctl-no-args$(EXEEXT) \ + prctl-pdeathsig$(EXEEXT) prctl-securebits$(EXEEXT) \ + prctl-tid_address$(EXEEXT) prctl-tsc$(EXEEXT) \ + pread64-pwrite64$(EXEEXT) preadv$(EXEEXT) \ preadv-pwritev$(EXEEXT) preadv2-pwritev2$(EXEEXT) \ printpath-umovestr$(EXEEXT) \ printpath-umovestr-peekdata$(EXEEXT) \ @@ -324,11 +331,15 @@ am__EXEEXT_1 = _newselect$(EXEEXT) accept$(EXEEXT) accept4$(EXEEXT) \ readlinkat$(EXEEXT) readv$(EXEEXT) reboot$(EXEEXT) \ recvfrom$(EXEEXT) recvmmsg-timeout$(EXEEXT) recvmsg$(EXEEXT) \ remap_file_pages$(EXEEXT) rename$(EXEEXT) renameat$(EXEEXT) \ - renameat2$(EXEEXT) request_key$(EXEEXT) rmdir$(EXEEXT) \ + renameat2$(EXEEXT) request_key$(EXEEXT) \ + riscv_flush_icache$(EXEEXT) rmdir$(EXEEXT) \ rt_sigaction$(EXEEXT) rt_sigpending$(EXEEXT) \ rt_sigprocmask$(EXEEXT) rt_sigqueueinfo$(EXEEXT) \ rt_sigreturn$(EXEEXT) rt_sigsuspend$(EXEEXT) \ rt_sigtimedwait$(EXEEXT) rt_tgsigqueueinfo$(EXEEXT) \ + s390_guarded_storage$(EXEEXT) s390_guarded_storage-v$(EXEEXT) \ + s390_pci_mmio_read_write$(EXEEXT) s390_runtime_instr$(EXEEXT) \ + s390_sthyi$(EXEEXT) s390_sthyi-v$(EXEEXT) \ sched_get_priority_mxx$(EXEEXT) sched_rr_get_interval$(EXEEXT) \ sched_xetaffinity$(EXEEXT) sched_xetattr$(EXEEXT) \ sched_xetparam$(EXEEXT) sched_xetscheduler$(EXEEXT) \ @@ -348,30 +359,34 @@ am__EXEEXT_1 = _newselect$(EXEEXT) accept$(EXEEXT) accept4$(EXEEXT) \ signalfd4$(EXEEXT) sigpending$(EXEEXT) sigprocmask$(EXEEXT) \ sigreturn$(EXEEXT) sigsuspend$(EXEEXT) so_linger$(EXEEXT) \ so_peercred$(EXEEXT) sock_filter-v$(EXEEXT) \ - socketcall$(EXEEXT) splice$(EXEEXT) stat$(EXEEXT) \ - stat64$(EXEEXT) statfs$(EXEEXT) statfs64$(EXEEXT) \ - statx$(EXEEXT) swap$(EXEEXT) sxetmask$(EXEEXT) \ - symlink$(EXEEXT) symlinkat$(EXEEXT) sync$(EXEEXT) \ - sync_file_range$(EXEEXT) sync_file_range2$(EXEEXT) \ - sysinfo$(EXEEXT) syslog$(EXEEXT) tee$(EXEEXT) time$(EXEEXT) \ - timer_create$(EXEEXT) timer_xettime$(EXEEXT) \ - timerfd_xettime$(EXEEXT) times$(EXEEXT) times-fail$(EXEEXT) \ - truncate$(EXEEXT) truncate64$(EXEEXT) ugetrlimit$(EXEEXT) \ - uio$(EXEEXT) umask$(EXEEXT) umount$(EXEEXT) umount2$(EXEEXT) \ - umoven-illptr$(EXEEXT) umovestr$(EXEEXT) \ - umovestr-illptr$(EXEEXT) umovestr2$(EXEEXT) umovestr3$(EXEEXT) \ - uname$(EXEEXT) unlink$(EXEEXT) unlinkat$(EXEEXT) \ - unshare$(EXEEXT) userfaultfd$(EXEEXT) ustat$(EXEEXT) \ - utime$(EXEEXT) utimensat$(EXEEXT) utimes$(EXEEXT) \ - vhangup$(EXEEXT) vmsplice$(EXEEXT) wait4$(EXEEXT) \ - waitid$(EXEEXT) waitpid$(EXEEXT) xattr$(EXEEXT) \ + socketcall$(EXEEXT) sockopt-sol_netlink$(EXEEXT) \ + splice$(EXEEXT) stat$(EXEEXT) stat64$(EXEEXT) statfs$(EXEEXT) \ + statfs64$(EXEEXT) statx$(EXEEXT) swap$(EXEEXT) \ + sxetmask$(EXEEXT) symlink$(EXEEXT) symlinkat$(EXEEXT) \ + sync$(EXEEXT) sync_file_range$(EXEEXT) \ + sync_file_range2$(EXEEXT) sysinfo$(EXEEXT) syslog$(EXEEXT) \ + tee$(EXEEXT) time$(EXEEXT) timer_create$(EXEEXT) \ + timer_xettime$(EXEEXT) timerfd_xettime$(EXEEXT) times$(EXEEXT) \ + times-fail$(EXEEXT) truncate$(EXEEXT) truncate64$(EXEEXT) \ + ugetrlimit$(EXEEXT) uio$(EXEEXT) umask$(EXEEXT) \ + umount$(EXEEXT) umount2$(EXEEXT) umoven-illptr$(EXEEXT) \ + umovestr$(EXEEXT) umovestr-illptr$(EXEEXT) umovestr2$(EXEEXT) \ + umovestr3$(EXEEXT) uname$(EXEEXT) unlink$(EXEEXT) \ + unlinkat$(EXEEXT) unshare$(EXEEXT) userfaultfd$(EXEEXT) \ + ustat$(EXEEXT) utime$(EXEEXT) utimensat$(EXEEXT) \ + utimes$(EXEEXT) vhangup$(EXEEXT) vmsplice$(EXEEXT) \ + wait4$(EXEEXT) waitid$(EXEEXT) waitpid$(EXEEXT) xattr$(EXEEXT) \ xattr-strings$(EXEEXT) xet_robust_list$(EXEEXT) \ - xetitimer$(EXEEXT) xetpgid$(EXEEXT) xetpriority$(EXEEXT) \ - xettimeofday$(EXEEXT) + xet_thread_area_x86$(EXEEXT) xetitimer$(EXEEXT) \ + xetpgid$(EXEEXT) xetpriority$(EXEEXT) xettimeofday$(EXEEXT) _newselect_SOURCES = _newselect.c _newselect_OBJECTS = _newselect.$(OBJEXT) _newselect_LDADD = $(LDADD) _newselect_DEPENDENCIES = libtests.a +_newselect_P_SOURCES = _newselect-P.c +_newselect_P_OBJECTS = _newselect-P.$(OBJEXT) +_newselect_P_LDADD = $(LDADD) +_newselect_P_DEPENDENCIES = libtests.a accept_SOURCES = accept.c accept_OBJECTS = accept.$(OBJEXT) accept_LDADD = $(LDADD) @@ -860,6 +875,10 @@ ioctl_evdev_v_SOURCES = ioctl_evdev-v.c ioctl_evdev_v_OBJECTS = ioctl_evdev-v.$(OBJEXT) ioctl_evdev_v_LDADD = $(LDADD) ioctl_evdev_v_DEPENDENCIES = libtests.a +ioctl_kvm_run_SOURCES = ioctl_kvm_run.c +ioctl_kvm_run_OBJECTS = ioctl_kvm_run.$(OBJEXT) +ioctl_kvm_run_LDADD = $(LDADD) +ioctl_kvm_run_DEPENDENCIES = libtests.a ioctl_loop_SOURCES = ioctl_loop.c ioctl_loop_OBJECTS = ioctl_loop.$(OBJEXT) ioctl_loop_LDADD = $(LDADD) @@ -1096,6 +1115,10 @@ mmsg_name_v_SOURCES = mmsg_name-v.c mmsg_name_v_OBJECTS = mmsg_name-v.$(OBJEXT) mmsg_name_v_LDADD = $(LDADD) mmsg_name_v_DEPENDENCIES = libtests.a +modify_ldt_SOURCES = modify_ldt.c +modify_ldt_OBJECTS = modify_ldt.$(OBJEXT) +modify_ldt_LDADD = $(LDADD) +modify_ldt_DEPENDENCIES = libtests.a mount_SOURCES = mount.c mount_OBJECTS = mount.$(OBJEXT) mount_LDADD = $(LDADD) @@ -1389,10 +1412,22 @@ nsyscalls_SOURCES = nsyscalls.c nsyscalls_OBJECTS = nsyscalls.$(OBJEXT) nsyscalls_LDADD = $(LDADD) nsyscalls_DEPENDENCIES = libtests.a +nsyscalls_d_SOURCES = nsyscalls-d.c +nsyscalls_d_OBJECTS = nsyscalls-d.$(OBJEXT) +nsyscalls_d_LDADD = $(LDADD) +nsyscalls_d_DEPENDENCIES = libtests.a old_mmap_SOURCES = old_mmap.c old_mmap_OBJECTS = old_mmap.$(OBJEXT) old_mmap_LDADD = $(LDADD) old_mmap_DEPENDENCIES = libtests.a +old_mmap_P_SOURCES = old_mmap-P.c +old_mmap_P_OBJECTS = old_mmap-P.$(OBJEXT) +old_mmap_P_LDADD = $(LDADD) +old_mmap_P_DEPENDENCIES = libtests.a +old_mmap_v_none_SOURCES = old_mmap-v-none.c +old_mmap_v_none_OBJECTS = old_mmap-v-none.$(OBJEXT) +old_mmap_v_none_LDADD = $(LDADD) +old_mmap_v_none_DEPENDENCIES = libtests.a oldfstat_SOURCES = oldfstat.c oldfstat_OBJECTS = oldfstat.$(OBJEXT) oldfstat_LDADD = $(LDADD) @@ -1405,6 +1440,18 @@ oldselect_SOURCES = oldselect.c oldselect_OBJECTS = oldselect.$(OBJEXT) oldselect_LDADD = $(LDADD) oldselect_DEPENDENCIES = libtests.a +oldselect_P_SOURCES = oldselect-P.c +oldselect_P_OBJECTS = oldselect-P.$(OBJEXT) +oldselect_P_LDADD = $(LDADD) +oldselect_P_DEPENDENCIES = libtests.a +oldselect_efault_SOURCES = oldselect-efault.c +oldselect_efault_OBJECTS = oldselect-efault.$(OBJEXT) +oldselect_efault_LDADD = $(LDADD) +oldselect_efault_DEPENDENCIES = libtests.a +oldselect_efault_P_SOURCES = oldselect-efault-P.c +oldselect_efault_P_OBJECTS = oldselect-efault-P.$(OBJEXT) +oldselect_efault_P_LDADD = $(LDADD) +oldselect_efault_P_DEPENDENCIES = libtests.a oldstat_SOURCES = oldstat.c oldstat_OBJECTS = oldstat.$(OBJEXT) oldstat_LDADD = $(LDADD) @@ -1470,10 +1517,18 @@ poll_SOURCES = poll.c poll_OBJECTS = poll.$(OBJEXT) poll_LDADD = $(LDADD) poll_DEPENDENCIES = libtests.a +poll_P_SOURCES = poll-P.c +poll_P_OBJECTS = poll-P.$(OBJEXT) +poll_P_LDADD = $(LDADD) +poll_P_DEPENDENCIES = libtests.a ppoll_SOURCES = ppoll.c ppoll_OBJECTS = ppoll.$(OBJEXT) ppoll_LDADD = $(LDADD) ppoll_DEPENDENCIES = libtests.a +ppoll_P_SOURCES = ppoll-P.c +ppoll_P_OBJECTS = ppoll-P.$(OBJEXT) +ppoll_P_LDADD = $(LDADD) +ppoll_P_DEPENDENCIES = libtests.a ppoll_v_SOURCES = ppoll-v.c ppoll_v_OBJECTS = ppoll-v.$(OBJEXT) ppoll_v_LDADD = $(LDADD) @@ -1700,6 +1755,10 @@ restart_syscall_SOURCES = restart_syscall.c restart_syscall_OBJECTS = restart_syscall.$(OBJEXT) restart_syscall_LDADD = $(LDADD) restart_syscall_DEPENDENCIES = libtests.a +riscv_flush_icache_SOURCES = riscv_flush_icache.c +riscv_flush_icache_OBJECTS = riscv_flush_icache.$(OBJEXT) +riscv_flush_icache_LDADD = $(LDADD) +riscv_flush_icache_DEPENDENCIES = libtests.a rmdir_SOURCES = rmdir.c rmdir_OBJECTS = rmdir.$(OBJEXT) rmdir_LDADD = $(LDADD) @@ -1740,6 +1799,30 @@ run_expect_termsig_SOURCES = run_expect_termsig.c run_expect_termsig_OBJECTS = run_expect_termsig.$(OBJEXT) run_expect_termsig_LDADD = $(LDADD) run_expect_termsig_DEPENDENCIES = libtests.a +s390_guarded_storage_SOURCES = s390_guarded_storage.c +s390_guarded_storage_OBJECTS = s390_guarded_storage.$(OBJEXT) +s390_guarded_storage_LDADD = $(LDADD) +s390_guarded_storage_DEPENDENCIES = libtests.a +s390_guarded_storage_v_SOURCES = s390_guarded_storage-v.c +s390_guarded_storage_v_OBJECTS = s390_guarded_storage-v.$(OBJEXT) +s390_guarded_storage_v_LDADD = $(LDADD) +s390_guarded_storage_v_DEPENDENCIES = libtests.a +s390_pci_mmio_read_write_SOURCES = s390_pci_mmio_read_write.c +s390_pci_mmio_read_write_OBJECTS = s390_pci_mmio_read_write.$(OBJEXT) +s390_pci_mmio_read_write_LDADD = $(LDADD) +s390_pci_mmio_read_write_DEPENDENCIES = libtests.a +s390_runtime_instr_SOURCES = s390_runtime_instr.c +s390_runtime_instr_OBJECTS = s390_runtime_instr.$(OBJEXT) +s390_runtime_instr_LDADD = $(LDADD) +s390_runtime_instr_DEPENDENCIES = libtests.a +s390_sthyi_SOURCES = s390_sthyi.c +s390_sthyi_OBJECTS = s390_sthyi.$(OBJEXT) +s390_sthyi_LDADD = $(LDADD) +s390_sthyi_DEPENDENCIES = libtests.a +s390_sthyi_v_SOURCES = s390_sthyi-v.c +s390_sthyi_v_OBJECTS = s390_sthyi-v.$(OBJEXT) +s390_sthyi_v_LDADD = $(LDADD) +s390_sthyi_v_DEPENDENCIES = libtests.a sched_get_priority_mxx_SOURCES = sched_get_priority_mxx.c sched_get_priority_mxx_OBJECTS = sched_get_priority_mxx.$(OBJEXT) sched_get_priority_mxx_LDADD = $(LDADD) @@ -1792,6 +1875,10 @@ select_SOURCES = select.c select_OBJECTS = select.$(OBJEXT) select_LDADD = $(LDADD) select_DEPENDENCIES = libtests.a +select_P_SOURCES = select-P.c +select_P_OBJECTS = select-P.$(OBJEXT) +select_P_LDADD = $(LDADD) +select_P_DEPENDENCIES = libtests.a semop_SOURCES = semop.c semop_OBJECTS = semop.$(OBJEXT) semop_LDADD = $(LDADD) @@ -1976,6 +2063,10 @@ socketcall_SOURCES = socketcall.c socketcall_OBJECTS = socketcall.$(OBJEXT) socketcall_LDADD = $(LDADD) socketcall_DEPENDENCIES = libtests.a +sockopt_sol_netlink_SOURCES = sockopt-sol_netlink.c +sockopt_sol_netlink_OBJECTS = sockopt-sol_netlink.$(OBJEXT) +sockopt_sol_netlink_LDADD = $(LDADD) +sockopt_sol_netlink_DEPENDENCIES = libtests.a splice_SOURCES = splice.c splice_OBJECTS = splice.$(OBJEXT) splice_LDADD = $(LDADD) @@ -1986,6 +2077,14 @@ am_stack_fcall_OBJECTS = stack-fcall.$(OBJEXT) stack-fcall-0.$(OBJEXT) \ stack_fcall_OBJECTS = $(am_stack_fcall_OBJECTS) stack_fcall_LDADD = $(LDADD) stack_fcall_DEPENDENCIES = libtests.a +am_stack_fcall_mangled_OBJECTS = stack-fcall-mangled.$(OBJEXT) \ + stack-fcall-mangled-0.$(OBJEXT) \ + stack-fcall-mangled-1.$(OBJEXT) \ + stack-fcall-mangled-2.$(OBJEXT) \ + stack-fcall-mangled-3.$(OBJEXT) +stack_fcall_mangled_OBJECTS = $(am_stack_fcall_mangled_OBJECTS) +stack_fcall_mangled_LDADD = $(LDADD) +stack_fcall_mangled_DEPENDENCIES = libtests.a stat_SOURCES = stat.c stat_OBJECTS = stat.$(OBJEXT) stat_LDADD = $(LDADD) @@ -2213,6 +2312,10 @@ xet_robust_list_SOURCES = xet_robust_list.c xet_robust_list_OBJECTS = xet_robust_list.$(OBJEXT) xet_robust_list_LDADD = $(LDADD) xet_robust_list_DEPENDENCIES = libtests.a +xet_thread_area_x86_SOURCES = xet_thread_area_x86.c +xet_thread_area_x86_OBJECTS = xet_thread_area_x86.$(OBJEXT) +xet_thread_area_x86_LDADD = $(LDADD) +xet_thread_area_x86_DEPENDENCIES = libtests.a xetitimer_SOURCES = xetitimer.c xetitimer_OBJECTS = xetitimer.$(OBJEXT) xetitimer_LDADD = $(LDADD) @@ -2265,9 +2368,9 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ - access.c acct.c add_key.c adjtimex.c aio.c alarm.c answer.c \ - attach-f-p.c attach-f-p-cmd.c attach-p-cmd-cmd.c \ +SOURCES = $(libtests_a_SOURCES) _newselect.c _newselect-P.c accept.c \ + accept4.c access.c acct.c add_key.c adjtimex.c aio.c alarm.c \ + answer.c attach-f-p.c attach-f-p-cmd.c attach-p-cmd-cmd.c \ attach-p-cmd-p.c block_reset_raise_run.c bpf.c bpf-v.c brk.c \ btrfs.c caps.c caps-abbrev.c check_sigblock.c check_sigign.c \ chmod.c chown.c chown32.c chroot.c clock_adjtime.c \ @@ -2291,9 +2394,9 @@ SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ gettid.c getuid.c getuid32.c getxxid.c group_req.c inet-cmsg.c \ init_module.c inotify.c inotify_init1.c int_0x80.c ioctl.c \ ioctl_block.c ioctl_dm.c ioctl_dm-v.c ioctl_evdev.c \ - ioctl_evdev-v.c ioctl_loop.c ioctl_loop-nv.c ioctl_loop-v.c \ - ioctl_mtd.c ioctl_nsfs.c ioctl_rtc.c ioctl_rtc-v.c \ - ioctl_scsi.c ioctl_sg_io_v3.c ioctl_sg_io_v4.c \ + ioctl_evdev-v.c ioctl_kvm_run.c ioctl_loop.c ioctl_loop-nv.c \ + ioctl_loop-v.c ioctl_mtd.c ioctl_nsfs.c ioctl_rtc.c \ + ioctl_rtc-v.c ioctl_scsi.c ioctl_sg_io_v3.c ioctl_sg_io_v4.c \ ioctl_sock_gifconf.c ioctl_uffdio.c ioctl_v4l2.c ioperm.c \ iopl.c ioprio.c ip_mreq.c ipc.c ipc_msg.c ipc_msgbuf.c \ ipc_sem.c ipc_shm.c is_linux_mips_n64.c kcmp.c kcmp-y.c \ @@ -2303,13 +2406,13 @@ SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ mbind.c membarrier.c memfd_create.c migrate_pages.c mincore.c \ mkdir.c mkdirat.c mknod.c mknodat.c mlock.c mlock2.c \ mlockall.c mmap.c mmap64.c mmsg.c mmsg-silent.c mmsg_name.c \ - mmsg_name-v.c mount.c move_pages.c mq.c mq_sendrecv.c \ - mq_sendrecv-read.c mq_sendrecv-write.c msg_control.c \ - msg_control-v.c msg_name.c munlockall.c nanosleep.c \ - net-accept-connect.c net-icmp_filter.c net-sockaddr.c \ - net-y-unix.c net-yy-inet.c net-yy-netlink.c net-yy-unix.c \ - netlink_audit.c netlink_crypto.c netlink_generic.c \ - netlink_inet_diag.c netlink_kobject_uevent.c \ + mmsg_name-v.c modify_ldt.c mount.c move_pages.c mq.c \ + mq_sendrecv.c mq_sendrecv-read.c mq_sendrecv-write.c \ + msg_control.c msg_control-v.c msg_name.c munlockall.c \ + nanosleep.c net-accept-connect.c net-icmp_filter.c \ + net-sockaddr.c net-y-unix.c net-yy-inet.c net-yy-netlink.c \ + net-yy-unix.c netlink_audit.c netlink_crypto.c \ + netlink_generic.c netlink_inet_diag.c netlink_kobject_uevent.c \ netlink_netfilter.c netlink_netlink_diag.c netlink_protocol.c \ netlink_route.c netlink_selinux.c netlink_sock_diag.c \ netlink_unix_diag.c netlink_xfrm.c newfstatat.c \ @@ -2328,13 +2431,16 @@ SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ nlattr_packet_diag_msg.c nlattr_rtgenmsg.c nlattr_rtmsg.c \ nlattr_smc_diag_msg.c nlattr_tc_stats.c nlattr_tca_stab.c \ nlattr_tcamsg.c nlattr_tcmsg.c nlattr_unix_diag_msg.c \ - nsyscalls.c old_mmap.c oldfstat.c oldlstat.c oldselect.c \ + nsyscalls.c nsyscalls-d.c old_mmap.c old_mmap-P.c \ + old_mmap-v-none.c oldfstat.c oldlstat.c oldselect.c \ + oldselect-P.c oldselect-efault.c oldselect-efault-P.c \ oldstat.c open.c openat.c osf_utimes.c pause.c pc.c \ perf_event_open.c perf_event_open_nonverbose.c \ perf_event_open_unabbrev.c personality.c pipe.c pipe2.c \ - pkey_alloc.c pkey_free.c pkey_mprotect.c poll.c ppoll.c \ - ppoll-v.c prctl-arg2-intptr.c prctl-dumpable.c prctl-name.c \ - prctl-no-args.c prctl-pdeathsig.c prctl-seccomp-filter-v.c \ + pkey_alloc.c pkey_free.c pkey_mprotect.c poll.c poll-P.c \ + ppoll.c ppoll-P.c ppoll-v.c prctl-arg2-intptr.c \ + prctl-dumpable.c prctl-name.c prctl-no-args.c \ + prctl-pdeathsig.c prctl-seccomp-filter-v.c \ prctl-seccomp-strict.c prctl-securebits.c prctl-tid_address.c \ prctl-tsc.c pread64-pwrite64.c preadv.c preadv-pwritev.c \ preadv2-pwritev2.c print_maxfd.c printpath-umovestr.c \ @@ -2348,28 +2454,32 @@ SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ readdir.c readlink.c readlinkat.c readv.c reboot.c recvfrom.c \ recvmmsg-timeout.c recvmsg.c redirect-fds.c remap_file_pages.c \ rename.c renameat.c renameat2.c request_key.c \ - restart_syscall.c rmdir.c rt_sigaction.c rt_sigpending.c \ - rt_sigprocmask.c rt_sigqueueinfo.c rt_sigreturn.c \ - rt_sigsuspend.c rt_sigtimedwait.c rt_tgsigqueueinfo.c \ - run_expect_termsig.c sched_get_priority_mxx.c \ + restart_syscall.c riscv_flush_icache.c rmdir.c rt_sigaction.c \ + rt_sigpending.c rt_sigprocmask.c rt_sigqueueinfo.c \ + rt_sigreturn.c rt_sigsuspend.c rt_sigtimedwait.c \ + rt_tgsigqueueinfo.c run_expect_termsig.c \ + s390_guarded_storage.c s390_guarded_storage-v.c \ + s390_pci_mmio_read_write.c s390_runtime_instr.c s390_sthyi.c \ + s390_sthyi-v.c sched_get_priority_mxx.c \ sched_rr_get_interval.c sched_xetaffinity.c sched_xetattr.c \ sched_xetparam.c sched_xetscheduler.c sched_yield.c \ scm_rights.c seccomp-filter.c seccomp-filter-v.c \ - seccomp-strict.c seccomp_get_action_avail.c select.c semop.c \ - sendfile.c sendfile64.c set_mempolicy.c set_ptracer_any.c \ - set_sigblock.c set_sigign.c setdomainname.c setfsgid.c \ - setfsgid32.c setfsuid.c setfsuid32.c setgid.c setgid32.c \ - setgroups.c setgroups32.c sethostname.c setns.c setregid.c \ - setregid32.c setresgid.c setresgid32.c setresuid.c \ + seccomp-strict.c seccomp_get_action_avail.c select.c \ + select-P.c semop.c sendfile.c sendfile64.c set_mempolicy.c \ + set_ptracer_any.c set_sigblock.c set_sigign.c setdomainname.c \ + setfsgid.c setfsgid32.c setfsuid.c setfsuid32.c setgid.c \ + setgid32.c setgroups.c setgroups32.c sethostname.c setns.c \ + setregid.c setregid32.c setresgid.c setresgid32.c setresuid.c \ setresuid32.c setreuid.c setreuid32.c setrlimit.c setuid.c \ setuid32.c shmxt.c shutdown.c sigaction.c sigaltstack.c \ siginfo.c signal.c signal_receive.c signalfd4.c sigpending.c \ sigprocmask.c sigreturn.c sigsuspend.c sleep.c so_linger.c \ - so_peercred.c sock_filter-v.c socketcall.c splice.c \ - $(stack_fcall_SOURCES) stat.c stat64.c statfs.c statfs64.c \ - statx.c swap.c sxetmask.c symlink.c symlinkat.c sync.c \ - sync_file_range.c sync_file_range2.c sysinfo.c syslog.c tee.c \ - threads-execve.c time.c timer_create.c timer_xettime.c \ + so_peercred.c sock_filter-v.c socketcall.c \ + sockopt-sol_netlink.c splice.c $(stack_fcall_SOURCES) \ + $(stack_fcall_mangled_SOURCES) stat.c stat64.c statfs.c \ + statfs64.c statx.c swap.c sxetmask.c symlink.c symlinkat.c \ + sync.c sync_file_range.c sync_file_range2.c sysinfo.c syslog.c \ + tee.c threads-execve.c time.c timer_create.c timer_xettime.c \ timerfd_xettime.c times.c times-fail.c truncate.c truncate64.c \ ugetrlimit.c uio.c umask.c umount.c umount2.c umoven-illptr.c \ umovestr.c umovestr-illptr.c umovestr2.c umovestr3.c uname.c \ @@ -2378,16 +2488,17 @@ SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ userfaultfd.c ustat.c utime.c utimensat.c utimes.c vfork-f.c \ vhangup.c vmsplice.c wait4.c wait4-v.c waitid.c waitid-v.c \ waitpid.c xattr.c xattr-strings.c xet_robust_list.c \ - xetitimer.c xetpgid.c xetpriority.c xettimeofday.c zeroargc.c -DIST_SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ - access.c acct.c add_key.c adjtimex.c aio.c alarm.c answer.c \ - attach-f-p.c attach-f-p-cmd.c attach-p-cmd-cmd.c \ - attach-p-cmd-p.c block_reset_raise_run.c bpf.c bpf-v.c brk.c \ - btrfs.c caps.c caps-abbrev.c check_sigblock.c check_sigign.c \ - chmod.c chown.c chown32.c chroot.c clock_adjtime.c \ - clock_nanosleep.c clock_xettime.c clone_parent.c \ - clone_ptrace.c copy_file_range.c count-f.c creat.c \ - delete_module.c dup.c dup2.c dup3.c epoll_create.c \ + xet_thread_area_x86.c xetitimer.c xetpgid.c xetpriority.c \ + xettimeofday.c zeroargc.c +DIST_SOURCES = $(libtests_a_SOURCES) _newselect.c _newselect-P.c \ + accept.c accept4.c access.c acct.c add_key.c adjtimex.c aio.c \ + alarm.c answer.c attach-f-p.c attach-f-p-cmd.c \ + attach-p-cmd-cmd.c attach-p-cmd-p.c block_reset_raise_run.c \ + bpf.c bpf-v.c brk.c btrfs.c caps.c caps-abbrev.c \ + check_sigblock.c check_sigign.c chmod.c chown.c chown32.c \ + chroot.c clock_adjtime.c clock_nanosleep.c clock_xettime.c \ + clone_parent.c clone_ptrace.c copy_file_range.c count-f.c \ + creat.c delete_module.c dup.c dup2.c dup3.c epoll_create.c \ epoll_create1.c epoll_ctl.c epoll_pwait.c epoll_wait.c \ erestartsys.c eventfd.c execve.c execve-v.c execveat.c \ execveat-v.c faccessat.c fadvise64.c fadvise64_64.c \ @@ -2405,9 +2516,9 @@ DIST_SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ gettid.c getuid.c getuid32.c getxxid.c group_req.c inet-cmsg.c \ init_module.c inotify.c inotify_init1.c int_0x80.c ioctl.c \ ioctl_block.c ioctl_dm.c ioctl_dm-v.c ioctl_evdev.c \ - ioctl_evdev-v.c ioctl_loop.c ioctl_loop-nv.c ioctl_loop-v.c \ - ioctl_mtd.c ioctl_nsfs.c ioctl_rtc.c ioctl_rtc-v.c \ - ioctl_scsi.c ioctl_sg_io_v3.c ioctl_sg_io_v4.c \ + ioctl_evdev-v.c ioctl_kvm_run.c ioctl_loop.c ioctl_loop-nv.c \ + ioctl_loop-v.c ioctl_mtd.c ioctl_nsfs.c ioctl_rtc.c \ + ioctl_rtc-v.c ioctl_scsi.c ioctl_sg_io_v3.c ioctl_sg_io_v4.c \ ioctl_sock_gifconf.c ioctl_uffdio.c ioctl_v4l2.c ioperm.c \ iopl.c ioprio.c ip_mreq.c ipc.c ipc_msg.c ipc_msgbuf.c \ ipc_sem.c ipc_shm.c is_linux_mips_n64.c kcmp.c kcmp-y.c \ @@ -2417,13 +2528,13 @@ DIST_SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ mbind.c membarrier.c memfd_create.c migrate_pages.c mincore.c \ mkdir.c mkdirat.c mknod.c mknodat.c mlock.c mlock2.c \ mlockall.c mmap.c mmap64.c mmsg.c mmsg-silent.c mmsg_name.c \ - mmsg_name-v.c mount.c move_pages.c mq.c mq_sendrecv.c \ - mq_sendrecv-read.c mq_sendrecv-write.c msg_control.c \ - msg_control-v.c msg_name.c munlockall.c nanosleep.c \ - net-accept-connect.c net-icmp_filter.c net-sockaddr.c \ - net-y-unix.c net-yy-inet.c net-yy-netlink.c net-yy-unix.c \ - netlink_audit.c netlink_crypto.c netlink_generic.c \ - netlink_inet_diag.c netlink_kobject_uevent.c \ + mmsg_name-v.c modify_ldt.c mount.c move_pages.c mq.c \ + mq_sendrecv.c mq_sendrecv-read.c mq_sendrecv-write.c \ + msg_control.c msg_control-v.c msg_name.c munlockall.c \ + nanosleep.c net-accept-connect.c net-icmp_filter.c \ + net-sockaddr.c net-y-unix.c net-yy-inet.c net-yy-netlink.c \ + net-yy-unix.c netlink_audit.c netlink_crypto.c \ + netlink_generic.c netlink_inet_diag.c netlink_kobject_uevent.c \ netlink_netfilter.c netlink_netlink_diag.c netlink_protocol.c \ netlink_route.c netlink_selinux.c netlink_sock_diag.c \ netlink_unix_diag.c netlink_xfrm.c newfstatat.c \ @@ -2442,13 +2553,16 @@ DIST_SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ nlattr_packet_diag_msg.c nlattr_rtgenmsg.c nlattr_rtmsg.c \ nlattr_smc_diag_msg.c nlattr_tc_stats.c nlattr_tca_stab.c \ nlattr_tcamsg.c nlattr_tcmsg.c nlattr_unix_diag_msg.c \ - nsyscalls.c old_mmap.c oldfstat.c oldlstat.c oldselect.c \ + nsyscalls.c nsyscalls-d.c old_mmap.c old_mmap-P.c \ + old_mmap-v-none.c oldfstat.c oldlstat.c oldselect.c \ + oldselect-P.c oldselect-efault.c oldselect-efault-P.c \ oldstat.c open.c openat.c osf_utimes.c pause.c pc.c \ perf_event_open.c perf_event_open_nonverbose.c \ perf_event_open_unabbrev.c personality.c pipe.c pipe2.c \ - pkey_alloc.c pkey_free.c pkey_mprotect.c poll.c ppoll.c \ - ppoll-v.c prctl-arg2-intptr.c prctl-dumpable.c prctl-name.c \ - prctl-no-args.c prctl-pdeathsig.c prctl-seccomp-filter-v.c \ + pkey_alloc.c pkey_free.c pkey_mprotect.c poll.c poll-P.c \ + ppoll.c ppoll-P.c ppoll-v.c prctl-arg2-intptr.c \ + prctl-dumpable.c prctl-name.c prctl-no-args.c \ + prctl-pdeathsig.c prctl-seccomp-filter-v.c \ prctl-seccomp-strict.c prctl-securebits.c prctl-tid_address.c \ prctl-tsc.c pread64-pwrite64.c preadv.c preadv-pwritev.c \ preadv2-pwritev2.c print_maxfd.c printpath-umovestr.c \ @@ -2462,28 +2576,32 @@ DIST_SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ readdir.c readlink.c readlinkat.c readv.c reboot.c recvfrom.c \ recvmmsg-timeout.c recvmsg.c redirect-fds.c remap_file_pages.c \ rename.c renameat.c renameat2.c request_key.c \ - restart_syscall.c rmdir.c rt_sigaction.c rt_sigpending.c \ - rt_sigprocmask.c rt_sigqueueinfo.c rt_sigreturn.c \ - rt_sigsuspend.c rt_sigtimedwait.c rt_tgsigqueueinfo.c \ - run_expect_termsig.c sched_get_priority_mxx.c \ + restart_syscall.c riscv_flush_icache.c rmdir.c rt_sigaction.c \ + rt_sigpending.c rt_sigprocmask.c rt_sigqueueinfo.c \ + rt_sigreturn.c rt_sigsuspend.c rt_sigtimedwait.c \ + rt_tgsigqueueinfo.c run_expect_termsig.c \ + s390_guarded_storage.c s390_guarded_storage-v.c \ + s390_pci_mmio_read_write.c s390_runtime_instr.c s390_sthyi.c \ + s390_sthyi-v.c sched_get_priority_mxx.c \ sched_rr_get_interval.c sched_xetaffinity.c sched_xetattr.c \ sched_xetparam.c sched_xetscheduler.c sched_yield.c \ scm_rights.c seccomp-filter.c seccomp-filter-v.c \ - seccomp-strict.c seccomp_get_action_avail.c select.c semop.c \ - sendfile.c sendfile64.c set_mempolicy.c set_ptracer_any.c \ - set_sigblock.c set_sigign.c setdomainname.c setfsgid.c \ - setfsgid32.c setfsuid.c setfsuid32.c setgid.c setgid32.c \ - setgroups.c setgroups32.c sethostname.c setns.c setregid.c \ - setregid32.c setresgid.c setresgid32.c setresuid.c \ + seccomp-strict.c seccomp_get_action_avail.c select.c \ + select-P.c semop.c sendfile.c sendfile64.c set_mempolicy.c \ + set_ptracer_any.c set_sigblock.c set_sigign.c setdomainname.c \ + setfsgid.c setfsgid32.c setfsuid.c setfsuid32.c setgid.c \ + setgid32.c setgroups.c setgroups32.c sethostname.c setns.c \ + setregid.c setregid32.c setresgid.c setresgid32.c setresuid.c \ setresuid32.c setreuid.c setreuid32.c setrlimit.c setuid.c \ setuid32.c shmxt.c shutdown.c sigaction.c sigaltstack.c \ siginfo.c signal.c signal_receive.c signalfd4.c sigpending.c \ sigprocmask.c sigreturn.c sigsuspend.c sleep.c so_linger.c \ - so_peercred.c sock_filter-v.c socketcall.c splice.c \ - $(stack_fcall_SOURCES) stat.c stat64.c statfs.c statfs64.c \ - statx.c swap.c sxetmask.c symlink.c symlinkat.c sync.c \ - sync_file_range.c sync_file_range2.c sysinfo.c syslog.c tee.c \ - threads-execve.c time.c timer_create.c timer_xettime.c \ + so_peercred.c sock_filter-v.c socketcall.c \ + sockopt-sol_netlink.c splice.c $(stack_fcall_SOURCES) \ + $(stack_fcall_mangled_SOURCES) stat.c stat64.c statfs.c \ + statfs64.c statx.c swap.c sxetmask.c symlink.c symlinkat.c \ + sync.c sync_file_range.c sync_file_range2.c sysinfo.c syslog.c \ + tee.c threads-execve.c time.c timer_create.c timer_xettime.c \ timerfd_xettime.c times.c times-fail.c truncate.c truncate64.c \ ugetrlimit.c uio.c umask.c umount.c umount2.c umoven-illptr.c \ umovestr.c umovestr-illptr.c umovestr2.c umovestr3.c uname.c \ @@ -2492,7 +2610,8 @@ DIST_SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ userfaultfd.c ustat.c utime.c utimensat.c utimes.c vfork-f.c \ vhangup.c vmsplice.c wait4.c wait4-v.c waitid.c waitid-v.c \ waitpid.c xattr.c xattr-strings.c xet_robust_list.c \ - xetitimer.c xetpgid.c xetpriority.c xettimeofday.c zeroargc.c + xet_thread_area_x86.c xetitimer.c xetpgid.c xetpriority.c \ + xettimeofday.c zeroargc.c am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -2705,7 +2824,7 @@ am__set_TESTS_bases = \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck -@USE_LIBUNWIND_TRUE@am__EXEEXT_2 = strace-k.test +@USE_LIBUNWIND_TRUE@am__EXEEXT_2 = strace-k.test $(am__append_1) TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test am__test_logs1 = $(TESTS:=.log) @@ -2793,10 +2912,13 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ RANLIB = @RANLIB@ +READELF = @READELF@ RPM_CHANGELOGTIME = @RPM_CHANGELOGTIME@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SIZEOF_KERNEL_LONG_T = @SIZEOF_KERNEL_LONG_T@ +SIZEOF_LONG = 4 STRIP = @STRIP@ VALGRIND = @VALGRIND@ VALGRIND_ENABLED = @VALGRIND_ENABLED@ @@ -2817,6 +2939,7 @@ am__untar = @am__untar@ arch = @arch@ arch_m32 = @arch_m32@ arch_mx32 = @arch_mx32@ +arch_native = @arch_native@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -2824,6 +2947,8 @@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ +cc_flags_m32 = @cc_flags_m32@ +cc_flags_mx32 = @cc_flags_mx32@ datadir = @datadir@ datarootdir = @datarootdir@ dl_LIBS = @dl_LIBS@ @@ -2841,6 +2966,9 @@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +libiberty_CPPFLAGS = @libiberty_CPPFLAGS@ +libiberty_LDFLAGS = @libiberty_LDFLAGS@ +libiberty_LIBS = @libiberty_LIBS@ libunwind_CPPFLAGS = @libunwind_CPPFLAGS@ libunwind_LDFLAGS = @libunwind_LDFLAGS@ libunwind_LIBS = @libunwind_LIBS@ @@ -2865,8 +2993,10 @@ valgrind_enabled_tools = @valgrind_enabled_tools@ valgrind_tools = @valgrind_tools@ OS = linux ARCH = @arch_mx32@ +NATIVE_ARCH = @arch_native@ MPERS_NAME = mx32 -ARCH_MFLAGS = -DMPERS_IS_$(MPERS_NAME) -mx32 +MPERS_CC_FLAGS = @cc_flags_mx32@ +ARCH_MFLAGS = -DMPERS_IS_$(MPERS_NAME) $(MPERS_CC_FLAGS) AM_CFLAGS = $(WARN_CFLAGS) AM_CPPFLAGS = $(ARCH_MFLAGS) \ -I$(builddir) \ @@ -3021,6 +3151,7 @@ PURE_EXECUTABLES = \ ioctl_block \ ioctl_dm \ ioctl_evdev \ + ioctl_kvm_run \ ioctl_loop \ ioctl_mtd \ ioctl_rtc \ @@ -3071,6 +3202,7 @@ PURE_EXECUTABLES = \ mmap64 \ mmsg \ mmsg_name \ + modify_ldt \ mount \ move_pages \ mq \ @@ -3140,9 +3272,12 @@ PURE_EXECUTABLES = \ nlattr_tcmsg \ nlattr_unix_diag_msg \ old_mmap \ + old_mmap-P \ + old_mmap-v-none \ oldfstat \ oldlstat \ oldselect \ + oldselect-efault \ oldstat \ open \ openat \ @@ -3156,7 +3291,9 @@ PURE_EXECUTABLES = \ pkey_free \ pkey_mprotect \ poll \ + poll-P \ ppoll \ + ppoll-P \ prctl-arg2-intptr \ prctl-dumpable \ prctl-name \ @@ -3199,6 +3336,7 @@ PURE_EXECUTABLES = \ renameat \ renameat2 \ request_key \ + riscv_flush_icache \ rmdir \ rt_sigaction \ rt_sigpending \ @@ -3208,6 +3346,12 @@ PURE_EXECUTABLES = \ rt_sigsuspend \ rt_sigtimedwait \ rt_tgsigqueueinfo \ + s390_guarded_storage \ + s390_guarded_storage-v \ + s390_pci_mmio_read_write \ + s390_runtime_instr \ + s390_sthyi \ + s390_sthyi-v \ sched_get_priority_mxx \ sched_rr_get_interval \ sched_xetaffinity \ @@ -3259,6 +3403,7 @@ PURE_EXECUTABLES = \ so_peercred \ sock_filter-v \ socketcall \ + sockopt-sol_netlink \ splice \ stat \ stat64 \ @@ -3310,6 +3455,7 @@ PURE_EXECUTABLES = \ xattr \ xattr-strings \ xet_robust_list \ + xet_thread_area_x86 \ xetitimer \ xetpgid \ xetpriority \ @@ -3344,13 +3490,17 @@ uio_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64 stack_fcall_SOURCES = stack-fcall.c \ stack-fcall-0.c stack-fcall-1.c stack-fcall-2.c stack-fcall-3.c +stack_fcall_mangled_SOURCES = stack-fcall-mangled.c \ + stack-fcall-mangled-0.c stack-fcall-mangled-1.c \ + stack-fcall-mangled-2.c stack-fcall-mangled-3.c + # Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in; do not edit. -GEN_TESTS = _newselect.gen.test accept.gen.test accept4.gen.test \ - access.gen.test acct.gen.test add_key.gen.test \ - adjtimex.gen.test aio.gen.test alarm.gen.test bpf.gen.test \ - bpf-v.gen.test btrfs.gen.test chmod.gen.test chown.gen.test \ - chown32.gen.test chroot.gen.test clock.gen.test \ +GEN_TESTS = _newselect.gen.test _newselect-P.gen.test accept.gen.test \ + accept4.gen.test access.gen.test acct.gen.test \ + add_key.gen.test adjtimex.gen.test aio.gen.test alarm.gen.test \ + bpf.gen.test bpf-v.gen.test btrfs.gen.test chmod.gen.test \ + chown.gen.test chown32.gen.test chroot.gen.test clock.gen.test \ clock_adjtime.gen.test clock_nanosleep.gen.test \ clock_xettime.gen.test copy_file_range.gen.test creat.gen.test \ delete_module.gen.test dup.gen.test dup2.gen.test \ @@ -3378,46 +3528,49 @@ GEN_TESTS = _newselect.gen.test accept.gen.test accept4.gen.test \ gettid.gen.test getuid32.gen.test getxxid.gen.test \ group_req.gen.test inet-cmsg.gen.test init_module.gen.test \ inotify.gen.test inotify_init1.gen.test int_0x80.gen.test \ - ioctl_block.gen.test ioctl_evdev.gen.test \ - ioctl_evdev-v.gen.test ioctl_loop.gen.test \ - ioctl_loop-v.gen.test ioctl_mtd.gen.test ioctl_rtc.gen.test \ + ioctl_block.gen.test ioctl_dm.gen.test ioctl_dm-v.gen.test \ + ioctl_evdev.gen.test ioctl_evdev-v.gen.test \ + ioctl_kvm_run.gen.test ioctl_loop.gen.test \ + ioctl_loop-nv.gen.test ioctl_loop-v.gen.test \ + ioctl_mtd.gen.test ioctl_nsfs.gen.test ioctl_rtc.gen.test \ ioctl_rtc-v.gen.test ioctl_scsi.gen.test \ ioctl_sg_io_v3.gen.test ioctl_sg_io_v4.gen.test \ - ioctl_uffdio.gen.test ioctl_v4l2.gen.test ioperm.gen.test \ - iopl.gen.test ioprio.gen.test ip_mreq.gen.test ipc.gen.test \ - ipc_msg.gen.test ipc_sem.gen.test ipc_shm.gen.test \ - kcmp.gen.test kcmp-y.gen.test kexec_file_load.gen.test \ - kexec_load.gen.test keyctl.gen.test kill.gen.test \ - lchown.gen.test lchown32.gen.test link.gen.test \ - linkat.gen.test lookup_dcookie.gen.test lstat.gen.test \ - lstat64.gen.test madvise.gen.test mbind.gen.test \ - membarrier.gen.test memfd_create.gen.test \ - migrate_pages.gen.test mincore.gen.test mkdir.gen.test \ - mkdirat.gen.test mknod.gen.test mknodat.gen.test \ - mlock.gen.test mlock2.gen.test mlockall.gen.test \ - mmap64.gen.test mmsg.gen.test mmsg-silent.gen.test \ - mmsg_name.gen.test mmsg_name-v.gen.test mount.gen.test \ - move_pages.gen.test mq.gen.test mq_sendrecv.gen.test \ - mq_sendrecv-read.gen.test mq_sendrecv-write.gen.test \ - msg_control.gen.test msg_control-v.gen.test msg_name.gen.test \ - munlockall.gen.test nanosleep.gen.test \ - net-icmp_filter.gen.test net-sockaddr.gen.test \ - netlink_audit.gen.test netlink_crypto.gen.test \ - netlink_generic.gen.test netlink_kobject_uevent.gen.test \ - netlink_netfilter.gen.test netlink_protocol.gen.test \ - netlink_route.gen.test netlink_selinux.gen.test \ - netlink_xfrm.gen.test newfstatat.gen.test nlattr.gen.test \ - nfnetlink_acct.gen.test nfnetlink_cthelper.gen.test \ - nfnetlink_ctnetlink.gen.test nfnetlink_ctnetlink_exp.gen.test \ - nfnetlink_cttimeout.gen.test nfnetlink_ipset.gen.test \ - nfnetlink_nft_compat.gen.test nfnetlink_nftables.gen.test \ - nfnetlink_osf.gen.test nfnetlink_queue.gen.test \ - nfnetlink_ulog.gen.test nlattr_crypto_user_alg.gen.test \ - nlattr_br_port_msg.gen.test nlattr_dcbmsg.gen.test \ - nlattr_fib_rule_hdr.gen.test nlattr_ifaddrlblmsg.gen.test \ - nlattr_ifaddrmsg.gen.test nlattr_ifinfomsg.gen.test \ - nlattr_ifla_brport.gen.test nlattr_ifla_port.gen.test \ - nlattr_ifla_xdp.gen.test nlattr_inet_diag_msg.gen.test \ + ioctl_sock_gifconf.gen.test ioctl_uffdio.gen.test \ + ioctl_v4l2.gen.test ioperm.gen.test iopl.gen.test \ + ioprio.gen.test ip_mreq.gen.test ipc.gen.test ipc_msg.gen.test \ + ipc_sem.gen.test ipc_shm.gen.test kcmp.gen.test \ + kcmp-y.gen.test kexec_file_load.gen.test kexec_load.gen.test \ + keyctl.gen.test kill.gen.test lchown.gen.test \ + lchown32.gen.test link.gen.test linkat.gen.test \ + lookup_dcookie.gen.test lstat.gen.test lstat64.gen.test \ + madvise.gen.test mbind.gen.test membarrier.gen.test \ + memfd_create.gen.test migrate_pages.gen.test mincore.gen.test \ + mkdir.gen.test mkdirat.gen.test mknod.gen.test \ + mknodat.gen.test mlock.gen.test mlock2.gen.test \ + mlockall.gen.test mmap64.gen.test mmsg.gen.test \ + mmsg-silent.gen.test mmsg_name.gen.test mmsg_name-v.gen.test \ + modify_ldt.gen.test mount.gen.test move_pages.gen.test \ + mq.gen.test mq_sendrecv.gen.test mq_sendrecv-read.gen.test \ + mq_sendrecv-write.gen.test msg_control.gen.test \ + msg_control-v.gen.test msg_name.gen.test munlockall.gen.test \ + nanosleep.gen.test net-icmp_filter.gen.test \ + net-sockaddr.gen.test netlink_audit.gen.test \ + netlink_crypto.gen.test netlink_generic.gen.test \ + netlink_kobject_uevent.gen.test netlink_netfilter.gen.test \ + netlink_protocol.gen.test netlink_route.gen.test \ + netlink_selinux.gen.test netlink_xfrm.gen.test \ + newfstatat.gen.test nlattr.gen.test nfnetlink_acct.gen.test \ + nfnetlink_cthelper.gen.test nfnetlink_ctnetlink.gen.test \ + nfnetlink_ctnetlink_exp.gen.test nfnetlink_cttimeout.gen.test \ + nfnetlink_ipset.gen.test nfnetlink_nft_compat.gen.test \ + nfnetlink_nftables.gen.test nfnetlink_osf.gen.test \ + nfnetlink_queue.gen.test nfnetlink_ulog.gen.test \ + nlattr_crypto_user_alg.gen.test nlattr_br_port_msg.gen.test \ + nlattr_dcbmsg.gen.test nlattr_fib_rule_hdr.gen.test \ + nlattr_ifaddrlblmsg.gen.test nlattr_ifaddrmsg.gen.test \ + nlattr_ifinfomsg.gen.test nlattr_ifla_brport.gen.test \ + nlattr_ifla_port.gen.test nlattr_ifla_xdp.gen.test \ + nlattr_inet_diag_msg.gen.test \ nlattr_inet_diag_req_compat.gen.test \ nlattr_inet_diag_req_v2.gen.test \ nlattr_mdba_mdb_entry.gen.test \ @@ -3429,16 +3582,18 @@ GEN_TESTS = _newselect.gen.test accept.gen.test accept4.gen.test \ nlattr_tc_stats.gen.test nlattr_tca_stab.gen.test \ nlattr_tcamsg.gen.test nlattr_tcmsg.gen.test \ nlattr_unix_diag_msg.gen.test old_mmap.gen.test \ - oldfstat.gen.test oldlstat.gen.test oldstat.gen.test \ - open.gen.test openat.gen.test osf_utimes.gen.test \ - pause.gen.test perf_event_open.gen.test \ + old_mmap-P.gen.test old_mmap-v-none.gen.test oldfstat.gen.test \ + oldlstat.gen.test oldselect.gen.test oldselect-P.gen.test \ + oldselect-efault.gen.test oldselect-efault-P.gen.test \ + oldstat.gen.test open.gen.test openat.gen.test \ + osf_utimes.gen.test pause.gen.test perf_event_open.gen.test \ perf_event_open_nonverbose.gen.test \ perf_event_open_unabbrev.gen.test pipe2.gen.test \ pkey_alloc.gen.test pkey_free.gen.test pkey_mprotect.gen.test \ - ppoll.gen.test ppoll-v.gen.test pread64-pwrite64.gen.test \ - preadv.gen.test preadv-pwritev.gen.test \ - preadv2-pwritev2.gen.test printstr.gen.test \ - printpath-umovestr.gen.test \ + ppoll.gen.test ppoll-P.gen.test ppoll-v.gen.test \ + pread64-pwrite64.gen.test preadv.gen.test \ + preadv-pwritev.gen.test preadv2-pwritev2.gen.test \ + printstr.gen.test printpath-umovestr.gen.test \ printpath-umovestr-peekdata.gen.test \ printpath-umovestr-undumpable.gen.test \ printstrn-umoven.gen.test printstrn-umoven-peekdata.gen.test \ @@ -3451,44 +3606,48 @@ GEN_TESTS = _newselect.gen.test accept.gen.test accept4.gen.test \ reboot.gen.test recvfrom.gen.test recvmmsg-timeout.gen.test \ recvmsg.gen.test regex.gen.test remap_file_pages.gen.test \ rename.gen.test renameat.gen.test renameat2.gen.test \ - request_key.gen.test rmdir.gen.test rt_sigpending.gen.test \ - rt_sigprocmask.gen.test rt_sigqueueinfo.gen.test \ - rt_sigreturn.gen.test rt_sigsuspend.gen.test \ - rt_sigtimedwait.gen.test rt_tgsigqueueinfo.gen.test \ - sched.gen.test sched_get_priority_mxx.gen.test \ - sched_rr_get_interval.gen.test sched_xetaffinity.gen.test \ - sched_xetattr.gen.test sched_xetparam.gen.test \ - sched_xetscheduler.gen.test sched_yield.gen.test \ - seccomp-filter.gen.test seccomp-filter-v.gen.test \ - seccomp_get_action_avail.gen.test select.gen.test \ - semop.gen.test sendfile.gen.test sendfile64.gen.test \ - set_mempolicy.gen.test setdomainname.gen.test \ - setfsgid.gen.test setfsgid32.gen.test setfsuid.gen.test \ - setfsuid32.gen.test setgid.gen.test setgid32.gen.test \ - setgroups.gen.test setgroups32.gen.test sethostname.gen.test \ - setns.gen.test setregid.gen.test setregid32.gen.test \ - setresgid.gen.test setresgid32.gen.test setresuid.gen.test \ - setresuid32.gen.test setreuid.gen.test setreuid32.gen.test \ - setrlimit.gen.test setuid.gen.test setuid32.gen.test \ - shmxt.gen.test shutdown.gen.test sigaction.gen.test \ - siginfo.gen.test signal.gen.test signal_receive.gen.test \ - signalfd4.gen.test sigpending.gen.test sigprocmask.gen.test \ - sigreturn.gen.test sigsuspend.gen.test so_linger.gen.test \ - so_peercred.gen.test sock_filter-v.gen.test \ - socketcall.gen.test splice.gen.test stat.gen.test \ - stat64.gen.test statfs.gen.test statfs64.gen.test \ - statx.gen.test swap.gen.test sxetmask.gen.test \ - symlink.gen.test symlinkat.gen.test sync.gen.test \ - sync_file_range.gen.test sync_file_range2.gen.test \ - sysinfo.gen.test syslog.gen.test tee.gen.test time.gen.test \ - timer_create.gen.test timer_xettime.gen.test \ - timerfd_xettime.gen.test times.gen.test times-fail.gen.test \ - trace_fstat.gen.test trace_fstatfs.gen.test \ - trace_lstat.gen.test trace_question.gen.test \ - trace_stat.gen.test trace_stat_like.gen.test \ - trace_statfs.gen.test trace_statfs_like.gen.test \ - truncate.gen.test truncate64.gen.test ugetrlimit.gen.test \ - umask.gen.test umoven-illptr.gen.test umovestr-illptr.gen.test \ + request_key.gen.test riscv_flush_icache.gen.test \ + rmdir.gen.test rt_sigpending.gen.test rt_sigprocmask.gen.test \ + rt_sigqueueinfo.gen.test rt_sigreturn.gen.test \ + rt_sigsuspend.gen.test rt_sigtimedwait.gen.test \ + rt_tgsigqueueinfo.gen.test s390_guarded_storage.gen.test \ + s390_guarded_storage-v.gen.test \ + s390_pci_mmio_read_write.gen.test s390_runtime_instr.gen.test \ + s390_sthyi.gen.test s390_sthyi-v.gen.test sched.gen.test \ + sched_get_priority_mxx.gen.test sched_rr_get_interval.gen.test \ + sched_xetaffinity.gen.test sched_xetattr.gen.test \ + sched_xetparam.gen.test sched_xetscheduler.gen.test \ + sched_yield.gen.test seccomp-filter.gen.test \ + seccomp-filter-v.gen.test seccomp_get_action_avail.gen.test \ + select.gen.test select-P.gen.test semop.gen.test \ + sendfile.gen.test sendfile64.gen.test set_mempolicy.gen.test \ + setdomainname.gen.test setfsgid.gen.test setfsgid32.gen.test \ + setfsuid.gen.test setfsuid32.gen.test setgid.gen.test \ + setgid32.gen.test setgroups.gen.test setgroups32.gen.test \ + sethostname.gen.test setns.gen.test setregid.gen.test \ + setregid32.gen.test setresgid.gen.test setresgid32.gen.test \ + setresuid.gen.test setresuid32.gen.test setreuid.gen.test \ + setreuid32.gen.test setrlimit.gen.test setuid.gen.test \ + setuid32.gen.test shmxt.gen.test shutdown.gen.test \ + sigaction.gen.test siginfo.gen.test signal.gen.test \ + signal_receive.gen.test signalfd4.gen.test sigpending.gen.test \ + sigprocmask.gen.test sigreturn.gen.test sigsuspend.gen.test \ + so_linger.gen.test so_peercred.gen.test sock_filter-v.gen.test \ + socketcall.gen.test sockopt-sol_netlink.gen.test \ + splice.gen.test stat.gen.test stat64.gen.test statfs.gen.test \ + statfs64.gen.test statx.gen.test swap.gen.test \ + sxetmask.gen.test symlink.gen.test symlinkat.gen.test \ + sync.gen.test sync_file_range.gen.test \ + sync_file_range2.gen.test sysinfo.gen.test syslog.gen.test \ + tee.gen.test time.gen.test timer_create.gen.test \ + timer_xettime.gen.test timerfd_xettime.gen.test times.gen.test \ + times-fail.gen.test trace_fstat.gen.test \ + trace_fstatfs.gen.test trace_lstat.gen.test \ + trace_question.gen.test trace_stat.gen.test \ + trace_stat_like.gen.test trace_statfs.gen.test \ + trace_statfs_like.gen.test truncate.gen.test \ + truncate64.gen.test ugetrlimit.gen.test umask.gen.test \ + umoven-illptr.gen.test umovestr-illptr.gen.test \ umovestr3.gen.test unlink.gen.test unlinkat.gen.test \ unshare.gen.test userfaultfd.gen.test ustat.gen.test \ utime.gen.test utimensat.gen.test utimes.gen.test \ @@ -3499,7 +3658,7 @@ GEN_TESTS = _newselect.gen.test accept.gen.test accept4.gen.test \ xetitimer.gen.test xetpgid.gen.test xetpriority.gen.test \ xettimeofday.gen.test @USE_LIBUNWIND_FALSE@LIBUNWIND_TESTS = -@USE_LIBUNWIND_TRUE@LIBUNWIND_TESTS = strace-k.test +@USE_LIBUNWIND_TRUE@LIBUNWIND_TESTS = strace-k.test $(am__append_1) DECODER_TESTS = \ brk.test \ btrfs-v.test \ @@ -3514,11 +3673,6 @@ DECODER_TESTS = \ futex.test \ getuid.test \ ioctl.test \ - ioctl_dm-v.test \ - ioctl_dm.test \ - ioctl_loop-nv.test \ - ioctl_nsfs.test \ - ioctl_sock_gifconf.test \ ipc_msgbuf.test \ llseek.test \ lseek.test \ @@ -3530,9 +3684,11 @@ DECODER_TESTS = \ net.test \ netlink_sock_diag.test \ nsyscalls.test \ - oldselect.test \ + nsyscalls-d.test \ + nsyscalls-nd.test \ personality.test \ pipe.test \ + poll-P.test \ poll.test \ prctl-arg2-intptr.test \ prctl-dumpable.test \ @@ -3551,6 +3707,7 @@ DECODER_TESTS = \ seccomp-strict.test \ sigaltstack.test \ sun_path.test \ + xet_thread_area_x86.test \ uio.test \ umount.test \ umount2.test \ @@ -3573,6 +3730,8 @@ MISC_TESTS = \ detach-sleeping.test \ detach-stopped.test \ filter-unavailable.test \ + filtering_fd-syntax.test \ + filtering_syscall-syntax.test \ fflush.test \ get_regs.test \ interactive_block.test \ @@ -3616,10 +3775,16 @@ XFAIL_TESTS_x86_64 = int_0x80.gen.test XFAIL_TESTS_x32 = int_0x80.gen.test XFAIL_TESTS = $(XFAIL_TESTS_$(MPERS_NAME)) $(XFAIL_TESTS_$(ARCH)) TEST_LOG_COMPILER = env -AM_TEST_LOG_FLAGS = STRACE_ARCH=$(ARCH) MIPS_ABI=$(MIPS_ABI) $(srcdir)/run.sh +AM_TEST_LOG_FLAGS = STRACE_ARCH=$(ARCH) STRACE_NATIVE_ARCH=$(NATIVE_ARCH) \ + SIZEOF_KERNEL_LONG_T=$(SIZEOF_KERNEL_LONG_T) \ + SIZEOF_LONG=$(SIZEOF_LONG) \ + MIPS_ABI=$(MIPS_ABI) $(srcdir)/run.sh + VALGRIND_FLAGS = --quiet VALGRIND_SUPPRESSIONS_FILES = $(abs_srcdir)/strace.supp EXTRA_DIST = \ + accept_compat.h \ + attach-p-cmd.h \ caps-abbrev.awk \ caps.awk \ clock.in \ @@ -3635,7 +3800,6 @@ EXTRA_DIST = \ getresugid.c \ init.sh \ init_delete_module.h \ - ioctl-v.sh \ ipc.sh \ ipc_msgbuf.expected \ ksysent.sed \ @@ -3643,8 +3807,8 @@ EXTRA_DIST = \ match.awk \ net.expected \ netlink_sock_diag-v.sh \ - oldselect.expected \ pipe.expected \ + print_user_desc.c \ process_vm_readv_writev.c \ pure_executables.list \ qual_fault-exit_group.expected \ @@ -3662,10 +3826,12 @@ EXTRA_DIST = \ setugid.c \ sigaltstack.expected \ sockname.c \ + stack-fcall.h \ strace-C.expected \ strace-E.expected \ strace-T.expected \ strace-ff.expected \ + strace-k-demangle.test \ strace-k.test \ strace-r.expected \ strace.supp \ @@ -3756,6 +3922,10 @@ _newselect$(EXEEXT): $(_newselect_OBJECTS) $(_newselect_DEPENDENCIES) $(EXTRA__n @rm -f _newselect$(EXEEXT) $(AM_V_CCLD)$(LINK) $(_newselect_OBJECTS) $(_newselect_LDADD) $(LIBS) +_newselect-P$(EXEEXT): $(_newselect_P_OBJECTS) $(_newselect_P_DEPENDENCIES) $(EXTRA__newselect_P_DEPENDENCIES) + @rm -f _newselect-P$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(_newselect_P_OBJECTS) $(_newselect_P_LDADD) $(LIBS) + accept$(EXEEXT): $(accept_OBJECTS) $(accept_DEPENDENCIES) $(EXTRA_accept_DEPENDENCIES) @rm -f accept$(EXEEXT) $(AM_V_CCLD)$(LINK) $(accept_OBJECTS) $(accept_LDADD) $(LIBS) @@ -4248,6 +4418,10 @@ ioctl_evdev-v$(EXEEXT): $(ioctl_evdev_v_OBJECTS) $(ioctl_evdev_v_DEPENDENCIES) $ @rm -f ioctl_evdev-v$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ioctl_evdev_v_OBJECTS) $(ioctl_evdev_v_LDADD) $(LIBS) +ioctl_kvm_run$(EXEEXT): $(ioctl_kvm_run_OBJECTS) $(ioctl_kvm_run_DEPENDENCIES) $(EXTRA_ioctl_kvm_run_DEPENDENCIES) + @rm -f ioctl_kvm_run$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ioctl_kvm_run_OBJECTS) $(ioctl_kvm_run_LDADD) $(LIBS) + ioctl_loop$(EXEEXT): $(ioctl_loop_OBJECTS) $(ioctl_loop_DEPENDENCIES) $(EXTRA_ioctl_loop_DEPENDENCIES) @rm -f ioctl_loop$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ioctl_loop_OBJECTS) $(ioctl_loop_LDADD) $(LIBS) @@ -4484,6 +4658,10 @@ mmsg_name-v$(EXEEXT): $(mmsg_name_v_OBJECTS) $(mmsg_name_v_DEPENDENCIES) $(EXTRA @rm -f mmsg_name-v$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mmsg_name_v_OBJECTS) $(mmsg_name_v_LDADD) $(LIBS) +modify_ldt$(EXEEXT): $(modify_ldt_OBJECTS) $(modify_ldt_DEPENDENCIES) $(EXTRA_modify_ldt_DEPENDENCIES) + @rm -f modify_ldt$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(modify_ldt_OBJECTS) $(modify_ldt_LDADD) $(LIBS) + mount$(EXEEXT): $(mount_OBJECTS) $(mount_DEPENDENCIES) $(EXTRA_mount_DEPENDENCIES) @rm -f mount$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mount_OBJECTS) $(mount_LDADD) $(LIBS) @@ -4780,10 +4958,22 @@ nsyscalls$(EXEEXT): $(nsyscalls_OBJECTS) $(nsyscalls_DEPENDENCIES) $(EXTRA_nsysc @rm -f nsyscalls$(EXEEXT) $(AM_V_CCLD)$(LINK) $(nsyscalls_OBJECTS) $(nsyscalls_LDADD) $(LIBS) +nsyscalls-d$(EXEEXT): $(nsyscalls_d_OBJECTS) $(nsyscalls_d_DEPENDENCIES) $(EXTRA_nsyscalls_d_DEPENDENCIES) + @rm -f nsyscalls-d$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(nsyscalls_d_OBJECTS) $(nsyscalls_d_LDADD) $(LIBS) + old_mmap$(EXEEXT): $(old_mmap_OBJECTS) $(old_mmap_DEPENDENCIES) $(EXTRA_old_mmap_DEPENDENCIES) @rm -f old_mmap$(EXEEXT) $(AM_V_CCLD)$(LINK) $(old_mmap_OBJECTS) $(old_mmap_LDADD) $(LIBS) +old_mmap-P$(EXEEXT): $(old_mmap_P_OBJECTS) $(old_mmap_P_DEPENDENCIES) $(EXTRA_old_mmap_P_DEPENDENCIES) + @rm -f old_mmap-P$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(old_mmap_P_OBJECTS) $(old_mmap_P_LDADD) $(LIBS) + +old_mmap-v-none$(EXEEXT): $(old_mmap_v_none_OBJECTS) $(old_mmap_v_none_DEPENDENCIES) $(EXTRA_old_mmap_v_none_DEPENDENCIES) + @rm -f old_mmap-v-none$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(old_mmap_v_none_OBJECTS) $(old_mmap_v_none_LDADD) $(LIBS) + oldfstat$(EXEEXT): $(oldfstat_OBJECTS) $(oldfstat_DEPENDENCIES) $(EXTRA_oldfstat_DEPENDENCIES) @rm -f oldfstat$(EXEEXT) $(AM_V_CCLD)$(LINK) $(oldfstat_OBJECTS) $(oldfstat_LDADD) $(LIBS) @@ -4796,6 +4986,18 @@ oldselect$(EXEEXT): $(oldselect_OBJECTS) $(oldselect_DEPENDENCIES) $(EXTRA_oldse @rm -f oldselect$(EXEEXT) $(AM_V_CCLD)$(LINK) $(oldselect_OBJECTS) $(oldselect_LDADD) $(LIBS) +oldselect-P$(EXEEXT): $(oldselect_P_OBJECTS) $(oldselect_P_DEPENDENCIES) $(EXTRA_oldselect_P_DEPENDENCIES) + @rm -f oldselect-P$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(oldselect_P_OBJECTS) $(oldselect_P_LDADD) $(LIBS) + +oldselect-efault$(EXEEXT): $(oldselect_efault_OBJECTS) $(oldselect_efault_DEPENDENCIES) $(EXTRA_oldselect_efault_DEPENDENCIES) + @rm -f oldselect-efault$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(oldselect_efault_OBJECTS) $(oldselect_efault_LDADD) $(LIBS) + +oldselect-efault-P$(EXEEXT): $(oldselect_efault_P_OBJECTS) $(oldselect_efault_P_DEPENDENCIES) $(EXTRA_oldselect_efault_P_DEPENDENCIES) + @rm -f oldselect-efault-P$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(oldselect_efault_P_OBJECTS) $(oldselect_efault_P_LDADD) $(LIBS) + oldstat$(EXEEXT): $(oldstat_OBJECTS) $(oldstat_DEPENDENCIES) $(EXTRA_oldstat_DEPENDENCIES) @rm -f oldstat$(EXEEXT) $(AM_V_CCLD)$(LINK) $(oldstat_OBJECTS) $(oldstat_LDADD) $(LIBS) @@ -4860,10 +5062,18 @@ poll$(EXEEXT): $(poll_OBJECTS) $(poll_DEPENDENCIES) $(EXTRA_poll_DEPENDENCIES) @rm -f poll$(EXEEXT) $(AM_V_CCLD)$(LINK) $(poll_OBJECTS) $(poll_LDADD) $(LIBS) +poll-P$(EXEEXT): $(poll_P_OBJECTS) $(poll_P_DEPENDENCIES) $(EXTRA_poll_P_DEPENDENCIES) + @rm -f poll-P$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(poll_P_OBJECTS) $(poll_P_LDADD) $(LIBS) + ppoll$(EXEEXT): $(ppoll_OBJECTS) $(ppoll_DEPENDENCIES) $(EXTRA_ppoll_DEPENDENCIES) @rm -f ppoll$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ppoll_OBJECTS) $(ppoll_LDADD) $(LIBS) +ppoll-P$(EXEEXT): $(ppoll_P_OBJECTS) $(ppoll_P_DEPENDENCIES) $(EXTRA_ppoll_P_DEPENDENCIES) + @rm -f ppoll-P$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ppoll_P_OBJECTS) $(ppoll_P_LDADD) $(LIBS) + ppoll-v$(EXEEXT): $(ppoll_v_OBJECTS) $(ppoll_v_DEPENDENCIES) $(EXTRA_ppoll_v_DEPENDENCIES) @rm -f ppoll-v$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ppoll_v_OBJECTS) $(ppoll_v_LDADD) $(LIBS) @@ -5084,6 +5294,10 @@ restart_syscall$(EXEEXT): $(restart_syscall_OBJECTS) $(restart_syscall_DEPENDENC @rm -f restart_syscall$(EXEEXT) $(AM_V_CCLD)$(LINK) $(restart_syscall_OBJECTS) $(restart_syscall_LDADD) $(LIBS) +riscv_flush_icache$(EXEEXT): $(riscv_flush_icache_OBJECTS) $(riscv_flush_icache_DEPENDENCIES) $(EXTRA_riscv_flush_icache_DEPENDENCIES) + @rm -f riscv_flush_icache$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(riscv_flush_icache_OBJECTS) $(riscv_flush_icache_LDADD) $(LIBS) + rmdir$(EXEEXT): $(rmdir_OBJECTS) $(rmdir_DEPENDENCIES) $(EXTRA_rmdir_DEPENDENCIES) @rm -f rmdir$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rmdir_OBJECTS) $(rmdir_LDADD) $(LIBS) @@ -5124,6 +5338,30 @@ run_expect_termsig$(EXEEXT): $(run_expect_termsig_OBJECTS) $(run_expect_termsig_ @rm -f run_expect_termsig$(EXEEXT) $(AM_V_CCLD)$(LINK) $(run_expect_termsig_OBJECTS) $(run_expect_termsig_LDADD) $(LIBS) +s390_guarded_storage$(EXEEXT): $(s390_guarded_storage_OBJECTS) $(s390_guarded_storage_DEPENDENCIES) $(EXTRA_s390_guarded_storage_DEPENDENCIES) + @rm -f s390_guarded_storage$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(s390_guarded_storage_OBJECTS) $(s390_guarded_storage_LDADD) $(LIBS) + +s390_guarded_storage-v$(EXEEXT): $(s390_guarded_storage_v_OBJECTS) $(s390_guarded_storage_v_DEPENDENCIES) $(EXTRA_s390_guarded_storage_v_DEPENDENCIES) + @rm -f s390_guarded_storage-v$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(s390_guarded_storage_v_OBJECTS) $(s390_guarded_storage_v_LDADD) $(LIBS) + +s390_pci_mmio_read_write$(EXEEXT): $(s390_pci_mmio_read_write_OBJECTS) $(s390_pci_mmio_read_write_DEPENDENCIES) $(EXTRA_s390_pci_mmio_read_write_DEPENDENCIES) + @rm -f s390_pci_mmio_read_write$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(s390_pci_mmio_read_write_OBJECTS) $(s390_pci_mmio_read_write_LDADD) $(LIBS) + +s390_runtime_instr$(EXEEXT): $(s390_runtime_instr_OBJECTS) $(s390_runtime_instr_DEPENDENCIES) $(EXTRA_s390_runtime_instr_DEPENDENCIES) + @rm -f s390_runtime_instr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(s390_runtime_instr_OBJECTS) $(s390_runtime_instr_LDADD) $(LIBS) + +s390_sthyi$(EXEEXT): $(s390_sthyi_OBJECTS) $(s390_sthyi_DEPENDENCIES) $(EXTRA_s390_sthyi_DEPENDENCIES) + @rm -f s390_sthyi$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(s390_sthyi_OBJECTS) $(s390_sthyi_LDADD) $(LIBS) + +s390_sthyi-v$(EXEEXT): $(s390_sthyi_v_OBJECTS) $(s390_sthyi_v_DEPENDENCIES) $(EXTRA_s390_sthyi_v_DEPENDENCIES) + @rm -f s390_sthyi-v$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(s390_sthyi_v_OBJECTS) $(s390_sthyi_v_LDADD) $(LIBS) + sched_get_priority_mxx$(EXEEXT): $(sched_get_priority_mxx_OBJECTS) $(sched_get_priority_mxx_DEPENDENCIES) $(EXTRA_sched_get_priority_mxx_DEPENDENCIES) @rm -f sched_get_priority_mxx$(EXEEXT) $(AM_V_CCLD)$(LINK) $(sched_get_priority_mxx_OBJECTS) $(sched_get_priority_mxx_LDADD) $(LIBS) @@ -5176,6 +5414,10 @@ select$(EXEEXT): $(select_OBJECTS) $(select_DEPENDENCIES) $(EXTRA_select_DEPENDE @rm -f select$(EXEEXT) $(AM_V_CCLD)$(LINK) $(select_OBJECTS) $(select_LDADD) $(LIBS) +select-P$(EXEEXT): $(select_P_OBJECTS) $(select_P_DEPENDENCIES) $(EXTRA_select_P_DEPENDENCIES) + @rm -f select-P$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(select_P_OBJECTS) $(select_P_LDADD) $(LIBS) + semop$(EXEEXT): $(semop_OBJECTS) $(semop_DEPENDENCIES) $(EXTRA_semop_DEPENDENCIES) @rm -f semop$(EXEEXT) $(AM_V_CCLD)$(LINK) $(semop_OBJECTS) $(semop_LDADD) $(LIBS) @@ -5360,6 +5602,10 @@ socketcall$(EXEEXT): $(socketcall_OBJECTS) $(socketcall_DEPENDENCIES) $(EXTRA_so @rm -f socketcall$(EXEEXT) $(AM_V_CCLD)$(LINK) $(socketcall_OBJECTS) $(socketcall_LDADD) $(LIBS) +sockopt-sol_netlink$(EXEEXT): $(sockopt_sol_netlink_OBJECTS) $(sockopt_sol_netlink_DEPENDENCIES) $(EXTRA_sockopt_sol_netlink_DEPENDENCIES) + @rm -f sockopt-sol_netlink$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(sockopt_sol_netlink_OBJECTS) $(sockopt_sol_netlink_LDADD) $(LIBS) + splice$(EXEEXT): $(splice_OBJECTS) $(splice_DEPENDENCIES) $(EXTRA_splice_DEPENDENCIES) @rm -f splice$(EXEEXT) $(AM_V_CCLD)$(LINK) $(splice_OBJECTS) $(splice_LDADD) $(LIBS) @@ -5368,6 +5614,10 @@ stack-fcall$(EXEEXT): $(stack_fcall_OBJECTS) $(stack_fcall_DEPENDENCIES) $(EXTRA @rm -f stack-fcall$(EXEEXT) $(AM_V_CCLD)$(LINK) $(stack_fcall_OBJECTS) $(stack_fcall_LDADD) $(LIBS) +stack-fcall-mangled$(EXEEXT): $(stack_fcall_mangled_OBJECTS) $(stack_fcall_mangled_DEPENDENCIES) $(EXTRA_stack_fcall_mangled_DEPENDENCIES) + @rm -f stack-fcall-mangled$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(stack_fcall_mangled_OBJECTS) $(stack_fcall_mangled_LDADD) $(LIBS) + stat$(EXEEXT): $(stat_OBJECTS) $(stat_DEPENDENCIES) $(EXTRA_stat_DEPENDENCIES) @rm -f stat$(EXEEXT) $(AM_V_CCLD)$(LINK) $(stat_OBJECTS) $(stat_LDADD) $(LIBS) @@ -5596,6 +5846,10 @@ xet_robust_list$(EXEEXT): $(xet_robust_list_OBJECTS) $(xet_robust_list_DEPENDENC @rm -f xet_robust_list$(EXEEXT) $(AM_V_CCLD)$(LINK) $(xet_robust_list_OBJECTS) $(xet_robust_list_LDADD) $(LIBS) +xet_thread_area_x86$(EXEEXT): $(xet_thread_area_x86_OBJECTS) $(xet_thread_area_x86_DEPENDENCIES) $(EXTRA_xet_thread_area_x86_DEPENDENCIES) + @rm -f xet_thread_area_x86$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(xet_thread_area_x86_OBJECTS) $(xet_thread_area_x86_LDADD) $(LIBS) + xetitimer$(EXEEXT): $(xetitimer_OBJECTS) $(xetitimer_DEPENDENCIES) $(EXTRA_xetitimer_DEPENDENCIES) @rm -f xetitimer$(EXEEXT) $(AM_V_CCLD)$(LINK) $(xetitimer_OBJECTS) $(xetitimer_LDADD) $(LIBS) @@ -5622,6 +5876,7 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_newselect-P.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_newselect.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/accept.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/accept4.Po@am__quote@ @@ -5746,6 +6001,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_dm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_evdev-v.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_evdev.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_kvm_run.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_loop-nv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_loop-v.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_loop.Po@am__quote@ @@ -5831,6 +6087,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmsg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmsg_name-v.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmsg_name.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modify_ldt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mount.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/move_pages.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mq.Po@am__quote@ @@ -5904,10 +6161,16 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nlattr_tcamsg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nlattr_tcmsg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nlattr_unix_diag_msg.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nsyscalls-d.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nsyscalls.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/old_mmap-P.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/old_mmap-v-none.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/old_mmap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oldfstat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oldlstat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oldselect-P.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oldselect-efault-P.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oldselect-efault.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oldselect.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oldstat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/open.Po@am__quote@ @@ -5924,7 +6187,9 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkey_alloc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkey_free.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkey_mprotect.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/poll-P.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/poll.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppoll-P.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppoll-v.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppoll.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prctl-arg2-intptr.Po@am__quote@ @@ -5981,6 +6246,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/renameat2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/request_key.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/restart_syscall.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/riscv_flush_icache.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rmdir.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rt_sigaction.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rt_sigpending.Po@am__quote@ @@ -5991,6 +6257,12 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rt_sigtimedwait.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rt_tgsigqueueinfo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run_expect_termsig.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_guarded_storage-v.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_guarded_storage.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_pci_mmio_read_write.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_runtime_instr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_sthyi-v.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_sthyi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched_get_priority_mxx.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched_rr_get_interval.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched_xetaffinity.Po@am__quote@ @@ -6003,6 +6275,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seccomp-filter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seccomp-strict.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seccomp_get_action_avail.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/select-P.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/select.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/semop.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sendfile.Po@am__quote@ @@ -6050,11 +6323,17 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/so_peercred.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sock_filter-v.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/socketcall.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sockopt-sol_netlink.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splice.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-0.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-3.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled-0.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled-1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled-2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled-3.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat64-stat64.Po@am__quote@ @@ -6113,6 +6392,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xattr-strings.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xattr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xet_robust_list.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xet_thread_area_x86.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xetitimer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xetpgid.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xetpriority.Po@am__quote@ @@ -7094,6 +7374,9 @@ uninstall-am: $(srcdir)/_newselect.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/_newselect-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/accept.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -7385,21 +7668,36 @@ $(srcdir)/int_0x80.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(srcdir)/ioctl_block.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_dm.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/ioctl_dm-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_evdev.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ $(srcdir)/ioctl_evdev-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_kvm_run.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_loop.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_loop-nv.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_loop-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ $(srcdir)/ioctl_mtd.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_nsfs.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_rtc.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -7415,6 +7713,9 @@ $(srcdir)/ioctl_sg_io_v3.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_test $(srcdir)/ioctl_sg_io_v4.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_sock_gifconf.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_uffdio.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -7538,6 +7839,9 @@ $(srcdir)/mmsg_name.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(srcdir)/mmsg_name-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/modify_ldt.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/mount.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -7733,12 +8037,30 @@ $(srcdir)/nlattr_unix_diag_msg.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/ge $(srcdir)/old_mmap.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/old_mmap-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/old_mmap-v-none.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/oldfstat.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ $(srcdir)/oldlstat.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/oldselect.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/oldselect-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/oldselect-efault.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/oldselect-efault-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/oldstat.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -7778,6 +8100,9 @@ $(srcdir)/pkey_mprotect.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests $(srcdir)/ppoll.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ppoll-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ppoll-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -7889,6 +8214,9 @@ $(srcdir)/renameat2.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(srcdir)/request_key.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/riscv_flush_icache.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/rmdir.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -7913,6 +8241,24 @@ $(srcdir)/rt_sigtimedwait.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tes $(srcdir)/rt_tgsigqueueinfo.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/s390_guarded_storage.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_guarded_storage-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_pci_mmio_read_write.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_runtime_instr.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_sthyi.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_sthyi-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/sched.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -7949,6 +8295,9 @@ $(srcdir)/seccomp_get_action_avail.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir $(srcdir)/select.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/select-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/semop.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -8072,6 +8421,9 @@ $(srcdir)/sock_filter-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests $(srcdir)/socketcall.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/sockopt-sol_netlink.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/splice.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ diff --git a/tests-mx32/_newselect-P.c b/tests-mx32/_newselect-P.c new file mode 100644 index 00000000..561fbfe2 --- /dev/null +++ b/tests-mx32/_newselect-P.c @@ -0,0 +1,2 @@ +#define PATH_TRACING_FD 9 +#include "_newselect.c" diff --git a/tests-mx32/_newselect-P.gen.test b/tests-mx32/_newselect-P.gen.test new file mode 100755 index 00000000..9c4247a1 --- /dev/null +++ b/tests-mx32/_newselect-P.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (_newselect-P -e trace=_newselect -P /dev/full 9>>/dev/full); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -e trace=_newselect -P /dev/full 9>>/dev/full diff --git a/tests-mx32/_newselect.gen.test b/tests-mx32/_newselect.gen.test index 490abe46..8e4d5f24 100755 --- a/tests-mx32/_newselect.gen.test +++ b/tests-mx32/_newselect.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (_newselect ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (_newselect ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/accept.c b/tests-mx32/accept.c index 8d42ba15..40b45db2 100644 --- a/tests-mx32/accept.c +++ b/tests-mx32/accept.c @@ -2,6 +2,7 @@ * Check decoding of accept syscall. * * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,9 +28,34 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef TEST_SYSCALL_NAME -# define TEST_SYSCALL_NAME accept -#endif +#include "tests.h" + +#include <unistd.h> + +#include <asm/unistd.h> + +#if defined __NR_accept + +# ifndef TEST_SYSCALL_NAME +# define TEST_SYSCALL_NAME do_accept + +# ifndef TEST_SYSCALL_STR +# define TEST_SYSCALL_STR "accept" +# endif + +int do_accept(int sockfd, void *addr, void *addrlen) +{ + return syscall(__NR_accept, sockfd, addr, addrlen); +} +# endif /* !TEST_SYSCALL_NAME */ + +#else /* !__NR_accept */ + +# ifndef TEST_SYSCALL_NAME +# define TEST_SYSCALL_NAME accept +# endif + +#endif /* __NR_accept */ #define TEST_SYSCALL_PREPARE connect_un() static void connect_un(void); diff --git a/tests-mx32/accept.gen.test b/tests-mx32/accept.gen.test index 3ebba3b5..45d9239e 100755 --- a/tests-mx32/accept.gen.test +++ b/tests-mx32/accept.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (accept -a22); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (accept -a22 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a22 +run_strace_match_diff -a22 diff --git a/tests-mx32/accept4.gen.test b/tests-mx32/accept4.gen.test index 5bd7fe6c..71199703 100755 --- a/tests-mx32/accept4.gen.test +++ b/tests-mx32/accept4.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (accept4 -a37); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (accept4 -a37 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a37 +run_strace_match_diff -a37 diff --git a/tests-mx32/accept_compat.h b/tests-mx32/accept_compat.h new file mode 100644 index 00000000..c45b2551 --- /dev/null +++ b/tests-mx32/accept_compat.h @@ -0,0 +1,25 @@ +#ifndef _STRACE_TESTS_ACCEPT_COMPAT_H_ +#define _STRACE_TESTS_ACCEPT_COMPAT_H_ + +#include <unistd.h> +#include <sys/socket.h> +#include <asm/unistd.h> + +#if defined __NR_socketcall && defined __sparc__ +/* + * Work around the fact that + * - glibc >= 2.26 uses accept4 syscall to implement accept() call on sparc; + * - accept syscall had not been wired up on sparc until v4.4-rc8~4^2~1. + */ +static inline int +do_accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen) +{ + const long args[] = { sockfd, (long) addr, (long) addrlen }; + + return syscall(__NR_socketcall, 5, args); +} +#else +# define do_accept accept +#endif + +#endif /* !_STRACE_TESTS_ACCEPT_COMPAT_H_ */ diff --git a/tests-mx32/acct.gen.test b/tests-mx32/acct.gen.test index fa14e85b..4a98dd46 100755 --- a/tests-mx32/acct.gen.test +++ b/tests-mx32/acct.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (acct -a20); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (acct -a20 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a20 +run_strace_match_diff -a20 diff --git a/tests-mx32/adjtimex.gen.test b/tests-mx32/adjtimex.gen.test index 8db59f29..e6024431 100755 --- a/tests-mx32/adjtimex.gen.test +++ b/tests-mx32/adjtimex.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (adjtimex -a15); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (adjtimex -a15 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a15 +run_strace_match_diff -a15 diff --git a/tests-mx32/alarm.gen.test b/tests-mx32/alarm.gen.test index ba1dea8b..25982e14 100755 --- a/tests-mx32/alarm.gen.test +++ b/tests-mx32/alarm.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (alarm -a10); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (alarm -a10 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a10 +run_strace_match_diff -a10 diff --git a/tests-mx32/attach-p-cmd-cmd.c b/tests-mx32/attach-p-cmd-cmd.c index d0f824e9..70e3a2de 100644 --- a/tests-mx32/attach-p-cmd-cmd.c +++ b/tests-mx32/attach-p-cmd-cmd.c @@ -1,7 +1,7 @@ /* * This file is part of attach-p-cmd strace test. * - * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2017 Dmitry V. Levin <ldv@altlinux.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,19 +32,41 @@ #include <stdio.h> #include <sys/stat.h> #include <unistd.h> +#include "attach-p-cmd.h" -int -main(void) +static void +write_pidfile(const pid_t pid) +{ + FILE *fp = fopen(pidfile, "w"); + if (!fp) + perror_msg_and_fail("fopen: %s", pidfile); + + if (fprintf(fp, "%d", pid) < 0) + perror_msg_and_fail("fprintf: %s", pidfile); + + if (fclose(fp)) + perror_msg_and_fail("fclose: %s", pidfile); +} + +static void +wait_for_peer_invocation(void) { - static const char lockdir[] = "attach-p-cmd.test-lock"; /* wait for the lock directory to be created by peer */ while (rmdir(lockdir)) { if (ENOENT != errno) perror_msg_and_fail("rmdir: %s", lockdir); } +} + +int +main(void) +{ + const pid_t pid = getpid(); + write_pidfile(pid); + + wait_for_peer_invocation(); static const char dir[] = "attach-p-cmd.test cmd"; - pid_t pid = getpid(); int rc = chdir(dir); printf("%-5d chdir(\"%s\") = %s\n" diff --git a/tests-mx32/attach-p-cmd-p.c b/tests-mx32/attach-p-cmd-p.c index 254d19ae..843db957 100644 --- a/tests-mx32/attach-p-cmd-p.c +++ b/tests-mx32/attach-p-cmd-p.c @@ -1,7 +1,7 @@ /* * This file is part of attach-p-cmd strace test. * - * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2017 Dmitry V. Levin <ldv@altlinux.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,27 +33,14 @@ #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> +#include <time.h> #include <unistd.h> +#include "attach-p-cmd.h" static void -handler(int signo) +wait_for_peer_invocation(void) { -} - -int -main(void) -{ - const struct sigaction act = { .sa_handler = handler }; - if (sigaction(SIGALRM, &act, NULL)) - perror_msg_and_fail("sigaction"); - - sigset_t mask = {}; - sigaddset(&mask, SIGALRM); - if (sigprocmask(SIG_UNBLOCK, &mask, NULL)) - perror_msg_and_fail("sigprocmask"); - - static const char lockdir[] = "attach-p-cmd.test-lock"; - /* create a lock directory */ + /* create the lock directory */ if (mkdir(lockdir, 0700)) perror_msg_and_fail("mkdir: %s", lockdir); @@ -63,21 +50,51 @@ main(void) perror_msg_and_fail("mkdir: %s", lockdir); } - /* remove the lock directory */ + /* cleanup the lock directory */ if (rmdir(lockdir)) perror_msg_and_fail("rmdir: %s", lockdir); +} + +static void +wait_for_peer_termination(void) +{ + FILE *fp = fopen(pidfile, "r"); + if (!fp) + perror_msg_and_fail("fopen: %s", pidfile); + + pid_t pid; + if (fscanf(fp, "%d", &pid) < 0) + perror_msg_and_fail("fscanf: %s", pidfile); + if (pid < 0) + error_msg_and_fail("pid = %d", pid); + + if (fclose(fp)) + perror_msg_and_fail("fclose: %s", pidfile); + + if (unlink(pidfile)) + perror_msg_and_fail("unlink: %s", pidfile); + + while (kill(pid, 0) == 0) + ; +} + +int +main(void) +{ + wait_for_peer_invocation(); + wait_for_peer_termination(); - alarm(1); - pause(); + static const struct timespec ts = { .tv_nsec = 123456789 }; + if (nanosleep(&ts, NULL)) + perror_msg_and_fail("nanosleep"); static const char dir[] = "attach-p-cmd.test -p"; pid_t pid = getpid(); int rc = chdir(dir); - printf("%-5d --- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---\n" - "%-5d chdir(\"%s\") = %d %s (%m)\n" + printf("%-5d chdir(\"%s\") = %s\n" "%-5d +++ exited with 0 +++\n", - pid, pid, dir, rc, errno2name(), pid); + pid, dir, sprintrc(rc), pid); return 0; } diff --git a/tests-mx32/attach-p-cmd.h b/tests-mx32/attach-p-cmd.h new file mode 100644 index 00000000..e04af38f --- /dev/null +++ b/tests-mx32/attach-p-cmd.h @@ -0,0 +1,2 @@ +static const char lockdir[] = "attach-p-cmd.test-lock"; +static const char pidfile[] = "attach-p-cmd.test-pid"; diff --git a/tests-mx32/bpf.c b/tests-mx32/bpf.c index bec30f87..3f963fa3 100644 --- a/tests-mx32/bpf.c +++ b/tests-mx32/bpf.c @@ -34,8 +34,11 @@ && (defined HAVE_UNION_BPF_ATTR_ATTACH_FLAGS \ || defined HAVE_UNION_BPF_ATTR_BPF_FD \ || defined HAVE_UNION_BPF_ATTR_FLAGS \ - || defined HAVE_UNION_BPF_ATTR_INNER_MAP_FD \ - || defined HAVE_UNION_BPF_ATTR_PROG_FLAGS) + || defined HAVE_UNION_BPF_ATTR_INFO_INFO \ + || defined HAVE_UNION_BPF_ATTR_NEXT_ID \ + || defined HAVE_UNION_BPF_ATTR_NUMA_NODE \ + || defined HAVE_UNION_BPF_ATTR_PROG_FLAGS \ + || defined HAVE_UNION_BPF_ATTR_TEST_DURATION) # include <stddef.h> # include <stdio.h> @@ -43,6 +46,7 @@ # include <string.h> # include <unistd.h> # include <linux/bpf.h> +# include "print_fields.h" static const kernel_ulong_t long_bits = (kernel_ulong_t) 0xfacefeed00000000ULL; static const char *errstr; @@ -183,18 +187,22 @@ sys_bpf(kernel_ulong_t cmd, kernel_ulong_t attr, kernel_ulong_t size) init_ ## cmd_ ## _attr, print_ ## cmd_ ## _attr) \ /* End of TEST_BPF definition. */ -# ifdef HAVE_UNION_BPF_ATTR_INNER_MAP_FD +#define DEF_BPF_INIT_FIRST(cmd_, field_, value_) \ + static unsigned int \ + init_ ## cmd_ ## _first(const unsigned long eop) \ + { \ + static const union bpf_attr attr = { .field_ = value_ };\ + static const unsigned int offset = sizeof(attr.field_); \ + const unsigned long addr = eop - offset; \ + \ + memcpy((void *) addr, &attr.field_, offset); \ + return offset; \ + } \ + /* End of DEF_INIT_FIRST definition. */ -static unsigned int -init_BPF_MAP_CREATE_first(const unsigned long eop) -{ - static const union bpf_attr attr = { .map_type = 2 }; - static const unsigned int offset = sizeof(attr.map_type); - const unsigned long addr = eop - offset; +# ifdef HAVE_UNION_BPF_ATTR_NUMA_NODE - memcpy((void *) addr, &attr.map_type, offset); - return offset; -} +DEF_BPF_INIT_FIRST(BPF_MAP_CREATE, map_type, 2) static void print_BPF_MAP_CREATE_first(const unsigned long addr) @@ -211,11 +219,12 @@ init_BPF_MAP_CREATE_attr(const unsigned long eop) .key_size = 4, .value_size = 8, .max_entries = 256, - .map_flags = 1, - .inner_map_fd = -1 + .map_flags = 7, + .inner_map_fd = -1, + .numa_node = 42 }; static const unsigned int offset = - offsetofend(union bpf_attr, inner_map_fd); + offsetofend(union bpf_attr, numa_node); const unsigned long addr = eop - offset; memcpy((void *) addr, &attr, offset); @@ -227,23 +236,15 @@ print_BPF_MAP_CREATE_attr(const unsigned long addr) { printf("map_type=BPF_MAP_TYPE_HASH, key_size=4" ", value_size=8, max_entries=256" - ", map_flags=BPF_F_NO_PREALLOC, inner_map_fd=-1"); + ", map_flags=BPF_F_NO_PREALLOC|BPF_F_NO_COMMON_LRU" + "|BPF_F_NUMA_NODE, inner_map_fd=-1, numa_node=42"); } -# endif /* HAVE_UNION_BPF_ATTR_INNER_MAP_FD */ +# endif /* HAVE_UNION_BPF_ATTR_NUMA_NODE */ # ifdef HAVE_UNION_BPF_ATTR_FLAGS -static unsigned int -init_BPF_MAP_LOOKUP_ELEM_first(const unsigned long eop) -{ - static const union bpf_attr attr = { .map_fd = -1 }; - static const unsigned int offset = sizeof(attr.map_fd); - const unsigned long addr = eop - offset; - - memcpy((void *) addr, &attr.map_fd, offset); - return offset; -} +DEF_BPF_INIT_FIRST(BPF_MAP_LOOKUP_ELEM, map_fd, -1) static void print_BPF_MAP_LOOKUP_ELEM_first(const unsigned long addr) @@ -367,16 +368,7 @@ print_BPF_MAP_GET_NEXT_KEY_attr(const unsigned long addr) # ifdef HAVE_UNION_BPF_ATTR_PROG_FLAGS -static unsigned int -init_BPF_PROG_LOAD_first(const unsigned long eop) -{ - static const union bpf_attr attr = { .prog_type = 1 }; - static const unsigned int offset = sizeof(attr.prog_type); - const unsigned long addr = eop - offset; - - memcpy((void *) addr, &attr.prog_type, offset); - return offset; -} +DEF_BPF_INIT_FIRST(BPF_PROG_LOAD, prog_type, 1) static void print_BPF_PROG_LOAD_first(const unsigned long addr) @@ -435,16 +427,7 @@ print_BPF_PROG_LOAD_attr(const unsigned long addr) */ # ifdef HAVE_UNION_BPF_ATTR_BPF_FD -static unsigned int -init_BPF_OBJ_PIN_first(const unsigned long eop) -{ - static const union bpf_attr attr = {}; - static const unsigned int offset = sizeof(attr.pathname); - const unsigned long addr = eop - offset; - - memcpy((void *) addr, &attr.pathname, offset); - return offset; -} +DEF_BPF_INIT_FIRST(BPF_OBJ_PIN, pathname, 0) static void print_BPF_OBJ_PIN_first(const unsigned long addr) @@ -484,16 +467,7 @@ print_BPF_OBJ_PIN_attr(const unsigned long addr) /* BPF_PROG_ATTACH and BPF_PROG_DETACH commands appear in kernel 4.10. */ # ifdef HAVE_UNION_BPF_ATTR_ATTACH_FLAGS -static unsigned int -init_BPF_PROG_ATTACH_first(const unsigned long eop) -{ - static const union bpf_attr attr = { .target_fd = -1 }; - static const unsigned int offset = sizeof(attr.target_fd); - const unsigned long addr = eop - offset; - - memcpy((void *) addr, &attr.target_fd, offset); - return offset; -} +DEF_BPF_INIT_FIRST(BPF_PROG_ATTACH, target_fd, -1) static void print_BPF_PROG_ATTACH_first(const unsigned long addr) @@ -559,13 +533,171 @@ print_BPF_PROG_DETACH_attr(const unsigned long addr) # endif /* HAVE_UNION_BPF_ATTR_ATTACH_FLAGS */ +/* BPF_PROG_TEST_RUN command appears in kernel 4.12. */ +# ifdef HAVE_UNION_BPF_ATTR_TEST_DURATION + +DEF_BPF_INIT_FIRST(BPF_PROG_TEST_RUN, test.prog_fd, -1) + +static void +print_BPF_PROG_TEST_RUN_first(const unsigned long addr) +{ + printf("test={prog_fd=-1, retval=0, data_size_in=0, data_size_out=0" + ", data_in=0, data_out=0, repeat=0, duration=0}"); +} + +static const union bpf_attr sample_BPF_PROG_TEST_RUN_attr = { + .test = { + .prog_fd = -1, + .retval = 0xfac1fed2, + .data_size_in = 0xfac3fed4, + .data_size_out = 0xfac5fed6, + .data_in = (uint64_t) 0xfacef11dbadc2ded, + .data_out = (uint64_t) 0xfacef33dbadc4ded, + .repeat = 0xfac7fed8, + .duration = 0xfac9feda + } +}; +static unsigned int +init_BPF_PROG_TEST_RUN_attr(const unsigned long eop) +{ + static const unsigned int offset = + offsetofend(union bpf_attr, test); + const unsigned long addr = eop - offset; + + memcpy((void *) addr, &sample_BPF_PROG_TEST_RUN_attr, offset); + return offset; +} + +static void +print_BPF_PROG_TEST_RUN_attr(const unsigned long addr) +{ + PRINT_FIELD_D("test={", sample_BPF_PROG_TEST_RUN_attr.test, prog_fd); + PRINT_FIELD_U(", ", sample_BPF_PROG_TEST_RUN_attr.test, retval); + PRINT_FIELD_U(", ", sample_BPF_PROG_TEST_RUN_attr.test, data_size_in); + PRINT_FIELD_U(", ", sample_BPF_PROG_TEST_RUN_attr.test, data_size_out); + PRINT_FIELD_X(", ", sample_BPF_PROG_TEST_RUN_attr.test, data_in); + PRINT_FIELD_X(", ", sample_BPF_PROG_TEST_RUN_attr.test, data_out); + PRINT_FIELD_U(", ", sample_BPF_PROG_TEST_RUN_attr.test, repeat); + PRINT_FIELD_U(", ", sample_BPF_PROG_TEST_RUN_attr.test, duration); + printf("}"); +} + +# endif /* HAVE_UNION_BPF_ATTR_TEST_DURATION */ + +# ifdef HAVE_UNION_BPF_ATTR_NEXT_ID + +DEF_BPF_INIT_FIRST(BPF_PROG_GET_NEXT_ID, start_id, 0xdeadbeef) + +static void +print_BPF_PROG_GET_NEXT_ID_first(const unsigned long addr) +{ + printf("start_id=%u, next_id=0", 0xdeadbeef); +} + +static unsigned int +init_BPF_PROG_GET_NEXT_ID_attr(const unsigned long eop) +{ + static const union bpf_attr attr = { + .start_id = 0xbadc0ded, + .next_id = 0xcafef00d + }; + static const unsigned int offset = + offsetofend(union bpf_attr, next_id); + const unsigned long addr = eop - offset; + + memcpy((void *) addr, &attr, offset); + return offset; +} + +static void +print_BPF_PROG_GET_NEXT_ID_attr(const unsigned long addr) +{ + printf("start_id=%u, next_id=%u", 0xbadc0ded, 0xcafef00d); +} + +# define init_BPF_MAP_GET_NEXT_ID_first init_BPF_PROG_GET_NEXT_ID_first +# define print_BPF_MAP_GET_NEXT_ID_first print_BPF_PROG_GET_NEXT_ID_first +# define init_BPF_MAP_GET_NEXT_ID_attr init_BPF_PROG_GET_NEXT_ID_attr +# define print_BPF_MAP_GET_NEXT_ID_attr print_BPF_PROG_GET_NEXT_ID_attr + +# define init_BPF_PROG_GET_FD_BY_ID_first init_BPF_PROG_GET_NEXT_ID_first +# define init_BPF_PROG_GET_FD_BY_ID_attr init_BPF_PROG_GET_NEXT_ID_attr + +static void +print_BPF_PROG_GET_FD_BY_ID_first(const unsigned long addr) +{ + printf("prog_id=%u, next_id=0", 0xdeadbeef); +} + +static void +print_BPF_PROG_GET_FD_BY_ID_attr(const unsigned long addr) +{ + printf("prog_id=%u, next_id=%u", 0xbadc0ded, 0xcafef00d); +} + +# define init_BPF_MAP_GET_FD_BY_ID_first init_BPF_PROG_GET_NEXT_ID_first +# define init_BPF_MAP_GET_FD_BY_ID_attr init_BPF_PROG_GET_NEXT_ID_attr + +static void +print_BPF_MAP_GET_FD_BY_ID_first(const unsigned long addr) +{ + printf("map_id=%u, next_id=0", 0xdeadbeef); +} + +static void +print_BPF_MAP_GET_FD_BY_ID_attr(const unsigned long addr) +{ + printf("map_id=%u, next_id=%u", 0xbadc0ded, 0xcafef00d); +} + +# endif /* HAVE_UNION_BPF_ATTR_NEXT_ID */ + +# ifdef HAVE_UNION_BPF_ATTR_INFO_INFO + +DEF_BPF_INIT_FIRST(BPF_OBJ_GET_INFO_BY_FD, info.bpf_fd, -1) + +static void +print_BPF_OBJ_GET_INFO_BY_FD_first(const unsigned long addr) +{ + printf("info={bpf_fd=-1, info_len=0, info=0}"); +} + +static const union bpf_attr sample_BPF_OBJ_GET_INFO_BY_FD_attr = { + .info = { + .bpf_fd = -1, + .info_len = 0xdeadbeef, + .info = (uint64_t) 0xfacefeedbadc0ded + } +}; +static unsigned int +init_BPF_OBJ_GET_INFO_BY_FD_attr(const unsigned long eop) +{ + static const unsigned int offset = + offsetofend(union bpf_attr, info); + const unsigned long addr = eop - offset; + + memcpy((void *) addr, &sample_BPF_OBJ_GET_INFO_BY_FD_attr, offset); + return offset; +} + +static void +print_BPF_OBJ_GET_INFO_BY_FD_attr(const unsigned long addr) +{ + PRINT_FIELD_D("info={", sample_BPF_OBJ_GET_INFO_BY_FD_attr.info, bpf_fd); + PRINT_FIELD_U(", ", sample_BPF_OBJ_GET_INFO_BY_FD_attr.info, info_len); + PRINT_FIELD_X(", ", sample_BPF_OBJ_GET_INFO_BY_FD_attr.info, info); + printf("}"); +} + +# endif /* HAVE_UNION_BPF_ATTR_INFO_INFO */ + int main(void) { page_size = get_page_size(); end_of_page = (unsigned long) tail_alloc(1) + 1; -# ifdef HAVE_UNION_BPF_ATTR_INNER_MAP_FD +# ifdef HAVE_UNION_BPF_ATTR_NUMA_NODE TEST_BPF(BPF_MAP_CREATE); # endif @@ -590,6 +722,21 @@ main(void) TEST_BPF(BPF_PROG_DETACH); # endif +# ifdef HAVE_UNION_BPF_ATTR_TEST_DURATION + TEST_BPF(BPF_PROG_TEST_RUN); +# endif + +# ifdef HAVE_UNION_BPF_ATTR_NEXT_ID + TEST_BPF(BPF_PROG_GET_NEXT_ID); + TEST_BPF(BPF_MAP_GET_NEXT_ID); + TEST_BPF(BPF_PROG_GET_FD_BY_ID); + TEST_BPF(BPF_MAP_GET_FD_BY_ID); +# endif + +# ifdef HAVE_UNION_BPF_ATTR_INFO_INFO + TEST_BPF(BPF_OBJ_GET_INFO_BY_FD); +# endif + sys_bpf(0xfacefeed, end_of_page, 40); printf("bpf(0xfacefeed /* BPF_??? */, %#lx, 40) = %s\n", end_of_page, errstr); diff --git a/tests-mx32/bpf.gen.test b/tests-mx32/bpf.gen.test index 7ee9e7f3..1391d6b8 100755 --- a/tests-mx32/bpf.gen.test +++ b/tests-mx32/bpf.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (bpf -a20); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (bpf -a20 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a20 +run_strace_match_diff -a20 diff --git a/tests-mx32/btrfs.gen.test b/tests-mx32/btrfs.gen.test index a7118efa..3976cf5d 100755 --- a/tests-mx32/btrfs.gen.test +++ b/tests-mx32/btrfs.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (btrfs +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (btrfs +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests-mx32/chmod.gen.test b/tests-mx32/chmod.gen.test index 438665ad..40330885 100755 --- a/tests-mx32/chmod.gen.test +++ b/tests-mx32/chmod.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (chmod -a28); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (chmod -a28 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a28 +run_strace_match_diff -a28 diff --git a/tests-mx32/chown.gen.test b/tests-mx32/chown.gen.test index 46889a13..87cc0f02 100755 --- a/tests-mx32/chown.gen.test +++ b/tests-mx32/chown.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (chown -a28); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (chown -a28 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a28 +run_strace_match_diff -a28 diff --git a/tests-mx32/chown32.gen.test b/tests-mx32/chown32.gen.test index f0f603e3..8d9d8916 100755 --- a/tests-mx32/chown32.gen.test +++ b/tests-mx32/chown32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (chown32 -a31); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (chown32 -a31 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a31 +run_strace_match_diff -a31 diff --git a/tests-mx32/chroot.gen.test b/tests-mx32/chroot.gen.test index 6ea81dd2..40eb55ba 100755 --- a/tests-mx32/chroot.gen.test +++ b/tests-mx32/chroot.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (chroot -a24); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (chroot -a24 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a24 +run_strace_match_diff -a24 diff --git a/tests-mx32/clock_adjtime.gen.test b/tests-mx32/clock_adjtime.gen.test index 735e3af5..22d5dbcd 100755 --- a/tests-mx32/clock_adjtime.gen.test +++ b/tests-mx32/clock_adjtime.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (clock_adjtime -a37); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (clock_adjtime -a37 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a37 +run_strace_match_diff -a37 diff --git a/tests-mx32/copy_file_range.gen.test b/tests-mx32/copy_file_range.gen.test index 4f3063ba..e90c6c18 100755 --- a/tests-mx32/copy_file_range.gen.test +++ b/tests-mx32/copy_file_range.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (copy_file_range ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (copy_file_range ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/creat.gen.test b/tests-mx32/creat.gen.test index d2e47d31..baff9169 100755 --- a/tests-mx32/creat.gen.test +++ b/tests-mx32/creat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (creat -a20); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (creat -a20 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a20 +run_strace_match_diff -a20 diff --git a/tests-mx32/delete_module.gen.test b/tests-mx32/delete_module.gen.test index 4e4c6712..028515ff 100755 --- a/tests-mx32/delete_module.gen.test +++ b/tests-mx32/delete_module.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (delete_module -a23); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (delete_module -a23 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a23 +run_strace_match_diff -a23 diff --git a/tests-mx32/dup.gen.test b/tests-mx32/dup.gen.test index e5729c0f..e559cdbc 100755 --- a/tests-mx32/dup.gen.test +++ b/tests-mx32/dup.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (dup -a8); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (dup -a8 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a8 +run_strace_match_diff -a8 diff --git a/tests-mx32/dup2.gen.test b/tests-mx32/dup2.gen.test index fd1f5c97..6a6d2f58 100755 --- a/tests-mx32/dup2.gen.test +++ b/tests-mx32/dup2.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (dup2 -a13); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (dup2 -a13 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a13 +run_strace_match_diff -a13 diff --git a/tests-mx32/dup3.gen.test b/tests-mx32/dup3.gen.test index d6ff7d7a..776b9a79 100755 --- a/tests-mx32/dup3.gen.test +++ b/tests-mx32/dup3.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (dup3 -a24); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (dup3 -a24 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a24 +run_strace_match_diff -a24 diff --git a/tests-mx32/epoll_create.gen.test b/tests-mx32/epoll_create.gen.test index 841da6d0..277a5aab 100755 --- a/tests-mx32/epoll_create.gen.test +++ b/tests-mx32/epoll_create.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_create -a17); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_create -a17 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a17 +run_strace_match_diff -a17 diff --git a/tests-mx32/epoll_create1.gen.test b/tests-mx32/epoll_create1.gen.test index c5e62a06..c510c322 100755 --- a/tests-mx32/epoll_create1.gen.test +++ b/tests-mx32/epoll_create1.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_create1 -a28); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_create1 -a28 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a28 +run_strace_match_diff -a28 diff --git a/tests-mx32/epoll_ctl.gen.test b/tests-mx32/epoll_ctl.gen.test index 68c96eb8..dba65f7d 100755 --- a/tests-mx32/epoll_ctl.gen.test +++ b/tests-mx32/epoll_ctl.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_ctl ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_ctl ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/epoll_pwait.gen.test b/tests-mx32/epoll_pwait.gen.test index c558efc4..f98e2b55 100755 --- a/tests-mx32/epoll_pwait.gen.test +++ b/tests-mx32/epoll_pwait.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_pwait ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_pwait ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/epoll_wait.gen.test b/tests-mx32/epoll_wait.gen.test index 024cc0fd..d90fbeb9 100755 --- a/tests-mx32/epoll_wait.gen.test +++ b/tests-mx32/epoll_wait.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_wait -a26); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_wait -a26 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a26 +run_strace_match_diff -a26 diff --git a/tests-mx32/error_msg.c b/tests-mx32/error_msg.c index 498a8821..9cb3e80c 100644 --- a/tests-mx32/error_msg.c +++ b/tests-mx32/error_msg.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -25,6 +26,9 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#define perror_msg_and_fail perror_msg_and_fail +#define error_msg_and_fail error_msg_and_fail + #include "tests.h" #include <errno.h> #include <stdarg.h> diff --git a/tests-mx32/execveat.gen.test b/tests-mx32/execveat.gen.test index c92e4d65..180b8299 100755 --- a/tests-mx32/execveat.gen.test +++ b/tests-mx32/execveat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (execveat ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (execveat ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/fadvise64_64.gen.test b/tests-mx32/fadvise64_64.gen.test index 5f95b3c2..e46bf810 100755 --- a/tests-mx32/fadvise64_64.gen.test +++ b/tests-mx32/fadvise64_64.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fadvise64_64 +fadvise64.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fadvise64_64 +fadvise64.test ); do not edit. +set -- . "${srcdir=.}/fadvise64.test" diff --git a/tests-mx32/fallocate.gen.test b/tests-mx32/fallocate.gen.test index c6cfdb79..3bb5bbf0 100755 --- a/tests-mx32/fallocate.gen.test +++ b/tests-mx32/fallocate.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fallocate -a18); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fallocate -a18 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a18 +run_strace_match_diff -a18 diff --git a/tests-mx32/fanotify_init.gen.test b/tests-mx32/fanotify_init.gen.test index ee519e66..69807a7a 100755 --- a/tests-mx32/fanotify_init.gen.test +++ b/tests-mx32/fanotify_init.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fanotify_init ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fanotify_init ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/fanotify_mark.gen.test b/tests-mx32/fanotify_mark.gen.test index ce16a551..46512608 100755 --- a/tests-mx32/fanotify_mark.gen.test +++ b/tests-mx32/fanotify_mark.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fanotify_mark -a32); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fanotify_mark -a32 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a32 +run_strace_match_diff -a32 diff --git a/tests-mx32/fchdir.gen.test b/tests-mx32/fchdir.gen.test index c80e141f..a352a21b 100755 --- a/tests-mx32/fchdir.gen.test +++ b/tests-mx32/fchdir.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchdir -a11); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchdir -a11 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a11 +run_strace_match_diff -a11 diff --git a/tests-mx32/fchmod.gen.test b/tests-mx32/fchmod.gen.test index f327fb7a..828c9b50 100755 --- a/tests-mx32/fchmod.gen.test +++ b/tests-mx32/fchmod.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchmod -a15); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchmod -a15 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a15 +run_strace_match_diff -a15 diff --git a/tests-mx32/fchmodat.gen.test b/tests-mx32/fchmodat.gen.test index 9ee1f013..36461858 100755 --- a/tests-mx32/fchmodat.gen.test +++ b/tests-mx32/fchmodat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchmodat ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchmodat ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/fchown.gen.test b/tests-mx32/fchown.gen.test index 63ee5454..ec7f7c54 100755 --- a/tests-mx32/fchown.gen.test +++ b/tests-mx32/fchown.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchown -a16); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchown -a16 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a16 +run_strace_match_diff -a16 diff --git a/tests-mx32/fchown32.gen.test b/tests-mx32/fchown32.gen.test index d8167dd4..16705832 100755 --- a/tests-mx32/fchown32.gen.test +++ b/tests-mx32/fchown32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchown32 -a18); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchown32 -a18 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a18 +run_strace_match_diff -a18 diff --git a/tests-mx32/fchownat.gen.test b/tests-mx32/fchownat.gen.test index 2ec9e32c..54bd0430 100755 --- a/tests-mx32/fchownat.gen.test +++ b/tests-mx32/fchownat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchownat ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchownat ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/fcntl.gen.test b/tests-mx32/fcntl.gen.test index 83a1af48..9de26c00 100755 --- a/tests-mx32/fcntl.gen.test +++ b/tests-mx32/fcntl.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fcntl -a8); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fcntl -a8 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a8 +run_strace_match_diff -a8 diff --git a/tests-mx32/fcntl64.gen.test b/tests-mx32/fcntl64.gen.test index 9d3b98ad..fee01b66 100755 --- a/tests-mx32/fcntl64.gen.test +++ b/tests-mx32/fcntl64.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fcntl64 -a8); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fcntl64 -a8 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a8 +run_strace_match_diff -a8 diff --git a/tests-mx32/fdatasync.gen.test b/tests-mx32/fdatasync.gen.test index 0dbea8ad..9aa5f2a6 100755 --- a/tests-mx32/fdatasync.gen.test +++ b/tests-mx32/fdatasync.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fdatasync -a14); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fdatasync -a14 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a14 +run_strace_match_diff -a14 diff --git a/tests-mx32/file_ioctl.gen.test b/tests-mx32/file_ioctl.gen.test index f7e58f59..0abab81a 100755 --- a/tests-mx32/file_ioctl.gen.test +++ b/tests-mx32/file_ioctl.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (file_ioctl +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (file_ioctl +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests-mx32/filtering_fd-syntax.test b/tests-mx32/filtering_fd-syntax.test new file mode 100755 index 00000000..4f4e9c73 --- /dev/null +++ b/tests-mx32/filtering_fd-syntax.test @@ -0,0 +1,60 @@ +#!/bin/sh +# +# Check descriptor set parsing syntax. +# +# Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> +# Copyright (c) 2016-2018 The strace developers. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +. "${srcdir=.}/syntax.sh" + +check_fd_qualify() +{ + check_e "invalid descriptor '$1'" -e"read=$2" + check_e "invalid descriptor '$1'" -e "read=$2" + check_e "invalid descriptor '$1'" -e"write=$2" + check_e "invalid descriptor '$1'" -e "write=$2" +} + +for arg in '' , ,, ,,, ; do + check_fd_qualify "$arg" "$arg" + check_fd_qualify "!$arg" "!$arg" +done + +for arg in -1 -42 \ + not_fd \ + 2147483648 \ + 4294967296 \ + ; do + check_fd_qualify "$arg" "$arg" + check_fd_qualify "$arg" "1,$arg" + check_fd_qualify "$arg" "$arg,1" + check_fd_qualify "$arg" "!$arg" +done + +for arg in ! all none; do + check_fd_qualify "$arg" "1,$arg" + check_fd_qualify "!$arg" "1,!$arg" +done diff --git a/tests-mx32/filtering_syscall-syntax.test b/tests-mx32/filtering_syscall-syntax.test new file mode 100755 index 00000000..8fda8dc2 --- /dev/null +++ b/tests-mx32/filtering_syscall-syntax.test @@ -0,0 +1,121 @@ +#!/bin/sh +# +# Check syscall set parsing syntax. +# +# Copyright (c) 2016-2018 Dmitry V. Levin <ldv@altlinux.org> +# Copyright (c) 2017 Nikolay Marchuk <marchuk.nikolay.a@gmail.com> +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +. "${srcdir=.}/syntax.sh" + +check_syscall() +{ + [ -z "$2" ] || check_e "invalid system call '$1'" -e"$2" + + check_e "invalid system call '$1'" -e "$2" + check_e "invalid system call '$1'" -etrace="$2" + check_e "invalid system call '$1'" -e trace="$2" + + check_e "invalid system call '$1'" -eabbrev="$2" + check_e "invalid system call '$1'" -e abbrev="$2" + + check_e "invalid system call '$1'" -everbose="$2" + check_e "invalid system call '$1'" -e verbose="$2" + + check_e "invalid system call '$1'" -eraw="$2" + check_e "invalid system call '$1'" -e raw="$2" + + check_e "invalid system call '$1'" -einject="$2" + check_e "invalid system call '$1'" -e inject="$2" + check_e "invalid system call '$1'" -einject="$2:" + check_e "invalid system call '$1'" -einject="$2::" + check_e "invalid system call '$1'" -einject="$2:::" + check_e "invalid system call '$1'" -e inject="$2:" + check_e "invalid system call '$1'" -e inject="$2::" + check_e "invalid system call '$1'" -e inject="$2:::" + check_e "invalid system call '$1'" -einject="$2:when=3" + check_e "invalid system call '$1'" -e inject="$2:when=3" + + check_e "invalid system call '$1'" -efault="$2" + check_e "invalid system call '$1'" -e fault="$2" + check_e "invalid system call '$1'" -efault="$2:" + check_e "invalid system call '$1'" -efault="$2::" + check_e "invalid system call '$1'" -efault="$2:::" + check_e "invalid system call '$1'" -e fault="$2:" + check_e "invalid system call '$1'" -e fault="$2::" + check_e "invalid system call '$1'" -e fault="$2:::" + check_e "invalid system call '$1'" -efault="$2:when=4" + check_e "invalid system call '$1'" -e fault="$2:when=4" +} + +for arg in '' , ,, ,,, ; do + check_syscall "$arg" "$arg" + check_syscall "!$arg" "!$arg" +done + +for arg in -1 -2 -3 -4 -5 \ + invalid_syscall_name \ + 0x 0y \ + 32767 \ + 2147483647 \ + 2147483648 \ + 4294967295 \ + 4294967296 \ + /non_syscall \ + % %not_a_class \ + ; do + check_syscall "$arg" "$arg" + check_syscall "$arg" "!$arg" + check_syscall "$arg" "1,$arg" +done + +for arg in '!chdir' none all; do + check_syscall "$arg" "1,$arg" +done + +# invalid syscall, multiple syscalls +for arg in %desc \ + %file \ + %memory \ + %process \ + %network \ + chdir \ + 1 \ + ?32767 \ + ?invalid \ + ?%not_a_class \ + ?/non_syscall \ + ; do + check_syscall nonsense "$arg,nonsense" + check_syscall nonsense "!$arg,nonsense" + check_syscall nonsense "nonsense,$arg" + check_syscall nonsense "!nonsense,$arg" +done + +check_e_using_grep 'regcomp: \+id: [[:alpha:]].+' -e trace='/+id' +check_e_using_grep 'regcomp: \*id: [[:alpha:]].+' -e trace='/*id' +check_e_using_grep 'regcomp: \{id: [[:alpha:]].+' -e trace='/{id' +check_e_using_grep 'regcomp: \(id: [[:alpha:]].+' -e trace='/(id' +check_e_using_grep 'regcomp: \[id: [[:alpha:]].+' -e trace='/[id' diff --git a/tests-mx32/finit_module.gen.test b/tests-mx32/finit_module.gen.test index f2e56afc..5ffafd32 100755 --- a/tests-mx32/finit_module.gen.test +++ b/tests-mx32/finit_module.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (finit_module -a25); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (finit_module -a25 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a25 +run_strace_match_diff -a25 diff --git a/tests-mx32/flock.gen.test b/tests-mx32/flock.gen.test index dff2bac4..67a9d8c6 100755 --- a/tests-mx32/flock.gen.test +++ b/tests-mx32/flock.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (flock -a19); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (flock -a19 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a19 +run_strace_match_diff -a19 diff --git a/tests-mx32/fstatfs.gen.test b/tests-mx32/fstatfs.gen.test index 3dd04d8b..27deaf34 100755 --- a/tests-mx32/fstatfs.gen.test +++ b/tests-mx32/fstatfs.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fstatfs -a18); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fstatfs -a18 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a18 +run_strace_match_diff -a18 diff --git a/tests-mx32/fstatfs64.gen.test b/tests-mx32/fstatfs64.gen.test index b9527beb..d6937269 100755 --- a/tests-mx32/fstatfs64.gen.test +++ b/tests-mx32/fstatfs64.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fstatfs64 -a24); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fstatfs64 -a24 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a24 +run_strace_match_diff -a24 diff --git a/tests-mx32/fsync.gen.test b/tests-mx32/fsync.gen.test index 921e804c..5e72cc25 100755 --- a/tests-mx32/fsync.gen.test +++ b/tests-mx32/fsync.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fsync -a10); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fsync -a10 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a10 +run_strace_match_diff -a10 diff --git a/tests-mx32/ftruncate.gen.test b/tests-mx32/ftruncate.gen.test index 709a8511..6e5926b2 100755 --- a/tests-mx32/ftruncate.gen.test +++ b/tests-mx32/ftruncate.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ftruncate -a24); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ftruncate -a24 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a24 +run_strace_match_diff -a24 diff --git a/tests-mx32/ftruncate64.gen.test b/tests-mx32/ftruncate64.gen.test index 4cb1fe7a..d910f617 100755 --- a/tests-mx32/ftruncate64.gen.test +++ b/tests-mx32/ftruncate64.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ftruncate64 -a36); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ftruncate64 -a36 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a36 +run_strace_match_diff -a36 diff --git a/tests-mx32/futex.c b/tests-mx32/futex.c index e1dbcb74..0c095b8f 100644 --- a/tests-mx32/futex.c +++ b/tests-mx32/futex.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -57,10 +57,11 @@ # include "xlat/futexwakecmps.h" void futex_error(int *uaddr, int op, unsigned long val, unsigned long timeout, - int *uaddr2, unsigned long val3, int rc) + int *uaddr2, unsigned long val3, int rc, const char *func, int line) { - perror_msg_and_fail("futex(%p, %#x, %#x, %#lx, %p, %#x) = %d", - uaddr, op, (unsigned) val, timeout, uaddr, (unsigned) val3, rc); + perror_msg_and_fail("%s:%d: futex(%p, %#x, %#x, %#lx, %p, %#x) = %d", + func, line, uaddr, op, (unsigned) val, timeout, uaddr, + (unsigned) val3, rc); } # define CHECK_FUTEX_GENERIC(uaddr, op, val, timeout, uaddr2, val3, check, \ @@ -77,7 +78,7 @@ void futex_error(int *uaddr, int op, unsigned long val, unsigned long timeout, if (!(check)) \ futex_error((uaddr), (op), (val), \ (unsigned long) (timeout), (int *) (uaddr2), \ - (val3), rc); \ + (val3), rc, __func__, __LINE__); \ } while (0) # define CHECK_FUTEX_ENOSYS(uaddr, op, val, timeout, uaddr2, val3, check) \ @@ -151,14 +152,20 @@ void invalid_op(int *val, int op, uint32_t argmask, ...) } while (0) /* Value which differs from one stored in int *val */ -# define VAL ((unsigned long) 0xbadda7a0facefeedLLU) -# define VAL_PR ((unsigned) VAL) +# define VAL ((unsigned long) 0xbadda7a0facefeedLLU) +# define VAL_PR ((unsigned) VAL) -# define VAL2 ((unsigned long) 0xbadda7a0ca7b100dLLU) -# define VAL2_PR ((unsigned) VAL2) +# define VALP ((unsigned long) 0xbadda7a01acefeedLLU) +# define VALP_PR ((unsigned) VALP) -# define VAL3 ((unsigned long) 0xbadda7a09caffee1LLU) -# define VAL3_PR ((unsigned) VAL3) +# define VAL2 ((unsigned long) 0xbadda7a0ca7b100dLLU) +# define VAL2_PR ((unsigned) VAL2) + +# define VAL2P ((unsigned long) 0xbadda7a07a7b100dLLU) +# define VAL2P_PR ((unsigned) VAL2P) + +# define VAL3 ((unsigned long) 0xbadda7a09caffee1LLU) +# define VAL3_PR ((unsigned) VAL3) int main(int argc, char *argv[]) @@ -418,16 +425,26 @@ main(int argc, char *argv[]) /* Trying to re-queue some processes but there's nothing to re-queue */ CHECK_FUTEX(uaddr, FUTEX_REQUEUE, VAL, VAL2, uaddr2, VAL3, - (rc == 0)); + (rc == 0) || ((rc == -1) && (errno == EINVAL))); printf("futex(%p, FUTEX_REQUEUE, %u, %u, %p) = %s\n", uaddr, VAL_PR, VAL2_PR, uaddr2, sprintrc(rc)); + CHECK_FUTEX(uaddr, FUTEX_REQUEUE, VALP, VAL2P, uaddr2, VAL3, + (rc == 0)); + printf("futex(%p, FUTEX_REQUEUE, %u, %u, %p) = %s\n", + uaddr, VALP_PR, VAL2P_PR, uaddr2, sprintrc(rc)); + /* Trying to re-queue some processes but there's nothing to re-queue */ CHECK_FUTEX_ENOSYS(uaddr, FUTEX_PRIVATE_FLAG | FUTEX_REQUEUE, VAL, VAL2, - uaddr2, VAL3, (rc == 0)); + uaddr2, VAL3, (rc == 0) || ((rc == -1) && (errno == EINVAL))); printf("futex(%p, FUTEX_REQUEUE_PRIVATE, %u, %u, %p) = %s\n", uaddr, VAL_PR, VAL2_PR, uaddr2, sprintrc(rc)); + CHECK_FUTEX_ENOSYS(uaddr, FUTEX_PRIVATE_FLAG | FUTEX_REQUEUE, VALP, + VAL2P, uaddr2, VAL3, (rc == 0)); + printf("futex(%p, FUTEX_REQUEUE_PRIVATE, %u, %u, %p) = %s\n", + uaddr, VALP_PR, VAL2P_PR, uaddr2, sprintrc(rc)); + CHECK_INVALID_CLOCKRT(FUTEX_REQUEUE, ARG3 | ARG4 | ARG5, "%u", "%u", "%#lx"); @@ -444,22 +461,38 @@ main(int argc, char *argv[]) /* Comparison re-queue with wrong val value */ CHECK_FUTEX(uaddr, FUTEX_CMP_REQUEUE, VAL, VAL2, uaddr2, VAL3, - (rc == -1) && (errno == EAGAIN)); + (rc == -1) && (errno == EAGAIN || errno == EINVAL)); printf("futex(%p, FUTEX_CMP_REQUEUE, %u, %u, %p, %u) = %s\n", uaddr, VAL_PR, VAL2_PR, uaddr2, VAL3_PR, sprintrc(rc)); + CHECK_FUTEX(uaddr, FUTEX_CMP_REQUEUE, VALP, VAL2P, uaddr2, VAL3, + (rc == -1) && (errno == EAGAIN)); + printf("futex(%p, FUTEX_CMP_REQUEUE, %u, %u, %p, %u) = %s\n", + uaddr, VALP_PR, VAL2P_PR, uaddr2, VAL3_PR, sprintrc(rc)); + /* Successful comparison re-queue */ CHECK_FUTEX(uaddr, FUTEX_CMP_REQUEUE, VAL, VAL2, uaddr2, *uaddr, - (rc == 0)); + (rc == 0) || ((rc == -1) && (errno == EINVAL))); printf("futex(%p, FUTEX_CMP_REQUEUE, %u, %u, %p, %u) = %s\n", uaddr, VAL_PR, VAL2_PR, uaddr2, *uaddr, sprintrc(rc)); + CHECK_FUTEX(uaddr, FUTEX_CMP_REQUEUE, VALP, VAL2P, uaddr2, *uaddr, + (rc == 0)); + printf("futex(%p, FUTEX_CMP_REQUEUE, %u, %u, %p, %u) = %s\n", + uaddr, VALP_PR, VAL2P_PR, uaddr2, *uaddr, sprintrc(rc)); + /* Successful comparison re-queue */ CHECK_FUTEX_ENOSYS(uaddr, FUTEX_PRIVATE_FLAG | FUTEX_CMP_REQUEUE, VAL, - VAL2, uaddr2, *uaddr, (rc == 0)); + VAL2, uaddr2, *uaddr, + (rc == 0) || ((rc == -1) && (errno == EINVAL))); printf("futex(%p, FUTEX_CMP_REQUEUE_PRIVATE, %u, %u, %p, %u) = %s\n", uaddr, VAL_PR, VAL2_PR, uaddr2, *uaddr, sprintrc(rc)); + CHECK_FUTEX_ENOSYS(uaddr, FUTEX_PRIVATE_FLAG | FUTEX_CMP_REQUEUE, VALP, + VAL2P, uaddr2, *uaddr, (rc == 0)); + printf("futex(%p, FUTEX_CMP_REQUEUE_PRIVATE, %u, %u, %p, %u) = %s\n", + uaddr, VALP_PR, VAL2P_PR, uaddr2, *uaddr, sprintrc(rc)); + CHECK_INVALID_CLOCKRT(FUTEX_CMP_REQUEUE, ARG3 | ARG4 | ARG5 | ARG6, "%u", "%u", "%#lx", "%u"); diff --git a/tests-mx32/futimesat.gen.test b/tests-mx32/futimesat.gen.test index c3add8c3..80d7a8bc 100755 --- a/tests-mx32/futimesat.gen.test +++ b/tests-mx32/futimesat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (futimesat -a28); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (futimesat -a28 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a28 +run_strace_match_diff -a28 diff --git a/tests-mx32/gen_tests.am b/tests-mx32/gen_tests.am index 71e00135..29d8c643 100644 --- a/tests-mx32/gen_tests.am +++ b/tests-mx32/gen_tests.am @@ -1,9 +1,12 @@ # Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in; do not edit. -GEN_TESTS = _newselect.gen.test accept.gen.test accept4.gen.test access.gen.test acct.gen.test add_key.gen.test adjtimex.gen.test aio.gen.test alarm.gen.test bpf.gen.test bpf-v.gen.test btrfs.gen.test chmod.gen.test chown.gen.test chown32.gen.test chroot.gen.test clock.gen.test clock_adjtime.gen.test clock_nanosleep.gen.test clock_xettime.gen.test copy_file_range.gen.test creat.gen.test delete_module.gen.test dup.gen.test dup2.gen.test dup3.gen.test epoll_create.gen.test epoll_create1.gen.test epoll_ctl.gen.test epoll_pwait.gen.test epoll_wait.gen.test erestartsys.gen.test execveat.gen.test execveat-v.gen.test faccessat.gen.test fadvise64_64.gen.test fallocate.gen.test fanotify_init.gen.test fanotify_mark.gen.test fchdir.gen.test fchmod.gen.test fchmodat.gen.test fchown.gen.test fchown32.gen.test fchownat.gen.test fcntl.gen.test fcntl64.gen.test fdatasync.gen.test file_handle.gen.test file_ioctl.gen.test finit_module.gen.test flock.gen.test fork-f.gen.test fstat.gen.test fstat64.gen.test fstatat64.gen.test fstatfs.gen.test fstatfs64.gen.test fsync.gen.test ftruncate.gen.test ftruncate64.gen.test futimesat.gen.test get_mempolicy.gen.test getcpu.gen.test getcwd.gen.test getdents.gen.test getdents64.gen.test getegid.gen.test getegid32.gen.test geteuid.gen.test geteuid32.gen.test getgid.gen.test getgid32.gen.test getgroups.gen.test getgroups32.gen.test getpeername.gen.test getpgrp.gen.test getpid.gen.test getppid.gen.test getrandom.gen.test getresgid.gen.test getresgid32.gen.test getresuid.gen.test getresuid32.gen.test getrlimit.gen.test getrusage.gen.test getsid.gen.test getsockname.gen.test gettid.gen.test getuid32.gen.test getxxid.gen.test group_req.gen.test inet-cmsg.gen.test init_module.gen.test inotify.gen.test inotify_init1.gen.test int_0x80.gen.test ioctl_block.gen.test ioctl_evdev.gen.test ioctl_evdev-v.gen.test ioctl_loop.gen.test ioctl_loop-v.gen.test ioctl_mtd.gen.test ioctl_rtc.gen.test ioctl_rtc-v.gen.test ioctl_scsi.gen.test ioctl_sg_io_v3.gen.test ioctl_sg_io_v4.gen.test ioctl_uffdio.gen.test ioctl_v4l2.gen.test ioperm.gen.test iopl.gen.test ioprio.gen.test ip_mreq.gen.test ipc.gen.test ipc_msg.gen.test ipc_sem.gen.test ipc_shm.gen.test kcmp.gen.test kcmp-y.gen.test kexec_file_load.gen.test kexec_load.gen.test keyctl.gen.test kill.gen.test lchown.gen.test lchown32.gen.test link.gen.test linkat.gen.test lookup_dcookie.gen.test lstat.gen.test lstat64.gen.test madvise.gen.test mbind.gen.test membarrier.gen.test memfd_create.gen.test migrate_pages.gen.test mincore.gen.test mkdir.gen.test mkdirat.gen.test mknod.gen.test mknodat.gen.test mlock.gen.test mlock2.gen.test mlockall.gen.test mmap64.gen.test mmsg.gen.test mmsg-silent.gen.test mmsg_name.gen.test mmsg_name-v.gen.test mount.gen.test move_pages.gen.test mq.gen.test mq_sendrecv.gen.test mq_sendrecv-read.gen.test mq_sendrecv-write.gen.test msg_control.gen.test msg_control-v.gen.test msg_name.gen.test munlockall.gen.test nanosleep.gen.test net-icmp_filter.gen.test net-sockaddr.gen.test netlink_audit.gen.test netlink_crypto.gen.test netlink_generic.gen.test netlink_kobject_uevent.gen.test netlink_netfilter.gen.test netlink_protocol.gen.test netlink_route.gen.test netlink_selinux.gen.test netlink_xfrm.gen.test newfstatat.gen.test nlattr.gen.test nfnetlink_acct.gen.test nfnetlink_cthelper.gen.test nfnetlink_ctnetlink.gen.test nfnetlink_ctnetlink_exp.gen.test nfnetlink_cttimeout.gen.test nfnetlink_ipset.gen.test nfnetlink_nft_compat.gen.test nfnetlink_nftables.gen.test nfnetlink_osf.gen.test nfnetlink_queue.gen.test nfnetlink_ulog.gen.test nlattr_crypto_user_alg.gen.test nlattr_br_port_msg.gen.test nlattr_dcbmsg.gen.test nlattr_fib_rule_hdr.gen.test nlattr_ifaddrlblmsg.gen.test nlattr_ifaddrmsg.gen.test nlattr_ifinfomsg.gen.test nlattr_ifla_brport.gen.test nlattr_ifla_port.gen.test nlattr_ifla_xdp.gen.test nlattr_inet_diag_msg.gen.test nlattr_inet_diag_req_compat.gen.test nlattr_inet_diag_req_v2.gen.test nlattr_mdba_mdb_entry.gen.test nlattr_mdba_router_port.gen.test nlattr_ndmsg.gen.test nlattr_ndtmsg.gen.test nlattr_netconfmsg.gen.test nlattr_netlink_diag_msg.gen.test nlattr_nlmsgerr.gen.test nlattr_packet_diag_msg.gen.test nlattr_rtgenmsg.gen.test nlattr_rtmsg.gen.test nlattr_smc_diag_msg.gen.test nlattr_tc_stats.gen.test nlattr_tca_stab.gen.test nlattr_tcamsg.gen.test nlattr_tcmsg.gen.test nlattr_unix_diag_msg.gen.test old_mmap.gen.test oldfstat.gen.test oldlstat.gen.test oldstat.gen.test open.gen.test openat.gen.test osf_utimes.gen.test pause.gen.test perf_event_open.gen.test perf_event_open_nonverbose.gen.test perf_event_open_unabbrev.gen.test pipe2.gen.test pkey_alloc.gen.test pkey_free.gen.test pkey_mprotect.gen.test ppoll.gen.test ppoll-v.gen.test pread64-pwrite64.gen.test preadv.gen.test preadv-pwritev.gen.test preadv2-pwritev2.gen.test printstr.gen.test printpath-umovestr.gen.test printpath-umovestr-peekdata.gen.test printpath-umovestr-undumpable.gen.test printstrn-umoven.gen.test printstrn-umoven-peekdata.gen.test printstrn-umoven-undumpable.gen.test prlimit64.gen.test process_vm_readv.gen.test process_vm_writev.gen.test pselect6.gen.test ptrace.gen.test pwritev.gen.test quotactl.gen.test quotactl-v.gen.test quotactl-xfs.gen.test quotactl-xfs-v.gen.test read-write.gen.test readahead.gen.test readdir.gen.test readlink.gen.test readlinkat.gen.test reboot.gen.test recvfrom.gen.test recvmmsg-timeout.gen.test recvmsg.gen.test regex.gen.test remap_file_pages.gen.test rename.gen.test renameat.gen.test renameat2.gen.test request_key.gen.test rmdir.gen.test rt_sigpending.gen.test rt_sigprocmask.gen.test rt_sigqueueinfo.gen.test rt_sigreturn.gen.test rt_sigsuspend.gen.test rt_sigtimedwait.gen.test rt_tgsigqueueinfo.gen.test sched.gen.test sched_get_priority_mxx.gen.test sched_rr_get_interval.gen.test sched_xetaffinity.gen.test sched_xetattr.gen.test sched_xetparam.gen.test sched_xetscheduler.gen.test sched_yield.gen.test seccomp-filter.gen.test seccomp-filter-v.gen.test seccomp_get_action_avail.gen.test select.gen.test semop.gen.test sendfile.gen.test sendfile64.gen.test set_mempolicy.gen.test setdomainname.gen.test setfsgid.gen.test setfsgid32.gen.test setfsuid.gen.test setfsuid32.gen.test setgid.gen.test setgid32.gen.test setgroups.gen.test setgroups32.gen.test sethostname.gen.test setns.gen.test setregid.gen.test setregid32.gen.test setresgid.gen.test setresgid32.gen.test setresuid.gen.test setresuid32.gen.test setreuid.gen.test setreuid32.gen.test setrlimit.gen.test setuid.gen.test setuid32.gen.test shmxt.gen.test shutdown.gen.test sigaction.gen.test siginfo.gen.test signal.gen.test signal_receive.gen.test signalfd4.gen.test sigpending.gen.test sigprocmask.gen.test sigreturn.gen.test sigsuspend.gen.test so_linger.gen.test so_peercred.gen.test sock_filter-v.gen.test socketcall.gen.test splice.gen.test stat.gen.test stat64.gen.test statfs.gen.test statfs64.gen.test statx.gen.test swap.gen.test sxetmask.gen.test symlink.gen.test symlinkat.gen.test sync.gen.test sync_file_range.gen.test sync_file_range2.gen.test sysinfo.gen.test syslog.gen.test tee.gen.test time.gen.test timer_create.gen.test timer_xettime.gen.test timerfd_xettime.gen.test times.gen.test times-fail.gen.test trace_fstat.gen.test trace_fstatfs.gen.test trace_lstat.gen.test trace_question.gen.test trace_stat.gen.test trace_stat_like.gen.test trace_statfs.gen.test trace_statfs_like.gen.test truncate.gen.test truncate64.gen.test ugetrlimit.gen.test umask.gen.test umoven-illptr.gen.test umovestr-illptr.gen.test umovestr3.gen.test unlink.gen.test unlinkat.gen.test unshare.gen.test userfaultfd.gen.test ustat.gen.test utime.gen.test utimensat.gen.test utimes.gen.test vfork-f.gen.test vhangup.gen.test vmsplice.gen.test wait4.gen.test wait4-v.gen.test waitid.gen.test waitid-v.gen.test waitpid.gen.test xattr.gen.test xattr-strings.gen.test xet_robust_list.gen.test xetitimer.gen.test xetpgid.gen.test xetpriority.gen.test xettimeofday.gen.test +GEN_TESTS = _newselect.gen.test _newselect-P.gen.test accept.gen.test accept4.gen.test access.gen.test acct.gen.test add_key.gen.test adjtimex.gen.test aio.gen.test alarm.gen.test bpf.gen.test bpf-v.gen.test btrfs.gen.test chmod.gen.test chown.gen.test chown32.gen.test chroot.gen.test clock.gen.test clock_adjtime.gen.test clock_nanosleep.gen.test clock_xettime.gen.test copy_file_range.gen.test creat.gen.test delete_module.gen.test dup.gen.test dup2.gen.test dup3.gen.test epoll_create.gen.test epoll_create1.gen.test epoll_ctl.gen.test epoll_pwait.gen.test epoll_wait.gen.test erestartsys.gen.test execveat.gen.test execveat-v.gen.test faccessat.gen.test fadvise64_64.gen.test fallocate.gen.test fanotify_init.gen.test fanotify_mark.gen.test fchdir.gen.test fchmod.gen.test fchmodat.gen.test fchown.gen.test fchown32.gen.test fchownat.gen.test fcntl.gen.test fcntl64.gen.test fdatasync.gen.test file_handle.gen.test file_ioctl.gen.test finit_module.gen.test flock.gen.test fork-f.gen.test fstat.gen.test fstat64.gen.test fstatat64.gen.test fstatfs.gen.test fstatfs64.gen.test fsync.gen.test ftruncate.gen.test ftruncate64.gen.test futimesat.gen.test get_mempolicy.gen.test getcpu.gen.test getcwd.gen.test getdents.gen.test getdents64.gen.test getegid.gen.test getegid32.gen.test geteuid.gen.test geteuid32.gen.test getgid.gen.test getgid32.gen.test getgroups.gen.test getgroups32.gen.test getpeername.gen.test getpgrp.gen.test getpid.gen.test getppid.gen.test getrandom.gen.test getresgid.gen.test getresgid32.gen.test getresuid.gen.test getresuid32.gen.test getrlimit.gen.test getrusage.gen.test getsid.gen.test getsockname.gen.test gettid.gen.test getuid32.gen.test getxxid.gen.test group_req.gen.test inet-cmsg.gen.test init_module.gen.test inotify.gen.test inotify_init1.gen.test int_0x80.gen.test ioctl_block.gen.test ioctl_dm.gen.test ioctl_dm-v.gen.test ioctl_evdev.gen.test ioctl_evdev-v.gen.test ioctl_kvm_run.gen.test ioctl_loop.gen.test ioctl_loop-nv.gen.test ioctl_loop-v.gen.test ioctl_mtd.gen.test ioctl_nsfs.gen.test ioctl_rtc.gen.test ioctl_rtc-v.gen.test ioctl_scsi.gen.test ioctl_sg_io_v3.gen.test ioctl_sg_io_v4.gen.test ioctl_sock_gifconf.gen.test ioctl_uffdio.gen.test ioctl_v4l2.gen.test ioperm.gen.test iopl.gen.test ioprio.gen.test ip_mreq.gen.test ipc.gen.test ipc_msg.gen.test ipc_sem.gen.test ipc_shm.gen.test kcmp.gen.test kcmp-y.gen.test kexec_file_load.gen.test kexec_load.gen.test keyctl.gen.test kill.gen.test lchown.gen.test lchown32.gen.test link.gen.test linkat.gen.test lookup_dcookie.gen.test lstat.gen.test lstat64.gen.test madvise.gen.test mbind.gen.test membarrier.gen.test memfd_create.gen.test migrate_pages.gen.test mincore.gen.test mkdir.gen.test mkdirat.gen.test mknod.gen.test mknodat.gen.test mlock.gen.test mlock2.gen.test mlockall.gen.test mmap64.gen.test mmsg.gen.test mmsg-silent.gen.test mmsg_name.gen.test mmsg_name-v.gen.test modify_ldt.gen.test mount.gen.test move_pages.gen.test mq.gen.test mq_sendrecv.gen.test mq_sendrecv-read.gen.test mq_sendrecv-write.gen.test msg_control.gen.test msg_control-v.gen.test msg_name.gen.test munlockall.gen.test nanosleep.gen.test net-icmp_filter.gen.test net-sockaddr.gen.test netlink_audit.gen.test netlink_crypto.gen.test netlink_generic.gen.test netlink_kobject_uevent.gen.test netlink_netfilter.gen.test netlink_protocol.gen.test netlink_route.gen.test netlink_selinux.gen.test netlink_xfrm.gen.test newfstatat.gen.test nlattr.gen.test nfnetlink_acct.gen.test nfnetlink_cthelper.gen.test nfnetlink_ctnetlink.gen.test nfnetlink_ctnetlink_exp.gen.test nfnetlink_cttimeout.gen.test nfnetlink_ipset.gen.test nfnetlink_nft_compat.gen.test nfnetlink_nftables.gen.test nfnetlink_osf.gen.test nfnetlink_queue.gen.test nfnetlink_ulog.gen.test nlattr_crypto_user_alg.gen.test nlattr_br_port_msg.gen.test nlattr_dcbmsg.gen.test nlattr_fib_rule_hdr.gen.test nlattr_ifaddrlblmsg.gen.test nlattr_ifaddrmsg.gen.test nlattr_ifinfomsg.gen.test nlattr_ifla_brport.gen.test nlattr_ifla_port.gen.test nlattr_ifla_xdp.gen.test nlattr_inet_diag_msg.gen.test nlattr_inet_diag_req_compat.gen.test nlattr_inet_diag_req_v2.gen.test nlattr_mdba_mdb_entry.gen.test nlattr_mdba_router_port.gen.test nlattr_ndmsg.gen.test nlattr_ndtmsg.gen.test nlattr_netconfmsg.gen.test nlattr_netlink_diag_msg.gen.test nlattr_nlmsgerr.gen.test nlattr_packet_diag_msg.gen.test nlattr_rtgenmsg.gen.test nlattr_rtmsg.gen.test nlattr_smc_diag_msg.gen.test nlattr_tc_stats.gen.test nlattr_tca_stab.gen.test nlattr_tcamsg.gen.test nlattr_tcmsg.gen.test nlattr_unix_diag_msg.gen.test old_mmap.gen.test old_mmap-P.gen.test old_mmap-v-none.gen.test oldfstat.gen.test oldlstat.gen.test oldselect.gen.test oldselect-P.gen.test oldselect-efault.gen.test oldselect-efault-P.gen.test oldstat.gen.test open.gen.test openat.gen.test osf_utimes.gen.test pause.gen.test perf_event_open.gen.test perf_event_open_nonverbose.gen.test perf_event_open_unabbrev.gen.test pipe2.gen.test pkey_alloc.gen.test pkey_free.gen.test pkey_mprotect.gen.test ppoll.gen.test ppoll-P.gen.test ppoll-v.gen.test pread64-pwrite64.gen.test preadv.gen.test preadv-pwritev.gen.test preadv2-pwritev2.gen.test printstr.gen.test printpath-umovestr.gen.test printpath-umovestr-peekdata.gen.test printpath-umovestr-undumpable.gen.test printstrn-umoven.gen.test printstrn-umoven-peekdata.gen.test printstrn-umoven-undumpable.gen.test prlimit64.gen.test process_vm_readv.gen.test process_vm_writev.gen.test pselect6.gen.test ptrace.gen.test pwritev.gen.test quotactl.gen.test quotactl-v.gen.test quotactl-xfs.gen.test quotactl-xfs-v.gen.test read-write.gen.test readahead.gen.test readdir.gen.test readlink.gen.test readlinkat.gen.test reboot.gen.test recvfrom.gen.test recvmmsg-timeout.gen.test recvmsg.gen.test regex.gen.test remap_file_pages.gen.test rename.gen.test renameat.gen.test renameat2.gen.test request_key.gen.test riscv_flush_icache.gen.test rmdir.gen.test rt_sigpending.gen.test rt_sigprocmask.gen.test rt_sigqueueinfo.gen.test rt_sigreturn.gen.test rt_sigsuspend.gen.test rt_sigtimedwait.gen.test rt_tgsigqueueinfo.gen.test s390_guarded_storage.gen.test s390_guarded_storage-v.gen.test s390_pci_mmio_read_write.gen.test s390_runtime_instr.gen.test s390_sthyi.gen.test s390_sthyi-v.gen.test sched.gen.test sched_get_priority_mxx.gen.test sched_rr_get_interval.gen.test sched_xetaffinity.gen.test sched_xetattr.gen.test sched_xetparam.gen.test sched_xetscheduler.gen.test sched_yield.gen.test seccomp-filter.gen.test seccomp-filter-v.gen.test seccomp_get_action_avail.gen.test select.gen.test select-P.gen.test semop.gen.test sendfile.gen.test sendfile64.gen.test set_mempolicy.gen.test setdomainname.gen.test setfsgid.gen.test setfsgid32.gen.test setfsuid.gen.test setfsuid32.gen.test setgid.gen.test setgid32.gen.test setgroups.gen.test setgroups32.gen.test sethostname.gen.test setns.gen.test setregid.gen.test setregid32.gen.test setresgid.gen.test setresgid32.gen.test setresuid.gen.test setresuid32.gen.test setreuid.gen.test setreuid32.gen.test setrlimit.gen.test setuid.gen.test setuid32.gen.test shmxt.gen.test shutdown.gen.test sigaction.gen.test siginfo.gen.test signal.gen.test signal_receive.gen.test signalfd4.gen.test sigpending.gen.test sigprocmask.gen.test sigreturn.gen.test sigsuspend.gen.test so_linger.gen.test so_peercred.gen.test sock_filter-v.gen.test socketcall.gen.test sockopt-sol_netlink.gen.test splice.gen.test stat.gen.test stat64.gen.test statfs.gen.test statfs64.gen.test statx.gen.test swap.gen.test sxetmask.gen.test symlink.gen.test symlinkat.gen.test sync.gen.test sync_file_range.gen.test sync_file_range2.gen.test sysinfo.gen.test syslog.gen.test tee.gen.test time.gen.test timer_create.gen.test timer_xettime.gen.test timerfd_xettime.gen.test times.gen.test times-fail.gen.test trace_fstat.gen.test trace_fstatfs.gen.test trace_lstat.gen.test trace_question.gen.test trace_stat.gen.test trace_stat_like.gen.test trace_statfs.gen.test trace_statfs_like.gen.test truncate.gen.test truncate64.gen.test ugetrlimit.gen.test umask.gen.test umoven-illptr.gen.test umovestr-illptr.gen.test umovestr3.gen.test unlink.gen.test unlinkat.gen.test unshare.gen.test userfaultfd.gen.test ustat.gen.test utime.gen.test utimensat.gen.test utimes.gen.test vfork-f.gen.test vhangup.gen.test vmsplice.gen.test wait4.gen.test wait4-v.gen.test waitid.gen.test waitid-v.gen.test waitpid.gen.test xattr.gen.test xattr-strings.gen.test xet_robust_list.gen.test xetitimer.gen.test xetpgid.gen.test xetpriority.gen.test xettimeofday.gen.test $(srcdir)/_newselect.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/_newselect-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/accept.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -295,21 +298,36 @@ $(srcdir)/int_0x80.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(srcdir)/ioctl_block.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_dm.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/ioctl_dm-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_evdev.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ $(srcdir)/ioctl_evdev-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_kvm_run.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_loop.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_loop-nv.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_loop-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ $(srcdir)/ioctl_mtd.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_nsfs.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_rtc.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -325,6 +343,9 @@ $(srcdir)/ioctl_sg_io_v3.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_test $(srcdir)/ioctl_sg_io_v4.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_sock_gifconf.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_uffdio.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -448,6 +469,9 @@ $(srcdir)/mmsg_name.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(srcdir)/mmsg_name-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/modify_ldt.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/mount.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -643,12 +667,30 @@ $(srcdir)/nlattr_unix_diag_msg.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/ge $(srcdir)/old_mmap.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/old_mmap-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/old_mmap-v-none.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/oldfstat.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ $(srcdir)/oldlstat.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/oldselect.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/oldselect-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/oldselect-efault.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/oldselect-efault-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/oldstat.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -688,6 +730,9 @@ $(srcdir)/pkey_mprotect.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests $(srcdir)/ppoll.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ppoll-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ppoll-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -799,6 +844,9 @@ $(srcdir)/renameat2.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(srcdir)/request_key.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/riscv_flush_icache.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/rmdir.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -823,6 +871,24 @@ $(srcdir)/rt_sigtimedwait.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tes $(srcdir)/rt_tgsigqueueinfo.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/s390_guarded_storage.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_guarded_storage-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_pci_mmio_read_write.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_runtime_instr.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_sthyi.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_sthyi-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/sched.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -859,6 +925,9 @@ $(srcdir)/seccomp_get_action_avail.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir $(srcdir)/select.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/select-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/semop.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -982,6 +1051,9 @@ $(srcdir)/sock_filter-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests $(srcdir)/socketcall.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/sockopt-sol_netlink.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/splice.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ diff --git a/tests-mx32/gen_tests.in b/tests-mx32/gen_tests.in index 091bbe59..ea33892f 100644 --- a/tests-mx32/gen_tests.in +++ b/tests-mx32/gen_tests.in @@ -1,6 +1,6 @@ # Input for gen_tests.sh # -# Copyright (c) 2017 The strace developers. +# Copyright (c) 2017-2018 The strace developers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -26,6 +26,7 @@ # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. _newselect +_newselect-P -e trace=_newselect -P /dev/full 9>>/dev/full accept -a22 accept4 -a37 access -a30 -P access_sample @@ -123,16 +124,22 @@ inotify -a23 -e trace=inotify_add_watch,inotify_rm_watch inotify_init1 -a27 int_0x80 -a11 -e trace=getgid32 ioctl_block +ioctl.test +ioctl_dm +ioctl.test -s9 +ioctl_dm-v +ioctl.test -v -s9 ioctl_evdev +ioctl.test -ioctl_evdev-v +ioctl-v.sh +ioctl_evdev-v +ioctl.test -v +ioctl_kvm_run +ioctl.test -a36 -y ioctl_loop +ioctl.test -ioctl_loop-v +ioctl-v.sh +ioctl_loop-nv +ioctl.test -a22 -e verbose=none +ioctl_loop-v +ioctl.test -v ioctl_mtd +ioctl.test +ioctl_nsfs +ioctl.test -esignal=none ioctl_rtc +ioctl.test -ioctl_rtc-v +ioctl-v.sh +ioctl_rtc-v +ioctl.test -v ioctl_scsi +ioctl.test ioctl_sg_io_v3 +ioctl.test ioctl_sg_io_v4 +ioctl.test +ioctl_sock_gifconf +ioctl.test -a28 -s1 ioctl_uffdio +ioctl.test ioctl_v4l2 +ioctl.test ioperm -a27 @@ -174,6 +181,7 @@ mmsg -e read=0 -e write=1 -e trace=recvmmsg,sendmmsg mmsg-silent -a25 -e verbose=none -e trace=sendmmsg,recvmmsg mmsg_name -a25 -e trace=sendmmsg,recvmmsg mmsg_name-v -v -a25 -e trace=sendmmsg,recvmmsg +modify_ldt -a23 mount move_pages -s3 mq -a32 -e trace=mq_getsetattr,mq_open,mq_unlink @@ -239,11 +247,17 @@ nlattr_tcamsg +netlink_sock_diag.test nlattr_tcmsg +netlink_sock_diag.test nlattr_unix_diag_msg +netlink_sock_diag.test old_mmap -a11 -e trace=mmap +old_mmap-P -e trace=mmap -P "/dev/full" 9>>/dev/full +old_mmap-v-none -a11 -e trace=mmap -e verbose=none oldfstat -a18 -v -P stat.sample oldlstat -a32 -v -P stat.sample -P /dev/full +oldselect -a13 -e trace=select +oldselect-P -a13 -e trace=select -P /dev/full 9>>/dev/full +oldselect-efault -a13 -e trace=select +oldselect-efault-P -a13 -e trace=select -P /dev/full 9>>/dev/full oldstat -a32 -v -P stat.sample -P /dev/full open -a30 -P $NAME.sample -openat -P $NAME.sample +openat -a36 -P $NAME.sample osf_utimes -a21 pause -a8 -esignal=none perf_event_open -a1 @@ -254,6 +268,7 @@ pkey_alloc -a17 pkey_free -a13 pkey_mprotect -a37 ppoll -s2 +ppoll-P -s2 -e trace=ppoll -P /dev/full 9>>/dev/full ppoll-v -v -s2 -e trace=ppoll pread64-pwrite64 -a21 -eread=0 -ewrite=1 -e trace=pread64,pwrite64 -P pread64-pwrite64-tmpfile -P /dev/zero -P /dev/null preadv -a21 @@ -281,7 +296,7 @@ readahead -a1 readdir -a16 readlink -xx readlinkat -xx -reboot +reboot -s 256 recvfrom -a35 recvmmsg-timeout -a25 -e trace=recvmmsg recvmsg -eread=0 -ewrite=1 -e trace=recvmsg,sendmsg @@ -291,6 +306,7 @@ rename -a35 renameat renameat2 request_key -a33 -s12 +riscv_flush_icache -a34 rmdir -a22 rt_sigpending -a20 rt_sigprocmask @@ -299,6 +315,12 @@ rt_sigreturn -esignal='!USR1' rt_sigsuspend -a20 -esignal=none rt_sigtimedwait -a38 rt_tgsigqueueinfo -esignal=none +s390_guarded_storage -a32 +s390_guarded_storage-v -e trace=s390_guarded_storage -a32 -v +s390_pci_mmio_read_write -e trace=s390_pci_mmio_read,s390_pci_mmio_write -a30 +s390_runtime_instr -a50 +s390_sthyi -a47 +s390_sthyi-v -e trace=s390_sthyi -a47 -v sched test_trace_expr times -e/sched sched_get_priority_mxx -a33 -e trace=sched_get_priority_min,sched_get_priority_max sched_rr_get_interval -a31 @@ -311,6 +333,7 @@ seccomp-filter -e trace=seccomp seccomp-filter-v -v -e trace=seccomp seccomp_get_action_avail -e trace=seccomp select -a36 +select-P -a36 -e trace=select -P /dev/full 9>>/dev/full semop -a32 -e trace=semop,semtimedop sendfile -a27 sendfile64 -a29 @@ -352,6 +375,7 @@ so_linger -e trace=getsockopt,setsockopt so_peercred -e trace=getsockopt sock_filter-v -v -e trace=getsockopt,setsockopt socketcall -a20 +sockopt-sol_netlink -e trace=getsockopt,setsockopt splice stat -a32 -v -P stat.sample -P /dev/full stat64 -a32 -v -P stat.sample -P /dev/full diff --git a/tests-mx32/gen_tests.sh b/tests-mx32/gen_tests.sh index b0624365..b41983ee 100755 --- a/tests-mx32/gen_tests.sh +++ b/tests-mx32/gen_tests.sh @@ -1,6 +1,7 @@ #!/bin/sh -efu # # Copyright (c) 2017 Dmitry V. Levin <ldv@altlinux.org> +# Copyright (c) 2017-2018 The strace developers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -54,7 +55,7 @@ fi names= -while read -r name args; do { +while read -r name arg0 args; do { [ -n "${name###*}" ] || continue if [ -z "$match" ]; then names="$names $name" @@ -65,13 +66,14 @@ while read -r name args; do { hdr="\ #!/bin/sh -efu -# Generated by $0 from $input ($name $args); do not edit." +# Generated by $0 from $input ($name $arg0 $args); do not edit." - case "$args" in + case "$arg0" in +*) cat <<-EOF $hdr - . "\${srcdir=.}/${args#+}" + set -- $args + . "\${srcdir=.}/${arg0#+}" EOF ;; @@ -79,7 +81,7 @@ while read -r name args; do { cat <<-EOF $hdr . "\${srcdir=.}/init.sh" - run_strace_match_diff $args + run_strace_match_diff $arg0 $args EOF ;; @@ -87,7 +89,7 @@ while read -r name args; do { cat <<-EOF $hdr . "\${srcdir=.}/init.sh" - $args + $arg0 $args EOF ;; esac > "$output" diff --git a/tests-mx32/get_regs.test b/tests-mx32/get_regs.test index c673fe95..eb69137b 100755 --- a/tests-mx32/get_regs.test +++ b/tests-mx32/get_regs.test @@ -36,7 +36,7 @@ run_prog ../gettid > /dev/null run_strace -qq -esignal=none -eraw=all -etrace=none ../gettid > /dev/null run_strace -qq -esignal=none -eraw=all -eptrace -o '|grep -c ^ptrace > less' \ - -- ${STRACE##* } -o "$LOG" $args > /dev/null + -- "$STRACE_EXE" -o "$LOG" $args > /dev/null [ "$(cat less)" -gt 0 ] || fail_ "$STRACE $args failed to catch any ptrace syscalls" @@ -44,7 +44,7 @@ run_strace -qq -esignal=none -eraw=all -eptrace -o '|grep -c ^ptrace > less' \ run_strace -qq -esignal=none -eraw=all -etrace=all ../gettid > /dev/null run_strace -qq -esignal=none -eraw=all -eptrace -o '|grep -c ^ptrace > more' \ - -- ${STRACE##* } -o "$LOG" $args > /dev/null + -- "$STRACE_EXE" -o "$LOG" $args > /dev/null [ "$(cat more)" -gt 0 ] || fail_ "$STRACE $args failed to catch any ptrace syscalls" diff --git a/tests-mx32/getcpu.gen.test b/tests-mx32/getcpu.gen.test index 44d9a4b8..ae38aaa0 100755 --- a/tests-mx32/getcpu.gen.test +++ b/tests-mx32/getcpu.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getcpu -a25); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getcpu -a25 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a25 +run_strace_match_diff -a25 diff --git a/tests-mx32/getcwd.c b/tests-mx32/getcwd.c index 0c32f8dd..2020df40 100644 --- a/tests-mx32/getcwd.c +++ b/tests-mx32/getcwd.c @@ -4,9 +4,9 @@ #ifdef __NR_getcwd +# include <limits.h> # include <stdio.h> # include <unistd.h> -# include <sys/param.h> int main(void) diff --git a/tests-mx32/getcwd.gen.test b/tests-mx32/getcwd.gen.test index af2ff083..f783a5b1 100755 --- a/tests-mx32/getcwd.gen.test +++ b/tests-mx32/getcwd.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getcwd -a18); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getcwd -a18 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a18 +run_strace_match_diff -a18 diff --git a/tests-mx32/getegid.gen.test b/tests-mx32/getegid.gen.test index d6fecc23..ddf8fa9a 100755 --- a/tests-mx32/getegid.gen.test +++ b/tests-mx32/getegid.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getegid +getuid.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getegid +getuid.test ); do not edit. +set -- . "${srcdir=.}/getuid.test" diff --git a/tests-mx32/getegid32.gen.test b/tests-mx32/getegid32.gen.test index 38c4a4b2..a773f56a 100755 --- a/tests-mx32/getegid32.gen.test +++ b/tests-mx32/getegid32.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getegid32 +getuid.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getegid32 +getuid.test ); do not edit. +set -- . "${srcdir=.}/getuid.test" diff --git a/tests-mx32/geteuid.gen.test b/tests-mx32/geteuid.gen.test index 9e8c12f8..c7da2aa9 100755 --- a/tests-mx32/geteuid.gen.test +++ b/tests-mx32/geteuid.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (geteuid +getuid.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (geteuid +getuid.test ); do not edit. +set -- . "${srcdir=.}/getuid.test" diff --git a/tests-mx32/geteuid32.gen.test b/tests-mx32/geteuid32.gen.test index 5b783311..75c3f12e 100755 --- a/tests-mx32/geteuid32.gen.test +++ b/tests-mx32/geteuid32.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (geteuid32 +getuid.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (geteuid32 +getuid.test ); do not edit. +set -- . "${srcdir=.}/getuid.test" diff --git a/tests-mx32/getgid.gen.test b/tests-mx32/getgid.gen.test index 5a87aeeb..fc6ac3bc 100755 --- a/tests-mx32/getgid.gen.test +++ b/tests-mx32/getgid.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getgid +getuid.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getgid +getuid.test ); do not edit. +set -- . "${srcdir=.}/getuid.test" diff --git a/tests-mx32/getgid32.gen.test b/tests-mx32/getgid32.gen.test index 05e2d70c..b3a87561 100755 --- a/tests-mx32/getgid32.gen.test +++ b/tests-mx32/getgid32.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getgid32 +getuid.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getgid32 +getuid.test ); do not edit. +set -- . "${srcdir=.}/getuid.test" diff --git a/tests-mx32/getgroups.gen.test b/tests-mx32/getgroups.gen.test index 48b09be9..ae196d05 100755 --- a/tests-mx32/getgroups.gen.test +++ b/tests-mx32/getgroups.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getgroups -a17); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getgroups -a17 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a17 +run_strace_match_diff -a17 diff --git a/tests-mx32/getgroups32.gen.test b/tests-mx32/getgroups32.gen.test index 74637d0e..54b71d5f 100755 --- a/tests-mx32/getgroups32.gen.test +++ b/tests-mx32/getgroups32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getgroups32 -a19); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getgroups32 -a19 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a19 +run_strace_match_diff -a19 diff --git a/tests-mx32/getpeername.gen.test b/tests-mx32/getpeername.gen.test index 66fb0a92..020583ab 100755 --- a/tests-mx32/getpeername.gen.test +++ b/tests-mx32/getpeername.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getpeername -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getpeername -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests-mx32/getpgrp.gen.test b/tests-mx32/getpgrp.gen.test index 1ec48e9c..26989cdb 100755 --- a/tests-mx32/getpgrp.gen.test +++ b/tests-mx32/getpgrp.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getpgrp -a10); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getpgrp -a10 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a10 +run_strace_match_diff -a10 diff --git a/tests-mx32/getpid.gen.test b/tests-mx32/getpid.gen.test index 46917749..2a3eb1cf 100755 --- a/tests-mx32/getpid.gen.test +++ b/tests-mx32/getpid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getpid -a9); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getpid -a9 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a9 +run_strace_match_diff -a9 diff --git a/tests-mx32/getppid.gen.test b/tests-mx32/getppid.gen.test index 52116a0a..655b0b7d 100755 --- a/tests-mx32/getppid.gen.test +++ b/tests-mx32/getppid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getppid -a10); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getppid -a10 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a10 +run_strace_match_diff -a10 diff --git a/tests-mx32/getresgid.gen.test b/tests-mx32/getresgid.gen.test index f53bccce..dc32c62c 100755 --- a/tests-mx32/getresgid.gen.test +++ b/tests-mx32/getresgid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getresgid -a25); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getresgid -a25 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a25 +run_strace_match_diff -a25 diff --git a/tests-mx32/getresgid32.gen.test b/tests-mx32/getresgid32.gen.test index 5f00506f..0ee28299 100755 --- a/tests-mx32/getresgid32.gen.test +++ b/tests-mx32/getresgid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getresgid32 -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getresgid32 -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests-mx32/getresuid.gen.test b/tests-mx32/getresuid.gen.test index e947a94e..b0f478ce 100755 --- a/tests-mx32/getresuid.gen.test +++ b/tests-mx32/getresuid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getresuid -a25); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getresuid -a25 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a25 +run_strace_match_diff -a25 diff --git a/tests-mx32/getresuid32.gen.test b/tests-mx32/getresuid32.gen.test index b088a220..1b2f232c 100755 --- a/tests-mx32/getresuid32.gen.test +++ b/tests-mx32/getresuid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getresuid32 -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getresuid32 -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests-mx32/getrlimit.gen.test b/tests-mx32/getrlimit.gen.test index b97c176b..08daf2d0 100755 --- a/tests-mx32/getrlimit.gen.test +++ b/tests-mx32/getrlimit.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getrlimit -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getrlimit -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests-mx32/getrusage.gen.test b/tests-mx32/getrusage.gen.test index c4fb182b..161818aa 100755 --- a/tests-mx32/getrusage.gen.test +++ b/tests-mx32/getrusage.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getrusage -v); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getrusage -v ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -v +run_strace_match_diff -v diff --git a/tests-mx32/getsid.gen.test b/tests-mx32/getsid.gen.test index 123f1775..2b9084a4 100755 --- a/tests-mx32/getsid.gen.test +++ b/tests-mx32/getsid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getsid -a10); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getsid -a10 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a10 +run_strace_match_diff -a10 diff --git a/tests-mx32/getsockname.gen.test b/tests-mx32/getsockname.gen.test index cd40d3ef..64cdeea8 100755 --- a/tests-mx32/getsockname.gen.test +++ b/tests-mx32/getsockname.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getsockname -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getsockname -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests-mx32/gettid.gen.test b/tests-mx32/gettid.gen.test index 1ceaa53d..f5ad317e 100755 --- a/tests-mx32/gettid.gen.test +++ b/tests-mx32/gettid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (gettid -a9); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (gettid -a9 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a9 +run_strace_match_diff -a9 diff --git a/tests-mx32/getuid32.gen.test b/tests-mx32/getuid32.gen.test index ac0d0ad6..e81eb064 100755 --- a/tests-mx32/getuid32.gen.test +++ b/tests-mx32/getuid32.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getuid32 +getuid.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getuid32 +getuid.test ); do not edit. +set -- . "${srcdir=.}/getuid.test" diff --git a/tests-mx32/group_req.c b/tests-mx32/group_req.c index 946fe5c0..eb56cb7e 100644 --- a/tests-mx32/group_req.c +++ b/tests-mx32/group_req.c @@ -2,6 +2,7 @@ * Check decoding of MCAST_JOIN_GROUP/MCAST_LEAVE_GROUP. * * Copyright (c) 2015-2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2017-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,9 +34,9 @@ #if defined MCAST_JOIN_GROUP && defined MCAST_LEAVE_GROUP +# include <limits.h> # include <stdio.h> # include <unistd.h> -# include <sys/param.h> # include <sys/socket.h> # include <arpa/inet.h> diff --git a/tests-mx32/init_module.gen.test b/tests-mx32/init_module.gen.test index 8948e2ec..b6961be6 100755 --- a/tests-mx32/init_module.gen.test +++ b/tests-mx32/init_module.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (init_module -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (init_module -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests-mx32/inode_of_sockfd.c b/tests-mx32/inode_of_sockfd.c index b227f306..6a523c79 100644 --- a/tests-mx32/inode_of_sockfd.c +++ b/tests-mx32/inode_of_sockfd.c @@ -2,6 +2,7 @@ * This file is part of strace test suite. * * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,11 +30,11 @@ #include "tests.h" #include <assert.h> +#include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <sys/param.h> unsigned long inode_of_sockfd(const int fd) diff --git a/tests-mx32/inotify_init1.gen.test b/tests-mx32/inotify_init1.gen.test index d847b500..a1060c5d 100755 --- a/tests-mx32/inotify_init1.gen.test +++ b/tests-mx32/inotify_init1.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (inotify_init1 -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (inotify_init1 -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests-mx32/ioctl-v.sh b/tests-mx32/ioctl-v.sh deleted file mode 100755 index be896712..00000000 --- a/tests-mx32/ioctl-v.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# Check non-abbreviated decoding of ioctls. - -. "${srcdir=.}/init.sh" - -check_prog grep -run_prog > /dev/null -run_strace -a16 -v -eioctl $args > "$EXP" -grep -v '^ioctl([012],' < "$LOG" > "$OUT" -match_diff "$OUT" "$EXP" diff --git a/tests-mx32/ioctl.c b/tests-mx32/ioctl.c index 3c666b0d..af5f9ba2 100644 --- a/tests-mx32/ioctl.c +++ b/tests-mx32/ioctl.c @@ -86,8 +86,13 @@ main(void) " = -1 EBADF (%m)\n", &data); (void) ioctl(-1, _IOR('M', 13, int), &data); +# ifdef HAVE_STRUCT_MTD_WRITE_REQ printf("ioctl(-1, MIXER_READ(13) or OTPSELECT, [MTD_OTP_OFF])" " = -1 EBADF (%m)\n"); +# else + printf("ioctl(-1, MIXER_READ(13) or OTPSELECT, %p)" + " = -1 EBADF (%m)\n", &data); +# endif (void) ioctl(-1, _IOC(_IOC_WRITE, 0xde, 0, 0), (kernel_ulong_t) -1ULL); printf("ioctl(-1, _IOC(_IOC_WRITE, 0xde, 0, 0), %#lx)" diff --git a/tests-mx32/ioctl.test b/tests-mx32/ioctl.test index 1eb469ee..cbbadc83 100755 --- a/tests-mx32/ioctl.test +++ b/tests-mx32/ioctl.test @@ -6,6 +6,6 @@ check_prog grep run_prog > /dev/null -run_strace -a16 -eioctl $args > "$EXP" +run_strace -a16 -eioctl "$@" $args > "$EXP" grep -v '^ioctl([012],' < "$LOG" > "$OUT" match_diff "$OUT" "$EXP" diff --git a/tests-mx32/ioctl_block.gen.test b/tests-mx32/ioctl_block.gen.test index 0ffec6f6..8b2c3df6 100755 --- a/tests-mx32/ioctl_block.gen.test +++ b/tests-mx32/ioctl_block.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_block +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_block +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests-mx32/ioctl_dm-v.gen.test b/tests-mx32/ioctl_dm-v.gen.test new file mode 100755 index 00000000..66fa5856 --- /dev/null +++ b/tests-mx32/ioctl_dm-v.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_dm-v +ioctl.test -v -s9); do not edit. +set -- -v -s9 +. "${srcdir=.}/ioctl.test" diff --git a/tests-mx32/ioctl_dm-v.test b/tests-mx32/ioctl_dm-v.test deleted file mode 100755 index eed37c27..00000000 --- a/tests-mx32/ioctl_dm-v.test +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# Check unabbreviated decoding of DM* ioctls. - -. "${srcdir=.}/init.sh" - -check_prog grep -run_prog > /dev/null -run_strace -a16 -s9 -veioctl $args > "$EXP" -grep -v '^ioctl([012],' < "$LOG" > "$OUT" -match_diff "$OUT" "$EXP" diff --git a/tests-mx32/ioctl_dm.c b/tests-mx32/ioctl_dm.c index 1e831dfe..bbdc00c6 100644 --- a/tests-mx32/ioctl_dm.c +++ b/tests-mx32/ioctl_dm.c @@ -3,7 +3,7 @@ * * Copyright (c) 2016 Mikulas Patocka <mpatocka@redhat.com> * Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -143,7 +143,7 @@ init_dm_target_spec(struct dm_target_spec *ptr, uint32_t id) ptr->length = dts_length_base + dts_length_step * id; ptr->status = dts_status_base + dts_status_step * id; - strncpy(ptr->target_type, str129 + + memcpy(ptr->target_type, str129 + id % (sizeof(str129) - sizeof(ptr->target_type)), id % (sizeof(ptr->target_type) + 1)); if (id % (sizeof(ptr->target_type) + 1) < sizeof(ptr->target_type)) @@ -252,8 +252,8 @@ main(void) /* Unterminated name/uuid */ init_s(dm_arg, min_sizeof_dm_ioctl, 0); - strncpy(dm_arg->name, str129, sizeof(dm_arg->name)); - strncpy(dm_arg->uuid, str129, sizeof(dm_arg->uuid)); + memcpy(dm_arg->name, str129, sizeof(dm_arg->name)); + memcpy(dm_arg->uuid, str129, sizeof(dm_arg->uuid)); ioctl(-1, DM_VERSION, dm_arg); printf("ioctl(-1, DM_VERSION, {version=4.1.2, data_size=%zu, " "dev=makedev(18, 52), name=\"%.127s\"..., uuid=\"%.128s\"..., " @@ -511,7 +511,7 @@ main(void) target##id_next) - \ offsetof(struct dm_table_open_test, \ target##id); \ - strncpy(dm_arg_open3->param##id, str129 + id * 2, id); \ + memcpy(dm_arg_open3->param##id, str129 + id * 2, id); \ dm_arg_open3->param##id[id] = '\0'; \ } while (0) #define PRINT_DM_TARGET(id) \ diff --git a/tests-mx32/ioctl_dm.gen.test b/tests-mx32/ioctl_dm.gen.test new file mode 100755 index 00000000..b60c7175 --- /dev/null +++ b/tests-mx32/ioctl_dm.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_dm +ioctl.test -s9); do not edit. +set -- -s9 +. "${srcdir=.}/ioctl.test" diff --git a/tests-mx32/ioctl_dm.test b/tests-mx32/ioctl_dm.test deleted file mode 100755 index e9cca03b..00000000 --- a/tests-mx32/ioctl_dm.test +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# Check decoding of DM* ioctls. - -. "${srcdir=.}/init.sh" - -check_prog grep -run_prog > /dev/null -run_strace -a16 -s9 -eioctl $args > "$EXP" -grep -v '^ioctl([012],' < "$LOG" > "$OUT" -match_diff "$OUT" "$EXP" diff --git a/tests-mx32/ioctl_evdev-v.gen.test b/tests-mx32/ioctl_evdev-v.gen.test index fc7e2f0b..bf74ef4c 100755 --- a/tests-mx32/ioctl_evdev-v.gen.test +++ b/tests-mx32/ioctl_evdev-v.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_evdev-v +ioctl-v.sh); do not edit. -. "${srcdir=.}/ioctl-v.sh" +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_evdev-v +ioctl.test -v); do not edit. +set -- -v +. "${srcdir=.}/ioctl.test" diff --git a/tests-mx32/ioctl_evdev.gen.test b/tests-mx32/ioctl_evdev.gen.test index 26f0a288..68a43f7c 100755 --- a/tests-mx32/ioctl_evdev.gen.test +++ b/tests-mx32/ioctl_evdev.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_evdev +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_evdev +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests-mx32/ioctl_kvm_run.c b/tests-mx32/ioctl_kvm_run.c new file mode 100644 index 00000000..17946143 --- /dev/null +++ b/tests-mx32/ioctl_kvm_run.c @@ -0,0 +1,242 @@ +/* + * Check decoding of KVM_* commands of ioctl syscall using /dev/kvm API. + * Based on kvmtest.c from https://lwn.net/Articles/658512/ + * + * kvmtest.c author: Josh Triplett <josh@joshtriplett.org> + * Copyright (c) 2015 Intel Corporation + * Copyright (c) 2017-2018 The strace developers. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "tests.h" + +#if defined HAVE_LINUX_KVM_H \ + && defined HAVE_STRUCT_KVM_REGS \ + && defined HAVE_STRUCT_KVM_SREGS \ + && defined HAVE_STRUCT_KVM_USERSPACE_MEMORY_REGION \ + &&(defined __x86_64__ || defined __i386__) + +# include <fcntl.h> +# include <stdint.h> +# include <stdio.h> +# include <stdlib.h> +# include <string.h> +# include <sys/ioctl.h> +# include <sys/mman.h> +# include <linux/kvm.h> + +static int +kvm_ioctl(int fd, unsigned long cmd, const char *cmd_str, void *arg) +{ + int rc = ioctl(fd, cmd, arg); + if (rc < 0) + perror_msg_and_skip("%s", cmd_str); + return rc; +} + +#define KVM_IOCTL(fd_, cmd_, arg_) \ + kvm_ioctl((fd_), (cmd_), #cmd_, (arg_)) + +static const char dev[] = "/dev/kvm"; +static const char vm_dev[] = "anon_inode:kvm-vm"; +static const char vcpu_dev[] = "anon_inode:kvm-vcpu"; +static size_t page_size; + +extern const char code[]; +extern const unsigned short code_size; + +__asm__( + ".type code, @object \n" + "code: \n" + " mov $0xd80003f8, %edx \n" + " mov $'\n', %al \n" + " out %al, (%dx) \n" + " hlt \n" + ".size code, . - code \n" + ".type code_size, @object \n" + "code_size: \n" + " .short . - code \n" + ".size code_size, . - code_size \n" + ); + + +static void +run_kvm(const int vcpu_fd, struct kvm_run *const run, const size_t mmap_size, + void *const mem) +{ + /* Initialize CS to point at 0, via a read-modify-write of sregs. */ + struct kvm_sregs sregs; + KVM_IOCTL(vcpu_fd, KVM_GET_SREGS, &sregs); + printf("ioctl(%d<%s>, KVM_GET_SREGS, {cs={base=%#jx, limit=%u, selector=%u" + ", type=%u, present=%u, dpl=%u, db=%u, s=%u, l=%u, g=%u, avl=%u}" + ", ...}) = 0\n", vcpu_fd, vcpu_dev, (uintmax_t) sregs.cs.base, + sregs.cs.limit, sregs.cs.selector, sregs.cs.type, + sregs.cs.present, sregs.cs.dpl, sregs.cs.db, sregs.cs.s, + sregs.cs.l, sregs.cs.g, sregs.cs.avl); + + sregs.cs.base = 0; + sregs.cs.selector = 0; + KVM_IOCTL(vcpu_fd, KVM_SET_SREGS, &sregs); + printf("ioctl(%d<%s>, KVM_SET_SREGS, {cs={base=%#jx, limit=%u" + ", selector=%u, type=%u, present=%u, dpl=%u, db=%u, s=%u" + ", l=%u, g=%u, avl=%u}, ...}) = 0\n", + vcpu_fd, vcpu_dev, (uintmax_t) sregs.cs.base, + sregs.cs.limit, sregs.cs.selector, sregs.cs.type, + sregs.cs.present, sregs.cs.dpl, sregs.cs.db, sregs.cs.s, + sregs.cs.l, sregs.cs.g, sregs.cs.avl); + + /* + * Initialize registers: instruction pointer for our code, addends, + * and initial flags required by x86 architecture. + */ + struct kvm_regs regs = { + .rip = page_size, + .rax = 2, + .rbx = 2, + .rflags = 0x2, + }; + KVM_IOCTL(vcpu_fd, KVM_SET_REGS, ®s); + printf("ioctl(%d<%s>, KVM_SET_REGS, {rax=%#jx, ..." + ", rsp=%#jx, rbp=%#jx, ..., rip=%#jx, rflags=%#jx}) = 0\n", + vcpu_fd, vcpu_dev, (uintmax_t) regs.rax, + (uintmax_t) regs.rsp, (uintmax_t) regs.rbp, + (uintmax_t) regs.rip, (uintmax_t) regs.rflags); + + /* Copy the code */ + memcpy(mem, code, code_size); + + const char *p = "\n"; + + /* Repeatedly run code and handle VM exits. */ + for (;;) { + KVM_IOCTL(vcpu_fd, KVM_RUN, NULL); + printf("ioctl(%d<%s>, KVM_RUN, 0) = 0\n", vcpu_fd, vcpu_dev); + + switch (run->exit_reason) { + case KVM_EXIT_HLT: + if (p) + error_msg_and_fail("premature KVM_EXIT_HLT"); + return; + case KVM_EXIT_IO: + if (run->io.direction == KVM_EXIT_IO_OUT + && run->io.size == 1 + && run->io.port == 0x03f8 + && run->io.count == 1 + && run->io.data_offset < mmap_size + && p && *p == ((char *) run)[run->io.data_offset]) + p = NULL; + else + error_msg_and_fail("unhandled KVM_EXIT_IO"); + break; + case KVM_EXIT_MMIO: + error_msg_and_fail("Got an unexpected MMIO exit:" + " phys_addr %#llx," + " data %02x %02x %02x %02x" + " %02x %02x %02x %02x," + " len %u, is_write %hhu", + (unsigned long long) run->mmio.phys_addr, + run->mmio.data[0], run->mmio.data[1], + run->mmio.data[2], run->mmio.data[3], + run->mmio.data[4], run->mmio.data[5], + run->mmio.data[6], run->mmio.data[7], + run->mmio.len, run->mmio.is_write); + + default: + error_msg_and_fail("exit_reason = %#x", + run->exit_reason); + } + } +} + +int +main(void) +{ + skip_if_unavailable("/proc/self/fd/"); + + int kvm = open(dev, O_RDWR); + if (kvm < 0) + perror_msg_and_skip("open: %s", dev); + + /* Make sure we have the stable version of the API */ + int ret = KVM_IOCTL(kvm, KVM_GET_API_VERSION, 0); + if (ret != KVM_API_VERSION) + error_msg_and_skip("KVM_GET_API_VERSION returned %d" + ", KVM_API_VERSION is %d", + kvm, KVM_API_VERSION); + printf("ioctl(%d<%s>, KVM_GET_API_VERSION, 0) = %d\n", + kvm, dev, ret); + + int vm_fd = KVM_IOCTL(kvm, KVM_CREATE_VM, 0); + printf("ioctl(%d<%s>, KVM_CREATE_VM, 0) = %d<%s>\n", + kvm, dev, vm_fd, vm_dev); + + /* Allocate one aligned page of guest memory to hold the code. */ + page_size = get_page_size(); + void *const mem = mmap(NULL, page_size, PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_ANONYMOUS, -1, 0); + if (mem == MAP_FAILED) + perror_msg_and_fail("mmap page"); + + /* Map it to the second page frame (to avoid the real-mode IDT at 0). */ + struct kvm_userspace_memory_region region = { + .slot = 0, + .guest_phys_addr = page_size, + .memory_size = page_size, + .userspace_addr = (uintptr_t) mem, + }; + KVM_IOCTL(vm_fd, KVM_SET_USER_MEMORY_REGION, ®ion); + printf("ioctl(%d<%s>, KVM_SET_USER_MEMORY_REGION" + ", {slot=0, flags=0, guest_phys_addr=%#lx, memory_size=%lu" + ", userspace_addr=%p}) = 0\n", vm_fd, vm_dev, + (unsigned long) page_size, (unsigned long) page_size, mem); + + int vcpu_fd = KVM_IOCTL(vm_fd, KVM_CREATE_VCPU, NULL); + printf("ioctl(%d<%s>, KVM_CREATE_VCPU, 0) = %d<%s>\n", + vm_fd, vm_dev, vcpu_fd, vcpu_dev); + + /* Map the shared kvm_run structure and following data. */ + ret = KVM_IOCTL(kvm, KVM_GET_VCPU_MMAP_SIZE, NULL); + struct kvm_run *run; + if (ret < (int) sizeof(*run)) + error_msg_and_fail("KVM_GET_VCPU_MMAP_SIZE returned %d < %d", + ret, (int) sizeof(*run)); + printf("ioctl(%d<%s>, KVM_GET_VCPU_MMAP_SIZE, 0) = %d\n", + kvm, dev, ret); + + const size_t mmap_size = (ret + page_size - 1) & -page_size; + run = mmap(NULL, mmap_size, PROT_READ | PROT_WRITE, + MAP_SHARED, vcpu_fd, 0); + if (run == MAP_FAILED) + perror_msg_and_fail("mmap vcpu"); + + run_kvm(vcpu_fd, run, mmap_size, mem); + + puts("+++ exited with 0 +++"); + return 0; +} + +#else /* !HAVE_LINUX_KVM_H */ + +SKIP_MAIN_UNDEFINED("HAVE_LINUX_KVM_H && HAVE_STRUCT_KVM_REGS && " + "HAVE_STRUCT_KVM_SREGS && " + "HAVE_STRUCT_KVM_USERSPACE_MEMORY_REGION && " + "(__x86_64__ || __i386__)") + +#endif diff --git a/tests-mx32/ioctl_kvm_run.gen.test b/tests-mx32/ioctl_kvm_run.gen.test new file mode 100755 index 00000000..7ab473ba --- /dev/null +++ b/tests-mx32/ioctl_kvm_run.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_kvm_run +ioctl.test -a36 -y); do not edit. +set -- -a36 -y +. "${srcdir=.}/ioctl.test" diff --git a/tests-mx32/ioctl_loop-nv.gen.test b/tests-mx32/ioctl_loop-nv.gen.test new file mode 100755 index 00000000..d9da86a2 --- /dev/null +++ b/tests-mx32/ioctl_loop-nv.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_loop-nv +ioctl.test -a22 -e verbose=none); do not edit. +set -- -a22 -e verbose=none +. "${srcdir=.}/ioctl.test" diff --git a/tests-mx32/ioctl_loop-nv.test b/tests-mx32/ioctl_loop-nv.test deleted file mode 100755 index 7d59cc2b..00000000 --- a/tests-mx32/ioctl_loop-nv.test +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# Check non-verbose decoding of LOOP_* ioctls. - -. "${srcdir=.}/init.sh" - -check_prog grep -run_prog > /dev/null -run_strace -a22 -eioctl -e verbose=none $args > "$EXP" -grep -v '^ioctl([012],' < "$LOG" > "$OUT" -match_diff "$OUT" "$EXP" diff --git a/tests-mx32/ioctl_loop-v.gen.test b/tests-mx32/ioctl_loop-v.gen.test index 7fd9f661..b03bf784 100755 --- a/tests-mx32/ioctl_loop-v.gen.test +++ b/tests-mx32/ioctl_loop-v.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_loop-v +ioctl-v.sh); do not edit. -. "${srcdir=.}/ioctl-v.sh" +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_loop-v +ioctl.test -v); do not edit. +set -- -v +. "${srcdir=.}/ioctl.test" diff --git a/tests-mx32/ioctl_loop.gen.test b/tests-mx32/ioctl_loop.gen.test index f7aee8e5..d4ec35ac 100755 --- a/tests-mx32/ioctl_loop.gen.test +++ b/tests-mx32/ioctl_loop.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_loop +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_loop +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests-mx32/ioctl_mtd.c b/tests-mx32/ioctl_mtd.c index 6a7d94a7..1b5be755 100644 --- a/tests-mx32/ioctl_mtd.c +++ b/tests-mx32/ioctl_mtd.c @@ -30,22 +30,20 @@ #include "tests.h" -#include <errno.h> -#include <inttypes.h> -#include <stdio.h> -#include <string.h> -#include <sys/ioctl.h> -#include <linux/ioctl.h> -#include <linux/version.h> -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) -# include "mtd-abi.h" -#else +#ifdef HAVE_STRUCT_MTD_WRITE_REQ + +# include <errno.h> +# include <inttypes.h> +# include <stdio.h> +# include <string.h> +# include <sys/ioctl.h> +# include <linux/ioctl.h> +# include <linux/version.h> # include <mtd/mtd-abi.h> -#endif static const unsigned long lmagic = (unsigned long) 0xdeadbeefbadc0dedULL; -#define TEST_NULL_ARG(cmd) \ +# define TEST_NULL_ARG(cmd) \ do { \ ioctl(-1, cmd, 0); \ if (_IOC_DIR(cmd) == _IOC_WRITE) \ @@ -60,7 +58,7 @@ static const unsigned long lmagic = (unsigned long) 0xdeadbeefbadc0dedULL; printf("ioctl(-1, %s, NULL) = -1 EBADF (%m)\n", #cmd); \ } while (0) -#define TEST_erase_info_user(cmd, eiu) \ +# define TEST_erase_info_user(cmd, eiu) \ do { \ ioctl(-1, cmd, eiu); \ printf("ioctl(-1, MIXER_%s(%u) or %s, {start=%#x, length=%#x})" \ @@ -122,9 +120,9 @@ main(void) ioctl(-1, MEMGETREGIONINFO, riu); printf("ioctl(-1, %s, {regionindex=%#x}) = -1 EBADF (%m)\n", "MEMGETREGIONINFO" -#ifdef __i386__ +# ifdef __i386__ " or MTRRIOC_GET_PAGE_ENTRY" -#endif +# endif , riu->regionindex); TAIL_ALLOC_OBJECT_CONST_PTR(struct erase_info_user, eiu); @@ -198,3 +196,9 @@ main(void) puts("+++ exited with 0 +++"); return 0; } + +#else + +SKIP_MAIN_UNDEFINED("HAVE_STRUCT_MTD_WRITE_REQ") + +#endif diff --git a/tests-mx32/ioctl_mtd.gen.test b/tests-mx32/ioctl_mtd.gen.test index cbc31047..65b00037 100755 --- a/tests-mx32/ioctl_mtd.gen.test +++ b/tests-mx32/ioctl_mtd.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_mtd +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_mtd +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests-mx32/ioctl_nsfs.gen.test b/tests-mx32/ioctl_nsfs.gen.test new file mode 100755 index 00000000..f9adc5f0 --- /dev/null +++ b/tests-mx32/ioctl_nsfs.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_nsfs +ioctl.test -esignal=none); do not edit. +set -- -esignal=none +. "${srcdir=.}/ioctl.test" diff --git a/tests-mx32/ioctl_nsfs.test b/tests-mx32/ioctl_nsfs.test deleted file mode 100755 index acdfb618..00000000 --- a/tests-mx32/ioctl_nsfs.test +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# Check decoding of NS_* ioctls. - -. "${srcdir=.}/init.sh" - -check_prog grep -run_prog > /dev/null -run_strace -a16 -eioctl -esignal=none $args > "$EXP" -grep -v '^ioctl([012],' < "$LOG" > "$OUT" -match_diff "$OUT" "$EXP" diff --git a/tests-mx32/ioctl_rtc-v.gen.test b/tests-mx32/ioctl_rtc-v.gen.test index b534a025..820181b0 100755 --- a/tests-mx32/ioctl_rtc-v.gen.test +++ b/tests-mx32/ioctl_rtc-v.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_rtc-v +ioctl-v.sh); do not edit. -. "${srcdir=.}/ioctl-v.sh" +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_rtc-v +ioctl.test -v); do not edit. +set -- -v +. "${srcdir=.}/ioctl.test" diff --git a/tests-mx32/ioctl_rtc.gen.test b/tests-mx32/ioctl_rtc.gen.test index e430a82c..310b5588 100755 --- a/tests-mx32/ioctl_rtc.gen.test +++ b/tests-mx32/ioctl_rtc.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_rtc +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_rtc +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests-mx32/ioctl_scsi.gen.test b/tests-mx32/ioctl_scsi.gen.test index 23ac307b..499bfc49 100755 --- a/tests-mx32/ioctl_scsi.gen.test +++ b/tests-mx32/ioctl_scsi.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_scsi +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_scsi +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests-mx32/ioctl_sg_io_v3.gen.test b/tests-mx32/ioctl_sg_io_v3.gen.test index e7e5ea50..ef8fd14d 100755 --- a/tests-mx32/ioctl_sg_io_v3.gen.test +++ b/tests-mx32/ioctl_sg_io_v3.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_sg_io_v3 +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_sg_io_v3 +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests-mx32/ioctl_sg_io_v4.gen.test b/tests-mx32/ioctl_sg_io_v4.gen.test index 575ad96a..4aa4e4e9 100755 --- a/tests-mx32/ioctl_sg_io_v4.gen.test +++ b/tests-mx32/ioctl_sg_io_v4.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_sg_io_v4 +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_sg_io_v4 +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests-mx32/ioctl_sock_gifconf.gen.test b/tests-mx32/ioctl_sock_gifconf.gen.test new file mode 100755 index 00000000..5d6fe2f4 --- /dev/null +++ b/tests-mx32/ioctl_sock_gifconf.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_sock_gifconf +ioctl.test -a28 -s1); do not edit. +set -- -a28 -s1 +. "${srcdir=.}/ioctl.test" diff --git a/tests-mx32/ioctl_sock_gifconf.test b/tests-mx32/ioctl_sock_gifconf.test deleted file mode 100755 index 22d7ea46..00000000 --- a/tests-mx32/ioctl_sock_gifconf.test +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# Check decoding of SIOCGIFCONF ioctl. - -. "${srcdir=.}/init.sh" - -check_prog grep -run_prog > /dev/null -run_strace -a28 -s1 -eioctl $args > "$EXP" -grep -v '^ioctl([012],' < "$LOG" > "$OUT" -match_diff "$OUT" "$EXP" diff --git a/tests-mx32/ioctl_uffdio.gen.test b/tests-mx32/ioctl_uffdio.gen.test index 80fd2a64..ed73c5f0 100755 --- a/tests-mx32/ioctl_uffdio.gen.test +++ b/tests-mx32/ioctl_uffdio.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_uffdio +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_uffdio +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests-mx32/ioctl_v4l2.gen.test b/tests-mx32/ioctl_v4l2.gen.test index cbd36ba6..4c571447 100755 --- a/tests-mx32/ioctl_v4l2.gen.test +++ b/tests-mx32/ioctl_v4l2.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_v4l2 +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_v4l2 +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests-mx32/ioperm.gen.test b/tests-mx32/ioperm.gen.test index 154d60ae..bc69f69e 100755 --- a/tests-mx32/ioperm.gen.test +++ b/tests-mx32/ioperm.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioperm -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioperm -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests-mx32/iopl.gen.test b/tests-mx32/iopl.gen.test index 3d9704cb..f7769d23 100755 --- a/tests-mx32/iopl.gen.test +++ b/tests-mx32/iopl.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (iopl -a8); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (iopl -a8 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a8 +run_strace_match_diff -a8 diff --git a/tests-mx32/ip_mreq.c b/tests-mx32/ip_mreq.c index 3f4648ca..12cc2611 100644 --- a/tests-mx32/ip_mreq.c +++ b/tests-mx32/ip_mreq.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2015-2017 The strace developers. + * Copyright (c) 2015-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,9 +32,9 @@ #if defined IP_ADD_MEMBERSHIP && defined IPV6_ADD_MEMBERSHIP \ && defined IPV6_JOIN_ANYCAST +# include <limits.h> # include <stdio.h> # include <unistd.h> -# include <sys/param.h> # include <sys/socket.h> # include <arpa/inet.h> # include <net/if.h> diff --git a/tests-mx32/ipc.gen.test b/tests-mx32/ipc.gen.test index 5ed1f0d2..0aa75789 100755 --- a/tests-mx32/ipc.gen.test +++ b/tests-mx32/ipc.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ipc -a19); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ipc -a19 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a19 +run_strace_match_diff -a19 diff --git a/tests-mx32/ipc_msg.gen.test b/tests-mx32/ipc_msg.gen.test index f4fec80b..b1f1f7e8 100755 --- a/tests-mx32/ipc_msg.gen.test +++ b/tests-mx32/ipc_msg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ipc_msg +ipc.sh); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ipc_msg +ipc.sh ); do not edit. +set -- . "${srcdir=.}/ipc.sh" diff --git a/tests-mx32/ipc_msgbuf.c b/tests-mx32/ipc_msgbuf.c index d1083899..c4af1bef 100644 --- a/tests-mx32/ipc_msgbuf.c +++ b/tests-mx32/ipc_msgbuf.c @@ -38,11 +38,16 @@ static int msqid = -1; -static void +static int cleanup(void) { - msgctl(msqid, IPC_RMID, 0); - msqid = -1; + if (msqid != -1) { + int rc = msgctl(msqid, IPC_RMID, 0); + msqid = -1; + if (rc == -1) + return 77; + } + return 0; } int @@ -59,10 +64,11 @@ main(void) msqid = msgget(IPC_PRIVATE, IPC_CREAT | S_IRWXU); if (msqid == -1) perror_msg_and_skip("msgget"); - atexit(cleanup); + typedef void (*atexit_func)(void); + atexit((atexit_func) cleanup); if (msgsnd(msqid, &msg, msgsz, 0) == -1) perror_msg_and_skip("msgsnd"); if (msgrcv(msqid, &msg, msgsz, mtype, 0) != msgsz) perror_msg_and_skip("msgrcv"); - return 0; + return cleanup(); } diff --git a/tests-mx32/ipc_sem.gen.test b/tests-mx32/ipc_sem.gen.test index 54159a64..a1c03d2b 100755 --- a/tests-mx32/ipc_sem.gen.test +++ b/tests-mx32/ipc_sem.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ipc_sem +ipc.sh); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ipc_sem +ipc.sh ); do not edit. +set -- . "${srcdir=.}/ipc.sh" diff --git a/tests-mx32/ipc_shm.c b/tests-mx32/ipc_shm.c index 66960ff9..c7931388 100644 --- a/tests-mx32/ipc_shm.c +++ b/tests-mx32/ipc_shm.c @@ -1,6 +1,7 @@ /* * Copyright (c) 2015 Elvira Khabirova <lineprinter0@gmail.com> * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2015-2017 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,6 +33,14 @@ #include <stdlib.h> #include <sys/shm.h> +#ifndef SHM_HUGE_SHIFT +# define SHM_HUGE_SHIFT 26 +#endif + +#ifndef SHM_HUGE_MASK +# define SHM_HUGE_MASK 0x3f +#endif + #include "xlat.h" #include "xlat/shm_resource_flags.h" @@ -64,18 +73,54 @@ main(void) #else (size_t) 0x1e55c0de5dec0dedULL; #endif - static const int bogus_flags = 0xface1e55; - + static const unsigned int bogus_ipc_shm_flags = + IPC_CREAT | IPC_EXCL | SHM_HUGETLB | SHM_NORESERVE; + static const unsigned int huge_mask = SHM_HUGE_MASK << SHM_HUGE_SHIFT; + static const unsigned int huge_flags = 21 << SHM_HUGE_SHIFT; + int bogus_flags; int rc; struct shmid_ds ds; + rc = shmget(bogus_key, bogus_size, 0); + printf("shmget\\(%#llx, %zu, 000\\) += %s\n", + zero_extend_signed_to_ull(bogus_key), bogus_size, + sprintrc_grep(rc)); + + rc = shmget(bogus_key, bogus_size, huge_flags); + printf("shmget\\(%#llx, %zu, %s\\|%#03o\\) += %s\n", + zero_extend_signed_to_ull(bogus_key), bogus_size, + "21<<SHM_HUGE_SHIFT", 0, sprintrc_grep(rc)); + + bogus_flags = 0xface1e55 & ~(bogus_ipc_shm_flags | huge_mask); + rc = shmget(bogus_key, bogus_size, bogus_flags); + printf("shmget\\(%#llx, %zu, %#x\\|%#03o\\) += %s\n", + zero_extend_signed_to_ull(bogus_key), bogus_size, + bogus_flags & ~0777, + bogus_flags & 0777, sprintrc_grep(rc)); + + bogus_flags |= bogus_ipc_shm_flags; + rc = shmget(bogus_key, bogus_size, bogus_flags); + printf("shmget\\(%#llx, %zu, %s\\|%#x\\|%#03o\\) += %s\n", + zero_extend_signed_to_ull(bogus_key), bogus_size, + "IPC_CREAT\\|IPC_EXCL\\|SHM_HUGETLB\\|SHM_NORESERVE", + bogus_flags & ~(0777 | bogus_ipc_shm_flags), + bogus_flags & 0777, sprintrc_grep(rc)); + + bogus_flags |= huge_flags; + rc = shmget(bogus_key, bogus_size, bogus_flags); + printf("shmget\\(%#llx, %zu, %s\\|%#x\\|%s\\|%#03o\\) += %s\n", + zero_extend_signed_to_ull(bogus_key), bogus_size, + "IPC_CREAT\\|IPC_EXCL\\|SHM_HUGETLB\\|SHM_NORESERVE", + bogus_flags & ~(0777 | bogus_ipc_shm_flags | huge_mask), + "21<<SHM_HUGE_SHIFT", + bogus_flags & 0777, sprintrc_grep(rc)); + + bogus_flags &= ~bogus_ipc_shm_flags; rc = shmget(bogus_key, bogus_size, bogus_flags); - printf("shmget\\(%#llx, %zu, %s%s%s%#x\\|%#04o\\) += %s\n", + printf("shmget\\(%#llx, %zu, %#x\\|%s\\|%#03o\\) += %s\n", zero_extend_signed_to_ull(bogus_key), bogus_size, - IPC_CREAT & bogus_flags ? "IPC_CREAT\\|" : "", - IPC_EXCL & bogus_flags ? "IPC_EXCL\\|" : "", - SHM_HUGETLB & bogus_flags ? "SHM_HUGETLB\\|" : "", - bogus_flags & ~(0777 | IPC_CREAT | IPC_EXCL | SHM_HUGETLB), + bogus_flags & ~(0777 | huge_mask), + "21<<SHM_HUGE_SHIFT", bogus_flags & 0777, sprintrc_grep(rc)); id = shmget(private_key, 1, 0600); diff --git a/tests-mx32/ipc_shm.gen.test b/tests-mx32/ipc_shm.gen.test index 505eabaf..8c6df9b3 100755 --- a/tests-mx32/ipc_shm.gen.test +++ b/tests-mx32/ipc_shm.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ipc_shm +ipc.sh); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ipc_shm +ipc.sh ); do not edit. +set -- . "${srcdir=.}/ipc.sh" diff --git a/tests-mx32/kcmp.gen.test b/tests-mx32/kcmp.gen.test index c073a39e..139e909b 100755 --- a/tests-mx32/kcmp.gen.test +++ b/tests-mx32/kcmp.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (kcmp -a22); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (kcmp -a22 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a22 +run_strace_match_diff -a22 diff --git a/tests-mx32/kexec_file_load.gen.test b/tests-mx32/kexec_file_load.gen.test index aefaab38..11013497 100755 --- a/tests-mx32/kexec_file_load.gen.test +++ b/tests-mx32/kexec_file_load.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (kexec_file_load -s9); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (kexec_file_load -s9 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -s9 +run_strace_match_diff -s9 diff --git a/tests-mx32/kexec_load.gen.test b/tests-mx32/kexec_load.gen.test index 0af95271..6ce18317 100755 --- a/tests-mx32/kexec_load.gen.test +++ b/tests-mx32/kexec_load.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (kexec_load -s9); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (kexec_load -s9 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -s9 +run_strace_match_diff -s9 diff --git a/tests-mx32/lchown.gen.test b/tests-mx32/lchown.gen.test index b31e29d1..d346c76d 100755 --- a/tests-mx32/lchown.gen.test +++ b/tests-mx32/lchown.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (lchown -a30); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (lchown -a30 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a30 +run_strace_match_diff -a30 diff --git a/tests-mx32/lchown32.gen.test b/tests-mx32/lchown32.gen.test index 83be4bca..5da2349c 100755 --- a/tests-mx32/lchown32.gen.test +++ b/tests-mx32/lchown32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (lchown32 -a32); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (lchown32 -a32 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a32 +run_strace_match_diff -a32 diff --git a/tests-mx32/link.gen.test b/tests-mx32/link.gen.test index b6db34d0..2ec3f5b8 100755 --- a/tests-mx32/link.gen.test +++ b/tests-mx32/link.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (link ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (link ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/linkat.gen.test b/tests-mx32/linkat.gen.test index 54b12b94..8bdf78b4 100755 --- a/tests-mx32/linkat.gen.test +++ b/tests-mx32/linkat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (linkat ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (linkat ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/llseek.test b/tests-mx32/llseek.test index 8dcd65d6..9db68e3a 100755 --- a/tests-mx32/llseek.test +++ b/tests-mx32/llseek.test @@ -7,5 +7,5 @@ check_prog grep run_prog > /dev/null run_strace -e_llseek $args > "$EXP" -grep -v '^lseek([0-9]' < "$LOG" > "$OUT" +grep -v '^_llseek([0-9]' < "$LOG" > "$OUT" match_diff "$OUT" "$EXP" diff --git a/tests-mx32/lookup_dcookie.gen.test b/tests-mx32/lookup_dcookie.gen.test index 6357e19d..616c7057 100755 --- a/tests-mx32/lookup_dcookie.gen.test +++ b/tests-mx32/lookup_dcookie.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (lookup_dcookie -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (lookup_dcookie -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests-mx32/madvise.gen.test b/tests-mx32/madvise.gen.test index bd36dada..a549cf94 100755 --- a/tests-mx32/madvise.gen.test +++ b/tests-mx32/madvise.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (madvise -a33); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (madvise -a33 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a33 +run_strace_match_diff -a33 diff --git a/tests-mx32/mbind.gen.test b/tests-mx32/mbind.gen.test index a0d144df..c47e0fc1 100755 --- a/tests-mx32/mbind.gen.test +++ b/tests-mx32/mbind.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mbind ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mbind ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/membarrier.c b/tests-mx32/membarrier.c index 73dd3b02..43f99f88 100644 --- a/tests-mx32/membarrier.c +++ b/tests-mx32/membarrier.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2015-2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2015-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,28 +45,49 @@ main(void) printf("membarrier(0x3 /* MEMBARRIER_CMD_??? */, 255) = %s\n", sprintrc(-1)); if (saved_errno != ENOSYS) { + const char *text_global; const char *text; int rc = syscall(__NR_membarrier, 0, 0); - switch (rc) { - case 1: - text = "MEMBARRIER_CMD_SHARED"; + assert(rc >= 0); + + text_global = rc & 1 ? "MEMBARRIER_CMD_GLOBAL" : ""; + + switch (rc & ~1) { + case 0: + text = ""; break; - case 1|8: - text = "MEMBARRIER_CMD_SHARED|" - "MEMBARRIER_CMD_PRIVATE_EXPEDITED"; + case 8: + text = "MEMBARRIER_CMD_PRIVATE_EXPEDITED"; break; - case 1|8|16: - text = "MEMBARRIER_CMD_SHARED|" + case 8|16: + text = "MEMBARRIER_CMD_PRIVATE_EXPEDITED|" + "MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED"; + break; + + case 2|4|8|16: + text = "MEMBARRIER_CMD_GLOBAL_EXPEDITED|" + "MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED|" "MEMBARRIER_CMD_PRIVATE_EXPEDITED|" "MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED"; break; + + case 2|4|8|16|32|64: + text = "MEMBARRIER_CMD_GLOBAL_EXPEDITED|" + "MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED|" + "MEMBARRIER_CMD_PRIVATE_EXPEDITED|" + "MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED|" + "MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE|" + "MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE"; + break; + default: error_msg_and_fail("membarrier returned %#x, does" " the test have to be updated?", rc); } - printf("membarrier(MEMBARRIER_CMD_QUERY, 0) = %#x (%s)\n", - rc, text); + printf("membarrier(MEMBARRIER_CMD_QUERY, 0) = %#x (%s%s%s)\n", + rc, text_global, text[0] && text_global[0] ? "|" : "", + text); } puts("+++ exited with 0 +++"); return 0; diff --git a/tests-mx32/membarrier.gen.test b/tests-mx32/membarrier.gen.test index 7a6ea10d..6ae6e915 100755 --- a/tests-mx32/membarrier.gen.test +++ b/tests-mx32/membarrier.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (membarrier -a36); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (membarrier -a36 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a36 +run_strace_match_diff -a36 diff --git a/tests-mx32/memfd_create.c b/tests-mx32/memfd_create.c index 4559b426..8334af84 100644 --- a/tests-mx32/memfd_create.c +++ b/tests-mx32/memfd_create.c @@ -1,3 +1,32 @@ +/* + * Check decoding of memfd_create syscall. + * + * Copyright (c) 2015-2017 Dmitry V. Levin <ldv@altlinux.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + #include "tests.h" #include <asm/unistd.h> #include "scno.h" @@ -5,17 +34,62 @@ #ifdef __NR_memfd_create # include <stdio.h> +# include <stdint.h> # include <unistd.h> +# ifdef HAVE_LINUX_MEMFD_H +# include <linux/memfd.h> +# endif + +# ifndef MFD_HUGE_SHIFT +# define MFD_HUGE_SHIFT 26 +# endif + +# ifndef MFD_HUGE_MASK +# define MFD_HUGE_MASK 0x3f +# endif + +static const char *errstr; + +static long +k_memfd_create(const kernel_ulong_t name, const kernel_ulong_t flags) +{ + const long rc = syscall(__NR_memfd_create, name, flags); + errstr = sprintrc(rc); + return rc; +} + int main(void) { - static const char text[] = "strace"; - int rc = syscall(__NR_memfd_create, text, 0xf); + const size_t size = 255 - (sizeof("memfd:") - 1) + 1; + char *pattern = tail_alloc(size); + fill_memory_ex(pattern, size, '0', 10); + + k_memfd_create((uintptr_t) pattern, 0); + printf("memfd_create(\"%.*s\"..., 0) = %s\n", + (int) size - 1, pattern, errstr); + + kernel_ulong_t flags = (kernel_ulong_t) 0xfacefeed00000007ULL; + k_memfd_create((uintptr_t) pattern, flags); + printf("memfd_create(\"%.*s\"..., %s) = %s\n", + (int) size - 1, pattern, + "MFD_CLOEXEC|MFD_ALLOW_SEALING|MFD_HUGETLB", + errstr); + + pattern[size - 1] = '\0'; + flags = 30 << MFD_HUGE_SHIFT; + k_memfd_create((uintptr_t) pattern, flags); + printf("memfd_create(\"%s\", 30<<MFD_HUGE_SHIFT) = %s\n", + pattern, errstr); - printf("memfd_create(\"%s\", %s) = %s\n", - text, "MFD_CLOEXEC|MFD_ALLOW_SEALING|MFD_HUGETLB|0x8", - sprintrc(rc)); + pattern += size - 1; + flags = (kernel_ulong_t) -1ULL; + k_memfd_create(0, flags); + flags = -1U & ~(7 | (MFD_HUGE_MASK << MFD_HUGE_SHIFT)); + printf("memfd_create(NULL, MFD_CLOEXEC|MFD_ALLOW_SEALING|MFD_HUGETLB" + "|%#x|%u<<MFD_HUGE_SHIFT) = %s\n", + (unsigned int) flags, MFD_HUGE_MASK, errstr); puts("+++ exited with 0 +++"); return 0; diff --git a/tests-mx32/memfd_create.gen.test b/tests-mx32/memfd_create.gen.test index 11762bea..ccb5b52e 100755 --- a/tests-mx32/memfd_create.gen.test +++ b/tests-mx32/memfd_create.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (memfd_create ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (memfd_create ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/migrate_pages.gen.test b/tests-mx32/migrate_pages.gen.test index 20b7cad9..0ea017d0 100755 --- a/tests-mx32/migrate_pages.gen.test +++ b/tests-mx32/migrate_pages.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (migrate_pages -a33); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (migrate_pages -a33 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a33 +run_strace_match_diff -a33 diff --git a/tests-mx32/mincore.gen.test b/tests-mx32/mincore.gen.test index dc407261..45e43e25 100755 --- a/tests-mx32/mincore.gen.test +++ b/tests-mx32/mincore.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mincore -a22); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mincore -a22 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a22 +run_strace_match_diff -a22 diff --git a/tests-mx32/mkdir.gen.test b/tests-mx32/mkdir.gen.test index 80b49957..8d34c8b2 100755 --- a/tests-mx32/mkdir.gen.test +++ b/tests-mx32/mkdir.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mkdir -a20); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mkdir -a20 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a20 +run_strace_match_diff -a20 diff --git a/tests-mx32/mkdirat.gen.test b/tests-mx32/mkdirat.gen.test index 0f3fdae2..eef8e526 100755 --- a/tests-mx32/mkdirat.gen.test +++ b/tests-mx32/mkdirat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mkdirat -a28); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mkdirat -a28 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a28 +run_strace_match_diff -a28 diff --git a/tests-mx32/mknod.gen.test b/tests-mx32/mknod.gen.test index 870c88b4..ce08e99f 100755 --- a/tests-mx32/mknod.gen.test +++ b/tests-mx32/mknod.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mknod -a18); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mknod -a18 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a18 +run_strace_match_diff -a18 diff --git a/tests-mx32/mknodat.gen.test b/tests-mx32/mknodat.gen.test index 747fcbee..dce7d449 100755 --- a/tests-mx32/mknodat.gen.test +++ b/tests-mx32/mknodat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mknodat -a35); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mknodat -a35 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a35 +run_strace_match_diff -a35 diff --git a/tests-mx32/mlock2.gen.test b/tests-mx32/mlock2.gen.test index aa1818e1..ff94eb89 100755 --- a/tests-mx32/mlock2.gen.test +++ b/tests-mx32/mlock2.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mlock2 ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mlock2 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/mlockall.gen.test b/tests-mx32/mlockall.gen.test index 06d8ca44..59ef67f8 100755 --- a/tests-mx32/mlockall.gen.test +++ b/tests-mx32/mlockall.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mlockall -a12); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mlockall -a12 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a12 +run_strace_match_diff -a12 diff --git a/tests-mx32/mmap64.gen.test b/tests-mx32/mmap64.gen.test index 5e747b02..0ecd5294 100755 --- a/tests-mx32/mmap64.gen.test +++ b/tests-mx32/mmap64.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mmap64 +mmap.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mmap64 +mmap.test ); do not edit. +set -- . "${srcdir=.}/mmap.test" diff --git a/tests-mx32/modify_ldt.c b/tests-mx32/modify_ldt.c new file mode 100644 index 00000000..1e26bda4 --- /dev/null +++ b/tests-mx32/modify_ldt.c @@ -0,0 +1,137 @@ +/* + * Check decoding of modify_ldt syscall. + * + * Copyright (c) 2018 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" + +#include <asm/unistd.h> + +#if defined __NR_modify_ldt && defined HAVE_STRUCT_USER_DESC + +# include <errno.h> +# include <stdio.h> +# include <unistd.h> + +# include "print_user_desc.c" + +void +printrc(long rc) +{ +#ifdef __x86_64__ + int err = -rc; + + /* Thanks, long return type of syscall(2) */ + printf("%lld", zero_extend_signed_to_ull(rc)); + + if (err > 0 && err < 0x1000) { + errno = err; + printf(" %s (%m)", errno2name()); + } +#else + printf("%s", sprintrc(rc)); +#endif + + puts(""); +} + +int +main(void) +{ + static const kernel_ulong_t bogus_func = + (kernel_ulong_t) 0xbadc0dedda7a1057ULL; + static const kernel_ulong_t bogus_bytecount = + (kernel_ulong_t) 0xdeadfacefa57beefULL; + + struct user_desc *us = tail_alloc(sizeof(*us)); + unsigned int *bogus_int = tail_alloc(sizeof(*bogus_int)); + long rc; + + fill_memory(us, sizeof(*us)); + + rc = syscall(__NR_modify_ldt, 0, 0, 0); + printf("modify_ldt(0, NULL, 0) = "); + printrc(rc); + + rc = syscall(__NR_modify_ldt, bogus_func, (kernel_long_t) -1, + bogus_bytecount); + printf("modify_ldt(%d, %#llx, %llu) = ", + (int) bogus_func, + zero_extend_signed_to_ull((kernel_long_t) -1), + (unsigned long long) bogus_bytecount); + printrc(rc); + + rc = syscall(__NR_modify_ldt, bogus_func, us + 1, 0); + printf("modify_ldt(%d, %p, 0) = ", (int) bogus_func, us + 1); + printrc(rc); + + rc = syscall(__NR_modify_ldt, bogus_func, us, 42); + printf("modify_ldt(%d, %p, 42) = ", (int) bogus_func, us); + printrc(rc); + + rc = syscall(__NR_modify_ldt, bogus_func, us + 1, sizeof(*us)); + printf("modify_ldt(%d, %p, %zu) = ", + (int) bogus_func, us + 1, sizeof(*us)); + printrc(rc); + + /* + * print_user_desc handles entry_number field in a special way for + * get_thread_area syscall, so let's also check here that we don't + * retrieve it accidentally. + */ + rc = syscall(__NR_modify_ldt, bogus_func, bogus_int, sizeof(*us)); + printf("modify_ldt(%d, %p, %zu) = ", + (int) bogus_func, bogus_int, sizeof(*us)); + printrc(rc); + + rc = syscall(__NR_modify_ldt, bogus_func, us, sizeof(*us)); + printf("modify_ldt(%d, ", (int) bogus_func); + print_user_desc(us, NULL); + printf(", %zu) = ", sizeof(*us)); + printrc(rc); + + fill_memory_ex(us, sizeof(*us), 0x55, 80); + us->entry_number = -1; + us->base_addr = 0; + us->limit = 0; + + rc = syscall(__NR_modify_ldt, bogus_func, us, sizeof(*us)); + printf("modify_ldt(%d, ", (int) bogus_func); + print_user_desc(us, "-1"); + printf(", %zu) = ", sizeof(*us)); + printrc(rc); + + puts("+++ exited with 0 +++"); + + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_modify_ldt && HAVE_STRUCT_USER_DESC"); + +#endif diff --git a/tests-mx32/modify_ldt.gen.test b/tests-mx32/modify_ldt.gen.test new file mode 100755 index 00000000..1a85b067 --- /dev/null +++ b/tests-mx32/modify_ldt.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (modify_ldt -a23 ); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a23 diff --git a/tests-mx32/mount.gen.test b/tests-mx32/mount.gen.test index 0b124bc2..69bc99be 100755 --- a/tests-mx32/mount.gen.test +++ b/tests-mx32/mount.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mount ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mount ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/move_pages.gen.test b/tests-mx32/move_pages.gen.test index 2f060fa8..9d472ef9 100755 --- a/tests-mx32/move_pages.gen.test +++ b/tests-mx32/move_pages.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (move_pages -s3); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (move_pages -s3 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -s3 +run_strace_match_diff -s3 diff --git a/tests-mx32/munlockall.gen.test b/tests-mx32/munlockall.gen.test index 18343cba..2e4e0c4f 100755 --- a/tests-mx32/munlockall.gen.test +++ b/tests-mx32/munlockall.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (munlockall -a13); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (munlockall -a13 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a13 +run_strace_match_diff -a13 diff --git a/tests-mx32/nanosleep.gen.test b/tests-mx32/nanosleep.gen.test index ea5b19ae..41928ded 100755 --- a/tests-mx32/nanosleep.gen.test +++ b/tests-mx32/nanosleep.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nanosleep -a20); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nanosleep -a20 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a20 +run_strace_match_diff -a20 diff --git a/tests-mx32/net-accept-connect.c b/tests-mx32/net-accept-connect.c index 4045e056..0756c9be 100644 --- a/tests-mx32/net-accept-connect.c +++ b/tests-mx32/net-accept-connect.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2013-2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2013-2017 The strace developers. + * Copyright (c) 2013-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,15 +49,16 @@ main(int ac, const char **av) struct sockaddr_un addr = { .sun_family = AF_UNIX, }; - socklen_t len; assert(ac == 2); - assert(strlen(av[1]) > 0); + socklen_t len = strlen(av[1]); + assert(len > 0 && len <= sizeof(addr.sun_path)); - strncpy(addr.sun_path, av[1], sizeof(addr.sun_path)); - len = offsetof(struct sockaddr_un, sun_path) + strlen(av[1]) + 1; - if (len > sizeof(addr)) - len = sizeof(addr); + if (++len > sizeof(addr.sun_path)) + len = sizeof(addr.sun_path); + + memcpy(addr.sun_path, av[1], len); + len += offsetof(struct sockaddr_un, sun_path); unlink(av[1]); close(0); diff --git a/tests-mx32/net-y-unix.c b/tests-mx32/net-y-unix.c index fbdf5900..847c7354 100644 --- a/tests-mx32/net-y-unix.c +++ b/tests-mx32/net-y-unix.c @@ -2,6 +2,7 @@ * This file is part of net-y-unix strace test. * * Copyright (c) 2013-2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,10 +35,11 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <sys/param.h> #include <sys/socket.h> #include <sys/un.h> +#include "accept_compat.h" + #define TEST_SOCKET "net-y-unix.socket" int @@ -106,7 +108,7 @@ main(void) struct sockaddr * const accept_sa = tail_alloc(sizeof(addr)); memset(accept_sa, 0, sizeof(addr)); *len = sizeof(addr); - int accept_fd = accept(listen_fd, accept_sa, len); + int accept_fd = do_accept(listen_fd, accept_sa, len); if (accept_fd < 0) perror_msg_and_fail("accept"); unsigned long accept_inode = inode_of_sockfd(accept_fd); @@ -177,7 +179,7 @@ main(void) memset(accept_sa, 0, sizeof(addr)); *len = sizeof(addr); - accept_fd = accept(listen_fd, accept_sa, len); + accept_fd = do_accept(listen_fd, accept_sa, len); if (accept_fd < 0) perror_msg_and_fail("accept"); accept_inode = inode_of_sockfd(accept_fd); diff --git a/tests-mx32/net-yy-inet.c b/tests-mx32/net-yy-inet.c index c043920d..c69bb173 100644 --- a/tests-mx32/net-yy-inet.c +++ b/tests-mx32/net-yy-inet.c @@ -2,7 +2,7 @@ * This file is part of net-yy-inet strace test. * * Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,6 +39,8 @@ #include <netinet/tcp.h> #include <arpa/inet.h> +#include "accept_compat.h" + int main(void) { @@ -105,7 +107,7 @@ main(void) struct sockaddr * const accept_sa = tail_alloc(sizeof(addr)); memset(accept_sa, 0, sizeof(addr)); *len = sizeof(addr); - const int accept_fd = accept(listen_fd, accept_sa, len); + const int accept_fd = do_accept(listen_fd, accept_sa, len); if (accept_fd < 0) perror_msg_and_fail("accept"); const unsigned int connect_port = diff --git a/tests-mx32/net-yy-unix.c b/tests-mx32/net-yy-unix.c index 21822db9..40ac3a63 100644 --- a/tests-mx32/net-yy-unix.c +++ b/tests-mx32/net-yy-unix.c @@ -2,6 +2,7 @@ * This file is part of net-yy-unix strace test. * * Copyright (c) 2013-2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,10 +35,11 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <sys/param.h> #include <sys/socket.h> #include <sys/un.h> +#include "accept_compat.h" + #define TEST_SOCKET "net-yy-unix.socket" int @@ -107,7 +109,7 @@ main(void) struct sockaddr * const accept_sa = tail_alloc(sizeof(addr)); memset(accept_sa, 0, sizeof(addr)); *len = sizeof(addr); - int accept_fd = accept(listen_fd, accept_sa, len); + int accept_fd = do_accept(listen_fd, accept_sa, len); if (accept_fd < 0) perror_msg_and_fail("accept"); unsigned long accept_inode = inode_of_sockfd(accept_fd); @@ -180,7 +182,7 @@ main(void) memset(accept_sa, 0, sizeof(addr)); *len = sizeof(addr); - accept_fd = accept(listen_fd, accept_sa, len); + accept_fd = do_accept(listen_fd, accept_sa, len); if (accept_fd < 0) perror_msg_and_fail("accept"); accept_inode = inode_of_sockfd(accept_fd); diff --git a/tests-mx32/net.expected b/tests-mx32/net.expected index 80dd0701..e33e2966 100644 --- a/tests-mx32/net.expected +++ b/tests-mx32/net.expected @@ -3,5 +3,5 @@ [1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +bind\(0, \{sa_family=AF_(LOCAL|UNIX|FILE), sun_path="net-local-stream"\}, 19\) += 0 [1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +listen\(0, 5\) += 0 [1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +getsockname\(0, \{sa_family=AF_(LOCAL|UNIX|FILE), sun_path="net-local-stream"\}, \[19\]\) += 0 -[1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +accept\(0, \{sa_family=AF_(LOCAL|UNIX|FILE)\}, \[19->2\]\) += 1 +[1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +accept4?\(0, \{sa_family=AF_(LOCAL|UNIX|FILE)\}, \[19->2\](, 0)?\) += 1 [1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +connect\(1, \{sa_family=AF_(LOCAL|UNIX|FILE), sun_path="net-local-stream"\}, 19\) += 0 diff --git a/tests-mx32/netlink_audit.gen.test b/tests-mx32/netlink_audit.gen.test index 65110672..5c17038e 100755 --- a/tests-mx32/netlink_audit.gen.test +++ b/tests-mx32/netlink_audit.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_audit +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_audit +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/netlink_crypto.gen.test b/tests-mx32/netlink_crypto.gen.test index b1380991..fcb4c3d9 100755 --- a/tests-mx32/netlink_crypto.gen.test +++ b/tests-mx32/netlink_crypto.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_crypto +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_crypto +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/netlink_generic.gen.test b/tests-mx32/netlink_generic.gen.test index e51f15ce..6f304d3a 100755 --- a/tests-mx32/netlink_generic.gen.test +++ b/tests-mx32/netlink_generic.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_generic +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_generic +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/netlink_kobject_uevent.gen.test b/tests-mx32/netlink_kobject_uevent.gen.test index 310a70b8..46bdebd1 100755 --- a/tests-mx32/netlink_kobject_uevent.gen.test +++ b/tests-mx32/netlink_kobject_uevent.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_kobject_uevent +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_kobject_uevent +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/netlink_netfilter.gen.test b/tests-mx32/netlink_netfilter.gen.test index fffb72b4..94b3f369 100755 --- a/tests-mx32/netlink_netfilter.gen.test +++ b/tests-mx32/netlink_netfilter.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_netfilter +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_netfilter +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/netlink_route.gen.test b/tests-mx32/netlink_route.gen.test index 298dbf1a..bd9c0d95 100755 --- a/tests-mx32/netlink_route.gen.test +++ b/tests-mx32/netlink_route.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_route +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_route +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/netlink_selinux.gen.test b/tests-mx32/netlink_selinux.gen.test index a8871d6d..484ffae7 100755 --- a/tests-mx32/netlink_selinux.gen.test +++ b/tests-mx32/netlink_selinux.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_selinux +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_selinux +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/netlink_xfrm.gen.test b/tests-mx32/netlink_xfrm.gen.test index 17f7444b..36918982 100755 --- a/tests-mx32/netlink_xfrm.gen.test +++ b/tests-mx32/netlink_xfrm.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_xfrm +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_xfrm +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nfnetlink_acct.gen.test b/tests-mx32/nfnetlink_acct.gen.test index 7db22769..e3aa8892 100755 --- a/tests-mx32/nfnetlink_acct.gen.test +++ b/tests-mx32/nfnetlink_acct.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_acct +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_acct +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nfnetlink_cthelper.gen.test b/tests-mx32/nfnetlink_cthelper.gen.test index 661c949c..fa26e14a 100755 --- a/tests-mx32/nfnetlink_cthelper.gen.test +++ b/tests-mx32/nfnetlink_cthelper.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_cthelper +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_cthelper +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nfnetlink_ctnetlink.gen.test b/tests-mx32/nfnetlink_ctnetlink.gen.test index d4c4daaf..9e9ad153 100755 --- a/tests-mx32/nfnetlink_ctnetlink.gen.test +++ b/tests-mx32/nfnetlink_ctnetlink.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_ctnetlink +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_ctnetlink +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nfnetlink_ctnetlink_exp.gen.test b/tests-mx32/nfnetlink_ctnetlink_exp.gen.test index a5d83f9b..4ed3707e 100755 --- a/tests-mx32/nfnetlink_ctnetlink_exp.gen.test +++ b/tests-mx32/nfnetlink_ctnetlink_exp.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_ctnetlink_exp +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_ctnetlink_exp +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nfnetlink_cttimeout.gen.test b/tests-mx32/nfnetlink_cttimeout.gen.test index e197f000..ab42fc78 100755 --- a/tests-mx32/nfnetlink_cttimeout.gen.test +++ b/tests-mx32/nfnetlink_cttimeout.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_cttimeout +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_cttimeout +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nfnetlink_ipset.gen.test b/tests-mx32/nfnetlink_ipset.gen.test index 418437a7..ea129fbc 100755 --- a/tests-mx32/nfnetlink_ipset.gen.test +++ b/tests-mx32/nfnetlink_ipset.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_ipset +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_ipset +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nfnetlink_nft_compat.gen.test b/tests-mx32/nfnetlink_nft_compat.gen.test index c3dc8907..aff04c5f 100755 --- a/tests-mx32/nfnetlink_nft_compat.gen.test +++ b/tests-mx32/nfnetlink_nft_compat.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_nft_compat +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_nft_compat +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nfnetlink_nftables.gen.test b/tests-mx32/nfnetlink_nftables.gen.test index 25e90e85..c23ad330 100755 --- a/tests-mx32/nfnetlink_nftables.gen.test +++ b/tests-mx32/nfnetlink_nftables.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_nftables +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_nftables +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nfnetlink_osf.gen.test b/tests-mx32/nfnetlink_osf.gen.test index 2689574a..aa540907 100755 --- a/tests-mx32/nfnetlink_osf.gen.test +++ b/tests-mx32/nfnetlink_osf.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_osf +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_osf +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nfnetlink_queue.gen.test b/tests-mx32/nfnetlink_queue.gen.test index 739fb17d..965e0d24 100755 --- a/tests-mx32/nfnetlink_queue.gen.test +++ b/tests-mx32/nfnetlink_queue.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_queue +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_queue +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nfnetlink_ulog.gen.test b/tests-mx32/nfnetlink_ulog.gen.test index 850ebafc..825ad9f6 100755 --- a/tests-mx32/nfnetlink_ulog.gen.test +++ b/tests-mx32/nfnetlink_ulog.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_ulog +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_ulog +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr.gen.test b/tests-mx32/nlattr.gen.test index 105801b9..0ea2f185 100755 --- a/tests-mx32/nlattr.gen.test +++ b/tests-mx32/nlattr.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_br_port_msg.gen.test b/tests-mx32/nlattr_br_port_msg.gen.test index f843797a..c9572759 100755 --- a/tests-mx32/nlattr_br_port_msg.gen.test +++ b/tests-mx32/nlattr_br_port_msg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_br_port_msg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_br_port_msg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_crypto_user_alg.gen.test b/tests-mx32/nlattr_crypto_user_alg.gen.test index 81d866e0..e52b6be7 100755 --- a/tests-mx32/nlattr_crypto_user_alg.gen.test +++ b/tests-mx32/nlattr_crypto_user_alg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_crypto_user_alg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_crypto_user_alg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_dcbmsg.gen.test b/tests-mx32/nlattr_dcbmsg.gen.test index d78bfcf6..f9ef39f7 100755 --- a/tests-mx32/nlattr_dcbmsg.gen.test +++ b/tests-mx32/nlattr_dcbmsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_dcbmsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_dcbmsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_fib_rule_hdr.gen.test b/tests-mx32/nlattr_fib_rule_hdr.gen.test index cbdad4d5..fb61343d 100755 --- a/tests-mx32/nlattr_fib_rule_hdr.gen.test +++ b/tests-mx32/nlattr_fib_rule_hdr.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_fib_rule_hdr +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_fib_rule_hdr +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_ifaddrlblmsg.gen.test b/tests-mx32/nlattr_ifaddrlblmsg.gen.test index 0c41dbe5..0f51430f 100755 --- a/tests-mx32/nlattr_ifaddrlblmsg.gen.test +++ b/tests-mx32/nlattr_ifaddrlblmsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifaddrlblmsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifaddrlblmsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_ifaddrmsg.gen.test b/tests-mx32/nlattr_ifaddrmsg.gen.test index d659e001..3fb81bdb 100755 --- a/tests-mx32/nlattr_ifaddrmsg.gen.test +++ b/tests-mx32/nlattr_ifaddrmsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifaddrmsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifaddrmsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_ifinfomsg.gen.test b/tests-mx32/nlattr_ifinfomsg.gen.test index 618df143..b9a6456a 100755 --- a/tests-mx32/nlattr_ifinfomsg.gen.test +++ b/tests-mx32/nlattr_ifinfomsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifinfomsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifinfomsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_ifla_brport.gen.test b/tests-mx32/nlattr_ifla_brport.gen.test index 48bfed4b..6758d8d1 100755 --- a/tests-mx32/nlattr_ifla_brport.gen.test +++ b/tests-mx32/nlattr_ifla_brport.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifla_brport +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifla_brport +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_ifla_port.gen.test b/tests-mx32/nlattr_ifla_port.gen.test index 605bf045..ecea89a4 100755 --- a/tests-mx32/nlattr_ifla_port.gen.test +++ b/tests-mx32/nlattr_ifla_port.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifla_port +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifla_port +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_ifla_xdp.gen.test b/tests-mx32/nlattr_ifla_xdp.gen.test index a30e8436..c6e0fab3 100755 --- a/tests-mx32/nlattr_ifla_xdp.gen.test +++ b/tests-mx32/nlattr_ifla_xdp.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifla_xdp +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifla_xdp +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_inet_diag_msg.gen.test b/tests-mx32/nlattr_inet_diag_msg.gen.test index 953a7675..953a23df 100755 --- a/tests-mx32/nlattr_inet_diag_msg.gen.test +++ b/tests-mx32/nlattr_inet_diag_msg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_inet_diag_msg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_inet_diag_msg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_inet_diag_req_compat.gen.test b/tests-mx32/nlattr_inet_diag_req_compat.gen.test index bf8b65c8..7b577dc9 100755 --- a/tests-mx32/nlattr_inet_diag_req_compat.gen.test +++ b/tests-mx32/nlattr_inet_diag_req_compat.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_inet_diag_req_compat +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_inet_diag_req_compat +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_inet_diag_req_v2.gen.test b/tests-mx32/nlattr_inet_diag_req_v2.gen.test index 0260bc4a..01c73a13 100755 --- a/tests-mx32/nlattr_inet_diag_req_v2.gen.test +++ b/tests-mx32/nlattr_inet_diag_req_v2.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_inet_diag_req_v2 +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_inet_diag_req_v2 +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_mdba_mdb_entry.gen.test b/tests-mx32/nlattr_mdba_mdb_entry.gen.test index 67253e8e..8d09a033 100755 --- a/tests-mx32/nlattr_mdba_mdb_entry.gen.test +++ b/tests-mx32/nlattr_mdba_mdb_entry.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_mdba_mdb_entry +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_mdba_mdb_entry +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_mdba_router_port.gen.test b/tests-mx32/nlattr_mdba_router_port.gen.test index ce9ea148..97230e84 100755 --- a/tests-mx32/nlattr_mdba_router_port.gen.test +++ b/tests-mx32/nlattr_mdba_router_port.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_mdba_router_port +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_mdba_router_port +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_ndmsg.gen.test b/tests-mx32/nlattr_ndmsg.gen.test index 06b8f1a4..1d2763b0 100755 --- a/tests-mx32/nlattr_ndmsg.gen.test +++ b/tests-mx32/nlattr_ndmsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ndmsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ndmsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_ndtmsg.gen.test b/tests-mx32/nlattr_ndtmsg.gen.test index d75ad57b..bf7d122a 100755 --- a/tests-mx32/nlattr_ndtmsg.gen.test +++ b/tests-mx32/nlattr_ndtmsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ndtmsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ndtmsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_netconfmsg.gen.test b/tests-mx32/nlattr_netconfmsg.gen.test index 9a061cb4..27f3a66b 100755 --- a/tests-mx32/nlattr_netconfmsg.gen.test +++ b/tests-mx32/nlattr_netconfmsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_netconfmsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_netconfmsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_netlink_diag_msg.gen.test b/tests-mx32/nlattr_netlink_diag_msg.gen.test index aa6aabf4..eacc6df4 100755 --- a/tests-mx32/nlattr_netlink_diag_msg.gen.test +++ b/tests-mx32/nlattr_netlink_diag_msg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_netlink_diag_msg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_netlink_diag_msg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_nlmsgerr.gen.test b/tests-mx32/nlattr_nlmsgerr.gen.test index 23df5001..f06ea429 100755 --- a/tests-mx32/nlattr_nlmsgerr.gen.test +++ b/tests-mx32/nlattr_nlmsgerr.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_nlmsgerr +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_nlmsgerr +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_packet_diag_msg.gen.test b/tests-mx32/nlattr_packet_diag_msg.gen.test index 6af8749a..7177ea2a 100755 --- a/tests-mx32/nlattr_packet_diag_msg.gen.test +++ b/tests-mx32/nlattr_packet_diag_msg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_packet_diag_msg +netlink_sock_diag-v.sh); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_packet_diag_msg +netlink_sock_diag-v.sh ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag-v.sh" diff --git a/tests-mx32/nlattr_rtgenmsg.gen.test b/tests-mx32/nlattr_rtgenmsg.gen.test index 0ff6d130..37ec8425 100755 --- a/tests-mx32/nlattr_rtgenmsg.gen.test +++ b/tests-mx32/nlattr_rtgenmsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_rtgenmsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_rtgenmsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_rtmsg.gen.test b/tests-mx32/nlattr_rtmsg.gen.test index 55251431..f075529a 100755 --- a/tests-mx32/nlattr_rtmsg.gen.test +++ b/tests-mx32/nlattr_rtmsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_rtmsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_rtmsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_smc_diag_msg.gen.test b/tests-mx32/nlattr_smc_diag_msg.gen.test index 3e6407e5..e64d21e2 100755 --- a/tests-mx32/nlattr_smc_diag_msg.gen.test +++ b/tests-mx32/nlattr_smc_diag_msg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_smc_diag_msg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_smc_diag_msg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_tc_stats.gen.test b/tests-mx32/nlattr_tc_stats.gen.test index 72780d4a..11cadd2d 100755 --- a/tests-mx32/nlattr_tc_stats.gen.test +++ b/tests-mx32/nlattr_tc_stats.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_tc_stats +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_tc_stats +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_tca_stab.gen.test b/tests-mx32/nlattr_tca_stab.gen.test index 14cd1a54..81d36c70 100755 --- a/tests-mx32/nlattr_tca_stab.gen.test +++ b/tests-mx32/nlattr_tca_stab.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_tca_stab +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_tca_stab +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_tcamsg.gen.test b/tests-mx32/nlattr_tcamsg.gen.test index 7c302073..1a6408d9 100755 --- a/tests-mx32/nlattr_tcamsg.gen.test +++ b/tests-mx32/nlattr_tcamsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_tcamsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_tcamsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_tcmsg.gen.test b/tests-mx32/nlattr_tcmsg.gen.test index f5bf7a92..7e70ca26 100755 --- a/tests-mx32/nlattr_tcmsg.gen.test +++ b/tests-mx32/nlattr_tcmsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_tcmsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_tcmsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nlattr_unix_diag_msg.gen.test b/tests-mx32/nlattr_unix_diag_msg.gen.test index d913afc1..fd5b8286 100755 --- a/tests-mx32/nlattr_unix_diag_msg.gen.test +++ b/tests-mx32/nlattr_unix_diag_msg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_unix_diag_msg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_unix_diag_msg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests-mx32/nsyscalls-d.c b/tests-mx32/nsyscalls-d.c new file mode 100644 index 00000000..1525dea0 --- /dev/null +++ b/tests-mx32/nsyscalls-d.c @@ -0,0 +1,2 @@ +#define DEBUG_PRINT 1 +#include "nsyscalls.c" diff --git a/tests-mx32/nsyscalls-d.test b/tests-mx32/nsyscalls-d.test new file mode 100755 index 00000000..2cca32f1 --- /dev/null +++ b/tests-mx32/nsyscalls-d.test @@ -0,0 +1,26 @@ +#!/bin/sh + +# Check decoding of out-of-range syscalls along with debug ouput + +. "${srcdir=.}/init.sh" + +: ${debug_flag=-d} +NAME=nsyscalls-d + +if [ "$MIPS_ABI" = "o32" ]; then + syscall=syscall + [ -z "$debug_flag" ] || + skip_ "mips $MIPS_ABI is not supported by this test yet" +else + syscall=none +fi + +run_strace $debug_flag -e trace=$syscall ../$NAME "$STRACE_EXE" 9 \ + 2> "$LOG-err-all" > "$EXP" 9> "$EXP-err" + +[ -n "$debug_flag" ] || > "$EXP-err" + +grep "invalid syscall" "$LOG-err-all" > "$LOG-err" + +match_diff "$LOG" "$EXP" +match_diff "$LOG-err" "$EXP-err" diff --git a/tests-mx32/nsyscalls-nd.test b/tests-mx32/nsyscalls-nd.test new file mode 100755 index 00000000..7d2f1e1f --- /dev/null +++ b/tests-mx32/nsyscalls-nd.test @@ -0,0 +1,4 @@ +#!/bin/sh + +debug_flag= +. "${srcdir=.}"/nsyscalls-d.test diff --git a/tests-mx32/nsyscalls.c b/tests-mx32/nsyscalls.c index 29f444a2..9f748673 100644 --- a/tests-mx32/nsyscalls.c +++ b/tests-mx32/nsyscalls.c @@ -2,7 +2,7 @@ * Check decoding of out-of-range syscalls. * * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,6 +32,7 @@ #include "sysent.h" #include <errno.h> #include <stdio.h> +#include <stdlib.h> #include <unistd.h> #include <asm/unistd.h> @@ -43,6 +44,10 @@ static const struct_sysent syscallent[] = { #include "sysent_shorthand_undefs.h" +#ifndef DEBUG_PRINT +# define DEBUG_PRINT 0 +#endif + #if defined __X32_SYSCALL_BIT && defined __NR_read \ && (__X32_SYSCALL_BIT & __NR_read) != 0 # define SYSCALL_BIT __X32_SYSCALL_BIT @@ -50,6 +55,11 @@ static const struct_sysent syscallent[] = { # define SYSCALL_BIT 0 #endif +#if DEBUG_PRINT +static const char *strace_name; +static FILE *debug_out; +#endif + static void test_syscall(const unsigned long nr) { @@ -64,13 +74,19 @@ test_syscall(const unsigned long nr) long rc = syscall(nr | SYSCALL_BIT, a[0], a[1], a[2], a[3], a[4], a[5]); + +#if DEBUG_PRINT + fprintf(debug_out, "%s: pid %d invalid syscall %#lx\n", + strace_name, getpid(), nr | SYSCALL_BIT); +#endif + #ifdef LINUX_MIPSO32 printf("syscall(%#lx, %#lx, %#lx, %#lx, %#lx, %#lx, %#lx)" " = %ld ENOSYS (%m)\n", nr | SYSCALL_BIT, a[0], a[1], a[2], a[3], a[4], a[5], rc); #else - printf("syscall_%lu(%#llx, %#llx, %#llx, %#llx, %#llx, %#llx)" - " = %ld (errno %d)\n", nr, + printf("syscall_%#lx(%#llx, %#llx, %#llx, %#llx, %#llx, %#llx)" + " = %ld (errno %d)\n", nr | SYSCALL_BIT, (unsigned long long) a[0], (unsigned long long) a[1], (unsigned long long) a[2], @@ -82,8 +98,26 @@ test_syscall(const unsigned long nr) } int -main(void) +main(int argc, char *argv[]) { +#if DEBUG_PRINT + if (argc < 3) + error_msg_and_fail("Not enough arguments. " + "Usage: %s STRACE_NAME DEBUG_OUT_FD", + argv[0]); + + strace_name = argv[1]; + + errno = 0; + int debug_out_fd = strtol(argv[2], NULL, 0); + if (errno) + error_msg_and_fail("Not a number: %s", argv[2]); + + debug_out = fdopen(debug_out_fd, "a"); + if (!debug_out) + perror_msg_and_fail("fdopen: %d", debug_out_fd); +#endif + test_syscall(ARRAY_SIZE(syscallent)); #ifdef SYS_socket_subcall diff --git a/tests-mx32/old_mmap-P.c b/tests-mx32/old_mmap-P.c new file mode 100644 index 00000000..bb28e889 --- /dev/null +++ b/tests-mx32/old_mmap-P.c @@ -0,0 +1,3 @@ +#define TEST_FD 9 +#define PATH_TRACING +#include "old_mmap.c" diff --git a/tests-mx32/old_mmap-P.gen.test b/tests-mx32/old_mmap-P.gen.test new file mode 100755 index 00000000..b1de9345 --- /dev/null +++ b/tests-mx32/old_mmap-P.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (old_mmap-P -e trace=mmap -P "/dev/full" 9>>/dev/full); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -e trace=mmap -P "/dev/full" 9>>/dev/full diff --git a/tests-mx32/old_mmap-v-none.c b/tests-mx32/old_mmap-v-none.c new file mode 100644 index 00000000..033503cc --- /dev/null +++ b/tests-mx32/old_mmap-v-none.c @@ -0,0 +1 @@ +#include "old_mmap.c" diff --git a/tests-mx32/old_mmap-v-none.gen.test b/tests-mx32/old_mmap-v-none.gen.test new file mode 100755 index 00000000..a568d989 --- /dev/null +++ b/tests-mx32/old_mmap-v-none.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (old_mmap-v-none -a11 -e trace=mmap -e verbose=none); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a11 -e trace=mmap -e verbose=none diff --git a/tests-mx32/old_mmap.c b/tests-mx32/old_mmap.c index 2725fb75..35ec4288 100644 --- a/tests-mx32/old_mmap.c +++ b/tests-mx32/old_mmap.c @@ -2,6 +2,7 @@ * Check decoding of "old mmap" edition of mmap syscall. * * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,57 +37,64 @@ * it would require additional efforts to filter out mmap calls made by glibc. */ -#if defined __NR_mmap && \ -( defined __arm__ \ - || defined __i386__ \ - || (defined __s390__ && !defined __s390x__) \ -) +#if defined __NR_mmap \ + && (defined __arm__ || defined __i386__ || defined __m68k__ \ + || defined __s390__ || defined __s390x__) \ + && (defined PATH_TRACING || !(defined __s390x__ || defined __m68k__)) # include <stdio.h> # include <string.h> # include <sys/mman.h> # include <unistd.h> +# ifndef TEST_FD +# define TEST_FD -2LU +# endif + int main(void) { long rc = syscall(__NR_mmap, 0); +# ifndef PATH_TRACING printf("mmap(NULL) = %ld %s (%m)\n", rc, errno2name()); +# endif - const unsigned int args1_c[6] = { - 0xdeadbeef, /* addr */ - 0xfacefeed, /* len */ + const unsigned long args1_c[6] = { + (unsigned long) 0xbadc0deddeadbeefULL, /* addr */ + (unsigned long) 0xdeefacedfacefeedULL, /* len */ PROT_READ|PROT_EXEC, /* prot */ MAP_FILE|MAP_FIXED, /* flags */ - -2U, /* fd */ - 0xbadc0ded /* offset */ + TEST_FD, /* fd */ + (unsigned long) 0xdecaffedbadc0dedULL /* offset */ }; - const unsigned int page_size = get_page_size(); - const unsigned int args2_c[6] = { + const unsigned long page_size = get_page_size(); + const unsigned long args2_c[6] = { 0, page_size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, - -1U, - 0xfaced000 & -page_size + -1LU, + (unsigned long) 0xda7a1057faced000ULL & -page_size }; void *args = tail_memdup(args1_c, sizeof(args1_c)); rc = syscall(__NR_mmap, args); - printf("mmap(%#x, %u, PROT_READ|PROT_EXEC, MAP_FILE|MAP_FIXED" - ", %d, %#x) = %ld %s (%m)\n", - args1_c[0], args1_c[1], args1_c[4], args1_c[5], + printf("mmap(%#lx, %lu, PROT_READ|PROT_EXEC, MAP_FILE|MAP_FIXED" + ", %d, %#lx) = %ld %s (%m)\n", + args1_c[0], args1_c[1], (int) args1_c[4], args1_c[5], rc, errno2name()); memcpy(args, args2_c, sizeof(args2_c)); rc = syscall(__NR_mmap, args); - printf("mmap(NULL, %u, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS" - ", %d, %#x) = %#lx\n", - args2_c[1], args2_c[4], args2_c[5], rc); +# ifndef PATH_TRACING + printf("mmap(NULL, %lu, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS" + ", %d, %#lx) = %#lx\n", + args2_c[1], (int) args2_c[4], args2_c[5], rc); +# endif void *addr = (void *) rc; if (mprotect(addr, page_size, PROT_NONE)) - perror_msg_and_fail("mprotect(%p, %u, PROT_NONE)", + perror_msg_and_fail("mprotect(%p, %lu, PROT_NONE)", addr, page_size); puts("+++ exited with 0 +++"); @@ -95,7 +103,9 @@ main(void) #else -SKIP_MAIN_UNDEFINED("__NR_mmap && (__arm__ || __i386__" - " || (__s390__ && !__s390x__))") +SKIP_MAIN_UNDEFINED("defined __NR_mmap " + "&& (defined __arm__ || defined __i386__ || defined __m68k__ " + "|| defined __s390__ || defined __s390x__) " + "&& (defined PATH_TRACING || !(defined __s390x__ || defined __m68k__))") #endif diff --git a/tests-mx32/oldselect-P.c b/tests-mx32/oldselect-P.c new file mode 100644 index 00000000..67e21343 --- /dev/null +++ b/tests-mx32/oldselect-P.c @@ -0,0 +1,2 @@ +#define PATH_TRACING_FD 9 +#include "oldselect.c" diff --git a/tests-mx32/oldselect-P.gen.test b/tests-mx32/oldselect-P.gen.test new file mode 100755 index 00000000..3486ffd6 --- /dev/null +++ b/tests-mx32/oldselect-P.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (oldselect-P -a13 -e trace=select -P /dev/full 9>>/dev/full); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a13 -e trace=select -P /dev/full 9>>/dev/full diff --git a/tests-mx32/oldselect-efault-P.c b/tests-mx32/oldselect-efault-P.c new file mode 100644 index 00000000..9ebf73d2 --- /dev/null +++ b/tests-mx32/oldselect-efault-P.c @@ -0,0 +1,2 @@ +#define PATH_TRACING_FD 9 +#include "oldselect-efault.c" diff --git a/tests-mx32/oldselect-efault-P.gen.test b/tests-mx32/oldselect-efault-P.gen.test new file mode 100755 index 00000000..a3d71768 --- /dev/null +++ b/tests-mx32/oldselect-efault-P.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (oldselect-efault-P -a13 -e trace=select -P /dev/full 9>>/dev/full); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a13 -e trace=select -P /dev/full 9>>/dev/full diff --git a/tests-mx32/oldselect-efault.c b/tests-mx32/oldselect-efault.c new file mode 100644 index 00000000..3c443341 --- /dev/null +++ b/tests-mx32/oldselect-efault.c @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2015-2018 Dmitry V. Levin <ldv@altlinux.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" +#include <asm/unistd.h> + +#if defined __NR_select && defined __NR__newselect \ + && __NR_select != __NR__newselect \ + && !defined __sparc__ + +# include <stdint.h> +# include <stdio.h> +# include <string.h> +# include <unistd.h> +# include <sys/select.h> + +static const char *errstr; + +static long +xselect(const kernel_ulong_t args) +{ + static const kernel_ulong_t dummy = F8ILL_KULONG_MASK | 0xfacefeed; + long rc = syscall(__NR_select, args, dummy, dummy, dummy, dummy, dummy); + errstr = sprintrc(rc); + return rc; +} + +int +main(void) +{ + unsigned long *const args = tail_alloc(sizeof(*args) * 4); + memset(args, 0, sizeof(*args) * 4); + + xselect(0); +#ifndef PATH_TRACING_FD + printf("select(NULL) = %s\n", errstr); +#endif + + xselect((uintptr_t) args); +#ifndef PATH_TRACING_FD + printf("select(%p) = %s\n", args, errstr); +#endif + + puts("+++ exited with 0 +++"); + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_select && __NR__newselect" + " && __NR_select != __NR__newselect" + " && !defined __sparc__") + +#endif diff --git a/tests-mx32/oldselect-efault.gen.test b/tests-mx32/oldselect-efault.gen.test new file mode 100755 index 00000000..bfeb5571 --- /dev/null +++ b/tests-mx32/oldselect-efault.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (oldselect-efault -a13 -e trace=select); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a13 -e trace=select diff --git a/tests-mx32/oldselect.c b/tests-mx32/oldselect.c index 7413fc33..7f548f81 100644 --- a/tests-mx32/oldselect.c +++ b/tests-mx32/oldselect.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2015-2018 Dmitry V. Levin <ldv@altlinux.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,37 +30,38 @@ #if defined __NR_select && defined __NR__newselect \ && __NR_select != __NR__newselect \ - && !defined SPARC + && !defined __sparc__ -# include <unistd.h> -# include <sys/select.h> +# define TEST_SYSCALL_NR __NR_select +# define TEST_SYSCALL_STR "select" +# define xselect xselect +# include "xselect.c" -int -main(void) -{ - int fds[2]; - fd_set r = {}, w = {}; - struct timeval timeout = { .tv_sec = 0, .tv_usec = 42 }; - long args[] = { - 2, (long) &r, (long) &w, 0, (long) &timeout, - 0xdeadbeef, 0xbadc0ded, 0xdeadbeef, 0xbadc0ded, 0xdeadbeef - }; - - (void) close(0); - (void) close(1); - if (pipe(fds)) - perror_msg_and_fail("pipe"); +static uint32_t *args; - FD_SET(0, &w); - FD_SET(1, &r); - if (syscall(__NR_select, args)) - perror_msg_and_skip("select"); - - return 0; +static long +xselect(const kernel_ulong_t nfds, + const kernel_ulong_t rs, + const kernel_ulong_t ws, + const kernel_ulong_t es, + const kernel_ulong_t tv) +{ + if (!args) + args = tail_alloc(sizeof(*args) * 5); + args[0] = nfds; + args[1] = rs; + args[2] = ws; + args[3] = es; + args[4] = tv; + long rc = syscall(TEST_SYSCALL_NR, args); + errstr = sprintrc(rc); + return rc; } #else -SKIP_MAIN_UNDEFINED("__NR_select && __NR__newselect") +SKIP_MAIN_UNDEFINED("__NR_select && __NR__newselect" + " && __NR_select != __NR__newselect" + " && !defined __sparc__") #endif diff --git a/tests-mx32/oldselect.expected b/tests-mx32/oldselect.expected deleted file mode 100644 index d6e7f3c4..00000000 --- a/tests-mx32/oldselect.expected +++ /dev/null @@ -1,2 +0,0 @@ -select(2, [1], [0], NULL, {tv_sec=0, tv_usec=42}) = 0 (Timeout) -+++ exited with 0 +++ diff --git a/tests-mx32/oldselect.gen.test b/tests-mx32/oldselect.gen.test new file mode 100755 index 00000000..1f10cbe3 --- /dev/null +++ b/tests-mx32/oldselect.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (oldselect -a13 -e trace=select); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a13 -e trace=select diff --git a/tests-mx32/oldselect.test b/tests-mx32/oldselect.test deleted file mode 100755 index 35661ad4..00000000 --- a/tests-mx32/oldselect.test +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# Check old select syscall decoding. - -. "${srcdir=.}/init.sh" - -run_prog -run_strace -a34 -eselect $args -match_diff - -exit 0 diff --git a/tests-mx32/open.c b/tests-mx32/open.c index 01e89b0f..fe486c58 100644 --- a/tests-mx32/open.c +++ b/tests-mx32/open.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,7 +31,7 @@ #ifdef __NR_open -# include <fcntl.h> +# include <asm/fcntl.h> # include <stdio.h> # include <unistd.h> @@ -56,16 +57,11 @@ main(void) sample, sprintrc(fd)); } -#ifdef O_TMPFILE -# if O_TMPFILE == (O_TMPFILE & ~O_DIRECTORY) -# define STR_O_TMPFILE "O_TMPFILE" -# else -# define STR_O_TMPFILE "O_DIRECTORY|O_TMPFILE" -# endif +# ifdef O_TMPFILE fd = syscall(__NR_open, sample, O_WRONLY|O_TMPFILE, 0600); - printf("open(\"%s\", O_WRONLY|%s, 0600) = %s\n", - sample, STR_O_TMPFILE, sprintrc(fd)); -#endif /* O_TMPFILE */ + printf("open(\"%s\", O_WRONLY|O_TMPFILE, 0600) = %s\n", + sample, sprintrc(fd)); +# endif /* O_TMPFILE */ puts("+++ exited with 0 +++"); return 0; diff --git a/tests-mx32/openat.c b/tests-mx32/openat.c index 1d6765cf..8c97441a 100644 --- a/tests-mx32/openat.c +++ b/tests-mx32/openat.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2016 Katerina Koukiou <k.koukiou@gmail.com> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -28,17 +29,36 @@ #include "tests.h" #include <asm/unistd.h> -#if defined __NR_openat +#ifdef __NR_openat -# include <fcntl.h> +# include <asm/fcntl.h> # include <stdio.h> # include <unistd.h> +#ifdef O_TMPFILE +/* The kernel & C libraries often inline O_DIRECTORY. */ +# define STRACE_O_TMPFILE (O_TMPFILE & ~O_DIRECTORY) +#else +# define STRACE_O_TMPFILE 0 +#endif + +static const char sample[] = "openat.sample"; + +static void +test_mode_flag(unsigned int mode_val, const char *mode_str, + unsigned int flag_val, const char *flag_str) +{ + long rc = syscall(__NR_openat, -1, sample, mode_val | flag_val, 0); + printf("openat(-1, \"%s\", %s%s%s%s) = %s\n", + sample, mode_str, + flag_val ? "|" : "", flag_str, + flag_val & (O_CREAT | STRACE_O_TMPFILE) ? ", 000" : "", + sprintrc(rc)); +} + int main(void) { - static const char sample[] = "openat.sample"; - long fd = syscall(__NR_openat, -100, sample, O_RDONLY|O_CREAT, 0400); printf("openat(AT_FDCWD, \"%s\", O_RDONLY|O_CREAT, 0400) = %s\n", sample, sprintrc(fd)); @@ -53,6 +73,54 @@ main(void) sample, sprintrc(fd)); } + struct { + unsigned int val; + const char *str; + } modes[] = { + { ARG_STR(O_RDONLY) }, + { ARG_STR(O_WRONLY) }, + { ARG_STR(O_RDWR) }, + { ARG_STR(O_ACCMODE) } + }, flags[] = { + { ARG_STR(O_APPEND) }, + { ARG_STR(O_DIRECT) }, + { ARG_STR(O_DIRECTORY) }, + { ARG_STR(O_EXCL) }, + { ARG_STR(O_LARGEFILE) }, + { ARG_STR(O_NOATIME) }, + { ARG_STR(O_NOCTTY) }, + { ARG_STR(O_NOFOLLOW) }, + { ARG_STR(O_NONBLOCK) }, + { ARG_STR(O_SYNC) }, + { ARG_STR(O_TRUNC) }, + { ARG_STR(O_CREAT) }, +# ifdef O_CLOEXEC + { ARG_STR(O_CLOEXEC) }, +# endif +# ifdef O_DSYNC + { ARG_STR(O_DSYNC) }, +# endif +# ifdef __O_SYNC + { ARG_STR(__O_SYNC) }, +# endif +# ifdef O_PATH + { ARG_STR(O_PATH) }, +# endif +# ifdef O_TMPFILE + { ARG_STR(O_TMPFILE) }, +# endif +# ifdef __O_TMPFILE + { ARG_STR(__O_TMPFILE) }, +# endif + { ARG_STR(0x80000000) }, + { 0, "" } + }; + + for (unsigned int m = 0; m < ARRAY_SIZE(modes); ++m) + for (unsigned int f = 0; f < ARRAY_SIZE(flags); ++f) + test_mode_flag(modes[m].val, modes[m].str, + flags[f].val, flags[f].str); + puts("+++ exited with 0 +++"); return 0; } diff --git a/tests-mx32/openat.gen.test b/tests-mx32/openat.gen.test index fe29e1ca..29dd3491 100755 --- a/tests-mx32/openat.gen.test +++ b/tests-mx32/openat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (openat -P $NAME.sample); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (openat -a36 -P $NAME.sample); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -P $NAME.sample +run_strace_match_diff -a36 -P $NAME.sample diff --git a/tests-mx32/options-syntax.test b/tests-mx32/options-syntax.test index 2e459c96..f81dd992 100755 --- a/tests-mx32/options-syntax.test +++ b/tests-mx32/options-syntax.test @@ -3,7 +3,7 @@ # Check strace options syntax. # # Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> -# Copyright (c) 2016-2017 The strace developers. +# Copyright (c) 2016-2018 The strace developers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -37,33 +37,10 @@ check_e "Invalid process id: 'a'" -p 1,a check_e "Syscall 'chdir' for -b isn't supported" -b chdir check_e "Syscall 'chdir' for -b isn't supported" -b execve -b chdir -check_e "invalid system call '-1'" -e-1 -check_e "invalid system call '-2'" -e -2 -check_e "invalid system call '-3'" -etrace=-3 -check_e "invalid system call '-4'" -e trace=-4 -check_e "invalid system call '-5'" -e trace=1,-5 -check_e "invalid system call '/non_syscall'" -e trace=/non_syscall -check_e "invalid system call '2147483647'" -e 2147483647 -check_e "invalid system call '2147483648'" -e 2147483648 -check_e "invalid system call '4294967295'" -e 4294967295 -check_e "invalid system call '4294967296'" -e 4294967296 +check_e_using_grep 'exec: File *name too long' "$(printf '%4096s' ' ')" -check_e "invalid descriptor '-1'" -eread=-1 -check_e "invalid descriptor '-42'" -ewrite=-42 -check_e "invalid descriptor '2147483648'" -eread=2147483648 -check_e "invalid descriptor '4294967296'" -ewrite=4294967296 -check_e "invalid descriptor 'foo'" -eread=foo -check_e "invalid descriptor ''" -ewrite= -check_e "invalid descriptor ','" -eread=, -check_e "invalid descriptor '!'" -ewrite='!' -check_e "invalid descriptor '!'" -eread='0,!' -check_e "invalid descriptor '!,'" -ewrite='!,' - -check_e_using_grep 'regcomp: \+id: [[:alpha:]].+' -e trace='/+id' -check_e_using_grep 'regcomp: \*id: [[:alpha:]].+' -e trace='/*id' -check_e_using_grep 'regcomp: \{id: [[:alpha:]].+' -e trace='/{id' -check_e_using_grep 'regcomp: \(id: [[:alpha:]].+' -e trace='/(id' -check_e_using_grep 'regcomp: \[id: [[:alpha:]].+' -e trace='/[id' +ff_name="$(printf '%4084s' ' ')" +check_e_using_grep "$ff_name: File *name too long" -ff -o "$ff_name" true check_h 'must have PROG [ARGS] or -p PID' check_h 'PROG [ARGS] must be specified with -D' -D -p $$ @@ -80,12 +57,12 @@ check_h "invalid -s argument: '-42'" -s -42 check_h "invalid -s argument: '1073741824'" -s 1073741824 check_h "invalid -I argument: '5'" -I 5 -../zeroargc "$strace_exp" /bin/true 2> "$LOG" && +../zeroargc "$STRACE_EXE" /bin/true 2> "$LOG" && dump_log_and_fail_with \ 'zeroargc strace failed to handle the error properly' cat > "$EXP" << __EOF__ -$strace_exp: must have PROG [ARGS] or -p PID -Try '$strace_exp -h' for more information. +$STRACE_EXE: must have PROG [ARGS] or -p PID +Try '$STRACE_EXE -h' for more information. __EOF__ diff -u -- "$EXP" "$LOG" > /dev/null || { cat > "$EXP" <<- '__EOF__' @@ -107,17 +84,17 @@ if [ -n "${UID-}" ]; then for c in i r t T y; do check_e "-$c has no effect with -c -$strace_exp: $umsg" -u :nosuchuser: -c -$c true +$STRACE_EXE: $umsg" -u :nosuchuser: -c -$c true done check_e "-i has no effect with -c -$strace_exp: -r has no effect with -c -$strace_exp: -t has no effect with -c -$strace_exp: -T has no effect with -c -$strace_exp: -y has no effect with -c -$strace_exp: $umsg" -u :nosuchuser: -cirtTy true +$STRACE_EXE: -r has no effect with -c +$STRACE_EXE: -t has no effect with -c +$STRACE_EXE: -T has no effect with -c +$STRACE_EXE: -y has no effect with -c +$STRACE_EXE: $umsg" -u :nosuchuser: -cirtTy true check_e "-tt has no effect with -r -$strace_exp: $umsg" -u :nosuchuser: -r -tt true +$STRACE_EXE: $umsg" -u :nosuchuser: -r -tt true fi args='-p 2147483647' @@ -127,7 +104,7 @@ $STRACE $args 2> "$LOG" && for cmd in PTRACE_SEIZE PTRACE_ATTACH; do cat > "$EXP" << __EOF__ -$strace_exp: attach: ptrace($cmd, 2147483647): No such process +$STRACE_EXE: attach: ptrace($cmd, 2147483647): No such process __EOF__ diff -- "$EXP" "$LOG" || continue diff --git a/tests-mx32/osf_utimes.gen.test b/tests-mx32/osf_utimes.gen.test index b6be305d..9e683b47 100755 --- a/tests-mx32/osf_utimes.gen.test +++ b/tests-mx32/osf_utimes.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (osf_utimes -a21); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (osf_utimes -a21 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a21 +run_strace_match_diff -a21 diff --git a/tests-mx32/perf_event_open.c b/tests-mx32/perf_event_open.c index 74ff9527..667c31f4 100644 --- a/tests-mx32/perf_event_open.c +++ b/tests-mx32/perf_event_open.c @@ -2,7 +2,7 @@ * Check verbose decoding of perf_event_open syscall. * * Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -102,7 +102,8 @@ struct pea_flags { use_clockid :1, context_switch :1, write_backward :1, - __reserved_1 :36; + namespaces :1, + __reserved_1 :35; }; static const char * @@ -351,9 +352,17 @@ print_event_attr(struct perf_event_attr *attr_ptr, size_t size, # endif printf(", write_backward=%" PRIu64, val); + val = +# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_NAMESPACES + attr->namespaces; +# else + flags_data.flags.namespaces; +# endif + printf(", namespaces=%" PRIu64, val); + val = flags_data.flags.__reserved_1; if (val) - printf(", __reserved_1=%#" PRIx64 " /* Bits 63..28 */", val); + printf(", __reserved_1=%#" PRIx64 " /* Bits 63..29 */", val); printf(", %s=%u", attr->watermark ? "wakeup_watermark" : "wakeup_events", @@ -523,7 +532,8 @@ end: "PERF_SAMPLE_BRANCH_IND_JUMP|" \ "PERF_SAMPLE_BRANCH_CALL|" \ "PERF_SAMPLE_BRANCH_NO_FLAGS|" \ - "PERF_SAMPLE_BRANCH_NO_CYCLES" + "PERF_SAMPLE_BRANCH_NO_CYCLES|" \ + "PERF_SAMPLE_BRANCH_TYPE_SAVE" int main(void) @@ -608,7 +618,7 @@ main(void) static const struct u64_val_str sample_types[] = { { ARG_STR(0) }, { 0x800, "PERF_SAMPLE_BRANCH_STACK" }, - { ARG_ULL_STR(0xdeadc0deda780000) " /* PERF_SAMPLE_??? */" }, + { ARG_ULL_STR(0xdeadc0deda700000) " /* PERF_SAMPLE_??? */" }, { 0xffffffffffffffffULL, "PERF_SAMPLE_IP|PERF_SAMPLE_TID|PERF_SAMPLE_TIME|" "PERF_SAMPLE_ADDR|PERF_SAMPLE_READ|" @@ -618,7 +628,8 @@ main(void) "PERF_SAMPLE_REGS_USER|PERF_SAMPLE_STACK_USER|" "PERF_SAMPLE_WEIGHT|PERF_SAMPLE_DATA_SRC|" "PERF_SAMPLE_IDENTIFIER|PERF_SAMPLE_TRANSACTION|" - "PERF_SAMPLE_REGS_INTR|0xfffffffffff80000" }, + "PERF_SAMPLE_REGS_INTR|PERF_SAMPLE_PHYS_ADDR|" + "0xfffffffffff00000" }, }; static const struct u64_val_str read_formats[] = { { ARG_STR(0) }, @@ -650,11 +661,11 @@ main(void) static const struct u64_val_str branch_sample_types[] = { { ARG_STR(0) }, { 0x80, "PERF_SAMPLE_BRANCH_ABORT_TX" }, - { 0xffff, BRANCH_TYPE_ALL }, - { ARG_ULL_STR(0xdeadcaffeeed0000) + { 0x1ffff, BRANCH_TYPE_ALL }, + { ARG_ULL_STR(0xdeadcaffeeec0000) " /* PERF_SAMPLE_BRANCH_??? */" }, { 0xffffffffffffffffULL, - BRANCH_TYPE_ALL "|0xffffffffffff0000" } + BRANCH_TYPE_ALL "|0xfffffffffffe0000" } }; static const struct s32_val_str clockids[] = { { 11, "CLOCK_TAI" }, diff --git a/tests-mx32/perf_event_open.gen.test b/tests-mx32/perf_event_open.gen.test index 85336c3e..02d468ab 100755 --- a/tests-mx32/perf_event_open.gen.test +++ b/tests-mx32/perf_event_open.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (perf_event_open -a1); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (perf_event_open -a1 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a1 +run_strace_match_diff -a1 diff --git a/tests-mx32/pipe2.gen.test b/tests-mx32/pipe2.gen.test index 5a06c030..50b8fd64 100755 --- a/tests-mx32/pipe2.gen.test +++ b/tests-mx32/pipe2.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pipe2 -a15); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pipe2 -a15 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a15 +run_strace_match_diff -a15 diff --git a/tests-mx32/pkey_alloc.c b/tests-mx32/pkey_alloc.c index 45772787..4a0aa720 100644 --- a/tests-mx32/pkey_alloc.c +++ b/tests-mx32/pkey_alloc.c @@ -2,6 +2,7 @@ * Check decoding of pkey_alloc syscall. * * Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,10 +54,12 @@ main(void) sizeof(kernel_ulong_t) > sizeof(int) ? "PKEY_DISABLE_WRITE|0xbadc0ded00000000" : "PKEY_DISABLE_WRITE" }, - { 0xdec0ded, "PKEY_DISABLE_ACCESS|0xdec0dec" }, - { 0x3, "PKEY_DISABLE_ACCESS|PKEY_DISABLE_WRITE" }, + { 0xdec0ded, "PKEY_DISABLE_ACCESS|PKEY_DISABLE_EXECUTE|" + "0xdec0de8" }, + { 0x7, "PKEY_DISABLE_ACCESS|PKEY_DISABLE_WRITE|" + "PKEY_DISABLE_EXECUTE" }, { ARG_STR(0) }, - { 0xbadc0dec, "0xbadc0dec /* PKEY_??? */" }, + { 0xbadc0de8, "0xbadc0de8 /* PKEY_??? */" }, }; long rc; diff --git a/tests-mx32/pkey_alloc.gen.test b/tests-mx32/pkey_alloc.gen.test index b3e58692..fb554efc 100755 --- a/tests-mx32/pkey_alloc.gen.test +++ b/tests-mx32/pkey_alloc.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pkey_alloc -a17); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pkey_alloc -a17 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a17 +run_strace_match_diff -a17 diff --git a/tests-mx32/pkey_free.gen.test b/tests-mx32/pkey_free.gen.test index 588d1aa6..0374cc73 100755 --- a/tests-mx32/pkey_free.gen.test +++ b/tests-mx32/pkey_free.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pkey_free -a13); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pkey_free -a13 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a13 +run_strace_match_diff -a13 diff --git a/tests-mx32/pkey_mprotect.gen.test b/tests-mx32/pkey_mprotect.gen.test index 14be2311..11a902a5 100755 --- a/tests-mx32/pkey_mprotect.gen.test +++ b/tests-mx32/pkey_mprotect.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pkey_mprotect -a37); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pkey_mprotect -a37 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a37 +run_strace_match_diff -a37 diff --git a/tests-mx32/poll-P.c b/tests-mx32/poll-P.c new file mode 100644 index 00000000..7bbeb795 --- /dev/null +++ b/tests-mx32/poll-P.c @@ -0,0 +1,2 @@ +#define PATH_TRACING_FD 9 +#include "poll.c" diff --git a/tests-mx32/poll-P.test b/tests-mx32/poll-P.test new file mode 100755 index 00000000..a1905723 --- /dev/null +++ b/tests-mx32/poll-P.test @@ -0,0 +1,17 @@ +#!/bin/sh + +# Check path tracing of poll syscall. + +. "${srcdir=.}/init.sh" + +run_prog > /dev/null +run_strace -a16 -vepoll -P /dev/full 9>>/dev/full \ + $args > "$EXP" +match_diff "$LOG" "$EXP" + +for abbrev in 0 1 2 3 4 5; do + run_prog "../$NAME" $abbrev > /dev/null + run_strace -a16 -epoll -s$abbrev -P /dev/full 9>>/dev/full \ + $args > "$EXP" + match_diff "$LOG" "$EXP" +done diff --git a/tests-mx32/poll.c b/tests-mx32/poll.c index 2bf8c1a1..c5930a3e 100644 --- a/tests-mx32/poll.c +++ b/tests-mx32/poll.c @@ -1,8 +1,7 @@ /* - * This file is part of poll strace test. + * Check decoding of poll syscall. * - * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 Dmitry V. Levin <ldv@altlinux.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,6 +37,7 @@ # include <poll.h> # include <stdio.h> # include <stdlib.h> +# include <string.h> # include <unistd.h> #define PRINT_EVENT(flag, member) \ @@ -163,12 +163,19 @@ print_pollfd_array_exiting(const struct pollfd *const pfd, int main(int ac, char **av) { +# ifdef PATH_TRACING_FD + skip_if_unavailable("/proc/self/fd/"); +# endif + tprintf("%s", ""); assert(syscall(__NR_poll, NULL, 42, 0) == -1); if (ENOSYS == errno) perror_msg_and_skip("poll"); + +# ifndef PATH_TRACING_FD tprintf("poll(NULL, 42, 0) = -1 EFAULT (%m)\n"); +# endif int fds[2]; if (pipe(fds) || pipe(fds)) @@ -187,11 +194,14 @@ main(int ac, char **av) int rc = syscall(__NR_poll, tail_fds0, 0, timeout); assert(rc == 0); +# ifndef PATH_TRACING_FD tprintf("poll([], 0, %d) = %d (Timeout)\n", timeout, rc); +# endif rc = syscall(__NR_poll, tail_fds0, ARRAY_SIZE(pfds0), timeout); assert(rc == 3); +# ifndef PATH_TRACING_FD tprintf("poll("); print_pollfd_array_entering(tail_fds0, ARRAY_SIZE(pfds0), ARRAY_SIZE(pfds0), abbrev); @@ -199,6 +209,7 @@ main(int ac, char **av) (unsigned int) ARRAY_SIZE(pfds0), timeout, rc); print_pollfd_array_exiting(tail_fds0, ARRAY_SIZE(pfds0), abbrev); tprintf(")\n"); +# endif /* !PATH_TRACING_FD */ tail_fds0[0].fd = -1; tail_fds0[2].fd = -3; @@ -206,6 +217,7 @@ main(int ac, char **av) rc = syscall(__NR_poll, tail_fds0, ARRAY_SIZE(pfds0), timeout); assert(rc == 2); +# ifndef PATH_TRACING_FD tprintf("poll("); print_pollfd_array_entering(tail_fds0, ARRAY_SIZE(pfds0), ARRAY_SIZE(pfds0), abbrev); @@ -213,12 +225,14 @@ main(int ac, char **av) (unsigned int) ARRAY_SIZE(pfds0), timeout, rc); print_pollfd_array_exiting(tail_fds0, ARRAY_SIZE(pfds0), abbrev); tprintf(")\n"); +# endif /* !PATH_TRACING_FD */ tail_fds0[1].fd = -2; tail_fds0[4].fd = -5; rc = syscall(__NR_poll, tail_fds0, ARRAY_SIZE(pfds0), timeout); assert(rc == 1); +# ifndef PATH_TRACING_FD tprintf("poll("); print_pollfd_array_entering(tail_fds0, ARRAY_SIZE(pfds0), ARRAY_SIZE(pfds0), abbrev); @@ -226,6 +240,7 @@ main(int ac, char **av) (unsigned int) ARRAY_SIZE(pfds0), timeout, rc); print_pollfd_array_exiting(tail_fds0, ARRAY_SIZE(pfds0), abbrev); tprintf(")\n"); +# endif /* !PATH_TRACING_FD */ struct pollfd pfds1[] = { { .fd = 1, .events = POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND }, @@ -235,25 +250,58 @@ main(int ac, char **av) rc = syscall(__NR_poll, tail_fds1, ARRAY_SIZE(pfds1), timeout); assert(rc == 0); +# ifndef PATH_TRACING_FD tprintf("poll("); print_pollfd_array_entering(tail_fds1, ARRAY_SIZE(pfds1), ARRAY_SIZE(pfds1), abbrev); tprintf(", %u, %d) = %d (Timeout)\n", (unsigned int) ARRAY_SIZE(pfds1), timeout, rc); +# endif /* !PATH_TRACING_FD */ const void *const efault = tail_fds0 + ARRAY_SIZE(pfds0); rc = syscall(__NR_poll, efault, 1, 0); assert(rc == -1); + +# ifndef PATH_TRACING_FD tprintf("poll(%p, 1, 0) = -1 EFAULT (%m)\n", efault); +# endif const unsigned int valid = 1; const void *const epfds = tail_fds0 + ARRAY_SIZE(pfds0) - valid; rc = syscall(__NR_poll, epfds, valid + 1, 0); assert(rc == -1); + +# ifndef PATH_TRACING_FD + tprintf("poll("); + print_pollfd_array_entering(epfds, valid + 1, valid, abbrev); + errno = EFAULT; + tprintf(", %u, 0) = -1 EFAULT (%m)\n", valid + 1); +# endif /* !PATH_TRACING_FD */ + +# ifdef PATH_TRACING_FD + memcpy(tail_fds0, pfds0, sizeof(pfds0)); + tail_fds0[4].fd = PATH_TRACING_FD; + + rc = syscall(__NR_poll, tail_fds0, ARRAY_SIZE(pfds0), timeout); + assert(rc == 3); + + tprintf("poll("); + print_pollfd_array_entering(tail_fds0, ARRAY_SIZE(pfds0), + ARRAY_SIZE(pfds0), abbrev); + tprintf(", %u, %d) = %d (", + (unsigned int) ARRAY_SIZE(pfds0), timeout, rc); + print_pollfd_array_exiting(tail_fds0, ARRAY_SIZE(pfds0), abbrev); + tprintf(")\n"); + + rc = syscall(__NR_poll, epfds, valid + 1, 0); + assert(rc == -1); + + /* the 1st pollfd element is readable and contains PATH_TRACING_FD */ tprintf("poll("); print_pollfd_array_entering(epfds, valid + 1, valid, abbrev); errno = EFAULT; tprintf(", %u, 0) = -1 EFAULT (%m)\n", valid + 1); +# endif /* PATH_TRACING_FD */ tprintf("+++ exited with 0 +++\n"); return 0; diff --git a/tests-mx32/ppoll-P.c b/tests-mx32/ppoll-P.c new file mode 100644 index 00000000..c2c572e2 --- /dev/null +++ b/tests-mx32/ppoll-P.c @@ -0,0 +1,2 @@ +#define PATH_TRACING_FD 9 +#include "ppoll.c" diff --git a/tests-mx32/ppoll-P.gen.test b/tests-mx32/ppoll-P.gen.test new file mode 100755 index 00000000..25a97048 --- /dev/null +++ b/tests-mx32/ppoll-P.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ppoll-P -s2 -e trace=ppoll -P /dev/full 9>>/dev/full); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -s2 -e trace=ppoll -P /dev/full 9>>/dev/full diff --git a/tests-mx32/ppoll.c b/tests-mx32/ppoll.c index 62241839..b33f9593 100644 --- a/tests-mx32/ppoll.c +++ b/tests-mx32/ppoll.c @@ -1,7 +1,7 @@ /* * Check decoding of ppoll syscall. * - * Copyright (c) 2015-2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2015-2018 Dmitry V. Levin <ldv@altlinux.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -56,6 +56,10 @@ sys_ppoll(const kernel_ulong_t ufds, int main(void) { +# ifdef PATH_TRACING_FD + skip_if_unavailable("/proc/self/fd/"); +# endif + static const kernel_ulong_t bogus_nfds = (kernel_ulong_t) 0xdeadbeeffacefeedULL; static const kernel_ulong_t bogus_sigsetsize = @@ -76,28 +80,36 @@ main(void) sys_ppoll(0, bogus_nfds, 0, 0, bogus_sigsetsize); if (ENOSYS == errno) perror_msg_and_skip("ppoll"); +# ifndef PATH_TRACING_FD printf("ppoll(NULL, %u, NULL, NULL, %llu) = %s\n", (unsigned) bogus_nfds, (unsigned long long) bogus_sigsetsize, errstr); +# endif sys_ppoll((unsigned long) efault, 42, (unsigned long) efault + 8, (unsigned long) efault + 16, sigset_size); +# ifndef PATH_TRACING_FD printf("ppoll(%p, %u, %p, %p, %u) = %s\n", efault, 42, efault + 8, efault + 16, sigset_size, errstr); +# endif ts->tv_sec = 0xdeadbeefU; ts->tv_nsec = 0xfacefeedU; sys_ppoll(0, 0, (unsigned long) ts, 0, sigset_size); +# ifndef PATH_TRACING_FD printf("ppoll(NULL, 0, {tv_sec=%lld, tv_nsec=%llu}, NULL, %u) = %s\n", (long long) ts->tv_sec, zero_extend_signed_to_ull(ts->tv_nsec), sigset_size, errstr); +# endif ts->tv_sec = (time_t) 0xcafef00ddeadbeefLL; ts->tv_nsec = (long) 0xbadc0dedfacefeedL; sys_ppoll(0, 0, (unsigned long) ts, 0, sigset_size); +# ifndef PATH_TRACING_FD printf("ppoll(NULL, 0, {tv_sec=%lld, tv_nsec=%llu}, NULL, %u) = %s\n", (long long) ts->tv_sec, zero_extend_signed_to_ull(ts->tv_nsec), sigset_size, errstr); +# endif if (pipe(pipe_fd) || pipe(pipe_fd + 2)) perror_msg_and_fail("pipe"); @@ -124,24 +136,56 @@ main(void) (unsigned long) sigmask, sigset_size); if (rc != 2) perror_msg_and_fail("ppoll 1"); +# ifndef PATH_TRACING_FD printf("ppoll([{fd=%d, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}" ", {fd=%d, events=POLLOUT%s|POLLWRBAND}" -#if VERBOSE +# if VERBOSE ", {fd=%d, events=POLLIN|POLLPRI}, {fd=%d, events=POLLOUT}]" -#else +# else ", ...]" -#endif +# endif ", %u, {tv_sec=42, tv_nsec=999999999}, [%s], %u) = %ld" " ([{fd=%d, revents=POLLOUT%s}, {fd=%d, revents=POLLOUT}]" ", left {tv_sec=%u, tv_nsec=%u})\n", pipe_fd[0], pipe_fd[1], POLLWRNORM_str, -#if VERBOSE +# if VERBOSE pipe_fd[2], pipe_fd[3], -#endif +# endif (unsigned int) ARRAY_SIZE(fds1), USR2_CHLD_str, (unsigned int) sigset_size, rc, pipe_fd[1], POLLWRNORM_str, pipe_fd[3], (unsigned int) ts->tv_sec, (unsigned int) ts->tv_nsec); +# endif /* !PATH_TRACING_FD */ + +# ifdef PATH_TRACING_FD + ts->tv_sec = 123; + ts->tv_nsec = 987654321; + fds[3].fd = PATH_TRACING_FD; + + rc = sys_ppoll((unsigned long) fds, + F8ILL_KULONG_MASK | ARRAY_SIZE(fds1), (unsigned long) ts, + (unsigned long) sigmask, sigset_size); + if (rc != 2) + perror_msg_and_fail("ppoll -P"); + printf("ppoll([{fd=%d, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}" + ", {fd=%d, events=POLLOUT%s|POLLWRBAND}" +# if VERBOSE + ", {fd=%d, events=POLLIN|POLLPRI}, {fd=%d, events=POLLOUT}]" +# else + ", ...]" +# endif + ", %u, {tv_sec=123, tv_nsec=987654321}, [%s], %u) = %ld" + " ([{fd=%d, revents=POLLOUT%s}, {fd=%d, revents=POLLOUT}]" + ", left {tv_sec=%u, tv_nsec=%u})\n", + pipe_fd[0], pipe_fd[1], POLLWRNORM_str, +# if VERBOSE + pipe_fd[2], PATH_TRACING_FD, +# endif + (unsigned int) ARRAY_SIZE(fds1), USR2_CHLD_str, + (unsigned int) sigset_size, rc, pipe_fd[1], POLLWRNORM_str, + PATH_TRACING_FD, (unsigned int) ts->tv_sec, + (unsigned int) ts->tv_nsec); +# endif /* PATH_TRACING_FD */ ts->tv_sec = 0; ts->tv_nsec = 999; @@ -163,23 +207,27 @@ main(void) (unsigned long) sigmask, sigset_size); if (rc != 0) perror_msg_and_fail("ppoll 2"); +# ifndef PATH_TRACING_FD printf("ppoll([{fd=%d, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}" ", {fd=%d, events=POLLOUT%s|POLLWRBAND}], %u" ", {tv_sec=0, tv_nsec=999}, ~[HUP KILL STOP], %u)" " = %ld (Timeout)\n", pipe_fd[1], pipe_fd[0], POLLWRNORM_str, (unsigned) ARRAY_SIZE(fds2), sigset_size, rc); +# endif /* !PATH_TRACING_FD */ if (F8ILL_KULONG_SUPPORTED) { sys_ppoll(f8ill_ptr_to_kulong(fds), ARRAY_SIZE(fds2), f8ill_ptr_to_kulong(ts), f8ill_ptr_to_kulong(sigmask), sigset_size); +# ifndef PATH_TRACING_FD printf("ppoll(%#llx, %u, %#llx, %#llx, %u) = %s\n", (unsigned long long) f8ill_ptr_to_kulong(fds), (unsigned) ARRAY_SIZE(fds2), (unsigned long long) f8ill_ptr_to_kulong(ts), (unsigned long long) f8ill_ptr_to_kulong(sigmask), (unsigned) sigset_size, errstr); +# endif /* !PATH_TRACING_FD */ } puts("+++ exited with 0 +++"); diff --git a/tests-mx32/ppoll.gen.test b/tests-mx32/ppoll.gen.test index 4c075989..120e9536 100755 --- a/tests-mx32/ppoll.gen.test +++ b/tests-mx32/ppoll.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ppoll -s2); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ppoll -s2 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -s2 +run_strace_match_diff -s2 diff --git a/tests-mx32/prctl-dumpable.c b/tests-mx32/prctl-dumpable.c index 1049bcee..52c16680 100644 --- a/tests-mx32/prctl-dumpable.c +++ b/tests-mx32/prctl-dumpable.c @@ -3,6 +3,7 @@ * * Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com> * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,7 +33,8 @@ #include <asm/unistd.h> #include <linux/prctl.h> -#if defined __NR_prctl && defined PR_GET_DUMPABLE && defined PR_SET_DUMPABLE +#if defined __NR_prctl && defined PR_GET_DUMPABLE && defined PR_SET_DUMPABLE \ + && !defined __ia64__ # include <stdio.h> # include <unistd.h> @@ -101,6 +103,7 @@ main(void) #else -SKIP_MAIN_UNDEFINED("__NR_prctl && PR_GET_DUMPABLE && PR_SET_DUMPABLE") +SKIP_MAIN_UNDEFINED("__NR_prctl && PR_GET_DUMPABLE && PR_SET_DUMPABLE" + " && !__ia64__") #endif diff --git a/tests-mx32/preadv.gen.test b/tests-mx32/preadv.gen.test index 8fb7b540..c3fabe6f 100755 --- a/tests-mx32/preadv.gen.test +++ b/tests-mx32/preadv.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (preadv -a21); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (preadv -a21 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a21 +run_strace_match_diff -a21 diff --git a/tests-mx32/print_user_desc.c b/tests-mx32/print_user_desc.c new file mode 100644 index 00000000..2dac3879 --- /dev/null +++ b/tests-mx32/print_user_desc.c @@ -0,0 +1,78 @@ +/* + * Auxiliary printing function for the struct user_desc type. + * Used by modify_ldt and xet_thread_area tests. + * + * Copyright (c) 2018 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" + +#ifdef HAVE_STRUCT_USER_DESC + +# include <asm/ldt.h> + +/** + * Print user_desc structure. + * + * @param us Pointer to struct user_desc to print. + * @param entry_str If not NULL, the string is printed as a value of + * entry_number field. + */ +static void +print_user_desc(struct user_desc *us, const char *entry_str) +{ + if (entry_str) + printf("{entry_number=%s", entry_str); + else + printf("{entry_number=%u", us->entry_number); + + printf(", base_addr=%#08x" + ", limit=%#08x" + ", seg_32bit=%u" + ", contents=%u" + ", read_exec_only=%u" + ", limit_in_pages=%u" + ", seg_not_present=%u" + ", useable=%u" +# ifdef __x86_64__ + ", lm=%u" +# endif + "}", + us->base_addr, + us->limit, + us->seg_32bit, + us->contents, + us->read_exec_only, + us->limit_in_pages, + us->seg_not_present, + us->useable +# ifdef __x86_64__ + , us->lm +# endif + ); +} + +#endif /* HAVE_STRUCT_USER_DESC */ diff --git a/tests-mx32/printpath-umovestr.c b/tests-mx32/printpath-umovestr.c index a7251e5e..0d5955ff 100644 --- a/tests-mx32/printpath-umovestr.c +++ b/tests-mx32/printpath-umovestr.c @@ -2,6 +2,7 @@ * Test regular printpath/umovestr. * * Copyright (c) 2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2017-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,8 +30,8 @@ #include "tests.h" #include "test_ucopy.h" +#include <limits.h> #include <stdio.h> -#include <sys/param.h> int main(void) diff --git a/tests-mx32/prlimit64.gen.test b/tests-mx32/prlimit64.gen.test index 11964a5e..2c94fc9d 100755 --- a/tests-mx32/prlimit64.gen.test +++ b/tests-mx32/prlimit64.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (prlimit64 ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (prlimit64 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/pselect6.gen.test b/tests-mx32/pselect6.gen.test index c89e7054..29d38963 100755 --- a/tests-mx32/pselect6.gen.test +++ b/tests-mx32/pselect6.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pselect6 ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pselect6 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/ptrace.c b/tests-mx32/ptrace.c index d776dcdd..c70d5689 100644 --- a/tests-mx32/ptrace.c +++ b/tests-mx32/ptrace.c @@ -2,7 +2,7 @@ * Check decoding of ptrace syscall. * * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,12 +32,12 @@ #include <asm/unistd.h> #include <errno.h> +#include "ptrace.h" #include <signal.h> #include <stdio.h> #include <string.h> #include <sys/wait.h> #include <unistd.h> -#include "ptrace.h" #include <linux/audit.h> static const char *errstr; diff --git a/tests-mx32/pure_executables.am b/tests-mx32/pure_executables.am index 2cae9ae5..128028fe 100644 --- a/tests-mx32/pure_executables.am +++ b/tests-mx32/pure_executables.am @@ -104,6 +104,7 @@ PURE_EXECUTABLES = \ ioctl_block \ ioctl_dm \ ioctl_evdev \ + ioctl_kvm_run \ ioctl_loop \ ioctl_mtd \ ioctl_rtc \ @@ -154,6 +155,7 @@ PURE_EXECUTABLES = \ mmap64 \ mmsg \ mmsg_name \ + modify_ldt \ mount \ move_pages \ mq \ @@ -223,9 +225,12 @@ PURE_EXECUTABLES = \ nlattr_tcmsg \ nlattr_unix_diag_msg \ old_mmap \ + old_mmap-P \ + old_mmap-v-none \ oldfstat \ oldlstat \ oldselect \ + oldselect-efault \ oldstat \ open \ openat \ @@ -239,7 +244,9 @@ PURE_EXECUTABLES = \ pkey_free \ pkey_mprotect \ poll \ + poll-P \ ppoll \ + ppoll-P \ prctl-arg2-intptr \ prctl-dumpable \ prctl-name \ @@ -282,6 +289,7 @@ PURE_EXECUTABLES = \ renameat \ renameat2 \ request_key \ + riscv_flush_icache \ rmdir \ rt_sigaction \ rt_sigpending \ @@ -291,6 +299,12 @@ PURE_EXECUTABLES = \ rt_sigsuspend \ rt_sigtimedwait \ rt_tgsigqueueinfo \ + s390_guarded_storage \ + s390_guarded_storage-v \ + s390_pci_mmio_read_write \ + s390_runtime_instr \ + s390_sthyi \ + s390_sthyi-v \ sched_get_priority_mxx \ sched_rr_get_interval \ sched_xetaffinity \ @@ -342,6 +356,7 @@ PURE_EXECUTABLES = \ so_peercred \ sock_filter-v \ socketcall \ + sockopt-sol_netlink \ splice \ stat \ stat64 \ @@ -393,6 +408,7 @@ PURE_EXECUTABLES = \ xattr \ xattr-strings \ xet_robust_list \ + xet_thread_area_x86 \ xetitimer \ xetpgid \ xetpriority \ diff --git a/tests-mx32/pure_executables.list b/tests-mx32/pure_executables.list index d98b17db..2f602a93 100755 --- a/tests-mx32/pure_executables.list +++ b/tests-mx32/pure_executables.list @@ -103,6 +103,7 @@ ioctl ioctl_block ioctl_dm ioctl_evdev +ioctl_kvm_run ioctl_loop ioctl_mtd ioctl_rtc @@ -153,6 +154,7 @@ mmap mmap64 mmsg mmsg_name +modify_ldt mount move_pages mq @@ -222,9 +224,12 @@ nlattr_tcamsg nlattr_tcmsg nlattr_unix_diag_msg old_mmap +old_mmap-P +old_mmap-v-none oldfstat oldlstat oldselect +oldselect-efault oldstat open openat @@ -238,7 +243,9 @@ pkey_alloc pkey_free pkey_mprotect poll +poll-P ppoll +ppoll-P prctl-arg2-intptr prctl-dumpable prctl-name @@ -281,6 +288,7 @@ rename renameat renameat2 request_key +riscv_flush_icache rmdir rt_sigaction rt_sigpending @@ -290,6 +298,12 @@ rt_sigreturn rt_sigsuspend rt_sigtimedwait rt_tgsigqueueinfo +s390_guarded_storage +s390_guarded_storage-v +s390_pci_mmio_read_write +s390_runtime_instr +s390_sthyi +s390_sthyi-v sched_get_priority_mxx sched_rr_get_interval sched_xetaffinity @@ -341,6 +355,7 @@ so_linger so_peercred sock_filter-v socketcall +sockopt-sol_netlink splice stat stat64 @@ -392,6 +407,7 @@ waitpid xattr xattr-strings xet_robust_list +xet_thread_area_x86 xetitimer xetpgid xetpriority diff --git a/tests-mx32/qual_fault-syntax.test b/tests-mx32/qual_fault-syntax.test index 0cce539a..43ade769 100755 --- a/tests-mx32/qual_fault-syntax.test +++ b/tests-mx32/qual_fault-syntax.test @@ -2,7 +2,7 @@ # # Check -e fault= syntax. # -# Copyright (c) 2016-2017 Dmitry V. Levin <ldv@altlinux.org> +# Copyright (c) 2016-2018 Dmitry V. Levin <ldv@altlinux.org> # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -40,16 +40,7 @@ fail_with() "strace -e fault=$* failed to handle an argument error properly" } -for arg in '' , ,, ,,, : :: ::: \! \!, \!: \ - invalid_syscall_name \ - invalid_syscall_name:when=3 \ - -1 \!-1 \ - -1:when=4 \ - -2 \ - -2:when=5 \ - 32767 \!32767 \ - 32767:when=6 \ - chdir:42 \!chdir:42 \ +for arg in chdir:42 \!chdir:42 \ chdir:42:when=7 \ chdir:invalid \ chdir:invalid:when=8 \ @@ -92,12 +83,6 @@ for arg in '' , ,, ,,, : :: ::: \! \!, \!: \ chdir:when=65536:error=30 \ chdir:when=1+65536 \ chdir:when=1+65536:error=31 \ - file,nonsense \ - \!desc,nonsense \ - chdir,nonsense \ - \!chdir,nonsense \ - 1,nonsense \ - \!1,nonsense \ chdir:retval=0 \ chdir:signal=1 \ chdir:error=1:error=2 \ diff --git a/tests-mx32/qual_fault.c b/tests-mx32/qual_fault.c index 05401dec..670d9fe7 100644 --- a/tests-mx32/qual_fault.c +++ b/tests-mx32/qual_fault.c @@ -2,7 +2,7 @@ * Check that fault injection works properly. * * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,11 +33,11 @@ #include <assert.h> #include <errno.h> #include <fcntl.h> +#include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <sys/param.h> #include <sys/stat.h> #include <sys/uio.h> #include <sys/wait.h> diff --git a/tests-mx32/qual_inject-syntax.test b/tests-mx32/qual_inject-syntax.test index 7aa61809..46cead28 100755 --- a/tests-mx32/qual_inject-syntax.test +++ b/tests-mx32/qual_inject-syntax.test @@ -2,7 +2,7 @@ # # Check -e inject= syntax. # -# Copyright (c) 2016-2017 Dmitry V. Levin <ldv@altlinux.org> +# Copyright (c) 2016-2018 Dmitry V. Levin <ldv@altlinux.org> # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -40,17 +40,7 @@ fail_with() "strace -e inject=$* failed to handle an argument error properly" } -for arg in '' , ,, ,,, : :: ::: \! \!, \!: \ - invalid_syscall_name \ - invalid_syscall_name:when=3 \ - -1 \!-1 \ - -1:when=4 \ - -2 \ - -2:when=5 \ - 32767 \!32767 \ - 32767:when=6 \ - 42 \ - chdir \ +for arg in 42 chdir \ chdir:42 \!chdir:42 \ chdir:42:when=7 \ chdir:invalid \ @@ -94,12 +84,6 @@ for arg in '' , ,, ,,, : :: ::: \! \!, \!: \ chdir:when=65536:error=30 \ chdir:when=1+65536 \ chdir:when=1+65536:error=31 \ - file,nonsense \ - \!desc,nonsense \ - chdir,nonsense \ - \!chdir,nonsense \ - 1,nonsense \ - \!1,nonsense \ chdir:retval=-1 \ chdir:signal=0 \ chdir:signal=129 \ diff --git a/tests-mx32/quotactl.gen.test b/tests-mx32/quotactl.gen.test index c6ad6e1e..6d2dc754 100755 --- a/tests-mx32/quotactl.gen.test +++ b/tests-mx32/quotactl.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (quotactl ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (quotactl ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/readahead.gen.test b/tests-mx32/readahead.gen.test index 4e88efa6..c27ab0d0 100755 --- a/tests-mx32/readahead.gen.test +++ b/tests-mx32/readahead.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readahead -a1); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readahead -a1 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a1 +run_strace_match_diff -a1 diff --git a/tests-mx32/readdir.gen.test b/tests-mx32/readdir.gen.test index 10da83b2..09aad4f6 100755 --- a/tests-mx32/readdir.gen.test +++ b/tests-mx32/readdir.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readdir -a16); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readdir -a16 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a16 +run_strace_match_diff -a16 diff --git a/tests-mx32/readlink.gen.test b/tests-mx32/readlink.gen.test index 755fc8b3..42632341 100755 --- a/tests-mx32/readlink.gen.test +++ b/tests-mx32/readlink.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readlink -xx); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readlink -xx ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -xx +run_strace_match_diff -xx diff --git a/tests-mx32/readlinkat.gen.test b/tests-mx32/readlinkat.gen.test index 2a502999..d7de9932 100755 --- a/tests-mx32/readlinkat.gen.test +++ b/tests-mx32/readlinkat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readlinkat -xx); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readlinkat -xx ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -xx +run_strace_match_diff -xx diff --git a/tests-mx32/reboot.c b/tests-mx32/reboot.c index ce651dc7..3f819ce8 100644 --- a/tests-mx32/reboot.c +++ b/tests-mx32/reboot.c @@ -10,21 +10,83 @@ # define INVALID_MAGIC 319887762 # define INVALID_CMD 0x01234568 +# define STR32 "AbCdEfGhIjKlMnOpQrStUvWxYz012345" +# define STR128 STR32 STR32 STR32 STR32 + int main(void) { + static const kernel_ulong_t bogus_magic1 = + (kernel_ulong_t) 0xFFFFFFFFFFFFFFFFULL; + static const kernel_ulong_t bogus_magic2 = + (kernel_ulong_t) 0xdeadfacefa57beefULL; + static const kernel_ulong_t bogus_cmd = + (kernel_ulong_t) 0xbadda7a09caffee1ULL; static const char buf[] = "reboot"; - long rc = syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, + static const char str256_buf[] = STR128 STR128; + + long rc; + char *str256 = tail_memdup(str256_buf, sizeof(str256_buf) - 1); + + rc = syscall(__NR_reboot, 0, 0, 0, 0); + printf("reboot(0 /* LINUX_REBOOT_MAGIC_??? */, " + "0 /* LINUX_REBOOT_MAGIC_??? */, " + "LINUX_REBOOT_CMD_CAD_OFF) = %s\n", + sprintrc(rc)); + + rc = syscall(__NR_reboot, bogus_magic1, bogus_magic2, bogus_cmd, -1); + printf("reboot(%#x /* LINUX_REBOOT_MAGIC_??? */, " + "%#x /* LINUX_REBOOT_MAGIC_??? */, " + "%#x /* LINUX_REBOOT_CMD_??? */) = %s\n", + (unsigned int) bogus_magic1, (unsigned int) bogus_magic2, + (unsigned int) bogus_cmd, sprintrc(rc)); + + rc = syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, INVALID_MAGIC, LINUX_REBOOT_CMD_RESTART2, buf); printf("reboot(LINUX_REBOOT_MAGIC1, %#x /* LINUX_REBOOT_MAGIC_??? */," - " LINUX_REBOOT_CMD_RESTART2, \"%s\") = %ld %s (%m)\n", - INVALID_MAGIC, buf, rc, errno2name()); + " LINUX_REBOOT_CMD_RESTART2, \"%s\") = %s\n", + INVALID_MAGIC, buf, sprintrc(rc)); rc = syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, INVALID_CMD); printf("reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2," - " %#x /* LINUX_REBOOT_CMD_??? */) = %ld %s (%m)\n", - INVALID_CMD, rc, errno2name()); + " %#x /* LINUX_REBOOT_CMD_??? */) = %s\n", + INVALID_CMD, sprintrc(rc)); + + rc = syscall(__NR_reboot, INVALID_MAGIC, LINUX_REBOOT_MAGIC2A, + LINUX_REBOOT_CMD_RESTART2, str256); + printf("reboot(%#x /* LINUX_REBOOT_MAGIC_??? */, LINUX_REBOOT_MAGIC2A, " + "LINUX_REBOOT_CMD_RESTART2, \"%.255s\"...) = %s\n", + INVALID_MAGIC, str256, sprintrc(rc)); + + rc = syscall(__NR_reboot, INVALID_MAGIC, LINUX_REBOOT_MAGIC2B, + LINUX_REBOOT_CMD_RESTART2, str256 + 1); + printf("reboot(%#x /* LINUX_REBOOT_MAGIC_??? */, LINUX_REBOOT_MAGIC2B, " + "LINUX_REBOOT_CMD_RESTART2, \"%.255s\"...) = %s\n", + INVALID_MAGIC, str256 + 1, sprintrc(rc)); + + rc = syscall(__NR_reboot, INVALID_MAGIC, LINUX_REBOOT_MAGIC2C, + LINUX_REBOOT_CMD_RESTART2, str256 + 2); + printf("reboot(%#x /* LINUX_REBOOT_MAGIC_??? */, LINUX_REBOOT_MAGIC2C, " + "LINUX_REBOOT_CMD_RESTART2, %p) = %s\n", + INVALID_MAGIC, str256 + 2, sprintrc(rc)); + + str256[255] = '\0'; + rc = syscall(__NR_reboot, INVALID_MAGIC, bogus_magic1, + LINUX_REBOOT_CMD_RESTART2, str256); + printf("reboot(%#x /* LINUX_REBOOT_MAGIC_??? */, " + "%#x /* LINUX_REBOOT_MAGIC_??? */, " + "LINUX_REBOOT_CMD_RESTART2, \"%.255s\"...) = %s\n", + INVALID_MAGIC, (unsigned int) bogus_magic1, str256, + sprintrc(rc)); + + rc = syscall(__NR_reboot, INVALID_MAGIC, bogus_magic1, + LINUX_REBOOT_CMD_RESTART2, str256 + 1); + printf("reboot(%#x /* LINUX_REBOOT_MAGIC_??? */, " + "%#x /* LINUX_REBOOT_MAGIC_??? */, " + "LINUX_REBOOT_CMD_RESTART2, \"%.254s\") = %s\n", + INVALID_MAGIC, (unsigned int) bogus_magic1, str256 + 1, + sprintrc(rc)); puts("+++ exited with 0 +++"); return 0; diff --git a/tests-mx32/reboot.gen.test b/tests-mx32/reboot.gen.test index 0a48dea7..06d2f0cb 100755 --- a/tests-mx32/reboot.gen.test +++ b/tests-mx32/reboot.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (reboot ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (reboot -s 256); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff -s 256 diff --git a/tests-mx32/recvfrom.gen.test b/tests-mx32/recvfrom.gen.test index c23780c9..2741d210 100755 --- a/tests-mx32/recvfrom.gen.test +++ b/tests-mx32/recvfrom.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (recvfrom -a35); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (recvfrom -a35 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a35 +run_strace_match_diff -a35 diff --git a/tests-mx32/remap_file_pages.c b/tests-mx32/remap_file_pages.c index 452d2de7..4e409630 100644 --- a/tests-mx32/remap_file_pages.c +++ b/tests-mx32/remap_file_pages.c @@ -1,7 +1,7 @@ /* * Check decoding of remap_file_pages syscall. * - * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2017 Dmitry V. Levin <ldv@altlinux.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,22 +33,62 @@ #ifdef __NR_remap_file_pages # include <stdio.h> -# include <sys/mman.h> +# include <stdint.h> # include <unistd.h> +# include <linux/mman.h> + +static const char *errstr; + +static long +k_remap_file_pages(const kernel_ulong_t addr, + const kernel_ulong_t size, + const kernel_ulong_t prot, + const kernel_ulong_t pgoff, + const kernel_ulong_t flags) +{ + const long rc = syscall(__NR_remap_file_pages, + addr, size, prot, pgoff, flags); + errstr = sprintrc(rc); + return rc; +} int main(void) { - const unsigned long addr = (unsigned long) 0xfacefeeddeadbeefULL; - const unsigned long size = (unsigned long) 0xdefaced1bad2f00dULL; - const unsigned long prot = PROT_READ|PROT_WRITE|PROT_EXEC; - const unsigned long pgoff = (unsigned long) 0xcaf3babebad4deedULL; - const unsigned long flags = MAP_PRIVATE|MAP_ANONYMOUS; - - long rc = syscall(__NR_remap_file_pages, addr, size, prot, pgoff, flags); - printf("remap_file_pages(%#lx, %lu, %s, %lu, %s) = %ld %s (%m)\n", - addr, size, "PROT_READ|PROT_WRITE|PROT_EXEC", pgoff, - "MAP_PRIVATE|MAP_ANONYMOUS", rc, errno2name()); + kernel_ulong_t addr = (kernel_ulong_t) 0xfacefeeddeadbeefULL; + kernel_ulong_t size = (kernel_ulong_t) 0xdefaced1bad2f00dULL; + kernel_ulong_t prot = PROT_READ|PROT_WRITE|PROT_EXEC; + kernel_ulong_t pgoff = (kernel_ulong_t) 0xcaf3babebad4deedULL; + kernel_ulong_t flags = MAP_PRIVATE|MAP_ANONYMOUS; + + k_remap_file_pages(addr, size, prot, pgoff, flags); + printf("remap_file_pages(%#jx, %ju, %s, %ju, %s) = %s\n", + (uintmax_t) addr, (uintmax_t) size, + "PROT_READ|PROT_WRITE|PROT_EXEC", + (uintmax_t) pgoff, "MAP_PRIVATE|MAP_ANONYMOUS", errstr); + +#ifdef MAP_HUGETLB +# ifndef MAP_HUGE_2MB +# ifndef MAP_HUGE_SHIFT +# define MAP_HUGE_SHIFT 26 +# endif +# define MAP_HUGE_2MB (21 << MAP_HUGE_SHIFT) +# endif /* !MAP_HUGE_2MB */ + addr = (kernel_ulong_t) 0xfacefeeddeadf00dULL; + size = (kernel_ulong_t) 0xdefaced1bad2beefULL; + prot = (kernel_ulong_t) 0xdefaced00000000ULL | PROT_NONE; + flags = MAP_TYPE | MAP_FIXED | MAP_NORESERVE | MAP_HUGETLB | MAP_HUGE_2MB; + + k_remap_file_pages(addr, size, prot, pgoff, flags); + printf("remap_file_pages(%#jx, %ju, %s, %ju" + ", %#x /* MAP_??? */" + "|MAP_FIXED|MAP_NORESERVE|MAP_HUGETLB|21<<MAP_HUGE_SHIFT)" + " = %s\n", + (uintmax_t) addr, (uintmax_t) size, + prot == PROT_NONE ? "PROT_NONE" : + "0xdefaced00000000 /* PROT_??? */", + (uintmax_t) pgoff, MAP_TYPE, errstr); +#endif /* MAP_HUGETLB */ puts("+++ exited with 0 +++"); return 0; diff --git a/tests-mx32/remap_file_pages.gen.test b/tests-mx32/remap_file_pages.gen.test index e4894736..b3589886 100755 --- a/tests-mx32/remap_file_pages.gen.test +++ b/tests-mx32/remap_file_pages.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (remap_file_pages ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (remap_file_pages ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/rename.gen.test b/tests-mx32/rename.gen.test index 07f01801..81fb0398 100755 --- a/tests-mx32/rename.gen.test +++ b/tests-mx32/rename.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rename -a35); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rename -a35 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a35 +run_strace_match_diff -a35 diff --git a/tests-mx32/renameat.gen.test b/tests-mx32/renameat.gen.test index f2879cdc..dbc6e05b 100755 --- a/tests-mx32/renameat.gen.test +++ b/tests-mx32/renameat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (renameat ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (renameat ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/renameat2.gen.test b/tests-mx32/renameat2.gen.test index cd7c34ca..78251cb2 100755 --- a/tests-mx32/renameat2.gen.test +++ b/tests-mx32/renameat2.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (renameat2 ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (renameat2 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/riscv_flush_icache.c b/tests-mx32/riscv_flush_icache.c new file mode 100644 index 00000000..8aaeda51 --- /dev/null +++ b/tests-mx32/riscv_flush_icache.c @@ -0,0 +1,93 @@ +/* + * Check decoding of riscv_flush_icache syscall. + * + * Copyright (c) 2018 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" + +#include <asm/unistd.h> + +#include "scno.h" + +#ifdef __NR_riscv_flush_icache + +# include <stdint.h> +# include <stdio.h> +# include <unistd.h> + +int main(void) +{ + static struct { + kernel_ulong_t addr; + const char *str; + } addrs[] = { + { (kernel_ulong_t) (uintptr_t) ARG_STR(NULL) }, + { (kernel_ulong_t) 0xbadc0deddeadf157ULL, + sizeof(kernel_ulong_t) == 8 ? "0xbadc0deddeadf157" : + "0xdeadf157" }, + }; + static struct { + kernel_ulong_t val; + const char *str; + } flags[] = { + { ARG_STR(0) }, + { 1, "SYS_RISCV_FLUSH_ICACHE_LOCAL" }, + { (kernel_ulong_t) 0xfacefeedfffffffeULL, + sizeof(kernel_ulong_t) == 8 ? + "0xfacefeedfffffffe /* SYS_RISCV_FLUSH_ICACHE_??? */" : + "0xfffffffe /* SYS_RISCV_FLUSH_ICACHE_??? */" }, + { (kernel_ulong_t) 0xfacefeedffffffffULL, + sizeof(kernel_ulong_t) == 8 ? + "SYS_RISCV_FLUSH_ICACHE_LOCAL|0xfacefeedfffffffe" : + "SYS_RISCV_FLUSH_ICACHE_LOCAL|0xfffffffe" }, + }; + + for (size_t i = 0; i < ARRAY_SIZE(addrs); i++) { + for (size_t j = 0; j < ARRAY_SIZE(addrs); j++) { + for (size_t k = 0; k < ARRAY_SIZE(flags); k++) { + long rc = syscall(__NR_riscv_flush_icache, + addrs[i].addr, + addrs[j].addr, + flags[k].val); + + printf("riscv_flush_icache(%s, %s, %s) = %s\n", + addrs[i].str, addrs[j].str, flags[k].str, + sprintrc(rc)); + } + } + } + + puts("+++ exited with 0 +++"); + + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_riscv_flush_icache"); + +#endif diff --git a/tests-mx32/riscv_flush_icache.gen.test b/tests-mx32/riscv_flush_icache.gen.test new file mode 100755 index 00000000..1a1f793a --- /dev/null +++ b/tests-mx32/riscv_flush_icache.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (riscv_flush_icache -a34 ); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a34 diff --git a/tests-mx32/rmdir.gen.test b/tests-mx32/rmdir.gen.test index b511039d..8b346af9 100755 --- a/tests-mx32/rmdir.gen.test +++ b/tests-mx32/rmdir.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rmdir -a22); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rmdir -a22 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a22 +run_strace_match_diff -a22 diff --git a/tests-mx32/rt_sigpending.gen.test b/tests-mx32/rt_sigpending.gen.test index 0458876b..d52858af 100755 --- a/tests-mx32/rt_sigpending.gen.test +++ b/tests-mx32/rt_sigpending.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigpending -a20); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigpending -a20 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a20 +run_strace_match_diff -a20 diff --git a/tests-mx32/rt_sigprocmask.gen.test b/tests-mx32/rt_sigprocmask.gen.test index a21c6dbb..67fcdc0f 100755 --- a/tests-mx32/rt_sigprocmask.gen.test +++ b/tests-mx32/rt_sigprocmask.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigprocmask ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigprocmask ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/rt_sigqueueinfo.gen.test b/tests-mx32/rt_sigqueueinfo.gen.test index 7baf0e48..d11eecc0 100755 --- a/tests-mx32/rt_sigqueueinfo.gen.test +++ b/tests-mx32/rt_sigqueueinfo.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigqueueinfo -esignal=none); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigqueueinfo -esignal=none ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -esignal=none +run_strace_match_diff -esignal=none diff --git a/tests-mx32/rt_sigreturn.gen.test b/tests-mx32/rt_sigreturn.gen.test index 0672f113..d8b153e3 100755 --- a/tests-mx32/rt_sigreturn.gen.test +++ b/tests-mx32/rt_sigreturn.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigreturn -esignal='!USR1'); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigreturn -esignal='!USR1' ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -esignal='!USR1' +run_strace_match_diff -esignal='!USR1' diff --git a/tests-mx32/rt_sigtimedwait.gen.test b/tests-mx32/rt_sigtimedwait.gen.test index 2b18e7af..a9409ae9 100755 --- a/tests-mx32/rt_sigtimedwait.gen.test +++ b/tests-mx32/rt_sigtimedwait.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigtimedwait -a38); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigtimedwait -a38 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a38 +run_strace_match_diff -a38 diff --git a/tests-mx32/rt_tgsigqueueinfo.gen.test b/tests-mx32/rt_tgsigqueueinfo.gen.test index 407bbffa..0539e35a 100755 --- a/tests-mx32/rt_tgsigqueueinfo.gen.test +++ b/tests-mx32/rt_tgsigqueueinfo.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_tgsigqueueinfo -esignal=none); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_tgsigqueueinfo -esignal=none ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -esignal=none +run_strace_match_diff -esignal=none diff --git a/tests-mx32/run.sh b/tests-mx32/run.sh index d1b796ca..208aa0f9 100755 --- a/tests-mx32/run.sh +++ b/tests-mx32/run.sh @@ -9,4 +9,9 @@ TIMEOUT="timeout -k 5 -s XCPU $TIMEOUT_DURATION" $TIMEOUT true > /dev/null 2>&1 || TIMEOUT= -exec $TIMEOUT "$@" +if [ $# -eq 0 ]; then + echo 'No command or test-file specified' >&2 + exit 1 +fi + +exec $TIMEOUT "$@" < /dev/null diff --git a/tests-mx32/s390_guarded_storage-v.c b/tests-mx32/s390_guarded_storage-v.c new file mode 100644 index 00000000..05afd9fe --- /dev/null +++ b/tests-mx32/s390_guarded_storage-v.c @@ -0,0 +1,2 @@ +#define VERBOSE 1 +#include "s390_guarded_storage.c" diff --git a/tests-mx32/s390_guarded_storage-v.gen.test b/tests-mx32/s390_guarded_storage-v.gen.test new file mode 100755 index 00000000..045ff762 --- /dev/null +++ b/tests-mx32/s390_guarded_storage-v.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (s390_guarded_storage-v -e trace=s390_guarded_storage -a32 -v); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -e trace=s390_guarded_storage -a32 -v diff --git a/tests-mx32/s390_guarded_storage.c b/tests-mx32/s390_guarded_storage.c new file mode 100644 index 00000000..ab67c158 --- /dev/null +++ b/tests-mx32/s390_guarded_storage.c @@ -0,0 +1,229 @@ +/* + * Check decoding of s390_guarded_storage syscall. + * + * Copyright (c) 2018 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" +#include <asm/unistd.h> + +#if defined __NR_s390_guarded_storage && defined HAVE_ASM_GUARDED_STORAGE_H + +# include <inttypes.h> +# include <stdbool.h> +# include <stdint.h> +# include <stdio.h> +# include <unistd.h> + +# include <asm/guarded_storage.h> + +# ifndef VERBOSE +# define VERBOSE 0 +# endif + +static void +gs_no_arg(kernel_ulong_t val, const char *val_str) +{ + static const kernel_ulong_t bogus_addr = + (kernel_ulong_t) 0xcaffeedadeadbed5ULL; + static const kernel_ulong_t bogus_cmd_mask = + (kernel_ulong_t) 0xbadc0ded00000000ULL; + long rc; + + rc = syscall(__NR_s390_guarded_storage, val | bogus_cmd_mask, + bogus_addr); + printf("s390_guarded_storage(%s) = %s\n", val_str, sprintrc(rc)); +} + +static void +gs_print_epl(uint64_t addr, bool valid, const char *str) +{ + if (!valid) { + if (str) + printf("%s", str); + else + printf("%#" PRIx64, addr); + + return; + } + + struct gs_epl *gsepl = (struct gs_epl *) (uintptr_t) addr; + + printf("[{"); + +# if VERBOSE + if (gsepl->pad1) + printf("pad1=%#02x, ", gsepl->pad1); + + printf("gs_eam=%#02x /* extended addressing mode: %u, " + "basic addressing mode: %u */" + ", gs_eci=%#02x /* CPU in TX: %u, CPU in CX: %u, " + "instruction: %s */" + ", gs_eai=%#02x /* DAT: %u, address space indication: %u, " + "AR number: %u */, ", + gsepl->gs_eam, gsepl->e, gsepl->b, + gsepl->gs_eci, gsepl->tx, gsepl->cx, + gsepl->in ? "LLGFGS": "LGG", + gsepl->gs_eai, gsepl->t, gsepl->as, gsepl->ar); + + if (gsepl->pad2) + printf("pad2=%#08x, ", gsepl->pad2); +# endif /* VERBOSE */ + + printf("gs_eha=%#llx, ", (unsigned long long) gsepl->gs_eha); + +# if VERBOSE + printf("gs_eia=%#llx, gs_eoa=%#llx, gs_eir=%#llx, gs_era=%#llx", + (unsigned long long) gsepl->gs_eia, + (unsigned long long) gsepl->gs_eoa, + (unsigned long long) gsepl->gs_eir, + (unsigned long long) gsepl->gs_era); +# else /* !VERBOSE */ + printf("..."); +# endif /* VERBOSE */ + + printf("}]"); +} + +static void +gs_set_cb(kernel_ulong_t addr, bool valid, bool epl_valid, + const char *bc_str, const char *epl_str) +{ + static const kernel_ulong_t bogus_cmd_mask = + (kernel_ulong_t) 0xda7a105700000000ULL; + + long rc; + + printf("s390_guarded_storage(GS_SET_BC_CB, "); + + if (valid) { + struct gs_cb *gscb = (struct gs_cb *) (uintptr_t) addr; + + printf("{"); + + if (gscb->reserved) + printf("reserved=%#016llx, ", + (unsigned long long) gscb->reserved); + + printf("gsd=%#16llx", + (unsigned long long) gscb->gsd); +# if VERBOSE + printf(" /* GS origin: "); + + unsigned int gsc = gscb->gsd & 0x3F; + unsigned int gls = (gscb->gsd >> 8) & 7; + bool gsc_valid = gsc >= 25 && gsc <= 56; + + if (gsc_valid) { + uint64_t gls = gscb->gsd >> gsc; + int field_size = 2 + (67 - gsc) / 4; + + printf("%#0*" PRIx64, field_size, gls); + } else { + printf("[invalid]"); + } + + printf(", guard load shift: %u, GS characteristic: %u */", + gls, gsc); +# endif /* VERBOSE */ + + printf(", gssm=%#016llx, gs_epl_a=", + (unsigned long long) gscb->gssm); + + gs_print_epl(gscb->gs_epl_a, epl_valid, epl_str); + + printf("}"); + } else { + if (bc_str) + printf("%s", bc_str); + else + printf("%#llx", (unsigned long long) addr); + } + + rc = syscall(__NR_s390_guarded_storage, + GS_SET_BC_CB | bogus_cmd_mask, addr); + printf(") = %s\n", sprintrc(rc)); +} + +int +main(void) +{ + static const kernel_ulong_t bogus_cmd = + (kernel_ulong_t) 0xdeafbeefdeadc0deULL; + static const kernel_ulong_t bogus_addr = + (kernel_ulong_t) 0xfacefeedac0ffeedULL; + + struct gs_cb *gscb = tail_alloc(sizeof(*gscb)); + struct gs_epl *gsepl = tail_alloc(sizeof(*gsepl)); + + long rc; + + rc = syscall(__NR_s390_guarded_storage, 5, 0); + printf("s390_guarded_storage(0x5 /* GS_??? */, NULL) = %s\n", + sprintrc(rc)); + + rc = syscall(__NR_s390_guarded_storage, bogus_cmd, bogus_addr); + printf("s390_guarded_storage(%#x /* GS_??? */, %#lx) = %s\n", + (unsigned) bogus_cmd, (unsigned long) bogus_addr, sprintrc(rc)); + + gs_no_arg(ARG_STR(GS_BROADCAST)); + gs_no_arg(ARG_STR(GS_CLEAR_BC_CB)); + gs_no_arg(ARG_STR(GS_DISABLE)); + gs_no_arg(ARG_STR(GS_ENABLE)); + + fill_memory(gscb, sizeof(*gscb)); + fill_memory_ex(gsepl, sizeof(*gsepl), 0xA5, 0x5A); + + gs_set_cb(0, false, false, "NULL", NULL); + gs_set_cb((uintptr_t) (gscb + 1), false, false, NULL, NULL); + + gscb->gs_epl_a = 0; + gs_set_cb((uintptr_t) gscb, true, false, NULL, "NULL"); + + fill_memory_ex(gscb, sizeof(*gscb), 0x5A, 0xA5); + gscb->gs_epl_a = (uintptr_t) (gsepl + 1) | + (sizeof(kernel_ulong_t) < sizeof(uint64_t) ? + 0xc0debad000000000ULL : 0); + gs_set_cb((uintptr_t) gscb, true, false, NULL, NULL); + + fill_memory_ex(gscb, sizeof(*gscb), 0xA7, 0xA5); + gscb->gs_epl_a = (uintptr_t) gsepl; + gs_set_cb((uintptr_t) gscb, true, true, NULL, NULL); + + fill_memory_ex(gscb, sizeof(*gscb), 0x55, 0xAA); + fill_memory_ex(gsepl, sizeof(*gsepl), 0x5A, 0xA5); + gscb->gs_epl_a = (uintptr_t) gsepl; + gs_set_cb((uintptr_t) gscb, true, true, NULL, NULL); + + puts("+++ exited with 0 +++"); + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_s390_guarded_storage && HAVE_ASM_GUARDED_STORAGE_H") + +#endif diff --git a/tests-mx32/s390_guarded_storage.gen.test b/tests-mx32/s390_guarded_storage.gen.test new file mode 100755 index 00000000..28b59814 --- /dev/null +++ b/tests-mx32/s390_guarded_storage.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (s390_guarded_storage -a32 ); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a32 diff --git a/tests-mx32/s390_pci_mmio_read_write.c b/tests-mx32/s390_pci_mmio_read_write.c new file mode 100644 index 00000000..b493948d --- /dev/null +++ b/tests-mx32/s390_pci_mmio_read_write.c @@ -0,0 +1,155 @@ +/* + * Check decoding of s390_pci_mmio_read and s390_pci_mmio_write syscalls. + * + * Copyright (c) 2018 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" +#include <asm/unistd.h> + +#if defined __NR_s390_pci_mmio_read && defined __NR_s390_pci_mmio_write + +# include <errno.h> +# include <stdbool.h> +# include <stdint.h> +# include <stdio.h> +# include <unistd.h> + +static void +do_call(bool wr, kernel_ulong_t mmio_addr, kernel_ulong_t buf, + kernel_ulong_t len, bool buf_valid, const char *buf_str) +{ + long saved_errno = 0; + long rc = 0; + + printf("s390_pci_mmio_%s(%#llx, ", wr ? "write" : "read", + (unsigned long long) mmio_addr); + + if (!wr) { + rc = syscall(__NR_s390_pci_mmio_read, mmio_addr, buf, len); + saved_errno = errno; + } + + if (buf_valid && !rc) { + char *buf_ptr = (char *) (uintptr_t) buf; + + print_quoted_hex(buf_ptr, + len > DEFAULT_STRLEN ? DEFAULT_STRLEN : len); + + if (len > DEFAULT_STRLEN) + printf("..."); + } else { + if (buf_str) + printf("%s", buf_str); + else + printf("%#llx", (unsigned long long) buf); + } + + printf(", %llu) = ", (unsigned long long) len); + + if (wr) + rc = syscall(__NR_s390_pci_mmio_write, mmio_addr, buf, len); + else + errno = saved_errno; + + puts(sprintrc(rc)); +} + +int +main(void) +{ + static const size_t buf_size = DEFAULT_STRLEN + 10; + + char *buf = tail_alloc(buf_size); + + bool bools[] = { true, false }; + + kernel_ulong_t addrs[] = { + 0, + (kernel_ulong_t) 0xdeafbeefdeadc0deULL, + }; + + struct { + kernel_ulong_t buf; + const char *str; + size_t size; + } bufs[] = { + { (kernel_ulong_t) ARG_STR(NULL), 0 }, + { (kernel_ulong_t) (buf + buf_size), NULL, 0 }, + { (kernel_ulong_t) (buf), NULL, buf_size }, + { (kernel_ulong_t) (buf + 9), NULL, buf_size - 9 }, + { (kernel_ulong_t) (buf + 10), NULL, buf_size - 10 }, + { (kernel_ulong_t) (buf + 16), NULL, buf_size - 16 }, + { (kernel_ulong_t) (buf + 26), NULL, buf_size - 26 }, + { (kernel_ulong_t) (buf + 28), NULL, buf_size - 28 }, + }; + + kernel_ulong_t sizes[] = { + 0, + DEFAULT_STRLEN / 2, + DEFAULT_STRLEN - 10, + DEFAULT_STRLEN, + DEFAULT_STRLEN + 1, + buf_size, + buf_size + 10, + (kernel_ulong_t) 0xfacefeedac0ffeedULL, + }; + + unsigned int i, j, k, l; + unsigned int ctr = 0; + + for (i = 0; i < ARRAY_SIZE(addrs); i++) { + for (j = 0; j < ARRAY_SIZE(bufs); j++) { + for (k = 0; k < ARRAY_SIZE(sizes); k++) { + for (l = 0; l < ARRAY_SIZE(bools); l++) { + bool valid = bufs[j].buf && + bufs[j].size >= + MIN(sizes[k], + DEFAULT_STRLEN + 1); + + if (bufs[j].size && bools[l]) + fill_memory_ex((char *) buf, + bufs[j].size, + 0xC0 + ctr, 255); + + do_call(bools[l], addrs[i], bufs[j].buf, + sizes[k], valid, bufs[j].str); + + ctr++; + } + } + } + } + + puts("+++ exited with 0 +++"); + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_s390_pci_mmio_read && __NR_s390_pci_mmio_write"); + +#endif diff --git a/tests-mx32/s390_pci_mmio_read_write.gen.test b/tests-mx32/s390_pci_mmio_read_write.gen.test new file mode 100755 index 00000000..cf32e0b3 --- /dev/null +++ b/tests-mx32/s390_pci_mmio_read_write.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (s390_pci_mmio_read_write -e trace=s390_pci_mmio_read,s390_pci_mmio_write -a30); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -e trace=s390_pci_mmio_read,s390_pci_mmio_write -a30 diff --git a/tests-mx32/s390_runtime_instr.c b/tests-mx32/s390_runtime_instr.c new file mode 100644 index 00000000..861bbd4a --- /dev/null +++ b/tests-mx32/s390_runtime_instr.c @@ -0,0 +1,99 @@ +/* + * Check decoding of s390_runtime_instr syscall. + * + * Copyright (c) 2018 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" +#include <asm/unistd.h> + +#if defined __NR_s390_runtime_instr + +# include <errno.h> +# include <signal.h> +# include <stdio.h> +# include <unistd.h> + +int +main(void) +{ + static struct { + kernel_ulong_t cmd; + const char * cmd_str; + } cmd_args[] = { + { 0, "???" }, + { 4, "???" }, + { (kernel_ulong_t) 0xdeafbeefdeadc0deULL, "???" }, + { 2, "STOP", }, + }; + + static struct { + kernel_ulong_t sig; + const char * sig_str; + } start_sig_args[] = { + { 0, "SIG_0" }, + { (kernel_ulong_t) 0xfacefeedac0ffeedULL, NULL }, + { ARG_STR(SIGALRM) }, + { 33, "SIGRT_1" }, + { 63, "SIGRT_31" }, + }; + + unsigned int i; + long rc; + + for (i = 0; i < ARRAY_SIZE(cmd_args); i++) { + rc = syscall(__NR_s390_runtime_instr, cmd_args[i].cmd, 0xdead); + printf("s390_runtime_instr(%d /* S390_RUNTIME_INSTR_%s */) = " + "%s\n", + (int) cmd_args[i].cmd, cmd_args[i].cmd_str, + sprintrc(rc)); + } + + for (i = 0; i < ARRAY_SIZE(start_sig_args); i++) { + long saved_errno; + + rc = syscall(__NR_s390_runtime_instr, 1, start_sig_args[i].sig); + saved_errno = errno; + printf("s390_runtime_instr(1 /* S390_RUNTIME_INSTR_START */, "); + + if (start_sig_args[i].sig_str) + printf("%s", start_sig_args[i].sig_str); + else + printf("%d", (int) start_sig_args[i].sig); + + errno = saved_errno; + printf(") = %s\n", sprintrc(rc)); + } + + puts("+++ exited with 0 +++"); + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_s390_runtime_instr") + +#endif diff --git a/tests-mx32/s390_runtime_instr.gen.test b/tests-mx32/s390_runtime_instr.gen.test new file mode 100755 index 00000000..9197dc33 --- /dev/null +++ b/tests-mx32/s390_runtime_instr.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (s390_runtime_instr -a50 ); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a50 diff --git a/tests-mx32/s390_sthyi-v.c b/tests-mx32/s390_sthyi-v.c new file mode 100644 index 00000000..86055203 --- /dev/null +++ b/tests-mx32/s390_sthyi-v.c @@ -0,0 +1,2 @@ +#define VERBOSE 1 +#include "s390_sthyi.c" diff --git a/tests-mx32/s390_sthyi-v.gen.test b/tests-mx32/s390_sthyi-v.gen.test new file mode 100755 index 00000000..27ab447b --- /dev/null +++ b/tests-mx32/s390_sthyi-v.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (s390_sthyi-v -e trace=s390_sthyi -a47 -v); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -e trace=s390_sthyi -a47 -v diff --git a/tests-mx32/s390_sthyi.c b/tests-mx32/s390_sthyi.c new file mode 100644 index 00000000..8b241dd2 --- /dev/null +++ b/tests-mx32/s390_sthyi.c @@ -0,0 +1,786 @@ +/* + * Check decoding of s390_sthyi syscall. + * + * Copyright (c) 2018 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" +#include <asm/unistd.h> + +#if defined HAVE_ICONV_H && defined HAVE_ICONV_OPEN && defined __NR_s390_sthyi + +# include <errno.h> +# include <iconv.h> +# include <inttypes.h> +# include <stdbool.h> +# include <stdint.h> +# include <stdio.h> +# include <unistd.h> + +# include <sys/user.h> + +# define EBCDIC_MAX_LEN 16 + +# ifndef VERBOSE +# define VERBOSE 0 +# endif + +static bool +print_0x8(const char *prefix, unsigned char *buf, unsigned int offs, bool zero) +{ + if (!zero && !buf[offs]) + return false; + + printf("%s=%#02hhx", prefix, buf[offs]); + + return true; +} + +static bool +print_u8(const char *prefix, unsigned char *buf, unsigned int offs, bool zero) +{ + if (!zero && !buf[offs]) + return false; + + printf("%s=%hhu", prefix, buf[offs]); + + return true; +} + +static bool +print_u16(const char *prefix, unsigned char *buf, unsigned int offs, bool zero) +{ + uint16_t val = *(uint16_t *) (buf + offs); + + if (!zero && !val) + return false; + + printf("%s=%" PRIu16, prefix, val); + + return true; +} + +static bool +print_x32(const char *prefix, unsigned char *buf, unsigned int offs, bool zero) +{ + uint32_t val = *(uint32_t *) (buf + offs); + + if (!zero && !val) + return false; + + printf("%s=%#" PRIx32, prefix, val); + + return true; +} + +static bool +print_weight(const char *prefix, unsigned char *buf, unsigned int offs, + bool zero) +{ + uint32_t val = *(uint32_t *) (buf + offs); + + if (print_x32(prefix, buf, offs, zero)) { + if (val) + printf(" /* %u %u/65536 cores */", + val >> 16, val & 0xFFFF); + else + printf(" /* unlimited */"); + + return true; + } + + return false; +} + +static char * +ebcdic2ascii(unsigned char *ebcdic, size_t size) +{ + static char ascii_buf[EBCDIC_MAX_LEN]; + + char *ebcdic_pos = (char *) ebcdic; + char *ascii_pos = ascii_buf; + size_t ebcdic_left = size; + size_t ascii_left = size; + size_t ret; + + iconv_t cd = iconv_open("ASCII", "EBCDICUS"); + + if (size > sizeof(ascii_buf)) + error_msg_and_fail("ebcdic2ascii: EBCDIC string is too big: " + "%zu (maximum is %zu)", + size, sizeof(ascii_buf)); + if (cd == (iconv_t) -1) + perror_msg_and_fail("ebcdic2ascii: unable to allocate a " + "conversion descriptior for converting " + "EBCDIC to ASCII"); + + while ((ret = iconv(cd, &ebcdic_pos, &ebcdic_left, + &ascii_pos, &ascii_left)) == (size_t) -1) { + switch (errno) { + case EILSEQ: + case EINVAL: /* That one is quite unexpected, actually */ + if (!ebcdic_left || !ascii_left) + goto ebcdic2ascii_end; + + *ascii_pos++ = ' '; + ebcdic_pos++; + ebcdic_left--; + + break; + + case E2BIG: + perror_msg_and_fail("ebcdic2ascii: ran out of " + "ASCII buffer unexpectedly"); + default: + perror_msg_and_fail("ebcdic2ascii: unexpected error"); + } + } + +ebcdic2ascii_end: + iconv_close(cd); + + if (ebcdic_left != ascii_left) + error_msg_and_fail("ebcdic2ascii: ASCII string differs in size " + "from EBCDIC"); + + return ascii_buf; +} + +# if VERBOSE +static bool +is_empty(unsigned char *ptr, size_t size) +{ + size_t i; + + for (i = 0; !*ptr && i < size; ptr++, i++) + ; + + return i == size; +} +# endif /* !VERBOSE */ + +static bool +print_ebcdic(const char *prefix, unsigned char *addr, unsigned int offs, + size_t size, bool zero, bool blank) +{ + const char *ascii = ebcdic2ascii(addr + offs, size); + + if (!zero) { + size_t i; + + for (i = 0; (addr[offs + i] == (blank ? 64 : 0)) && (i < size); + i++) + ; + + if (i == size) + return false; + } + + printf("%s=", prefix); + print_quoted_hex((char *) (addr + offs), size); + printf(" /* "); + print_quoted_memory(ascii, size); + printf(" */"); + + return true; +} + +static void +print_hypervisor_header(unsigned char *buf, int level, unsigned int offs_pos, + unsigned int len_pos, bool mt) +{ + uint16_t offs = *(uint16_t *) (buf + offs_pos); + uint16_t hdr_size = *(uint16_t *) (buf + len_pos); + unsigned char *cur; + + if (!offs) + return; + if (hdr_size < 32) + error_msg_and_fail("sthyi: hypervisor %d section is too small " + "(got %hu, 32 expected)", level, hdr_size); + + cur = buf + offs; + + printf(", /* hypervisor %d */ {infyflg1", level); + print_0x8("", cur, 0, true); +# if VERBOSE + if (cur[0]) { + bool printed = false; + + printf(" /* "); + if (cur[0] & 0x80) { + printf("0x80 - guest CPU usage had limiting is using " + "the consumption method"); + printed = true; + } + if (cur[0] & 0x40) { + if (printed) + printf(", "); + printf("0x40 - LIMITHARD caps use prorated core time " + "for capping"); + printed = true; + } + if (cur[0] & 0x3F) { + if (printed) + printf(", "); + printf("%#hhx - ???", cur[0] & 0x3F); + } + printf(" */"); + } + + print_0x8(", infyflg2", cur, 1, false); + print_0x8(", infyval1", cur, 2, false); + print_0x8(", infyval2", cur, 3, false); + + print_u8(", infytype", cur, 4, true); + if (cur[4] == 1) + printf(" /* z/VM is the hypervisor */"); + else + printf(" /* unknown hypervisor type */"); + + if (cur[5]) + printf(", reserved_1__=\"\\x%#02hhx\"", cur[5]); + + print_u8(", infycpt", cur, 6, mt); + print_u8(", infyiflt", cur, 7, mt); +# endif /* !VERBOSE */ + + print_ebcdic(", infysyid", cur, 8, 8, VERBOSE, true); + print_ebcdic(", infyclnm", cur, 16, 8, VERBOSE, true); + + print_u16(", infyscps", cur, 24, VERBOSE); + print_u16(", infydcps", cur, 26, VERBOSE); + print_u16(", infysifl", cur, 28, VERBOSE); + print_u16(", infydifl", cur, 30, VERBOSE); + +# if VERBOSE + if (hdr_size > 32 && !is_empty(cur + 32, hdr_size - 32)) { + printf(", "); + print_quoted_hex((char *) (cur + 32), hdr_size - 32); + } +# else /* !VERBOSE */ + printf(", ..."); +# endif /* !VERBOSE */ + + printf("}"); +} + +static void +print_guest_header(unsigned char *buf, int level, unsigned int offs_pos, + unsigned int len_pos) +{ + uint16_t offs = *(uint16_t *) (buf + offs_pos); + uint16_t hdr_size = *(uint16_t *) (buf + len_pos); + unsigned char *cur; + + if (!offs) + return; + if (hdr_size < 56) + error_msg_and_fail("sthyi: guest %d section is too small " + "(got %hu, 56 expected)", level, hdr_size); + + cur = buf + offs; + + printf(", /* guest %d */ {infgflg1", level); + print_0x8("", cur, 0, true); +# if VERBOSE + if (cur[0]) { + bool printed = false; + + printf(" /* "); + if (cur[0] & 0x80) { + printf("0x80 - guest is mobility enabled"); + printed = true; + } + if (cur[0] & 0x40) { + if (printed) + printf(", "); + printf("0x40 - guest has multiple virtual CPU types"); + printed = true; + } + if (cur[0] & 0x20) { + if (printed) + printf(", "); + printf("0x20 - guest CP dispatch type has LIMITHARD " + "cap"); + printed = true; + } + if (cur[0] & 0x10) { + if (printed) + printf(", "); + printf("0x10 - guest IFL dispatch type has LIMITHARD " + "cap"); + printed = true; + } + if (cur[0] & 0x08) { + if (printed) + printf(", "); + printf("0x08 - virtual CPs are thread dispatched"); + printed = true; + } + if (cur[0] & 0x04) { + if (printed) + printf(", "); + printf("0x04 - virtual IFLs are thread dispatched"); + printed = true; + } + if (cur[0] & 0x3) { + if (printed) + printf(", "); + printf("%#hhx - ???", cur[0] & 0x3); + } + printf(" */"); + } + + print_0x8(", infgflg2", cur, 1, false); + print_0x8(", infgval1", cur, 2, false); + print_0x8(", infgval2", cur, 3, false); +# endif /* !VERBOSE */ + + print_ebcdic(", infgusid", cur, 4, 8, true, false); + + print_u16(", infgscps", cur, 12, VERBOSE); + print_u16(", infgdcps", cur, 14, VERBOSE); + +# if VERBOSE + print_u8(", infgcpdt", cur, 16, true); + if (cur[16] == 0) + printf(" /* General Purpose (CP) */"); + else + printf(" /* unknown */"); + + if (cur[17] || cur[18] || cur[19]) + printf(", reserved_1__=\"\\x%#02hhx\\x%#02hhx\\x%#02hhx\"", + cur[17], cur[18], cur[19]); +# endif /* !VERBOSE */ + + print_weight(", infgcpcc", cur, 20, VERBOSE); + + print_u16(", infgsifl", cur, 24, VERBOSE); + print_u16(", infgdifl", cur, 26, VERBOSE); + +# if VERBOSE + print_u8(", infgifdt", cur, 28, true); + if (cur[28] == 0) + printf(" /* General Purpose (CP) */"); + else if (cur[28] == 3) + printf(" /* Integrated Facility for Linux (IFL) */"); + else + printf(" /* unknown */"); + + if (cur[29] || cur[30] || cur[31]) + printf(", reserved_2__=\"\\x%#02hhx\\x%#02hhx\\x%#02hhx\"", + cur[29], cur[30], cur[31]); +# endif /* !VERBOSE */ + + print_weight(", infgifcc", cur, 32, VERBOSE); + + print_0x8(", infgpflg", cur, 36, true); +# if VERBOSE + if (cur[36]) { + bool printed = false; + + printf(" /* "); + if (cur[36] & 0x80) { + printf("0x80 - CPU pool's CP virtual type has " + "LIMITHARD cap"); + printed = true; + } + if (cur[36] & 0x40) { + if (printed) + printf(", "); + printf("0x40 - CPU pool's CP virtual type has " + "CAPACITY cap"); + printed = true; + } + if (cur[36] & 0x20) { + if (printed) + printf(", "); + printf("0x20 - CPU pool's IFL virtual type has " + "LIMITHARD cap"); + printed = true; + } + if (cur[36] & 0x10) { + if (printed) + printf(", "); + printf("0x10 - CPU pool's IFL virtual type has " + "CAPACITY cap"); + printed = true; + } + if (cur[36] & 0x08) { + if (printed) + printf(", "); + printf("0x08 - CPU pool uses prorated core time"); + printed = true; + } + if (cur[36] & 0x7) { + if (printed) + printf(", "); + printf("%#hhx - ???", cur[36] & 0x7); + } + printf(" */"); + } + + if (cur[37] || cur[38] || cur[39]) + printf(", reserved_3__=\"\\x%#02hhx\\x%#02hhx\\x%#02hhx\"", + cur[37], cur[38], cur[39]); + + print_ebcdic(", infgpnam", cur, 40, 8, false, true); + + print_weight(", infgpccc", cur, 48, true); + print_weight(", infgpicc", cur, 52, true); + + if (hdr_size > 56 && !is_empty(cur + 56, hdr_size - 56)) { + printf(", "); + print_quoted_hex((char *) (cur + 56), hdr_size - 56); + } +# else /* !VERBOSE */ + printf(", ..."); +# endif /* !VERBOSE */ + + printf("}"); +} + +static void +print_sthyi(unsigned char *buf) +{ + unsigned char *cur; + uint16_t hdr_size; + uint16_t offs; + bool mt = false; + + hdr_size = *(uint16_t *) (buf + 10); + if (hdr_size < 44) + error_msg_and_fail("sthyi: header section is too small " + "(got %hu, 44 expected)", hdr_size); + + /* INFHFLG1 */ + print_0x8("{/* header */ {infhflg1", buf, 0, true); +# if VERBOSE + if (buf[0]) { + bool printed = false; + + printf(" /* "); + if (buf[0] & 0x80) { + printf("0x80 - Global Performance Data unavailable"); + printed = true; + } + if (buf[0] & 0x40) { + if (printed) + printf(", "); + printf("0x40 - One or more hypervisor levels below " + "this level does not support the STHYI " + "instruction"); + printed = true; + } + if (buf[0] & 0x20) { + if (printed) + printf(", "); + printf("0x20 - Virtualization stack is incomplete"); + printed = true; + } + if (buf[0] & 0x10) { + if (printed) + printf(", "); + printf("0x10 - Execution environment is not within a " + "logical partition"); + printed = true; + } + if (buf[0] & 0xF) { + if (printed) + printf(", "); + printf("%#hhx - ???", buf[0] & 0xF); + } + printf(" */"); + } + + print_0x8(", infhflg2", buf, 1, false); + print_0x8(", infhval1", buf, 2, false); + print_0x8(", infhval2", buf, 3, false); + + /* Reserved */ + if (buf[4] || buf[5] || buf[6]) + printf(", reserved_1__=\"\\x%#02hhx\\x%#02hhx\\x%#02hhx\"", + buf[4], buf[5], buf[6]); + + print_u8(", infhygct", buf, 7, true); + print_u16(", infhtotl", buf, 8, true); + print_u16(", infhdln", buf, 10, true); + print_u16(", infmoff", buf, 12, true); + print_u16(", infmlen", buf, 14, true); + print_u16(", infpoff", buf, 16, true); + print_u16(", infplen", buf, 18, true); + print_u16(", infhoff1", buf, 20, true); + print_u16(", infhlen1", buf, 22, true); + print_u16(", infgoff1", buf, 24, true); + print_u16(", infglen1", buf, 26, true); + print_u16(", infhoff2", buf, 28, true); + print_u16(", infhlen2", buf, 30, true); + print_u16(", infgoff2", buf, 32, true); + print_u16(", infglen2", buf, 34, true); + print_u16(", infhoff3", buf, 36, true); + print_u16(", infhlen3", buf, 38, true); + print_u16(", infgoff3", buf, 40, true); + print_u16(", infglen3", buf, 42, true); + + if (hdr_size > 44 && !is_empty(buf + 44, hdr_size - 44)) { + printf(", "); + print_quoted_hex((char *) (buf + 44), hdr_size - 44); + } +# else /* !VERBOSE */ + printf(", ..."); +# endif /* !VERBOSE */ + + printf("}"); + + /* Machine header */ + offs = *(uint16_t *) (buf + 12); + if (!offs) + goto partition_hdr; + + hdr_size = *(uint16_t *) (buf + 14); + if (hdr_size < 60) + error_msg_and_fail("sthyi: machine section is too small " + "(got %hu, 60 expected)", hdr_size); + + cur = buf + offs; + + printf(", /* machine */ {"); + +# if VERBOSE + print_0x8("infmflg1", cur, 0, false); + if (cur[0]) + printf(", "); + print_0x8("infmflg2", cur, 1, false); + if (cur[1]) + printf(", "); +# endif /* !VERBOSE */ + print_0x8("infmval1", cur, 2, true); + + bool cnt_valid = cur[2] & 0x80; +# if VERBOSE + bool id_valid = cur[2] & 0x40; + bool name_valid = cur[2] & 0x20; + + printf(" /* processor count validity: %d, machine ID validity: %d, " + "machine name validity: %d", + !!cnt_valid, !!id_valid, !!name_valid); + if (cur[2] & 0x1F) + printf(", %#hhx - ???", cur[2] & 0x1F); + printf(" */"); + print_0x8(", infmval2", cur, 3, false); +# endif /* !VERBOSE */ + + print_u16(", infmscps", cur, 4, cnt_valid); + print_u16(", infmdcps", cur, 6, cnt_valid); + print_u16(", infmsifl", cur, 8, cnt_valid); + print_u16(", infmdifl", cur, 10, cnt_valid); + +# if VERBOSE + print_ebcdic(", infmname", cur, 12, 8, name_valid, false); + + print_ebcdic(", infmtype", cur, 20, 4, id_valid, false); + print_ebcdic(", infmmanu", cur, 24, 16, id_valid, false); + print_ebcdic(", infmseq", cur, 40, 16, id_valid, false); + print_ebcdic(", infmpman", cur, 56, 4, id_valid, false); + + if (hdr_size > 60 && !is_empty(cur + 60, hdr_size - 60)) { + printf(", "); + print_quoted_hex((char *) (cur + 60), hdr_size - 60); + } +# else /* !VERBOSE */ + printf(", ..."); +# endif /* !VERBOSE */ + + printf("}"); + +partition_hdr: + /* Partition header */ + offs = *(uint16_t *) (buf + 16); + if (!offs) + goto hv_hdr; + + hdr_size = *(uint16_t *) (buf + 18); + if (hdr_size < 56) + error_msg_and_fail("sthyi: partition section is too small " + "(got %hu, 56 expected)", hdr_size); + + cur = buf + offs; + + print_0x8(", /* partition */ {infpflg1", cur, 0, true); + mt = !!(cur[0] & 0x80); +# if VERBOSE + if (cur[0]) { + bool printed = false; + + printf(" /* "); + if (cur[0] & 0x80) { + printf("0x80 - multithreading is enabled"); + printed = true; + } + if (cur[0] & 0x7F) { + if (printed) + printf(", "); + printf("%#hhx - ???", cur[0] & 0x7F); + } + printf(" */"); + } + print_0x8(", infpflg2", cur, 1, false); +# endif /* !VERBOSE */ + print_0x8(", infpval1", cur, 2, true); + + bool pcnt_valid = cur[2] & 0x80; + bool pid_valid = cur[2] & 0x10; +# if VERBOSE + bool pwcap_valid = cur[2] & 0x40; + bool pacap_valid = cur[2] & 0x20; + bool lpar_valid = cur[2] & 0x08; +# endif /* !VERBOSE */ + +# if VERBOSE + printf(" /* processor count validity: %d, partition weight-based " + "capacity validity: %d, partition absolute capacity validity: " + "%d, partition ID validity: %d, LPAR group absolute capacity " + "capping information validity: %d", + !!pcnt_valid, !!pwcap_valid, !!pacap_valid, !!pid_valid, + !!lpar_valid); + if (cur[2] & 0x7) + printf(", %#hhx - ???", cur[2] & 0x7); + printf(" */"); + + print_0x8(", infpval2", cur, 3, false); +# endif /* !VERBOSE */ + + print_u16(", infppnum", cur, 4, pid_valid); + + print_u16(", infpscps", cur, 6, pcnt_valid); + print_u16(", infpdcps", cur, 8, pcnt_valid); + print_u16(", infpsifl", cur, 10, pcnt_valid); + print_u16(", infpdifl", cur, 12, pcnt_valid); + +# if VERBOSE + if (cur[14] || cur[15]) + printf(", reserved_1__=\"\\x%#02hhx\\x%#02hhx\"", + cur[14], cur[15]); +# endif /* !VERBOSE */ + + print_ebcdic(", infppnam", cur, 16, 8, pid_valid, false); + +# if VERBOSE + print_weight(", infpwbcp", cur, 24, pwcap_valid); + print_weight(", infpabcp", cur, 28, pacap_valid); + print_weight(", infpwbif", cur, 32, pwcap_valid); + print_weight(", infpabif", cur, 36, pacap_valid); + + if (print_ebcdic(", infplgnm", cur, 40, 8, false, false)) { + + print_weight(", infplgcp", cur, 48, false); + print_weight(", infplgif", cur, 52, false); + } else { + if (lpar_valid) { + printf(", infplgnm="); + print_quoted_hex((char *) (cur + 40), 8); + } + + print_x32(", infplgcp", cur, 48, false); + print_x32(", infplgif", cur, 52, false); + } + + if (hdr_size > 56 && !is_empty(cur + 56, hdr_size - 56)) { + printf(", "); + print_quoted_hex((char *) (cur + 56), hdr_size - 56); + } +# else /* !VERBOSE */ + printf(", ..."); +# endif /* !VERBOSE */ + + printf("}"); + +hv_hdr: + /* Hypervisor/guest headers */ + print_hypervisor_header(buf, 1, 20, 22, mt); + print_guest_header(buf, 1, 24, 26); + print_hypervisor_header(buf, 2, 28, 30, mt); + print_guest_header(buf, 2, 32, 34); + print_hypervisor_header(buf, 3, 36, 38, mt); + print_guest_header(buf, 3, 40, 42); + + printf("}"); +} + +int +main(void) +{ + static const kernel_ulong_t bogus_func = + (kernel_ulong_t) 0xdeafbeefdeadc0deULL; + static const kernel_ulong_t bogus_resp_buf = + (kernel_ulong_t) 0xfacefeedac0ffeedULL; + static const kernel_ulong_t bogus_ret_code = + (kernel_ulong_t) 0xf00dfa57decaffedULL; + static const kernel_ulong_t bogus_flags = + (kernel_ulong_t) 0xfee1deadfa57beefULL; + + unsigned char *buf = tail_alloc(PAGE_SIZE); + uint64_t *ret = tail_alloc(sizeof(*ret)); + + long rc; + + rc = syscall(__NR_s390_sthyi, 0, 0, 0, 0); + printf("s390_sthyi(STHYI_FC_CP_IFL_CAP, NULL, NULL, 0) = %s\n", + sprintrc(rc)); + + rc = syscall(__NR_s390_sthyi, bogus_func, bogus_resp_buf, + bogus_ret_code, bogus_flags); + printf("s390_sthyi(%#llx /* STHYI_FC_??? */, %#llx, %#llx, %#llx) = " + "%s\n", + (unsigned long long) bogus_func, + (unsigned long long) bogus_resp_buf, + (unsigned long long) bogus_ret_code, + (unsigned long long) bogus_flags, + sprintrc(rc)); + + rc = syscall(__NR_s390_sthyi, bogus_func, buf, ret, 0); + printf("s390_sthyi(%#llx /* STHYI_FC_??? */, %p, %p, 0) = %s\n", + (unsigned long long) bogus_func, buf, ret, sprintrc(rc)); + + rc = syscall(__NR_s390_sthyi, 0, buf, ret, 0); + if (rc) + error_msg_and_fail("syscall(__NR_s390_sthyi, 0, buf, ret, 0) " + "returned unexpected value of %ld", rc); + + printf("s390_sthyi(STHYI_FC_CP_IFL_CAP, "); + print_sthyi(buf); + printf(", [0], 0) = 0\n"); + + puts("+++ exited with 0 +++"); + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("HAVE_ICONV_H && HAVE_ICONV_OPEN && __NR_s390_sthyi") + +#endif diff --git a/tests-mx32/s390_sthyi.gen.test b/tests-mx32/s390_sthyi.gen.test new file mode 100755 index 00000000..cf271374 --- /dev/null +++ b/tests-mx32/s390_sthyi.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (s390_sthyi -a47 ); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a47 diff --git a/tests-mx32/sched_rr_get_interval.gen.test b/tests-mx32/sched_rr_get_interval.gen.test index 493de644..02aad002 100755 --- a/tests-mx32/sched_rr_get_interval.gen.test +++ b/tests-mx32/sched_rr_get_interval.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sched_rr_get_interval -a31); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sched_rr_get_interval -a31 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a31 +run_strace_match_diff -a31 diff --git a/tests-mx32/sched_yield.gen.test b/tests-mx32/sched_yield.gen.test index 3f4542ff..4b035fd8 100755 --- a/tests-mx32/sched_yield.gen.test +++ b/tests-mx32/sched_yield.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sched_yield -a14); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sched_yield -a14 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a14 +run_strace_match_diff -a14 diff --git a/tests-mx32/select-P.c b/tests-mx32/select-P.c new file mode 100644 index 00000000..868deed6 --- /dev/null +++ b/tests-mx32/select-P.c @@ -0,0 +1,2 @@ +#define PATH_TRACING_FD 9 +#include "select.c" diff --git a/tests-mx32/select-P.gen.test b/tests-mx32/select-P.gen.test new file mode 100755 index 00000000..2f6fc7bc --- /dev/null +++ b/tests-mx32/select-P.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (select-P -a36 -e trace=select -P /dev/full 9>>/dev/full); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a36 -e trace=select -P /dev/full 9>>/dev/full diff --git a/tests-mx32/select.gen.test b/tests-mx32/select.gen.test index cb3b8f15..23836149 100755 --- a/tests-mx32/select.gen.test +++ b/tests-mx32/select.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (select -a36); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (select -a36 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a36 +run_strace_match_diff -a36 diff --git a/tests-mx32/sendfile.gen.test b/tests-mx32/sendfile.gen.test index 433878f8..d32ef3ad 100755 --- a/tests-mx32/sendfile.gen.test +++ b/tests-mx32/sendfile.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sendfile -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sendfile -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests-mx32/sendfile64.gen.test b/tests-mx32/sendfile64.gen.test index 1655dd32..24f0746f 100755 --- a/tests-mx32/sendfile64.gen.test +++ b/tests-mx32/sendfile64.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sendfile64 -a29); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sendfile64 -a29 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a29 +run_strace_match_diff -a29 diff --git a/tests-mx32/set_ptracer_any.c b/tests-mx32/set_ptracer_any.c index 3b4ea2cb..3c112961 100644 --- a/tests-mx32/set_ptracer_any.c +++ b/tests-mx32/set_ptracer_any.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2013-2015 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2013-2017 The strace developers. + * Copyright (c) 2013-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,10 +37,16 @@ int main(int argc, char **argv) { if (argc < 2) return 99; -#if defined HAVE_PRCTL && defined PR_SET_PTRACER && defined PR_SET_PTRACER_ANY - /* Turn off restrictions on tracing if applicable. If the options +#ifdef HAVE_PRCTL + /* Turn off restrictions on tracing if applicable. If the command * aren't available on this system, that's OK too. */ - (void) prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY); +# ifndef PR_SET_PTRACER +# define PR_SET_PTRACER 0x59616d61 +# endif +# ifndef PR_SET_PTRACER_ANY +# define PR_SET_PTRACER_ANY -1UL +# endif + (void) prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY, 0, 0, 0); #endif if (write(1, "\n", 1) != 1) { perror("write"); diff --git a/tests-mx32/setdomainname.gen.test b/tests-mx32/setdomainname.gen.test index 2b12e082..1f29563f 100755 --- a/tests-mx32/setdomainname.gen.test +++ b/tests-mx32/setdomainname.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setdomainname -a24); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setdomainname -a24 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a24 +run_strace_match_diff -a24 diff --git a/tests-mx32/setfsgid.gen.test b/tests-mx32/setfsgid.gen.test index caff4012..bbb30cc1 100755 --- a/tests-mx32/setfsgid.gen.test +++ b/tests-mx32/setfsgid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setfsgid -a12); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setfsgid -a12 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a12 +run_strace_match_diff -a12 diff --git a/tests-mx32/setfsgid32.gen.test b/tests-mx32/setfsgid32.gen.test index fae29e01..63b3eca0 100755 --- a/tests-mx32/setfsgid32.gen.test +++ b/tests-mx32/setfsgid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setfsgid32 -a14); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setfsgid32 -a14 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a14 +run_strace_match_diff -a14 diff --git a/tests-mx32/setfsuid.gen.test b/tests-mx32/setfsuid.gen.test index e4c4d209..5896b303 100755 --- a/tests-mx32/setfsuid.gen.test +++ b/tests-mx32/setfsuid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setfsuid -a12); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setfsuid -a12 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a12 +run_strace_match_diff -a12 diff --git a/tests-mx32/setfsuid32.gen.test b/tests-mx32/setfsuid32.gen.test index b6cd67d7..52d0820f 100755 --- a/tests-mx32/setfsuid32.gen.test +++ b/tests-mx32/setfsuid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setfsuid32 -a14); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setfsuid32 -a14 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a14 +run_strace_match_diff -a14 diff --git a/tests-mx32/setgid.gen.test b/tests-mx32/setgid.gen.test index f10add65..be188d1f 100755 --- a/tests-mx32/setgid.gen.test +++ b/tests-mx32/setgid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setgid -a10); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setgid -a10 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a10 +run_strace_match_diff -a10 diff --git a/tests-mx32/setgid32.gen.test b/tests-mx32/setgid32.gen.test index 26f194ec..9020b809 100755 --- a/tests-mx32/setgid32.gen.test +++ b/tests-mx32/setgid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setgid32 -a12); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setgid32 -a12 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a12 +run_strace_match_diff -a12 diff --git a/tests-mx32/sethostname.gen.test b/tests-mx32/sethostname.gen.test index 2827b1dc..d68ed189 100755 --- a/tests-mx32/sethostname.gen.test +++ b/tests-mx32/sethostname.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sethostname -a22); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sethostname -a22 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a22 +run_strace_match_diff -a22 diff --git a/tests-mx32/setns.gen.test b/tests-mx32/setns.gen.test index 45fcc601..e25738bf 100755 --- a/tests-mx32/setns.gen.test +++ b/tests-mx32/setns.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setns -a21); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setns -a21 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a21 +run_strace_match_diff -a21 diff --git a/tests-mx32/setregid.gen.test b/tests-mx32/setregid.gen.test index 0125d7a9..f84b1acb 100755 --- a/tests-mx32/setregid.gen.test +++ b/tests-mx32/setregid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setregid -a15); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setregid -a15 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a15 +run_strace_match_diff -a15 diff --git a/tests-mx32/setregid32.gen.test b/tests-mx32/setregid32.gen.test index 24f1505b..7320c8cf 100755 --- a/tests-mx32/setregid32.gen.test +++ b/tests-mx32/setregid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setregid32 -a17); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setregid32 -a17 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a17 +run_strace_match_diff -a17 diff --git a/tests-mx32/setresgid.gen.test b/tests-mx32/setresgid.gen.test index ca5bc6b7..792313c2 100755 --- a/tests-mx32/setresgid.gen.test +++ b/tests-mx32/setresgid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setresgid -a19); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setresgid -a19 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a19 +run_strace_match_diff -a19 diff --git a/tests-mx32/setresgid32.gen.test b/tests-mx32/setresgid32.gen.test index a5edb905..6ecf936b 100755 --- a/tests-mx32/setresgid32.gen.test +++ b/tests-mx32/setresgid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setresgid32 -a21); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setresgid32 -a21 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a21 +run_strace_match_diff -a21 diff --git a/tests-mx32/setresuid.gen.test b/tests-mx32/setresuid.gen.test index a6e06641..a0dcb4ba 100755 --- a/tests-mx32/setresuid.gen.test +++ b/tests-mx32/setresuid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setresuid -a19); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setresuid -a19 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a19 +run_strace_match_diff -a19 diff --git a/tests-mx32/setresuid32.gen.test b/tests-mx32/setresuid32.gen.test index 3fbf36be..a9f43969 100755 --- a/tests-mx32/setresuid32.gen.test +++ b/tests-mx32/setresuid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setresuid32 -a21); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setresuid32 -a21 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a21 +run_strace_match_diff -a21 diff --git a/tests-mx32/setreuid.gen.test b/tests-mx32/setreuid.gen.test index 4c3dc930..0ecaef0b 100755 --- a/tests-mx32/setreuid.gen.test +++ b/tests-mx32/setreuid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setreuid -a15); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setreuid -a15 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a15 +run_strace_match_diff -a15 diff --git a/tests-mx32/setreuid32.gen.test b/tests-mx32/setreuid32.gen.test index d1790538..3eb0e95a 100755 --- a/tests-mx32/setreuid32.gen.test +++ b/tests-mx32/setreuid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setreuid32 -a17); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setreuid32 -a17 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a17 +run_strace_match_diff -a17 diff --git a/tests-mx32/setrlimit.gen.test b/tests-mx32/setrlimit.gen.test index dfe2da38..0d1508d3 100755 --- a/tests-mx32/setrlimit.gen.test +++ b/tests-mx32/setrlimit.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setrlimit -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setrlimit -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests-mx32/setugid.c b/tests-mx32/setugid.c index aba277c5..6ceec7fc 100644 --- a/tests-mx32/setugid.c +++ b/tests-mx32/setugid.c @@ -2,6 +2,7 @@ * Check decoding of setuid/setgid/setuid32/setgid32 syscalls. * * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -61,6 +62,8 @@ main(void) const unsigned int num = (unsigned UGID_TYPE) tests[i]; long expected; + errno = 0; + if (num == ugid) expected = 0; else if ((UGID_TYPE) num == (UGID_TYPE) -1U) @@ -77,8 +80,9 @@ main(void) SYSCALL_NAME, ugid, errstr); break; } - perror_msg_and_fail("%s(%#lx) != %ld", - SYSCALL_NAME, tests[i], expected); + perror_msg_and_fail("%s(%#lx) = %ld != %ld", + SYSCALL_NAME, tests[i], + rc, expected); } printf("%s(", SYSCALL_NAME); diff --git a/tests-mx32/setuid.gen.test b/tests-mx32/setuid.gen.test index 98d470fd..00aeb7a2 100755 --- a/tests-mx32/setuid.gen.test +++ b/tests-mx32/setuid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setuid -a10); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setuid -a10 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a10 +run_strace_match_diff -a10 diff --git a/tests-mx32/setuid32.gen.test b/tests-mx32/setuid32.gen.test index 7d15495c..ac8df8f2 100755 --- a/tests-mx32/setuid32.gen.test +++ b/tests-mx32/setuid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setuid32 -a12); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setuid32 -a12 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a12 +run_strace_match_diff -a12 diff --git a/tests-mx32/shmxt.c b/tests-mx32/shmxt.c index 23cc7ccf..398667c8 100644 --- a/tests-mx32/shmxt.c +++ b/tests-mx32/shmxt.c @@ -18,6 +18,10 @@ cleanup(void) # define SHMAT "shmat" #endif +#ifndef SHM_EXEC +# define SHM_EXEC 0100000 +#endif + int main(void) { @@ -34,8 +38,8 @@ main(void) atexit(cleanup); rc = (long) shmat(bogus_shmid, bogus_shmaddr, bogus_shmflg); - printf("%s(%d, %p, SHM_REMAP|SHM_RDONLY|SHM_RND|%#x) = %s\n", - SHMAT, bogus_shmid, bogus_shmaddr, bogus_shmflg & ~0x7000, + printf("%s(%d, %p, SHM_RDONLY|SHM_RND|SHM_REMAP|SHM_EXEC|%#x) = %s\n", + SHMAT, bogus_shmid, bogus_shmaddr, bogus_shmflg & ~0xf000, sprintrc(rc)); shmat(id, NULL, SHM_REMAP); @@ -50,18 +54,31 @@ main(void) rc = shmdt(NULL); printf("shmdt(NULL) = %s\n", sprintrc(rc)); - if (shmdt(shmaddr)) - perror_msg_and_skip("shmdt"); - printf("shmdt(%p) = 0\n", shmaddr); + rc = shmdt(shmaddr); + printf("shmdt(%p) = %s\n", shmaddr, sprintrc(rc)); ++shmaddr; void *shmaddr2 = shmat(id, shmaddr, SHM_RND); if (shmaddr2 == (void *)(-1)) printf("%s(%d, %p, SHM_RND) = -1 %s (%m)\n", SHMAT, id, shmaddr, errno2name()); - else + else { printf("%s(%d, %p, SHM_RND) = %p\n", SHMAT, id, shmaddr, shmaddr2); + rc = shmdt(shmaddr2); + printf("shmdt(%p) = %s\n", shmaddr2, sprintrc(rc)); + } + + shmaddr = shmat(id, NULL, SHM_RDONLY|SHM_EXEC); + if (shmaddr == (void *)(-1)) + printf("%s(%d, NULL, SHM_RDONLY|SHM_EXEC) = %s\n", + SHMAT, id, sprintrc(-1)); + else { + printf("%s(%d, NULL, SHM_RDONLY|SHM_EXEC) = %p\n", + SHMAT, id, shmaddr); + rc = shmdt(shmaddr); + printf("shmdt(%p) = %s\n", shmaddr, sprintrc(rc)); + } puts("+++ exited with 0 +++"); return 0; diff --git a/tests-mx32/shutdown.gen.test b/tests-mx32/shutdown.gen.test index 3412513f..7fde46ee 100755 --- a/tests-mx32/shutdown.gen.test +++ b/tests-mx32/shutdown.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (shutdown -a24); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (shutdown -a24 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a24 +run_strace_match_diff -a24 diff --git a/tests-mx32/sigaction.gen.test b/tests-mx32/sigaction.gen.test index dee340e8..1db6b3aa 100755 --- a/tests-mx32/sigaction.gen.test +++ b/tests-mx32/sigaction.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sigaction -a31); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sigaction -a31 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a31 +run_strace_match_diff -a31 diff --git a/tests-mx32/signalfd4.gen.test b/tests-mx32/signalfd4.gen.test index e91a9fe4..dee4274c 100755 --- a/tests-mx32/signalfd4.gen.test +++ b/tests-mx32/signalfd4.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (signalfd4 ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (signalfd4 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/sigpending.gen.test b/tests-mx32/sigpending.gen.test index 0f4259a3..c061868c 100755 --- a/tests-mx32/sigpending.gen.test +++ b/tests-mx32/sigpending.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sigpending -a15); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sigpending -a15 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a15 +run_strace_match_diff -a15 diff --git a/tests-mx32/sigprocmask.gen.test b/tests-mx32/sigprocmask.gen.test index 44a508ce..065b74d7 100755 --- a/tests-mx32/sigprocmask.gen.test +++ b/tests-mx32/sigprocmask.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sigprocmask -a34); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sigprocmask -a34 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a34 +run_strace_match_diff -a34 diff --git a/tests-mx32/sigreturn.gen.test b/tests-mx32/sigreturn.gen.test index f317e893..3b67c9d0 100755 --- a/tests-mx32/sigreturn.gen.test +++ b/tests-mx32/sigreturn.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sigreturn -esignal='!USR1'); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sigreturn -esignal='!USR1' ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -esignal='!USR1' +run_strace_match_diff -esignal='!USR1' diff --git a/tests-mx32/socketcall.gen.test b/tests-mx32/socketcall.gen.test index 95c45fd7..d18b0364 100755 --- a/tests-mx32/socketcall.gen.test +++ b/tests-mx32/socketcall.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (socketcall -a20); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (socketcall -a20 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a20 +run_strace_match_diff -a20 diff --git a/tests-mx32/sockname.c b/tests-mx32/sockname.c index 58726712..bba9a892 100644 --- a/tests-mx32/sockname.c +++ b/tests-mx32/sockname.c @@ -2,7 +2,7 @@ * Check decoding of sockname family syscalls. * * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,7 +42,9 @@ # error TEST_SYSCALL_NAME must be defined #endif -#define TEST_SYSCALL_STR STRINGIFY_VAL(TEST_SYSCALL_NAME) +#ifndef TEST_SYSCALL_STR +# define TEST_SYSCALL_STR STRINGIFY_VAL(TEST_SYSCALL_NAME) +#endif #define TEST_SOCKET TEST_SYSCALL_STR ".socket" #ifdef TEST_SYSCALL_PREPARE diff --git a/tests-mx32/sockopt-sol_netlink.c b/tests-mx32/sockopt-sol_netlink.c new file mode 100644 index 00000000..066920c6 --- /dev/null +++ b/tests-mx32/sockopt-sol_netlink.c @@ -0,0 +1,213 @@ +/* + * Check decoding of getsockopt and setsockopt for SOL_NETLINK level. + * + * Copyright (c) 2017 Dmitry V. Levin <ldv@altlinux.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" +#include "netlink.h" +#include <stdio.h> + +#ifndef SOL_NETLINK +# define SOL_NETLINK 270 +#endif + +static int rc; +static const char *errstr; + +static int +get_sockopt(int fd, int name, void *val, socklen_t *len) +{ + rc = getsockopt(fd, SOL_NETLINK, name, val, len); + errstr = sprintrc(rc); + return rc; +} + +static int +set_sockopt(int fd, int name, void *val, socklen_t len) +{ + rc = setsockopt(fd, SOL_NETLINK, name, val, len); + errstr = sprintrc(rc); + return rc; +} + +int +main(void) +{ + static const struct { + int val; + const char *str; + } names[] = { +#ifdef NETLINK_ADD_MEMBERSHIP + { ARG_STR(NETLINK_ADD_MEMBERSHIP) }, +#endif +#ifdef NETLINK_DROP_MEMBERSHIP + { ARG_STR(NETLINK_DROP_MEMBERSHIP) }, +#endif +#ifdef NETLINK_PKTINFO + { ARG_STR(NETLINK_PKTINFO) }, +#endif +#ifdef NETLINK_BROADCAST_ERROR + { ARG_STR(NETLINK_BROADCAST_ERROR) }, +#endif +#ifdef NETLINK_NO_ENOBUFS + { ARG_STR(NETLINK_NO_ENOBUFS) }, +#endif +#ifdef NETLINK_RX_RING + { ARG_STR(NETLINK_RX_RING) }, +#endif +#ifdef NETLINK_TX_RING + { ARG_STR(NETLINK_TX_RING) }, +#endif +#ifdef NETLINK_LISTEN_ALL_NSID + { ARG_STR(NETLINK_LISTEN_ALL_NSID) }, +#endif +#ifdef NETLINK_LIST_MEMBERSHIPS + { ARG_STR(NETLINK_LIST_MEMBERSHIPS) }, +#endif +#ifdef NETLINK_CAP_ACK + { ARG_STR(NETLINK_CAP_ACK) }, +#endif +#ifdef NETLINK_EXT_ACK + { ARG_STR(NETLINK_EXT_ACK) }, +#endif + }; + + TAIL_ALLOC_OBJECT_CONST_PTR(int, val); + TAIL_ALLOC_OBJECT_CONST_PTR(socklen_t, len); + void *const efault = val + 1; + int fd = socket(AF_NETLINK, SOCK_RAW, 0); + if (fd < 0) + perror_msg_and_skip("socket AF_NETLINK SOCK_RAW"); + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(names); ++i) { + /* getsockopt */ + + /* classic */ + *len = sizeof(*val); + get_sockopt(fd, names[i].val, val, len); + printf("getsockopt(%d, SOL_NETLINK, %s, ", fd, names[i].str); + if (rc) + printf("%p", val); + else + printf("[%d]", *val); + printf(", [%d]) = %s\n", *len, errstr); + + /* optlen larger than necessary - shortened */ + *len = sizeof(*val) + 1; + get_sockopt(fd, names[i].val, val, len); + printf("getsockopt(%d, SOL_NETLINK, %s, ", fd, names[i].str); + if (rc) + printf("%p", val); + else + printf("[%d]", *val); + printf(", [%d", (int) sizeof(*val) + 1); + if ((int) sizeof(*val) + 1 != *len) + printf("->%d", *len); + printf("]) = %s\n", errstr); + + /* zero optlen - print returned optlen */ + *len = 0; + get_sockopt(fd, names[i].val, NULL, len); + printf("getsockopt(%d, SOL_NETLINK, %s, NULL, [0", + fd, names[i].str); + if (*len) + printf("->%d", *len); + printf("]) = %s\n", errstr); + +#ifdef NETLINK_LIST_MEMBERSHIPS + if (names[i].val != NETLINK_LIST_MEMBERSHIPS) { +#endif + /* optlen shorter than necessary - print address */ + *len = sizeof(*val) - 1; + get_sockopt(fd, names[i].val, val, len); + printf("getsockopt(%d, SOL_NETLINK, %s, %p, [%d", + fd, names[i].str, val, (int) sizeof(*val) - 1); + if ((int) sizeof(*val) - 1 != *len) + printf("->%d", *len); + printf("]) = %s\n", errstr); +#ifdef NETLINK_LIST_MEMBERSHIPS + } else { + /* optlen shorter than required for the first element */ + *len = sizeof(*val) - 1; + get_sockopt(fd, names[i].val, efault, len); + printf("getsockopt(%d, SOL_NETLINK, %s, ", + fd, names[i].str); + if (rc) + printf("%p", efault); + else + printf("[]"); + printf(", [%d", (int) sizeof(*val) - 1); + if ((int) sizeof(*val) - 1 != *len) + printf("->%d", *len); + printf("]) = %s\n", errstr); + } +#endif + + /* optval EFAULT - print address */ + *len = sizeof(*val); + get_sockopt(fd, names[i].val, efault, len); + printf("getsockopt(%d, SOL_NETLINK, %s, %p, [%d]) = %s\n", + fd, names[i].str, efault, *len, errstr); + + /* optlen EFAULT - print address */ + get_sockopt(fd, names[i].val, val, len + 1); + printf("getsockopt(%d, SOL_NETLINK, %s, %p, %p) = %s\n", + fd, names[i].str, val, len + 1, errstr); + + /* setsockopt */ + + /* classic */ + *val = 0xdefaced; + set_sockopt(fd, names[i].val, val, sizeof(*val)); + printf("setsockopt(%d, SOL_NETLINK, %s, [%d], %d) = %s\n", + fd, names[i].str, *val, (int) sizeof(*val), errstr); + + /* optlen larger than necessary - shortened */ + set_sockopt(fd, names[i].val, val, sizeof(*val) + 1); + printf("setsockopt(%d, SOL_NETLINK, %s, [%d], %d) = %s\n", + fd, names[i].str, *val, (int) sizeof(*val) + 1, errstr); + + /* optlen < 0 - print address */ + set_sockopt(fd, names[i].val, val, -1U); + printf("setsockopt(%d, SOL_NETLINK, %s, %p, -1) = %s\n", + fd, names[i].str, val, errstr); + + /* optlen smaller than necessary - print address */ + set_sockopt(fd, names[i].val, val, sizeof(*val) - 1); + printf("setsockopt(%d, SOL_NETLINK, %s, %p, %d) = %s\n", + fd, names[i].str, val, (int) sizeof(*val) - 1, errstr); + + /* optval EFAULT - print address */ + set_sockopt(fd, names[i].val, efault, sizeof(*val)); + printf("setsockopt(%d, SOL_NETLINK, %s, %p, %d) = %s\n", + fd, names[i].str, efault, (int) sizeof(*val), errstr); + } + + puts("+++ exited with 0 +++"); + return 0; +} diff --git a/tests-mx32/sockopt-sol_netlink.gen.test b/tests-mx32/sockopt-sol_netlink.gen.test new file mode 100755 index 00000000..a2ba06dd --- /dev/null +++ b/tests-mx32/sockopt-sol_netlink.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sockopt-sol_netlink -e trace=getsockopt,setsockopt); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -e trace=getsockopt,setsockopt diff --git a/tests-mx32/splice.gen.test b/tests-mx32/splice.gen.test index 83c84064..75660806 100755 --- a/tests-mx32/splice.gen.test +++ b/tests-mx32/splice.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (splice ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (splice ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/stack-fcall-0.c b/tests-mx32/stack-fcall-0.c index 12a260de..edd6d326 100644 --- a/tests-mx32/stack-fcall-0.c +++ b/tests-mx32/stack-fcall-0.c @@ -1,4 +1,4 @@ -int f1(int i); +#include "stack-fcall.h" int f0(int i) { diff --git a/tests-mx32/stack-fcall-1.c b/tests-mx32/stack-fcall-1.c index 8716702d..5d0bf0e6 100644 --- a/tests-mx32/stack-fcall-1.c +++ b/tests-mx32/stack-fcall-1.c @@ -1,4 +1,4 @@ -int f2(int i); +#include "stack-fcall.h" int f1(int i) { diff --git a/tests-mx32/stack-fcall-2.c b/tests-mx32/stack-fcall-2.c index 19f8cf83..e1643207 100644 --- a/tests-mx32/stack-fcall-2.c +++ b/tests-mx32/stack-fcall-2.c @@ -1,4 +1,4 @@ -int f3(int i); +#include "stack-fcall.h" int f2(int i) { diff --git a/tests-mx32/stack-fcall-3.c b/tests-mx32/stack-fcall-3.c index 3af1667f..98726d8f 100644 --- a/tests-mx32/stack-fcall-3.c +++ b/tests-mx32/stack-fcall-3.c @@ -1,4 +1,5 @@ #include <unistd.h> +#include "stack-fcall.h" int f3(int i) { diff --git a/tests-mx32/stack-fcall-mangled-0.c b/tests-mx32/stack-fcall-mangled-0.c new file mode 100644 index 00000000..47549401 --- /dev/null +++ b/tests-mx32/stack-fcall-mangled-0.c @@ -0,0 +1,2 @@ +#define MANGLE +#include "stack-fcall-0.c" diff --git a/tests-mx32/stack-fcall-mangled-1.c b/tests-mx32/stack-fcall-mangled-1.c new file mode 100644 index 00000000..492c562b --- /dev/null +++ b/tests-mx32/stack-fcall-mangled-1.c @@ -0,0 +1,2 @@ +#define MANGLE +#include "stack-fcall-1.c" diff --git a/tests-mx32/stack-fcall-mangled-2.c b/tests-mx32/stack-fcall-mangled-2.c new file mode 100644 index 00000000..eb7c3624 --- /dev/null +++ b/tests-mx32/stack-fcall-mangled-2.c @@ -0,0 +1,2 @@ +#define MANGLE +#include "stack-fcall-2.c" diff --git a/tests-mx32/stack-fcall-mangled-3.c b/tests-mx32/stack-fcall-mangled-3.c new file mode 100644 index 00000000..98f738b4 --- /dev/null +++ b/tests-mx32/stack-fcall-mangled-3.c @@ -0,0 +1,2 @@ +#define MANGLE +#include "stack-fcall-3.c" diff --git a/tests-mx32/stack-fcall-mangled.c b/tests-mx32/stack-fcall-mangled.c new file mode 100644 index 00000000..67862059 --- /dev/null +++ b/tests-mx32/stack-fcall-mangled.c @@ -0,0 +1,2 @@ +#define MANGLE +#include "stack-fcall.c" diff --git a/tests-mx32/stack-fcall.c b/tests-mx32/stack-fcall.c index fc9ee5f9..e0ec3b1a 100644 --- a/tests-mx32/stack-fcall.c +++ b/tests-mx32/stack-fcall.c @@ -1,4 +1,4 @@ -int f0(int i); +#include "stack-fcall.h" int main(int argc, char **argv) { diff --git a/tests-mx32/stack-fcall.h b/tests-mx32/stack-fcall.h new file mode 100644 index 00000000..1a83bad4 --- /dev/null +++ b/tests-mx32/stack-fcall.h @@ -0,0 +1,13 @@ +#ifdef MANGLE + +#define f0 _ZN2ns2f0Ei +#define f1 _ZN2ns2f1Ei +#define f2 _ZN2ns2f2Ei +#define f3 _ZN2ns2f3Ei + +#endif + +int f0(int i); +int f1(int i); +int f2(int i); +int f3(int i); diff --git a/tests-mx32/statfs.gen.test b/tests-mx32/statfs.gen.test index 19b26dd8..32204a14 100755 --- a/tests-mx32/statfs.gen.test +++ b/tests-mx32/statfs.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (statfs -a17); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (statfs -a17 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a17 +run_strace_match_diff -a17 diff --git a/tests-mx32/statfs64.gen.test b/tests-mx32/statfs64.gen.test index 66409f9c..8f6f06f7 100755 --- a/tests-mx32/statfs64.gen.test +++ b/tests-mx32/statfs64.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (statfs64 -a23); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (statfs64 -a23 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a23 +run_strace_match_diff -a23 diff --git a/tests-mx32/strace-V.test b/tests-mx32/strace-V.test index ec1ca059..eb05e865 100755 --- a/tests-mx32/strace-V.test +++ b/tests-mx32/strace-V.test @@ -39,8 +39,21 @@ config_year=$(getstr COPYRIGHT_YEAR) } option_unwind=$(getoption USE_LIBUNWIND " stack-unwind") +option_demangle=$(getoption USE_DEMANGLE " stack-demangle") -features="${option_unwind}" +option_m32= +option_mx32= +case "$STRACE_NATIVE_ARCH" in +x86_64) + option_m32=$(getoption HAVE_M32_MPERS ' m32-mpers' ' no-m32-mpers') + option_mx32=$(getoption HAVE_MX32_MPERS ' mx32-mpers' ' no-mx32-mpers') + ;; +aarch64|powerpc64|riscv|s390x|sparc64|tile|x32) + option_m32=$(getoption HAVE_M32_MPERS ' m32-mpers' ' no-m32-mpers') + ;; +esac + +features="${option_unwind}${option_demangle}${option_m32}${option_mx32}" [ -n "$features" ] || features=" (none)" cat > "$EXP" << __EOF__ diff --git a/tests-mx32/strace-k-demangle.test b/tests-mx32/strace-k-demangle.test new file mode 100755 index 00000000..1616449f --- /dev/null +++ b/tests-mx32/strace-k-demangle.test @@ -0,0 +1,7 @@ +#!/bin/sh +# Check strace -k symbol names demangling. + +test_prog=../stack-fcall-mangled +expected='getpid ns::f3(int) ns::f2(int) ns::f1(int) ns::f0(int) main ' + +. "${srcdir=.}"/strace-k.test diff --git a/tests-mx32/strace-k.test b/tests-mx32/strace-k.test index e68951e8..2a21a9db 100755 --- a/tests-mx32/strace-k.test +++ b/tests-mx32/strace-k.test @@ -38,11 +38,13 @@ check_prog sed check_prog tr -run_prog ../stack-fcall +: ${test_prog=../stack-fcall} +: ${expected='getpid f3 f2 f1 f0 main '} + +run_prog "$test_prog" run_strace -e getpid -k $args -expected='getpid f3 f2 f1 f0 main ' -result=$(sed -r -n '1,/\(main\+0x[a-f0-9]+\) .*/ s/^.*\(([^+]+)\+0x[a-f0-9]+\) .*/\1/p' "$LOG" | +result=$(sed -r -n '1,/\(main\+0x[a-f0-9]+\) .*/ s/^[^(]+\(([^+]+)\+0x[a-f0-9]+\) .*/\1/p' "$LOG" | tr '\n' ' ') test "$result" = "$expected" || { @@ -50,5 +52,3 @@ test "$result" = "$expected" || { echo "result: \"$result\"" dump_log_and_fail_with "$STRACE $args output mismatch" } - -exit 0 diff --git a/tests-mx32/symlink.gen.test b/tests-mx32/symlink.gen.test index f41668c3..8cedfbf4 100755 --- a/tests-mx32/symlink.gen.test +++ b/tests-mx32/symlink.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (symlink -a34); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (symlink -a34 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a34 +run_strace_match_diff -a34 diff --git a/tests-mx32/symlinkat.gen.test b/tests-mx32/symlinkat.gen.test index 39e624ab..12455dd9 100755 --- a/tests-mx32/symlinkat.gen.test +++ b/tests-mx32/symlinkat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (symlinkat ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (symlinkat ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/sync.gen.test b/tests-mx32/sync.gen.test index 4aaf8c7f..8436a1fa 100755 --- a/tests-mx32/sync.gen.test +++ b/tests-mx32/sync.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sync -a7); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sync -a7 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a7 +run_strace_match_diff -a7 diff --git a/tests-mx32/sync_file_range.gen.test b/tests-mx32/sync_file_range.gen.test index 0693c12e..2f41c7db 100755 --- a/tests-mx32/sync_file_range.gen.test +++ b/tests-mx32/sync_file_range.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sync_file_range ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sync_file_range ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/sync_file_range2.gen.test b/tests-mx32/sync_file_range2.gen.test index 23046b6b..d432647a 100755 --- a/tests-mx32/sync_file_range2.gen.test +++ b/tests-mx32/sync_file_range2.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sync_file_range2 ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sync_file_range2 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/syntax.sh b/tests-mx32/syntax.sh index 0a0d2a57..b1c8fdc1 100644 --- a/tests-mx32/syntax.sh +++ b/tests-mx32/syntax.sh @@ -50,13 +50,11 @@ check_exit_status_and_stderr_using_grep() "strace $* failed to print expected diagnostics" } -strace_exp="${STRACE##* }" - check_e() { local pattern="$1"; shift cat > "$EXP" << __EOF__ -$strace_exp: $pattern +$STRACE_EXE: $pattern __EOF__ check_exit_status_and_stderr "$@" } @@ -65,7 +63,7 @@ check_e_using_grep() { local pattern="$1"; shift cat > "$EXP" << __EOF__ -$strace_exp: $pattern +$STRACE_EXE: $pattern __EOF__ check_exit_status_and_stderr_using_grep "$@" } @@ -74,8 +72,8 @@ check_h() { local pattern="$1"; shift cat > "$EXP" << __EOF__ -$strace_exp: $pattern -Try '$strace_exp -h' for more information. +$STRACE_EXE: $pattern +Try '$STRACE_EXE -h' for more information. __EOF__ check_exit_status_and_stderr "$@" } diff --git a/tests-mx32/sysinfo.gen.test b/tests-mx32/sysinfo.gen.test index e6469d55..fa462376 100755 --- a/tests-mx32/sysinfo.gen.test +++ b/tests-mx32/sysinfo.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sysinfo -a14); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sysinfo -a14 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a14 +run_strace_match_diff -a14 diff --git a/tests-mx32/syslog.gen.test b/tests-mx32/syslog.gen.test index 5423d5bb..5707a3e2 100755 --- a/tests-mx32/syslog.gen.test +++ b/tests-mx32/syslog.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (syslog -a36); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (syslog -a36 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a36 +run_strace_match_diff -a36 diff --git a/tests-mx32/tee.gen.test b/tests-mx32/tee.gen.test index 2a87fae3..b5fbfc05 100755 --- a/tests-mx32/tee.gen.test +++ b/tests-mx32/tee.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (tee ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (tee ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/test_printpath.c b/tests-mx32/test_printpath.c index 5f482f25..c485a26f 100644 --- a/tests-mx32/test_printpath.c +++ b/tests-mx32/test_printpath.c @@ -2,6 +2,7 @@ * Test printpath/umovestr. * * Copyright (c) 2015-2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2017-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,10 +30,10 @@ #include "tests.h" +#include <limits.h> #include <stdio.h> #include <string.h> #include <unistd.h> -#include <sys/param.h> #include "test_ucopy.h" diff --git a/tests-mx32/test_ucopy.c b/tests-mx32/test_ucopy.c index 9ddffbca..09f809a2 100644 --- a/tests-mx32/test_ucopy.c +++ b/tests-mx32/test_ucopy.c @@ -2,6 +2,7 @@ * Test whether process_vm_readv and PTRACE_PEEKDATA work. * * Copyright (c) 2016-2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2017-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,10 +31,10 @@ #include "tests.h" #include <errno.h> +#include <sys/ptrace.h> #include <signal.h> #include <stdlib.h> #include <unistd.h> -#include <sys/ptrace.h> #include <sys/uio.h> #include <sys/wait.h> diff --git a/tests-mx32/tests.h b/tests-mx32/tests.h index d453e3e0..1c66c265 100644 --- a/tests-mx32/tests.h +++ b/tests-mx32/tests.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -75,6 +75,15 @@ void error_msg_and_skip(const char *, ...) void perror_msg_and_skip(const char *, ...) ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN; +#ifndef perror_msg_and_fail +# define perror_msg_and_fail(fmt_, ...) \ + perror_msg_and_fail("%s:%d: " fmt_, __FILE__, __LINE__, ##__VA_ARGS__) +#endif +#ifndef perror_msg_and_fail +# define error_msg_and_fail(fmt_, ...) \ + error_msg_and_fail("%s:%d: " fmt_, __FILE__, __LINE__, ##__VA_ARGS__) +#endif + /* Stat the specified file and skip the test if the stat call failed. */ void skip_if_unavailable(const char *); diff --git a/tests-mx32/time.gen.test b/tests-mx32/time.gen.test index ed7ec69a..3269b164 100755 --- a/tests-mx32/time.gen.test +++ b/tests-mx32/time.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (time -a10); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (time -a10 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a10 +run_strace_match_diff -a10 diff --git a/tests-mx32/timer_create.gen.test b/tests-mx32/timer_create.gen.test index 6b4c543d..bf652612 100755 --- a/tests-mx32/timer_create.gen.test +++ b/tests-mx32/timer_create.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (timer_create ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (timer_create ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/times.gen.test b/tests-mx32/times.gen.test index ca4ebbe5..06b036fc 100755 --- a/tests-mx32/times.gen.test +++ b/tests-mx32/times.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (times -esignal=none); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (times -esignal=none ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -esignal=none +run_strace_match_diff -esignal=none diff --git a/tests-mx32/truncate.gen.test b/tests-mx32/truncate.gen.test index 0410e73d..7a631ef0 100755 --- a/tests-mx32/truncate.gen.test +++ b/tests-mx32/truncate.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (truncate ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (truncate ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/truncate64.gen.test b/tests-mx32/truncate64.gen.test index dae0fe6f..2b368f44 100755 --- a/tests-mx32/truncate64.gen.test +++ b/tests-mx32/truncate64.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (truncate64 ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (truncate64 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests-mx32/ugetrlimit.gen.test b/tests-mx32/ugetrlimit.gen.test index ff27134a..a412fe6a 100755 --- a/tests-mx32/ugetrlimit.gen.test +++ b/tests-mx32/ugetrlimit.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ugetrlimit -a28); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ugetrlimit -a28 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a28 +run_strace_match_diff -a28 diff --git a/tests-mx32/umask.gen.test b/tests-mx32/umask.gen.test index 60af5e9a..5d6c3187 100755 --- a/tests-mx32/umask.gen.test +++ b/tests-mx32/umask.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (umask -a11); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (umask -a11 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a11 +run_strace_match_diff -a11 diff --git a/tests-mx32/umovestr3.c b/tests-mx32/umovestr3.c index cf2fa7d4..74f0e934 100644 --- a/tests-mx32/umovestr3.c +++ b/tests-mx32/umovestr3.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,9 +27,9 @@ */ #include "tests.h" +#include <limits.h> #include <stdio.h> #include <unistd.h> -#include <sys/param.h> int main(void) diff --git a/tests-mx32/unlink.gen.test b/tests-mx32/unlink.gen.test index 7b8522b4..63bc0c42 100755 --- a/tests-mx32/unlink.gen.test +++ b/tests-mx32/unlink.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (unlink -a24); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (unlink -a24 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a24 +run_strace_match_diff -a24 diff --git a/tests-mx32/unlinkat.gen.test b/tests-mx32/unlinkat.gen.test index 5a77c6ab..5de79084 100755 --- a/tests-mx32/unlinkat.gen.test +++ b/tests-mx32/unlinkat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (unlinkat -a35); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (unlinkat -a35 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a35 +run_strace_match_diff -a35 diff --git a/tests-mx32/unshare.gen.test b/tests-mx32/unshare.gen.test index 077a4580..782ce47a 100755 --- a/tests-mx32/unshare.gen.test +++ b/tests-mx32/unshare.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (unshare -a11); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (unshare -a11 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a11 +run_strace_match_diff -a11 diff --git a/tests-mx32/userfaultfd.gen.test b/tests-mx32/userfaultfd.gen.test index 47351466..61b6988e 100755 --- a/tests-mx32/userfaultfd.gen.test +++ b/tests-mx32/userfaultfd.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (userfaultfd -a38); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (userfaultfd -a38 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a38 +run_strace_match_diff -a38 diff --git a/tests-mx32/ustat.gen.test b/tests-mx32/ustat.gen.test index f64b28d9..2b09f7e9 100755 --- a/tests-mx32/ustat.gen.test +++ b/tests-mx32/ustat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ustat -a33); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ustat -a33 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a33 +run_strace_match_diff -a33 diff --git a/tests-mx32/utime.gen.test b/tests-mx32/utime.gen.test index 72705566..58ebc5ac 100755 --- a/tests-mx32/utime.gen.test +++ b/tests-mx32/utime.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (utime -a16); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (utime -a16 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a16 +run_strace_match_diff -a16 diff --git a/tests-mx32/utimensat.gen.test b/tests-mx32/utimensat.gen.test index a4d6656e..07dffa37 100755 --- a/tests-mx32/utimensat.gen.test +++ b/tests-mx32/utimensat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (utimensat -a33); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (utimensat -a33 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a33 +run_strace_match_diff -a33 diff --git a/tests-mx32/utimes.gen.test b/tests-mx32/utimes.gen.test index 37ed29cd..559243e9 100755 --- a/tests-mx32/utimes.gen.test +++ b/tests-mx32/utimes.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (utimes -a17); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (utimes -a17 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a17 +run_strace_match_diff -a17 diff --git a/tests-mx32/vhangup.gen.test b/tests-mx32/vhangup.gen.test index 7ac84e57..da192169 100755 --- a/tests-mx32/vhangup.gen.test +++ b/tests-mx32/vhangup.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (vhangup -a10); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (vhangup -a10 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a10 +run_strace_match_diff -a10 diff --git a/tests-mx32/vmsplice.gen.test b/tests-mx32/vmsplice.gen.test index fe6a07d3..0dc18b63 100755 --- a/tests-mx32/vmsplice.gen.test +++ b/tests-mx32/vmsplice.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (vmsplice -ewrite=1); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (vmsplice -ewrite=1 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -ewrite=1 +run_strace_match_diff -ewrite=1 diff --git a/tests-mx32/wait4.gen.test b/tests-mx32/wait4.gen.test index ae04915f..22a982fd 100755 --- a/tests-mx32/wait4.gen.test +++ b/tests-mx32/wait4.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (wait4 -esignal=none); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (wait4 -esignal=none ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -esignal=none +run_strace_match_diff -esignal=none diff --git a/tests-mx32/waitid.gen.test b/tests-mx32/waitid.gen.test index 59f40228..22edd673 100755 --- a/tests-mx32/waitid.gen.test +++ b/tests-mx32/waitid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (waitid -esignal=none); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (waitid -esignal=none ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -esignal=none +run_strace_match_diff -esignal=none diff --git a/tests-mx32/waitpid.gen.test b/tests-mx32/waitpid.gen.test index d91e2985..a5678a1a 100755 --- a/tests-mx32/waitpid.gen.test +++ b/tests-mx32/waitpid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (waitpid -a28); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (waitpid -a28 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a28 +run_strace_match_diff -a28 diff --git a/tests-mx32/xet_thread_area_x86.c b/tests-mx32/xet_thread_area_x86.c new file mode 100644 index 00000000..68f495cb --- /dev/null +++ b/tests-mx32/xet_thread_area_x86.c @@ -0,0 +1,227 @@ +/* + * Check decoding of set_thread_area and get_thread_area syscalls on x86 + * architecture. + * + * Copyright (c) 2018 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" + +#include <asm/unistd.h> + +#if defined __NR_get_thread_area && defined __NR_set_thread_area \ + && defined HAVE_STRUCT_USER_DESC + +# include <assert.h> +# include <errno.h> +# include <stdbool.h> +# include <stdio.h> +# include <stdint.h> +# include <string.h> +# include <unistd.h> + +# include "print_user_desc.c" + +long errnum; + +static void +printptr(kernel_ulong_t ptr, const char *ptr_str) +{ + if (ptr_str) + printf("%s", ptr_str); + else + printf("%#llx", zero_extend_signed_to_ull(ptr)); +} + +/** + * Perform set_thread_area call along with printing the expected output. + * + * @param ptr_val Pointer to thread area argument. + * @param ptr_str Explicit string representation of the argument. + * @param valid Whether argument points to the valid memory and its contents + * should be decoded. + * @param entry_number_str explicit decoding of the entry_number field. + */ +static long +set_thread_area(kernel_ulong_t ptr_val, const char *ptr_str, bool valid, + const char *entry_number_str) +{ + struct user_desc *ptr = (struct user_desc *) (uintptr_t) ptr_val; + long rc = -1; + int saved_errno; + + rc = syscall(__NR_set_thread_area, ptr_val); + saved_errno = errno; + printf("set_thread_area("); + + if (valid) + print_user_desc(ptr, entry_number_str); + else + printptr(ptr_val, ptr_str); + + errno = saved_errno; + printf(") = %s", sprintrc(rc)); + if (!rc) + printf(" (entry_number=%u)", ptr->entry_number); + + puts(""); + + return rc; +} + +/** + * Perform get_thread_are call along with printing the expected output and + * checking the result against the argument of the previous set_thread_area + * call, if it had place. + * + * @param ptr_val Pointer to thread area argument. + * @param ptr_str Explicit string representation of the argument. + * @param valid Whether argument points to the valid memory and its contents + * should be decoded. + * @param set_rc Return code of the previous set_thread_area call. + * @param expected The value of the argument passed to the previous + * set_thread_area call. + */ +static void +get_thread_area(kernel_ulong_t ptr_val, const char *ptr_str, bool valid, + long set_rc, kernel_ulong_t expected) +{ + struct user_desc *ptr = (struct user_desc *) (uintptr_t) ptr_val; + struct user_desc *expected_ptr = + (struct user_desc *) (uintptr_t) expected; + int saved_errno; + long rc; + + rc = syscall(__NR_get_thread_area, ptr_val); + saved_errno = errno; + + printf("get_thread_area("); + + if (valid && !rc) { + if (!set_rc) { + assert(ptr->entry_number == expected_ptr->entry_number); + assert(ptr->base_addr == expected_ptr->base_addr); + assert(ptr->limit == expected_ptr->limit); + assert(ptr->seg_32bit == expected_ptr->seg_32bit); + assert(ptr->contents == expected_ptr->contents); + assert(ptr->read_exec_only == + expected_ptr->read_exec_only); + assert(ptr->limit_in_pages == + expected_ptr->limit_in_pages); + assert(ptr->seg_not_present == + expected_ptr->seg_not_present); + assert(ptr->useable == expected_ptr->useable); + /* + * We do not check lm as 32-bit processes ignore it, and + * only 32-bit processes can successfully execute + * get_thread_area. + */ + } + + print_user_desc(ptr, + (int) ptr->entry_number == -1 ? "-1" : NULL); + } else { + printptr(ptr_val, ptr_str); + } + + errno = saved_errno; + printf(") = %s\n", sprintrc(rc)); +} + +int main(void) +{ + struct user_desc *ta1 = tail_alloc(sizeof(*ta1)); + struct user_desc *ta2 = tail_alloc(sizeof(*ta2)); + unsigned *bogus_entry_number = tail_alloc(sizeof(*bogus_entry_number)); + + long set_rc = -1; + + /* + * Let's do some weird syscall, it will mark the beginning of our + * expected output. + */ + syscall(__NR_reboot, 0, 0, 0, 0); + + set_rc = set_thread_area((uintptr_t) ARG_STR(NULL), false, NULL); + get_thread_area((uintptr_t) ARG_STR(NULL), false, set_rc, + (uintptr_t) NULL); + + set_rc = set_thread_area(-1, NULL, false, NULL); + get_thread_area(-1, NULL, false, set_rc, -1); + + fill_memory(ta1, sizeof(*ta1)); + fill_memory_ex(ta2, sizeof(*ta2), 0xA5, 0x5A); + + set_thread_area((uintptr_t) (ta1 + 1), NULL, false, NULL); + + set_thread_area((uintptr_t) bogus_entry_number, NULL, false, NULL); + + set_thread_area((uintptr_t) ta1, NULL, true, NULL); + + ta1->entry_number = -1; + ta1->base_addr = 0; + ta1->limit = 0; + ta1->contents = 1; + ta1->seg_32bit = 1; + ta1->seg_not_present = 0; + + set_rc = set_thread_area((uintptr_t) ta1, NULL, true, "-1"); + + *bogus_entry_number = 2718281828U; + get_thread_area((uintptr_t) bogus_entry_number, + "{entry_number=2718281828, ...}", + false, set_rc, (uintptr_t) ta1); + + /* That one should return -EFAULT on i386 */ + *bogus_entry_number = 12; + get_thread_area((uintptr_t) bogus_entry_number, + "{entry_number=12, ...}", + false, set_rc, (uintptr_t) ta1); + + ta2->entry_number = 3141592653U; + get_thread_area((uintptr_t) ta2, "{entry_number=3141592653, ...}", + false, set_rc, (uintptr_t) ta1); + + ta2->entry_number = -1; + get_thread_area((uintptr_t) ta2, "{entry_number=-1, ...}", + false, set_rc, (uintptr_t) ta1); + + ta2->entry_number = ta1->entry_number; + assert(set_rc == 0 || (int) ta2->entry_number == -1); + get_thread_area((uintptr_t) ta2, "{entry_number=-1, ...}", + true, set_rc, (uintptr_t) ta1); + + puts("+++ exited with 0 +++"); + + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_get_thread_area && __NR_set_thread_area" + " && HAVE_STRUCT_USER_DESC"); + +#endif diff --git a/tests-mx32/xet_thread_area_x86.test b/tests-mx32/xet_thread_area_x86.test new file mode 100755 index 00000000..863f7e21 --- /dev/null +++ b/tests-mx32/xet_thread_area_x86.test @@ -0,0 +1,11 @@ +#!/bin/sh + +# Check decoding of set_thread_area and get_thread_area syscalls on x86. + +. "${srcdir=.}/init.sh" + +check_prog sed +run_prog > /dev/null +run_strace -a22 -e trace=reboot,/[gs]et_thread_area $args > "$EXP" +sed '0,/^reboot/d' "$LOG" > "$OUT" +match_diff "$OUT" "$EXP" diff --git a/tests-mx32/xselect.c b/tests-mx32/xselect.c index a25ebcc6..b1e37662 100644 --- a/tests-mx32/xselect.c +++ b/tests-mx32/xselect.c @@ -1,5 +1,7 @@ /* - * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org> + * Check decoding of select/_newselect syscalls. + * + * Copyright (c) 2015-2018 Dmitry V. Levin <ldv@altlinux.org> * Copyright (c) 2015-2017 The strace developers. * All rights reserved. * @@ -30,127 +32,442 @@ * Based on test by Dr. David Alan Gilbert <dave@treblig.org> */ -#include <assert.h> +#include <errno.h> +#include <limits.h> +#include <stdint.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <sys/select.h> -static fd_set set[0x1000000 / sizeof(fd_set)]; +static const char *errstr; -int main(void) +static long +xselect(const kernel_ulong_t nfds, + const kernel_ulong_t rs, + const kernel_ulong_t ws, + const kernel_ulong_t es, + const kernel_ulong_t tv) +#ifndef xselect { - TAIL_ALLOC_OBJECT_CONST_PTR(struct timeval, tv); - struct timeval tv_in; - int fds[2]; - long rc; + long rc = syscall(TEST_SYSCALL_NR, + F8ILL_KULONG_MASK | nfds, rs, ws, es, tv); + errstr = sprintrc(rc); + return rc; +} +#else + ; +#endif + +#define XSELECT(expected_, ...) \ + do { \ + long rc = xselect(__VA_ARGS__); \ + if (rc != (expected_)) \ + perror_msg_and_fail(TEST_SYSCALL_STR \ + ": expected %d" \ + ", returned %ld", \ + (expected_), rc); \ + } while (0) \ +/* End of XSELECT definition. */ + +int +main(void) +{ +#ifdef PATH_TRACING_FD + skip_if_unavailable("/proc/self/fd/"); +#endif + + for (int i = 3; i < FD_SETSIZE; ++i) { +#ifdef PATH_TRACING_FD + if (i == PATH_TRACING_FD) + continue; +#endif + (void) close(i); + } + int fds[2]; if (pipe(fds)) perror_msg_and_fail("pipe"); + static const int smallset_size = sizeof(kernel_ulong_t) * 8; + const int nfds = fds[1] + 1; + if (nfds > smallset_size) + error_msg_and_fail("nfds[%d] > smallset_size[%d]\n", + nfds, smallset_size); + + struct timeval tv_in = { 0, 123 }; + struct timeval *const tv = tail_memdup(&tv_in, sizeof(tv_in)); + const uintptr_t a_tv = (uintptr_t) tv; + + TAIL_ALLOC_OBJECT_VAR_PTR(kernel_ulong_t, l_rs); + fd_set *const rs = (void *) l_rs; + const uintptr_t a_rs = (uintptr_t) rs; + + TAIL_ALLOC_OBJECT_VAR_PTR(kernel_ulong_t, l_ws); + fd_set *const ws = (void *) l_ws; + const uintptr_t a_ws = (uintptr_t) ws; + + TAIL_ALLOC_OBJECT_VAR_PTR(kernel_ulong_t, l_es); + fd_set *const es = (void *) l_es; + const uintptr_t a_es = (uintptr_t) es; + + long rc; + /* - * Start with a nice simple select. + * An equivalent of nanosleep. */ - FD_ZERO(set); - FD_SET(fds[0], set); - FD_SET(fds[1], set); - rc = syscall(TEST_SYSCALL_NR, fds[1] + 1, set, set, set, NULL); - if (rc < 0) - perror_msg_and_skip(TEST_SYSCALL_STR); - assert(rc == 1); - printf("%s(%d, [%d %d], [%d %d], [%d %d], NULL) = 1 ()\n", - TEST_SYSCALL_STR, fds[1] + 1, fds[0], fds[1], - fds[0], fds[1], fds[0], fds[1]); + if (xselect(0, 0, 0, 0, a_tv)) { + if (errno == ENOSYS) + perror_msg_and_skip(TEST_SYSCALL_STR); + else + perror_msg_and_fail(TEST_SYSCALL_STR); + } +#ifndef PATH_TRACING_FD + printf("%s(0, NULL, NULL, NULL, {tv_sec=%lld, tv_usec=%llu})" + " = 0 (Timeout)\n", + TEST_SYSCALL_STR, (long long) tv_in.tv_sec, + zero_extend_signed_to_ull(tv_in.tv_usec)); +#endif + + /* EFAULT on tv argument */ + XSELECT(-1, 0, 0, 0, 0, a_tv + 1); +#ifndef PATH_TRACING_FD + printf("%s(0, NULL, NULL, NULL, %#lx) = %s\n", + TEST_SYSCALL_STR, (unsigned long) a_tv + 1, errstr); +#endif + + /* + * Start with a nice simple select with the same set. + */ + for (int i = nfds; i <= smallset_size; ++i) { + *l_rs = (1UL << fds[0]) | (1UL << fds[1]); + XSELECT(1, i, a_rs, a_rs, a_rs, 0); +#ifndef PATH_TRACING_FD + printf("%s(%d, [%d %d], [%d %d], [%d %d], NULL) = 1 ()\n", + TEST_SYSCALL_STR, i, fds[0], fds[1], + fds[0], fds[1], fds[0], fds[1]); +#else + *l_rs = (1UL << fds[0]) | (1UL << fds[1]) | + (1UL << PATH_TRACING_FD); + XSELECT(i > PATH_TRACING_FD ? 3 : 1, i, a_rs, a_rs, a_rs, 0); + if (i > PATH_TRACING_FD) { + printf("%s(%d, [%d %d %d], [%d %d %d], [%d %d %d]" + ", NULL) = 3 ()\n", + TEST_SYSCALL_STR, i, + fds[0], fds[1], PATH_TRACING_FD, + fds[0], fds[1], PATH_TRACING_FD, + fds[0], fds[1], PATH_TRACING_FD); + } +#endif + } /* * Odd timeout. */ - FD_SET(fds[0], set); - FD_SET(fds[1], set); - tv->tv_sec = 0xdeadbeefU; - tv->tv_usec = 0xfacefeedU; - memcpy(&tv_in, tv, sizeof(tv_in)); - rc = syscall(TEST_SYSCALL_NR, fds[1] + 1, set, set, set, tv); + *l_rs = (1UL << fds[0]) | (1UL << fds[1]); + tv_in.tv_sec = 0xdeadbeefU; + tv_in.tv_usec = 0xfacefeedU; + memcpy(tv, &tv_in, sizeof(tv_in)); + rc = xselect(nfds, a_rs, a_rs, a_rs, a_tv); if (rc < 0) { +#ifndef PATH_TRACING_FD printf("%s(%d, [%d %d], [%d %d], [%d %d]" ", {tv_sec=%lld, tv_usec=%llu}) = %s\n", - TEST_SYSCALL_STR, fds[1] + 1, fds[0], fds[1], - fds[0], fds[1], fds[0], fds[1], (long long) tv->tv_sec, - zero_extend_signed_to_ull(tv->tv_usec), sprintrc(rc)); + TEST_SYSCALL_STR, nfds, fds[0], fds[1], + fds[0], fds[1], fds[0], fds[1], + (long long) tv_in.tv_sec, + zero_extend_signed_to_ull(tv_in.tv_usec), + errstr); +#endif /* !PATH_TRACING_FD */ } else { +#ifndef PATH_TRACING_FD printf("%s(%d, [%d %d], [%d %d], [%d %d]" ", {tv_sec=%lld, tv_usec=%llu}) = %ld" " (left {tv_sec=%lld, tv_usec=%llu})\n", - TEST_SYSCALL_STR, fds[1] + 1, fds[0], fds[1], - fds[0], fds[1], fds[0], fds[1], (long long) tv_in.tv_sec, + TEST_SYSCALL_STR, nfds, fds[0], fds[1], + fds[0], fds[1], fds[0], fds[1], + (long long) tv_in.tv_sec, zero_extend_signed_to_ull(tv_in.tv_usec), rc, (long long) tv->tv_sec, zero_extend_signed_to_ull(tv->tv_usec)); +#endif /* !PATH_TRACING_FD */ } - FD_SET(fds[0], set); - FD_SET(fds[1], set); - tv->tv_sec = (time_t) 0xcafef00ddeadbeefLL; - tv->tv_usec = (suseconds_t) 0xbadc0dedfacefeedLL; - memcpy(&tv_in, tv, sizeof(tv_in)); - rc = syscall(TEST_SYSCALL_NR, fds[1] + 1, set, set, set, tv); + /* + * Very odd timeout. + */ + *l_rs = (1UL << fds[0]) | (1UL << fds[1]); + tv_in.tv_sec = (time_t) 0xcafef00ddeadbeefLL; + tv_in.tv_usec = (suseconds_t) 0xbadc0dedfacefeedLL; + memcpy(tv, &tv_in, sizeof(tv_in)); + rc = xselect(nfds, a_rs, a_rs, a_rs, a_tv); if (rc < 0) { +#ifndef PATH_TRACING_FD printf("%s(%d, [%d %d], [%d %d], [%d %d]" ", {tv_sec=%lld, tv_usec=%llu}) = %s\n", - TEST_SYSCALL_STR, fds[1] + 1, fds[0], fds[1], - fds[0], fds[1], fds[0], fds[1], (long long) tv->tv_sec, - zero_extend_signed_to_ull(tv->tv_usec), sprintrc(rc)); + TEST_SYSCALL_STR, nfds, fds[0], fds[1], + fds[0], fds[1], fds[0], fds[1], + (long long) tv_in.tv_sec, + zero_extend_signed_to_ull(tv_in.tv_usec), + errstr); +#endif /* PATH_TRACING_FD */ } else { +#ifndef PATH_TRACING_FD printf("%s(%d, [%d %d], [%d %d], [%d %d]" ", {tv_sec=%lld, tv_usec=%llu}) = %ld" " (left {tv_sec=%lld, tv_usec=%llu})\n", - TEST_SYSCALL_STR, fds[1] + 1, fds[0], fds[1], - fds[0], fds[1], fds[0], fds[1], (long long) tv_in.tv_sec, + TEST_SYSCALL_STR, nfds, fds[0], fds[1], + fds[0], fds[1], fds[0], fds[1], + (long long) tv_in.tv_sec, zero_extend_signed_to_ull(tv_in.tv_usec), rc, (long long) tv->tv_sec, zero_extend_signed_to_ull(tv->tv_usec)); +#endif /* PATH_TRACING_FD */ } /* * Another simple one, with a timeout. */ - FD_SET(1, set); - FD_SET(2, set); - FD_SET(fds[0], set); - FD_SET(fds[1], set); - tv->tv_sec = 0xc0de1; - tv->tv_usec = 0xc0de2; - memcpy(&tv_in, tv, sizeof(tv_in)); - assert(syscall(TEST_SYSCALL_NR, fds[1] + 1, NULL, set, NULL, tv) == 3); - printf("%s(%d, NULL, [1 2 %d %d], NULL, {tv_sec=%lld, tv_usec=%llu})" - " = 3 (out [1 2 %d], left {tv_sec=%lld, tv_usec=%llu})\n", - TEST_SYSCALL_STR, fds[1] + 1, fds[0], fds[1], - (long long) tv_in.tv_sec, - zero_extend_signed_to_ull(tv_in.tv_usec), - fds[1], - (long long) tv->tv_sec, - zero_extend_signed_to_ull(tv->tv_usec)); + for (int i = nfds; i <= smallset_size; ++i) { + *l_rs = (1UL << fds[0]) | (1UL << fds[1]); + *l_ws = (1UL << 1) | (1UL << 2) | + (1UL << fds[0]) | (1UL << fds[1]); + *l_es = 0; + tv_in.tv_sec = 0xc0de1; + tv_in.tv_usec = 0xc0de2; + memcpy(tv, &tv_in, sizeof(tv_in)); + XSELECT(3, i, a_rs, a_ws, a_es, a_tv); +#ifndef PATH_TRACING_FD + printf("%s(%d, [%d %d], [%d %d %d %d], []" + ", {tv_sec=%lld, tv_usec=%llu}) = 3 (out [1 2 %d]" + ", left {tv_sec=%lld, tv_usec=%llu})\n", + TEST_SYSCALL_STR, i, fds[0], fds[1], + 1, 2, fds[0], fds[1], + (long long) tv_in.tv_sec, + zero_extend_signed_to_ull(tv_in.tv_usec), + fds[1], + (long long) tv->tv_sec, + zero_extend_signed_to_ull(tv->tv_usec)); +#else + *l_rs = (1UL << fds[0]) | (1UL << fds[1]) | + (1UL << PATH_TRACING_FD); + *l_ws = (1UL << 1) | (1UL << 2) | + (1UL << fds[0]) | (1UL << fds[1]); + tv_in.tv_sec = 0xc0de1; + tv_in.tv_usec = 0xc0de2; + memcpy(tv, &tv_in, sizeof(tv_in)); + XSELECT(3 + (i > PATH_TRACING_FD), i, a_rs, a_ws, a_es, a_tv); + if (i > PATH_TRACING_FD) { + printf("%s(%d, [%d %d %d], [%d %d %d %d], []" + ", {tv_sec=%lld, tv_usec=%llu})" + " = 4 (in [%d], out [1 2 %d]" + ", left {tv_sec=%lld, tv_usec=%llu})\n", + TEST_SYSCALL_STR, i, + fds[0], fds[1], PATH_TRACING_FD, + 1, 2, fds[0], fds[1], + (long long) tv_in.tv_sec, + zero_extend_signed_to_ull(tv_in.tv_usec), + PATH_TRACING_FD, fds[1], + (long long) tv->tv_sec, + zero_extend_signed_to_ull(tv->tv_usec)); + } + + *l_rs = (1UL << fds[0]) | (1UL << fds[1]); + *l_ws = (1UL << 1) | (1UL << 2) | + (1UL << fds[0]) | (1UL << fds[1]) | + (1UL << PATH_TRACING_FD); + tv_in.tv_sec = 0xc0de1; + tv_in.tv_usec = 0xc0de2; + memcpy(tv, &tv_in, sizeof(tv_in)); + XSELECT(3 + (i > PATH_TRACING_FD), i, a_rs, a_ws, a_es, a_tv); + if (i > PATH_TRACING_FD) { + printf("%s(%d, [%d %d], [%d %d %d %d %d], []" + ", {tv_sec=%lld, tv_usec=%llu})" + " = 4 (out [1 2 %d %d]" + ", left {tv_sec=%lld, tv_usec=%llu})\n", + TEST_SYSCALL_STR, i, + fds[0], fds[1], + 1, 2, fds[0], fds[1], PATH_TRACING_FD, + (long long) tv_in.tv_sec, + zero_extend_signed_to_ull(tv_in.tv_usec), + fds[1], PATH_TRACING_FD, + (long long) tv->tv_sec, + zero_extend_signed_to_ull(tv->tv_usec)); + } + + *l_rs = (1UL << fds[0]) | (1UL << fds[1]); + *l_ws = (1UL << 1) | (1UL << 2) | + (1UL << fds[0]) | (1UL << fds[1]); + *l_es = (1UL << PATH_TRACING_FD); + tv_in.tv_sec = 0xc0de1; + tv_in.tv_usec = 0xc0de2; + memcpy(tv, &tv_in, sizeof(tv_in)); + XSELECT(3, i, a_rs, a_ws, a_es, a_tv); + if (i > PATH_TRACING_FD) { + printf("%s(%d, [%d %d], [%d %d %d %d], [%d]" + ", {tv_sec=%lld, tv_usec=%llu}) = 3 (out [1 2 %d]" + ", left {tv_sec=%lld, tv_usec=%llu})\n", + TEST_SYSCALL_STR, i, + fds[0], fds[1], + 1, 2, fds[0], fds[1], PATH_TRACING_FD, + (long long) tv_in.tv_sec, + zero_extend_signed_to_ull(tv_in.tv_usec), + fds[1], + (long long) tv->tv_sec, + zero_extend_signed_to_ull(tv->tv_usec)); + } + +#endif /* PATH_TRACING_FD */ + } /* * Now the crash case that trinity found, negative nfds * but with a pointer to a large chunk of valid memory. */ - FD_ZERO(set); + static fd_set set[0x1000000 / sizeof(fd_set)]; FD_SET(fds[1], set); - assert(syscall(TEST_SYSCALL_NR, -1, NULL, set, NULL, NULL) == -1); - printf("%s(-1, NULL, %p, NULL, NULL) = -1 EINVAL (%m)\n", - TEST_SYSCALL_STR, set); + XSELECT(-1, -1U, 0, (uintptr_t) set, 0, 0); +#ifndef PATH_TRACING_FD + printf("%s(-1, NULL, %p, NULL, NULL) = %s\n", + TEST_SYSCALL_STR, set, errstr); +#endif /* - * Another variant, with nfds exceeding FD_SETSIZE limit. + * Big sets, nfds exceeds FD_SETSIZE limit. */ - FD_ZERO(set); + const size_t big_size = sizeof(fd_set) + sizeof(long); + fd_set *const big_rs = tail_alloc(big_size); + const uintptr_t a_big_rs = (uintptr_t) big_rs; + + fd_set *const big_ws = tail_alloc(big_size); + const uintptr_t a_big_ws = (uintptr_t) big_ws; + + for (unsigned int i = FD_SETSIZE; i <= big_size * 8; ++i) { + memset(big_rs, 0, big_size); + memset(big_ws, 0, big_size); + FD_SET(fds[0], big_rs); + tv->tv_sec = 0; + tv->tv_usec = 10 + (i - FD_SETSIZE); + XSELECT(0, i, a_big_rs, a_big_ws, 0, a_tv); +#ifndef PATH_TRACING_FD + printf("%s(%d, [%d], [], NULL, {tv_sec=0, tv_usec=%d})" + " = 0 (Timeout)\n", + TEST_SYSCALL_STR, i, fds[0], 10 + (i - FD_SETSIZE)); +#else + FD_SET(fds[0], big_rs); + FD_SET(PATH_TRACING_FD, big_rs); + tv->tv_sec = 0; + tv->tv_usec = 10 + (i - FD_SETSIZE); + XSELECT(1, i, a_big_rs, a_big_ws, 0, a_tv); + printf("%s(%d, [%d %d], [], NULL, {tv_sec=0, tv_usec=%d})" + " = 1 (in [%d], left {tv_sec=0, tv_usec=%llu})\n", + TEST_SYSCALL_STR, i, fds[0], PATH_TRACING_FD, + 10 + (i - FD_SETSIZE), PATH_TRACING_FD, + zero_extend_signed_to_ull(tv->tv_usec)); +#endif /* PATH_TRACING_FD */ + } + + /* + * Huge sets, nfds equals to INT_MAX. + */ + FD_SET(fds[0], set); + FD_SET(fds[1], set); + tv->tv_sec = 0; + tv->tv_usec = 123; + XSELECT(0, INT_MAX, (uintptr_t) set, (uintptr_t) &set[1], + (uintptr_t) &set[2], a_tv); +#ifndef PATH_TRACING_FD + printf("%s(%d, [%d %d], [], [], {tv_sec=0, tv_usec=123})" + " = 0 (Timeout)\n", + TEST_SYSCALL_STR, INT_MAX, fds[0], fds[1]); +#else FD_SET(fds[0], set); + FD_SET(fds[1], set); + FD_SET(PATH_TRACING_FD, set); tv->tv_sec = 0; tv->tv_usec = 123; - assert(syscall(TEST_SYSCALL_NR, FD_SETSIZE + 1, set, set + 1, NULL, tv) == 0); - printf("%s(%d, [%d], [], NULL, {tv_sec=0, tv_usec=123}) = 0 (Timeout)\n", - TEST_SYSCALL_STR, FD_SETSIZE + 1, fds[0]); + XSELECT(1, INT_MAX, (uintptr_t) set, (uintptr_t) &set[1], + (uintptr_t) &set[2], a_tv); + printf("%s(%d, [%d %d %d], [], [], {tv_sec=0, tv_usec=123})" + " = 1 (in [%d], left {tv_sec=0, tv_usec=%llu})\n", + TEST_SYSCALL_STR, INT_MAX, fds[0], fds[1], PATH_TRACING_FD, + PATH_TRACING_FD, zero_extend_signed_to_ull(tv->tv_usec)); +#endif /* PATH_TRACING_FD */ + + /* + * Small sets, nfds exceeds FD_SETSIZE limit. + * The kernel seems to be fine with it but strace cannot follow. + */ + *l_rs = (1UL << fds[0]) | (1UL << fds[1]) +#ifdef PATH_TRACING_FD + | (1UL << PATH_TRACING_FD) +#endif + ; + *l_ws = (1UL << fds[0]); + *l_es = (1UL << fds[0]) | (1UL << fds[1]) +#ifdef PATH_TRACING_FD + | (1UL << PATH_TRACING_FD) +#endif + ; + tv->tv_sec = 0; + tv->tv_usec = 123; + rc = xselect(FD_SETSIZE + 1, a_rs, a_ws, a_es, a_tv); + if (rc < 0) { +#ifndef PATH_TRACING_FD + printf("%s(%d, %p, %p, %p, {tv_sec=0, tv_usec=123}) = %s\n", + TEST_SYSCALL_STR, FD_SETSIZE + 1, rs, ws, es, errstr); +#endif + } else { +#ifndef PATH_TRACING_FD + printf("%s(%d, %p, %p, %p, {tv_sec=0, tv_usec=123})" + " = 0 (Timeout)\n", + TEST_SYSCALL_STR, FD_SETSIZE + 1, rs, ws, es); +#endif + } + + /* + * Small sets, one of allocated descriptors exceeds smallset_size. + */ + if (dup2(fds[1], smallset_size) != smallset_size) + perror_msg_and_fail("dup2"); +#ifdef PATH_TRACING_FD + FD_SET(PATH_TRACING_FD, rs); + FD_SET(PATH_TRACING_FD, ws); + FD_SET(PATH_TRACING_FD, es); +#endif + XSELECT(-1, smallset_size + 1, a_rs, a_ws, a_es, 0); +#ifndef PATH_TRACING_FD + printf("%s(%d, %p, %p, %p, NULL) = %s\n", + TEST_SYSCALL_STR, smallset_size + 1, rs, ws, es, errstr); +#endif + + /* + * Small and big sets, + * one of allocated descriptors exceeds smallset_size. + */ + memset(big_rs, 0, big_size); + FD_SET(fds[0], big_rs); + FD_SET(smallset_size, big_rs); + memset(big_ws, 0, big_size); + FD_SET(fds[1], big_ws); + FD_SET(smallset_size, big_ws); + XSELECT(-1, smallset_size + 1, a_big_rs, a_big_ws, a_es, 0); +#ifndef PATH_TRACING_FD + printf("%s(%d, [%d %d], [%d %d], %p, NULL) = %s\n", + TEST_SYSCALL_STR, smallset_size + 1, + fds[0], smallset_size, + fds[1], smallset_size, + es, errstr); +#endif /* !PATH_TRACING_FD */ + XSELECT(-1, smallset_size + 1, a_es, a_big_ws, a_big_rs, 0); +#ifndef PATH_TRACING_FD + printf("%s(%d, %p, [%d %d], [%d %d], NULL) = %s\n", + TEST_SYSCALL_STR, smallset_size + 1, + es, + fds[1], smallset_size, + fds[0], smallset_size, + errstr); +#endif /* !PATH_TRACING_FD */ puts("+++ exited with 0 +++"); return 0; diff --git a/tests/Makefile.am b/tests/Makefile.am index f2109fd4..493a7f97 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,7 +1,7 @@ # Automake input for strace tests. # # Copyright (c) 2011-2016 Dmitry V. Levin <ldv@altlinux.org> -# Copyright (c) 2011-2017 The strace developers. +# Copyright (c) 2011-2018 The strace developers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -28,7 +28,11 @@ OS = linux ARCH = @arch@ +NATIVE_ARCH = @arch_native@ +SIZEOF_KERNEL_LONG_T = @SIZEOF_KERNEL_LONG_T@ +SIZEOF_LONG = @SIZEOF_LONG@ MPERS_NAME = +MPERS_CC_FLAGS = ARCH_MFLAGS = AM_CFLAGS = $(WARN_CFLAGS) AM_CPPFLAGS = $(ARCH_MFLAGS) \ @@ -80,6 +84,7 @@ LDADD = libtests.a include pure_executables.am check_PROGRAMS = $(PURE_EXECUTABLES) \ + _newselect-P \ answer \ attach-f-p \ attach-f-p-cmd \ @@ -117,6 +122,9 @@ check_PROGRAMS = $(PURE_EXECUTABLES) \ netlink_netlink_diag \ netlink_unix_diag \ nsyscalls \ + nsyscalls-d \ + oldselect-P \ + oldselect-efault-P \ pc \ perf_event_open_nonverbose \ perf_event_open_unabbrev \ @@ -137,12 +145,14 @@ check_PROGRAMS = $(PURE_EXECUTABLES) \ scm_rights \ seccomp-filter-v \ seccomp-strict \ + select-P \ set_ptracer_any \ set_sigblock \ set_sigign \ signal_receive \ sleep \ stack-fcall \ + stack-fcall-mangled \ threads-execve \ unblock_reset_raise \ unix-pair-send-recv \ @@ -182,10 +192,17 @@ uio_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64 stack_fcall_SOURCES = stack-fcall.c \ stack-fcall-0.c stack-fcall-1.c stack-fcall-2.c stack-fcall-3.c +stack_fcall_mangled_SOURCES = stack-fcall-mangled.c \ + stack-fcall-mangled-0.c stack-fcall-mangled-1.c \ + stack-fcall-mangled-2.c stack-fcall-mangled-3.c + include gen_tests.am if USE_LIBUNWIND LIBUNWIND_TESTS = strace-k.test +if USE_DEMANGLE +LIBUNWIND_TESTS += strace-k-demangle.test +endif else LIBUNWIND_TESTS = endif @@ -204,11 +221,6 @@ DECODER_TESTS = \ futex.test \ getuid.test \ ioctl.test \ - ioctl_dm-v.test \ - ioctl_dm.test \ - ioctl_loop-nv.test \ - ioctl_nsfs.test \ - ioctl_sock_gifconf.test \ ipc_msgbuf.test \ llseek.test \ lseek.test \ @@ -220,9 +232,11 @@ DECODER_TESTS = \ net.test \ netlink_sock_diag.test \ nsyscalls.test \ - oldselect.test \ + nsyscalls-d.test \ + nsyscalls-nd.test \ personality.test \ pipe.test \ + poll-P.test \ poll.test \ prctl-arg2-intptr.test \ prctl-dumpable.test \ @@ -241,6 +255,7 @@ DECODER_TESTS = \ seccomp-strict.test \ sigaltstack.test \ sun_path.test \ + xet_thread_area_x86.test \ uio.test \ umount.test \ umount2.test \ @@ -263,6 +278,8 @@ MISC_TESTS = \ detach-sleeping.test \ detach-stopped.test \ filter-unavailable.test \ + filtering_fd-syntax.test \ + filtering_syscall-syntax.test \ fflush.test \ get_regs.test \ interactive_block.test \ @@ -309,13 +326,18 @@ XFAIL_TESTS_x32 = int_0x80.gen.test XFAIL_TESTS = $(XFAIL_TESTS_$(MPERS_NAME)) $(XFAIL_TESTS_$(ARCH)) TEST_LOG_COMPILER = env -AM_TEST_LOG_FLAGS = STRACE_ARCH=$(ARCH) MIPS_ABI=$(MIPS_ABI) $(srcdir)/run.sh +AM_TEST_LOG_FLAGS = STRACE_ARCH=$(ARCH) STRACE_NATIVE_ARCH=$(NATIVE_ARCH) \ + SIZEOF_KERNEL_LONG_T=$(SIZEOF_KERNEL_LONG_T) \ + SIZEOF_LONG=$(SIZEOF_LONG) \ + MIPS_ABI=$(MIPS_ABI) $(srcdir)/run.sh @VALGRIND_CHECK_RULES@ VALGRIND_FLAGS = --quiet VALGRIND_SUPPRESSIONS_FILES = $(abs_srcdir)/strace.supp EXTRA_DIST = \ + accept_compat.h \ + attach-p-cmd.h \ caps-abbrev.awk \ caps.awk \ clock.in \ @@ -331,7 +353,6 @@ EXTRA_DIST = \ getresugid.c \ init.sh \ init_delete_module.h \ - ioctl-v.sh \ ipc.sh \ ipc_msgbuf.expected \ ksysent.sed \ @@ -339,8 +360,8 @@ EXTRA_DIST = \ match.awk \ net.expected \ netlink_sock_diag-v.sh \ - oldselect.expected \ pipe.expected \ + print_user_desc.c \ process_vm_readv_writev.c \ pure_executables.list \ qual_fault-exit_group.expected \ @@ -358,10 +379,12 @@ EXTRA_DIST = \ setugid.c \ sigaltstack.expected \ sockname.c \ + stack-fcall.h \ strace-C.expected \ strace-E.expected \ strace-T.expected \ strace-ff.expected \ + strace-k-demangle.test \ strace-k.test \ strace-r.expected \ strace.supp \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 1e8085a5..52055108 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -17,7 +17,7 @@ # Automake input for strace tests. # # Copyright (c) 2011-2016 Dmitry V. Levin <ldv@altlinux.org> -# Copyright (c) 2011-2017 The strace developers. +# Copyright (c) 2011-2018 The strace developers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -136,23 +136,25 @@ DIST_COMMON = $(srcdir)/pure_executables.am $(srcdir)/gen_tests.am \ $(srcdir)/../scno.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am $(top_srcdir)/depcomp \ $(top_srcdir)/test-driver -check_PROGRAMS = $(am__EXEEXT_1) answer$(EXEEXT) attach-f-p$(EXEEXT) \ - attach-f-p-cmd$(EXEEXT) attach-p-cmd-cmd$(EXEEXT) \ - attach-p-cmd-p$(EXEEXT) block_reset_raise_run$(EXEEXT) \ - caps-abbrev$(EXEEXT) check_sigblock$(EXEEXT) \ - check_sigign$(EXEEXT) clone_parent$(EXEEXT) \ - clone_ptrace$(EXEEXT) count-f$(EXEEXT) execve-v$(EXEEXT) \ - execveat-v$(EXEEXT) filter-unavailable$(EXEEXT) \ - fork-f$(EXEEXT) getpid$(EXEEXT) getppid$(EXEEXT) \ - gettid$(EXEEXT) int_0x80$(EXEEXT) ioctl_dm-v$(EXEEXT) \ - ioctl_evdev-v$(EXEEXT) ioctl_loop-nv$(EXEEXT) \ - ioctl_loop-v$(EXEEXT) ioctl_nsfs$(EXEEXT) ioctl_rtc-v$(EXEEXT) \ +check_PROGRAMS = $(am__EXEEXT_1) _newselect-P$(EXEEXT) answer$(EXEEXT) \ + attach-f-p$(EXEEXT) attach-f-p-cmd$(EXEEXT) \ + attach-p-cmd-cmd$(EXEEXT) attach-p-cmd-p$(EXEEXT) \ + block_reset_raise_run$(EXEEXT) caps-abbrev$(EXEEXT) \ + check_sigblock$(EXEEXT) check_sigign$(EXEEXT) \ + clone_parent$(EXEEXT) clone_ptrace$(EXEEXT) count-f$(EXEEXT) \ + execve-v$(EXEEXT) execveat-v$(EXEEXT) \ + filter-unavailable$(EXEEXT) fork-f$(EXEEXT) getpid$(EXEEXT) \ + getppid$(EXEEXT) gettid$(EXEEXT) int_0x80$(EXEEXT) \ + ioctl_dm-v$(EXEEXT) ioctl_evdev-v$(EXEEXT) \ + ioctl_loop-nv$(EXEEXT) ioctl_loop-v$(EXEEXT) \ + ioctl_nsfs$(EXEEXT) ioctl_rtc-v$(EXEEXT) \ is_linux_mips_n64$(EXEEXT) ksysent$(EXEEXT) \ list_sigaction_signum$(EXEEXT) mmsg-silent$(EXEEXT) \ mmsg_name-v$(EXEEXT) msg_control-v$(EXEEXT) \ net-accept-connect$(EXEEXT) netlink_inet_diag$(EXEEXT) \ netlink_netlink_diag$(EXEEXT) netlink_unix_diag$(EXEEXT) \ - nsyscalls$(EXEEXT) pc$(EXEEXT) \ + nsyscalls$(EXEEXT) nsyscalls-d$(EXEEXT) oldselect-P$(EXEEXT) \ + oldselect-efault-P$(EXEEXT) pc$(EXEEXT) \ perf_event_open_nonverbose$(EXEEXT) \ perf_event_open_unabbrev$(EXEEXT) ppoll-v$(EXEEXT) \ prctl-seccomp-filter-v$(EXEEXT) prctl-seccomp-strict$(EXEEXT) \ @@ -163,19 +165,21 @@ check_PROGRAMS = $(am__EXEEXT_1) answer$(EXEEXT) attach-f-p$(EXEEXT) \ redirect-fds$(EXEEXT) restart_syscall$(EXEEXT) \ run_expect_termsig$(EXEEXT) scm_rights$(EXEEXT) \ seccomp-filter-v$(EXEEXT) seccomp-strict$(EXEEXT) \ - set_ptracer_any$(EXEEXT) set_sigblock$(EXEEXT) \ - set_sigign$(EXEEXT) signal_receive$(EXEEXT) sleep$(EXEEXT) \ - stack-fcall$(EXEEXT) threads-execve$(EXEEXT) \ + select-P$(EXEEXT) set_ptracer_any$(EXEEXT) \ + set_sigblock$(EXEEXT) set_sigign$(EXEEXT) \ + signal_receive$(EXEEXT) sleep$(EXEEXT) stack-fcall$(EXEEXT) \ + stack-fcall-mangled$(EXEEXT) threads-execve$(EXEEXT) \ unblock_reset_raise$(EXEEXT) unix-pair-send-recv$(EXEEXT) \ unix-pair-sendto-recvfrom$(EXEEXT) vfork-f$(EXEEXT) \ wait4-v$(EXEEXT) waitid-v$(EXEEXT) zeroargc$(EXEEXT) +@USE_DEMANGLE_TRUE@@USE_LIBUNWIND_TRUE@am__append_1 = strace-k-demangle.test TESTS = $(GEN_TESTS) $(DECODER_TESTS) $(MISC_TESTS) $(am__EXEEXT_2) subdir = tests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_prog_cc_for_build.m4 \ $(top_srcdir)/m4/ax_valgrind_check.m4 \ - $(top_srcdir)/m4/mpers.m4 $(top_srcdir)/m4/st_bpf.m4 \ + $(top_srcdir)/m4/mpers.m4 \ $(top_srcdir)/m4/st_save_restore_var.m4 \ $(top_srcdir)/m4/st_warn_cflags.m4 \ $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/configure.ac @@ -250,8 +254,9 @@ am__EXEEXT_1 = _newselect$(EXEEXT) accept$(EXEEXT) accept4$(EXEEXT) \ getxxid$(EXEEXT) group_req$(EXEEXT) inet-cmsg$(EXEEXT) \ init_module$(EXEEXT) inotify$(EXEEXT) inotify_init1$(EXEEXT) \ ioctl$(EXEEXT) ioctl_block$(EXEEXT) ioctl_dm$(EXEEXT) \ - ioctl_evdev$(EXEEXT) ioctl_loop$(EXEEXT) ioctl_mtd$(EXEEXT) \ - ioctl_rtc$(EXEEXT) ioctl_scsi$(EXEEXT) ioctl_sg_io_v3$(EXEEXT) \ + ioctl_evdev$(EXEEXT) ioctl_kvm_run$(EXEEXT) \ + ioctl_loop$(EXEEXT) ioctl_mtd$(EXEEXT) ioctl_rtc$(EXEEXT) \ + ioctl_scsi$(EXEEXT) ioctl_sg_io_v3$(EXEEXT) \ ioctl_sg_io_v4$(EXEEXT) ioctl_sock_gifconf$(EXEEXT) \ ioctl_uffdio$(EXEEXT) ioctl_v4l2$(EXEEXT) ioperm$(EXEEXT) \ iopl$(EXEEXT) ioprio$(EXEEXT) ip_mreq$(EXEEXT) ipc$(EXEEXT) \ @@ -266,12 +271,12 @@ am__EXEEXT_1 = _newselect$(EXEEXT) accept$(EXEEXT) accept4$(EXEEXT) \ mkdir$(EXEEXT) mkdirat$(EXEEXT) mknod$(EXEEXT) \ mknodat$(EXEEXT) mlock$(EXEEXT) mlock2$(EXEEXT) \ mlockall$(EXEEXT) mmap$(EXEEXT) mmap64$(EXEEXT) mmsg$(EXEEXT) \ - mmsg_name$(EXEEXT) mount$(EXEEXT) move_pages$(EXEEXT) \ - mq$(EXEEXT) mq_sendrecv$(EXEEXT) mq_sendrecv-read$(EXEEXT) \ - mq_sendrecv-write$(EXEEXT) msg_control$(EXEEXT) \ - msg_name$(EXEEXT) munlockall$(EXEEXT) nanosleep$(EXEEXT) \ - net-icmp_filter$(EXEEXT) net-sockaddr$(EXEEXT) \ - net-y-unix$(EXEEXT) net-yy-inet$(EXEEXT) \ + mmsg_name$(EXEEXT) modify_ldt$(EXEEXT) mount$(EXEEXT) \ + move_pages$(EXEEXT) mq$(EXEEXT) mq_sendrecv$(EXEEXT) \ + mq_sendrecv-read$(EXEEXT) mq_sendrecv-write$(EXEEXT) \ + msg_control$(EXEEXT) msg_name$(EXEEXT) munlockall$(EXEEXT) \ + nanosleep$(EXEEXT) net-icmp_filter$(EXEEXT) \ + net-sockaddr$(EXEEXT) net-y-unix$(EXEEXT) net-yy-inet$(EXEEXT) \ net-yy-netlink$(EXEEXT) net-yy-unix$(EXEEXT) \ netlink_audit$(EXEEXT) netlink_crypto$(EXEEXT) \ netlink_generic$(EXEEXT) netlink_kobject_uevent$(EXEEXT) \ @@ -301,16 +306,18 @@ am__EXEEXT_1 = _newselect$(EXEEXT) accept$(EXEEXT) accept4$(EXEEXT) \ nlattr_tc_stats$(EXEEXT) nlattr_tca_stab$(EXEEXT) \ nlattr_tcamsg$(EXEEXT) nlattr_tcmsg$(EXEEXT) \ nlattr_unix_diag_msg$(EXEEXT) old_mmap$(EXEEXT) \ - oldfstat$(EXEEXT) oldlstat$(EXEEXT) oldselect$(EXEEXT) \ + old_mmap-P$(EXEEXT) old_mmap-v-none$(EXEEXT) oldfstat$(EXEEXT) \ + oldlstat$(EXEEXT) oldselect$(EXEEXT) oldselect-efault$(EXEEXT) \ oldstat$(EXEEXT) open$(EXEEXT) openat$(EXEEXT) \ osf_utimes$(EXEEXT) pause$(EXEEXT) perf_event_open$(EXEEXT) \ personality$(EXEEXT) pipe$(EXEEXT) pipe2$(EXEEXT) \ pkey_alloc$(EXEEXT) pkey_free$(EXEEXT) pkey_mprotect$(EXEEXT) \ - poll$(EXEEXT) ppoll$(EXEEXT) prctl-arg2-intptr$(EXEEXT) \ - prctl-dumpable$(EXEEXT) prctl-name$(EXEEXT) \ - prctl-no-args$(EXEEXT) prctl-pdeathsig$(EXEEXT) \ - prctl-securebits$(EXEEXT) prctl-tid_address$(EXEEXT) \ - prctl-tsc$(EXEEXT) pread64-pwrite64$(EXEEXT) preadv$(EXEEXT) \ + poll$(EXEEXT) poll-P$(EXEEXT) ppoll$(EXEEXT) ppoll-P$(EXEEXT) \ + prctl-arg2-intptr$(EXEEXT) prctl-dumpable$(EXEEXT) \ + prctl-name$(EXEEXT) prctl-no-args$(EXEEXT) \ + prctl-pdeathsig$(EXEEXT) prctl-securebits$(EXEEXT) \ + prctl-tid_address$(EXEEXT) prctl-tsc$(EXEEXT) \ + pread64-pwrite64$(EXEEXT) preadv$(EXEEXT) \ preadv-pwritev$(EXEEXT) preadv2-pwritev2$(EXEEXT) \ printpath-umovestr$(EXEEXT) \ printpath-umovestr-peekdata$(EXEEXT) \ @@ -324,11 +331,15 @@ am__EXEEXT_1 = _newselect$(EXEEXT) accept$(EXEEXT) accept4$(EXEEXT) \ readlinkat$(EXEEXT) readv$(EXEEXT) reboot$(EXEEXT) \ recvfrom$(EXEEXT) recvmmsg-timeout$(EXEEXT) recvmsg$(EXEEXT) \ remap_file_pages$(EXEEXT) rename$(EXEEXT) renameat$(EXEEXT) \ - renameat2$(EXEEXT) request_key$(EXEEXT) rmdir$(EXEEXT) \ + renameat2$(EXEEXT) request_key$(EXEEXT) \ + riscv_flush_icache$(EXEEXT) rmdir$(EXEEXT) \ rt_sigaction$(EXEEXT) rt_sigpending$(EXEEXT) \ rt_sigprocmask$(EXEEXT) rt_sigqueueinfo$(EXEEXT) \ rt_sigreturn$(EXEEXT) rt_sigsuspend$(EXEEXT) \ rt_sigtimedwait$(EXEEXT) rt_tgsigqueueinfo$(EXEEXT) \ + s390_guarded_storage$(EXEEXT) s390_guarded_storage-v$(EXEEXT) \ + s390_pci_mmio_read_write$(EXEEXT) s390_runtime_instr$(EXEEXT) \ + s390_sthyi$(EXEEXT) s390_sthyi-v$(EXEEXT) \ sched_get_priority_mxx$(EXEEXT) sched_rr_get_interval$(EXEEXT) \ sched_xetaffinity$(EXEEXT) sched_xetattr$(EXEEXT) \ sched_xetparam$(EXEEXT) sched_xetscheduler$(EXEEXT) \ @@ -348,30 +359,34 @@ am__EXEEXT_1 = _newselect$(EXEEXT) accept$(EXEEXT) accept4$(EXEEXT) \ signalfd4$(EXEEXT) sigpending$(EXEEXT) sigprocmask$(EXEEXT) \ sigreturn$(EXEEXT) sigsuspend$(EXEEXT) so_linger$(EXEEXT) \ so_peercred$(EXEEXT) sock_filter-v$(EXEEXT) \ - socketcall$(EXEEXT) splice$(EXEEXT) stat$(EXEEXT) \ - stat64$(EXEEXT) statfs$(EXEEXT) statfs64$(EXEEXT) \ - statx$(EXEEXT) swap$(EXEEXT) sxetmask$(EXEEXT) \ - symlink$(EXEEXT) symlinkat$(EXEEXT) sync$(EXEEXT) \ - sync_file_range$(EXEEXT) sync_file_range2$(EXEEXT) \ - sysinfo$(EXEEXT) syslog$(EXEEXT) tee$(EXEEXT) time$(EXEEXT) \ - timer_create$(EXEEXT) timer_xettime$(EXEEXT) \ - timerfd_xettime$(EXEEXT) times$(EXEEXT) times-fail$(EXEEXT) \ - truncate$(EXEEXT) truncate64$(EXEEXT) ugetrlimit$(EXEEXT) \ - uio$(EXEEXT) umask$(EXEEXT) umount$(EXEEXT) umount2$(EXEEXT) \ - umoven-illptr$(EXEEXT) umovestr$(EXEEXT) \ - umovestr-illptr$(EXEEXT) umovestr2$(EXEEXT) umovestr3$(EXEEXT) \ - uname$(EXEEXT) unlink$(EXEEXT) unlinkat$(EXEEXT) \ - unshare$(EXEEXT) userfaultfd$(EXEEXT) ustat$(EXEEXT) \ - utime$(EXEEXT) utimensat$(EXEEXT) utimes$(EXEEXT) \ - vhangup$(EXEEXT) vmsplice$(EXEEXT) wait4$(EXEEXT) \ - waitid$(EXEEXT) waitpid$(EXEEXT) xattr$(EXEEXT) \ + socketcall$(EXEEXT) sockopt-sol_netlink$(EXEEXT) \ + splice$(EXEEXT) stat$(EXEEXT) stat64$(EXEEXT) statfs$(EXEEXT) \ + statfs64$(EXEEXT) statx$(EXEEXT) swap$(EXEEXT) \ + sxetmask$(EXEEXT) symlink$(EXEEXT) symlinkat$(EXEEXT) \ + sync$(EXEEXT) sync_file_range$(EXEEXT) \ + sync_file_range2$(EXEEXT) sysinfo$(EXEEXT) syslog$(EXEEXT) \ + tee$(EXEEXT) time$(EXEEXT) timer_create$(EXEEXT) \ + timer_xettime$(EXEEXT) timerfd_xettime$(EXEEXT) times$(EXEEXT) \ + times-fail$(EXEEXT) truncate$(EXEEXT) truncate64$(EXEEXT) \ + ugetrlimit$(EXEEXT) uio$(EXEEXT) umask$(EXEEXT) \ + umount$(EXEEXT) umount2$(EXEEXT) umoven-illptr$(EXEEXT) \ + umovestr$(EXEEXT) umovestr-illptr$(EXEEXT) umovestr2$(EXEEXT) \ + umovestr3$(EXEEXT) uname$(EXEEXT) unlink$(EXEEXT) \ + unlinkat$(EXEEXT) unshare$(EXEEXT) userfaultfd$(EXEEXT) \ + ustat$(EXEEXT) utime$(EXEEXT) utimensat$(EXEEXT) \ + utimes$(EXEEXT) vhangup$(EXEEXT) vmsplice$(EXEEXT) \ + wait4$(EXEEXT) waitid$(EXEEXT) waitpid$(EXEEXT) xattr$(EXEEXT) \ xattr-strings$(EXEEXT) xet_robust_list$(EXEEXT) \ - xetitimer$(EXEEXT) xetpgid$(EXEEXT) xetpriority$(EXEEXT) \ - xettimeofday$(EXEEXT) + xet_thread_area_x86$(EXEEXT) xetitimer$(EXEEXT) \ + xetpgid$(EXEEXT) xetpriority$(EXEEXT) xettimeofday$(EXEEXT) _newselect_SOURCES = _newselect.c _newselect_OBJECTS = _newselect.$(OBJEXT) _newselect_LDADD = $(LDADD) _newselect_DEPENDENCIES = libtests.a +_newselect_P_SOURCES = _newselect-P.c +_newselect_P_OBJECTS = _newselect-P.$(OBJEXT) +_newselect_P_LDADD = $(LDADD) +_newselect_P_DEPENDENCIES = libtests.a accept_SOURCES = accept.c accept_OBJECTS = accept.$(OBJEXT) accept_LDADD = $(LDADD) @@ -860,6 +875,10 @@ ioctl_evdev_v_SOURCES = ioctl_evdev-v.c ioctl_evdev_v_OBJECTS = ioctl_evdev-v.$(OBJEXT) ioctl_evdev_v_LDADD = $(LDADD) ioctl_evdev_v_DEPENDENCIES = libtests.a +ioctl_kvm_run_SOURCES = ioctl_kvm_run.c +ioctl_kvm_run_OBJECTS = ioctl_kvm_run.$(OBJEXT) +ioctl_kvm_run_LDADD = $(LDADD) +ioctl_kvm_run_DEPENDENCIES = libtests.a ioctl_loop_SOURCES = ioctl_loop.c ioctl_loop_OBJECTS = ioctl_loop.$(OBJEXT) ioctl_loop_LDADD = $(LDADD) @@ -1096,6 +1115,10 @@ mmsg_name_v_SOURCES = mmsg_name-v.c mmsg_name_v_OBJECTS = mmsg_name-v.$(OBJEXT) mmsg_name_v_LDADD = $(LDADD) mmsg_name_v_DEPENDENCIES = libtests.a +modify_ldt_SOURCES = modify_ldt.c +modify_ldt_OBJECTS = modify_ldt.$(OBJEXT) +modify_ldt_LDADD = $(LDADD) +modify_ldt_DEPENDENCIES = libtests.a mount_SOURCES = mount.c mount_OBJECTS = mount.$(OBJEXT) mount_LDADD = $(LDADD) @@ -1389,10 +1412,22 @@ nsyscalls_SOURCES = nsyscalls.c nsyscalls_OBJECTS = nsyscalls.$(OBJEXT) nsyscalls_LDADD = $(LDADD) nsyscalls_DEPENDENCIES = libtests.a +nsyscalls_d_SOURCES = nsyscalls-d.c +nsyscalls_d_OBJECTS = nsyscalls-d.$(OBJEXT) +nsyscalls_d_LDADD = $(LDADD) +nsyscalls_d_DEPENDENCIES = libtests.a old_mmap_SOURCES = old_mmap.c old_mmap_OBJECTS = old_mmap.$(OBJEXT) old_mmap_LDADD = $(LDADD) old_mmap_DEPENDENCIES = libtests.a +old_mmap_P_SOURCES = old_mmap-P.c +old_mmap_P_OBJECTS = old_mmap-P.$(OBJEXT) +old_mmap_P_LDADD = $(LDADD) +old_mmap_P_DEPENDENCIES = libtests.a +old_mmap_v_none_SOURCES = old_mmap-v-none.c +old_mmap_v_none_OBJECTS = old_mmap-v-none.$(OBJEXT) +old_mmap_v_none_LDADD = $(LDADD) +old_mmap_v_none_DEPENDENCIES = libtests.a oldfstat_SOURCES = oldfstat.c oldfstat_OBJECTS = oldfstat.$(OBJEXT) oldfstat_LDADD = $(LDADD) @@ -1405,6 +1440,18 @@ oldselect_SOURCES = oldselect.c oldselect_OBJECTS = oldselect.$(OBJEXT) oldselect_LDADD = $(LDADD) oldselect_DEPENDENCIES = libtests.a +oldselect_P_SOURCES = oldselect-P.c +oldselect_P_OBJECTS = oldselect-P.$(OBJEXT) +oldselect_P_LDADD = $(LDADD) +oldselect_P_DEPENDENCIES = libtests.a +oldselect_efault_SOURCES = oldselect-efault.c +oldselect_efault_OBJECTS = oldselect-efault.$(OBJEXT) +oldselect_efault_LDADD = $(LDADD) +oldselect_efault_DEPENDENCIES = libtests.a +oldselect_efault_P_SOURCES = oldselect-efault-P.c +oldselect_efault_P_OBJECTS = oldselect-efault-P.$(OBJEXT) +oldselect_efault_P_LDADD = $(LDADD) +oldselect_efault_P_DEPENDENCIES = libtests.a oldstat_SOURCES = oldstat.c oldstat_OBJECTS = oldstat.$(OBJEXT) oldstat_LDADD = $(LDADD) @@ -1470,10 +1517,18 @@ poll_SOURCES = poll.c poll_OBJECTS = poll.$(OBJEXT) poll_LDADD = $(LDADD) poll_DEPENDENCIES = libtests.a +poll_P_SOURCES = poll-P.c +poll_P_OBJECTS = poll-P.$(OBJEXT) +poll_P_LDADD = $(LDADD) +poll_P_DEPENDENCIES = libtests.a ppoll_SOURCES = ppoll.c ppoll_OBJECTS = ppoll.$(OBJEXT) ppoll_LDADD = $(LDADD) ppoll_DEPENDENCIES = libtests.a +ppoll_P_SOURCES = ppoll-P.c +ppoll_P_OBJECTS = ppoll-P.$(OBJEXT) +ppoll_P_LDADD = $(LDADD) +ppoll_P_DEPENDENCIES = libtests.a ppoll_v_SOURCES = ppoll-v.c ppoll_v_OBJECTS = ppoll-v.$(OBJEXT) ppoll_v_LDADD = $(LDADD) @@ -1700,6 +1755,10 @@ restart_syscall_SOURCES = restart_syscall.c restart_syscall_OBJECTS = restart_syscall.$(OBJEXT) restart_syscall_LDADD = $(LDADD) restart_syscall_DEPENDENCIES = libtests.a +riscv_flush_icache_SOURCES = riscv_flush_icache.c +riscv_flush_icache_OBJECTS = riscv_flush_icache.$(OBJEXT) +riscv_flush_icache_LDADD = $(LDADD) +riscv_flush_icache_DEPENDENCIES = libtests.a rmdir_SOURCES = rmdir.c rmdir_OBJECTS = rmdir.$(OBJEXT) rmdir_LDADD = $(LDADD) @@ -1740,6 +1799,30 @@ run_expect_termsig_SOURCES = run_expect_termsig.c run_expect_termsig_OBJECTS = run_expect_termsig.$(OBJEXT) run_expect_termsig_LDADD = $(LDADD) run_expect_termsig_DEPENDENCIES = libtests.a +s390_guarded_storage_SOURCES = s390_guarded_storage.c +s390_guarded_storage_OBJECTS = s390_guarded_storage.$(OBJEXT) +s390_guarded_storage_LDADD = $(LDADD) +s390_guarded_storage_DEPENDENCIES = libtests.a +s390_guarded_storage_v_SOURCES = s390_guarded_storage-v.c +s390_guarded_storage_v_OBJECTS = s390_guarded_storage-v.$(OBJEXT) +s390_guarded_storage_v_LDADD = $(LDADD) +s390_guarded_storage_v_DEPENDENCIES = libtests.a +s390_pci_mmio_read_write_SOURCES = s390_pci_mmio_read_write.c +s390_pci_mmio_read_write_OBJECTS = s390_pci_mmio_read_write.$(OBJEXT) +s390_pci_mmio_read_write_LDADD = $(LDADD) +s390_pci_mmio_read_write_DEPENDENCIES = libtests.a +s390_runtime_instr_SOURCES = s390_runtime_instr.c +s390_runtime_instr_OBJECTS = s390_runtime_instr.$(OBJEXT) +s390_runtime_instr_LDADD = $(LDADD) +s390_runtime_instr_DEPENDENCIES = libtests.a +s390_sthyi_SOURCES = s390_sthyi.c +s390_sthyi_OBJECTS = s390_sthyi.$(OBJEXT) +s390_sthyi_LDADD = $(LDADD) +s390_sthyi_DEPENDENCIES = libtests.a +s390_sthyi_v_SOURCES = s390_sthyi-v.c +s390_sthyi_v_OBJECTS = s390_sthyi-v.$(OBJEXT) +s390_sthyi_v_LDADD = $(LDADD) +s390_sthyi_v_DEPENDENCIES = libtests.a sched_get_priority_mxx_SOURCES = sched_get_priority_mxx.c sched_get_priority_mxx_OBJECTS = sched_get_priority_mxx.$(OBJEXT) sched_get_priority_mxx_LDADD = $(LDADD) @@ -1792,6 +1875,10 @@ select_SOURCES = select.c select_OBJECTS = select.$(OBJEXT) select_LDADD = $(LDADD) select_DEPENDENCIES = libtests.a +select_P_SOURCES = select-P.c +select_P_OBJECTS = select-P.$(OBJEXT) +select_P_LDADD = $(LDADD) +select_P_DEPENDENCIES = libtests.a semop_SOURCES = semop.c semop_OBJECTS = semop.$(OBJEXT) semop_LDADD = $(LDADD) @@ -1976,6 +2063,10 @@ socketcall_SOURCES = socketcall.c socketcall_OBJECTS = socketcall.$(OBJEXT) socketcall_LDADD = $(LDADD) socketcall_DEPENDENCIES = libtests.a +sockopt_sol_netlink_SOURCES = sockopt-sol_netlink.c +sockopt_sol_netlink_OBJECTS = sockopt-sol_netlink.$(OBJEXT) +sockopt_sol_netlink_LDADD = $(LDADD) +sockopt_sol_netlink_DEPENDENCIES = libtests.a splice_SOURCES = splice.c splice_OBJECTS = splice.$(OBJEXT) splice_LDADD = $(LDADD) @@ -1986,6 +2077,14 @@ am_stack_fcall_OBJECTS = stack-fcall.$(OBJEXT) stack-fcall-0.$(OBJEXT) \ stack_fcall_OBJECTS = $(am_stack_fcall_OBJECTS) stack_fcall_LDADD = $(LDADD) stack_fcall_DEPENDENCIES = libtests.a +am_stack_fcall_mangled_OBJECTS = stack-fcall-mangled.$(OBJEXT) \ + stack-fcall-mangled-0.$(OBJEXT) \ + stack-fcall-mangled-1.$(OBJEXT) \ + stack-fcall-mangled-2.$(OBJEXT) \ + stack-fcall-mangled-3.$(OBJEXT) +stack_fcall_mangled_OBJECTS = $(am_stack_fcall_mangled_OBJECTS) +stack_fcall_mangled_LDADD = $(LDADD) +stack_fcall_mangled_DEPENDENCIES = libtests.a stat_SOURCES = stat.c stat_OBJECTS = stat.$(OBJEXT) stat_LDADD = $(LDADD) @@ -2213,6 +2312,10 @@ xet_robust_list_SOURCES = xet_robust_list.c xet_robust_list_OBJECTS = xet_robust_list.$(OBJEXT) xet_robust_list_LDADD = $(LDADD) xet_robust_list_DEPENDENCIES = libtests.a +xet_thread_area_x86_SOURCES = xet_thread_area_x86.c +xet_thread_area_x86_OBJECTS = xet_thread_area_x86.$(OBJEXT) +xet_thread_area_x86_LDADD = $(LDADD) +xet_thread_area_x86_DEPENDENCIES = libtests.a xetitimer_SOURCES = xetitimer.c xetitimer_OBJECTS = xetitimer.$(OBJEXT) xetitimer_LDADD = $(LDADD) @@ -2265,9 +2368,9 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ - access.c acct.c add_key.c adjtimex.c aio.c alarm.c answer.c \ - attach-f-p.c attach-f-p-cmd.c attach-p-cmd-cmd.c \ +SOURCES = $(libtests_a_SOURCES) _newselect.c _newselect-P.c accept.c \ + accept4.c access.c acct.c add_key.c adjtimex.c aio.c alarm.c \ + answer.c attach-f-p.c attach-f-p-cmd.c attach-p-cmd-cmd.c \ attach-p-cmd-p.c block_reset_raise_run.c bpf.c bpf-v.c brk.c \ btrfs.c caps.c caps-abbrev.c check_sigblock.c check_sigign.c \ chmod.c chown.c chown32.c chroot.c clock_adjtime.c \ @@ -2291,9 +2394,9 @@ SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ gettid.c getuid.c getuid32.c getxxid.c group_req.c inet-cmsg.c \ init_module.c inotify.c inotify_init1.c int_0x80.c ioctl.c \ ioctl_block.c ioctl_dm.c ioctl_dm-v.c ioctl_evdev.c \ - ioctl_evdev-v.c ioctl_loop.c ioctl_loop-nv.c ioctl_loop-v.c \ - ioctl_mtd.c ioctl_nsfs.c ioctl_rtc.c ioctl_rtc-v.c \ - ioctl_scsi.c ioctl_sg_io_v3.c ioctl_sg_io_v4.c \ + ioctl_evdev-v.c ioctl_kvm_run.c ioctl_loop.c ioctl_loop-nv.c \ + ioctl_loop-v.c ioctl_mtd.c ioctl_nsfs.c ioctl_rtc.c \ + ioctl_rtc-v.c ioctl_scsi.c ioctl_sg_io_v3.c ioctl_sg_io_v4.c \ ioctl_sock_gifconf.c ioctl_uffdio.c ioctl_v4l2.c ioperm.c \ iopl.c ioprio.c ip_mreq.c ipc.c ipc_msg.c ipc_msgbuf.c \ ipc_sem.c ipc_shm.c is_linux_mips_n64.c kcmp.c kcmp-y.c \ @@ -2303,13 +2406,13 @@ SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ mbind.c membarrier.c memfd_create.c migrate_pages.c mincore.c \ mkdir.c mkdirat.c mknod.c mknodat.c mlock.c mlock2.c \ mlockall.c mmap.c mmap64.c mmsg.c mmsg-silent.c mmsg_name.c \ - mmsg_name-v.c mount.c move_pages.c mq.c mq_sendrecv.c \ - mq_sendrecv-read.c mq_sendrecv-write.c msg_control.c \ - msg_control-v.c msg_name.c munlockall.c nanosleep.c \ - net-accept-connect.c net-icmp_filter.c net-sockaddr.c \ - net-y-unix.c net-yy-inet.c net-yy-netlink.c net-yy-unix.c \ - netlink_audit.c netlink_crypto.c netlink_generic.c \ - netlink_inet_diag.c netlink_kobject_uevent.c \ + mmsg_name-v.c modify_ldt.c mount.c move_pages.c mq.c \ + mq_sendrecv.c mq_sendrecv-read.c mq_sendrecv-write.c \ + msg_control.c msg_control-v.c msg_name.c munlockall.c \ + nanosleep.c net-accept-connect.c net-icmp_filter.c \ + net-sockaddr.c net-y-unix.c net-yy-inet.c net-yy-netlink.c \ + net-yy-unix.c netlink_audit.c netlink_crypto.c \ + netlink_generic.c netlink_inet_diag.c netlink_kobject_uevent.c \ netlink_netfilter.c netlink_netlink_diag.c netlink_protocol.c \ netlink_route.c netlink_selinux.c netlink_sock_diag.c \ netlink_unix_diag.c netlink_xfrm.c newfstatat.c \ @@ -2328,13 +2431,16 @@ SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ nlattr_packet_diag_msg.c nlattr_rtgenmsg.c nlattr_rtmsg.c \ nlattr_smc_diag_msg.c nlattr_tc_stats.c nlattr_tca_stab.c \ nlattr_tcamsg.c nlattr_tcmsg.c nlattr_unix_diag_msg.c \ - nsyscalls.c old_mmap.c oldfstat.c oldlstat.c oldselect.c \ + nsyscalls.c nsyscalls-d.c old_mmap.c old_mmap-P.c \ + old_mmap-v-none.c oldfstat.c oldlstat.c oldselect.c \ + oldselect-P.c oldselect-efault.c oldselect-efault-P.c \ oldstat.c open.c openat.c osf_utimes.c pause.c pc.c \ perf_event_open.c perf_event_open_nonverbose.c \ perf_event_open_unabbrev.c personality.c pipe.c pipe2.c \ - pkey_alloc.c pkey_free.c pkey_mprotect.c poll.c ppoll.c \ - ppoll-v.c prctl-arg2-intptr.c prctl-dumpable.c prctl-name.c \ - prctl-no-args.c prctl-pdeathsig.c prctl-seccomp-filter-v.c \ + pkey_alloc.c pkey_free.c pkey_mprotect.c poll.c poll-P.c \ + ppoll.c ppoll-P.c ppoll-v.c prctl-arg2-intptr.c \ + prctl-dumpable.c prctl-name.c prctl-no-args.c \ + prctl-pdeathsig.c prctl-seccomp-filter-v.c \ prctl-seccomp-strict.c prctl-securebits.c prctl-tid_address.c \ prctl-tsc.c pread64-pwrite64.c preadv.c preadv-pwritev.c \ preadv2-pwritev2.c print_maxfd.c printpath-umovestr.c \ @@ -2348,28 +2454,32 @@ SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ readdir.c readlink.c readlinkat.c readv.c reboot.c recvfrom.c \ recvmmsg-timeout.c recvmsg.c redirect-fds.c remap_file_pages.c \ rename.c renameat.c renameat2.c request_key.c \ - restart_syscall.c rmdir.c rt_sigaction.c rt_sigpending.c \ - rt_sigprocmask.c rt_sigqueueinfo.c rt_sigreturn.c \ - rt_sigsuspend.c rt_sigtimedwait.c rt_tgsigqueueinfo.c \ - run_expect_termsig.c sched_get_priority_mxx.c \ + restart_syscall.c riscv_flush_icache.c rmdir.c rt_sigaction.c \ + rt_sigpending.c rt_sigprocmask.c rt_sigqueueinfo.c \ + rt_sigreturn.c rt_sigsuspend.c rt_sigtimedwait.c \ + rt_tgsigqueueinfo.c run_expect_termsig.c \ + s390_guarded_storage.c s390_guarded_storage-v.c \ + s390_pci_mmio_read_write.c s390_runtime_instr.c s390_sthyi.c \ + s390_sthyi-v.c sched_get_priority_mxx.c \ sched_rr_get_interval.c sched_xetaffinity.c sched_xetattr.c \ sched_xetparam.c sched_xetscheduler.c sched_yield.c \ scm_rights.c seccomp-filter.c seccomp-filter-v.c \ - seccomp-strict.c seccomp_get_action_avail.c select.c semop.c \ - sendfile.c sendfile64.c set_mempolicy.c set_ptracer_any.c \ - set_sigblock.c set_sigign.c setdomainname.c setfsgid.c \ - setfsgid32.c setfsuid.c setfsuid32.c setgid.c setgid32.c \ - setgroups.c setgroups32.c sethostname.c setns.c setregid.c \ - setregid32.c setresgid.c setresgid32.c setresuid.c \ + seccomp-strict.c seccomp_get_action_avail.c select.c \ + select-P.c semop.c sendfile.c sendfile64.c set_mempolicy.c \ + set_ptracer_any.c set_sigblock.c set_sigign.c setdomainname.c \ + setfsgid.c setfsgid32.c setfsuid.c setfsuid32.c setgid.c \ + setgid32.c setgroups.c setgroups32.c sethostname.c setns.c \ + setregid.c setregid32.c setresgid.c setresgid32.c setresuid.c \ setresuid32.c setreuid.c setreuid32.c setrlimit.c setuid.c \ setuid32.c shmxt.c shutdown.c sigaction.c sigaltstack.c \ siginfo.c signal.c signal_receive.c signalfd4.c sigpending.c \ sigprocmask.c sigreturn.c sigsuspend.c sleep.c so_linger.c \ - so_peercred.c sock_filter-v.c socketcall.c splice.c \ - $(stack_fcall_SOURCES) stat.c stat64.c statfs.c statfs64.c \ - statx.c swap.c sxetmask.c symlink.c symlinkat.c sync.c \ - sync_file_range.c sync_file_range2.c sysinfo.c syslog.c tee.c \ - threads-execve.c time.c timer_create.c timer_xettime.c \ + so_peercred.c sock_filter-v.c socketcall.c \ + sockopt-sol_netlink.c splice.c $(stack_fcall_SOURCES) \ + $(stack_fcall_mangled_SOURCES) stat.c stat64.c statfs.c \ + statfs64.c statx.c swap.c sxetmask.c symlink.c symlinkat.c \ + sync.c sync_file_range.c sync_file_range2.c sysinfo.c syslog.c \ + tee.c threads-execve.c time.c timer_create.c timer_xettime.c \ timerfd_xettime.c times.c times-fail.c truncate.c truncate64.c \ ugetrlimit.c uio.c umask.c umount.c umount2.c umoven-illptr.c \ umovestr.c umovestr-illptr.c umovestr2.c umovestr3.c uname.c \ @@ -2378,16 +2488,17 @@ SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ userfaultfd.c ustat.c utime.c utimensat.c utimes.c vfork-f.c \ vhangup.c vmsplice.c wait4.c wait4-v.c waitid.c waitid-v.c \ waitpid.c xattr.c xattr-strings.c xet_robust_list.c \ - xetitimer.c xetpgid.c xetpriority.c xettimeofday.c zeroargc.c -DIST_SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ - access.c acct.c add_key.c adjtimex.c aio.c alarm.c answer.c \ - attach-f-p.c attach-f-p-cmd.c attach-p-cmd-cmd.c \ - attach-p-cmd-p.c block_reset_raise_run.c bpf.c bpf-v.c brk.c \ - btrfs.c caps.c caps-abbrev.c check_sigblock.c check_sigign.c \ - chmod.c chown.c chown32.c chroot.c clock_adjtime.c \ - clock_nanosleep.c clock_xettime.c clone_parent.c \ - clone_ptrace.c copy_file_range.c count-f.c creat.c \ - delete_module.c dup.c dup2.c dup3.c epoll_create.c \ + xet_thread_area_x86.c xetitimer.c xetpgid.c xetpriority.c \ + xettimeofday.c zeroargc.c +DIST_SOURCES = $(libtests_a_SOURCES) _newselect.c _newselect-P.c \ + accept.c accept4.c access.c acct.c add_key.c adjtimex.c aio.c \ + alarm.c answer.c attach-f-p.c attach-f-p-cmd.c \ + attach-p-cmd-cmd.c attach-p-cmd-p.c block_reset_raise_run.c \ + bpf.c bpf-v.c brk.c btrfs.c caps.c caps-abbrev.c \ + check_sigblock.c check_sigign.c chmod.c chown.c chown32.c \ + chroot.c clock_adjtime.c clock_nanosleep.c clock_xettime.c \ + clone_parent.c clone_ptrace.c copy_file_range.c count-f.c \ + creat.c delete_module.c dup.c dup2.c dup3.c epoll_create.c \ epoll_create1.c epoll_ctl.c epoll_pwait.c epoll_wait.c \ erestartsys.c eventfd.c execve.c execve-v.c execveat.c \ execveat-v.c faccessat.c fadvise64.c fadvise64_64.c \ @@ -2405,9 +2516,9 @@ DIST_SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ gettid.c getuid.c getuid32.c getxxid.c group_req.c inet-cmsg.c \ init_module.c inotify.c inotify_init1.c int_0x80.c ioctl.c \ ioctl_block.c ioctl_dm.c ioctl_dm-v.c ioctl_evdev.c \ - ioctl_evdev-v.c ioctl_loop.c ioctl_loop-nv.c ioctl_loop-v.c \ - ioctl_mtd.c ioctl_nsfs.c ioctl_rtc.c ioctl_rtc-v.c \ - ioctl_scsi.c ioctl_sg_io_v3.c ioctl_sg_io_v4.c \ + ioctl_evdev-v.c ioctl_kvm_run.c ioctl_loop.c ioctl_loop-nv.c \ + ioctl_loop-v.c ioctl_mtd.c ioctl_nsfs.c ioctl_rtc.c \ + ioctl_rtc-v.c ioctl_scsi.c ioctl_sg_io_v3.c ioctl_sg_io_v4.c \ ioctl_sock_gifconf.c ioctl_uffdio.c ioctl_v4l2.c ioperm.c \ iopl.c ioprio.c ip_mreq.c ipc.c ipc_msg.c ipc_msgbuf.c \ ipc_sem.c ipc_shm.c is_linux_mips_n64.c kcmp.c kcmp-y.c \ @@ -2417,13 +2528,13 @@ DIST_SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ mbind.c membarrier.c memfd_create.c migrate_pages.c mincore.c \ mkdir.c mkdirat.c mknod.c mknodat.c mlock.c mlock2.c \ mlockall.c mmap.c mmap64.c mmsg.c mmsg-silent.c mmsg_name.c \ - mmsg_name-v.c mount.c move_pages.c mq.c mq_sendrecv.c \ - mq_sendrecv-read.c mq_sendrecv-write.c msg_control.c \ - msg_control-v.c msg_name.c munlockall.c nanosleep.c \ - net-accept-connect.c net-icmp_filter.c net-sockaddr.c \ - net-y-unix.c net-yy-inet.c net-yy-netlink.c net-yy-unix.c \ - netlink_audit.c netlink_crypto.c netlink_generic.c \ - netlink_inet_diag.c netlink_kobject_uevent.c \ + mmsg_name-v.c modify_ldt.c mount.c move_pages.c mq.c \ + mq_sendrecv.c mq_sendrecv-read.c mq_sendrecv-write.c \ + msg_control.c msg_control-v.c msg_name.c munlockall.c \ + nanosleep.c net-accept-connect.c net-icmp_filter.c \ + net-sockaddr.c net-y-unix.c net-yy-inet.c net-yy-netlink.c \ + net-yy-unix.c netlink_audit.c netlink_crypto.c \ + netlink_generic.c netlink_inet_diag.c netlink_kobject_uevent.c \ netlink_netfilter.c netlink_netlink_diag.c netlink_protocol.c \ netlink_route.c netlink_selinux.c netlink_sock_diag.c \ netlink_unix_diag.c netlink_xfrm.c newfstatat.c \ @@ -2442,13 +2553,16 @@ DIST_SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ nlattr_packet_diag_msg.c nlattr_rtgenmsg.c nlattr_rtmsg.c \ nlattr_smc_diag_msg.c nlattr_tc_stats.c nlattr_tca_stab.c \ nlattr_tcamsg.c nlattr_tcmsg.c nlattr_unix_diag_msg.c \ - nsyscalls.c old_mmap.c oldfstat.c oldlstat.c oldselect.c \ + nsyscalls.c nsyscalls-d.c old_mmap.c old_mmap-P.c \ + old_mmap-v-none.c oldfstat.c oldlstat.c oldselect.c \ + oldselect-P.c oldselect-efault.c oldselect-efault-P.c \ oldstat.c open.c openat.c osf_utimes.c pause.c pc.c \ perf_event_open.c perf_event_open_nonverbose.c \ perf_event_open_unabbrev.c personality.c pipe.c pipe2.c \ - pkey_alloc.c pkey_free.c pkey_mprotect.c poll.c ppoll.c \ - ppoll-v.c prctl-arg2-intptr.c prctl-dumpable.c prctl-name.c \ - prctl-no-args.c prctl-pdeathsig.c prctl-seccomp-filter-v.c \ + pkey_alloc.c pkey_free.c pkey_mprotect.c poll.c poll-P.c \ + ppoll.c ppoll-P.c ppoll-v.c prctl-arg2-intptr.c \ + prctl-dumpable.c prctl-name.c prctl-no-args.c \ + prctl-pdeathsig.c prctl-seccomp-filter-v.c \ prctl-seccomp-strict.c prctl-securebits.c prctl-tid_address.c \ prctl-tsc.c pread64-pwrite64.c preadv.c preadv-pwritev.c \ preadv2-pwritev2.c print_maxfd.c printpath-umovestr.c \ @@ -2462,28 +2576,32 @@ DIST_SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ readdir.c readlink.c readlinkat.c readv.c reboot.c recvfrom.c \ recvmmsg-timeout.c recvmsg.c redirect-fds.c remap_file_pages.c \ rename.c renameat.c renameat2.c request_key.c \ - restart_syscall.c rmdir.c rt_sigaction.c rt_sigpending.c \ - rt_sigprocmask.c rt_sigqueueinfo.c rt_sigreturn.c \ - rt_sigsuspend.c rt_sigtimedwait.c rt_tgsigqueueinfo.c \ - run_expect_termsig.c sched_get_priority_mxx.c \ + restart_syscall.c riscv_flush_icache.c rmdir.c rt_sigaction.c \ + rt_sigpending.c rt_sigprocmask.c rt_sigqueueinfo.c \ + rt_sigreturn.c rt_sigsuspend.c rt_sigtimedwait.c \ + rt_tgsigqueueinfo.c run_expect_termsig.c \ + s390_guarded_storage.c s390_guarded_storage-v.c \ + s390_pci_mmio_read_write.c s390_runtime_instr.c s390_sthyi.c \ + s390_sthyi-v.c sched_get_priority_mxx.c \ sched_rr_get_interval.c sched_xetaffinity.c sched_xetattr.c \ sched_xetparam.c sched_xetscheduler.c sched_yield.c \ scm_rights.c seccomp-filter.c seccomp-filter-v.c \ - seccomp-strict.c seccomp_get_action_avail.c select.c semop.c \ - sendfile.c sendfile64.c set_mempolicy.c set_ptracer_any.c \ - set_sigblock.c set_sigign.c setdomainname.c setfsgid.c \ - setfsgid32.c setfsuid.c setfsuid32.c setgid.c setgid32.c \ - setgroups.c setgroups32.c sethostname.c setns.c setregid.c \ - setregid32.c setresgid.c setresgid32.c setresuid.c \ + seccomp-strict.c seccomp_get_action_avail.c select.c \ + select-P.c semop.c sendfile.c sendfile64.c set_mempolicy.c \ + set_ptracer_any.c set_sigblock.c set_sigign.c setdomainname.c \ + setfsgid.c setfsgid32.c setfsuid.c setfsuid32.c setgid.c \ + setgid32.c setgroups.c setgroups32.c sethostname.c setns.c \ + setregid.c setregid32.c setresgid.c setresgid32.c setresuid.c \ setresuid32.c setreuid.c setreuid32.c setrlimit.c setuid.c \ setuid32.c shmxt.c shutdown.c sigaction.c sigaltstack.c \ siginfo.c signal.c signal_receive.c signalfd4.c sigpending.c \ sigprocmask.c sigreturn.c sigsuspend.c sleep.c so_linger.c \ - so_peercred.c sock_filter-v.c socketcall.c splice.c \ - $(stack_fcall_SOURCES) stat.c stat64.c statfs.c statfs64.c \ - statx.c swap.c sxetmask.c symlink.c symlinkat.c sync.c \ - sync_file_range.c sync_file_range2.c sysinfo.c syslog.c tee.c \ - threads-execve.c time.c timer_create.c timer_xettime.c \ + so_peercred.c sock_filter-v.c socketcall.c \ + sockopt-sol_netlink.c splice.c $(stack_fcall_SOURCES) \ + $(stack_fcall_mangled_SOURCES) stat.c stat64.c statfs.c \ + statfs64.c statx.c swap.c sxetmask.c symlink.c symlinkat.c \ + sync.c sync_file_range.c sync_file_range2.c sysinfo.c syslog.c \ + tee.c threads-execve.c time.c timer_create.c timer_xettime.c \ timerfd_xettime.c times.c times-fail.c truncate.c truncate64.c \ ugetrlimit.c uio.c umask.c umount.c umount2.c umoven-illptr.c \ umovestr.c umovestr-illptr.c umovestr2.c umovestr3.c uname.c \ @@ -2492,7 +2610,8 @@ DIST_SOURCES = $(libtests_a_SOURCES) _newselect.c accept.c accept4.c \ userfaultfd.c ustat.c utime.c utimensat.c utimes.c vfork-f.c \ vhangup.c vmsplice.c wait4.c wait4-v.c waitid.c waitid-v.c \ waitpid.c xattr.c xattr-strings.c xet_robust_list.c \ - xetitimer.c xetpgid.c xetpriority.c xettimeofday.c zeroargc.c + xet_thread_area_x86.c xetitimer.c xetpgid.c xetpriority.c \ + xettimeofday.c zeroargc.c am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -2705,7 +2824,7 @@ am__set_TESTS_bases = \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck -@USE_LIBUNWIND_TRUE@am__EXEEXT_2 = strace-k.test +@USE_LIBUNWIND_TRUE@am__EXEEXT_2 = strace-k.test $(am__append_1) TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test am__test_logs1 = $(TESTS:=.log) @@ -2793,10 +2912,13 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ RANLIB = @RANLIB@ +READELF = @READELF@ RPM_CHANGELOGTIME = @RPM_CHANGELOGTIME@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SIZEOF_KERNEL_LONG_T = @SIZEOF_KERNEL_LONG_T@ +SIZEOF_LONG = @SIZEOF_LONG@ STRIP = @STRIP@ VALGRIND = @VALGRIND@ VALGRIND_ENABLED = @VALGRIND_ENABLED@ @@ -2817,6 +2939,7 @@ am__untar = @am__untar@ arch = @arch@ arch_m32 = @arch_m32@ arch_mx32 = @arch_mx32@ +arch_native = @arch_native@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -2824,6 +2947,8 @@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ +cc_flags_m32 = @cc_flags_m32@ +cc_flags_mx32 = @cc_flags_mx32@ datadir = @datadir@ datarootdir = @datarootdir@ dl_LIBS = @dl_LIBS@ @@ -2841,6 +2966,9 @@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +libiberty_CPPFLAGS = @libiberty_CPPFLAGS@ +libiberty_LDFLAGS = @libiberty_LDFLAGS@ +libiberty_LIBS = @libiberty_LIBS@ libunwind_CPPFLAGS = @libunwind_CPPFLAGS@ libunwind_LDFLAGS = @libunwind_LDFLAGS@ libunwind_LIBS = @libunwind_LIBS@ @@ -2865,7 +2993,9 @@ valgrind_enabled_tools = @valgrind_enabled_tools@ valgrind_tools = @valgrind_tools@ OS = linux ARCH = @arch@ +NATIVE_ARCH = @arch_native@ MPERS_NAME = +MPERS_CC_FLAGS = ARCH_MFLAGS = AM_CFLAGS = $(WARN_CFLAGS) AM_CPPFLAGS = $(ARCH_MFLAGS) \ @@ -3021,6 +3151,7 @@ PURE_EXECUTABLES = \ ioctl_block \ ioctl_dm \ ioctl_evdev \ + ioctl_kvm_run \ ioctl_loop \ ioctl_mtd \ ioctl_rtc \ @@ -3071,6 +3202,7 @@ PURE_EXECUTABLES = \ mmap64 \ mmsg \ mmsg_name \ + modify_ldt \ mount \ move_pages \ mq \ @@ -3140,9 +3272,12 @@ PURE_EXECUTABLES = \ nlattr_tcmsg \ nlattr_unix_diag_msg \ old_mmap \ + old_mmap-P \ + old_mmap-v-none \ oldfstat \ oldlstat \ oldselect \ + oldselect-efault \ oldstat \ open \ openat \ @@ -3156,7 +3291,9 @@ PURE_EXECUTABLES = \ pkey_free \ pkey_mprotect \ poll \ + poll-P \ ppoll \ + ppoll-P \ prctl-arg2-intptr \ prctl-dumpable \ prctl-name \ @@ -3199,6 +3336,7 @@ PURE_EXECUTABLES = \ renameat \ renameat2 \ request_key \ + riscv_flush_icache \ rmdir \ rt_sigaction \ rt_sigpending \ @@ -3208,6 +3346,12 @@ PURE_EXECUTABLES = \ rt_sigsuspend \ rt_sigtimedwait \ rt_tgsigqueueinfo \ + s390_guarded_storage \ + s390_guarded_storage-v \ + s390_pci_mmio_read_write \ + s390_runtime_instr \ + s390_sthyi \ + s390_sthyi-v \ sched_get_priority_mxx \ sched_rr_get_interval \ sched_xetaffinity \ @@ -3259,6 +3403,7 @@ PURE_EXECUTABLES = \ so_peercred \ sock_filter-v \ socketcall \ + sockopt-sol_netlink \ splice \ stat \ stat64 \ @@ -3310,6 +3455,7 @@ PURE_EXECUTABLES = \ xattr \ xattr-strings \ xet_robust_list \ + xet_thread_area_x86 \ xetitimer \ xetpgid \ xetpriority \ @@ -3344,13 +3490,17 @@ uio_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64 stack_fcall_SOURCES = stack-fcall.c \ stack-fcall-0.c stack-fcall-1.c stack-fcall-2.c stack-fcall-3.c +stack_fcall_mangled_SOURCES = stack-fcall-mangled.c \ + stack-fcall-mangled-0.c stack-fcall-mangled-1.c \ + stack-fcall-mangled-2.c stack-fcall-mangled-3.c + # Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in; do not edit. -GEN_TESTS = _newselect.gen.test accept.gen.test accept4.gen.test \ - access.gen.test acct.gen.test add_key.gen.test \ - adjtimex.gen.test aio.gen.test alarm.gen.test bpf.gen.test \ - bpf-v.gen.test btrfs.gen.test chmod.gen.test chown.gen.test \ - chown32.gen.test chroot.gen.test clock.gen.test \ +GEN_TESTS = _newselect.gen.test _newselect-P.gen.test accept.gen.test \ + accept4.gen.test access.gen.test acct.gen.test \ + add_key.gen.test adjtimex.gen.test aio.gen.test alarm.gen.test \ + bpf.gen.test bpf-v.gen.test btrfs.gen.test chmod.gen.test \ + chown.gen.test chown32.gen.test chroot.gen.test clock.gen.test \ clock_adjtime.gen.test clock_nanosleep.gen.test \ clock_xettime.gen.test copy_file_range.gen.test creat.gen.test \ delete_module.gen.test dup.gen.test dup2.gen.test \ @@ -3378,46 +3528,49 @@ GEN_TESTS = _newselect.gen.test accept.gen.test accept4.gen.test \ gettid.gen.test getuid32.gen.test getxxid.gen.test \ group_req.gen.test inet-cmsg.gen.test init_module.gen.test \ inotify.gen.test inotify_init1.gen.test int_0x80.gen.test \ - ioctl_block.gen.test ioctl_evdev.gen.test \ - ioctl_evdev-v.gen.test ioctl_loop.gen.test \ - ioctl_loop-v.gen.test ioctl_mtd.gen.test ioctl_rtc.gen.test \ + ioctl_block.gen.test ioctl_dm.gen.test ioctl_dm-v.gen.test \ + ioctl_evdev.gen.test ioctl_evdev-v.gen.test \ + ioctl_kvm_run.gen.test ioctl_loop.gen.test \ + ioctl_loop-nv.gen.test ioctl_loop-v.gen.test \ + ioctl_mtd.gen.test ioctl_nsfs.gen.test ioctl_rtc.gen.test \ ioctl_rtc-v.gen.test ioctl_scsi.gen.test \ ioctl_sg_io_v3.gen.test ioctl_sg_io_v4.gen.test \ - ioctl_uffdio.gen.test ioctl_v4l2.gen.test ioperm.gen.test \ - iopl.gen.test ioprio.gen.test ip_mreq.gen.test ipc.gen.test \ - ipc_msg.gen.test ipc_sem.gen.test ipc_shm.gen.test \ - kcmp.gen.test kcmp-y.gen.test kexec_file_load.gen.test \ - kexec_load.gen.test keyctl.gen.test kill.gen.test \ - lchown.gen.test lchown32.gen.test link.gen.test \ - linkat.gen.test lookup_dcookie.gen.test lstat.gen.test \ - lstat64.gen.test madvise.gen.test mbind.gen.test \ - membarrier.gen.test memfd_create.gen.test \ - migrate_pages.gen.test mincore.gen.test mkdir.gen.test \ - mkdirat.gen.test mknod.gen.test mknodat.gen.test \ - mlock.gen.test mlock2.gen.test mlockall.gen.test \ - mmap64.gen.test mmsg.gen.test mmsg-silent.gen.test \ - mmsg_name.gen.test mmsg_name-v.gen.test mount.gen.test \ - move_pages.gen.test mq.gen.test mq_sendrecv.gen.test \ - mq_sendrecv-read.gen.test mq_sendrecv-write.gen.test \ - msg_control.gen.test msg_control-v.gen.test msg_name.gen.test \ - munlockall.gen.test nanosleep.gen.test \ - net-icmp_filter.gen.test net-sockaddr.gen.test \ - netlink_audit.gen.test netlink_crypto.gen.test \ - netlink_generic.gen.test netlink_kobject_uevent.gen.test \ - netlink_netfilter.gen.test netlink_protocol.gen.test \ - netlink_route.gen.test netlink_selinux.gen.test \ - netlink_xfrm.gen.test newfstatat.gen.test nlattr.gen.test \ - nfnetlink_acct.gen.test nfnetlink_cthelper.gen.test \ - nfnetlink_ctnetlink.gen.test nfnetlink_ctnetlink_exp.gen.test \ - nfnetlink_cttimeout.gen.test nfnetlink_ipset.gen.test \ - nfnetlink_nft_compat.gen.test nfnetlink_nftables.gen.test \ - nfnetlink_osf.gen.test nfnetlink_queue.gen.test \ - nfnetlink_ulog.gen.test nlattr_crypto_user_alg.gen.test \ - nlattr_br_port_msg.gen.test nlattr_dcbmsg.gen.test \ - nlattr_fib_rule_hdr.gen.test nlattr_ifaddrlblmsg.gen.test \ - nlattr_ifaddrmsg.gen.test nlattr_ifinfomsg.gen.test \ - nlattr_ifla_brport.gen.test nlattr_ifla_port.gen.test \ - nlattr_ifla_xdp.gen.test nlattr_inet_diag_msg.gen.test \ + ioctl_sock_gifconf.gen.test ioctl_uffdio.gen.test \ + ioctl_v4l2.gen.test ioperm.gen.test iopl.gen.test \ + ioprio.gen.test ip_mreq.gen.test ipc.gen.test ipc_msg.gen.test \ + ipc_sem.gen.test ipc_shm.gen.test kcmp.gen.test \ + kcmp-y.gen.test kexec_file_load.gen.test kexec_load.gen.test \ + keyctl.gen.test kill.gen.test lchown.gen.test \ + lchown32.gen.test link.gen.test linkat.gen.test \ + lookup_dcookie.gen.test lstat.gen.test lstat64.gen.test \ + madvise.gen.test mbind.gen.test membarrier.gen.test \ + memfd_create.gen.test migrate_pages.gen.test mincore.gen.test \ + mkdir.gen.test mkdirat.gen.test mknod.gen.test \ + mknodat.gen.test mlock.gen.test mlock2.gen.test \ + mlockall.gen.test mmap64.gen.test mmsg.gen.test \ + mmsg-silent.gen.test mmsg_name.gen.test mmsg_name-v.gen.test \ + modify_ldt.gen.test mount.gen.test move_pages.gen.test \ + mq.gen.test mq_sendrecv.gen.test mq_sendrecv-read.gen.test \ + mq_sendrecv-write.gen.test msg_control.gen.test \ + msg_control-v.gen.test msg_name.gen.test munlockall.gen.test \ + nanosleep.gen.test net-icmp_filter.gen.test \ + net-sockaddr.gen.test netlink_audit.gen.test \ + netlink_crypto.gen.test netlink_generic.gen.test \ + netlink_kobject_uevent.gen.test netlink_netfilter.gen.test \ + netlink_protocol.gen.test netlink_route.gen.test \ + netlink_selinux.gen.test netlink_xfrm.gen.test \ + newfstatat.gen.test nlattr.gen.test nfnetlink_acct.gen.test \ + nfnetlink_cthelper.gen.test nfnetlink_ctnetlink.gen.test \ + nfnetlink_ctnetlink_exp.gen.test nfnetlink_cttimeout.gen.test \ + nfnetlink_ipset.gen.test nfnetlink_nft_compat.gen.test \ + nfnetlink_nftables.gen.test nfnetlink_osf.gen.test \ + nfnetlink_queue.gen.test nfnetlink_ulog.gen.test \ + nlattr_crypto_user_alg.gen.test nlattr_br_port_msg.gen.test \ + nlattr_dcbmsg.gen.test nlattr_fib_rule_hdr.gen.test \ + nlattr_ifaddrlblmsg.gen.test nlattr_ifaddrmsg.gen.test \ + nlattr_ifinfomsg.gen.test nlattr_ifla_brport.gen.test \ + nlattr_ifla_port.gen.test nlattr_ifla_xdp.gen.test \ + nlattr_inet_diag_msg.gen.test \ nlattr_inet_diag_req_compat.gen.test \ nlattr_inet_diag_req_v2.gen.test \ nlattr_mdba_mdb_entry.gen.test \ @@ -3429,16 +3582,18 @@ GEN_TESTS = _newselect.gen.test accept.gen.test accept4.gen.test \ nlattr_tc_stats.gen.test nlattr_tca_stab.gen.test \ nlattr_tcamsg.gen.test nlattr_tcmsg.gen.test \ nlattr_unix_diag_msg.gen.test old_mmap.gen.test \ - oldfstat.gen.test oldlstat.gen.test oldstat.gen.test \ - open.gen.test openat.gen.test osf_utimes.gen.test \ - pause.gen.test perf_event_open.gen.test \ + old_mmap-P.gen.test old_mmap-v-none.gen.test oldfstat.gen.test \ + oldlstat.gen.test oldselect.gen.test oldselect-P.gen.test \ + oldselect-efault.gen.test oldselect-efault-P.gen.test \ + oldstat.gen.test open.gen.test openat.gen.test \ + osf_utimes.gen.test pause.gen.test perf_event_open.gen.test \ perf_event_open_nonverbose.gen.test \ perf_event_open_unabbrev.gen.test pipe2.gen.test \ pkey_alloc.gen.test pkey_free.gen.test pkey_mprotect.gen.test \ - ppoll.gen.test ppoll-v.gen.test pread64-pwrite64.gen.test \ - preadv.gen.test preadv-pwritev.gen.test \ - preadv2-pwritev2.gen.test printstr.gen.test \ - printpath-umovestr.gen.test \ + ppoll.gen.test ppoll-P.gen.test ppoll-v.gen.test \ + pread64-pwrite64.gen.test preadv.gen.test \ + preadv-pwritev.gen.test preadv2-pwritev2.gen.test \ + printstr.gen.test printpath-umovestr.gen.test \ printpath-umovestr-peekdata.gen.test \ printpath-umovestr-undumpable.gen.test \ printstrn-umoven.gen.test printstrn-umoven-peekdata.gen.test \ @@ -3451,44 +3606,48 @@ GEN_TESTS = _newselect.gen.test accept.gen.test accept4.gen.test \ reboot.gen.test recvfrom.gen.test recvmmsg-timeout.gen.test \ recvmsg.gen.test regex.gen.test remap_file_pages.gen.test \ rename.gen.test renameat.gen.test renameat2.gen.test \ - request_key.gen.test rmdir.gen.test rt_sigpending.gen.test \ - rt_sigprocmask.gen.test rt_sigqueueinfo.gen.test \ - rt_sigreturn.gen.test rt_sigsuspend.gen.test \ - rt_sigtimedwait.gen.test rt_tgsigqueueinfo.gen.test \ - sched.gen.test sched_get_priority_mxx.gen.test \ - sched_rr_get_interval.gen.test sched_xetaffinity.gen.test \ - sched_xetattr.gen.test sched_xetparam.gen.test \ - sched_xetscheduler.gen.test sched_yield.gen.test \ - seccomp-filter.gen.test seccomp-filter-v.gen.test \ - seccomp_get_action_avail.gen.test select.gen.test \ - semop.gen.test sendfile.gen.test sendfile64.gen.test \ - set_mempolicy.gen.test setdomainname.gen.test \ - setfsgid.gen.test setfsgid32.gen.test setfsuid.gen.test \ - setfsuid32.gen.test setgid.gen.test setgid32.gen.test \ - setgroups.gen.test setgroups32.gen.test sethostname.gen.test \ - setns.gen.test setregid.gen.test setregid32.gen.test \ - setresgid.gen.test setresgid32.gen.test setresuid.gen.test \ - setresuid32.gen.test setreuid.gen.test setreuid32.gen.test \ - setrlimit.gen.test setuid.gen.test setuid32.gen.test \ - shmxt.gen.test shutdown.gen.test sigaction.gen.test \ - siginfo.gen.test signal.gen.test signal_receive.gen.test \ - signalfd4.gen.test sigpending.gen.test sigprocmask.gen.test \ - sigreturn.gen.test sigsuspend.gen.test so_linger.gen.test \ - so_peercred.gen.test sock_filter-v.gen.test \ - socketcall.gen.test splice.gen.test stat.gen.test \ - stat64.gen.test statfs.gen.test statfs64.gen.test \ - statx.gen.test swap.gen.test sxetmask.gen.test \ - symlink.gen.test symlinkat.gen.test sync.gen.test \ - sync_file_range.gen.test sync_file_range2.gen.test \ - sysinfo.gen.test syslog.gen.test tee.gen.test time.gen.test \ - timer_create.gen.test timer_xettime.gen.test \ - timerfd_xettime.gen.test times.gen.test times-fail.gen.test \ - trace_fstat.gen.test trace_fstatfs.gen.test \ - trace_lstat.gen.test trace_question.gen.test \ - trace_stat.gen.test trace_stat_like.gen.test \ - trace_statfs.gen.test trace_statfs_like.gen.test \ - truncate.gen.test truncate64.gen.test ugetrlimit.gen.test \ - umask.gen.test umoven-illptr.gen.test umovestr-illptr.gen.test \ + request_key.gen.test riscv_flush_icache.gen.test \ + rmdir.gen.test rt_sigpending.gen.test rt_sigprocmask.gen.test \ + rt_sigqueueinfo.gen.test rt_sigreturn.gen.test \ + rt_sigsuspend.gen.test rt_sigtimedwait.gen.test \ + rt_tgsigqueueinfo.gen.test s390_guarded_storage.gen.test \ + s390_guarded_storage-v.gen.test \ + s390_pci_mmio_read_write.gen.test s390_runtime_instr.gen.test \ + s390_sthyi.gen.test s390_sthyi-v.gen.test sched.gen.test \ + sched_get_priority_mxx.gen.test sched_rr_get_interval.gen.test \ + sched_xetaffinity.gen.test sched_xetattr.gen.test \ + sched_xetparam.gen.test sched_xetscheduler.gen.test \ + sched_yield.gen.test seccomp-filter.gen.test \ + seccomp-filter-v.gen.test seccomp_get_action_avail.gen.test \ + select.gen.test select-P.gen.test semop.gen.test \ + sendfile.gen.test sendfile64.gen.test set_mempolicy.gen.test \ + setdomainname.gen.test setfsgid.gen.test setfsgid32.gen.test \ + setfsuid.gen.test setfsuid32.gen.test setgid.gen.test \ + setgid32.gen.test setgroups.gen.test setgroups32.gen.test \ + sethostname.gen.test setns.gen.test setregid.gen.test \ + setregid32.gen.test setresgid.gen.test setresgid32.gen.test \ + setresuid.gen.test setresuid32.gen.test setreuid.gen.test \ + setreuid32.gen.test setrlimit.gen.test setuid.gen.test \ + setuid32.gen.test shmxt.gen.test shutdown.gen.test \ + sigaction.gen.test siginfo.gen.test signal.gen.test \ + signal_receive.gen.test signalfd4.gen.test sigpending.gen.test \ + sigprocmask.gen.test sigreturn.gen.test sigsuspend.gen.test \ + so_linger.gen.test so_peercred.gen.test sock_filter-v.gen.test \ + socketcall.gen.test sockopt-sol_netlink.gen.test \ + splice.gen.test stat.gen.test stat64.gen.test statfs.gen.test \ + statfs64.gen.test statx.gen.test swap.gen.test \ + sxetmask.gen.test symlink.gen.test symlinkat.gen.test \ + sync.gen.test sync_file_range.gen.test \ + sync_file_range2.gen.test sysinfo.gen.test syslog.gen.test \ + tee.gen.test time.gen.test timer_create.gen.test \ + timer_xettime.gen.test timerfd_xettime.gen.test times.gen.test \ + times-fail.gen.test trace_fstat.gen.test \ + trace_fstatfs.gen.test trace_lstat.gen.test \ + trace_question.gen.test trace_stat.gen.test \ + trace_stat_like.gen.test trace_statfs.gen.test \ + trace_statfs_like.gen.test truncate.gen.test \ + truncate64.gen.test ugetrlimit.gen.test umask.gen.test \ + umoven-illptr.gen.test umovestr-illptr.gen.test \ umovestr3.gen.test unlink.gen.test unlinkat.gen.test \ unshare.gen.test userfaultfd.gen.test ustat.gen.test \ utime.gen.test utimensat.gen.test utimes.gen.test \ @@ -3499,7 +3658,7 @@ GEN_TESTS = _newselect.gen.test accept.gen.test accept4.gen.test \ xetitimer.gen.test xetpgid.gen.test xetpriority.gen.test \ xettimeofday.gen.test @USE_LIBUNWIND_FALSE@LIBUNWIND_TESTS = -@USE_LIBUNWIND_TRUE@LIBUNWIND_TESTS = strace-k.test +@USE_LIBUNWIND_TRUE@LIBUNWIND_TESTS = strace-k.test $(am__append_1) DECODER_TESTS = \ brk.test \ btrfs-v.test \ @@ -3514,11 +3673,6 @@ DECODER_TESTS = \ futex.test \ getuid.test \ ioctl.test \ - ioctl_dm-v.test \ - ioctl_dm.test \ - ioctl_loop-nv.test \ - ioctl_nsfs.test \ - ioctl_sock_gifconf.test \ ipc_msgbuf.test \ llseek.test \ lseek.test \ @@ -3530,9 +3684,11 @@ DECODER_TESTS = \ net.test \ netlink_sock_diag.test \ nsyscalls.test \ - oldselect.test \ + nsyscalls-d.test \ + nsyscalls-nd.test \ personality.test \ pipe.test \ + poll-P.test \ poll.test \ prctl-arg2-intptr.test \ prctl-dumpable.test \ @@ -3551,6 +3707,7 @@ DECODER_TESTS = \ seccomp-strict.test \ sigaltstack.test \ sun_path.test \ + xet_thread_area_x86.test \ uio.test \ umount.test \ umount2.test \ @@ -3573,6 +3730,8 @@ MISC_TESTS = \ detach-sleeping.test \ detach-stopped.test \ filter-unavailable.test \ + filtering_fd-syntax.test \ + filtering_syscall-syntax.test \ fflush.test \ get_regs.test \ interactive_block.test \ @@ -3616,10 +3775,16 @@ XFAIL_TESTS_x86_64 = int_0x80.gen.test XFAIL_TESTS_x32 = int_0x80.gen.test XFAIL_TESTS = $(XFAIL_TESTS_$(MPERS_NAME)) $(XFAIL_TESTS_$(ARCH)) TEST_LOG_COMPILER = env -AM_TEST_LOG_FLAGS = STRACE_ARCH=$(ARCH) MIPS_ABI=$(MIPS_ABI) $(srcdir)/run.sh +AM_TEST_LOG_FLAGS = STRACE_ARCH=$(ARCH) STRACE_NATIVE_ARCH=$(NATIVE_ARCH) \ + SIZEOF_KERNEL_LONG_T=$(SIZEOF_KERNEL_LONG_T) \ + SIZEOF_LONG=$(SIZEOF_LONG) \ + MIPS_ABI=$(MIPS_ABI) $(srcdir)/run.sh + VALGRIND_FLAGS = --quiet VALGRIND_SUPPRESSIONS_FILES = $(abs_srcdir)/strace.supp EXTRA_DIST = \ + accept_compat.h \ + attach-p-cmd.h \ caps-abbrev.awk \ caps.awk \ clock.in \ @@ -3635,7 +3800,6 @@ EXTRA_DIST = \ getresugid.c \ init.sh \ init_delete_module.h \ - ioctl-v.sh \ ipc.sh \ ipc_msgbuf.expected \ ksysent.sed \ @@ -3643,8 +3807,8 @@ EXTRA_DIST = \ match.awk \ net.expected \ netlink_sock_diag-v.sh \ - oldselect.expected \ pipe.expected \ + print_user_desc.c \ process_vm_readv_writev.c \ pure_executables.list \ qual_fault-exit_group.expected \ @@ -3662,10 +3826,12 @@ EXTRA_DIST = \ setugid.c \ sigaltstack.expected \ sockname.c \ + stack-fcall.h \ strace-C.expected \ strace-E.expected \ strace-T.expected \ strace-ff.expected \ + strace-k-demangle.test \ strace-k.test \ strace-r.expected \ strace.supp \ @@ -3756,6 +3922,10 @@ _newselect$(EXEEXT): $(_newselect_OBJECTS) $(_newselect_DEPENDENCIES) $(EXTRA__n @rm -f _newselect$(EXEEXT) $(AM_V_CCLD)$(LINK) $(_newselect_OBJECTS) $(_newselect_LDADD) $(LIBS) +_newselect-P$(EXEEXT): $(_newselect_P_OBJECTS) $(_newselect_P_DEPENDENCIES) $(EXTRA__newselect_P_DEPENDENCIES) + @rm -f _newselect-P$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(_newselect_P_OBJECTS) $(_newselect_P_LDADD) $(LIBS) + accept$(EXEEXT): $(accept_OBJECTS) $(accept_DEPENDENCIES) $(EXTRA_accept_DEPENDENCIES) @rm -f accept$(EXEEXT) $(AM_V_CCLD)$(LINK) $(accept_OBJECTS) $(accept_LDADD) $(LIBS) @@ -4248,6 +4418,10 @@ ioctl_evdev-v$(EXEEXT): $(ioctl_evdev_v_OBJECTS) $(ioctl_evdev_v_DEPENDENCIES) $ @rm -f ioctl_evdev-v$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ioctl_evdev_v_OBJECTS) $(ioctl_evdev_v_LDADD) $(LIBS) +ioctl_kvm_run$(EXEEXT): $(ioctl_kvm_run_OBJECTS) $(ioctl_kvm_run_DEPENDENCIES) $(EXTRA_ioctl_kvm_run_DEPENDENCIES) + @rm -f ioctl_kvm_run$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ioctl_kvm_run_OBJECTS) $(ioctl_kvm_run_LDADD) $(LIBS) + ioctl_loop$(EXEEXT): $(ioctl_loop_OBJECTS) $(ioctl_loop_DEPENDENCIES) $(EXTRA_ioctl_loop_DEPENDENCIES) @rm -f ioctl_loop$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ioctl_loop_OBJECTS) $(ioctl_loop_LDADD) $(LIBS) @@ -4484,6 +4658,10 @@ mmsg_name-v$(EXEEXT): $(mmsg_name_v_OBJECTS) $(mmsg_name_v_DEPENDENCIES) $(EXTRA @rm -f mmsg_name-v$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mmsg_name_v_OBJECTS) $(mmsg_name_v_LDADD) $(LIBS) +modify_ldt$(EXEEXT): $(modify_ldt_OBJECTS) $(modify_ldt_DEPENDENCIES) $(EXTRA_modify_ldt_DEPENDENCIES) + @rm -f modify_ldt$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(modify_ldt_OBJECTS) $(modify_ldt_LDADD) $(LIBS) + mount$(EXEEXT): $(mount_OBJECTS) $(mount_DEPENDENCIES) $(EXTRA_mount_DEPENDENCIES) @rm -f mount$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mount_OBJECTS) $(mount_LDADD) $(LIBS) @@ -4780,10 +4958,22 @@ nsyscalls$(EXEEXT): $(nsyscalls_OBJECTS) $(nsyscalls_DEPENDENCIES) $(EXTRA_nsysc @rm -f nsyscalls$(EXEEXT) $(AM_V_CCLD)$(LINK) $(nsyscalls_OBJECTS) $(nsyscalls_LDADD) $(LIBS) +nsyscalls-d$(EXEEXT): $(nsyscalls_d_OBJECTS) $(nsyscalls_d_DEPENDENCIES) $(EXTRA_nsyscalls_d_DEPENDENCIES) + @rm -f nsyscalls-d$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(nsyscalls_d_OBJECTS) $(nsyscalls_d_LDADD) $(LIBS) + old_mmap$(EXEEXT): $(old_mmap_OBJECTS) $(old_mmap_DEPENDENCIES) $(EXTRA_old_mmap_DEPENDENCIES) @rm -f old_mmap$(EXEEXT) $(AM_V_CCLD)$(LINK) $(old_mmap_OBJECTS) $(old_mmap_LDADD) $(LIBS) +old_mmap-P$(EXEEXT): $(old_mmap_P_OBJECTS) $(old_mmap_P_DEPENDENCIES) $(EXTRA_old_mmap_P_DEPENDENCIES) + @rm -f old_mmap-P$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(old_mmap_P_OBJECTS) $(old_mmap_P_LDADD) $(LIBS) + +old_mmap-v-none$(EXEEXT): $(old_mmap_v_none_OBJECTS) $(old_mmap_v_none_DEPENDENCIES) $(EXTRA_old_mmap_v_none_DEPENDENCIES) + @rm -f old_mmap-v-none$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(old_mmap_v_none_OBJECTS) $(old_mmap_v_none_LDADD) $(LIBS) + oldfstat$(EXEEXT): $(oldfstat_OBJECTS) $(oldfstat_DEPENDENCIES) $(EXTRA_oldfstat_DEPENDENCIES) @rm -f oldfstat$(EXEEXT) $(AM_V_CCLD)$(LINK) $(oldfstat_OBJECTS) $(oldfstat_LDADD) $(LIBS) @@ -4796,6 +4986,18 @@ oldselect$(EXEEXT): $(oldselect_OBJECTS) $(oldselect_DEPENDENCIES) $(EXTRA_oldse @rm -f oldselect$(EXEEXT) $(AM_V_CCLD)$(LINK) $(oldselect_OBJECTS) $(oldselect_LDADD) $(LIBS) +oldselect-P$(EXEEXT): $(oldselect_P_OBJECTS) $(oldselect_P_DEPENDENCIES) $(EXTRA_oldselect_P_DEPENDENCIES) + @rm -f oldselect-P$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(oldselect_P_OBJECTS) $(oldselect_P_LDADD) $(LIBS) + +oldselect-efault$(EXEEXT): $(oldselect_efault_OBJECTS) $(oldselect_efault_DEPENDENCIES) $(EXTRA_oldselect_efault_DEPENDENCIES) + @rm -f oldselect-efault$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(oldselect_efault_OBJECTS) $(oldselect_efault_LDADD) $(LIBS) + +oldselect-efault-P$(EXEEXT): $(oldselect_efault_P_OBJECTS) $(oldselect_efault_P_DEPENDENCIES) $(EXTRA_oldselect_efault_P_DEPENDENCIES) + @rm -f oldselect-efault-P$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(oldselect_efault_P_OBJECTS) $(oldselect_efault_P_LDADD) $(LIBS) + oldstat$(EXEEXT): $(oldstat_OBJECTS) $(oldstat_DEPENDENCIES) $(EXTRA_oldstat_DEPENDENCIES) @rm -f oldstat$(EXEEXT) $(AM_V_CCLD)$(LINK) $(oldstat_OBJECTS) $(oldstat_LDADD) $(LIBS) @@ -4860,10 +5062,18 @@ poll$(EXEEXT): $(poll_OBJECTS) $(poll_DEPENDENCIES) $(EXTRA_poll_DEPENDENCIES) @rm -f poll$(EXEEXT) $(AM_V_CCLD)$(LINK) $(poll_OBJECTS) $(poll_LDADD) $(LIBS) +poll-P$(EXEEXT): $(poll_P_OBJECTS) $(poll_P_DEPENDENCIES) $(EXTRA_poll_P_DEPENDENCIES) + @rm -f poll-P$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(poll_P_OBJECTS) $(poll_P_LDADD) $(LIBS) + ppoll$(EXEEXT): $(ppoll_OBJECTS) $(ppoll_DEPENDENCIES) $(EXTRA_ppoll_DEPENDENCIES) @rm -f ppoll$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ppoll_OBJECTS) $(ppoll_LDADD) $(LIBS) +ppoll-P$(EXEEXT): $(ppoll_P_OBJECTS) $(ppoll_P_DEPENDENCIES) $(EXTRA_ppoll_P_DEPENDENCIES) + @rm -f ppoll-P$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ppoll_P_OBJECTS) $(ppoll_P_LDADD) $(LIBS) + ppoll-v$(EXEEXT): $(ppoll_v_OBJECTS) $(ppoll_v_DEPENDENCIES) $(EXTRA_ppoll_v_DEPENDENCIES) @rm -f ppoll-v$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ppoll_v_OBJECTS) $(ppoll_v_LDADD) $(LIBS) @@ -5084,6 +5294,10 @@ restart_syscall$(EXEEXT): $(restart_syscall_OBJECTS) $(restart_syscall_DEPENDENC @rm -f restart_syscall$(EXEEXT) $(AM_V_CCLD)$(LINK) $(restart_syscall_OBJECTS) $(restart_syscall_LDADD) $(LIBS) +riscv_flush_icache$(EXEEXT): $(riscv_flush_icache_OBJECTS) $(riscv_flush_icache_DEPENDENCIES) $(EXTRA_riscv_flush_icache_DEPENDENCIES) + @rm -f riscv_flush_icache$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(riscv_flush_icache_OBJECTS) $(riscv_flush_icache_LDADD) $(LIBS) + rmdir$(EXEEXT): $(rmdir_OBJECTS) $(rmdir_DEPENDENCIES) $(EXTRA_rmdir_DEPENDENCIES) @rm -f rmdir$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rmdir_OBJECTS) $(rmdir_LDADD) $(LIBS) @@ -5124,6 +5338,30 @@ run_expect_termsig$(EXEEXT): $(run_expect_termsig_OBJECTS) $(run_expect_termsig_ @rm -f run_expect_termsig$(EXEEXT) $(AM_V_CCLD)$(LINK) $(run_expect_termsig_OBJECTS) $(run_expect_termsig_LDADD) $(LIBS) +s390_guarded_storage$(EXEEXT): $(s390_guarded_storage_OBJECTS) $(s390_guarded_storage_DEPENDENCIES) $(EXTRA_s390_guarded_storage_DEPENDENCIES) + @rm -f s390_guarded_storage$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(s390_guarded_storage_OBJECTS) $(s390_guarded_storage_LDADD) $(LIBS) + +s390_guarded_storage-v$(EXEEXT): $(s390_guarded_storage_v_OBJECTS) $(s390_guarded_storage_v_DEPENDENCIES) $(EXTRA_s390_guarded_storage_v_DEPENDENCIES) + @rm -f s390_guarded_storage-v$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(s390_guarded_storage_v_OBJECTS) $(s390_guarded_storage_v_LDADD) $(LIBS) + +s390_pci_mmio_read_write$(EXEEXT): $(s390_pci_mmio_read_write_OBJECTS) $(s390_pci_mmio_read_write_DEPENDENCIES) $(EXTRA_s390_pci_mmio_read_write_DEPENDENCIES) + @rm -f s390_pci_mmio_read_write$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(s390_pci_mmio_read_write_OBJECTS) $(s390_pci_mmio_read_write_LDADD) $(LIBS) + +s390_runtime_instr$(EXEEXT): $(s390_runtime_instr_OBJECTS) $(s390_runtime_instr_DEPENDENCIES) $(EXTRA_s390_runtime_instr_DEPENDENCIES) + @rm -f s390_runtime_instr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(s390_runtime_instr_OBJECTS) $(s390_runtime_instr_LDADD) $(LIBS) + +s390_sthyi$(EXEEXT): $(s390_sthyi_OBJECTS) $(s390_sthyi_DEPENDENCIES) $(EXTRA_s390_sthyi_DEPENDENCIES) + @rm -f s390_sthyi$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(s390_sthyi_OBJECTS) $(s390_sthyi_LDADD) $(LIBS) + +s390_sthyi-v$(EXEEXT): $(s390_sthyi_v_OBJECTS) $(s390_sthyi_v_DEPENDENCIES) $(EXTRA_s390_sthyi_v_DEPENDENCIES) + @rm -f s390_sthyi-v$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(s390_sthyi_v_OBJECTS) $(s390_sthyi_v_LDADD) $(LIBS) + sched_get_priority_mxx$(EXEEXT): $(sched_get_priority_mxx_OBJECTS) $(sched_get_priority_mxx_DEPENDENCIES) $(EXTRA_sched_get_priority_mxx_DEPENDENCIES) @rm -f sched_get_priority_mxx$(EXEEXT) $(AM_V_CCLD)$(LINK) $(sched_get_priority_mxx_OBJECTS) $(sched_get_priority_mxx_LDADD) $(LIBS) @@ -5176,6 +5414,10 @@ select$(EXEEXT): $(select_OBJECTS) $(select_DEPENDENCIES) $(EXTRA_select_DEPENDE @rm -f select$(EXEEXT) $(AM_V_CCLD)$(LINK) $(select_OBJECTS) $(select_LDADD) $(LIBS) +select-P$(EXEEXT): $(select_P_OBJECTS) $(select_P_DEPENDENCIES) $(EXTRA_select_P_DEPENDENCIES) + @rm -f select-P$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(select_P_OBJECTS) $(select_P_LDADD) $(LIBS) + semop$(EXEEXT): $(semop_OBJECTS) $(semop_DEPENDENCIES) $(EXTRA_semop_DEPENDENCIES) @rm -f semop$(EXEEXT) $(AM_V_CCLD)$(LINK) $(semop_OBJECTS) $(semop_LDADD) $(LIBS) @@ -5360,6 +5602,10 @@ socketcall$(EXEEXT): $(socketcall_OBJECTS) $(socketcall_DEPENDENCIES) $(EXTRA_so @rm -f socketcall$(EXEEXT) $(AM_V_CCLD)$(LINK) $(socketcall_OBJECTS) $(socketcall_LDADD) $(LIBS) +sockopt-sol_netlink$(EXEEXT): $(sockopt_sol_netlink_OBJECTS) $(sockopt_sol_netlink_DEPENDENCIES) $(EXTRA_sockopt_sol_netlink_DEPENDENCIES) + @rm -f sockopt-sol_netlink$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(sockopt_sol_netlink_OBJECTS) $(sockopt_sol_netlink_LDADD) $(LIBS) + splice$(EXEEXT): $(splice_OBJECTS) $(splice_DEPENDENCIES) $(EXTRA_splice_DEPENDENCIES) @rm -f splice$(EXEEXT) $(AM_V_CCLD)$(LINK) $(splice_OBJECTS) $(splice_LDADD) $(LIBS) @@ -5368,6 +5614,10 @@ stack-fcall$(EXEEXT): $(stack_fcall_OBJECTS) $(stack_fcall_DEPENDENCIES) $(EXTRA @rm -f stack-fcall$(EXEEXT) $(AM_V_CCLD)$(LINK) $(stack_fcall_OBJECTS) $(stack_fcall_LDADD) $(LIBS) +stack-fcall-mangled$(EXEEXT): $(stack_fcall_mangled_OBJECTS) $(stack_fcall_mangled_DEPENDENCIES) $(EXTRA_stack_fcall_mangled_DEPENDENCIES) + @rm -f stack-fcall-mangled$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(stack_fcall_mangled_OBJECTS) $(stack_fcall_mangled_LDADD) $(LIBS) + stat$(EXEEXT): $(stat_OBJECTS) $(stat_DEPENDENCIES) $(EXTRA_stat_DEPENDENCIES) @rm -f stat$(EXEEXT) $(AM_V_CCLD)$(LINK) $(stat_OBJECTS) $(stat_LDADD) $(LIBS) @@ -5596,6 +5846,10 @@ xet_robust_list$(EXEEXT): $(xet_robust_list_OBJECTS) $(xet_robust_list_DEPENDENC @rm -f xet_robust_list$(EXEEXT) $(AM_V_CCLD)$(LINK) $(xet_robust_list_OBJECTS) $(xet_robust_list_LDADD) $(LIBS) +xet_thread_area_x86$(EXEEXT): $(xet_thread_area_x86_OBJECTS) $(xet_thread_area_x86_DEPENDENCIES) $(EXTRA_xet_thread_area_x86_DEPENDENCIES) + @rm -f xet_thread_area_x86$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(xet_thread_area_x86_OBJECTS) $(xet_thread_area_x86_LDADD) $(LIBS) + xetitimer$(EXEEXT): $(xetitimer_OBJECTS) $(xetitimer_DEPENDENCIES) $(EXTRA_xetitimer_DEPENDENCIES) @rm -f xetitimer$(EXEEXT) $(AM_V_CCLD)$(LINK) $(xetitimer_OBJECTS) $(xetitimer_LDADD) $(LIBS) @@ -5622,6 +5876,7 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_newselect-P.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_newselect.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/accept.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/accept4.Po@am__quote@ @@ -5746,6 +6001,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_dm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_evdev-v.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_evdev.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_kvm_run.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_loop-nv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_loop-v.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioctl_loop.Po@am__quote@ @@ -5831,6 +6087,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmsg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmsg_name-v.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmsg_name.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modify_ldt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mount.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/move_pages.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mq.Po@am__quote@ @@ -5904,10 +6161,16 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nlattr_tcamsg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nlattr_tcmsg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nlattr_unix_diag_msg.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nsyscalls-d.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nsyscalls.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/old_mmap-P.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/old_mmap-v-none.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/old_mmap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oldfstat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oldlstat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oldselect-P.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oldselect-efault-P.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oldselect-efault.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oldselect.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oldstat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/open.Po@am__quote@ @@ -5924,7 +6187,9 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkey_alloc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkey_free.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkey_mprotect.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/poll-P.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/poll.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppoll-P.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppoll-v.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppoll.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prctl-arg2-intptr.Po@am__quote@ @@ -5981,6 +6246,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/renameat2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/request_key.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/restart_syscall.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/riscv_flush_icache.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rmdir.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rt_sigaction.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rt_sigpending.Po@am__quote@ @@ -5991,6 +6257,12 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rt_sigtimedwait.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rt_tgsigqueueinfo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run_expect_termsig.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_guarded_storage-v.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_guarded_storage.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_pci_mmio_read_write.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_runtime_instr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_sthyi-v.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s390_sthyi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched_get_priority_mxx.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched_rr_get_interval.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched_xetaffinity.Po@am__quote@ @@ -6003,6 +6275,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seccomp-filter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seccomp-strict.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seccomp_get_action_avail.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/select-P.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/select.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/semop.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sendfile.Po@am__quote@ @@ -6050,11 +6323,17 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/so_peercred.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sock_filter-v.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/socketcall.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sockopt-sol_netlink.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splice.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-0.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-3.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled-0.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled-1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled-2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled-3.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall-mangled.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-fcall.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat64-stat64.Po@am__quote@ @@ -6113,6 +6392,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xattr-strings.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xattr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xet_robust_list.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xet_thread_area_x86.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xetitimer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xetpgid.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xetpriority.Po@am__quote@ @@ -7094,6 +7374,9 @@ uninstall-am: $(srcdir)/_newselect.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/_newselect-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/accept.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -7385,21 +7668,36 @@ $(srcdir)/int_0x80.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(srcdir)/ioctl_block.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_dm.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/ioctl_dm-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_evdev.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ $(srcdir)/ioctl_evdev-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_kvm_run.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_loop.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_loop-nv.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_loop-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ $(srcdir)/ioctl_mtd.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_nsfs.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_rtc.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -7415,6 +7713,9 @@ $(srcdir)/ioctl_sg_io_v3.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_test $(srcdir)/ioctl_sg_io_v4.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_sock_gifconf.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_uffdio.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -7538,6 +7839,9 @@ $(srcdir)/mmsg_name.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(srcdir)/mmsg_name-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/modify_ldt.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/mount.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -7733,12 +8037,30 @@ $(srcdir)/nlattr_unix_diag_msg.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/ge $(srcdir)/old_mmap.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/old_mmap-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/old_mmap-v-none.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/oldfstat.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ $(srcdir)/oldlstat.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/oldselect.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/oldselect-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/oldselect-efault.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/oldselect-efault-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/oldstat.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -7778,6 +8100,9 @@ $(srcdir)/pkey_mprotect.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests $(srcdir)/ppoll.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ppoll-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ppoll-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -7889,6 +8214,9 @@ $(srcdir)/renameat2.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(srcdir)/request_key.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/riscv_flush_icache.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/rmdir.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -7913,6 +8241,24 @@ $(srcdir)/rt_sigtimedwait.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tes $(srcdir)/rt_tgsigqueueinfo.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/s390_guarded_storage.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_guarded_storage-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_pci_mmio_read_write.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_runtime_instr.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_sthyi.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_sthyi-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/sched.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -7949,6 +8295,9 @@ $(srcdir)/seccomp_get_action_avail.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir $(srcdir)/select.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/select-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/semop.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -8072,6 +8421,9 @@ $(srcdir)/sock_filter-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests $(srcdir)/socketcall.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/sockopt-sol_netlink.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/splice.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ diff --git a/tests/_newselect-P.c b/tests/_newselect-P.c new file mode 100644 index 00000000..561fbfe2 --- /dev/null +++ b/tests/_newselect-P.c @@ -0,0 +1,2 @@ +#define PATH_TRACING_FD 9 +#include "_newselect.c" diff --git a/tests/_newselect-P.gen.test b/tests/_newselect-P.gen.test new file mode 100755 index 00000000..9c4247a1 --- /dev/null +++ b/tests/_newselect-P.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (_newselect-P -e trace=_newselect -P /dev/full 9>>/dev/full); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -e trace=_newselect -P /dev/full 9>>/dev/full diff --git a/tests/_newselect.gen.test b/tests/_newselect.gen.test index 490abe46..8e4d5f24 100755 --- a/tests/_newselect.gen.test +++ b/tests/_newselect.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (_newselect ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (_newselect ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/accept.c b/tests/accept.c index 8d42ba15..40b45db2 100644 --- a/tests/accept.c +++ b/tests/accept.c @@ -2,6 +2,7 @@ * Check decoding of accept syscall. * * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,9 +28,34 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef TEST_SYSCALL_NAME -# define TEST_SYSCALL_NAME accept -#endif +#include "tests.h" + +#include <unistd.h> + +#include <asm/unistd.h> + +#if defined __NR_accept + +# ifndef TEST_SYSCALL_NAME +# define TEST_SYSCALL_NAME do_accept + +# ifndef TEST_SYSCALL_STR +# define TEST_SYSCALL_STR "accept" +# endif + +int do_accept(int sockfd, void *addr, void *addrlen) +{ + return syscall(__NR_accept, sockfd, addr, addrlen); +} +# endif /* !TEST_SYSCALL_NAME */ + +#else /* !__NR_accept */ + +# ifndef TEST_SYSCALL_NAME +# define TEST_SYSCALL_NAME accept +# endif + +#endif /* __NR_accept */ #define TEST_SYSCALL_PREPARE connect_un() static void connect_un(void); diff --git a/tests/accept.gen.test b/tests/accept.gen.test index 3ebba3b5..45d9239e 100755 --- a/tests/accept.gen.test +++ b/tests/accept.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (accept -a22); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (accept -a22 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a22 +run_strace_match_diff -a22 diff --git a/tests/accept4.gen.test b/tests/accept4.gen.test index 5bd7fe6c..71199703 100755 --- a/tests/accept4.gen.test +++ b/tests/accept4.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (accept4 -a37); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (accept4 -a37 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a37 +run_strace_match_diff -a37 diff --git a/tests/accept_compat.h b/tests/accept_compat.h new file mode 100644 index 00000000..c45b2551 --- /dev/null +++ b/tests/accept_compat.h @@ -0,0 +1,25 @@ +#ifndef _STRACE_TESTS_ACCEPT_COMPAT_H_ +#define _STRACE_TESTS_ACCEPT_COMPAT_H_ + +#include <unistd.h> +#include <sys/socket.h> +#include <asm/unistd.h> + +#if defined __NR_socketcall && defined __sparc__ +/* + * Work around the fact that + * - glibc >= 2.26 uses accept4 syscall to implement accept() call on sparc; + * - accept syscall had not been wired up on sparc until v4.4-rc8~4^2~1. + */ +static inline int +do_accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen) +{ + const long args[] = { sockfd, (long) addr, (long) addrlen }; + + return syscall(__NR_socketcall, 5, args); +} +#else +# define do_accept accept +#endif + +#endif /* !_STRACE_TESTS_ACCEPT_COMPAT_H_ */ diff --git a/tests/acct.gen.test b/tests/acct.gen.test index fa14e85b..4a98dd46 100755 --- a/tests/acct.gen.test +++ b/tests/acct.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (acct -a20); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (acct -a20 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a20 +run_strace_match_diff -a20 diff --git a/tests/adjtimex.gen.test b/tests/adjtimex.gen.test index 8db59f29..e6024431 100755 --- a/tests/adjtimex.gen.test +++ b/tests/adjtimex.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (adjtimex -a15); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (adjtimex -a15 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a15 +run_strace_match_diff -a15 diff --git a/tests/alarm.gen.test b/tests/alarm.gen.test index ba1dea8b..25982e14 100755 --- a/tests/alarm.gen.test +++ b/tests/alarm.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (alarm -a10); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (alarm -a10 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a10 +run_strace_match_diff -a10 diff --git a/tests/attach-p-cmd-cmd.c b/tests/attach-p-cmd-cmd.c index d0f824e9..70e3a2de 100644 --- a/tests/attach-p-cmd-cmd.c +++ b/tests/attach-p-cmd-cmd.c @@ -1,7 +1,7 @@ /* * This file is part of attach-p-cmd strace test. * - * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2017 Dmitry V. Levin <ldv@altlinux.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,19 +32,41 @@ #include <stdio.h> #include <sys/stat.h> #include <unistd.h> +#include "attach-p-cmd.h" -int -main(void) +static void +write_pidfile(const pid_t pid) +{ + FILE *fp = fopen(pidfile, "w"); + if (!fp) + perror_msg_and_fail("fopen: %s", pidfile); + + if (fprintf(fp, "%d", pid) < 0) + perror_msg_and_fail("fprintf: %s", pidfile); + + if (fclose(fp)) + perror_msg_and_fail("fclose: %s", pidfile); +} + +static void +wait_for_peer_invocation(void) { - static const char lockdir[] = "attach-p-cmd.test-lock"; /* wait for the lock directory to be created by peer */ while (rmdir(lockdir)) { if (ENOENT != errno) perror_msg_and_fail("rmdir: %s", lockdir); } +} + +int +main(void) +{ + const pid_t pid = getpid(); + write_pidfile(pid); + + wait_for_peer_invocation(); static const char dir[] = "attach-p-cmd.test cmd"; - pid_t pid = getpid(); int rc = chdir(dir); printf("%-5d chdir(\"%s\") = %s\n" diff --git a/tests/attach-p-cmd-p.c b/tests/attach-p-cmd-p.c index 254d19ae..843db957 100644 --- a/tests/attach-p-cmd-p.c +++ b/tests/attach-p-cmd-p.c @@ -1,7 +1,7 @@ /* * This file is part of attach-p-cmd strace test. * - * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2017 Dmitry V. Levin <ldv@altlinux.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,27 +33,14 @@ #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> +#include <time.h> #include <unistd.h> +#include "attach-p-cmd.h" static void -handler(int signo) +wait_for_peer_invocation(void) { -} - -int -main(void) -{ - const struct sigaction act = { .sa_handler = handler }; - if (sigaction(SIGALRM, &act, NULL)) - perror_msg_and_fail("sigaction"); - - sigset_t mask = {}; - sigaddset(&mask, SIGALRM); - if (sigprocmask(SIG_UNBLOCK, &mask, NULL)) - perror_msg_and_fail("sigprocmask"); - - static const char lockdir[] = "attach-p-cmd.test-lock"; - /* create a lock directory */ + /* create the lock directory */ if (mkdir(lockdir, 0700)) perror_msg_and_fail("mkdir: %s", lockdir); @@ -63,21 +50,51 @@ main(void) perror_msg_and_fail("mkdir: %s", lockdir); } - /* remove the lock directory */ + /* cleanup the lock directory */ if (rmdir(lockdir)) perror_msg_and_fail("rmdir: %s", lockdir); +} + +static void +wait_for_peer_termination(void) +{ + FILE *fp = fopen(pidfile, "r"); + if (!fp) + perror_msg_and_fail("fopen: %s", pidfile); + + pid_t pid; + if (fscanf(fp, "%d", &pid) < 0) + perror_msg_and_fail("fscanf: %s", pidfile); + if (pid < 0) + error_msg_and_fail("pid = %d", pid); + + if (fclose(fp)) + perror_msg_and_fail("fclose: %s", pidfile); + + if (unlink(pidfile)) + perror_msg_and_fail("unlink: %s", pidfile); + + while (kill(pid, 0) == 0) + ; +} + +int +main(void) +{ + wait_for_peer_invocation(); + wait_for_peer_termination(); - alarm(1); - pause(); + static const struct timespec ts = { .tv_nsec = 123456789 }; + if (nanosleep(&ts, NULL)) + perror_msg_and_fail("nanosleep"); static const char dir[] = "attach-p-cmd.test -p"; pid_t pid = getpid(); int rc = chdir(dir); - printf("%-5d --- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---\n" - "%-5d chdir(\"%s\") = %d %s (%m)\n" + printf("%-5d chdir(\"%s\") = %s\n" "%-5d +++ exited with 0 +++\n", - pid, pid, dir, rc, errno2name(), pid); + pid, dir, sprintrc(rc), pid); return 0; } diff --git a/tests/attach-p-cmd.h b/tests/attach-p-cmd.h new file mode 100644 index 00000000..e04af38f --- /dev/null +++ b/tests/attach-p-cmd.h @@ -0,0 +1,2 @@ +static const char lockdir[] = "attach-p-cmd.test-lock"; +static const char pidfile[] = "attach-p-cmd.test-pid"; diff --git a/tests/bpf.c b/tests/bpf.c index bec30f87..3f963fa3 100644 --- a/tests/bpf.c +++ b/tests/bpf.c @@ -34,8 +34,11 @@ && (defined HAVE_UNION_BPF_ATTR_ATTACH_FLAGS \ || defined HAVE_UNION_BPF_ATTR_BPF_FD \ || defined HAVE_UNION_BPF_ATTR_FLAGS \ - || defined HAVE_UNION_BPF_ATTR_INNER_MAP_FD \ - || defined HAVE_UNION_BPF_ATTR_PROG_FLAGS) + || defined HAVE_UNION_BPF_ATTR_INFO_INFO \ + || defined HAVE_UNION_BPF_ATTR_NEXT_ID \ + || defined HAVE_UNION_BPF_ATTR_NUMA_NODE \ + || defined HAVE_UNION_BPF_ATTR_PROG_FLAGS \ + || defined HAVE_UNION_BPF_ATTR_TEST_DURATION) # include <stddef.h> # include <stdio.h> @@ -43,6 +46,7 @@ # include <string.h> # include <unistd.h> # include <linux/bpf.h> +# include "print_fields.h" static const kernel_ulong_t long_bits = (kernel_ulong_t) 0xfacefeed00000000ULL; static const char *errstr; @@ -183,18 +187,22 @@ sys_bpf(kernel_ulong_t cmd, kernel_ulong_t attr, kernel_ulong_t size) init_ ## cmd_ ## _attr, print_ ## cmd_ ## _attr) \ /* End of TEST_BPF definition. */ -# ifdef HAVE_UNION_BPF_ATTR_INNER_MAP_FD +#define DEF_BPF_INIT_FIRST(cmd_, field_, value_) \ + static unsigned int \ + init_ ## cmd_ ## _first(const unsigned long eop) \ + { \ + static const union bpf_attr attr = { .field_ = value_ };\ + static const unsigned int offset = sizeof(attr.field_); \ + const unsigned long addr = eop - offset; \ + \ + memcpy((void *) addr, &attr.field_, offset); \ + return offset; \ + } \ + /* End of DEF_INIT_FIRST definition. */ -static unsigned int -init_BPF_MAP_CREATE_first(const unsigned long eop) -{ - static const union bpf_attr attr = { .map_type = 2 }; - static const unsigned int offset = sizeof(attr.map_type); - const unsigned long addr = eop - offset; +# ifdef HAVE_UNION_BPF_ATTR_NUMA_NODE - memcpy((void *) addr, &attr.map_type, offset); - return offset; -} +DEF_BPF_INIT_FIRST(BPF_MAP_CREATE, map_type, 2) static void print_BPF_MAP_CREATE_first(const unsigned long addr) @@ -211,11 +219,12 @@ init_BPF_MAP_CREATE_attr(const unsigned long eop) .key_size = 4, .value_size = 8, .max_entries = 256, - .map_flags = 1, - .inner_map_fd = -1 + .map_flags = 7, + .inner_map_fd = -1, + .numa_node = 42 }; static const unsigned int offset = - offsetofend(union bpf_attr, inner_map_fd); + offsetofend(union bpf_attr, numa_node); const unsigned long addr = eop - offset; memcpy((void *) addr, &attr, offset); @@ -227,23 +236,15 @@ print_BPF_MAP_CREATE_attr(const unsigned long addr) { printf("map_type=BPF_MAP_TYPE_HASH, key_size=4" ", value_size=8, max_entries=256" - ", map_flags=BPF_F_NO_PREALLOC, inner_map_fd=-1"); + ", map_flags=BPF_F_NO_PREALLOC|BPF_F_NO_COMMON_LRU" + "|BPF_F_NUMA_NODE, inner_map_fd=-1, numa_node=42"); } -# endif /* HAVE_UNION_BPF_ATTR_INNER_MAP_FD */ +# endif /* HAVE_UNION_BPF_ATTR_NUMA_NODE */ # ifdef HAVE_UNION_BPF_ATTR_FLAGS -static unsigned int -init_BPF_MAP_LOOKUP_ELEM_first(const unsigned long eop) -{ - static const union bpf_attr attr = { .map_fd = -1 }; - static const unsigned int offset = sizeof(attr.map_fd); - const unsigned long addr = eop - offset; - - memcpy((void *) addr, &attr.map_fd, offset); - return offset; -} +DEF_BPF_INIT_FIRST(BPF_MAP_LOOKUP_ELEM, map_fd, -1) static void print_BPF_MAP_LOOKUP_ELEM_first(const unsigned long addr) @@ -367,16 +368,7 @@ print_BPF_MAP_GET_NEXT_KEY_attr(const unsigned long addr) # ifdef HAVE_UNION_BPF_ATTR_PROG_FLAGS -static unsigned int -init_BPF_PROG_LOAD_first(const unsigned long eop) -{ - static const union bpf_attr attr = { .prog_type = 1 }; - static const unsigned int offset = sizeof(attr.prog_type); - const unsigned long addr = eop - offset; - - memcpy((void *) addr, &attr.prog_type, offset); - return offset; -} +DEF_BPF_INIT_FIRST(BPF_PROG_LOAD, prog_type, 1) static void print_BPF_PROG_LOAD_first(const unsigned long addr) @@ -435,16 +427,7 @@ print_BPF_PROG_LOAD_attr(const unsigned long addr) */ # ifdef HAVE_UNION_BPF_ATTR_BPF_FD -static unsigned int -init_BPF_OBJ_PIN_first(const unsigned long eop) -{ - static const union bpf_attr attr = {}; - static const unsigned int offset = sizeof(attr.pathname); - const unsigned long addr = eop - offset; - - memcpy((void *) addr, &attr.pathname, offset); - return offset; -} +DEF_BPF_INIT_FIRST(BPF_OBJ_PIN, pathname, 0) static void print_BPF_OBJ_PIN_first(const unsigned long addr) @@ -484,16 +467,7 @@ print_BPF_OBJ_PIN_attr(const unsigned long addr) /* BPF_PROG_ATTACH and BPF_PROG_DETACH commands appear in kernel 4.10. */ # ifdef HAVE_UNION_BPF_ATTR_ATTACH_FLAGS -static unsigned int -init_BPF_PROG_ATTACH_first(const unsigned long eop) -{ - static const union bpf_attr attr = { .target_fd = -1 }; - static const unsigned int offset = sizeof(attr.target_fd); - const unsigned long addr = eop - offset; - - memcpy((void *) addr, &attr.target_fd, offset); - return offset; -} +DEF_BPF_INIT_FIRST(BPF_PROG_ATTACH, target_fd, -1) static void print_BPF_PROG_ATTACH_first(const unsigned long addr) @@ -559,13 +533,171 @@ print_BPF_PROG_DETACH_attr(const unsigned long addr) # endif /* HAVE_UNION_BPF_ATTR_ATTACH_FLAGS */ +/* BPF_PROG_TEST_RUN command appears in kernel 4.12. */ +# ifdef HAVE_UNION_BPF_ATTR_TEST_DURATION + +DEF_BPF_INIT_FIRST(BPF_PROG_TEST_RUN, test.prog_fd, -1) + +static void +print_BPF_PROG_TEST_RUN_first(const unsigned long addr) +{ + printf("test={prog_fd=-1, retval=0, data_size_in=0, data_size_out=0" + ", data_in=0, data_out=0, repeat=0, duration=0}"); +} + +static const union bpf_attr sample_BPF_PROG_TEST_RUN_attr = { + .test = { + .prog_fd = -1, + .retval = 0xfac1fed2, + .data_size_in = 0xfac3fed4, + .data_size_out = 0xfac5fed6, + .data_in = (uint64_t) 0xfacef11dbadc2ded, + .data_out = (uint64_t) 0xfacef33dbadc4ded, + .repeat = 0xfac7fed8, + .duration = 0xfac9feda + } +}; +static unsigned int +init_BPF_PROG_TEST_RUN_attr(const unsigned long eop) +{ + static const unsigned int offset = + offsetofend(union bpf_attr, test); + const unsigned long addr = eop - offset; + + memcpy((void *) addr, &sample_BPF_PROG_TEST_RUN_attr, offset); + return offset; +} + +static void +print_BPF_PROG_TEST_RUN_attr(const unsigned long addr) +{ + PRINT_FIELD_D("test={", sample_BPF_PROG_TEST_RUN_attr.test, prog_fd); + PRINT_FIELD_U(", ", sample_BPF_PROG_TEST_RUN_attr.test, retval); + PRINT_FIELD_U(", ", sample_BPF_PROG_TEST_RUN_attr.test, data_size_in); + PRINT_FIELD_U(", ", sample_BPF_PROG_TEST_RUN_attr.test, data_size_out); + PRINT_FIELD_X(", ", sample_BPF_PROG_TEST_RUN_attr.test, data_in); + PRINT_FIELD_X(", ", sample_BPF_PROG_TEST_RUN_attr.test, data_out); + PRINT_FIELD_U(", ", sample_BPF_PROG_TEST_RUN_attr.test, repeat); + PRINT_FIELD_U(", ", sample_BPF_PROG_TEST_RUN_attr.test, duration); + printf("}"); +} + +# endif /* HAVE_UNION_BPF_ATTR_TEST_DURATION */ + +# ifdef HAVE_UNION_BPF_ATTR_NEXT_ID + +DEF_BPF_INIT_FIRST(BPF_PROG_GET_NEXT_ID, start_id, 0xdeadbeef) + +static void +print_BPF_PROG_GET_NEXT_ID_first(const unsigned long addr) +{ + printf("start_id=%u, next_id=0", 0xdeadbeef); +} + +static unsigned int +init_BPF_PROG_GET_NEXT_ID_attr(const unsigned long eop) +{ + static const union bpf_attr attr = { + .start_id = 0xbadc0ded, + .next_id = 0xcafef00d + }; + static const unsigned int offset = + offsetofend(union bpf_attr, next_id); + const unsigned long addr = eop - offset; + + memcpy((void *) addr, &attr, offset); + return offset; +} + +static void +print_BPF_PROG_GET_NEXT_ID_attr(const unsigned long addr) +{ + printf("start_id=%u, next_id=%u", 0xbadc0ded, 0xcafef00d); +} + +# define init_BPF_MAP_GET_NEXT_ID_first init_BPF_PROG_GET_NEXT_ID_first +# define print_BPF_MAP_GET_NEXT_ID_first print_BPF_PROG_GET_NEXT_ID_first +# define init_BPF_MAP_GET_NEXT_ID_attr init_BPF_PROG_GET_NEXT_ID_attr +# define print_BPF_MAP_GET_NEXT_ID_attr print_BPF_PROG_GET_NEXT_ID_attr + +# define init_BPF_PROG_GET_FD_BY_ID_first init_BPF_PROG_GET_NEXT_ID_first +# define init_BPF_PROG_GET_FD_BY_ID_attr init_BPF_PROG_GET_NEXT_ID_attr + +static void +print_BPF_PROG_GET_FD_BY_ID_first(const unsigned long addr) +{ + printf("prog_id=%u, next_id=0", 0xdeadbeef); +} + +static void +print_BPF_PROG_GET_FD_BY_ID_attr(const unsigned long addr) +{ + printf("prog_id=%u, next_id=%u", 0xbadc0ded, 0xcafef00d); +} + +# define init_BPF_MAP_GET_FD_BY_ID_first init_BPF_PROG_GET_NEXT_ID_first +# define init_BPF_MAP_GET_FD_BY_ID_attr init_BPF_PROG_GET_NEXT_ID_attr + +static void +print_BPF_MAP_GET_FD_BY_ID_first(const unsigned long addr) +{ + printf("map_id=%u, next_id=0", 0xdeadbeef); +} + +static void +print_BPF_MAP_GET_FD_BY_ID_attr(const unsigned long addr) +{ + printf("map_id=%u, next_id=%u", 0xbadc0ded, 0xcafef00d); +} + +# endif /* HAVE_UNION_BPF_ATTR_NEXT_ID */ + +# ifdef HAVE_UNION_BPF_ATTR_INFO_INFO + +DEF_BPF_INIT_FIRST(BPF_OBJ_GET_INFO_BY_FD, info.bpf_fd, -1) + +static void +print_BPF_OBJ_GET_INFO_BY_FD_first(const unsigned long addr) +{ + printf("info={bpf_fd=-1, info_len=0, info=0}"); +} + +static const union bpf_attr sample_BPF_OBJ_GET_INFO_BY_FD_attr = { + .info = { + .bpf_fd = -1, + .info_len = 0xdeadbeef, + .info = (uint64_t) 0xfacefeedbadc0ded + } +}; +static unsigned int +init_BPF_OBJ_GET_INFO_BY_FD_attr(const unsigned long eop) +{ + static const unsigned int offset = + offsetofend(union bpf_attr, info); + const unsigned long addr = eop - offset; + + memcpy((void *) addr, &sample_BPF_OBJ_GET_INFO_BY_FD_attr, offset); + return offset; +} + +static void +print_BPF_OBJ_GET_INFO_BY_FD_attr(const unsigned long addr) +{ + PRINT_FIELD_D("info={", sample_BPF_OBJ_GET_INFO_BY_FD_attr.info, bpf_fd); + PRINT_FIELD_U(", ", sample_BPF_OBJ_GET_INFO_BY_FD_attr.info, info_len); + PRINT_FIELD_X(", ", sample_BPF_OBJ_GET_INFO_BY_FD_attr.info, info); + printf("}"); +} + +# endif /* HAVE_UNION_BPF_ATTR_INFO_INFO */ + int main(void) { page_size = get_page_size(); end_of_page = (unsigned long) tail_alloc(1) + 1; -# ifdef HAVE_UNION_BPF_ATTR_INNER_MAP_FD +# ifdef HAVE_UNION_BPF_ATTR_NUMA_NODE TEST_BPF(BPF_MAP_CREATE); # endif @@ -590,6 +722,21 @@ main(void) TEST_BPF(BPF_PROG_DETACH); # endif +# ifdef HAVE_UNION_BPF_ATTR_TEST_DURATION + TEST_BPF(BPF_PROG_TEST_RUN); +# endif + +# ifdef HAVE_UNION_BPF_ATTR_NEXT_ID + TEST_BPF(BPF_PROG_GET_NEXT_ID); + TEST_BPF(BPF_MAP_GET_NEXT_ID); + TEST_BPF(BPF_PROG_GET_FD_BY_ID); + TEST_BPF(BPF_MAP_GET_FD_BY_ID); +# endif + +# ifdef HAVE_UNION_BPF_ATTR_INFO_INFO + TEST_BPF(BPF_OBJ_GET_INFO_BY_FD); +# endif + sys_bpf(0xfacefeed, end_of_page, 40); printf("bpf(0xfacefeed /* BPF_??? */, %#lx, 40) = %s\n", end_of_page, errstr); diff --git a/tests/bpf.gen.test b/tests/bpf.gen.test index 7ee9e7f3..1391d6b8 100755 --- a/tests/bpf.gen.test +++ b/tests/bpf.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (bpf -a20); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (bpf -a20 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a20 +run_strace_match_diff -a20 diff --git a/tests/btrfs.gen.test b/tests/btrfs.gen.test index a7118efa..3976cf5d 100755 --- a/tests/btrfs.gen.test +++ b/tests/btrfs.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (btrfs +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (btrfs +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests/chmod.gen.test b/tests/chmod.gen.test index 438665ad..40330885 100755 --- a/tests/chmod.gen.test +++ b/tests/chmod.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (chmod -a28); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (chmod -a28 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a28 +run_strace_match_diff -a28 diff --git a/tests/chown.gen.test b/tests/chown.gen.test index 46889a13..87cc0f02 100755 --- a/tests/chown.gen.test +++ b/tests/chown.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (chown -a28); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (chown -a28 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a28 +run_strace_match_diff -a28 diff --git a/tests/chown32.gen.test b/tests/chown32.gen.test index f0f603e3..8d9d8916 100755 --- a/tests/chown32.gen.test +++ b/tests/chown32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (chown32 -a31); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (chown32 -a31 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a31 +run_strace_match_diff -a31 diff --git a/tests/chroot.gen.test b/tests/chroot.gen.test index 6ea81dd2..40eb55ba 100755 --- a/tests/chroot.gen.test +++ b/tests/chroot.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (chroot -a24); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (chroot -a24 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a24 +run_strace_match_diff -a24 diff --git a/tests/clock_adjtime.gen.test b/tests/clock_adjtime.gen.test index 735e3af5..22d5dbcd 100755 --- a/tests/clock_adjtime.gen.test +++ b/tests/clock_adjtime.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (clock_adjtime -a37); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (clock_adjtime -a37 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a37 +run_strace_match_diff -a37 diff --git a/tests/copy_file_range.gen.test b/tests/copy_file_range.gen.test index 4f3063ba..e90c6c18 100755 --- a/tests/copy_file_range.gen.test +++ b/tests/copy_file_range.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (copy_file_range ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (copy_file_range ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/creat.gen.test b/tests/creat.gen.test index d2e47d31..baff9169 100755 --- a/tests/creat.gen.test +++ b/tests/creat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (creat -a20); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (creat -a20 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a20 +run_strace_match_diff -a20 diff --git a/tests/delete_module.gen.test b/tests/delete_module.gen.test index 4e4c6712..028515ff 100755 --- a/tests/delete_module.gen.test +++ b/tests/delete_module.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (delete_module -a23); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (delete_module -a23 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a23 +run_strace_match_diff -a23 diff --git a/tests/dup.gen.test b/tests/dup.gen.test index e5729c0f..e559cdbc 100755 --- a/tests/dup.gen.test +++ b/tests/dup.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (dup -a8); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (dup -a8 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a8 +run_strace_match_diff -a8 diff --git a/tests/dup2.gen.test b/tests/dup2.gen.test index fd1f5c97..6a6d2f58 100755 --- a/tests/dup2.gen.test +++ b/tests/dup2.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (dup2 -a13); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (dup2 -a13 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a13 +run_strace_match_diff -a13 diff --git a/tests/dup3.gen.test b/tests/dup3.gen.test index d6ff7d7a..776b9a79 100755 --- a/tests/dup3.gen.test +++ b/tests/dup3.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (dup3 -a24); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (dup3 -a24 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a24 +run_strace_match_diff -a24 diff --git a/tests/epoll_create.gen.test b/tests/epoll_create.gen.test index 841da6d0..277a5aab 100755 --- a/tests/epoll_create.gen.test +++ b/tests/epoll_create.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_create -a17); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_create -a17 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a17 +run_strace_match_diff -a17 diff --git a/tests/epoll_create1.gen.test b/tests/epoll_create1.gen.test index c5e62a06..c510c322 100755 --- a/tests/epoll_create1.gen.test +++ b/tests/epoll_create1.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_create1 -a28); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_create1 -a28 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a28 +run_strace_match_diff -a28 diff --git a/tests/epoll_ctl.gen.test b/tests/epoll_ctl.gen.test index 68c96eb8..dba65f7d 100755 --- a/tests/epoll_ctl.gen.test +++ b/tests/epoll_ctl.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_ctl ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_ctl ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/epoll_pwait.gen.test b/tests/epoll_pwait.gen.test index c558efc4..f98e2b55 100755 --- a/tests/epoll_pwait.gen.test +++ b/tests/epoll_pwait.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_pwait ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_pwait ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/epoll_wait.gen.test b/tests/epoll_wait.gen.test index 024cc0fd..d90fbeb9 100755 --- a/tests/epoll_wait.gen.test +++ b/tests/epoll_wait.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_wait -a26); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (epoll_wait -a26 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a26 +run_strace_match_diff -a26 diff --git a/tests/error_msg.c b/tests/error_msg.c index 498a8821..9cb3e80c 100644 --- a/tests/error_msg.c +++ b/tests/error_msg.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -25,6 +26,9 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#define perror_msg_and_fail perror_msg_and_fail +#define error_msg_and_fail error_msg_and_fail + #include "tests.h" #include <errno.h> #include <stdarg.h> diff --git a/tests/execveat.gen.test b/tests/execveat.gen.test index c92e4d65..180b8299 100755 --- a/tests/execveat.gen.test +++ b/tests/execveat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (execveat ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (execveat ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/fadvise64_64.gen.test b/tests/fadvise64_64.gen.test index 5f95b3c2..e46bf810 100755 --- a/tests/fadvise64_64.gen.test +++ b/tests/fadvise64_64.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fadvise64_64 +fadvise64.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fadvise64_64 +fadvise64.test ); do not edit. +set -- . "${srcdir=.}/fadvise64.test" diff --git a/tests/fallocate.gen.test b/tests/fallocate.gen.test index c6cfdb79..3bb5bbf0 100755 --- a/tests/fallocate.gen.test +++ b/tests/fallocate.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fallocate -a18); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fallocate -a18 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a18 +run_strace_match_diff -a18 diff --git a/tests/fanotify_init.gen.test b/tests/fanotify_init.gen.test index ee519e66..69807a7a 100755 --- a/tests/fanotify_init.gen.test +++ b/tests/fanotify_init.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fanotify_init ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fanotify_init ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/fanotify_mark.gen.test b/tests/fanotify_mark.gen.test index ce16a551..46512608 100755 --- a/tests/fanotify_mark.gen.test +++ b/tests/fanotify_mark.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fanotify_mark -a32); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fanotify_mark -a32 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a32 +run_strace_match_diff -a32 diff --git a/tests/fchdir.gen.test b/tests/fchdir.gen.test index c80e141f..a352a21b 100755 --- a/tests/fchdir.gen.test +++ b/tests/fchdir.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchdir -a11); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchdir -a11 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a11 +run_strace_match_diff -a11 diff --git a/tests/fchmod.gen.test b/tests/fchmod.gen.test index f327fb7a..828c9b50 100755 --- a/tests/fchmod.gen.test +++ b/tests/fchmod.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchmod -a15); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchmod -a15 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a15 +run_strace_match_diff -a15 diff --git a/tests/fchmodat.gen.test b/tests/fchmodat.gen.test index 9ee1f013..36461858 100755 --- a/tests/fchmodat.gen.test +++ b/tests/fchmodat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchmodat ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchmodat ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/fchown.gen.test b/tests/fchown.gen.test index 63ee5454..ec7f7c54 100755 --- a/tests/fchown.gen.test +++ b/tests/fchown.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchown -a16); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchown -a16 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a16 +run_strace_match_diff -a16 diff --git a/tests/fchown32.gen.test b/tests/fchown32.gen.test index d8167dd4..16705832 100755 --- a/tests/fchown32.gen.test +++ b/tests/fchown32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchown32 -a18); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchown32 -a18 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a18 +run_strace_match_diff -a18 diff --git a/tests/fchownat.gen.test b/tests/fchownat.gen.test index 2ec9e32c..54bd0430 100755 --- a/tests/fchownat.gen.test +++ b/tests/fchownat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchownat ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fchownat ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/fcntl.gen.test b/tests/fcntl.gen.test index 83a1af48..9de26c00 100755 --- a/tests/fcntl.gen.test +++ b/tests/fcntl.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fcntl -a8); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fcntl -a8 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a8 +run_strace_match_diff -a8 diff --git a/tests/fcntl64.gen.test b/tests/fcntl64.gen.test index 9d3b98ad..fee01b66 100755 --- a/tests/fcntl64.gen.test +++ b/tests/fcntl64.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fcntl64 -a8); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fcntl64 -a8 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a8 +run_strace_match_diff -a8 diff --git a/tests/fdatasync.gen.test b/tests/fdatasync.gen.test index 0dbea8ad..9aa5f2a6 100755 --- a/tests/fdatasync.gen.test +++ b/tests/fdatasync.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fdatasync -a14); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fdatasync -a14 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a14 +run_strace_match_diff -a14 diff --git a/tests/file_ioctl.gen.test b/tests/file_ioctl.gen.test index f7e58f59..0abab81a 100755 --- a/tests/file_ioctl.gen.test +++ b/tests/file_ioctl.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (file_ioctl +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (file_ioctl +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests/filtering_fd-syntax.test b/tests/filtering_fd-syntax.test new file mode 100755 index 00000000..4f4e9c73 --- /dev/null +++ b/tests/filtering_fd-syntax.test @@ -0,0 +1,60 @@ +#!/bin/sh +# +# Check descriptor set parsing syntax. +# +# Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> +# Copyright (c) 2016-2018 The strace developers. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +. "${srcdir=.}/syntax.sh" + +check_fd_qualify() +{ + check_e "invalid descriptor '$1'" -e"read=$2" + check_e "invalid descriptor '$1'" -e "read=$2" + check_e "invalid descriptor '$1'" -e"write=$2" + check_e "invalid descriptor '$1'" -e "write=$2" +} + +for arg in '' , ,, ,,, ; do + check_fd_qualify "$arg" "$arg" + check_fd_qualify "!$arg" "!$arg" +done + +for arg in -1 -42 \ + not_fd \ + 2147483648 \ + 4294967296 \ + ; do + check_fd_qualify "$arg" "$arg" + check_fd_qualify "$arg" "1,$arg" + check_fd_qualify "$arg" "$arg,1" + check_fd_qualify "$arg" "!$arg" +done + +for arg in ! all none; do + check_fd_qualify "$arg" "1,$arg" + check_fd_qualify "!$arg" "1,!$arg" +done diff --git a/tests/filtering_syscall-syntax.test b/tests/filtering_syscall-syntax.test new file mode 100755 index 00000000..8fda8dc2 --- /dev/null +++ b/tests/filtering_syscall-syntax.test @@ -0,0 +1,121 @@ +#!/bin/sh +# +# Check syscall set parsing syntax. +# +# Copyright (c) 2016-2018 Dmitry V. Levin <ldv@altlinux.org> +# Copyright (c) 2017 Nikolay Marchuk <marchuk.nikolay.a@gmail.com> +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +. "${srcdir=.}/syntax.sh" + +check_syscall() +{ + [ -z "$2" ] || check_e "invalid system call '$1'" -e"$2" + + check_e "invalid system call '$1'" -e "$2" + check_e "invalid system call '$1'" -etrace="$2" + check_e "invalid system call '$1'" -e trace="$2" + + check_e "invalid system call '$1'" -eabbrev="$2" + check_e "invalid system call '$1'" -e abbrev="$2" + + check_e "invalid system call '$1'" -everbose="$2" + check_e "invalid system call '$1'" -e verbose="$2" + + check_e "invalid system call '$1'" -eraw="$2" + check_e "invalid system call '$1'" -e raw="$2" + + check_e "invalid system call '$1'" -einject="$2" + check_e "invalid system call '$1'" -e inject="$2" + check_e "invalid system call '$1'" -einject="$2:" + check_e "invalid system call '$1'" -einject="$2::" + check_e "invalid system call '$1'" -einject="$2:::" + check_e "invalid system call '$1'" -e inject="$2:" + check_e "invalid system call '$1'" -e inject="$2::" + check_e "invalid system call '$1'" -e inject="$2:::" + check_e "invalid system call '$1'" -einject="$2:when=3" + check_e "invalid system call '$1'" -e inject="$2:when=3" + + check_e "invalid system call '$1'" -efault="$2" + check_e "invalid system call '$1'" -e fault="$2" + check_e "invalid system call '$1'" -efault="$2:" + check_e "invalid system call '$1'" -efault="$2::" + check_e "invalid system call '$1'" -efault="$2:::" + check_e "invalid system call '$1'" -e fault="$2:" + check_e "invalid system call '$1'" -e fault="$2::" + check_e "invalid system call '$1'" -e fault="$2:::" + check_e "invalid system call '$1'" -efault="$2:when=4" + check_e "invalid system call '$1'" -e fault="$2:when=4" +} + +for arg in '' , ,, ,,, ; do + check_syscall "$arg" "$arg" + check_syscall "!$arg" "!$arg" +done + +for arg in -1 -2 -3 -4 -5 \ + invalid_syscall_name \ + 0x 0y \ + 32767 \ + 2147483647 \ + 2147483648 \ + 4294967295 \ + 4294967296 \ + /non_syscall \ + % %not_a_class \ + ; do + check_syscall "$arg" "$arg" + check_syscall "$arg" "!$arg" + check_syscall "$arg" "1,$arg" +done + +for arg in '!chdir' none all; do + check_syscall "$arg" "1,$arg" +done + +# invalid syscall, multiple syscalls +for arg in %desc \ + %file \ + %memory \ + %process \ + %network \ + chdir \ + 1 \ + ?32767 \ + ?invalid \ + ?%not_a_class \ + ?/non_syscall \ + ; do + check_syscall nonsense "$arg,nonsense" + check_syscall nonsense "!$arg,nonsense" + check_syscall nonsense "nonsense,$arg" + check_syscall nonsense "!nonsense,$arg" +done + +check_e_using_grep 'regcomp: \+id: [[:alpha:]].+' -e trace='/+id' +check_e_using_grep 'regcomp: \*id: [[:alpha:]].+' -e trace='/*id' +check_e_using_grep 'regcomp: \{id: [[:alpha:]].+' -e trace='/{id' +check_e_using_grep 'regcomp: \(id: [[:alpha:]].+' -e trace='/(id' +check_e_using_grep 'regcomp: \[id: [[:alpha:]].+' -e trace='/[id' diff --git a/tests/finit_module.gen.test b/tests/finit_module.gen.test index f2e56afc..5ffafd32 100755 --- a/tests/finit_module.gen.test +++ b/tests/finit_module.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (finit_module -a25); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (finit_module -a25 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a25 +run_strace_match_diff -a25 diff --git a/tests/flock.gen.test b/tests/flock.gen.test index dff2bac4..67a9d8c6 100755 --- a/tests/flock.gen.test +++ b/tests/flock.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (flock -a19); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (flock -a19 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a19 +run_strace_match_diff -a19 diff --git a/tests/fstatfs.gen.test b/tests/fstatfs.gen.test index 3dd04d8b..27deaf34 100755 --- a/tests/fstatfs.gen.test +++ b/tests/fstatfs.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fstatfs -a18); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fstatfs -a18 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a18 +run_strace_match_diff -a18 diff --git a/tests/fstatfs64.gen.test b/tests/fstatfs64.gen.test index b9527beb..d6937269 100755 --- a/tests/fstatfs64.gen.test +++ b/tests/fstatfs64.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fstatfs64 -a24); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fstatfs64 -a24 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a24 +run_strace_match_diff -a24 diff --git a/tests/fsync.gen.test b/tests/fsync.gen.test index 921e804c..5e72cc25 100755 --- a/tests/fsync.gen.test +++ b/tests/fsync.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fsync -a10); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (fsync -a10 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a10 +run_strace_match_diff -a10 diff --git a/tests/ftruncate.gen.test b/tests/ftruncate.gen.test index 709a8511..6e5926b2 100755 --- a/tests/ftruncate.gen.test +++ b/tests/ftruncate.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ftruncate -a24); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ftruncate -a24 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a24 +run_strace_match_diff -a24 diff --git a/tests/ftruncate64.gen.test b/tests/ftruncate64.gen.test index 4cb1fe7a..d910f617 100755 --- a/tests/ftruncate64.gen.test +++ b/tests/ftruncate64.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ftruncate64 -a36); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ftruncate64 -a36 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a36 +run_strace_match_diff -a36 diff --git a/tests/futex.c b/tests/futex.c index e1dbcb74..0c095b8f 100644 --- a/tests/futex.c +++ b/tests/futex.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -57,10 +57,11 @@ # include "xlat/futexwakecmps.h" void futex_error(int *uaddr, int op, unsigned long val, unsigned long timeout, - int *uaddr2, unsigned long val3, int rc) + int *uaddr2, unsigned long val3, int rc, const char *func, int line) { - perror_msg_and_fail("futex(%p, %#x, %#x, %#lx, %p, %#x) = %d", - uaddr, op, (unsigned) val, timeout, uaddr, (unsigned) val3, rc); + perror_msg_and_fail("%s:%d: futex(%p, %#x, %#x, %#lx, %p, %#x) = %d", + func, line, uaddr, op, (unsigned) val, timeout, uaddr, + (unsigned) val3, rc); } # define CHECK_FUTEX_GENERIC(uaddr, op, val, timeout, uaddr2, val3, check, \ @@ -77,7 +78,7 @@ void futex_error(int *uaddr, int op, unsigned long val, unsigned long timeout, if (!(check)) \ futex_error((uaddr), (op), (val), \ (unsigned long) (timeout), (int *) (uaddr2), \ - (val3), rc); \ + (val3), rc, __func__, __LINE__); \ } while (0) # define CHECK_FUTEX_ENOSYS(uaddr, op, val, timeout, uaddr2, val3, check) \ @@ -151,14 +152,20 @@ void invalid_op(int *val, int op, uint32_t argmask, ...) } while (0) /* Value which differs from one stored in int *val */ -# define VAL ((unsigned long) 0xbadda7a0facefeedLLU) -# define VAL_PR ((unsigned) VAL) +# define VAL ((unsigned long) 0xbadda7a0facefeedLLU) +# define VAL_PR ((unsigned) VAL) -# define VAL2 ((unsigned long) 0xbadda7a0ca7b100dLLU) -# define VAL2_PR ((unsigned) VAL2) +# define VALP ((unsigned long) 0xbadda7a01acefeedLLU) +# define VALP_PR ((unsigned) VALP) -# define VAL3 ((unsigned long) 0xbadda7a09caffee1LLU) -# define VAL3_PR ((unsigned) VAL3) +# define VAL2 ((unsigned long) 0xbadda7a0ca7b100dLLU) +# define VAL2_PR ((unsigned) VAL2) + +# define VAL2P ((unsigned long) 0xbadda7a07a7b100dLLU) +# define VAL2P_PR ((unsigned) VAL2P) + +# define VAL3 ((unsigned long) 0xbadda7a09caffee1LLU) +# define VAL3_PR ((unsigned) VAL3) int main(int argc, char *argv[]) @@ -418,16 +425,26 @@ main(int argc, char *argv[]) /* Trying to re-queue some processes but there's nothing to re-queue */ CHECK_FUTEX(uaddr, FUTEX_REQUEUE, VAL, VAL2, uaddr2, VAL3, - (rc == 0)); + (rc == 0) || ((rc == -1) && (errno == EINVAL))); printf("futex(%p, FUTEX_REQUEUE, %u, %u, %p) = %s\n", uaddr, VAL_PR, VAL2_PR, uaddr2, sprintrc(rc)); + CHECK_FUTEX(uaddr, FUTEX_REQUEUE, VALP, VAL2P, uaddr2, VAL3, + (rc == 0)); + printf("futex(%p, FUTEX_REQUEUE, %u, %u, %p) = %s\n", + uaddr, VALP_PR, VAL2P_PR, uaddr2, sprintrc(rc)); + /* Trying to re-queue some processes but there's nothing to re-queue */ CHECK_FUTEX_ENOSYS(uaddr, FUTEX_PRIVATE_FLAG | FUTEX_REQUEUE, VAL, VAL2, - uaddr2, VAL3, (rc == 0)); + uaddr2, VAL3, (rc == 0) || ((rc == -1) && (errno == EINVAL))); printf("futex(%p, FUTEX_REQUEUE_PRIVATE, %u, %u, %p) = %s\n", uaddr, VAL_PR, VAL2_PR, uaddr2, sprintrc(rc)); + CHECK_FUTEX_ENOSYS(uaddr, FUTEX_PRIVATE_FLAG | FUTEX_REQUEUE, VALP, + VAL2P, uaddr2, VAL3, (rc == 0)); + printf("futex(%p, FUTEX_REQUEUE_PRIVATE, %u, %u, %p) = %s\n", + uaddr, VALP_PR, VAL2P_PR, uaddr2, sprintrc(rc)); + CHECK_INVALID_CLOCKRT(FUTEX_REQUEUE, ARG3 | ARG4 | ARG5, "%u", "%u", "%#lx"); @@ -444,22 +461,38 @@ main(int argc, char *argv[]) /* Comparison re-queue with wrong val value */ CHECK_FUTEX(uaddr, FUTEX_CMP_REQUEUE, VAL, VAL2, uaddr2, VAL3, - (rc == -1) && (errno == EAGAIN)); + (rc == -1) && (errno == EAGAIN || errno == EINVAL)); printf("futex(%p, FUTEX_CMP_REQUEUE, %u, %u, %p, %u) = %s\n", uaddr, VAL_PR, VAL2_PR, uaddr2, VAL3_PR, sprintrc(rc)); + CHECK_FUTEX(uaddr, FUTEX_CMP_REQUEUE, VALP, VAL2P, uaddr2, VAL3, + (rc == -1) && (errno == EAGAIN)); + printf("futex(%p, FUTEX_CMP_REQUEUE, %u, %u, %p, %u) = %s\n", + uaddr, VALP_PR, VAL2P_PR, uaddr2, VAL3_PR, sprintrc(rc)); + /* Successful comparison re-queue */ CHECK_FUTEX(uaddr, FUTEX_CMP_REQUEUE, VAL, VAL2, uaddr2, *uaddr, - (rc == 0)); + (rc == 0) || ((rc == -1) && (errno == EINVAL))); printf("futex(%p, FUTEX_CMP_REQUEUE, %u, %u, %p, %u) = %s\n", uaddr, VAL_PR, VAL2_PR, uaddr2, *uaddr, sprintrc(rc)); + CHECK_FUTEX(uaddr, FUTEX_CMP_REQUEUE, VALP, VAL2P, uaddr2, *uaddr, + (rc == 0)); + printf("futex(%p, FUTEX_CMP_REQUEUE, %u, %u, %p, %u) = %s\n", + uaddr, VALP_PR, VAL2P_PR, uaddr2, *uaddr, sprintrc(rc)); + /* Successful comparison re-queue */ CHECK_FUTEX_ENOSYS(uaddr, FUTEX_PRIVATE_FLAG | FUTEX_CMP_REQUEUE, VAL, - VAL2, uaddr2, *uaddr, (rc == 0)); + VAL2, uaddr2, *uaddr, + (rc == 0) || ((rc == -1) && (errno == EINVAL))); printf("futex(%p, FUTEX_CMP_REQUEUE_PRIVATE, %u, %u, %p, %u) = %s\n", uaddr, VAL_PR, VAL2_PR, uaddr2, *uaddr, sprintrc(rc)); + CHECK_FUTEX_ENOSYS(uaddr, FUTEX_PRIVATE_FLAG | FUTEX_CMP_REQUEUE, VALP, + VAL2P, uaddr2, *uaddr, (rc == 0)); + printf("futex(%p, FUTEX_CMP_REQUEUE_PRIVATE, %u, %u, %p, %u) = %s\n", + uaddr, VALP_PR, VAL2P_PR, uaddr2, *uaddr, sprintrc(rc)); + CHECK_INVALID_CLOCKRT(FUTEX_CMP_REQUEUE, ARG3 | ARG4 | ARG5 | ARG6, "%u", "%u", "%#lx", "%u"); diff --git a/tests/futimesat.gen.test b/tests/futimesat.gen.test index c3add8c3..80d7a8bc 100755 --- a/tests/futimesat.gen.test +++ b/tests/futimesat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (futimesat -a28); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (futimesat -a28 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a28 +run_strace_match_diff -a28 diff --git a/tests/gen_tests.am b/tests/gen_tests.am index 71e00135..29d8c643 100644 --- a/tests/gen_tests.am +++ b/tests/gen_tests.am @@ -1,9 +1,12 @@ # Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in; do not edit. -GEN_TESTS = _newselect.gen.test accept.gen.test accept4.gen.test access.gen.test acct.gen.test add_key.gen.test adjtimex.gen.test aio.gen.test alarm.gen.test bpf.gen.test bpf-v.gen.test btrfs.gen.test chmod.gen.test chown.gen.test chown32.gen.test chroot.gen.test clock.gen.test clock_adjtime.gen.test clock_nanosleep.gen.test clock_xettime.gen.test copy_file_range.gen.test creat.gen.test delete_module.gen.test dup.gen.test dup2.gen.test dup3.gen.test epoll_create.gen.test epoll_create1.gen.test epoll_ctl.gen.test epoll_pwait.gen.test epoll_wait.gen.test erestartsys.gen.test execveat.gen.test execveat-v.gen.test faccessat.gen.test fadvise64_64.gen.test fallocate.gen.test fanotify_init.gen.test fanotify_mark.gen.test fchdir.gen.test fchmod.gen.test fchmodat.gen.test fchown.gen.test fchown32.gen.test fchownat.gen.test fcntl.gen.test fcntl64.gen.test fdatasync.gen.test file_handle.gen.test file_ioctl.gen.test finit_module.gen.test flock.gen.test fork-f.gen.test fstat.gen.test fstat64.gen.test fstatat64.gen.test fstatfs.gen.test fstatfs64.gen.test fsync.gen.test ftruncate.gen.test ftruncate64.gen.test futimesat.gen.test get_mempolicy.gen.test getcpu.gen.test getcwd.gen.test getdents.gen.test getdents64.gen.test getegid.gen.test getegid32.gen.test geteuid.gen.test geteuid32.gen.test getgid.gen.test getgid32.gen.test getgroups.gen.test getgroups32.gen.test getpeername.gen.test getpgrp.gen.test getpid.gen.test getppid.gen.test getrandom.gen.test getresgid.gen.test getresgid32.gen.test getresuid.gen.test getresuid32.gen.test getrlimit.gen.test getrusage.gen.test getsid.gen.test getsockname.gen.test gettid.gen.test getuid32.gen.test getxxid.gen.test group_req.gen.test inet-cmsg.gen.test init_module.gen.test inotify.gen.test inotify_init1.gen.test int_0x80.gen.test ioctl_block.gen.test ioctl_evdev.gen.test ioctl_evdev-v.gen.test ioctl_loop.gen.test ioctl_loop-v.gen.test ioctl_mtd.gen.test ioctl_rtc.gen.test ioctl_rtc-v.gen.test ioctl_scsi.gen.test ioctl_sg_io_v3.gen.test ioctl_sg_io_v4.gen.test ioctl_uffdio.gen.test ioctl_v4l2.gen.test ioperm.gen.test iopl.gen.test ioprio.gen.test ip_mreq.gen.test ipc.gen.test ipc_msg.gen.test ipc_sem.gen.test ipc_shm.gen.test kcmp.gen.test kcmp-y.gen.test kexec_file_load.gen.test kexec_load.gen.test keyctl.gen.test kill.gen.test lchown.gen.test lchown32.gen.test link.gen.test linkat.gen.test lookup_dcookie.gen.test lstat.gen.test lstat64.gen.test madvise.gen.test mbind.gen.test membarrier.gen.test memfd_create.gen.test migrate_pages.gen.test mincore.gen.test mkdir.gen.test mkdirat.gen.test mknod.gen.test mknodat.gen.test mlock.gen.test mlock2.gen.test mlockall.gen.test mmap64.gen.test mmsg.gen.test mmsg-silent.gen.test mmsg_name.gen.test mmsg_name-v.gen.test mount.gen.test move_pages.gen.test mq.gen.test mq_sendrecv.gen.test mq_sendrecv-read.gen.test mq_sendrecv-write.gen.test msg_control.gen.test msg_control-v.gen.test msg_name.gen.test munlockall.gen.test nanosleep.gen.test net-icmp_filter.gen.test net-sockaddr.gen.test netlink_audit.gen.test netlink_crypto.gen.test netlink_generic.gen.test netlink_kobject_uevent.gen.test netlink_netfilter.gen.test netlink_protocol.gen.test netlink_route.gen.test netlink_selinux.gen.test netlink_xfrm.gen.test newfstatat.gen.test nlattr.gen.test nfnetlink_acct.gen.test nfnetlink_cthelper.gen.test nfnetlink_ctnetlink.gen.test nfnetlink_ctnetlink_exp.gen.test nfnetlink_cttimeout.gen.test nfnetlink_ipset.gen.test nfnetlink_nft_compat.gen.test nfnetlink_nftables.gen.test nfnetlink_osf.gen.test nfnetlink_queue.gen.test nfnetlink_ulog.gen.test nlattr_crypto_user_alg.gen.test nlattr_br_port_msg.gen.test nlattr_dcbmsg.gen.test nlattr_fib_rule_hdr.gen.test nlattr_ifaddrlblmsg.gen.test nlattr_ifaddrmsg.gen.test nlattr_ifinfomsg.gen.test nlattr_ifla_brport.gen.test nlattr_ifla_port.gen.test nlattr_ifla_xdp.gen.test nlattr_inet_diag_msg.gen.test nlattr_inet_diag_req_compat.gen.test nlattr_inet_diag_req_v2.gen.test nlattr_mdba_mdb_entry.gen.test nlattr_mdba_router_port.gen.test nlattr_ndmsg.gen.test nlattr_ndtmsg.gen.test nlattr_netconfmsg.gen.test nlattr_netlink_diag_msg.gen.test nlattr_nlmsgerr.gen.test nlattr_packet_diag_msg.gen.test nlattr_rtgenmsg.gen.test nlattr_rtmsg.gen.test nlattr_smc_diag_msg.gen.test nlattr_tc_stats.gen.test nlattr_tca_stab.gen.test nlattr_tcamsg.gen.test nlattr_tcmsg.gen.test nlattr_unix_diag_msg.gen.test old_mmap.gen.test oldfstat.gen.test oldlstat.gen.test oldstat.gen.test open.gen.test openat.gen.test osf_utimes.gen.test pause.gen.test perf_event_open.gen.test perf_event_open_nonverbose.gen.test perf_event_open_unabbrev.gen.test pipe2.gen.test pkey_alloc.gen.test pkey_free.gen.test pkey_mprotect.gen.test ppoll.gen.test ppoll-v.gen.test pread64-pwrite64.gen.test preadv.gen.test preadv-pwritev.gen.test preadv2-pwritev2.gen.test printstr.gen.test printpath-umovestr.gen.test printpath-umovestr-peekdata.gen.test printpath-umovestr-undumpable.gen.test printstrn-umoven.gen.test printstrn-umoven-peekdata.gen.test printstrn-umoven-undumpable.gen.test prlimit64.gen.test process_vm_readv.gen.test process_vm_writev.gen.test pselect6.gen.test ptrace.gen.test pwritev.gen.test quotactl.gen.test quotactl-v.gen.test quotactl-xfs.gen.test quotactl-xfs-v.gen.test read-write.gen.test readahead.gen.test readdir.gen.test readlink.gen.test readlinkat.gen.test reboot.gen.test recvfrom.gen.test recvmmsg-timeout.gen.test recvmsg.gen.test regex.gen.test remap_file_pages.gen.test rename.gen.test renameat.gen.test renameat2.gen.test request_key.gen.test rmdir.gen.test rt_sigpending.gen.test rt_sigprocmask.gen.test rt_sigqueueinfo.gen.test rt_sigreturn.gen.test rt_sigsuspend.gen.test rt_sigtimedwait.gen.test rt_tgsigqueueinfo.gen.test sched.gen.test sched_get_priority_mxx.gen.test sched_rr_get_interval.gen.test sched_xetaffinity.gen.test sched_xetattr.gen.test sched_xetparam.gen.test sched_xetscheduler.gen.test sched_yield.gen.test seccomp-filter.gen.test seccomp-filter-v.gen.test seccomp_get_action_avail.gen.test select.gen.test semop.gen.test sendfile.gen.test sendfile64.gen.test set_mempolicy.gen.test setdomainname.gen.test setfsgid.gen.test setfsgid32.gen.test setfsuid.gen.test setfsuid32.gen.test setgid.gen.test setgid32.gen.test setgroups.gen.test setgroups32.gen.test sethostname.gen.test setns.gen.test setregid.gen.test setregid32.gen.test setresgid.gen.test setresgid32.gen.test setresuid.gen.test setresuid32.gen.test setreuid.gen.test setreuid32.gen.test setrlimit.gen.test setuid.gen.test setuid32.gen.test shmxt.gen.test shutdown.gen.test sigaction.gen.test siginfo.gen.test signal.gen.test signal_receive.gen.test signalfd4.gen.test sigpending.gen.test sigprocmask.gen.test sigreturn.gen.test sigsuspend.gen.test so_linger.gen.test so_peercred.gen.test sock_filter-v.gen.test socketcall.gen.test splice.gen.test stat.gen.test stat64.gen.test statfs.gen.test statfs64.gen.test statx.gen.test swap.gen.test sxetmask.gen.test symlink.gen.test symlinkat.gen.test sync.gen.test sync_file_range.gen.test sync_file_range2.gen.test sysinfo.gen.test syslog.gen.test tee.gen.test time.gen.test timer_create.gen.test timer_xettime.gen.test timerfd_xettime.gen.test times.gen.test times-fail.gen.test trace_fstat.gen.test trace_fstatfs.gen.test trace_lstat.gen.test trace_question.gen.test trace_stat.gen.test trace_stat_like.gen.test trace_statfs.gen.test trace_statfs_like.gen.test truncate.gen.test truncate64.gen.test ugetrlimit.gen.test umask.gen.test umoven-illptr.gen.test umovestr-illptr.gen.test umovestr3.gen.test unlink.gen.test unlinkat.gen.test unshare.gen.test userfaultfd.gen.test ustat.gen.test utime.gen.test utimensat.gen.test utimes.gen.test vfork-f.gen.test vhangup.gen.test vmsplice.gen.test wait4.gen.test wait4-v.gen.test waitid.gen.test waitid-v.gen.test waitpid.gen.test xattr.gen.test xattr-strings.gen.test xet_robust_list.gen.test xetitimer.gen.test xetpgid.gen.test xetpriority.gen.test xettimeofday.gen.test +GEN_TESTS = _newselect.gen.test _newselect-P.gen.test accept.gen.test accept4.gen.test access.gen.test acct.gen.test add_key.gen.test adjtimex.gen.test aio.gen.test alarm.gen.test bpf.gen.test bpf-v.gen.test btrfs.gen.test chmod.gen.test chown.gen.test chown32.gen.test chroot.gen.test clock.gen.test clock_adjtime.gen.test clock_nanosleep.gen.test clock_xettime.gen.test copy_file_range.gen.test creat.gen.test delete_module.gen.test dup.gen.test dup2.gen.test dup3.gen.test epoll_create.gen.test epoll_create1.gen.test epoll_ctl.gen.test epoll_pwait.gen.test epoll_wait.gen.test erestartsys.gen.test execveat.gen.test execveat-v.gen.test faccessat.gen.test fadvise64_64.gen.test fallocate.gen.test fanotify_init.gen.test fanotify_mark.gen.test fchdir.gen.test fchmod.gen.test fchmodat.gen.test fchown.gen.test fchown32.gen.test fchownat.gen.test fcntl.gen.test fcntl64.gen.test fdatasync.gen.test file_handle.gen.test file_ioctl.gen.test finit_module.gen.test flock.gen.test fork-f.gen.test fstat.gen.test fstat64.gen.test fstatat64.gen.test fstatfs.gen.test fstatfs64.gen.test fsync.gen.test ftruncate.gen.test ftruncate64.gen.test futimesat.gen.test get_mempolicy.gen.test getcpu.gen.test getcwd.gen.test getdents.gen.test getdents64.gen.test getegid.gen.test getegid32.gen.test geteuid.gen.test geteuid32.gen.test getgid.gen.test getgid32.gen.test getgroups.gen.test getgroups32.gen.test getpeername.gen.test getpgrp.gen.test getpid.gen.test getppid.gen.test getrandom.gen.test getresgid.gen.test getresgid32.gen.test getresuid.gen.test getresuid32.gen.test getrlimit.gen.test getrusage.gen.test getsid.gen.test getsockname.gen.test gettid.gen.test getuid32.gen.test getxxid.gen.test group_req.gen.test inet-cmsg.gen.test init_module.gen.test inotify.gen.test inotify_init1.gen.test int_0x80.gen.test ioctl_block.gen.test ioctl_dm.gen.test ioctl_dm-v.gen.test ioctl_evdev.gen.test ioctl_evdev-v.gen.test ioctl_kvm_run.gen.test ioctl_loop.gen.test ioctl_loop-nv.gen.test ioctl_loop-v.gen.test ioctl_mtd.gen.test ioctl_nsfs.gen.test ioctl_rtc.gen.test ioctl_rtc-v.gen.test ioctl_scsi.gen.test ioctl_sg_io_v3.gen.test ioctl_sg_io_v4.gen.test ioctl_sock_gifconf.gen.test ioctl_uffdio.gen.test ioctl_v4l2.gen.test ioperm.gen.test iopl.gen.test ioprio.gen.test ip_mreq.gen.test ipc.gen.test ipc_msg.gen.test ipc_sem.gen.test ipc_shm.gen.test kcmp.gen.test kcmp-y.gen.test kexec_file_load.gen.test kexec_load.gen.test keyctl.gen.test kill.gen.test lchown.gen.test lchown32.gen.test link.gen.test linkat.gen.test lookup_dcookie.gen.test lstat.gen.test lstat64.gen.test madvise.gen.test mbind.gen.test membarrier.gen.test memfd_create.gen.test migrate_pages.gen.test mincore.gen.test mkdir.gen.test mkdirat.gen.test mknod.gen.test mknodat.gen.test mlock.gen.test mlock2.gen.test mlockall.gen.test mmap64.gen.test mmsg.gen.test mmsg-silent.gen.test mmsg_name.gen.test mmsg_name-v.gen.test modify_ldt.gen.test mount.gen.test move_pages.gen.test mq.gen.test mq_sendrecv.gen.test mq_sendrecv-read.gen.test mq_sendrecv-write.gen.test msg_control.gen.test msg_control-v.gen.test msg_name.gen.test munlockall.gen.test nanosleep.gen.test net-icmp_filter.gen.test net-sockaddr.gen.test netlink_audit.gen.test netlink_crypto.gen.test netlink_generic.gen.test netlink_kobject_uevent.gen.test netlink_netfilter.gen.test netlink_protocol.gen.test netlink_route.gen.test netlink_selinux.gen.test netlink_xfrm.gen.test newfstatat.gen.test nlattr.gen.test nfnetlink_acct.gen.test nfnetlink_cthelper.gen.test nfnetlink_ctnetlink.gen.test nfnetlink_ctnetlink_exp.gen.test nfnetlink_cttimeout.gen.test nfnetlink_ipset.gen.test nfnetlink_nft_compat.gen.test nfnetlink_nftables.gen.test nfnetlink_osf.gen.test nfnetlink_queue.gen.test nfnetlink_ulog.gen.test nlattr_crypto_user_alg.gen.test nlattr_br_port_msg.gen.test nlattr_dcbmsg.gen.test nlattr_fib_rule_hdr.gen.test nlattr_ifaddrlblmsg.gen.test nlattr_ifaddrmsg.gen.test nlattr_ifinfomsg.gen.test nlattr_ifla_brport.gen.test nlattr_ifla_port.gen.test nlattr_ifla_xdp.gen.test nlattr_inet_diag_msg.gen.test nlattr_inet_diag_req_compat.gen.test nlattr_inet_diag_req_v2.gen.test nlattr_mdba_mdb_entry.gen.test nlattr_mdba_router_port.gen.test nlattr_ndmsg.gen.test nlattr_ndtmsg.gen.test nlattr_netconfmsg.gen.test nlattr_netlink_diag_msg.gen.test nlattr_nlmsgerr.gen.test nlattr_packet_diag_msg.gen.test nlattr_rtgenmsg.gen.test nlattr_rtmsg.gen.test nlattr_smc_diag_msg.gen.test nlattr_tc_stats.gen.test nlattr_tca_stab.gen.test nlattr_tcamsg.gen.test nlattr_tcmsg.gen.test nlattr_unix_diag_msg.gen.test old_mmap.gen.test old_mmap-P.gen.test old_mmap-v-none.gen.test oldfstat.gen.test oldlstat.gen.test oldselect.gen.test oldselect-P.gen.test oldselect-efault.gen.test oldselect-efault-P.gen.test oldstat.gen.test open.gen.test openat.gen.test osf_utimes.gen.test pause.gen.test perf_event_open.gen.test perf_event_open_nonverbose.gen.test perf_event_open_unabbrev.gen.test pipe2.gen.test pkey_alloc.gen.test pkey_free.gen.test pkey_mprotect.gen.test ppoll.gen.test ppoll-P.gen.test ppoll-v.gen.test pread64-pwrite64.gen.test preadv.gen.test preadv-pwritev.gen.test preadv2-pwritev2.gen.test printstr.gen.test printpath-umovestr.gen.test printpath-umovestr-peekdata.gen.test printpath-umovestr-undumpable.gen.test printstrn-umoven.gen.test printstrn-umoven-peekdata.gen.test printstrn-umoven-undumpable.gen.test prlimit64.gen.test process_vm_readv.gen.test process_vm_writev.gen.test pselect6.gen.test ptrace.gen.test pwritev.gen.test quotactl.gen.test quotactl-v.gen.test quotactl-xfs.gen.test quotactl-xfs-v.gen.test read-write.gen.test readahead.gen.test readdir.gen.test readlink.gen.test readlinkat.gen.test reboot.gen.test recvfrom.gen.test recvmmsg-timeout.gen.test recvmsg.gen.test regex.gen.test remap_file_pages.gen.test rename.gen.test renameat.gen.test renameat2.gen.test request_key.gen.test riscv_flush_icache.gen.test rmdir.gen.test rt_sigpending.gen.test rt_sigprocmask.gen.test rt_sigqueueinfo.gen.test rt_sigreturn.gen.test rt_sigsuspend.gen.test rt_sigtimedwait.gen.test rt_tgsigqueueinfo.gen.test s390_guarded_storage.gen.test s390_guarded_storage-v.gen.test s390_pci_mmio_read_write.gen.test s390_runtime_instr.gen.test s390_sthyi.gen.test s390_sthyi-v.gen.test sched.gen.test sched_get_priority_mxx.gen.test sched_rr_get_interval.gen.test sched_xetaffinity.gen.test sched_xetattr.gen.test sched_xetparam.gen.test sched_xetscheduler.gen.test sched_yield.gen.test seccomp-filter.gen.test seccomp-filter-v.gen.test seccomp_get_action_avail.gen.test select.gen.test select-P.gen.test semop.gen.test sendfile.gen.test sendfile64.gen.test set_mempolicy.gen.test setdomainname.gen.test setfsgid.gen.test setfsgid32.gen.test setfsuid.gen.test setfsuid32.gen.test setgid.gen.test setgid32.gen.test setgroups.gen.test setgroups32.gen.test sethostname.gen.test setns.gen.test setregid.gen.test setregid32.gen.test setresgid.gen.test setresgid32.gen.test setresuid.gen.test setresuid32.gen.test setreuid.gen.test setreuid32.gen.test setrlimit.gen.test setuid.gen.test setuid32.gen.test shmxt.gen.test shutdown.gen.test sigaction.gen.test siginfo.gen.test signal.gen.test signal_receive.gen.test signalfd4.gen.test sigpending.gen.test sigprocmask.gen.test sigreturn.gen.test sigsuspend.gen.test so_linger.gen.test so_peercred.gen.test sock_filter-v.gen.test socketcall.gen.test sockopt-sol_netlink.gen.test splice.gen.test stat.gen.test stat64.gen.test statfs.gen.test statfs64.gen.test statx.gen.test swap.gen.test sxetmask.gen.test symlink.gen.test symlinkat.gen.test sync.gen.test sync_file_range.gen.test sync_file_range2.gen.test sysinfo.gen.test syslog.gen.test tee.gen.test time.gen.test timer_create.gen.test timer_xettime.gen.test timerfd_xettime.gen.test times.gen.test times-fail.gen.test trace_fstat.gen.test trace_fstatfs.gen.test trace_lstat.gen.test trace_question.gen.test trace_stat.gen.test trace_stat_like.gen.test trace_statfs.gen.test trace_statfs_like.gen.test truncate.gen.test truncate64.gen.test ugetrlimit.gen.test umask.gen.test umoven-illptr.gen.test umovestr-illptr.gen.test umovestr3.gen.test unlink.gen.test unlinkat.gen.test unshare.gen.test userfaultfd.gen.test ustat.gen.test utime.gen.test utimensat.gen.test utimes.gen.test vfork-f.gen.test vhangup.gen.test vmsplice.gen.test wait4.gen.test wait4-v.gen.test waitid.gen.test waitid-v.gen.test waitpid.gen.test xattr.gen.test xattr-strings.gen.test xet_robust_list.gen.test xetitimer.gen.test xetpgid.gen.test xetpriority.gen.test xettimeofday.gen.test $(srcdir)/_newselect.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/_newselect-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/accept.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -295,21 +298,36 @@ $(srcdir)/int_0x80.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(srcdir)/ioctl_block.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_dm.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/ioctl_dm-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_evdev.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ $(srcdir)/ioctl_evdev-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_kvm_run.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_loop.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_loop-nv.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_loop-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ $(srcdir)/ioctl_mtd.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_nsfs.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_rtc.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -325,6 +343,9 @@ $(srcdir)/ioctl_sg_io_v3.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_test $(srcdir)/ioctl_sg_io_v4.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ioctl_sock_gifconf.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ioctl_uffdio.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -448,6 +469,9 @@ $(srcdir)/mmsg_name.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(srcdir)/mmsg_name-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/modify_ldt.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/mount.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -643,12 +667,30 @@ $(srcdir)/nlattr_unix_diag_msg.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/ge $(srcdir)/old_mmap.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/old_mmap-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/old_mmap-v-none.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/oldfstat.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ $(srcdir)/oldlstat.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/oldselect.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/oldselect-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/oldselect-efault.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/oldselect-efault-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/oldstat.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -688,6 +730,9 @@ $(srcdir)/pkey_mprotect.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests $(srcdir)/ppoll.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/ppoll-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/ppoll-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -799,6 +844,9 @@ $(srcdir)/renameat2.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(srcdir)/request_key.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/riscv_flush_icache.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/rmdir.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -823,6 +871,24 @@ $(srcdir)/rt_sigtimedwait.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tes $(srcdir)/rt_tgsigqueueinfo.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/s390_guarded_storage.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_guarded_storage-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_pci_mmio_read_write.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_runtime_instr.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_sthyi.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + +$(srcdir)/s390_sthyi-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/sched.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -859,6 +925,9 @@ $(srcdir)/seccomp_get_action_avail.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir $(srcdir)/select.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/select-P.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/semop.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ @@ -982,6 +1051,9 @@ $(srcdir)/sock_filter-v.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests $(srcdir)/socketcall.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ +$(srcdir)/sockopt-sol_netlink.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in + $(AM_V_GEN) $^ $@ + $(srcdir)/splice.gen.test: $(abs_srcdir)/gen_tests.sh $(srcdir)/gen_tests.in $(AM_V_GEN) $^ $@ diff --git a/tests/gen_tests.in b/tests/gen_tests.in index 091bbe59..ea33892f 100644 --- a/tests/gen_tests.in +++ b/tests/gen_tests.in @@ -1,6 +1,6 @@ # Input for gen_tests.sh # -# Copyright (c) 2017 The strace developers. +# Copyright (c) 2017-2018 The strace developers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -26,6 +26,7 @@ # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. _newselect +_newselect-P -e trace=_newselect -P /dev/full 9>>/dev/full accept -a22 accept4 -a37 access -a30 -P access_sample @@ -123,16 +124,22 @@ inotify -a23 -e trace=inotify_add_watch,inotify_rm_watch inotify_init1 -a27 int_0x80 -a11 -e trace=getgid32 ioctl_block +ioctl.test +ioctl_dm +ioctl.test -s9 +ioctl_dm-v +ioctl.test -v -s9 ioctl_evdev +ioctl.test -ioctl_evdev-v +ioctl-v.sh +ioctl_evdev-v +ioctl.test -v +ioctl_kvm_run +ioctl.test -a36 -y ioctl_loop +ioctl.test -ioctl_loop-v +ioctl-v.sh +ioctl_loop-nv +ioctl.test -a22 -e verbose=none +ioctl_loop-v +ioctl.test -v ioctl_mtd +ioctl.test +ioctl_nsfs +ioctl.test -esignal=none ioctl_rtc +ioctl.test -ioctl_rtc-v +ioctl-v.sh +ioctl_rtc-v +ioctl.test -v ioctl_scsi +ioctl.test ioctl_sg_io_v3 +ioctl.test ioctl_sg_io_v4 +ioctl.test +ioctl_sock_gifconf +ioctl.test -a28 -s1 ioctl_uffdio +ioctl.test ioctl_v4l2 +ioctl.test ioperm -a27 @@ -174,6 +181,7 @@ mmsg -e read=0 -e write=1 -e trace=recvmmsg,sendmmsg mmsg-silent -a25 -e verbose=none -e trace=sendmmsg,recvmmsg mmsg_name -a25 -e trace=sendmmsg,recvmmsg mmsg_name-v -v -a25 -e trace=sendmmsg,recvmmsg +modify_ldt -a23 mount move_pages -s3 mq -a32 -e trace=mq_getsetattr,mq_open,mq_unlink @@ -239,11 +247,17 @@ nlattr_tcamsg +netlink_sock_diag.test nlattr_tcmsg +netlink_sock_diag.test nlattr_unix_diag_msg +netlink_sock_diag.test old_mmap -a11 -e trace=mmap +old_mmap-P -e trace=mmap -P "/dev/full" 9>>/dev/full +old_mmap-v-none -a11 -e trace=mmap -e verbose=none oldfstat -a18 -v -P stat.sample oldlstat -a32 -v -P stat.sample -P /dev/full +oldselect -a13 -e trace=select +oldselect-P -a13 -e trace=select -P /dev/full 9>>/dev/full +oldselect-efault -a13 -e trace=select +oldselect-efault-P -a13 -e trace=select -P /dev/full 9>>/dev/full oldstat -a32 -v -P stat.sample -P /dev/full open -a30 -P $NAME.sample -openat -P $NAME.sample +openat -a36 -P $NAME.sample osf_utimes -a21 pause -a8 -esignal=none perf_event_open -a1 @@ -254,6 +268,7 @@ pkey_alloc -a17 pkey_free -a13 pkey_mprotect -a37 ppoll -s2 +ppoll-P -s2 -e trace=ppoll -P /dev/full 9>>/dev/full ppoll-v -v -s2 -e trace=ppoll pread64-pwrite64 -a21 -eread=0 -ewrite=1 -e trace=pread64,pwrite64 -P pread64-pwrite64-tmpfile -P /dev/zero -P /dev/null preadv -a21 @@ -281,7 +296,7 @@ readahead -a1 readdir -a16 readlink -xx readlinkat -xx -reboot +reboot -s 256 recvfrom -a35 recvmmsg-timeout -a25 -e trace=recvmmsg recvmsg -eread=0 -ewrite=1 -e trace=recvmsg,sendmsg @@ -291,6 +306,7 @@ rename -a35 renameat renameat2 request_key -a33 -s12 +riscv_flush_icache -a34 rmdir -a22 rt_sigpending -a20 rt_sigprocmask @@ -299,6 +315,12 @@ rt_sigreturn -esignal='!USR1' rt_sigsuspend -a20 -esignal=none rt_sigtimedwait -a38 rt_tgsigqueueinfo -esignal=none +s390_guarded_storage -a32 +s390_guarded_storage-v -e trace=s390_guarded_storage -a32 -v +s390_pci_mmio_read_write -e trace=s390_pci_mmio_read,s390_pci_mmio_write -a30 +s390_runtime_instr -a50 +s390_sthyi -a47 +s390_sthyi-v -e trace=s390_sthyi -a47 -v sched test_trace_expr times -e/sched sched_get_priority_mxx -a33 -e trace=sched_get_priority_min,sched_get_priority_max sched_rr_get_interval -a31 @@ -311,6 +333,7 @@ seccomp-filter -e trace=seccomp seccomp-filter-v -v -e trace=seccomp seccomp_get_action_avail -e trace=seccomp select -a36 +select-P -a36 -e trace=select -P /dev/full 9>>/dev/full semop -a32 -e trace=semop,semtimedop sendfile -a27 sendfile64 -a29 @@ -352,6 +375,7 @@ so_linger -e trace=getsockopt,setsockopt so_peercred -e trace=getsockopt sock_filter-v -v -e trace=getsockopt,setsockopt socketcall -a20 +sockopt-sol_netlink -e trace=getsockopt,setsockopt splice stat -a32 -v -P stat.sample -P /dev/full stat64 -a32 -v -P stat.sample -P /dev/full diff --git a/tests/gen_tests.sh b/tests/gen_tests.sh index b0624365..b41983ee 100755 --- a/tests/gen_tests.sh +++ b/tests/gen_tests.sh @@ -1,6 +1,7 @@ #!/bin/sh -efu # # Copyright (c) 2017 Dmitry V. Levin <ldv@altlinux.org> +# Copyright (c) 2017-2018 The strace developers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -54,7 +55,7 @@ fi names= -while read -r name args; do { +while read -r name arg0 args; do { [ -n "${name###*}" ] || continue if [ -z "$match" ]; then names="$names $name" @@ -65,13 +66,14 @@ while read -r name args; do { hdr="\ #!/bin/sh -efu -# Generated by $0 from $input ($name $args); do not edit." +# Generated by $0 from $input ($name $arg0 $args); do not edit." - case "$args" in + case "$arg0" in +*) cat <<-EOF $hdr - . "\${srcdir=.}/${args#+}" + set -- $args + . "\${srcdir=.}/${arg0#+}" EOF ;; @@ -79,7 +81,7 @@ while read -r name args; do { cat <<-EOF $hdr . "\${srcdir=.}/init.sh" - run_strace_match_diff $args + run_strace_match_diff $arg0 $args EOF ;; @@ -87,7 +89,7 @@ while read -r name args; do { cat <<-EOF $hdr . "\${srcdir=.}/init.sh" - $args + $arg0 $args EOF ;; esac > "$output" diff --git a/tests/get_regs.test b/tests/get_regs.test index c673fe95..eb69137b 100755 --- a/tests/get_regs.test +++ b/tests/get_regs.test @@ -36,7 +36,7 @@ run_prog ../gettid > /dev/null run_strace -qq -esignal=none -eraw=all -etrace=none ../gettid > /dev/null run_strace -qq -esignal=none -eraw=all -eptrace -o '|grep -c ^ptrace > less' \ - -- ${STRACE##* } -o "$LOG" $args > /dev/null + -- "$STRACE_EXE" -o "$LOG" $args > /dev/null [ "$(cat less)" -gt 0 ] || fail_ "$STRACE $args failed to catch any ptrace syscalls" @@ -44,7 +44,7 @@ run_strace -qq -esignal=none -eraw=all -eptrace -o '|grep -c ^ptrace > less' \ run_strace -qq -esignal=none -eraw=all -etrace=all ../gettid > /dev/null run_strace -qq -esignal=none -eraw=all -eptrace -o '|grep -c ^ptrace > more' \ - -- ${STRACE##* } -o "$LOG" $args > /dev/null + -- "$STRACE_EXE" -o "$LOG" $args > /dev/null [ "$(cat more)" -gt 0 ] || fail_ "$STRACE $args failed to catch any ptrace syscalls" diff --git a/tests/getcpu.gen.test b/tests/getcpu.gen.test index 44d9a4b8..ae38aaa0 100755 --- a/tests/getcpu.gen.test +++ b/tests/getcpu.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getcpu -a25); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getcpu -a25 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a25 +run_strace_match_diff -a25 diff --git a/tests/getcwd.c b/tests/getcwd.c index 0c32f8dd..2020df40 100644 --- a/tests/getcwd.c +++ b/tests/getcwd.c @@ -4,9 +4,9 @@ #ifdef __NR_getcwd +# include <limits.h> # include <stdio.h> # include <unistd.h> -# include <sys/param.h> int main(void) diff --git a/tests/getcwd.gen.test b/tests/getcwd.gen.test index af2ff083..f783a5b1 100755 --- a/tests/getcwd.gen.test +++ b/tests/getcwd.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getcwd -a18); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getcwd -a18 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a18 +run_strace_match_diff -a18 diff --git a/tests/getegid.gen.test b/tests/getegid.gen.test index d6fecc23..ddf8fa9a 100755 --- a/tests/getegid.gen.test +++ b/tests/getegid.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getegid +getuid.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getegid +getuid.test ); do not edit. +set -- . "${srcdir=.}/getuid.test" diff --git a/tests/getegid32.gen.test b/tests/getegid32.gen.test index 38c4a4b2..a773f56a 100755 --- a/tests/getegid32.gen.test +++ b/tests/getegid32.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getegid32 +getuid.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getegid32 +getuid.test ); do not edit. +set -- . "${srcdir=.}/getuid.test" diff --git a/tests/geteuid.gen.test b/tests/geteuid.gen.test index 9e8c12f8..c7da2aa9 100755 --- a/tests/geteuid.gen.test +++ b/tests/geteuid.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (geteuid +getuid.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (geteuid +getuid.test ); do not edit. +set -- . "${srcdir=.}/getuid.test" diff --git a/tests/geteuid32.gen.test b/tests/geteuid32.gen.test index 5b783311..75c3f12e 100755 --- a/tests/geteuid32.gen.test +++ b/tests/geteuid32.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (geteuid32 +getuid.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (geteuid32 +getuid.test ); do not edit. +set -- . "${srcdir=.}/getuid.test" diff --git a/tests/getgid.gen.test b/tests/getgid.gen.test index 5a87aeeb..fc6ac3bc 100755 --- a/tests/getgid.gen.test +++ b/tests/getgid.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getgid +getuid.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getgid +getuid.test ); do not edit. +set -- . "${srcdir=.}/getuid.test" diff --git a/tests/getgid32.gen.test b/tests/getgid32.gen.test index 05e2d70c..b3a87561 100755 --- a/tests/getgid32.gen.test +++ b/tests/getgid32.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getgid32 +getuid.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getgid32 +getuid.test ); do not edit. +set -- . "${srcdir=.}/getuid.test" diff --git a/tests/getgroups.gen.test b/tests/getgroups.gen.test index 48b09be9..ae196d05 100755 --- a/tests/getgroups.gen.test +++ b/tests/getgroups.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getgroups -a17); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getgroups -a17 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a17 +run_strace_match_diff -a17 diff --git a/tests/getgroups32.gen.test b/tests/getgroups32.gen.test index 74637d0e..54b71d5f 100755 --- a/tests/getgroups32.gen.test +++ b/tests/getgroups32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getgroups32 -a19); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getgroups32 -a19 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a19 +run_strace_match_diff -a19 diff --git a/tests/getpeername.gen.test b/tests/getpeername.gen.test index 66fb0a92..020583ab 100755 --- a/tests/getpeername.gen.test +++ b/tests/getpeername.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getpeername -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getpeername -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests/getpgrp.gen.test b/tests/getpgrp.gen.test index 1ec48e9c..26989cdb 100755 --- a/tests/getpgrp.gen.test +++ b/tests/getpgrp.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getpgrp -a10); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getpgrp -a10 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a10 +run_strace_match_diff -a10 diff --git a/tests/getpid.gen.test b/tests/getpid.gen.test index 46917749..2a3eb1cf 100755 --- a/tests/getpid.gen.test +++ b/tests/getpid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getpid -a9); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getpid -a9 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a9 +run_strace_match_diff -a9 diff --git a/tests/getppid.gen.test b/tests/getppid.gen.test index 52116a0a..655b0b7d 100755 --- a/tests/getppid.gen.test +++ b/tests/getppid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getppid -a10); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getppid -a10 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a10 +run_strace_match_diff -a10 diff --git a/tests/getresgid.gen.test b/tests/getresgid.gen.test index f53bccce..dc32c62c 100755 --- a/tests/getresgid.gen.test +++ b/tests/getresgid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getresgid -a25); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getresgid -a25 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a25 +run_strace_match_diff -a25 diff --git a/tests/getresgid32.gen.test b/tests/getresgid32.gen.test index 5f00506f..0ee28299 100755 --- a/tests/getresgid32.gen.test +++ b/tests/getresgid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getresgid32 -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getresgid32 -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests/getresuid.gen.test b/tests/getresuid.gen.test index e947a94e..b0f478ce 100755 --- a/tests/getresuid.gen.test +++ b/tests/getresuid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getresuid -a25); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getresuid -a25 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a25 +run_strace_match_diff -a25 diff --git a/tests/getresuid32.gen.test b/tests/getresuid32.gen.test index b088a220..1b2f232c 100755 --- a/tests/getresuid32.gen.test +++ b/tests/getresuid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getresuid32 -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getresuid32 -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests/getrlimit.gen.test b/tests/getrlimit.gen.test index b97c176b..08daf2d0 100755 --- a/tests/getrlimit.gen.test +++ b/tests/getrlimit.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getrlimit -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getrlimit -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests/getrusage.gen.test b/tests/getrusage.gen.test index c4fb182b..161818aa 100755 --- a/tests/getrusage.gen.test +++ b/tests/getrusage.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getrusage -v); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getrusage -v ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -v +run_strace_match_diff -v diff --git a/tests/getsid.gen.test b/tests/getsid.gen.test index 123f1775..2b9084a4 100755 --- a/tests/getsid.gen.test +++ b/tests/getsid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getsid -a10); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getsid -a10 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a10 +run_strace_match_diff -a10 diff --git a/tests/getsockname.gen.test b/tests/getsockname.gen.test index cd40d3ef..64cdeea8 100755 --- a/tests/getsockname.gen.test +++ b/tests/getsockname.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getsockname -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getsockname -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests/gettid.gen.test b/tests/gettid.gen.test index 1ceaa53d..f5ad317e 100755 --- a/tests/gettid.gen.test +++ b/tests/gettid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (gettid -a9); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (gettid -a9 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a9 +run_strace_match_diff -a9 diff --git a/tests/getuid32.gen.test b/tests/getuid32.gen.test index ac0d0ad6..e81eb064 100755 --- a/tests/getuid32.gen.test +++ b/tests/getuid32.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getuid32 +getuid.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (getuid32 +getuid.test ); do not edit. +set -- . "${srcdir=.}/getuid.test" diff --git a/tests/group_req.c b/tests/group_req.c index 946fe5c0..eb56cb7e 100644 --- a/tests/group_req.c +++ b/tests/group_req.c @@ -2,6 +2,7 @@ * Check decoding of MCAST_JOIN_GROUP/MCAST_LEAVE_GROUP. * * Copyright (c) 2015-2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2017-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,9 +34,9 @@ #if defined MCAST_JOIN_GROUP && defined MCAST_LEAVE_GROUP +# include <limits.h> # include <stdio.h> # include <unistd.h> -# include <sys/param.h> # include <sys/socket.h> # include <arpa/inet.h> diff --git a/tests/init_module.gen.test b/tests/init_module.gen.test index 8948e2ec..b6961be6 100755 --- a/tests/init_module.gen.test +++ b/tests/init_module.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (init_module -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (init_module -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests/inode_of_sockfd.c b/tests/inode_of_sockfd.c index b227f306..6a523c79 100644 --- a/tests/inode_of_sockfd.c +++ b/tests/inode_of_sockfd.c @@ -2,6 +2,7 @@ * This file is part of strace test suite. * * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,11 +30,11 @@ #include "tests.h" #include <assert.h> +#include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <sys/param.h> unsigned long inode_of_sockfd(const int fd) diff --git a/tests/inotify_init1.gen.test b/tests/inotify_init1.gen.test index d847b500..a1060c5d 100755 --- a/tests/inotify_init1.gen.test +++ b/tests/inotify_init1.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (inotify_init1 -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (inotify_init1 -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests/ioctl-v.sh b/tests/ioctl-v.sh deleted file mode 100755 index be896712..00000000 --- a/tests/ioctl-v.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# Check non-abbreviated decoding of ioctls. - -. "${srcdir=.}/init.sh" - -check_prog grep -run_prog > /dev/null -run_strace -a16 -v -eioctl $args > "$EXP" -grep -v '^ioctl([012],' < "$LOG" > "$OUT" -match_diff "$OUT" "$EXP" diff --git a/tests/ioctl.c b/tests/ioctl.c index 3c666b0d..af5f9ba2 100644 --- a/tests/ioctl.c +++ b/tests/ioctl.c @@ -86,8 +86,13 @@ main(void) " = -1 EBADF (%m)\n", &data); (void) ioctl(-1, _IOR('M', 13, int), &data); +# ifdef HAVE_STRUCT_MTD_WRITE_REQ printf("ioctl(-1, MIXER_READ(13) or OTPSELECT, [MTD_OTP_OFF])" " = -1 EBADF (%m)\n"); +# else + printf("ioctl(-1, MIXER_READ(13) or OTPSELECT, %p)" + " = -1 EBADF (%m)\n", &data); +# endif (void) ioctl(-1, _IOC(_IOC_WRITE, 0xde, 0, 0), (kernel_ulong_t) -1ULL); printf("ioctl(-1, _IOC(_IOC_WRITE, 0xde, 0, 0), %#lx)" diff --git a/tests/ioctl.test b/tests/ioctl.test index 1eb469ee..cbbadc83 100755 --- a/tests/ioctl.test +++ b/tests/ioctl.test @@ -6,6 +6,6 @@ check_prog grep run_prog > /dev/null -run_strace -a16 -eioctl $args > "$EXP" +run_strace -a16 -eioctl "$@" $args > "$EXP" grep -v '^ioctl([012],' < "$LOG" > "$OUT" match_diff "$OUT" "$EXP" diff --git a/tests/ioctl_block.gen.test b/tests/ioctl_block.gen.test index 0ffec6f6..8b2c3df6 100755 --- a/tests/ioctl_block.gen.test +++ b/tests/ioctl_block.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_block +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_block +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests/ioctl_dm-v.gen.test b/tests/ioctl_dm-v.gen.test new file mode 100755 index 00000000..66fa5856 --- /dev/null +++ b/tests/ioctl_dm-v.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_dm-v +ioctl.test -v -s9); do not edit. +set -- -v -s9 +. "${srcdir=.}/ioctl.test" diff --git a/tests/ioctl_dm-v.test b/tests/ioctl_dm-v.test deleted file mode 100755 index eed37c27..00000000 --- a/tests/ioctl_dm-v.test +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# Check unabbreviated decoding of DM* ioctls. - -. "${srcdir=.}/init.sh" - -check_prog grep -run_prog > /dev/null -run_strace -a16 -s9 -veioctl $args > "$EXP" -grep -v '^ioctl([012],' < "$LOG" > "$OUT" -match_diff "$OUT" "$EXP" diff --git a/tests/ioctl_dm.c b/tests/ioctl_dm.c index 1e831dfe..bbdc00c6 100644 --- a/tests/ioctl_dm.c +++ b/tests/ioctl_dm.c @@ -3,7 +3,7 @@ * * Copyright (c) 2016 Mikulas Patocka <mpatocka@redhat.com> * Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -143,7 +143,7 @@ init_dm_target_spec(struct dm_target_spec *ptr, uint32_t id) ptr->length = dts_length_base + dts_length_step * id; ptr->status = dts_status_base + dts_status_step * id; - strncpy(ptr->target_type, str129 + + memcpy(ptr->target_type, str129 + id % (sizeof(str129) - sizeof(ptr->target_type)), id % (sizeof(ptr->target_type) + 1)); if (id % (sizeof(ptr->target_type) + 1) < sizeof(ptr->target_type)) @@ -252,8 +252,8 @@ main(void) /* Unterminated name/uuid */ init_s(dm_arg, min_sizeof_dm_ioctl, 0); - strncpy(dm_arg->name, str129, sizeof(dm_arg->name)); - strncpy(dm_arg->uuid, str129, sizeof(dm_arg->uuid)); + memcpy(dm_arg->name, str129, sizeof(dm_arg->name)); + memcpy(dm_arg->uuid, str129, sizeof(dm_arg->uuid)); ioctl(-1, DM_VERSION, dm_arg); printf("ioctl(-1, DM_VERSION, {version=4.1.2, data_size=%zu, " "dev=makedev(18, 52), name=\"%.127s\"..., uuid=\"%.128s\"..., " @@ -511,7 +511,7 @@ main(void) target##id_next) - \ offsetof(struct dm_table_open_test, \ target##id); \ - strncpy(dm_arg_open3->param##id, str129 + id * 2, id); \ + memcpy(dm_arg_open3->param##id, str129 + id * 2, id); \ dm_arg_open3->param##id[id] = '\0'; \ } while (0) #define PRINT_DM_TARGET(id) \ diff --git a/tests/ioctl_dm.gen.test b/tests/ioctl_dm.gen.test new file mode 100755 index 00000000..b60c7175 --- /dev/null +++ b/tests/ioctl_dm.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_dm +ioctl.test -s9); do not edit. +set -- -s9 +. "${srcdir=.}/ioctl.test" diff --git a/tests/ioctl_dm.test b/tests/ioctl_dm.test deleted file mode 100755 index e9cca03b..00000000 --- a/tests/ioctl_dm.test +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# Check decoding of DM* ioctls. - -. "${srcdir=.}/init.sh" - -check_prog grep -run_prog > /dev/null -run_strace -a16 -s9 -eioctl $args > "$EXP" -grep -v '^ioctl([012],' < "$LOG" > "$OUT" -match_diff "$OUT" "$EXP" diff --git a/tests/ioctl_evdev-v.gen.test b/tests/ioctl_evdev-v.gen.test index fc7e2f0b..bf74ef4c 100755 --- a/tests/ioctl_evdev-v.gen.test +++ b/tests/ioctl_evdev-v.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_evdev-v +ioctl-v.sh); do not edit. -. "${srcdir=.}/ioctl-v.sh" +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_evdev-v +ioctl.test -v); do not edit. +set -- -v +. "${srcdir=.}/ioctl.test" diff --git a/tests/ioctl_evdev.gen.test b/tests/ioctl_evdev.gen.test index 26f0a288..68a43f7c 100755 --- a/tests/ioctl_evdev.gen.test +++ b/tests/ioctl_evdev.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_evdev +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_evdev +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests/ioctl_kvm_run.c b/tests/ioctl_kvm_run.c new file mode 100644 index 00000000..17946143 --- /dev/null +++ b/tests/ioctl_kvm_run.c @@ -0,0 +1,242 @@ +/* + * Check decoding of KVM_* commands of ioctl syscall using /dev/kvm API. + * Based on kvmtest.c from https://lwn.net/Articles/658512/ + * + * kvmtest.c author: Josh Triplett <josh@joshtriplett.org> + * Copyright (c) 2015 Intel Corporation + * Copyright (c) 2017-2018 The strace developers. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "tests.h" + +#if defined HAVE_LINUX_KVM_H \ + && defined HAVE_STRUCT_KVM_REGS \ + && defined HAVE_STRUCT_KVM_SREGS \ + && defined HAVE_STRUCT_KVM_USERSPACE_MEMORY_REGION \ + &&(defined __x86_64__ || defined __i386__) + +# include <fcntl.h> +# include <stdint.h> +# include <stdio.h> +# include <stdlib.h> +# include <string.h> +# include <sys/ioctl.h> +# include <sys/mman.h> +# include <linux/kvm.h> + +static int +kvm_ioctl(int fd, unsigned long cmd, const char *cmd_str, void *arg) +{ + int rc = ioctl(fd, cmd, arg); + if (rc < 0) + perror_msg_and_skip("%s", cmd_str); + return rc; +} + +#define KVM_IOCTL(fd_, cmd_, arg_) \ + kvm_ioctl((fd_), (cmd_), #cmd_, (arg_)) + +static const char dev[] = "/dev/kvm"; +static const char vm_dev[] = "anon_inode:kvm-vm"; +static const char vcpu_dev[] = "anon_inode:kvm-vcpu"; +static size_t page_size; + +extern const char code[]; +extern const unsigned short code_size; + +__asm__( + ".type code, @object \n" + "code: \n" + " mov $0xd80003f8, %edx \n" + " mov $'\n', %al \n" + " out %al, (%dx) \n" + " hlt \n" + ".size code, . - code \n" + ".type code_size, @object \n" + "code_size: \n" + " .short . - code \n" + ".size code_size, . - code_size \n" + ); + + +static void +run_kvm(const int vcpu_fd, struct kvm_run *const run, const size_t mmap_size, + void *const mem) +{ + /* Initialize CS to point at 0, via a read-modify-write of sregs. */ + struct kvm_sregs sregs; + KVM_IOCTL(vcpu_fd, KVM_GET_SREGS, &sregs); + printf("ioctl(%d<%s>, KVM_GET_SREGS, {cs={base=%#jx, limit=%u, selector=%u" + ", type=%u, present=%u, dpl=%u, db=%u, s=%u, l=%u, g=%u, avl=%u}" + ", ...}) = 0\n", vcpu_fd, vcpu_dev, (uintmax_t) sregs.cs.base, + sregs.cs.limit, sregs.cs.selector, sregs.cs.type, + sregs.cs.present, sregs.cs.dpl, sregs.cs.db, sregs.cs.s, + sregs.cs.l, sregs.cs.g, sregs.cs.avl); + + sregs.cs.base = 0; + sregs.cs.selector = 0; + KVM_IOCTL(vcpu_fd, KVM_SET_SREGS, &sregs); + printf("ioctl(%d<%s>, KVM_SET_SREGS, {cs={base=%#jx, limit=%u" + ", selector=%u, type=%u, present=%u, dpl=%u, db=%u, s=%u" + ", l=%u, g=%u, avl=%u}, ...}) = 0\n", + vcpu_fd, vcpu_dev, (uintmax_t) sregs.cs.base, + sregs.cs.limit, sregs.cs.selector, sregs.cs.type, + sregs.cs.present, sregs.cs.dpl, sregs.cs.db, sregs.cs.s, + sregs.cs.l, sregs.cs.g, sregs.cs.avl); + + /* + * Initialize registers: instruction pointer for our code, addends, + * and initial flags required by x86 architecture. + */ + struct kvm_regs regs = { + .rip = page_size, + .rax = 2, + .rbx = 2, + .rflags = 0x2, + }; + KVM_IOCTL(vcpu_fd, KVM_SET_REGS, ®s); + printf("ioctl(%d<%s>, KVM_SET_REGS, {rax=%#jx, ..." + ", rsp=%#jx, rbp=%#jx, ..., rip=%#jx, rflags=%#jx}) = 0\n", + vcpu_fd, vcpu_dev, (uintmax_t) regs.rax, + (uintmax_t) regs.rsp, (uintmax_t) regs.rbp, + (uintmax_t) regs.rip, (uintmax_t) regs.rflags); + + /* Copy the code */ + memcpy(mem, code, code_size); + + const char *p = "\n"; + + /* Repeatedly run code and handle VM exits. */ + for (;;) { + KVM_IOCTL(vcpu_fd, KVM_RUN, NULL); + printf("ioctl(%d<%s>, KVM_RUN, 0) = 0\n", vcpu_fd, vcpu_dev); + + switch (run->exit_reason) { + case KVM_EXIT_HLT: + if (p) + error_msg_and_fail("premature KVM_EXIT_HLT"); + return; + case KVM_EXIT_IO: + if (run->io.direction == KVM_EXIT_IO_OUT + && run->io.size == 1 + && run->io.port == 0x03f8 + && run->io.count == 1 + && run->io.data_offset < mmap_size + && p && *p == ((char *) run)[run->io.data_offset]) + p = NULL; + else + error_msg_and_fail("unhandled KVM_EXIT_IO"); + break; + case KVM_EXIT_MMIO: + error_msg_and_fail("Got an unexpected MMIO exit:" + " phys_addr %#llx," + " data %02x %02x %02x %02x" + " %02x %02x %02x %02x," + " len %u, is_write %hhu", + (unsigned long long) run->mmio.phys_addr, + run->mmio.data[0], run->mmio.data[1], + run->mmio.data[2], run->mmio.data[3], + run->mmio.data[4], run->mmio.data[5], + run->mmio.data[6], run->mmio.data[7], + run->mmio.len, run->mmio.is_write); + + default: + error_msg_and_fail("exit_reason = %#x", + run->exit_reason); + } + } +} + +int +main(void) +{ + skip_if_unavailable("/proc/self/fd/"); + + int kvm = open(dev, O_RDWR); + if (kvm < 0) + perror_msg_and_skip("open: %s", dev); + + /* Make sure we have the stable version of the API */ + int ret = KVM_IOCTL(kvm, KVM_GET_API_VERSION, 0); + if (ret != KVM_API_VERSION) + error_msg_and_skip("KVM_GET_API_VERSION returned %d" + ", KVM_API_VERSION is %d", + kvm, KVM_API_VERSION); + printf("ioctl(%d<%s>, KVM_GET_API_VERSION, 0) = %d\n", + kvm, dev, ret); + + int vm_fd = KVM_IOCTL(kvm, KVM_CREATE_VM, 0); + printf("ioctl(%d<%s>, KVM_CREATE_VM, 0) = %d<%s>\n", + kvm, dev, vm_fd, vm_dev); + + /* Allocate one aligned page of guest memory to hold the code. */ + page_size = get_page_size(); + void *const mem = mmap(NULL, page_size, PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_ANONYMOUS, -1, 0); + if (mem == MAP_FAILED) + perror_msg_and_fail("mmap page"); + + /* Map it to the second page frame (to avoid the real-mode IDT at 0). */ + struct kvm_userspace_memory_region region = { + .slot = 0, + .guest_phys_addr = page_size, + .memory_size = page_size, + .userspace_addr = (uintptr_t) mem, + }; + KVM_IOCTL(vm_fd, KVM_SET_USER_MEMORY_REGION, ®ion); + printf("ioctl(%d<%s>, KVM_SET_USER_MEMORY_REGION" + ", {slot=0, flags=0, guest_phys_addr=%#lx, memory_size=%lu" + ", userspace_addr=%p}) = 0\n", vm_fd, vm_dev, + (unsigned long) page_size, (unsigned long) page_size, mem); + + int vcpu_fd = KVM_IOCTL(vm_fd, KVM_CREATE_VCPU, NULL); + printf("ioctl(%d<%s>, KVM_CREATE_VCPU, 0) = %d<%s>\n", + vm_fd, vm_dev, vcpu_fd, vcpu_dev); + + /* Map the shared kvm_run structure and following data. */ + ret = KVM_IOCTL(kvm, KVM_GET_VCPU_MMAP_SIZE, NULL); + struct kvm_run *run; + if (ret < (int) sizeof(*run)) + error_msg_and_fail("KVM_GET_VCPU_MMAP_SIZE returned %d < %d", + ret, (int) sizeof(*run)); + printf("ioctl(%d<%s>, KVM_GET_VCPU_MMAP_SIZE, 0) = %d\n", + kvm, dev, ret); + + const size_t mmap_size = (ret + page_size - 1) & -page_size; + run = mmap(NULL, mmap_size, PROT_READ | PROT_WRITE, + MAP_SHARED, vcpu_fd, 0); + if (run == MAP_FAILED) + perror_msg_and_fail("mmap vcpu"); + + run_kvm(vcpu_fd, run, mmap_size, mem); + + puts("+++ exited with 0 +++"); + return 0; +} + +#else /* !HAVE_LINUX_KVM_H */ + +SKIP_MAIN_UNDEFINED("HAVE_LINUX_KVM_H && HAVE_STRUCT_KVM_REGS && " + "HAVE_STRUCT_KVM_SREGS && " + "HAVE_STRUCT_KVM_USERSPACE_MEMORY_REGION && " + "(__x86_64__ || __i386__)") + +#endif diff --git a/tests/ioctl_kvm_run.gen.test b/tests/ioctl_kvm_run.gen.test new file mode 100755 index 00000000..7ab473ba --- /dev/null +++ b/tests/ioctl_kvm_run.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_kvm_run +ioctl.test -a36 -y); do not edit. +set -- -a36 -y +. "${srcdir=.}/ioctl.test" diff --git a/tests/ioctl_loop-nv.gen.test b/tests/ioctl_loop-nv.gen.test new file mode 100755 index 00000000..d9da86a2 --- /dev/null +++ b/tests/ioctl_loop-nv.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_loop-nv +ioctl.test -a22 -e verbose=none); do not edit. +set -- -a22 -e verbose=none +. "${srcdir=.}/ioctl.test" diff --git a/tests/ioctl_loop-nv.test b/tests/ioctl_loop-nv.test deleted file mode 100755 index 7d59cc2b..00000000 --- a/tests/ioctl_loop-nv.test +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# Check non-verbose decoding of LOOP_* ioctls. - -. "${srcdir=.}/init.sh" - -check_prog grep -run_prog > /dev/null -run_strace -a22 -eioctl -e verbose=none $args > "$EXP" -grep -v '^ioctl([012],' < "$LOG" > "$OUT" -match_diff "$OUT" "$EXP" diff --git a/tests/ioctl_loop-v.gen.test b/tests/ioctl_loop-v.gen.test index 7fd9f661..b03bf784 100755 --- a/tests/ioctl_loop-v.gen.test +++ b/tests/ioctl_loop-v.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_loop-v +ioctl-v.sh); do not edit. -. "${srcdir=.}/ioctl-v.sh" +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_loop-v +ioctl.test -v); do not edit. +set -- -v +. "${srcdir=.}/ioctl.test" diff --git a/tests/ioctl_loop.gen.test b/tests/ioctl_loop.gen.test index f7aee8e5..d4ec35ac 100755 --- a/tests/ioctl_loop.gen.test +++ b/tests/ioctl_loop.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_loop +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_loop +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests/ioctl_mtd.c b/tests/ioctl_mtd.c index 6a7d94a7..1b5be755 100644 --- a/tests/ioctl_mtd.c +++ b/tests/ioctl_mtd.c @@ -30,22 +30,20 @@ #include "tests.h" -#include <errno.h> -#include <inttypes.h> -#include <stdio.h> -#include <string.h> -#include <sys/ioctl.h> -#include <linux/ioctl.h> -#include <linux/version.h> -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) -# include "mtd-abi.h" -#else +#ifdef HAVE_STRUCT_MTD_WRITE_REQ + +# include <errno.h> +# include <inttypes.h> +# include <stdio.h> +# include <string.h> +# include <sys/ioctl.h> +# include <linux/ioctl.h> +# include <linux/version.h> # include <mtd/mtd-abi.h> -#endif static const unsigned long lmagic = (unsigned long) 0xdeadbeefbadc0dedULL; -#define TEST_NULL_ARG(cmd) \ +# define TEST_NULL_ARG(cmd) \ do { \ ioctl(-1, cmd, 0); \ if (_IOC_DIR(cmd) == _IOC_WRITE) \ @@ -60,7 +58,7 @@ static const unsigned long lmagic = (unsigned long) 0xdeadbeefbadc0dedULL; printf("ioctl(-1, %s, NULL) = -1 EBADF (%m)\n", #cmd); \ } while (0) -#define TEST_erase_info_user(cmd, eiu) \ +# define TEST_erase_info_user(cmd, eiu) \ do { \ ioctl(-1, cmd, eiu); \ printf("ioctl(-1, MIXER_%s(%u) or %s, {start=%#x, length=%#x})" \ @@ -122,9 +120,9 @@ main(void) ioctl(-1, MEMGETREGIONINFO, riu); printf("ioctl(-1, %s, {regionindex=%#x}) = -1 EBADF (%m)\n", "MEMGETREGIONINFO" -#ifdef __i386__ +# ifdef __i386__ " or MTRRIOC_GET_PAGE_ENTRY" -#endif +# endif , riu->regionindex); TAIL_ALLOC_OBJECT_CONST_PTR(struct erase_info_user, eiu); @@ -198,3 +196,9 @@ main(void) puts("+++ exited with 0 +++"); return 0; } + +#else + +SKIP_MAIN_UNDEFINED("HAVE_STRUCT_MTD_WRITE_REQ") + +#endif diff --git a/tests/ioctl_mtd.gen.test b/tests/ioctl_mtd.gen.test index cbc31047..65b00037 100755 --- a/tests/ioctl_mtd.gen.test +++ b/tests/ioctl_mtd.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_mtd +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_mtd +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests/ioctl_nsfs.gen.test b/tests/ioctl_nsfs.gen.test new file mode 100755 index 00000000..f9adc5f0 --- /dev/null +++ b/tests/ioctl_nsfs.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_nsfs +ioctl.test -esignal=none); do not edit. +set -- -esignal=none +. "${srcdir=.}/ioctl.test" diff --git a/tests/ioctl_nsfs.test b/tests/ioctl_nsfs.test deleted file mode 100755 index acdfb618..00000000 --- a/tests/ioctl_nsfs.test +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# Check decoding of NS_* ioctls. - -. "${srcdir=.}/init.sh" - -check_prog grep -run_prog > /dev/null -run_strace -a16 -eioctl -esignal=none $args > "$EXP" -grep -v '^ioctl([012],' < "$LOG" > "$OUT" -match_diff "$OUT" "$EXP" diff --git a/tests/ioctl_rtc-v.gen.test b/tests/ioctl_rtc-v.gen.test index b534a025..820181b0 100755 --- a/tests/ioctl_rtc-v.gen.test +++ b/tests/ioctl_rtc-v.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_rtc-v +ioctl-v.sh); do not edit. -. "${srcdir=.}/ioctl-v.sh" +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_rtc-v +ioctl.test -v); do not edit. +set -- -v +. "${srcdir=.}/ioctl.test" diff --git a/tests/ioctl_rtc.gen.test b/tests/ioctl_rtc.gen.test index e430a82c..310b5588 100755 --- a/tests/ioctl_rtc.gen.test +++ b/tests/ioctl_rtc.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_rtc +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_rtc +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests/ioctl_scsi.gen.test b/tests/ioctl_scsi.gen.test index 23ac307b..499bfc49 100755 --- a/tests/ioctl_scsi.gen.test +++ b/tests/ioctl_scsi.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_scsi +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_scsi +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests/ioctl_sg_io_v3.gen.test b/tests/ioctl_sg_io_v3.gen.test index e7e5ea50..ef8fd14d 100755 --- a/tests/ioctl_sg_io_v3.gen.test +++ b/tests/ioctl_sg_io_v3.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_sg_io_v3 +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_sg_io_v3 +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests/ioctl_sg_io_v4.gen.test b/tests/ioctl_sg_io_v4.gen.test index 575ad96a..4aa4e4e9 100755 --- a/tests/ioctl_sg_io_v4.gen.test +++ b/tests/ioctl_sg_io_v4.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_sg_io_v4 +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_sg_io_v4 +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests/ioctl_sock_gifconf.gen.test b/tests/ioctl_sock_gifconf.gen.test new file mode 100755 index 00000000..5d6fe2f4 --- /dev/null +++ b/tests/ioctl_sock_gifconf.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_sock_gifconf +ioctl.test -a28 -s1); do not edit. +set -- -a28 -s1 +. "${srcdir=.}/ioctl.test" diff --git a/tests/ioctl_sock_gifconf.test b/tests/ioctl_sock_gifconf.test deleted file mode 100755 index 22d7ea46..00000000 --- a/tests/ioctl_sock_gifconf.test +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# Check decoding of SIOCGIFCONF ioctl. - -. "${srcdir=.}/init.sh" - -check_prog grep -run_prog > /dev/null -run_strace -a28 -s1 -eioctl $args > "$EXP" -grep -v '^ioctl([012],' < "$LOG" > "$OUT" -match_diff "$OUT" "$EXP" diff --git a/tests/ioctl_uffdio.gen.test b/tests/ioctl_uffdio.gen.test index 80fd2a64..ed73c5f0 100755 --- a/tests/ioctl_uffdio.gen.test +++ b/tests/ioctl_uffdio.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_uffdio +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_uffdio +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests/ioctl_v4l2.gen.test b/tests/ioctl_v4l2.gen.test index cbd36ba6..4c571447 100755 --- a/tests/ioctl_v4l2.gen.test +++ b/tests/ioctl_v4l2.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_v4l2 +ioctl.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioctl_v4l2 +ioctl.test ); do not edit. +set -- . "${srcdir=.}/ioctl.test" diff --git a/tests/ioperm.gen.test b/tests/ioperm.gen.test index 154d60ae..bc69f69e 100755 --- a/tests/ioperm.gen.test +++ b/tests/ioperm.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioperm -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ioperm -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests/iopl.gen.test b/tests/iopl.gen.test index 3d9704cb..f7769d23 100755 --- a/tests/iopl.gen.test +++ b/tests/iopl.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (iopl -a8); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (iopl -a8 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a8 +run_strace_match_diff -a8 diff --git a/tests/ip_mreq.c b/tests/ip_mreq.c index 3f4648ca..12cc2611 100644 --- a/tests/ip_mreq.c +++ b/tests/ip_mreq.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2015-2017 The strace developers. + * Copyright (c) 2015-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,9 +32,9 @@ #if defined IP_ADD_MEMBERSHIP && defined IPV6_ADD_MEMBERSHIP \ && defined IPV6_JOIN_ANYCAST +# include <limits.h> # include <stdio.h> # include <unistd.h> -# include <sys/param.h> # include <sys/socket.h> # include <arpa/inet.h> # include <net/if.h> diff --git a/tests/ipc.gen.test b/tests/ipc.gen.test index 5ed1f0d2..0aa75789 100755 --- a/tests/ipc.gen.test +++ b/tests/ipc.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ipc -a19); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ipc -a19 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a19 +run_strace_match_diff -a19 diff --git a/tests/ipc_msg.gen.test b/tests/ipc_msg.gen.test index f4fec80b..b1f1f7e8 100755 --- a/tests/ipc_msg.gen.test +++ b/tests/ipc_msg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ipc_msg +ipc.sh); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ipc_msg +ipc.sh ); do not edit. +set -- . "${srcdir=.}/ipc.sh" diff --git a/tests/ipc_msgbuf.c b/tests/ipc_msgbuf.c index d1083899..c4af1bef 100644 --- a/tests/ipc_msgbuf.c +++ b/tests/ipc_msgbuf.c @@ -38,11 +38,16 @@ static int msqid = -1; -static void +static int cleanup(void) { - msgctl(msqid, IPC_RMID, 0); - msqid = -1; + if (msqid != -1) { + int rc = msgctl(msqid, IPC_RMID, 0); + msqid = -1; + if (rc == -1) + return 77; + } + return 0; } int @@ -59,10 +64,11 @@ main(void) msqid = msgget(IPC_PRIVATE, IPC_CREAT | S_IRWXU); if (msqid == -1) perror_msg_and_skip("msgget"); - atexit(cleanup); + typedef void (*atexit_func)(void); + atexit((atexit_func) cleanup); if (msgsnd(msqid, &msg, msgsz, 0) == -1) perror_msg_and_skip("msgsnd"); if (msgrcv(msqid, &msg, msgsz, mtype, 0) != msgsz) perror_msg_and_skip("msgrcv"); - return 0; + return cleanup(); } diff --git a/tests/ipc_sem.gen.test b/tests/ipc_sem.gen.test index 54159a64..a1c03d2b 100755 --- a/tests/ipc_sem.gen.test +++ b/tests/ipc_sem.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ipc_sem +ipc.sh); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ipc_sem +ipc.sh ); do not edit. +set -- . "${srcdir=.}/ipc.sh" diff --git a/tests/ipc_shm.c b/tests/ipc_shm.c index 66960ff9..c7931388 100644 --- a/tests/ipc_shm.c +++ b/tests/ipc_shm.c @@ -1,6 +1,7 @@ /* * Copyright (c) 2015 Elvira Khabirova <lineprinter0@gmail.com> * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2015-2017 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,6 +33,14 @@ #include <stdlib.h> #include <sys/shm.h> +#ifndef SHM_HUGE_SHIFT +# define SHM_HUGE_SHIFT 26 +#endif + +#ifndef SHM_HUGE_MASK +# define SHM_HUGE_MASK 0x3f +#endif + #include "xlat.h" #include "xlat/shm_resource_flags.h" @@ -64,18 +73,54 @@ main(void) #else (size_t) 0x1e55c0de5dec0dedULL; #endif - static const int bogus_flags = 0xface1e55; - + static const unsigned int bogus_ipc_shm_flags = + IPC_CREAT | IPC_EXCL | SHM_HUGETLB | SHM_NORESERVE; + static const unsigned int huge_mask = SHM_HUGE_MASK << SHM_HUGE_SHIFT; + static const unsigned int huge_flags = 21 << SHM_HUGE_SHIFT; + int bogus_flags; int rc; struct shmid_ds ds; + rc = shmget(bogus_key, bogus_size, 0); + printf("shmget\\(%#llx, %zu, 000\\) += %s\n", + zero_extend_signed_to_ull(bogus_key), bogus_size, + sprintrc_grep(rc)); + + rc = shmget(bogus_key, bogus_size, huge_flags); + printf("shmget\\(%#llx, %zu, %s\\|%#03o\\) += %s\n", + zero_extend_signed_to_ull(bogus_key), bogus_size, + "21<<SHM_HUGE_SHIFT", 0, sprintrc_grep(rc)); + + bogus_flags = 0xface1e55 & ~(bogus_ipc_shm_flags | huge_mask); + rc = shmget(bogus_key, bogus_size, bogus_flags); + printf("shmget\\(%#llx, %zu, %#x\\|%#03o\\) += %s\n", + zero_extend_signed_to_ull(bogus_key), bogus_size, + bogus_flags & ~0777, + bogus_flags & 0777, sprintrc_grep(rc)); + + bogus_flags |= bogus_ipc_shm_flags; + rc = shmget(bogus_key, bogus_size, bogus_flags); + printf("shmget\\(%#llx, %zu, %s\\|%#x\\|%#03o\\) += %s\n", + zero_extend_signed_to_ull(bogus_key), bogus_size, + "IPC_CREAT\\|IPC_EXCL\\|SHM_HUGETLB\\|SHM_NORESERVE", + bogus_flags & ~(0777 | bogus_ipc_shm_flags), + bogus_flags & 0777, sprintrc_grep(rc)); + + bogus_flags |= huge_flags; + rc = shmget(bogus_key, bogus_size, bogus_flags); + printf("shmget\\(%#llx, %zu, %s\\|%#x\\|%s\\|%#03o\\) += %s\n", + zero_extend_signed_to_ull(bogus_key), bogus_size, + "IPC_CREAT\\|IPC_EXCL\\|SHM_HUGETLB\\|SHM_NORESERVE", + bogus_flags & ~(0777 | bogus_ipc_shm_flags | huge_mask), + "21<<SHM_HUGE_SHIFT", + bogus_flags & 0777, sprintrc_grep(rc)); + + bogus_flags &= ~bogus_ipc_shm_flags; rc = shmget(bogus_key, bogus_size, bogus_flags); - printf("shmget\\(%#llx, %zu, %s%s%s%#x\\|%#04o\\) += %s\n", + printf("shmget\\(%#llx, %zu, %#x\\|%s\\|%#03o\\) += %s\n", zero_extend_signed_to_ull(bogus_key), bogus_size, - IPC_CREAT & bogus_flags ? "IPC_CREAT\\|" : "", - IPC_EXCL & bogus_flags ? "IPC_EXCL\\|" : "", - SHM_HUGETLB & bogus_flags ? "SHM_HUGETLB\\|" : "", - bogus_flags & ~(0777 | IPC_CREAT | IPC_EXCL | SHM_HUGETLB), + bogus_flags & ~(0777 | huge_mask), + "21<<SHM_HUGE_SHIFT", bogus_flags & 0777, sprintrc_grep(rc)); id = shmget(private_key, 1, 0600); diff --git a/tests/ipc_shm.gen.test b/tests/ipc_shm.gen.test index 505eabaf..8c6df9b3 100755 --- a/tests/ipc_shm.gen.test +++ b/tests/ipc_shm.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ipc_shm +ipc.sh); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ipc_shm +ipc.sh ); do not edit. +set -- . "${srcdir=.}/ipc.sh" diff --git a/tests/kcmp.gen.test b/tests/kcmp.gen.test index c073a39e..139e909b 100755 --- a/tests/kcmp.gen.test +++ b/tests/kcmp.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (kcmp -a22); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (kcmp -a22 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a22 +run_strace_match_diff -a22 diff --git a/tests/kexec_file_load.gen.test b/tests/kexec_file_load.gen.test index aefaab38..11013497 100755 --- a/tests/kexec_file_load.gen.test +++ b/tests/kexec_file_load.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (kexec_file_load -s9); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (kexec_file_load -s9 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -s9 +run_strace_match_diff -s9 diff --git a/tests/kexec_load.gen.test b/tests/kexec_load.gen.test index 0af95271..6ce18317 100755 --- a/tests/kexec_load.gen.test +++ b/tests/kexec_load.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (kexec_load -s9); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (kexec_load -s9 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -s9 +run_strace_match_diff -s9 diff --git a/tests/lchown.gen.test b/tests/lchown.gen.test index b31e29d1..d346c76d 100755 --- a/tests/lchown.gen.test +++ b/tests/lchown.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (lchown -a30); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (lchown -a30 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a30 +run_strace_match_diff -a30 diff --git a/tests/lchown32.gen.test b/tests/lchown32.gen.test index 83be4bca..5da2349c 100755 --- a/tests/lchown32.gen.test +++ b/tests/lchown32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (lchown32 -a32); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (lchown32 -a32 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a32 +run_strace_match_diff -a32 diff --git a/tests/link.gen.test b/tests/link.gen.test index b6db34d0..2ec3f5b8 100755 --- a/tests/link.gen.test +++ b/tests/link.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (link ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (link ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/linkat.gen.test b/tests/linkat.gen.test index 54b12b94..8bdf78b4 100755 --- a/tests/linkat.gen.test +++ b/tests/linkat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (linkat ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (linkat ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/llseek.test b/tests/llseek.test index 8dcd65d6..9db68e3a 100755 --- a/tests/llseek.test +++ b/tests/llseek.test @@ -7,5 +7,5 @@ check_prog grep run_prog > /dev/null run_strace -e_llseek $args > "$EXP" -grep -v '^lseek([0-9]' < "$LOG" > "$OUT" +grep -v '^_llseek([0-9]' < "$LOG" > "$OUT" match_diff "$OUT" "$EXP" diff --git a/tests/lookup_dcookie.gen.test b/tests/lookup_dcookie.gen.test index 6357e19d..616c7057 100755 --- a/tests/lookup_dcookie.gen.test +++ b/tests/lookup_dcookie.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (lookup_dcookie -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (lookup_dcookie -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests/madvise.gen.test b/tests/madvise.gen.test index bd36dada..a549cf94 100755 --- a/tests/madvise.gen.test +++ b/tests/madvise.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (madvise -a33); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (madvise -a33 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a33 +run_strace_match_diff -a33 diff --git a/tests/mbind.gen.test b/tests/mbind.gen.test index a0d144df..c47e0fc1 100755 --- a/tests/mbind.gen.test +++ b/tests/mbind.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mbind ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mbind ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/membarrier.c b/tests/membarrier.c index 73dd3b02..43f99f88 100644 --- a/tests/membarrier.c +++ b/tests/membarrier.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2015-2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2015-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,28 +45,49 @@ main(void) printf("membarrier(0x3 /* MEMBARRIER_CMD_??? */, 255) = %s\n", sprintrc(-1)); if (saved_errno != ENOSYS) { + const char *text_global; const char *text; int rc = syscall(__NR_membarrier, 0, 0); - switch (rc) { - case 1: - text = "MEMBARRIER_CMD_SHARED"; + assert(rc >= 0); + + text_global = rc & 1 ? "MEMBARRIER_CMD_GLOBAL" : ""; + + switch (rc & ~1) { + case 0: + text = ""; break; - case 1|8: - text = "MEMBARRIER_CMD_SHARED|" - "MEMBARRIER_CMD_PRIVATE_EXPEDITED"; + case 8: + text = "MEMBARRIER_CMD_PRIVATE_EXPEDITED"; break; - case 1|8|16: - text = "MEMBARRIER_CMD_SHARED|" + case 8|16: + text = "MEMBARRIER_CMD_PRIVATE_EXPEDITED|" + "MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED"; + break; + + case 2|4|8|16: + text = "MEMBARRIER_CMD_GLOBAL_EXPEDITED|" + "MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED|" "MEMBARRIER_CMD_PRIVATE_EXPEDITED|" "MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED"; break; + + case 2|4|8|16|32|64: + text = "MEMBARRIER_CMD_GLOBAL_EXPEDITED|" + "MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED|" + "MEMBARRIER_CMD_PRIVATE_EXPEDITED|" + "MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED|" + "MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE|" + "MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE"; + break; + default: error_msg_and_fail("membarrier returned %#x, does" " the test have to be updated?", rc); } - printf("membarrier(MEMBARRIER_CMD_QUERY, 0) = %#x (%s)\n", - rc, text); + printf("membarrier(MEMBARRIER_CMD_QUERY, 0) = %#x (%s%s%s)\n", + rc, text_global, text[0] && text_global[0] ? "|" : "", + text); } puts("+++ exited with 0 +++"); return 0; diff --git a/tests/membarrier.gen.test b/tests/membarrier.gen.test index 7a6ea10d..6ae6e915 100755 --- a/tests/membarrier.gen.test +++ b/tests/membarrier.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (membarrier -a36); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (membarrier -a36 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a36 +run_strace_match_diff -a36 diff --git a/tests/memfd_create.c b/tests/memfd_create.c index 4559b426..8334af84 100644 --- a/tests/memfd_create.c +++ b/tests/memfd_create.c @@ -1,3 +1,32 @@ +/* + * Check decoding of memfd_create syscall. + * + * Copyright (c) 2015-2017 Dmitry V. Levin <ldv@altlinux.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + #include "tests.h" #include <asm/unistd.h> #include "scno.h" @@ -5,17 +34,62 @@ #ifdef __NR_memfd_create # include <stdio.h> +# include <stdint.h> # include <unistd.h> +# ifdef HAVE_LINUX_MEMFD_H +# include <linux/memfd.h> +# endif + +# ifndef MFD_HUGE_SHIFT +# define MFD_HUGE_SHIFT 26 +# endif + +# ifndef MFD_HUGE_MASK +# define MFD_HUGE_MASK 0x3f +# endif + +static const char *errstr; + +static long +k_memfd_create(const kernel_ulong_t name, const kernel_ulong_t flags) +{ + const long rc = syscall(__NR_memfd_create, name, flags); + errstr = sprintrc(rc); + return rc; +} + int main(void) { - static const char text[] = "strace"; - int rc = syscall(__NR_memfd_create, text, 0xf); + const size_t size = 255 - (sizeof("memfd:") - 1) + 1; + char *pattern = tail_alloc(size); + fill_memory_ex(pattern, size, '0', 10); + + k_memfd_create((uintptr_t) pattern, 0); + printf("memfd_create(\"%.*s\"..., 0) = %s\n", + (int) size - 1, pattern, errstr); + + kernel_ulong_t flags = (kernel_ulong_t) 0xfacefeed00000007ULL; + k_memfd_create((uintptr_t) pattern, flags); + printf("memfd_create(\"%.*s\"..., %s) = %s\n", + (int) size - 1, pattern, + "MFD_CLOEXEC|MFD_ALLOW_SEALING|MFD_HUGETLB", + errstr); + + pattern[size - 1] = '\0'; + flags = 30 << MFD_HUGE_SHIFT; + k_memfd_create((uintptr_t) pattern, flags); + printf("memfd_create(\"%s\", 30<<MFD_HUGE_SHIFT) = %s\n", + pattern, errstr); - printf("memfd_create(\"%s\", %s) = %s\n", - text, "MFD_CLOEXEC|MFD_ALLOW_SEALING|MFD_HUGETLB|0x8", - sprintrc(rc)); + pattern += size - 1; + flags = (kernel_ulong_t) -1ULL; + k_memfd_create(0, flags); + flags = -1U & ~(7 | (MFD_HUGE_MASK << MFD_HUGE_SHIFT)); + printf("memfd_create(NULL, MFD_CLOEXEC|MFD_ALLOW_SEALING|MFD_HUGETLB" + "|%#x|%u<<MFD_HUGE_SHIFT) = %s\n", + (unsigned int) flags, MFD_HUGE_MASK, errstr); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/memfd_create.gen.test b/tests/memfd_create.gen.test index 11762bea..ccb5b52e 100755 --- a/tests/memfd_create.gen.test +++ b/tests/memfd_create.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (memfd_create ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (memfd_create ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/migrate_pages.gen.test b/tests/migrate_pages.gen.test index 20b7cad9..0ea017d0 100755 --- a/tests/migrate_pages.gen.test +++ b/tests/migrate_pages.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (migrate_pages -a33); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (migrate_pages -a33 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a33 +run_strace_match_diff -a33 diff --git a/tests/mincore.gen.test b/tests/mincore.gen.test index dc407261..45e43e25 100755 --- a/tests/mincore.gen.test +++ b/tests/mincore.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mincore -a22); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mincore -a22 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a22 +run_strace_match_diff -a22 diff --git a/tests/mkdir.gen.test b/tests/mkdir.gen.test index 80b49957..8d34c8b2 100755 --- a/tests/mkdir.gen.test +++ b/tests/mkdir.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mkdir -a20); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mkdir -a20 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a20 +run_strace_match_diff -a20 diff --git a/tests/mkdirat.gen.test b/tests/mkdirat.gen.test index 0f3fdae2..eef8e526 100755 --- a/tests/mkdirat.gen.test +++ b/tests/mkdirat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mkdirat -a28); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mkdirat -a28 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a28 +run_strace_match_diff -a28 diff --git a/tests/mknod.gen.test b/tests/mknod.gen.test index 870c88b4..ce08e99f 100755 --- a/tests/mknod.gen.test +++ b/tests/mknod.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mknod -a18); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mknod -a18 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a18 +run_strace_match_diff -a18 diff --git a/tests/mknodat.gen.test b/tests/mknodat.gen.test index 747fcbee..dce7d449 100755 --- a/tests/mknodat.gen.test +++ b/tests/mknodat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mknodat -a35); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mknodat -a35 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a35 +run_strace_match_diff -a35 diff --git a/tests/mlock2.gen.test b/tests/mlock2.gen.test index aa1818e1..ff94eb89 100755 --- a/tests/mlock2.gen.test +++ b/tests/mlock2.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mlock2 ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mlock2 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/mlockall.gen.test b/tests/mlockall.gen.test index 06d8ca44..59ef67f8 100755 --- a/tests/mlockall.gen.test +++ b/tests/mlockall.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mlockall -a12); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mlockall -a12 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a12 +run_strace_match_diff -a12 diff --git a/tests/mmap64.gen.test b/tests/mmap64.gen.test index 5e747b02..0ecd5294 100755 --- a/tests/mmap64.gen.test +++ b/tests/mmap64.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mmap64 +mmap.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mmap64 +mmap.test ); do not edit. +set -- . "${srcdir=.}/mmap.test" diff --git a/tests/modify_ldt.c b/tests/modify_ldt.c new file mode 100644 index 00000000..1e26bda4 --- /dev/null +++ b/tests/modify_ldt.c @@ -0,0 +1,137 @@ +/* + * Check decoding of modify_ldt syscall. + * + * Copyright (c) 2018 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" + +#include <asm/unistd.h> + +#if defined __NR_modify_ldt && defined HAVE_STRUCT_USER_DESC + +# include <errno.h> +# include <stdio.h> +# include <unistd.h> + +# include "print_user_desc.c" + +void +printrc(long rc) +{ +#ifdef __x86_64__ + int err = -rc; + + /* Thanks, long return type of syscall(2) */ + printf("%lld", zero_extend_signed_to_ull(rc)); + + if (err > 0 && err < 0x1000) { + errno = err; + printf(" %s (%m)", errno2name()); + } +#else + printf("%s", sprintrc(rc)); +#endif + + puts(""); +} + +int +main(void) +{ + static const kernel_ulong_t bogus_func = + (kernel_ulong_t) 0xbadc0dedda7a1057ULL; + static const kernel_ulong_t bogus_bytecount = + (kernel_ulong_t) 0xdeadfacefa57beefULL; + + struct user_desc *us = tail_alloc(sizeof(*us)); + unsigned int *bogus_int = tail_alloc(sizeof(*bogus_int)); + long rc; + + fill_memory(us, sizeof(*us)); + + rc = syscall(__NR_modify_ldt, 0, 0, 0); + printf("modify_ldt(0, NULL, 0) = "); + printrc(rc); + + rc = syscall(__NR_modify_ldt, bogus_func, (kernel_long_t) -1, + bogus_bytecount); + printf("modify_ldt(%d, %#llx, %llu) = ", + (int) bogus_func, + zero_extend_signed_to_ull((kernel_long_t) -1), + (unsigned long long) bogus_bytecount); + printrc(rc); + + rc = syscall(__NR_modify_ldt, bogus_func, us + 1, 0); + printf("modify_ldt(%d, %p, 0) = ", (int) bogus_func, us + 1); + printrc(rc); + + rc = syscall(__NR_modify_ldt, bogus_func, us, 42); + printf("modify_ldt(%d, %p, 42) = ", (int) bogus_func, us); + printrc(rc); + + rc = syscall(__NR_modify_ldt, bogus_func, us + 1, sizeof(*us)); + printf("modify_ldt(%d, %p, %zu) = ", + (int) bogus_func, us + 1, sizeof(*us)); + printrc(rc); + + /* + * print_user_desc handles entry_number field in a special way for + * get_thread_area syscall, so let's also check here that we don't + * retrieve it accidentally. + */ + rc = syscall(__NR_modify_ldt, bogus_func, bogus_int, sizeof(*us)); + printf("modify_ldt(%d, %p, %zu) = ", + (int) bogus_func, bogus_int, sizeof(*us)); + printrc(rc); + + rc = syscall(__NR_modify_ldt, bogus_func, us, sizeof(*us)); + printf("modify_ldt(%d, ", (int) bogus_func); + print_user_desc(us, NULL); + printf(", %zu) = ", sizeof(*us)); + printrc(rc); + + fill_memory_ex(us, sizeof(*us), 0x55, 80); + us->entry_number = -1; + us->base_addr = 0; + us->limit = 0; + + rc = syscall(__NR_modify_ldt, bogus_func, us, sizeof(*us)); + printf("modify_ldt(%d, ", (int) bogus_func); + print_user_desc(us, "-1"); + printf(", %zu) = ", sizeof(*us)); + printrc(rc); + + puts("+++ exited with 0 +++"); + + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_modify_ldt && HAVE_STRUCT_USER_DESC"); + +#endif diff --git a/tests/modify_ldt.gen.test b/tests/modify_ldt.gen.test new file mode 100755 index 00000000..1a85b067 --- /dev/null +++ b/tests/modify_ldt.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (modify_ldt -a23 ); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a23 diff --git a/tests/mount.gen.test b/tests/mount.gen.test index 0b124bc2..69bc99be 100755 --- a/tests/mount.gen.test +++ b/tests/mount.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mount ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (mount ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/move_pages.gen.test b/tests/move_pages.gen.test index 2f060fa8..9d472ef9 100755 --- a/tests/move_pages.gen.test +++ b/tests/move_pages.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (move_pages -s3); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (move_pages -s3 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -s3 +run_strace_match_diff -s3 diff --git a/tests/munlockall.gen.test b/tests/munlockall.gen.test index 18343cba..2e4e0c4f 100755 --- a/tests/munlockall.gen.test +++ b/tests/munlockall.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (munlockall -a13); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (munlockall -a13 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a13 +run_strace_match_diff -a13 diff --git a/tests/nanosleep.gen.test b/tests/nanosleep.gen.test index ea5b19ae..41928ded 100755 --- a/tests/nanosleep.gen.test +++ b/tests/nanosleep.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nanosleep -a20); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nanosleep -a20 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a20 +run_strace_match_diff -a20 diff --git a/tests/net-accept-connect.c b/tests/net-accept-connect.c index 4045e056..0756c9be 100644 --- a/tests/net-accept-connect.c +++ b/tests/net-accept-connect.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2013-2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2013-2017 The strace developers. + * Copyright (c) 2013-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,15 +49,16 @@ main(int ac, const char **av) struct sockaddr_un addr = { .sun_family = AF_UNIX, }; - socklen_t len; assert(ac == 2); - assert(strlen(av[1]) > 0); + socklen_t len = strlen(av[1]); + assert(len > 0 && len <= sizeof(addr.sun_path)); - strncpy(addr.sun_path, av[1], sizeof(addr.sun_path)); - len = offsetof(struct sockaddr_un, sun_path) + strlen(av[1]) + 1; - if (len > sizeof(addr)) - len = sizeof(addr); + if (++len > sizeof(addr.sun_path)) + len = sizeof(addr.sun_path); + + memcpy(addr.sun_path, av[1], len); + len += offsetof(struct sockaddr_un, sun_path); unlink(av[1]); close(0); diff --git a/tests/net-y-unix.c b/tests/net-y-unix.c index fbdf5900..847c7354 100644 --- a/tests/net-y-unix.c +++ b/tests/net-y-unix.c @@ -2,6 +2,7 @@ * This file is part of net-y-unix strace test. * * Copyright (c) 2013-2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,10 +35,11 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <sys/param.h> #include <sys/socket.h> #include <sys/un.h> +#include "accept_compat.h" + #define TEST_SOCKET "net-y-unix.socket" int @@ -106,7 +108,7 @@ main(void) struct sockaddr * const accept_sa = tail_alloc(sizeof(addr)); memset(accept_sa, 0, sizeof(addr)); *len = sizeof(addr); - int accept_fd = accept(listen_fd, accept_sa, len); + int accept_fd = do_accept(listen_fd, accept_sa, len); if (accept_fd < 0) perror_msg_and_fail("accept"); unsigned long accept_inode = inode_of_sockfd(accept_fd); @@ -177,7 +179,7 @@ main(void) memset(accept_sa, 0, sizeof(addr)); *len = sizeof(addr); - accept_fd = accept(listen_fd, accept_sa, len); + accept_fd = do_accept(listen_fd, accept_sa, len); if (accept_fd < 0) perror_msg_and_fail("accept"); accept_inode = inode_of_sockfd(accept_fd); diff --git a/tests/net-yy-inet.c b/tests/net-yy-inet.c index c043920d..c69bb173 100644 --- a/tests/net-yy-inet.c +++ b/tests/net-yy-inet.c @@ -2,7 +2,7 @@ * This file is part of net-yy-inet strace test. * * Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,6 +39,8 @@ #include <netinet/tcp.h> #include <arpa/inet.h> +#include "accept_compat.h" + int main(void) { @@ -105,7 +107,7 @@ main(void) struct sockaddr * const accept_sa = tail_alloc(sizeof(addr)); memset(accept_sa, 0, sizeof(addr)); *len = sizeof(addr); - const int accept_fd = accept(listen_fd, accept_sa, len); + const int accept_fd = do_accept(listen_fd, accept_sa, len); if (accept_fd < 0) perror_msg_and_fail("accept"); const unsigned int connect_port = diff --git a/tests/net-yy-unix.c b/tests/net-yy-unix.c index 21822db9..40ac3a63 100644 --- a/tests/net-yy-unix.c +++ b/tests/net-yy-unix.c @@ -2,6 +2,7 @@ * This file is part of net-yy-unix strace test. * * Copyright (c) 2013-2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,10 +35,11 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <sys/param.h> #include <sys/socket.h> #include <sys/un.h> +#include "accept_compat.h" + #define TEST_SOCKET "net-yy-unix.socket" int @@ -107,7 +109,7 @@ main(void) struct sockaddr * const accept_sa = tail_alloc(sizeof(addr)); memset(accept_sa, 0, sizeof(addr)); *len = sizeof(addr); - int accept_fd = accept(listen_fd, accept_sa, len); + int accept_fd = do_accept(listen_fd, accept_sa, len); if (accept_fd < 0) perror_msg_and_fail("accept"); unsigned long accept_inode = inode_of_sockfd(accept_fd); @@ -180,7 +182,7 @@ main(void) memset(accept_sa, 0, sizeof(addr)); *len = sizeof(addr); - accept_fd = accept(listen_fd, accept_sa, len); + accept_fd = do_accept(listen_fd, accept_sa, len); if (accept_fd < 0) perror_msg_and_fail("accept"); accept_inode = inode_of_sockfd(accept_fd); diff --git a/tests/net.expected b/tests/net.expected index 80dd0701..e33e2966 100644 --- a/tests/net.expected +++ b/tests/net.expected @@ -3,5 +3,5 @@ [1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +bind\(0, \{sa_family=AF_(LOCAL|UNIX|FILE), sun_path="net-local-stream"\}, 19\) += 0 [1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +listen\(0, 5\) += 0 [1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +getsockname\(0, \{sa_family=AF_(LOCAL|UNIX|FILE), sun_path="net-local-stream"\}, \[19\]\) += 0 -[1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +accept\(0, \{sa_family=AF_(LOCAL|UNIX|FILE)\}, \[19->2\]\) += 1 +[1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +accept4?\(0, \{sa_family=AF_(LOCAL|UNIX|FILE)\}, \[19->2\](, 0)?\) += 1 [1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +connect\(1, \{sa_family=AF_(LOCAL|UNIX|FILE), sun_path="net-local-stream"\}, 19\) += 0 diff --git a/tests/netlink_audit.gen.test b/tests/netlink_audit.gen.test index 65110672..5c17038e 100755 --- a/tests/netlink_audit.gen.test +++ b/tests/netlink_audit.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_audit +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_audit +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/netlink_crypto.gen.test b/tests/netlink_crypto.gen.test index b1380991..fcb4c3d9 100755 --- a/tests/netlink_crypto.gen.test +++ b/tests/netlink_crypto.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_crypto +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_crypto +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/netlink_generic.gen.test b/tests/netlink_generic.gen.test index e51f15ce..6f304d3a 100755 --- a/tests/netlink_generic.gen.test +++ b/tests/netlink_generic.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_generic +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_generic +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/netlink_kobject_uevent.gen.test b/tests/netlink_kobject_uevent.gen.test index 310a70b8..46bdebd1 100755 --- a/tests/netlink_kobject_uevent.gen.test +++ b/tests/netlink_kobject_uevent.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_kobject_uevent +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_kobject_uevent +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/netlink_netfilter.gen.test b/tests/netlink_netfilter.gen.test index fffb72b4..94b3f369 100755 --- a/tests/netlink_netfilter.gen.test +++ b/tests/netlink_netfilter.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_netfilter +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_netfilter +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/netlink_route.gen.test b/tests/netlink_route.gen.test index 298dbf1a..bd9c0d95 100755 --- a/tests/netlink_route.gen.test +++ b/tests/netlink_route.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_route +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_route +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/netlink_selinux.gen.test b/tests/netlink_selinux.gen.test index a8871d6d..484ffae7 100755 --- a/tests/netlink_selinux.gen.test +++ b/tests/netlink_selinux.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_selinux +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_selinux +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/netlink_xfrm.gen.test b/tests/netlink_xfrm.gen.test index 17f7444b..36918982 100755 --- a/tests/netlink_xfrm.gen.test +++ b/tests/netlink_xfrm.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_xfrm +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (netlink_xfrm +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nfnetlink_acct.gen.test b/tests/nfnetlink_acct.gen.test index 7db22769..e3aa8892 100755 --- a/tests/nfnetlink_acct.gen.test +++ b/tests/nfnetlink_acct.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_acct +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_acct +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nfnetlink_cthelper.gen.test b/tests/nfnetlink_cthelper.gen.test index 661c949c..fa26e14a 100755 --- a/tests/nfnetlink_cthelper.gen.test +++ b/tests/nfnetlink_cthelper.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_cthelper +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_cthelper +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nfnetlink_ctnetlink.gen.test b/tests/nfnetlink_ctnetlink.gen.test index d4c4daaf..9e9ad153 100755 --- a/tests/nfnetlink_ctnetlink.gen.test +++ b/tests/nfnetlink_ctnetlink.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_ctnetlink +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_ctnetlink +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nfnetlink_ctnetlink_exp.gen.test b/tests/nfnetlink_ctnetlink_exp.gen.test index a5d83f9b..4ed3707e 100755 --- a/tests/nfnetlink_ctnetlink_exp.gen.test +++ b/tests/nfnetlink_ctnetlink_exp.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_ctnetlink_exp +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_ctnetlink_exp +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nfnetlink_cttimeout.gen.test b/tests/nfnetlink_cttimeout.gen.test index e197f000..ab42fc78 100755 --- a/tests/nfnetlink_cttimeout.gen.test +++ b/tests/nfnetlink_cttimeout.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_cttimeout +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_cttimeout +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nfnetlink_ipset.gen.test b/tests/nfnetlink_ipset.gen.test index 418437a7..ea129fbc 100755 --- a/tests/nfnetlink_ipset.gen.test +++ b/tests/nfnetlink_ipset.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_ipset +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_ipset +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nfnetlink_nft_compat.gen.test b/tests/nfnetlink_nft_compat.gen.test index c3dc8907..aff04c5f 100755 --- a/tests/nfnetlink_nft_compat.gen.test +++ b/tests/nfnetlink_nft_compat.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_nft_compat +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_nft_compat +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nfnetlink_nftables.gen.test b/tests/nfnetlink_nftables.gen.test index 25e90e85..c23ad330 100755 --- a/tests/nfnetlink_nftables.gen.test +++ b/tests/nfnetlink_nftables.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_nftables +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_nftables +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nfnetlink_osf.gen.test b/tests/nfnetlink_osf.gen.test index 2689574a..aa540907 100755 --- a/tests/nfnetlink_osf.gen.test +++ b/tests/nfnetlink_osf.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_osf +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_osf +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nfnetlink_queue.gen.test b/tests/nfnetlink_queue.gen.test index 739fb17d..965e0d24 100755 --- a/tests/nfnetlink_queue.gen.test +++ b/tests/nfnetlink_queue.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_queue +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_queue +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nfnetlink_ulog.gen.test b/tests/nfnetlink_ulog.gen.test index 850ebafc..825ad9f6 100755 --- a/tests/nfnetlink_ulog.gen.test +++ b/tests/nfnetlink_ulog.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_ulog +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nfnetlink_ulog +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr.gen.test b/tests/nlattr.gen.test index 105801b9..0ea2f185 100755 --- a/tests/nlattr.gen.test +++ b/tests/nlattr.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_br_port_msg.gen.test b/tests/nlattr_br_port_msg.gen.test index f843797a..c9572759 100755 --- a/tests/nlattr_br_port_msg.gen.test +++ b/tests/nlattr_br_port_msg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_br_port_msg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_br_port_msg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_crypto_user_alg.gen.test b/tests/nlattr_crypto_user_alg.gen.test index 81d866e0..e52b6be7 100755 --- a/tests/nlattr_crypto_user_alg.gen.test +++ b/tests/nlattr_crypto_user_alg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_crypto_user_alg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_crypto_user_alg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_dcbmsg.gen.test b/tests/nlattr_dcbmsg.gen.test index d78bfcf6..f9ef39f7 100755 --- a/tests/nlattr_dcbmsg.gen.test +++ b/tests/nlattr_dcbmsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_dcbmsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_dcbmsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_fib_rule_hdr.gen.test b/tests/nlattr_fib_rule_hdr.gen.test index cbdad4d5..fb61343d 100755 --- a/tests/nlattr_fib_rule_hdr.gen.test +++ b/tests/nlattr_fib_rule_hdr.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_fib_rule_hdr +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_fib_rule_hdr +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_ifaddrlblmsg.gen.test b/tests/nlattr_ifaddrlblmsg.gen.test index 0c41dbe5..0f51430f 100755 --- a/tests/nlattr_ifaddrlblmsg.gen.test +++ b/tests/nlattr_ifaddrlblmsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifaddrlblmsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifaddrlblmsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_ifaddrmsg.gen.test b/tests/nlattr_ifaddrmsg.gen.test index d659e001..3fb81bdb 100755 --- a/tests/nlattr_ifaddrmsg.gen.test +++ b/tests/nlattr_ifaddrmsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifaddrmsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifaddrmsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_ifinfomsg.gen.test b/tests/nlattr_ifinfomsg.gen.test index 618df143..b9a6456a 100755 --- a/tests/nlattr_ifinfomsg.gen.test +++ b/tests/nlattr_ifinfomsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifinfomsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifinfomsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_ifla_brport.gen.test b/tests/nlattr_ifla_brport.gen.test index 48bfed4b..6758d8d1 100755 --- a/tests/nlattr_ifla_brport.gen.test +++ b/tests/nlattr_ifla_brport.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifla_brport +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifla_brport +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_ifla_port.gen.test b/tests/nlattr_ifla_port.gen.test index 605bf045..ecea89a4 100755 --- a/tests/nlattr_ifla_port.gen.test +++ b/tests/nlattr_ifla_port.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifla_port +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifla_port +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_ifla_xdp.gen.test b/tests/nlattr_ifla_xdp.gen.test index a30e8436..c6e0fab3 100755 --- a/tests/nlattr_ifla_xdp.gen.test +++ b/tests/nlattr_ifla_xdp.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifla_xdp +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ifla_xdp +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_inet_diag_msg.gen.test b/tests/nlattr_inet_diag_msg.gen.test index 953a7675..953a23df 100755 --- a/tests/nlattr_inet_diag_msg.gen.test +++ b/tests/nlattr_inet_diag_msg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_inet_diag_msg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_inet_diag_msg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_inet_diag_req_compat.gen.test b/tests/nlattr_inet_diag_req_compat.gen.test index bf8b65c8..7b577dc9 100755 --- a/tests/nlattr_inet_diag_req_compat.gen.test +++ b/tests/nlattr_inet_diag_req_compat.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_inet_diag_req_compat +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_inet_diag_req_compat +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_inet_diag_req_v2.gen.test b/tests/nlattr_inet_diag_req_v2.gen.test index 0260bc4a..01c73a13 100755 --- a/tests/nlattr_inet_diag_req_v2.gen.test +++ b/tests/nlattr_inet_diag_req_v2.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_inet_diag_req_v2 +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_inet_diag_req_v2 +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_mdba_mdb_entry.gen.test b/tests/nlattr_mdba_mdb_entry.gen.test index 67253e8e..8d09a033 100755 --- a/tests/nlattr_mdba_mdb_entry.gen.test +++ b/tests/nlattr_mdba_mdb_entry.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_mdba_mdb_entry +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_mdba_mdb_entry +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_mdba_router_port.gen.test b/tests/nlattr_mdba_router_port.gen.test index ce9ea148..97230e84 100755 --- a/tests/nlattr_mdba_router_port.gen.test +++ b/tests/nlattr_mdba_router_port.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_mdba_router_port +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_mdba_router_port +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_ndmsg.gen.test b/tests/nlattr_ndmsg.gen.test index 06b8f1a4..1d2763b0 100755 --- a/tests/nlattr_ndmsg.gen.test +++ b/tests/nlattr_ndmsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ndmsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ndmsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_ndtmsg.gen.test b/tests/nlattr_ndtmsg.gen.test index d75ad57b..bf7d122a 100755 --- a/tests/nlattr_ndtmsg.gen.test +++ b/tests/nlattr_ndtmsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ndtmsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_ndtmsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_netconfmsg.gen.test b/tests/nlattr_netconfmsg.gen.test index 9a061cb4..27f3a66b 100755 --- a/tests/nlattr_netconfmsg.gen.test +++ b/tests/nlattr_netconfmsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_netconfmsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_netconfmsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_netlink_diag_msg.gen.test b/tests/nlattr_netlink_diag_msg.gen.test index aa6aabf4..eacc6df4 100755 --- a/tests/nlattr_netlink_diag_msg.gen.test +++ b/tests/nlattr_netlink_diag_msg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_netlink_diag_msg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_netlink_diag_msg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_nlmsgerr.gen.test b/tests/nlattr_nlmsgerr.gen.test index 23df5001..f06ea429 100755 --- a/tests/nlattr_nlmsgerr.gen.test +++ b/tests/nlattr_nlmsgerr.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_nlmsgerr +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_nlmsgerr +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_packet_diag_msg.gen.test b/tests/nlattr_packet_diag_msg.gen.test index 6af8749a..7177ea2a 100755 --- a/tests/nlattr_packet_diag_msg.gen.test +++ b/tests/nlattr_packet_diag_msg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_packet_diag_msg +netlink_sock_diag-v.sh); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_packet_diag_msg +netlink_sock_diag-v.sh ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag-v.sh" diff --git a/tests/nlattr_rtgenmsg.gen.test b/tests/nlattr_rtgenmsg.gen.test index 0ff6d130..37ec8425 100755 --- a/tests/nlattr_rtgenmsg.gen.test +++ b/tests/nlattr_rtgenmsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_rtgenmsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_rtgenmsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_rtmsg.gen.test b/tests/nlattr_rtmsg.gen.test index 55251431..f075529a 100755 --- a/tests/nlattr_rtmsg.gen.test +++ b/tests/nlattr_rtmsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_rtmsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_rtmsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_smc_diag_msg.gen.test b/tests/nlattr_smc_diag_msg.gen.test index 3e6407e5..e64d21e2 100755 --- a/tests/nlattr_smc_diag_msg.gen.test +++ b/tests/nlattr_smc_diag_msg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_smc_diag_msg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_smc_diag_msg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_tc_stats.gen.test b/tests/nlattr_tc_stats.gen.test index 72780d4a..11cadd2d 100755 --- a/tests/nlattr_tc_stats.gen.test +++ b/tests/nlattr_tc_stats.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_tc_stats +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_tc_stats +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_tca_stab.gen.test b/tests/nlattr_tca_stab.gen.test index 14cd1a54..81d36c70 100755 --- a/tests/nlattr_tca_stab.gen.test +++ b/tests/nlattr_tca_stab.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_tca_stab +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_tca_stab +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_tcamsg.gen.test b/tests/nlattr_tcamsg.gen.test index 7c302073..1a6408d9 100755 --- a/tests/nlattr_tcamsg.gen.test +++ b/tests/nlattr_tcamsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_tcamsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_tcamsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_tcmsg.gen.test b/tests/nlattr_tcmsg.gen.test index f5bf7a92..7e70ca26 100755 --- a/tests/nlattr_tcmsg.gen.test +++ b/tests/nlattr_tcmsg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_tcmsg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_tcmsg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nlattr_unix_diag_msg.gen.test b/tests/nlattr_unix_diag_msg.gen.test index d913afc1..fd5b8286 100755 --- a/tests/nlattr_unix_diag_msg.gen.test +++ b/tests/nlattr_unix_diag_msg.gen.test @@ -1,3 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_unix_diag_msg +netlink_sock_diag.test); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (nlattr_unix_diag_msg +netlink_sock_diag.test ); do not edit. +set -- . "${srcdir=.}/netlink_sock_diag.test" diff --git a/tests/nsyscalls-d.c b/tests/nsyscalls-d.c new file mode 100644 index 00000000..1525dea0 --- /dev/null +++ b/tests/nsyscalls-d.c @@ -0,0 +1,2 @@ +#define DEBUG_PRINT 1 +#include "nsyscalls.c" diff --git a/tests/nsyscalls-d.test b/tests/nsyscalls-d.test new file mode 100755 index 00000000..2cca32f1 --- /dev/null +++ b/tests/nsyscalls-d.test @@ -0,0 +1,26 @@ +#!/bin/sh + +# Check decoding of out-of-range syscalls along with debug ouput + +. "${srcdir=.}/init.sh" + +: ${debug_flag=-d} +NAME=nsyscalls-d + +if [ "$MIPS_ABI" = "o32" ]; then + syscall=syscall + [ -z "$debug_flag" ] || + skip_ "mips $MIPS_ABI is not supported by this test yet" +else + syscall=none +fi + +run_strace $debug_flag -e trace=$syscall ../$NAME "$STRACE_EXE" 9 \ + 2> "$LOG-err-all" > "$EXP" 9> "$EXP-err" + +[ -n "$debug_flag" ] || > "$EXP-err" + +grep "invalid syscall" "$LOG-err-all" > "$LOG-err" + +match_diff "$LOG" "$EXP" +match_diff "$LOG-err" "$EXP-err" diff --git a/tests/nsyscalls-nd.test b/tests/nsyscalls-nd.test new file mode 100755 index 00000000..7d2f1e1f --- /dev/null +++ b/tests/nsyscalls-nd.test @@ -0,0 +1,4 @@ +#!/bin/sh + +debug_flag= +. "${srcdir=.}"/nsyscalls-d.test diff --git a/tests/nsyscalls.c b/tests/nsyscalls.c index 29f444a2..9f748673 100644 --- a/tests/nsyscalls.c +++ b/tests/nsyscalls.c @@ -2,7 +2,7 @@ * Check decoding of out-of-range syscalls. * * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,6 +32,7 @@ #include "sysent.h" #include <errno.h> #include <stdio.h> +#include <stdlib.h> #include <unistd.h> #include <asm/unistd.h> @@ -43,6 +44,10 @@ static const struct_sysent syscallent[] = { #include "sysent_shorthand_undefs.h" +#ifndef DEBUG_PRINT +# define DEBUG_PRINT 0 +#endif + #if defined __X32_SYSCALL_BIT && defined __NR_read \ && (__X32_SYSCALL_BIT & __NR_read) != 0 # define SYSCALL_BIT __X32_SYSCALL_BIT @@ -50,6 +55,11 @@ static const struct_sysent syscallent[] = { # define SYSCALL_BIT 0 #endif +#if DEBUG_PRINT +static const char *strace_name; +static FILE *debug_out; +#endif + static void test_syscall(const unsigned long nr) { @@ -64,13 +74,19 @@ test_syscall(const unsigned long nr) long rc = syscall(nr | SYSCALL_BIT, a[0], a[1], a[2], a[3], a[4], a[5]); + +#if DEBUG_PRINT + fprintf(debug_out, "%s: pid %d invalid syscall %#lx\n", + strace_name, getpid(), nr | SYSCALL_BIT); +#endif + #ifdef LINUX_MIPSO32 printf("syscall(%#lx, %#lx, %#lx, %#lx, %#lx, %#lx, %#lx)" " = %ld ENOSYS (%m)\n", nr | SYSCALL_BIT, a[0], a[1], a[2], a[3], a[4], a[5], rc); #else - printf("syscall_%lu(%#llx, %#llx, %#llx, %#llx, %#llx, %#llx)" - " = %ld (errno %d)\n", nr, + printf("syscall_%#lx(%#llx, %#llx, %#llx, %#llx, %#llx, %#llx)" + " = %ld (errno %d)\n", nr | SYSCALL_BIT, (unsigned long long) a[0], (unsigned long long) a[1], (unsigned long long) a[2], @@ -82,8 +98,26 @@ test_syscall(const unsigned long nr) } int -main(void) +main(int argc, char *argv[]) { +#if DEBUG_PRINT + if (argc < 3) + error_msg_and_fail("Not enough arguments. " + "Usage: %s STRACE_NAME DEBUG_OUT_FD", + argv[0]); + + strace_name = argv[1]; + + errno = 0; + int debug_out_fd = strtol(argv[2], NULL, 0); + if (errno) + error_msg_and_fail("Not a number: %s", argv[2]); + + debug_out = fdopen(debug_out_fd, "a"); + if (!debug_out) + perror_msg_and_fail("fdopen: %d", debug_out_fd); +#endif + test_syscall(ARRAY_SIZE(syscallent)); #ifdef SYS_socket_subcall diff --git a/tests/old_mmap-P.c b/tests/old_mmap-P.c new file mode 100644 index 00000000..bb28e889 --- /dev/null +++ b/tests/old_mmap-P.c @@ -0,0 +1,3 @@ +#define TEST_FD 9 +#define PATH_TRACING +#include "old_mmap.c" diff --git a/tests/old_mmap-P.gen.test b/tests/old_mmap-P.gen.test new file mode 100755 index 00000000..b1de9345 --- /dev/null +++ b/tests/old_mmap-P.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (old_mmap-P -e trace=mmap -P "/dev/full" 9>>/dev/full); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -e trace=mmap -P "/dev/full" 9>>/dev/full diff --git a/tests/old_mmap-v-none.c b/tests/old_mmap-v-none.c new file mode 100644 index 00000000..033503cc --- /dev/null +++ b/tests/old_mmap-v-none.c @@ -0,0 +1 @@ +#include "old_mmap.c" diff --git a/tests/old_mmap-v-none.gen.test b/tests/old_mmap-v-none.gen.test new file mode 100755 index 00000000..a568d989 --- /dev/null +++ b/tests/old_mmap-v-none.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (old_mmap-v-none -a11 -e trace=mmap -e verbose=none); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a11 -e trace=mmap -e verbose=none diff --git a/tests/old_mmap.c b/tests/old_mmap.c index 2725fb75..35ec4288 100644 --- a/tests/old_mmap.c +++ b/tests/old_mmap.c @@ -2,6 +2,7 @@ * Check decoding of "old mmap" edition of mmap syscall. * * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,57 +37,64 @@ * it would require additional efforts to filter out mmap calls made by glibc. */ -#if defined __NR_mmap && \ -( defined __arm__ \ - || defined __i386__ \ - || (defined __s390__ && !defined __s390x__) \ -) +#if defined __NR_mmap \ + && (defined __arm__ || defined __i386__ || defined __m68k__ \ + || defined __s390__ || defined __s390x__) \ + && (defined PATH_TRACING || !(defined __s390x__ || defined __m68k__)) # include <stdio.h> # include <string.h> # include <sys/mman.h> # include <unistd.h> +# ifndef TEST_FD +# define TEST_FD -2LU +# endif + int main(void) { long rc = syscall(__NR_mmap, 0); +# ifndef PATH_TRACING printf("mmap(NULL) = %ld %s (%m)\n", rc, errno2name()); +# endif - const unsigned int args1_c[6] = { - 0xdeadbeef, /* addr */ - 0xfacefeed, /* len */ + const unsigned long args1_c[6] = { + (unsigned long) 0xbadc0deddeadbeefULL, /* addr */ + (unsigned long) 0xdeefacedfacefeedULL, /* len */ PROT_READ|PROT_EXEC, /* prot */ MAP_FILE|MAP_FIXED, /* flags */ - -2U, /* fd */ - 0xbadc0ded /* offset */ + TEST_FD, /* fd */ + (unsigned long) 0xdecaffedbadc0dedULL /* offset */ }; - const unsigned int page_size = get_page_size(); - const unsigned int args2_c[6] = { + const unsigned long page_size = get_page_size(); + const unsigned long args2_c[6] = { 0, page_size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, - -1U, - 0xfaced000 & -page_size + -1LU, + (unsigned long) 0xda7a1057faced000ULL & -page_size }; void *args = tail_memdup(args1_c, sizeof(args1_c)); rc = syscall(__NR_mmap, args); - printf("mmap(%#x, %u, PROT_READ|PROT_EXEC, MAP_FILE|MAP_FIXED" - ", %d, %#x) = %ld %s (%m)\n", - args1_c[0], args1_c[1], args1_c[4], args1_c[5], + printf("mmap(%#lx, %lu, PROT_READ|PROT_EXEC, MAP_FILE|MAP_FIXED" + ", %d, %#lx) = %ld %s (%m)\n", + args1_c[0], args1_c[1], (int) args1_c[4], args1_c[5], rc, errno2name()); memcpy(args, args2_c, sizeof(args2_c)); rc = syscall(__NR_mmap, args); - printf("mmap(NULL, %u, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS" - ", %d, %#x) = %#lx\n", - args2_c[1], args2_c[4], args2_c[5], rc); +# ifndef PATH_TRACING + printf("mmap(NULL, %lu, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS" + ", %d, %#lx) = %#lx\n", + args2_c[1], (int) args2_c[4], args2_c[5], rc); +# endif void *addr = (void *) rc; if (mprotect(addr, page_size, PROT_NONE)) - perror_msg_and_fail("mprotect(%p, %u, PROT_NONE)", + perror_msg_and_fail("mprotect(%p, %lu, PROT_NONE)", addr, page_size); puts("+++ exited with 0 +++"); @@ -95,7 +103,9 @@ main(void) #else -SKIP_MAIN_UNDEFINED("__NR_mmap && (__arm__ || __i386__" - " || (__s390__ && !__s390x__))") +SKIP_MAIN_UNDEFINED("defined __NR_mmap " + "&& (defined __arm__ || defined __i386__ || defined __m68k__ " + "|| defined __s390__ || defined __s390x__) " + "&& (defined PATH_TRACING || !(defined __s390x__ || defined __m68k__))") #endif diff --git a/tests/oldselect-P.c b/tests/oldselect-P.c new file mode 100644 index 00000000..67e21343 --- /dev/null +++ b/tests/oldselect-P.c @@ -0,0 +1,2 @@ +#define PATH_TRACING_FD 9 +#include "oldselect.c" diff --git a/tests/oldselect-P.gen.test b/tests/oldselect-P.gen.test new file mode 100755 index 00000000..3486ffd6 --- /dev/null +++ b/tests/oldselect-P.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (oldselect-P -a13 -e trace=select -P /dev/full 9>>/dev/full); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a13 -e trace=select -P /dev/full 9>>/dev/full diff --git a/tests/oldselect-efault-P.c b/tests/oldselect-efault-P.c new file mode 100644 index 00000000..9ebf73d2 --- /dev/null +++ b/tests/oldselect-efault-P.c @@ -0,0 +1,2 @@ +#define PATH_TRACING_FD 9 +#include "oldselect-efault.c" diff --git a/tests/oldselect-efault-P.gen.test b/tests/oldselect-efault-P.gen.test new file mode 100755 index 00000000..a3d71768 --- /dev/null +++ b/tests/oldselect-efault-P.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (oldselect-efault-P -a13 -e trace=select -P /dev/full 9>>/dev/full); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a13 -e trace=select -P /dev/full 9>>/dev/full diff --git a/tests/oldselect-efault.c b/tests/oldselect-efault.c new file mode 100644 index 00000000..3c443341 --- /dev/null +++ b/tests/oldselect-efault.c @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2015-2018 Dmitry V. Levin <ldv@altlinux.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" +#include <asm/unistd.h> + +#if defined __NR_select && defined __NR__newselect \ + && __NR_select != __NR__newselect \ + && !defined __sparc__ + +# include <stdint.h> +# include <stdio.h> +# include <string.h> +# include <unistd.h> +# include <sys/select.h> + +static const char *errstr; + +static long +xselect(const kernel_ulong_t args) +{ + static const kernel_ulong_t dummy = F8ILL_KULONG_MASK | 0xfacefeed; + long rc = syscall(__NR_select, args, dummy, dummy, dummy, dummy, dummy); + errstr = sprintrc(rc); + return rc; +} + +int +main(void) +{ + unsigned long *const args = tail_alloc(sizeof(*args) * 4); + memset(args, 0, sizeof(*args) * 4); + + xselect(0); +#ifndef PATH_TRACING_FD + printf("select(NULL) = %s\n", errstr); +#endif + + xselect((uintptr_t) args); +#ifndef PATH_TRACING_FD + printf("select(%p) = %s\n", args, errstr); +#endif + + puts("+++ exited with 0 +++"); + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_select && __NR__newselect" + " && __NR_select != __NR__newselect" + " && !defined __sparc__") + +#endif diff --git a/tests/oldselect-efault.gen.test b/tests/oldselect-efault.gen.test new file mode 100755 index 00000000..bfeb5571 --- /dev/null +++ b/tests/oldselect-efault.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (oldselect-efault -a13 -e trace=select); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a13 -e trace=select diff --git a/tests/oldselect.c b/tests/oldselect.c index 7413fc33..7f548f81 100644 --- a/tests/oldselect.c +++ b/tests/oldselect.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2015-2018 Dmitry V. Levin <ldv@altlinux.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,37 +30,38 @@ #if defined __NR_select && defined __NR__newselect \ && __NR_select != __NR__newselect \ - && !defined SPARC + && !defined __sparc__ -# include <unistd.h> -# include <sys/select.h> +# define TEST_SYSCALL_NR __NR_select +# define TEST_SYSCALL_STR "select" +# define xselect xselect +# include "xselect.c" -int -main(void) -{ - int fds[2]; - fd_set r = {}, w = {}; - struct timeval timeout = { .tv_sec = 0, .tv_usec = 42 }; - long args[] = { - 2, (long) &r, (long) &w, 0, (long) &timeout, - 0xdeadbeef, 0xbadc0ded, 0xdeadbeef, 0xbadc0ded, 0xdeadbeef - }; - - (void) close(0); - (void) close(1); - if (pipe(fds)) - perror_msg_and_fail("pipe"); +static uint32_t *args; - FD_SET(0, &w); - FD_SET(1, &r); - if (syscall(__NR_select, args)) - perror_msg_and_skip("select"); - - return 0; +static long +xselect(const kernel_ulong_t nfds, + const kernel_ulong_t rs, + const kernel_ulong_t ws, + const kernel_ulong_t es, + const kernel_ulong_t tv) +{ + if (!args) + args = tail_alloc(sizeof(*args) * 5); + args[0] = nfds; + args[1] = rs; + args[2] = ws; + args[3] = es; + args[4] = tv; + long rc = syscall(TEST_SYSCALL_NR, args); + errstr = sprintrc(rc); + return rc; } #else -SKIP_MAIN_UNDEFINED("__NR_select && __NR__newselect") +SKIP_MAIN_UNDEFINED("__NR_select && __NR__newselect" + " && __NR_select != __NR__newselect" + " && !defined __sparc__") #endif diff --git a/tests/oldselect.expected b/tests/oldselect.expected deleted file mode 100644 index d6e7f3c4..00000000 --- a/tests/oldselect.expected +++ /dev/null @@ -1,2 +0,0 @@ -select(2, [1], [0], NULL, {tv_sec=0, tv_usec=42}) = 0 (Timeout) -+++ exited with 0 +++ diff --git a/tests/oldselect.gen.test b/tests/oldselect.gen.test new file mode 100755 index 00000000..1f10cbe3 --- /dev/null +++ b/tests/oldselect.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (oldselect -a13 -e trace=select); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a13 -e trace=select diff --git a/tests/oldselect.test b/tests/oldselect.test deleted file mode 100755 index 35661ad4..00000000 --- a/tests/oldselect.test +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# Check old select syscall decoding. - -. "${srcdir=.}/init.sh" - -run_prog -run_strace -a34 -eselect $args -match_diff - -exit 0 diff --git a/tests/open.c b/tests/open.c index 01e89b0f..fe486c58 100644 --- a/tests/open.c +++ b/tests/open.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,7 +31,7 @@ #ifdef __NR_open -# include <fcntl.h> +# include <asm/fcntl.h> # include <stdio.h> # include <unistd.h> @@ -56,16 +57,11 @@ main(void) sample, sprintrc(fd)); } -#ifdef O_TMPFILE -# if O_TMPFILE == (O_TMPFILE & ~O_DIRECTORY) -# define STR_O_TMPFILE "O_TMPFILE" -# else -# define STR_O_TMPFILE "O_DIRECTORY|O_TMPFILE" -# endif +# ifdef O_TMPFILE fd = syscall(__NR_open, sample, O_WRONLY|O_TMPFILE, 0600); - printf("open(\"%s\", O_WRONLY|%s, 0600) = %s\n", - sample, STR_O_TMPFILE, sprintrc(fd)); -#endif /* O_TMPFILE */ + printf("open(\"%s\", O_WRONLY|O_TMPFILE, 0600) = %s\n", + sample, sprintrc(fd)); +# endif /* O_TMPFILE */ puts("+++ exited with 0 +++"); return 0; diff --git a/tests/openat.c b/tests/openat.c index 1d6765cf..8c97441a 100644 --- a/tests/openat.c +++ b/tests/openat.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2016 Katerina Koukiou <k.koukiou@gmail.com> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -28,17 +29,36 @@ #include "tests.h" #include <asm/unistd.h> -#if defined __NR_openat +#ifdef __NR_openat -# include <fcntl.h> +# include <asm/fcntl.h> # include <stdio.h> # include <unistd.h> +#ifdef O_TMPFILE +/* The kernel & C libraries often inline O_DIRECTORY. */ +# define STRACE_O_TMPFILE (O_TMPFILE & ~O_DIRECTORY) +#else +# define STRACE_O_TMPFILE 0 +#endif + +static const char sample[] = "openat.sample"; + +static void +test_mode_flag(unsigned int mode_val, const char *mode_str, + unsigned int flag_val, const char *flag_str) +{ + long rc = syscall(__NR_openat, -1, sample, mode_val | flag_val, 0); + printf("openat(-1, \"%s\", %s%s%s%s) = %s\n", + sample, mode_str, + flag_val ? "|" : "", flag_str, + flag_val & (O_CREAT | STRACE_O_TMPFILE) ? ", 000" : "", + sprintrc(rc)); +} + int main(void) { - static const char sample[] = "openat.sample"; - long fd = syscall(__NR_openat, -100, sample, O_RDONLY|O_CREAT, 0400); printf("openat(AT_FDCWD, \"%s\", O_RDONLY|O_CREAT, 0400) = %s\n", sample, sprintrc(fd)); @@ -53,6 +73,54 @@ main(void) sample, sprintrc(fd)); } + struct { + unsigned int val; + const char *str; + } modes[] = { + { ARG_STR(O_RDONLY) }, + { ARG_STR(O_WRONLY) }, + { ARG_STR(O_RDWR) }, + { ARG_STR(O_ACCMODE) } + }, flags[] = { + { ARG_STR(O_APPEND) }, + { ARG_STR(O_DIRECT) }, + { ARG_STR(O_DIRECTORY) }, + { ARG_STR(O_EXCL) }, + { ARG_STR(O_LARGEFILE) }, + { ARG_STR(O_NOATIME) }, + { ARG_STR(O_NOCTTY) }, + { ARG_STR(O_NOFOLLOW) }, + { ARG_STR(O_NONBLOCK) }, + { ARG_STR(O_SYNC) }, + { ARG_STR(O_TRUNC) }, + { ARG_STR(O_CREAT) }, +# ifdef O_CLOEXEC + { ARG_STR(O_CLOEXEC) }, +# endif +# ifdef O_DSYNC + { ARG_STR(O_DSYNC) }, +# endif +# ifdef __O_SYNC + { ARG_STR(__O_SYNC) }, +# endif +# ifdef O_PATH + { ARG_STR(O_PATH) }, +# endif +# ifdef O_TMPFILE + { ARG_STR(O_TMPFILE) }, +# endif +# ifdef __O_TMPFILE + { ARG_STR(__O_TMPFILE) }, +# endif + { ARG_STR(0x80000000) }, + { 0, "" } + }; + + for (unsigned int m = 0; m < ARRAY_SIZE(modes); ++m) + for (unsigned int f = 0; f < ARRAY_SIZE(flags); ++f) + test_mode_flag(modes[m].val, modes[m].str, + flags[f].val, flags[f].str); + puts("+++ exited with 0 +++"); return 0; } diff --git a/tests/openat.gen.test b/tests/openat.gen.test index fe29e1ca..29dd3491 100755 --- a/tests/openat.gen.test +++ b/tests/openat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (openat -P $NAME.sample); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (openat -a36 -P $NAME.sample); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -P $NAME.sample +run_strace_match_diff -a36 -P $NAME.sample diff --git a/tests/options-syntax.test b/tests/options-syntax.test index 2e459c96..f81dd992 100755 --- a/tests/options-syntax.test +++ b/tests/options-syntax.test @@ -3,7 +3,7 @@ # Check strace options syntax. # # Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> -# Copyright (c) 2016-2017 The strace developers. +# Copyright (c) 2016-2018 The strace developers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -37,33 +37,10 @@ check_e "Invalid process id: 'a'" -p 1,a check_e "Syscall 'chdir' for -b isn't supported" -b chdir check_e "Syscall 'chdir' for -b isn't supported" -b execve -b chdir -check_e "invalid system call '-1'" -e-1 -check_e "invalid system call '-2'" -e -2 -check_e "invalid system call '-3'" -etrace=-3 -check_e "invalid system call '-4'" -e trace=-4 -check_e "invalid system call '-5'" -e trace=1,-5 -check_e "invalid system call '/non_syscall'" -e trace=/non_syscall -check_e "invalid system call '2147483647'" -e 2147483647 -check_e "invalid system call '2147483648'" -e 2147483648 -check_e "invalid system call '4294967295'" -e 4294967295 -check_e "invalid system call '4294967296'" -e 4294967296 +check_e_using_grep 'exec: File *name too long' "$(printf '%4096s' ' ')" -check_e "invalid descriptor '-1'" -eread=-1 -check_e "invalid descriptor '-42'" -ewrite=-42 -check_e "invalid descriptor '2147483648'" -eread=2147483648 -check_e "invalid descriptor '4294967296'" -ewrite=4294967296 -check_e "invalid descriptor 'foo'" -eread=foo -check_e "invalid descriptor ''" -ewrite= -check_e "invalid descriptor ','" -eread=, -check_e "invalid descriptor '!'" -ewrite='!' -check_e "invalid descriptor '!'" -eread='0,!' -check_e "invalid descriptor '!,'" -ewrite='!,' - -check_e_using_grep 'regcomp: \+id: [[:alpha:]].+' -e trace='/+id' -check_e_using_grep 'regcomp: \*id: [[:alpha:]].+' -e trace='/*id' -check_e_using_grep 'regcomp: \{id: [[:alpha:]].+' -e trace='/{id' -check_e_using_grep 'regcomp: \(id: [[:alpha:]].+' -e trace='/(id' -check_e_using_grep 'regcomp: \[id: [[:alpha:]].+' -e trace='/[id' +ff_name="$(printf '%4084s' ' ')" +check_e_using_grep "$ff_name: File *name too long" -ff -o "$ff_name" true check_h 'must have PROG [ARGS] or -p PID' check_h 'PROG [ARGS] must be specified with -D' -D -p $$ @@ -80,12 +57,12 @@ check_h "invalid -s argument: '-42'" -s -42 check_h "invalid -s argument: '1073741824'" -s 1073741824 check_h "invalid -I argument: '5'" -I 5 -../zeroargc "$strace_exp" /bin/true 2> "$LOG" && +../zeroargc "$STRACE_EXE" /bin/true 2> "$LOG" && dump_log_and_fail_with \ 'zeroargc strace failed to handle the error properly' cat > "$EXP" << __EOF__ -$strace_exp: must have PROG [ARGS] or -p PID -Try '$strace_exp -h' for more information. +$STRACE_EXE: must have PROG [ARGS] or -p PID +Try '$STRACE_EXE -h' for more information. __EOF__ diff -u -- "$EXP" "$LOG" > /dev/null || { cat > "$EXP" <<- '__EOF__' @@ -107,17 +84,17 @@ if [ -n "${UID-}" ]; then for c in i r t T y; do check_e "-$c has no effect with -c -$strace_exp: $umsg" -u :nosuchuser: -c -$c true +$STRACE_EXE: $umsg" -u :nosuchuser: -c -$c true done check_e "-i has no effect with -c -$strace_exp: -r has no effect with -c -$strace_exp: -t has no effect with -c -$strace_exp: -T has no effect with -c -$strace_exp: -y has no effect with -c -$strace_exp: $umsg" -u :nosuchuser: -cirtTy true +$STRACE_EXE: -r has no effect with -c +$STRACE_EXE: -t has no effect with -c +$STRACE_EXE: -T has no effect with -c +$STRACE_EXE: -y has no effect with -c +$STRACE_EXE: $umsg" -u :nosuchuser: -cirtTy true check_e "-tt has no effect with -r -$strace_exp: $umsg" -u :nosuchuser: -r -tt true +$STRACE_EXE: $umsg" -u :nosuchuser: -r -tt true fi args='-p 2147483647' @@ -127,7 +104,7 @@ $STRACE $args 2> "$LOG" && for cmd in PTRACE_SEIZE PTRACE_ATTACH; do cat > "$EXP" << __EOF__ -$strace_exp: attach: ptrace($cmd, 2147483647): No such process +$STRACE_EXE: attach: ptrace($cmd, 2147483647): No such process __EOF__ diff -- "$EXP" "$LOG" || continue diff --git a/tests/osf_utimes.gen.test b/tests/osf_utimes.gen.test index b6be305d..9e683b47 100755 --- a/tests/osf_utimes.gen.test +++ b/tests/osf_utimes.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (osf_utimes -a21); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (osf_utimes -a21 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a21 +run_strace_match_diff -a21 diff --git a/tests/perf_event_open.c b/tests/perf_event_open.c index 74ff9527..667c31f4 100644 --- a/tests/perf_event_open.c +++ b/tests/perf_event_open.c @@ -2,7 +2,7 @@ * Check verbose decoding of perf_event_open syscall. * * Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -102,7 +102,8 @@ struct pea_flags { use_clockid :1, context_switch :1, write_backward :1, - __reserved_1 :36; + namespaces :1, + __reserved_1 :35; }; static const char * @@ -351,9 +352,17 @@ print_event_attr(struct perf_event_attr *attr_ptr, size_t size, # endif printf(", write_backward=%" PRIu64, val); + val = +# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_NAMESPACES + attr->namespaces; +# else + flags_data.flags.namespaces; +# endif + printf(", namespaces=%" PRIu64, val); + val = flags_data.flags.__reserved_1; if (val) - printf(", __reserved_1=%#" PRIx64 " /* Bits 63..28 */", val); + printf(", __reserved_1=%#" PRIx64 " /* Bits 63..29 */", val); printf(", %s=%u", attr->watermark ? "wakeup_watermark" : "wakeup_events", @@ -523,7 +532,8 @@ end: "PERF_SAMPLE_BRANCH_IND_JUMP|" \ "PERF_SAMPLE_BRANCH_CALL|" \ "PERF_SAMPLE_BRANCH_NO_FLAGS|" \ - "PERF_SAMPLE_BRANCH_NO_CYCLES" + "PERF_SAMPLE_BRANCH_NO_CYCLES|" \ + "PERF_SAMPLE_BRANCH_TYPE_SAVE" int main(void) @@ -608,7 +618,7 @@ main(void) static const struct u64_val_str sample_types[] = { { ARG_STR(0) }, { 0x800, "PERF_SAMPLE_BRANCH_STACK" }, - { ARG_ULL_STR(0xdeadc0deda780000) " /* PERF_SAMPLE_??? */" }, + { ARG_ULL_STR(0xdeadc0deda700000) " /* PERF_SAMPLE_??? */" }, { 0xffffffffffffffffULL, "PERF_SAMPLE_IP|PERF_SAMPLE_TID|PERF_SAMPLE_TIME|" "PERF_SAMPLE_ADDR|PERF_SAMPLE_READ|" @@ -618,7 +628,8 @@ main(void) "PERF_SAMPLE_REGS_USER|PERF_SAMPLE_STACK_USER|" "PERF_SAMPLE_WEIGHT|PERF_SAMPLE_DATA_SRC|" "PERF_SAMPLE_IDENTIFIER|PERF_SAMPLE_TRANSACTION|" - "PERF_SAMPLE_REGS_INTR|0xfffffffffff80000" }, + "PERF_SAMPLE_REGS_INTR|PERF_SAMPLE_PHYS_ADDR|" + "0xfffffffffff00000" }, }; static const struct u64_val_str read_formats[] = { { ARG_STR(0) }, @@ -650,11 +661,11 @@ main(void) static const struct u64_val_str branch_sample_types[] = { { ARG_STR(0) }, { 0x80, "PERF_SAMPLE_BRANCH_ABORT_TX" }, - { 0xffff, BRANCH_TYPE_ALL }, - { ARG_ULL_STR(0xdeadcaffeeed0000) + { 0x1ffff, BRANCH_TYPE_ALL }, + { ARG_ULL_STR(0xdeadcaffeeec0000) " /* PERF_SAMPLE_BRANCH_??? */" }, { 0xffffffffffffffffULL, - BRANCH_TYPE_ALL "|0xffffffffffff0000" } + BRANCH_TYPE_ALL "|0xfffffffffffe0000" } }; static const struct s32_val_str clockids[] = { { 11, "CLOCK_TAI" }, diff --git a/tests/perf_event_open.gen.test b/tests/perf_event_open.gen.test index 85336c3e..02d468ab 100755 --- a/tests/perf_event_open.gen.test +++ b/tests/perf_event_open.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (perf_event_open -a1); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (perf_event_open -a1 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a1 +run_strace_match_diff -a1 diff --git a/tests/pipe2.gen.test b/tests/pipe2.gen.test index 5a06c030..50b8fd64 100755 --- a/tests/pipe2.gen.test +++ b/tests/pipe2.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pipe2 -a15); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pipe2 -a15 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a15 +run_strace_match_diff -a15 diff --git a/tests/pkey_alloc.c b/tests/pkey_alloc.c index 45772787..4a0aa720 100644 --- a/tests/pkey_alloc.c +++ b/tests/pkey_alloc.c @@ -2,6 +2,7 @@ * Check decoding of pkey_alloc syscall. * * Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,10 +54,12 @@ main(void) sizeof(kernel_ulong_t) > sizeof(int) ? "PKEY_DISABLE_WRITE|0xbadc0ded00000000" : "PKEY_DISABLE_WRITE" }, - { 0xdec0ded, "PKEY_DISABLE_ACCESS|0xdec0dec" }, - { 0x3, "PKEY_DISABLE_ACCESS|PKEY_DISABLE_WRITE" }, + { 0xdec0ded, "PKEY_DISABLE_ACCESS|PKEY_DISABLE_EXECUTE|" + "0xdec0de8" }, + { 0x7, "PKEY_DISABLE_ACCESS|PKEY_DISABLE_WRITE|" + "PKEY_DISABLE_EXECUTE" }, { ARG_STR(0) }, - { 0xbadc0dec, "0xbadc0dec /* PKEY_??? */" }, + { 0xbadc0de8, "0xbadc0de8 /* PKEY_??? */" }, }; long rc; diff --git a/tests/pkey_alloc.gen.test b/tests/pkey_alloc.gen.test index b3e58692..fb554efc 100755 --- a/tests/pkey_alloc.gen.test +++ b/tests/pkey_alloc.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pkey_alloc -a17); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pkey_alloc -a17 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a17 +run_strace_match_diff -a17 diff --git a/tests/pkey_free.gen.test b/tests/pkey_free.gen.test index 588d1aa6..0374cc73 100755 --- a/tests/pkey_free.gen.test +++ b/tests/pkey_free.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pkey_free -a13); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pkey_free -a13 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a13 +run_strace_match_diff -a13 diff --git a/tests/pkey_mprotect.gen.test b/tests/pkey_mprotect.gen.test index 14be2311..11a902a5 100755 --- a/tests/pkey_mprotect.gen.test +++ b/tests/pkey_mprotect.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pkey_mprotect -a37); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pkey_mprotect -a37 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a37 +run_strace_match_diff -a37 diff --git a/tests/poll-P.c b/tests/poll-P.c new file mode 100644 index 00000000..7bbeb795 --- /dev/null +++ b/tests/poll-P.c @@ -0,0 +1,2 @@ +#define PATH_TRACING_FD 9 +#include "poll.c" diff --git a/tests/poll-P.test b/tests/poll-P.test new file mode 100755 index 00000000..a1905723 --- /dev/null +++ b/tests/poll-P.test @@ -0,0 +1,17 @@ +#!/bin/sh + +# Check path tracing of poll syscall. + +. "${srcdir=.}/init.sh" + +run_prog > /dev/null +run_strace -a16 -vepoll -P /dev/full 9>>/dev/full \ + $args > "$EXP" +match_diff "$LOG" "$EXP" + +for abbrev in 0 1 2 3 4 5; do + run_prog "../$NAME" $abbrev > /dev/null + run_strace -a16 -epoll -s$abbrev -P /dev/full 9>>/dev/full \ + $args > "$EXP" + match_diff "$LOG" "$EXP" +done diff --git a/tests/poll.c b/tests/poll.c index 2bf8c1a1..c5930a3e 100644 --- a/tests/poll.c +++ b/tests/poll.c @@ -1,8 +1,7 @@ /* - * This file is part of poll strace test. + * Check decoding of poll syscall. * - * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 Dmitry V. Levin <ldv@altlinux.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,6 +37,7 @@ # include <poll.h> # include <stdio.h> # include <stdlib.h> +# include <string.h> # include <unistd.h> #define PRINT_EVENT(flag, member) \ @@ -163,12 +163,19 @@ print_pollfd_array_exiting(const struct pollfd *const pfd, int main(int ac, char **av) { +# ifdef PATH_TRACING_FD + skip_if_unavailable("/proc/self/fd/"); +# endif + tprintf("%s", ""); assert(syscall(__NR_poll, NULL, 42, 0) == -1); if (ENOSYS == errno) perror_msg_and_skip("poll"); + +# ifndef PATH_TRACING_FD tprintf("poll(NULL, 42, 0) = -1 EFAULT (%m)\n"); +# endif int fds[2]; if (pipe(fds) || pipe(fds)) @@ -187,11 +194,14 @@ main(int ac, char **av) int rc = syscall(__NR_poll, tail_fds0, 0, timeout); assert(rc == 0); +# ifndef PATH_TRACING_FD tprintf("poll([], 0, %d) = %d (Timeout)\n", timeout, rc); +# endif rc = syscall(__NR_poll, tail_fds0, ARRAY_SIZE(pfds0), timeout); assert(rc == 3); +# ifndef PATH_TRACING_FD tprintf("poll("); print_pollfd_array_entering(tail_fds0, ARRAY_SIZE(pfds0), ARRAY_SIZE(pfds0), abbrev); @@ -199,6 +209,7 @@ main(int ac, char **av) (unsigned int) ARRAY_SIZE(pfds0), timeout, rc); print_pollfd_array_exiting(tail_fds0, ARRAY_SIZE(pfds0), abbrev); tprintf(")\n"); +# endif /* !PATH_TRACING_FD */ tail_fds0[0].fd = -1; tail_fds0[2].fd = -3; @@ -206,6 +217,7 @@ main(int ac, char **av) rc = syscall(__NR_poll, tail_fds0, ARRAY_SIZE(pfds0), timeout); assert(rc == 2); +# ifndef PATH_TRACING_FD tprintf("poll("); print_pollfd_array_entering(tail_fds0, ARRAY_SIZE(pfds0), ARRAY_SIZE(pfds0), abbrev); @@ -213,12 +225,14 @@ main(int ac, char **av) (unsigned int) ARRAY_SIZE(pfds0), timeout, rc); print_pollfd_array_exiting(tail_fds0, ARRAY_SIZE(pfds0), abbrev); tprintf(")\n"); +# endif /* !PATH_TRACING_FD */ tail_fds0[1].fd = -2; tail_fds0[4].fd = -5; rc = syscall(__NR_poll, tail_fds0, ARRAY_SIZE(pfds0), timeout); assert(rc == 1); +# ifndef PATH_TRACING_FD tprintf("poll("); print_pollfd_array_entering(tail_fds0, ARRAY_SIZE(pfds0), ARRAY_SIZE(pfds0), abbrev); @@ -226,6 +240,7 @@ main(int ac, char **av) (unsigned int) ARRAY_SIZE(pfds0), timeout, rc); print_pollfd_array_exiting(tail_fds0, ARRAY_SIZE(pfds0), abbrev); tprintf(")\n"); +# endif /* !PATH_TRACING_FD */ struct pollfd pfds1[] = { { .fd = 1, .events = POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND }, @@ -235,25 +250,58 @@ main(int ac, char **av) rc = syscall(__NR_poll, tail_fds1, ARRAY_SIZE(pfds1), timeout); assert(rc == 0); +# ifndef PATH_TRACING_FD tprintf("poll("); print_pollfd_array_entering(tail_fds1, ARRAY_SIZE(pfds1), ARRAY_SIZE(pfds1), abbrev); tprintf(", %u, %d) = %d (Timeout)\n", (unsigned int) ARRAY_SIZE(pfds1), timeout, rc); +# endif /* !PATH_TRACING_FD */ const void *const efault = tail_fds0 + ARRAY_SIZE(pfds0); rc = syscall(__NR_poll, efault, 1, 0); assert(rc == -1); + +# ifndef PATH_TRACING_FD tprintf("poll(%p, 1, 0) = -1 EFAULT (%m)\n", efault); +# endif const unsigned int valid = 1; const void *const epfds = tail_fds0 + ARRAY_SIZE(pfds0) - valid; rc = syscall(__NR_poll, epfds, valid + 1, 0); assert(rc == -1); + +# ifndef PATH_TRACING_FD + tprintf("poll("); + print_pollfd_array_entering(epfds, valid + 1, valid, abbrev); + errno = EFAULT; + tprintf(", %u, 0) = -1 EFAULT (%m)\n", valid + 1); +# endif /* !PATH_TRACING_FD */ + +# ifdef PATH_TRACING_FD + memcpy(tail_fds0, pfds0, sizeof(pfds0)); + tail_fds0[4].fd = PATH_TRACING_FD; + + rc = syscall(__NR_poll, tail_fds0, ARRAY_SIZE(pfds0), timeout); + assert(rc == 3); + + tprintf("poll("); + print_pollfd_array_entering(tail_fds0, ARRAY_SIZE(pfds0), + ARRAY_SIZE(pfds0), abbrev); + tprintf(", %u, %d) = %d (", + (unsigned int) ARRAY_SIZE(pfds0), timeout, rc); + print_pollfd_array_exiting(tail_fds0, ARRAY_SIZE(pfds0), abbrev); + tprintf(")\n"); + + rc = syscall(__NR_poll, epfds, valid + 1, 0); + assert(rc == -1); + + /* the 1st pollfd element is readable and contains PATH_TRACING_FD */ tprintf("poll("); print_pollfd_array_entering(epfds, valid + 1, valid, abbrev); errno = EFAULT; tprintf(", %u, 0) = -1 EFAULT (%m)\n", valid + 1); +# endif /* PATH_TRACING_FD */ tprintf("+++ exited with 0 +++\n"); return 0; diff --git a/tests/ppoll-P.c b/tests/ppoll-P.c new file mode 100644 index 00000000..c2c572e2 --- /dev/null +++ b/tests/ppoll-P.c @@ -0,0 +1,2 @@ +#define PATH_TRACING_FD 9 +#include "ppoll.c" diff --git a/tests/ppoll-P.gen.test b/tests/ppoll-P.gen.test new file mode 100755 index 00000000..25a97048 --- /dev/null +++ b/tests/ppoll-P.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ppoll-P -s2 -e trace=ppoll -P /dev/full 9>>/dev/full); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -s2 -e trace=ppoll -P /dev/full 9>>/dev/full diff --git a/tests/ppoll.c b/tests/ppoll.c index 62241839..b33f9593 100644 --- a/tests/ppoll.c +++ b/tests/ppoll.c @@ -1,7 +1,7 @@ /* * Check decoding of ppoll syscall. * - * Copyright (c) 2015-2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2015-2018 Dmitry V. Levin <ldv@altlinux.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -56,6 +56,10 @@ sys_ppoll(const kernel_ulong_t ufds, int main(void) { +# ifdef PATH_TRACING_FD + skip_if_unavailable("/proc/self/fd/"); +# endif + static const kernel_ulong_t bogus_nfds = (kernel_ulong_t) 0xdeadbeeffacefeedULL; static const kernel_ulong_t bogus_sigsetsize = @@ -76,28 +80,36 @@ main(void) sys_ppoll(0, bogus_nfds, 0, 0, bogus_sigsetsize); if (ENOSYS == errno) perror_msg_and_skip("ppoll"); +# ifndef PATH_TRACING_FD printf("ppoll(NULL, %u, NULL, NULL, %llu) = %s\n", (unsigned) bogus_nfds, (unsigned long long) bogus_sigsetsize, errstr); +# endif sys_ppoll((unsigned long) efault, 42, (unsigned long) efault + 8, (unsigned long) efault + 16, sigset_size); +# ifndef PATH_TRACING_FD printf("ppoll(%p, %u, %p, %p, %u) = %s\n", efault, 42, efault + 8, efault + 16, sigset_size, errstr); +# endif ts->tv_sec = 0xdeadbeefU; ts->tv_nsec = 0xfacefeedU; sys_ppoll(0, 0, (unsigned long) ts, 0, sigset_size); +# ifndef PATH_TRACING_FD printf("ppoll(NULL, 0, {tv_sec=%lld, tv_nsec=%llu}, NULL, %u) = %s\n", (long long) ts->tv_sec, zero_extend_signed_to_ull(ts->tv_nsec), sigset_size, errstr); +# endif ts->tv_sec = (time_t) 0xcafef00ddeadbeefLL; ts->tv_nsec = (long) 0xbadc0dedfacefeedL; sys_ppoll(0, 0, (unsigned long) ts, 0, sigset_size); +# ifndef PATH_TRACING_FD printf("ppoll(NULL, 0, {tv_sec=%lld, tv_nsec=%llu}, NULL, %u) = %s\n", (long long) ts->tv_sec, zero_extend_signed_to_ull(ts->tv_nsec), sigset_size, errstr); +# endif if (pipe(pipe_fd) || pipe(pipe_fd + 2)) perror_msg_and_fail("pipe"); @@ -124,24 +136,56 @@ main(void) (unsigned long) sigmask, sigset_size); if (rc != 2) perror_msg_and_fail("ppoll 1"); +# ifndef PATH_TRACING_FD printf("ppoll([{fd=%d, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}" ", {fd=%d, events=POLLOUT%s|POLLWRBAND}" -#if VERBOSE +# if VERBOSE ", {fd=%d, events=POLLIN|POLLPRI}, {fd=%d, events=POLLOUT}]" -#else +# else ", ...]" -#endif +# endif ", %u, {tv_sec=42, tv_nsec=999999999}, [%s], %u) = %ld" " ([{fd=%d, revents=POLLOUT%s}, {fd=%d, revents=POLLOUT}]" ", left {tv_sec=%u, tv_nsec=%u})\n", pipe_fd[0], pipe_fd[1], POLLWRNORM_str, -#if VERBOSE +# if VERBOSE pipe_fd[2], pipe_fd[3], -#endif +# endif (unsigned int) ARRAY_SIZE(fds1), USR2_CHLD_str, (unsigned int) sigset_size, rc, pipe_fd[1], POLLWRNORM_str, pipe_fd[3], (unsigned int) ts->tv_sec, (unsigned int) ts->tv_nsec); +# endif /* !PATH_TRACING_FD */ + +# ifdef PATH_TRACING_FD + ts->tv_sec = 123; + ts->tv_nsec = 987654321; + fds[3].fd = PATH_TRACING_FD; + + rc = sys_ppoll((unsigned long) fds, + F8ILL_KULONG_MASK | ARRAY_SIZE(fds1), (unsigned long) ts, + (unsigned long) sigmask, sigset_size); + if (rc != 2) + perror_msg_and_fail("ppoll -P"); + printf("ppoll([{fd=%d, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}" + ", {fd=%d, events=POLLOUT%s|POLLWRBAND}" +# if VERBOSE + ", {fd=%d, events=POLLIN|POLLPRI}, {fd=%d, events=POLLOUT}]" +# else + ", ...]" +# endif + ", %u, {tv_sec=123, tv_nsec=987654321}, [%s], %u) = %ld" + " ([{fd=%d, revents=POLLOUT%s}, {fd=%d, revents=POLLOUT}]" + ", left {tv_sec=%u, tv_nsec=%u})\n", + pipe_fd[0], pipe_fd[1], POLLWRNORM_str, +# if VERBOSE + pipe_fd[2], PATH_TRACING_FD, +# endif + (unsigned int) ARRAY_SIZE(fds1), USR2_CHLD_str, + (unsigned int) sigset_size, rc, pipe_fd[1], POLLWRNORM_str, + PATH_TRACING_FD, (unsigned int) ts->tv_sec, + (unsigned int) ts->tv_nsec); +# endif /* PATH_TRACING_FD */ ts->tv_sec = 0; ts->tv_nsec = 999; @@ -163,23 +207,27 @@ main(void) (unsigned long) sigmask, sigset_size); if (rc != 0) perror_msg_and_fail("ppoll 2"); +# ifndef PATH_TRACING_FD printf("ppoll([{fd=%d, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}" ", {fd=%d, events=POLLOUT%s|POLLWRBAND}], %u" ", {tv_sec=0, tv_nsec=999}, ~[HUP KILL STOP], %u)" " = %ld (Timeout)\n", pipe_fd[1], pipe_fd[0], POLLWRNORM_str, (unsigned) ARRAY_SIZE(fds2), sigset_size, rc); +# endif /* !PATH_TRACING_FD */ if (F8ILL_KULONG_SUPPORTED) { sys_ppoll(f8ill_ptr_to_kulong(fds), ARRAY_SIZE(fds2), f8ill_ptr_to_kulong(ts), f8ill_ptr_to_kulong(sigmask), sigset_size); +# ifndef PATH_TRACING_FD printf("ppoll(%#llx, %u, %#llx, %#llx, %u) = %s\n", (unsigned long long) f8ill_ptr_to_kulong(fds), (unsigned) ARRAY_SIZE(fds2), (unsigned long long) f8ill_ptr_to_kulong(ts), (unsigned long long) f8ill_ptr_to_kulong(sigmask), (unsigned) sigset_size, errstr); +# endif /* !PATH_TRACING_FD */ } puts("+++ exited with 0 +++"); diff --git a/tests/ppoll.gen.test b/tests/ppoll.gen.test index 4c075989..120e9536 100755 --- a/tests/ppoll.gen.test +++ b/tests/ppoll.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ppoll -s2); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ppoll -s2 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -s2 +run_strace_match_diff -s2 diff --git a/tests/prctl-dumpable.c b/tests/prctl-dumpable.c index 1049bcee..52c16680 100644 --- a/tests/prctl-dumpable.c +++ b/tests/prctl-dumpable.c @@ -3,6 +3,7 @@ * * Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com> * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,7 +33,8 @@ #include <asm/unistd.h> #include <linux/prctl.h> -#if defined __NR_prctl && defined PR_GET_DUMPABLE && defined PR_SET_DUMPABLE +#if defined __NR_prctl && defined PR_GET_DUMPABLE && defined PR_SET_DUMPABLE \ + && !defined __ia64__ # include <stdio.h> # include <unistd.h> @@ -101,6 +103,7 @@ main(void) #else -SKIP_MAIN_UNDEFINED("__NR_prctl && PR_GET_DUMPABLE && PR_SET_DUMPABLE") +SKIP_MAIN_UNDEFINED("__NR_prctl && PR_GET_DUMPABLE && PR_SET_DUMPABLE" + " && !__ia64__") #endif diff --git a/tests/preadv.gen.test b/tests/preadv.gen.test index 8fb7b540..c3fabe6f 100755 --- a/tests/preadv.gen.test +++ b/tests/preadv.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (preadv -a21); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (preadv -a21 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a21 +run_strace_match_diff -a21 diff --git a/tests/print_user_desc.c b/tests/print_user_desc.c new file mode 100644 index 00000000..2dac3879 --- /dev/null +++ b/tests/print_user_desc.c @@ -0,0 +1,78 @@ +/* + * Auxiliary printing function for the struct user_desc type. + * Used by modify_ldt and xet_thread_area tests. + * + * Copyright (c) 2018 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" + +#ifdef HAVE_STRUCT_USER_DESC + +# include <asm/ldt.h> + +/** + * Print user_desc structure. + * + * @param us Pointer to struct user_desc to print. + * @param entry_str If not NULL, the string is printed as a value of + * entry_number field. + */ +static void +print_user_desc(struct user_desc *us, const char *entry_str) +{ + if (entry_str) + printf("{entry_number=%s", entry_str); + else + printf("{entry_number=%u", us->entry_number); + + printf(", base_addr=%#08x" + ", limit=%#08x" + ", seg_32bit=%u" + ", contents=%u" + ", read_exec_only=%u" + ", limit_in_pages=%u" + ", seg_not_present=%u" + ", useable=%u" +# ifdef __x86_64__ + ", lm=%u" +# endif + "}", + us->base_addr, + us->limit, + us->seg_32bit, + us->contents, + us->read_exec_only, + us->limit_in_pages, + us->seg_not_present, + us->useable +# ifdef __x86_64__ + , us->lm +# endif + ); +} + +#endif /* HAVE_STRUCT_USER_DESC */ diff --git a/tests/printpath-umovestr.c b/tests/printpath-umovestr.c index a7251e5e..0d5955ff 100644 --- a/tests/printpath-umovestr.c +++ b/tests/printpath-umovestr.c @@ -2,6 +2,7 @@ * Test regular printpath/umovestr. * * Copyright (c) 2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2017-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,8 +30,8 @@ #include "tests.h" #include "test_ucopy.h" +#include <limits.h> #include <stdio.h> -#include <sys/param.h> int main(void) diff --git a/tests/prlimit64.gen.test b/tests/prlimit64.gen.test index 11964a5e..2c94fc9d 100755 --- a/tests/prlimit64.gen.test +++ b/tests/prlimit64.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (prlimit64 ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (prlimit64 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/pselect6.gen.test b/tests/pselect6.gen.test index c89e7054..29d38963 100755 --- a/tests/pselect6.gen.test +++ b/tests/pselect6.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pselect6 ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pselect6 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/ptrace.c b/tests/ptrace.c index d776dcdd..c70d5689 100644 --- a/tests/ptrace.c +++ b/tests/ptrace.c @@ -2,7 +2,7 @@ * Check decoding of ptrace syscall. * * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,12 +32,12 @@ #include <asm/unistd.h> #include <errno.h> +#include "ptrace.h" #include <signal.h> #include <stdio.h> #include <string.h> #include <sys/wait.h> #include <unistd.h> -#include "ptrace.h" #include <linux/audit.h> static const char *errstr; diff --git a/tests/pure_executables.am b/tests/pure_executables.am index 2cae9ae5..128028fe 100644 --- a/tests/pure_executables.am +++ b/tests/pure_executables.am @@ -104,6 +104,7 @@ PURE_EXECUTABLES = \ ioctl_block \ ioctl_dm \ ioctl_evdev \ + ioctl_kvm_run \ ioctl_loop \ ioctl_mtd \ ioctl_rtc \ @@ -154,6 +155,7 @@ PURE_EXECUTABLES = \ mmap64 \ mmsg \ mmsg_name \ + modify_ldt \ mount \ move_pages \ mq \ @@ -223,9 +225,12 @@ PURE_EXECUTABLES = \ nlattr_tcmsg \ nlattr_unix_diag_msg \ old_mmap \ + old_mmap-P \ + old_mmap-v-none \ oldfstat \ oldlstat \ oldselect \ + oldselect-efault \ oldstat \ open \ openat \ @@ -239,7 +244,9 @@ PURE_EXECUTABLES = \ pkey_free \ pkey_mprotect \ poll \ + poll-P \ ppoll \ + ppoll-P \ prctl-arg2-intptr \ prctl-dumpable \ prctl-name \ @@ -282,6 +289,7 @@ PURE_EXECUTABLES = \ renameat \ renameat2 \ request_key \ + riscv_flush_icache \ rmdir \ rt_sigaction \ rt_sigpending \ @@ -291,6 +299,12 @@ PURE_EXECUTABLES = \ rt_sigsuspend \ rt_sigtimedwait \ rt_tgsigqueueinfo \ + s390_guarded_storage \ + s390_guarded_storage-v \ + s390_pci_mmio_read_write \ + s390_runtime_instr \ + s390_sthyi \ + s390_sthyi-v \ sched_get_priority_mxx \ sched_rr_get_interval \ sched_xetaffinity \ @@ -342,6 +356,7 @@ PURE_EXECUTABLES = \ so_peercred \ sock_filter-v \ socketcall \ + sockopt-sol_netlink \ splice \ stat \ stat64 \ @@ -393,6 +408,7 @@ PURE_EXECUTABLES = \ xattr \ xattr-strings \ xet_robust_list \ + xet_thread_area_x86 \ xetitimer \ xetpgid \ xetpriority \ diff --git a/tests/pure_executables.list b/tests/pure_executables.list index d98b17db..2f602a93 100755 --- a/tests/pure_executables.list +++ b/tests/pure_executables.list @@ -103,6 +103,7 @@ ioctl ioctl_block ioctl_dm ioctl_evdev +ioctl_kvm_run ioctl_loop ioctl_mtd ioctl_rtc @@ -153,6 +154,7 @@ mmap mmap64 mmsg mmsg_name +modify_ldt mount move_pages mq @@ -222,9 +224,12 @@ nlattr_tcamsg nlattr_tcmsg nlattr_unix_diag_msg old_mmap +old_mmap-P +old_mmap-v-none oldfstat oldlstat oldselect +oldselect-efault oldstat open openat @@ -238,7 +243,9 @@ pkey_alloc pkey_free pkey_mprotect poll +poll-P ppoll +ppoll-P prctl-arg2-intptr prctl-dumpable prctl-name @@ -281,6 +288,7 @@ rename renameat renameat2 request_key +riscv_flush_icache rmdir rt_sigaction rt_sigpending @@ -290,6 +298,12 @@ rt_sigreturn rt_sigsuspend rt_sigtimedwait rt_tgsigqueueinfo +s390_guarded_storage +s390_guarded_storage-v +s390_pci_mmio_read_write +s390_runtime_instr +s390_sthyi +s390_sthyi-v sched_get_priority_mxx sched_rr_get_interval sched_xetaffinity @@ -341,6 +355,7 @@ so_linger so_peercred sock_filter-v socketcall +sockopt-sol_netlink splice stat stat64 @@ -392,6 +407,7 @@ waitpid xattr xattr-strings xet_robust_list +xet_thread_area_x86 xetitimer xetpgid xetpriority diff --git a/tests/qual_fault-syntax.test b/tests/qual_fault-syntax.test index 0cce539a..43ade769 100755 --- a/tests/qual_fault-syntax.test +++ b/tests/qual_fault-syntax.test @@ -2,7 +2,7 @@ # # Check -e fault= syntax. # -# Copyright (c) 2016-2017 Dmitry V. Levin <ldv@altlinux.org> +# Copyright (c) 2016-2018 Dmitry V. Levin <ldv@altlinux.org> # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -40,16 +40,7 @@ fail_with() "strace -e fault=$* failed to handle an argument error properly" } -for arg in '' , ,, ,,, : :: ::: \! \!, \!: \ - invalid_syscall_name \ - invalid_syscall_name:when=3 \ - -1 \!-1 \ - -1:when=4 \ - -2 \ - -2:when=5 \ - 32767 \!32767 \ - 32767:when=6 \ - chdir:42 \!chdir:42 \ +for arg in chdir:42 \!chdir:42 \ chdir:42:when=7 \ chdir:invalid \ chdir:invalid:when=8 \ @@ -92,12 +83,6 @@ for arg in '' , ,, ,,, : :: ::: \! \!, \!: \ chdir:when=65536:error=30 \ chdir:when=1+65536 \ chdir:when=1+65536:error=31 \ - file,nonsense \ - \!desc,nonsense \ - chdir,nonsense \ - \!chdir,nonsense \ - 1,nonsense \ - \!1,nonsense \ chdir:retval=0 \ chdir:signal=1 \ chdir:error=1:error=2 \ diff --git a/tests/qual_fault.c b/tests/qual_fault.c index 05401dec..670d9fe7 100644 --- a/tests/qual_fault.c +++ b/tests/qual_fault.c @@ -2,7 +2,7 @@ * Check that fault injection works properly. * * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,11 +33,11 @@ #include <assert.h> #include <errno.h> #include <fcntl.h> +#include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <sys/param.h> #include <sys/stat.h> #include <sys/uio.h> #include <sys/wait.h> diff --git a/tests/qual_inject-syntax.test b/tests/qual_inject-syntax.test index 7aa61809..46cead28 100755 --- a/tests/qual_inject-syntax.test +++ b/tests/qual_inject-syntax.test @@ -2,7 +2,7 @@ # # Check -e inject= syntax. # -# Copyright (c) 2016-2017 Dmitry V. Levin <ldv@altlinux.org> +# Copyright (c) 2016-2018 Dmitry V. Levin <ldv@altlinux.org> # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -40,17 +40,7 @@ fail_with() "strace -e inject=$* failed to handle an argument error properly" } -for arg in '' , ,, ,,, : :: ::: \! \!, \!: \ - invalid_syscall_name \ - invalid_syscall_name:when=3 \ - -1 \!-1 \ - -1:when=4 \ - -2 \ - -2:when=5 \ - 32767 \!32767 \ - 32767:when=6 \ - 42 \ - chdir \ +for arg in 42 chdir \ chdir:42 \!chdir:42 \ chdir:42:when=7 \ chdir:invalid \ @@ -94,12 +84,6 @@ for arg in '' , ,, ,,, : :: ::: \! \!, \!: \ chdir:when=65536:error=30 \ chdir:when=1+65536 \ chdir:when=1+65536:error=31 \ - file,nonsense \ - \!desc,nonsense \ - chdir,nonsense \ - \!chdir,nonsense \ - 1,nonsense \ - \!1,nonsense \ chdir:retval=-1 \ chdir:signal=0 \ chdir:signal=129 \ diff --git a/tests/quotactl.gen.test b/tests/quotactl.gen.test index c6ad6e1e..6d2dc754 100755 --- a/tests/quotactl.gen.test +++ b/tests/quotactl.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (quotactl ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (quotactl ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/readahead.gen.test b/tests/readahead.gen.test index 4e88efa6..c27ab0d0 100755 --- a/tests/readahead.gen.test +++ b/tests/readahead.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readahead -a1); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readahead -a1 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a1 +run_strace_match_diff -a1 diff --git a/tests/readdir.gen.test b/tests/readdir.gen.test index 10da83b2..09aad4f6 100755 --- a/tests/readdir.gen.test +++ b/tests/readdir.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readdir -a16); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readdir -a16 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a16 +run_strace_match_diff -a16 diff --git a/tests/readlink.gen.test b/tests/readlink.gen.test index 755fc8b3..42632341 100755 --- a/tests/readlink.gen.test +++ b/tests/readlink.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readlink -xx); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readlink -xx ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -xx +run_strace_match_diff -xx diff --git a/tests/readlinkat.gen.test b/tests/readlinkat.gen.test index 2a502999..d7de9932 100755 --- a/tests/readlinkat.gen.test +++ b/tests/readlinkat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readlinkat -xx); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readlinkat -xx ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -xx +run_strace_match_diff -xx diff --git a/tests/reboot.c b/tests/reboot.c index ce651dc7..3f819ce8 100644 --- a/tests/reboot.c +++ b/tests/reboot.c @@ -10,21 +10,83 @@ # define INVALID_MAGIC 319887762 # define INVALID_CMD 0x01234568 +# define STR32 "AbCdEfGhIjKlMnOpQrStUvWxYz012345" +# define STR128 STR32 STR32 STR32 STR32 + int main(void) { + static const kernel_ulong_t bogus_magic1 = + (kernel_ulong_t) 0xFFFFFFFFFFFFFFFFULL; + static const kernel_ulong_t bogus_magic2 = + (kernel_ulong_t) 0xdeadfacefa57beefULL; + static const kernel_ulong_t bogus_cmd = + (kernel_ulong_t) 0xbadda7a09caffee1ULL; static const char buf[] = "reboot"; - long rc = syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, + static const char str256_buf[] = STR128 STR128; + + long rc; + char *str256 = tail_memdup(str256_buf, sizeof(str256_buf) - 1); + + rc = syscall(__NR_reboot, 0, 0, 0, 0); + printf("reboot(0 /* LINUX_REBOOT_MAGIC_??? */, " + "0 /* LINUX_REBOOT_MAGIC_??? */, " + "LINUX_REBOOT_CMD_CAD_OFF) = %s\n", + sprintrc(rc)); + + rc = syscall(__NR_reboot, bogus_magic1, bogus_magic2, bogus_cmd, -1); + printf("reboot(%#x /* LINUX_REBOOT_MAGIC_??? */, " + "%#x /* LINUX_REBOOT_MAGIC_??? */, " + "%#x /* LINUX_REBOOT_CMD_??? */) = %s\n", + (unsigned int) bogus_magic1, (unsigned int) bogus_magic2, + (unsigned int) bogus_cmd, sprintrc(rc)); + + rc = syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, INVALID_MAGIC, LINUX_REBOOT_CMD_RESTART2, buf); printf("reboot(LINUX_REBOOT_MAGIC1, %#x /* LINUX_REBOOT_MAGIC_??? */," - " LINUX_REBOOT_CMD_RESTART2, \"%s\") = %ld %s (%m)\n", - INVALID_MAGIC, buf, rc, errno2name()); + " LINUX_REBOOT_CMD_RESTART2, \"%s\") = %s\n", + INVALID_MAGIC, buf, sprintrc(rc)); rc = syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, INVALID_CMD); printf("reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2," - " %#x /* LINUX_REBOOT_CMD_??? */) = %ld %s (%m)\n", - INVALID_CMD, rc, errno2name()); + " %#x /* LINUX_REBOOT_CMD_??? */) = %s\n", + INVALID_CMD, sprintrc(rc)); + + rc = syscall(__NR_reboot, INVALID_MAGIC, LINUX_REBOOT_MAGIC2A, + LINUX_REBOOT_CMD_RESTART2, str256); + printf("reboot(%#x /* LINUX_REBOOT_MAGIC_??? */, LINUX_REBOOT_MAGIC2A, " + "LINUX_REBOOT_CMD_RESTART2, \"%.255s\"...) = %s\n", + INVALID_MAGIC, str256, sprintrc(rc)); + + rc = syscall(__NR_reboot, INVALID_MAGIC, LINUX_REBOOT_MAGIC2B, + LINUX_REBOOT_CMD_RESTART2, str256 + 1); + printf("reboot(%#x /* LINUX_REBOOT_MAGIC_??? */, LINUX_REBOOT_MAGIC2B, " + "LINUX_REBOOT_CMD_RESTART2, \"%.255s\"...) = %s\n", + INVALID_MAGIC, str256 + 1, sprintrc(rc)); + + rc = syscall(__NR_reboot, INVALID_MAGIC, LINUX_REBOOT_MAGIC2C, + LINUX_REBOOT_CMD_RESTART2, str256 + 2); + printf("reboot(%#x /* LINUX_REBOOT_MAGIC_??? */, LINUX_REBOOT_MAGIC2C, " + "LINUX_REBOOT_CMD_RESTART2, %p) = %s\n", + INVALID_MAGIC, str256 + 2, sprintrc(rc)); + + str256[255] = '\0'; + rc = syscall(__NR_reboot, INVALID_MAGIC, bogus_magic1, + LINUX_REBOOT_CMD_RESTART2, str256); + printf("reboot(%#x /* LINUX_REBOOT_MAGIC_??? */, " + "%#x /* LINUX_REBOOT_MAGIC_??? */, " + "LINUX_REBOOT_CMD_RESTART2, \"%.255s\"...) = %s\n", + INVALID_MAGIC, (unsigned int) bogus_magic1, str256, + sprintrc(rc)); + + rc = syscall(__NR_reboot, INVALID_MAGIC, bogus_magic1, + LINUX_REBOOT_CMD_RESTART2, str256 + 1); + printf("reboot(%#x /* LINUX_REBOOT_MAGIC_??? */, " + "%#x /* LINUX_REBOOT_MAGIC_??? */, " + "LINUX_REBOOT_CMD_RESTART2, \"%.254s\") = %s\n", + INVALID_MAGIC, (unsigned int) bogus_magic1, str256 + 1, + sprintrc(rc)); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/reboot.gen.test b/tests/reboot.gen.test index 0a48dea7..06d2f0cb 100755 --- a/tests/reboot.gen.test +++ b/tests/reboot.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (reboot ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (reboot -s 256); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff -s 256 diff --git a/tests/recvfrom.gen.test b/tests/recvfrom.gen.test index c23780c9..2741d210 100755 --- a/tests/recvfrom.gen.test +++ b/tests/recvfrom.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (recvfrom -a35); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (recvfrom -a35 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a35 +run_strace_match_diff -a35 diff --git a/tests/remap_file_pages.c b/tests/remap_file_pages.c index 452d2de7..4e409630 100644 --- a/tests/remap_file_pages.c +++ b/tests/remap_file_pages.c @@ -1,7 +1,7 @@ /* * Check decoding of remap_file_pages syscall. * - * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2017 Dmitry V. Levin <ldv@altlinux.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,22 +33,62 @@ #ifdef __NR_remap_file_pages # include <stdio.h> -# include <sys/mman.h> +# include <stdint.h> # include <unistd.h> +# include <linux/mman.h> + +static const char *errstr; + +static long +k_remap_file_pages(const kernel_ulong_t addr, + const kernel_ulong_t size, + const kernel_ulong_t prot, + const kernel_ulong_t pgoff, + const kernel_ulong_t flags) +{ + const long rc = syscall(__NR_remap_file_pages, + addr, size, prot, pgoff, flags); + errstr = sprintrc(rc); + return rc; +} int main(void) { - const unsigned long addr = (unsigned long) 0xfacefeeddeadbeefULL; - const unsigned long size = (unsigned long) 0xdefaced1bad2f00dULL; - const unsigned long prot = PROT_READ|PROT_WRITE|PROT_EXEC; - const unsigned long pgoff = (unsigned long) 0xcaf3babebad4deedULL; - const unsigned long flags = MAP_PRIVATE|MAP_ANONYMOUS; - - long rc = syscall(__NR_remap_file_pages, addr, size, prot, pgoff, flags); - printf("remap_file_pages(%#lx, %lu, %s, %lu, %s) = %ld %s (%m)\n", - addr, size, "PROT_READ|PROT_WRITE|PROT_EXEC", pgoff, - "MAP_PRIVATE|MAP_ANONYMOUS", rc, errno2name()); + kernel_ulong_t addr = (kernel_ulong_t) 0xfacefeeddeadbeefULL; + kernel_ulong_t size = (kernel_ulong_t) 0xdefaced1bad2f00dULL; + kernel_ulong_t prot = PROT_READ|PROT_WRITE|PROT_EXEC; + kernel_ulong_t pgoff = (kernel_ulong_t) 0xcaf3babebad4deedULL; + kernel_ulong_t flags = MAP_PRIVATE|MAP_ANONYMOUS; + + k_remap_file_pages(addr, size, prot, pgoff, flags); + printf("remap_file_pages(%#jx, %ju, %s, %ju, %s) = %s\n", + (uintmax_t) addr, (uintmax_t) size, + "PROT_READ|PROT_WRITE|PROT_EXEC", + (uintmax_t) pgoff, "MAP_PRIVATE|MAP_ANONYMOUS", errstr); + +#ifdef MAP_HUGETLB +# ifndef MAP_HUGE_2MB +# ifndef MAP_HUGE_SHIFT +# define MAP_HUGE_SHIFT 26 +# endif +# define MAP_HUGE_2MB (21 << MAP_HUGE_SHIFT) +# endif /* !MAP_HUGE_2MB */ + addr = (kernel_ulong_t) 0xfacefeeddeadf00dULL; + size = (kernel_ulong_t) 0xdefaced1bad2beefULL; + prot = (kernel_ulong_t) 0xdefaced00000000ULL | PROT_NONE; + flags = MAP_TYPE | MAP_FIXED | MAP_NORESERVE | MAP_HUGETLB | MAP_HUGE_2MB; + + k_remap_file_pages(addr, size, prot, pgoff, flags); + printf("remap_file_pages(%#jx, %ju, %s, %ju" + ", %#x /* MAP_??? */" + "|MAP_FIXED|MAP_NORESERVE|MAP_HUGETLB|21<<MAP_HUGE_SHIFT)" + " = %s\n", + (uintmax_t) addr, (uintmax_t) size, + prot == PROT_NONE ? "PROT_NONE" : + "0xdefaced00000000 /* PROT_??? */", + (uintmax_t) pgoff, MAP_TYPE, errstr); +#endif /* MAP_HUGETLB */ puts("+++ exited with 0 +++"); return 0; diff --git a/tests/remap_file_pages.gen.test b/tests/remap_file_pages.gen.test index e4894736..b3589886 100755 --- a/tests/remap_file_pages.gen.test +++ b/tests/remap_file_pages.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (remap_file_pages ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (remap_file_pages ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/rename.gen.test b/tests/rename.gen.test index 07f01801..81fb0398 100755 --- a/tests/rename.gen.test +++ b/tests/rename.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rename -a35); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rename -a35 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a35 +run_strace_match_diff -a35 diff --git a/tests/renameat.gen.test b/tests/renameat.gen.test index f2879cdc..dbc6e05b 100755 --- a/tests/renameat.gen.test +++ b/tests/renameat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (renameat ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (renameat ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/renameat2.gen.test b/tests/renameat2.gen.test index cd7c34ca..78251cb2 100755 --- a/tests/renameat2.gen.test +++ b/tests/renameat2.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (renameat2 ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (renameat2 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/riscv_flush_icache.c b/tests/riscv_flush_icache.c new file mode 100644 index 00000000..8aaeda51 --- /dev/null +++ b/tests/riscv_flush_icache.c @@ -0,0 +1,93 @@ +/* + * Check decoding of riscv_flush_icache syscall. + * + * Copyright (c) 2018 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" + +#include <asm/unistd.h> + +#include "scno.h" + +#ifdef __NR_riscv_flush_icache + +# include <stdint.h> +# include <stdio.h> +# include <unistd.h> + +int main(void) +{ + static struct { + kernel_ulong_t addr; + const char *str; + } addrs[] = { + { (kernel_ulong_t) (uintptr_t) ARG_STR(NULL) }, + { (kernel_ulong_t) 0xbadc0deddeadf157ULL, + sizeof(kernel_ulong_t) == 8 ? "0xbadc0deddeadf157" : + "0xdeadf157" }, + }; + static struct { + kernel_ulong_t val; + const char *str; + } flags[] = { + { ARG_STR(0) }, + { 1, "SYS_RISCV_FLUSH_ICACHE_LOCAL" }, + { (kernel_ulong_t) 0xfacefeedfffffffeULL, + sizeof(kernel_ulong_t) == 8 ? + "0xfacefeedfffffffe /* SYS_RISCV_FLUSH_ICACHE_??? */" : + "0xfffffffe /* SYS_RISCV_FLUSH_ICACHE_??? */" }, + { (kernel_ulong_t) 0xfacefeedffffffffULL, + sizeof(kernel_ulong_t) == 8 ? + "SYS_RISCV_FLUSH_ICACHE_LOCAL|0xfacefeedfffffffe" : + "SYS_RISCV_FLUSH_ICACHE_LOCAL|0xfffffffe" }, + }; + + for (size_t i = 0; i < ARRAY_SIZE(addrs); i++) { + for (size_t j = 0; j < ARRAY_SIZE(addrs); j++) { + for (size_t k = 0; k < ARRAY_SIZE(flags); k++) { + long rc = syscall(__NR_riscv_flush_icache, + addrs[i].addr, + addrs[j].addr, + flags[k].val); + + printf("riscv_flush_icache(%s, %s, %s) = %s\n", + addrs[i].str, addrs[j].str, flags[k].str, + sprintrc(rc)); + } + } + } + + puts("+++ exited with 0 +++"); + + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_riscv_flush_icache"); + +#endif diff --git a/tests/riscv_flush_icache.gen.test b/tests/riscv_flush_icache.gen.test new file mode 100755 index 00000000..1a1f793a --- /dev/null +++ b/tests/riscv_flush_icache.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (riscv_flush_icache -a34 ); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a34 diff --git a/tests/rmdir.gen.test b/tests/rmdir.gen.test index b511039d..8b346af9 100755 --- a/tests/rmdir.gen.test +++ b/tests/rmdir.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rmdir -a22); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rmdir -a22 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a22 +run_strace_match_diff -a22 diff --git a/tests/rt_sigpending.gen.test b/tests/rt_sigpending.gen.test index 0458876b..d52858af 100755 --- a/tests/rt_sigpending.gen.test +++ b/tests/rt_sigpending.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigpending -a20); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigpending -a20 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a20 +run_strace_match_diff -a20 diff --git a/tests/rt_sigprocmask.gen.test b/tests/rt_sigprocmask.gen.test index a21c6dbb..67fcdc0f 100755 --- a/tests/rt_sigprocmask.gen.test +++ b/tests/rt_sigprocmask.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigprocmask ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigprocmask ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/rt_sigqueueinfo.gen.test b/tests/rt_sigqueueinfo.gen.test index 7baf0e48..d11eecc0 100755 --- a/tests/rt_sigqueueinfo.gen.test +++ b/tests/rt_sigqueueinfo.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigqueueinfo -esignal=none); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigqueueinfo -esignal=none ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -esignal=none +run_strace_match_diff -esignal=none diff --git a/tests/rt_sigreturn.gen.test b/tests/rt_sigreturn.gen.test index 0672f113..d8b153e3 100755 --- a/tests/rt_sigreturn.gen.test +++ b/tests/rt_sigreturn.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigreturn -esignal='!USR1'); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigreturn -esignal='!USR1' ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -esignal='!USR1' +run_strace_match_diff -esignal='!USR1' diff --git a/tests/rt_sigtimedwait.gen.test b/tests/rt_sigtimedwait.gen.test index 2b18e7af..a9409ae9 100755 --- a/tests/rt_sigtimedwait.gen.test +++ b/tests/rt_sigtimedwait.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigtimedwait -a38); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_sigtimedwait -a38 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a38 +run_strace_match_diff -a38 diff --git a/tests/rt_tgsigqueueinfo.gen.test b/tests/rt_tgsigqueueinfo.gen.test index 407bbffa..0539e35a 100755 --- a/tests/rt_tgsigqueueinfo.gen.test +++ b/tests/rt_tgsigqueueinfo.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_tgsigqueueinfo -esignal=none); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (rt_tgsigqueueinfo -esignal=none ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -esignal=none +run_strace_match_diff -esignal=none diff --git a/tests/run.sh b/tests/run.sh index d1b796ca..208aa0f9 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -9,4 +9,9 @@ TIMEOUT="timeout -k 5 -s XCPU $TIMEOUT_DURATION" $TIMEOUT true > /dev/null 2>&1 || TIMEOUT= -exec $TIMEOUT "$@" +if [ $# -eq 0 ]; then + echo 'No command or test-file specified' >&2 + exit 1 +fi + +exec $TIMEOUT "$@" < /dev/null diff --git a/tests/s390_guarded_storage-v.c b/tests/s390_guarded_storage-v.c new file mode 100644 index 00000000..05afd9fe --- /dev/null +++ b/tests/s390_guarded_storage-v.c @@ -0,0 +1,2 @@ +#define VERBOSE 1 +#include "s390_guarded_storage.c" diff --git a/tests/s390_guarded_storage-v.gen.test b/tests/s390_guarded_storage-v.gen.test new file mode 100755 index 00000000..045ff762 --- /dev/null +++ b/tests/s390_guarded_storage-v.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (s390_guarded_storage-v -e trace=s390_guarded_storage -a32 -v); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -e trace=s390_guarded_storage -a32 -v diff --git a/tests/s390_guarded_storage.c b/tests/s390_guarded_storage.c new file mode 100644 index 00000000..ab67c158 --- /dev/null +++ b/tests/s390_guarded_storage.c @@ -0,0 +1,229 @@ +/* + * Check decoding of s390_guarded_storage syscall. + * + * Copyright (c) 2018 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" +#include <asm/unistd.h> + +#if defined __NR_s390_guarded_storage && defined HAVE_ASM_GUARDED_STORAGE_H + +# include <inttypes.h> +# include <stdbool.h> +# include <stdint.h> +# include <stdio.h> +# include <unistd.h> + +# include <asm/guarded_storage.h> + +# ifndef VERBOSE +# define VERBOSE 0 +# endif + +static void +gs_no_arg(kernel_ulong_t val, const char *val_str) +{ + static const kernel_ulong_t bogus_addr = + (kernel_ulong_t) 0xcaffeedadeadbed5ULL; + static const kernel_ulong_t bogus_cmd_mask = + (kernel_ulong_t) 0xbadc0ded00000000ULL; + long rc; + + rc = syscall(__NR_s390_guarded_storage, val | bogus_cmd_mask, + bogus_addr); + printf("s390_guarded_storage(%s) = %s\n", val_str, sprintrc(rc)); +} + +static void +gs_print_epl(uint64_t addr, bool valid, const char *str) +{ + if (!valid) { + if (str) + printf("%s", str); + else + printf("%#" PRIx64, addr); + + return; + } + + struct gs_epl *gsepl = (struct gs_epl *) (uintptr_t) addr; + + printf("[{"); + +# if VERBOSE + if (gsepl->pad1) + printf("pad1=%#02x, ", gsepl->pad1); + + printf("gs_eam=%#02x /* extended addressing mode: %u, " + "basic addressing mode: %u */" + ", gs_eci=%#02x /* CPU in TX: %u, CPU in CX: %u, " + "instruction: %s */" + ", gs_eai=%#02x /* DAT: %u, address space indication: %u, " + "AR number: %u */, ", + gsepl->gs_eam, gsepl->e, gsepl->b, + gsepl->gs_eci, gsepl->tx, gsepl->cx, + gsepl->in ? "LLGFGS": "LGG", + gsepl->gs_eai, gsepl->t, gsepl->as, gsepl->ar); + + if (gsepl->pad2) + printf("pad2=%#08x, ", gsepl->pad2); +# endif /* VERBOSE */ + + printf("gs_eha=%#llx, ", (unsigned long long) gsepl->gs_eha); + +# if VERBOSE + printf("gs_eia=%#llx, gs_eoa=%#llx, gs_eir=%#llx, gs_era=%#llx", + (unsigned long long) gsepl->gs_eia, + (unsigned long long) gsepl->gs_eoa, + (unsigned long long) gsepl->gs_eir, + (unsigned long long) gsepl->gs_era); +# else /* !VERBOSE */ + printf("..."); +# endif /* VERBOSE */ + + printf("}]"); +} + +static void +gs_set_cb(kernel_ulong_t addr, bool valid, bool epl_valid, + const char *bc_str, const char *epl_str) +{ + static const kernel_ulong_t bogus_cmd_mask = + (kernel_ulong_t) 0xda7a105700000000ULL; + + long rc; + + printf("s390_guarded_storage(GS_SET_BC_CB, "); + + if (valid) { + struct gs_cb *gscb = (struct gs_cb *) (uintptr_t) addr; + + printf("{"); + + if (gscb->reserved) + printf("reserved=%#016llx, ", + (unsigned long long) gscb->reserved); + + printf("gsd=%#16llx", + (unsigned long long) gscb->gsd); +# if VERBOSE + printf(" /* GS origin: "); + + unsigned int gsc = gscb->gsd & 0x3F; + unsigned int gls = (gscb->gsd >> 8) & 7; + bool gsc_valid = gsc >= 25 && gsc <= 56; + + if (gsc_valid) { + uint64_t gls = gscb->gsd >> gsc; + int field_size = 2 + (67 - gsc) / 4; + + printf("%#0*" PRIx64, field_size, gls); + } else { + printf("[invalid]"); + } + + printf(", guard load shift: %u, GS characteristic: %u */", + gls, gsc); +# endif /* VERBOSE */ + + printf(", gssm=%#016llx, gs_epl_a=", + (unsigned long long) gscb->gssm); + + gs_print_epl(gscb->gs_epl_a, epl_valid, epl_str); + + printf("}"); + } else { + if (bc_str) + printf("%s", bc_str); + else + printf("%#llx", (unsigned long long) addr); + } + + rc = syscall(__NR_s390_guarded_storage, + GS_SET_BC_CB | bogus_cmd_mask, addr); + printf(") = %s\n", sprintrc(rc)); +} + +int +main(void) +{ + static const kernel_ulong_t bogus_cmd = + (kernel_ulong_t) 0xdeafbeefdeadc0deULL; + static const kernel_ulong_t bogus_addr = + (kernel_ulong_t) 0xfacefeedac0ffeedULL; + + struct gs_cb *gscb = tail_alloc(sizeof(*gscb)); + struct gs_epl *gsepl = tail_alloc(sizeof(*gsepl)); + + long rc; + + rc = syscall(__NR_s390_guarded_storage, 5, 0); + printf("s390_guarded_storage(0x5 /* GS_??? */, NULL) = %s\n", + sprintrc(rc)); + + rc = syscall(__NR_s390_guarded_storage, bogus_cmd, bogus_addr); + printf("s390_guarded_storage(%#x /* GS_??? */, %#lx) = %s\n", + (unsigned) bogus_cmd, (unsigned long) bogus_addr, sprintrc(rc)); + + gs_no_arg(ARG_STR(GS_BROADCAST)); + gs_no_arg(ARG_STR(GS_CLEAR_BC_CB)); + gs_no_arg(ARG_STR(GS_DISABLE)); + gs_no_arg(ARG_STR(GS_ENABLE)); + + fill_memory(gscb, sizeof(*gscb)); + fill_memory_ex(gsepl, sizeof(*gsepl), 0xA5, 0x5A); + + gs_set_cb(0, false, false, "NULL", NULL); + gs_set_cb((uintptr_t) (gscb + 1), false, false, NULL, NULL); + + gscb->gs_epl_a = 0; + gs_set_cb((uintptr_t) gscb, true, false, NULL, "NULL"); + + fill_memory_ex(gscb, sizeof(*gscb), 0x5A, 0xA5); + gscb->gs_epl_a = (uintptr_t) (gsepl + 1) | + (sizeof(kernel_ulong_t) < sizeof(uint64_t) ? + 0xc0debad000000000ULL : 0); + gs_set_cb((uintptr_t) gscb, true, false, NULL, NULL); + + fill_memory_ex(gscb, sizeof(*gscb), 0xA7, 0xA5); + gscb->gs_epl_a = (uintptr_t) gsepl; + gs_set_cb((uintptr_t) gscb, true, true, NULL, NULL); + + fill_memory_ex(gscb, sizeof(*gscb), 0x55, 0xAA); + fill_memory_ex(gsepl, sizeof(*gsepl), 0x5A, 0xA5); + gscb->gs_epl_a = (uintptr_t) gsepl; + gs_set_cb((uintptr_t) gscb, true, true, NULL, NULL); + + puts("+++ exited with 0 +++"); + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_s390_guarded_storage && HAVE_ASM_GUARDED_STORAGE_H") + +#endif diff --git a/tests/s390_guarded_storage.gen.test b/tests/s390_guarded_storage.gen.test new file mode 100755 index 00000000..28b59814 --- /dev/null +++ b/tests/s390_guarded_storage.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (s390_guarded_storage -a32 ); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a32 diff --git a/tests/s390_pci_mmio_read_write.c b/tests/s390_pci_mmio_read_write.c new file mode 100644 index 00000000..b493948d --- /dev/null +++ b/tests/s390_pci_mmio_read_write.c @@ -0,0 +1,155 @@ +/* + * Check decoding of s390_pci_mmio_read and s390_pci_mmio_write syscalls. + * + * Copyright (c) 2018 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" +#include <asm/unistd.h> + +#if defined __NR_s390_pci_mmio_read && defined __NR_s390_pci_mmio_write + +# include <errno.h> +# include <stdbool.h> +# include <stdint.h> +# include <stdio.h> +# include <unistd.h> + +static void +do_call(bool wr, kernel_ulong_t mmio_addr, kernel_ulong_t buf, + kernel_ulong_t len, bool buf_valid, const char *buf_str) +{ + long saved_errno = 0; + long rc = 0; + + printf("s390_pci_mmio_%s(%#llx, ", wr ? "write" : "read", + (unsigned long long) mmio_addr); + + if (!wr) { + rc = syscall(__NR_s390_pci_mmio_read, mmio_addr, buf, len); + saved_errno = errno; + } + + if (buf_valid && !rc) { + char *buf_ptr = (char *) (uintptr_t) buf; + + print_quoted_hex(buf_ptr, + len > DEFAULT_STRLEN ? DEFAULT_STRLEN : len); + + if (len > DEFAULT_STRLEN) + printf("..."); + } else { + if (buf_str) + printf("%s", buf_str); + else + printf("%#llx", (unsigned long long) buf); + } + + printf(", %llu) = ", (unsigned long long) len); + + if (wr) + rc = syscall(__NR_s390_pci_mmio_write, mmio_addr, buf, len); + else + errno = saved_errno; + + puts(sprintrc(rc)); +} + +int +main(void) +{ + static const size_t buf_size = DEFAULT_STRLEN + 10; + + char *buf = tail_alloc(buf_size); + + bool bools[] = { true, false }; + + kernel_ulong_t addrs[] = { + 0, + (kernel_ulong_t) 0xdeafbeefdeadc0deULL, + }; + + struct { + kernel_ulong_t buf; + const char *str; + size_t size; + } bufs[] = { + { (kernel_ulong_t) ARG_STR(NULL), 0 }, + { (kernel_ulong_t) (buf + buf_size), NULL, 0 }, + { (kernel_ulong_t) (buf), NULL, buf_size }, + { (kernel_ulong_t) (buf + 9), NULL, buf_size - 9 }, + { (kernel_ulong_t) (buf + 10), NULL, buf_size - 10 }, + { (kernel_ulong_t) (buf + 16), NULL, buf_size - 16 }, + { (kernel_ulong_t) (buf + 26), NULL, buf_size - 26 }, + { (kernel_ulong_t) (buf + 28), NULL, buf_size - 28 }, + }; + + kernel_ulong_t sizes[] = { + 0, + DEFAULT_STRLEN / 2, + DEFAULT_STRLEN - 10, + DEFAULT_STRLEN, + DEFAULT_STRLEN + 1, + buf_size, + buf_size + 10, + (kernel_ulong_t) 0xfacefeedac0ffeedULL, + }; + + unsigned int i, j, k, l; + unsigned int ctr = 0; + + for (i = 0; i < ARRAY_SIZE(addrs); i++) { + for (j = 0; j < ARRAY_SIZE(bufs); j++) { + for (k = 0; k < ARRAY_SIZE(sizes); k++) { + for (l = 0; l < ARRAY_SIZE(bools); l++) { + bool valid = bufs[j].buf && + bufs[j].size >= + MIN(sizes[k], + DEFAULT_STRLEN + 1); + + if (bufs[j].size && bools[l]) + fill_memory_ex((char *) buf, + bufs[j].size, + 0xC0 + ctr, 255); + + do_call(bools[l], addrs[i], bufs[j].buf, + sizes[k], valid, bufs[j].str); + + ctr++; + } + } + } + } + + puts("+++ exited with 0 +++"); + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_s390_pci_mmio_read && __NR_s390_pci_mmio_write"); + +#endif diff --git a/tests/s390_pci_mmio_read_write.gen.test b/tests/s390_pci_mmio_read_write.gen.test new file mode 100755 index 00000000..cf32e0b3 --- /dev/null +++ b/tests/s390_pci_mmio_read_write.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (s390_pci_mmio_read_write -e trace=s390_pci_mmio_read,s390_pci_mmio_write -a30); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -e trace=s390_pci_mmio_read,s390_pci_mmio_write -a30 diff --git a/tests/s390_runtime_instr.c b/tests/s390_runtime_instr.c new file mode 100644 index 00000000..861bbd4a --- /dev/null +++ b/tests/s390_runtime_instr.c @@ -0,0 +1,99 @@ +/* + * Check decoding of s390_runtime_instr syscall. + * + * Copyright (c) 2018 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" +#include <asm/unistd.h> + +#if defined __NR_s390_runtime_instr + +# include <errno.h> +# include <signal.h> +# include <stdio.h> +# include <unistd.h> + +int +main(void) +{ + static struct { + kernel_ulong_t cmd; + const char * cmd_str; + } cmd_args[] = { + { 0, "???" }, + { 4, "???" }, + { (kernel_ulong_t) 0xdeafbeefdeadc0deULL, "???" }, + { 2, "STOP", }, + }; + + static struct { + kernel_ulong_t sig; + const char * sig_str; + } start_sig_args[] = { + { 0, "SIG_0" }, + { (kernel_ulong_t) 0xfacefeedac0ffeedULL, NULL }, + { ARG_STR(SIGALRM) }, + { 33, "SIGRT_1" }, + { 63, "SIGRT_31" }, + }; + + unsigned int i; + long rc; + + for (i = 0; i < ARRAY_SIZE(cmd_args); i++) { + rc = syscall(__NR_s390_runtime_instr, cmd_args[i].cmd, 0xdead); + printf("s390_runtime_instr(%d /* S390_RUNTIME_INSTR_%s */) = " + "%s\n", + (int) cmd_args[i].cmd, cmd_args[i].cmd_str, + sprintrc(rc)); + } + + for (i = 0; i < ARRAY_SIZE(start_sig_args); i++) { + long saved_errno; + + rc = syscall(__NR_s390_runtime_instr, 1, start_sig_args[i].sig); + saved_errno = errno; + printf("s390_runtime_instr(1 /* S390_RUNTIME_INSTR_START */, "); + + if (start_sig_args[i].sig_str) + printf("%s", start_sig_args[i].sig_str); + else + printf("%d", (int) start_sig_args[i].sig); + + errno = saved_errno; + printf(") = %s\n", sprintrc(rc)); + } + + puts("+++ exited with 0 +++"); + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_s390_runtime_instr") + +#endif diff --git a/tests/s390_runtime_instr.gen.test b/tests/s390_runtime_instr.gen.test new file mode 100755 index 00000000..9197dc33 --- /dev/null +++ b/tests/s390_runtime_instr.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (s390_runtime_instr -a50 ); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a50 diff --git a/tests/s390_sthyi-v.c b/tests/s390_sthyi-v.c new file mode 100644 index 00000000..86055203 --- /dev/null +++ b/tests/s390_sthyi-v.c @@ -0,0 +1,2 @@ +#define VERBOSE 1 +#include "s390_sthyi.c" diff --git a/tests/s390_sthyi-v.gen.test b/tests/s390_sthyi-v.gen.test new file mode 100755 index 00000000..27ab447b --- /dev/null +++ b/tests/s390_sthyi-v.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (s390_sthyi-v -e trace=s390_sthyi -a47 -v); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -e trace=s390_sthyi -a47 -v diff --git a/tests/s390_sthyi.c b/tests/s390_sthyi.c new file mode 100644 index 00000000..8b241dd2 --- /dev/null +++ b/tests/s390_sthyi.c @@ -0,0 +1,786 @@ +/* + * Check decoding of s390_sthyi syscall. + * + * Copyright (c) 2018 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" +#include <asm/unistd.h> + +#if defined HAVE_ICONV_H && defined HAVE_ICONV_OPEN && defined __NR_s390_sthyi + +# include <errno.h> +# include <iconv.h> +# include <inttypes.h> +# include <stdbool.h> +# include <stdint.h> +# include <stdio.h> +# include <unistd.h> + +# include <sys/user.h> + +# define EBCDIC_MAX_LEN 16 + +# ifndef VERBOSE +# define VERBOSE 0 +# endif + +static bool +print_0x8(const char *prefix, unsigned char *buf, unsigned int offs, bool zero) +{ + if (!zero && !buf[offs]) + return false; + + printf("%s=%#02hhx", prefix, buf[offs]); + + return true; +} + +static bool +print_u8(const char *prefix, unsigned char *buf, unsigned int offs, bool zero) +{ + if (!zero && !buf[offs]) + return false; + + printf("%s=%hhu", prefix, buf[offs]); + + return true; +} + +static bool +print_u16(const char *prefix, unsigned char *buf, unsigned int offs, bool zero) +{ + uint16_t val = *(uint16_t *) (buf + offs); + + if (!zero && !val) + return false; + + printf("%s=%" PRIu16, prefix, val); + + return true; +} + +static bool +print_x32(const char *prefix, unsigned char *buf, unsigned int offs, bool zero) +{ + uint32_t val = *(uint32_t *) (buf + offs); + + if (!zero && !val) + return false; + + printf("%s=%#" PRIx32, prefix, val); + + return true; +} + +static bool +print_weight(const char *prefix, unsigned char *buf, unsigned int offs, + bool zero) +{ + uint32_t val = *(uint32_t *) (buf + offs); + + if (print_x32(prefix, buf, offs, zero)) { + if (val) + printf(" /* %u %u/65536 cores */", + val >> 16, val & 0xFFFF); + else + printf(" /* unlimited */"); + + return true; + } + + return false; +} + +static char * +ebcdic2ascii(unsigned char *ebcdic, size_t size) +{ + static char ascii_buf[EBCDIC_MAX_LEN]; + + char *ebcdic_pos = (char *) ebcdic; + char *ascii_pos = ascii_buf; + size_t ebcdic_left = size; + size_t ascii_left = size; + size_t ret; + + iconv_t cd = iconv_open("ASCII", "EBCDICUS"); + + if (size > sizeof(ascii_buf)) + error_msg_and_fail("ebcdic2ascii: EBCDIC string is too big: " + "%zu (maximum is %zu)", + size, sizeof(ascii_buf)); + if (cd == (iconv_t) -1) + perror_msg_and_fail("ebcdic2ascii: unable to allocate a " + "conversion descriptior for converting " + "EBCDIC to ASCII"); + + while ((ret = iconv(cd, &ebcdic_pos, &ebcdic_left, + &ascii_pos, &ascii_left)) == (size_t) -1) { + switch (errno) { + case EILSEQ: + case EINVAL: /* That one is quite unexpected, actually */ + if (!ebcdic_left || !ascii_left) + goto ebcdic2ascii_end; + + *ascii_pos++ = ' '; + ebcdic_pos++; + ebcdic_left--; + + break; + + case E2BIG: + perror_msg_and_fail("ebcdic2ascii: ran out of " + "ASCII buffer unexpectedly"); + default: + perror_msg_and_fail("ebcdic2ascii: unexpected error"); + } + } + +ebcdic2ascii_end: + iconv_close(cd); + + if (ebcdic_left != ascii_left) + error_msg_and_fail("ebcdic2ascii: ASCII string differs in size " + "from EBCDIC"); + + return ascii_buf; +} + +# if VERBOSE +static bool +is_empty(unsigned char *ptr, size_t size) +{ + size_t i; + + for (i = 0; !*ptr && i < size; ptr++, i++) + ; + + return i == size; +} +# endif /* !VERBOSE */ + +static bool +print_ebcdic(const char *prefix, unsigned char *addr, unsigned int offs, + size_t size, bool zero, bool blank) +{ + const char *ascii = ebcdic2ascii(addr + offs, size); + + if (!zero) { + size_t i; + + for (i = 0; (addr[offs + i] == (blank ? 64 : 0)) && (i < size); + i++) + ; + + if (i == size) + return false; + } + + printf("%s=", prefix); + print_quoted_hex((char *) (addr + offs), size); + printf(" /* "); + print_quoted_memory(ascii, size); + printf(" */"); + + return true; +} + +static void +print_hypervisor_header(unsigned char *buf, int level, unsigned int offs_pos, + unsigned int len_pos, bool mt) +{ + uint16_t offs = *(uint16_t *) (buf + offs_pos); + uint16_t hdr_size = *(uint16_t *) (buf + len_pos); + unsigned char *cur; + + if (!offs) + return; + if (hdr_size < 32) + error_msg_and_fail("sthyi: hypervisor %d section is too small " + "(got %hu, 32 expected)", level, hdr_size); + + cur = buf + offs; + + printf(", /* hypervisor %d */ {infyflg1", level); + print_0x8("", cur, 0, true); +# if VERBOSE + if (cur[0]) { + bool printed = false; + + printf(" /* "); + if (cur[0] & 0x80) { + printf("0x80 - guest CPU usage had limiting is using " + "the consumption method"); + printed = true; + } + if (cur[0] & 0x40) { + if (printed) + printf(", "); + printf("0x40 - LIMITHARD caps use prorated core time " + "for capping"); + printed = true; + } + if (cur[0] & 0x3F) { + if (printed) + printf(", "); + printf("%#hhx - ???", cur[0] & 0x3F); + } + printf(" */"); + } + + print_0x8(", infyflg2", cur, 1, false); + print_0x8(", infyval1", cur, 2, false); + print_0x8(", infyval2", cur, 3, false); + + print_u8(", infytype", cur, 4, true); + if (cur[4] == 1) + printf(" /* z/VM is the hypervisor */"); + else + printf(" /* unknown hypervisor type */"); + + if (cur[5]) + printf(", reserved_1__=\"\\x%#02hhx\"", cur[5]); + + print_u8(", infycpt", cur, 6, mt); + print_u8(", infyiflt", cur, 7, mt); +# endif /* !VERBOSE */ + + print_ebcdic(", infysyid", cur, 8, 8, VERBOSE, true); + print_ebcdic(", infyclnm", cur, 16, 8, VERBOSE, true); + + print_u16(", infyscps", cur, 24, VERBOSE); + print_u16(", infydcps", cur, 26, VERBOSE); + print_u16(", infysifl", cur, 28, VERBOSE); + print_u16(", infydifl", cur, 30, VERBOSE); + +# if VERBOSE + if (hdr_size > 32 && !is_empty(cur + 32, hdr_size - 32)) { + printf(", "); + print_quoted_hex((char *) (cur + 32), hdr_size - 32); + } +# else /* !VERBOSE */ + printf(", ..."); +# endif /* !VERBOSE */ + + printf("}"); +} + +static void +print_guest_header(unsigned char *buf, int level, unsigned int offs_pos, + unsigned int len_pos) +{ + uint16_t offs = *(uint16_t *) (buf + offs_pos); + uint16_t hdr_size = *(uint16_t *) (buf + len_pos); + unsigned char *cur; + + if (!offs) + return; + if (hdr_size < 56) + error_msg_and_fail("sthyi: guest %d section is too small " + "(got %hu, 56 expected)", level, hdr_size); + + cur = buf + offs; + + printf(", /* guest %d */ {infgflg1", level); + print_0x8("", cur, 0, true); +# if VERBOSE + if (cur[0]) { + bool printed = false; + + printf(" /* "); + if (cur[0] & 0x80) { + printf("0x80 - guest is mobility enabled"); + printed = true; + } + if (cur[0] & 0x40) { + if (printed) + printf(", "); + printf("0x40 - guest has multiple virtual CPU types"); + printed = true; + } + if (cur[0] & 0x20) { + if (printed) + printf(", "); + printf("0x20 - guest CP dispatch type has LIMITHARD " + "cap"); + printed = true; + } + if (cur[0] & 0x10) { + if (printed) + printf(", "); + printf("0x10 - guest IFL dispatch type has LIMITHARD " + "cap"); + printed = true; + } + if (cur[0] & 0x08) { + if (printed) + printf(", "); + printf("0x08 - virtual CPs are thread dispatched"); + printed = true; + } + if (cur[0] & 0x04) { + if (printed) + printf(", "); + printf("0x04 - virtual IFLs are thread dispatched"); + printed = true; + } + if (cur[0] & 0x3) { + if (printed) + printf(", "); + printf("%#hhx - ???", cur[0] & 0x3); + } + printf(" */"); + } + + print_0x8(", infgflg2", cur, 1, false); + print_0x8(", infgval1", cur, 2, false); + print_0x8(", infgval2", cur, 3, false); +# endif /* !VERBOSE */ + + print_ebcdic(", infgusid", cur, 4, 8, true, false); + + print_u16(", infgscps", cur, 12, VERBOSE); + print_u16(", infgdcps", cur, 14, VERBOSE); + +# if VERBOSE + print_u8(", infgcpdt", cur, 16, true); + if (cur[16] == 0) + printf(" /* General Purpose (CP) */"); + else + printf(" /* unknown */"); + + if (cur[17] || cur[18] || cur[19]) + printf(", reserved_1__=\"\\x%#02hhx\\x%#02hhx\\x%#02hhx\"", + cur[17], cur[18], cur[19]); +# endif /* !VERBOSE */ + + print_weight(", infgcpcc", cur, 20, VERBOSE); + + print_u16(", infgsifl", cur, 24, VERBOSE); + print_u16(", infgdifl", cur, 26, VERBOSE); + +# if VERBOSE + print_u8(", infgifdt", cur, 28, true); + if (cur[28] == 0) + printf(" /* General Purpose (CP) */"); + else if (cur[28] == 3) + printf(" /* Integrated Facility for Linux (IFL) */"); + else + printf(" /* unknown */"); + + if (cur[29] || cur[30] || cur[31]) + printf(", reserved_2__=\"\\x%#02hhx\\x%#02hhx\\x%#02hhx\"", + cur[29], cur[30], cur[31]); +# endif /* !VERBOSE */ + + print_weight(", infgifcc", cur, 32, VERBOSE); + + print_0x8(", infgpflg", cur, 36, true); +# if VERBOSE + if (cur[36]) { + bool printed = false; + + printf(" /* "); + if (cur[36] & 0x80) { + printf("0x80 - CPU pool's CP virtual type has " + "LIMITHARD cap"); + printed = true; + } + if (cur[36] & 0x40) { + if (printed) + printf(", "); + printf("0x40 - CPU pool's CP virtual type has " + "CAPACITY cap"); + printed = true; + } + if (cur[36] & 0x20) { + if (printed) + printf(", "); + printf("0x20 - CPU pool's IFL virtual type has " + "LIMITHARD cap"); + printed = true; + } + if (cur[36] & 0x10) { + if (printed) + printf(", "); + printf("0x10 - CPU pool's IFL virtual type has " + "CAPACITY cap"); + printed = true; + } + if (cur[36] & 0x08) { + if (printed) + printf(", "); + printf("0x08 - CPU pool uses prorated core time"); + printed = true; + } + if (cur[36] & 0x7) { + if (printed) + printf(", "); + printf("%#hhx - ???", cur[36] & 0x7); + } + printf(" */"); + } + + if (cur[37] || cur[38] || cur[39]) + printf(", reserved_3__=\"\\x%#02hhx\\x%#02hhx\\x%#02hhx\"", + cur[37], cur[38], cur[39]); + + print_ebcdic(", infgpnam", cur, 40, 8, false, true); + + print_weight(", infgpccc", cur, 48, true); + print_weight(", infgpicc", cur, 52, true); + + if (hdr_size > 56 && !is_empty(cur + 56, hdr_size - 56)) { + printf(", "); + print_quoted_hex((char *) (cur + 56), hdr_size - 56); + } +# else /* !VERBOSE */ + printf(", ..."); +# endif /* !VERBOSE */ + + printf("}"); +} + +static void +print_sthyi(unsigned char *buf) +{ + unsigned char *cur; + uint16_t hdr_size; + uint16_t offs; + bool mt = false; + + hdr_size = *(uint16_t *) (buf + 10); + if (hdr_size < 44) + error_msg_and_fail("sthyi: header section is too small " + "(got %hu, 44 expected)", hdr_size); + + /* INFHFLG1 */ + print_0x8("{/* header */ {infhflg1", buf, 0, true); +# if VERBOSE + if (buf[0]) { + bool printed = false; + + printf(" /* "); + if (buf[0] & 0x80) { + printf("0x80 - Global Performance Data unavailable"); + printed = true; + } + if (buf[0] & 0x40) { + if (printed) + printf(", "); + printf("0x40 - One or more hypervisor levels below " + "this level does not support the STHYI " + "instruction"); + printed = true; + } + if (buf[0] & 0x20) { + if (printed) + printf(", "); + printf("0x20 - Virtualization stack is incomplete"); + printed = true; + } + if (buf[0] & 0x10) { + if (printed) + printf(", "); + printf("0x10 - Execution environment is not within a " + "logical partition"); + printed = true; + } + if (buf[0] & 0xF) { + if (printed) + printf(", "); + printf("%#hhx - ???", buf[0] & 0xF); + } + printf(" */"); + } + + print_0x8(", infhflg2", buf, 1, false); + print_0x8(", infhval1", buf, 2, false); + print_0x8(", infhval2", buf, 3, false); + + /* Reserved */ + if (buf[4] || buf[5] || buf[6]) + printf(", reserved_1__=\"\\x%#02hhx\\x%#02hhx\\x%#02hhx\"", + buf[4], buf[5], buf[6]); + + print_u8(", infhygct", buf, 7, true); + print_u16(", infhtotl", buf, 8, true); + print_u16(", infhdln", buf, 10, true); + print_u16(", infmoff", buf, 12, true); + print_u16(", infmlen", buf, 14, true); + print_u16(", infpoff", buf, 16, true); + print_u16(", infplen", buf, 18, true); + print_u16(", infhoff1", buf, 20, true); + print_u16(", infhlen1", buf, 22, true); + print_u16(", infgoff1", buf, 24, true); + print_u16(", infglen1", buf, 26, true); + print_u16(", infhoff2", buf, 28, true); + print_u16(", infhlen2", buf, 30, true); + print_u16(", infgoff2", buf, 32, true); + print_u16(", infglen2", buf, 34, true); + print_u16(", infhoff3", buf, 36, true); + print_u16(", infhlen3", buf, 38, true); + print_u16(", infgoff3", buf, 40, true); + print_u16(", infglen3", buf, 42, true); + + if (hdr_size > 44 && !is_empty(buf + 44, hdr_size - 44)) { + printf(", "); + print_quoted_hex((char *) (buf + 44), hdr_size - 44); + } +# else /* !VERBOSE */ + printf(", ..."); +# endif /* !VERBOSE */ + + printf("}"); + + /* Machine header */ + offs = *(uint16_t *) (buf + 12); + if (!offs) + goto partition_hdr; + + hdr_size = *(uint16_t *) (buf + 14); + if (hdr_size < 60) + error_msg_and_fail("sthyi: machine section is too small " + "(got %hu, 60 expected)", hdr_size); + + cur = buf + offs; + + printf(", /* machine */ {"); + +# if VERBOSE + print_0x8("infmflg1", cur, 0, false); + if (cur[0]) + printf(", "); + print_0x8("infmflg2", cur, 1, false); + if (cur[1]) + printf(", "); +# endif /* !VERBOSE */ + print_0x8("infmval1", cur, 2, true); + + bool cnt_valid = cur[2] & 0x80; +# if VERBOSE + bool id_valid = cur[2] & 0x40; + bool name_valid = cur[2] & 0x20; + + printf(" /* processor count validity: %d, machine ID validity: %d, " + "machine name validity: %d", + !!cnt_valid, !!id_valid, !!name_valid); + if (cur[2] & 0x1F) + printf(", %#hhx - ???", cur[2] & 0x1F); + printf(" */"); + print_0x8(", infmval2", cur, 3, false); +# endif /* !VERBOSE */ + + print_u16(", infmscps", cur, 4, cnt_valid); + print_u16(", infmdcps", cur, 6, cnt_valid); + print_u16(", infmsifl", cur, 8, cnt_valid); + print_u16(", infmdifl", cur, 10, cnt_valid); + +# if VERBOSE + print_ebcdic(", infmname", cur, 12, 8, name_valid, false); + + print_ebcdic(", infmtype", cur, 20, 4, id_valid, false); + print_ebcdic(", infmmanu", cur, 24, 16, id_valid, false); + print_ebcdic(", infmseq", cur, 40, 16, id_valid, false); + print_ebcdic(", infmpman", cur, 56, 4, id_valid, false); + + if (hdr_size > 60 && !is_empty(cur + 60, hdr_size - 60)) { + printf(", "); + print_quoted_hex((char *) (cur + 60), hdr_size - 60); + } +# else /* !VERBOSE */ + printf(", ..."); +# endif /* !VERBOSE */ + + printf("}"); + +partition_hdr: + /* Partition header */ + offs = *(uint16_t *) (buf + 16); + if (!offs) + goto hv_hdr; + + hdr_size = *(uint16_t *) (buf + 18); + if (hdr_size < 56) + error_msg_and_fail("sthyi: partition section is too small " + "(got %hu, 56 expected)", hdr_size); + + cur = buf + offs; + + print_0x8(", /* partition */ {infpflg1", cur, 0, true); + mt = !!(cur[0] & 0x80); +# if VERBOSE + if (cur[0]) { + bool printed = false; + + printf(" /* "); + if (cur[0] & 0x80) { + printf("0x80 - multithreading is enabled"); + printed = true; + } + if (cur[0] & 0x7F) { + if (printed) + printf(", "); + printf("%#hhx - ???", cur[0] & 0x7F); + } + printf(" */"); + } + print_0x8(", infpflg2", cur, 1, false); +# endif /* !VERBOSE */ + print_0x8(", infpval1", cur, 2, true); + + bool pcnt_valid = cur[2] & 0x80; + bool pid_valid = cur[2] & 0x10; +# if VERBOSE + bool pwcap_valid = cur[2] & 0x40; + bool pacap_valid = cur[2] & 0x20; + bool lpar_valid = cur[2] & 0x08; +# endif /* !VERBOSE */ + +# if VERBOSE + printf(" /* processor count validity: %d, partition weight-based " + "capacity validity: %d, partition absolute capacity validity: " + "%d, partition ID validity: %d, LPAR group absolute capacity " + "capping information validity: %d", + !!pcnt_valid, !!pwcap_valid, !!pacap_valid, !!pid_valid, + !!lpar_valid); + if (cur[2] & 0x7) + printf(", %#hhx - ???", cur[2] & 0x7); + printf(" */"); + + print_0x8(", infpval2", cur, 3, false); +# endif /* !VERBOSE */ + + print_u16(", infppnum", cur, 4, pid_valid); + + print_u16(", infpscps", cur, 6, pcnt_valid); + print_u16(", infpdcps", cur, 8, pcnt_valid); + print_u16(", infpsifl", cur, 10, pcnt_valid); + print_u16(", infpdifl", cur, 12, pcnt_valid); + +# if VERBOSE + if (cur[14] || cur[15]) + printf(", reserved_1__=\"\\x%#02hhx\\x%#02hhx\"", + cur[14], cur[15]); +# endif /* !VERBOSE */ + + print_ebcdic(", infppnam", cur, 16, 8, pid_valid, false); + +# if VERBOSE + print_weight(", infpwbcp", cur, 24, pwcap_valid); + print_weight(", infpabcp", cur, 28, pacap_valid); + print_weight(", infpwbif", cur, 32, pwcap_valid); + print_weight(", infpabif", cur, 36, pacap_valid); + + if (print_ebcdic(", infplgnm", cur, 40, 8, false, false)) { + + print_weight(", infplgcp", cur, 48, false); + print_weight(", infplgif", cur, 52, false); + } else { + if (lpar_valid) { + printf(", infplgnm="); + print_quoted_hex((char *) (cur + 40), 8); + } + + print_x32(", infplgcp", cur, 48, false); + print_x32(", infplgif", cur, 52, false); + } + + if (hdr_size > 56 && !is_empty(cur + 56, hdr_size - 56)) { + printf(", "); + print_quoted_hex((char *) (cur + 56), hdr_size - 56); + } +# else /* !VERBOSE */ + printf(", ..."); +# endif /* !VERBOSE */ + + printf("}"); + +hv_hdr: + /* Hypervisor/guest headers */ + print_hypervisor_header(buf, 1, 20, 22, mt); + print_guest_header(buf, 1, 24, 26); + print_hypervisor_header(buf, 2, 28, 30, mt); + print_guest_header(buf, 2, 32, 34); + print_hypervisor_header(buf, 3, 36, 38, mt); + print_guest_header(buf, 3, 40, 42); + + printf("}"); +} + +int +main(void) +{ + static const kernel_ulong_t bogus_func = + (kernel_ulong_t) 0xdeafbeefdeadc0deULL; + static const kernel_ulong_t bogus_resp_buf = + (kernel_ulong_t) 0xfacefeedac0ffeedULL; + static const kernel_ulong_t bogus_ret_code = + (kernel_ulong_t) 0xf00dfa57decaffedULL; + static const kernel_ulong_t bogus_flags = + (kernel_ulong_t) 0xfee1deadfa57beefULL; + + unsigned char *buf = tail_alloc(PAGE_SIZE); + uint64_t *ret = tail_alloc(sizeof(*ret)); + + long rc; + + rc = syscall(__NR_s390_sthyi, 0, 0, 0, 0); + printf("s390_sthyi(STHYI_FC_CP_IFL_CAP, NULL, NULL, 0) = %s\n", + sprintrc(rc)); + + rc = syscall(__NR_s390_sthyi, bogus_func, bogus_resp_buf, + bogus_ret_code, bogus_flags); + printf("s390_sthyi(%#llx /* STHYI_FC_??? */, %#llx, %#llx, %#llx) = " + "%s\n", + (unsigned long long) bogus_func, + (unsigned long long) bogus_resp_buf, + (unsigned long long) bogus_ret_code, + (unsigned long long) bogus_flags, + sprintrc(rc)); + + rc = syscall(__NR_s390_sthyi, bogus_func, buf, ret, 0); + printf("s390_sthyi(%#llx /* STHYI_FC_??? */, %p, %p, 0) = %s\n", + (unsigned long long) bogus_func, buf, ret, sprintrc(rc)); + + rc = syscall(__NR_s390_sthyi, 0, buf, ret, 0); + if (rc) + error_msg_and_fail("syscall(__NR_s390_sthyi, 0, buf, ret, 0) " + "returned unexpected value of %ld", rc); + + printf("s390_sthyi(STHYI_FC_CP_IFL_CAP, "); + print_sthyi(buf); + printf(", [0], 0) = 0\n"); + + puts("+++ exited with 0 +++"); + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("HAVE_ICONV_H && HAVE_ICONV_OPEN && __NR_s390_sthyi") + +#endif diff --git a/tests/s390_sthyi.gen.test b/tests/s390_sthyi.gen.test new file mode 100755 index 00000000..cf271374 --- /dev/null +++ b/tests/s390_sthyi.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (s390_sthyi -a47 ); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a47 diff --git a/tests/sched_rr_get_interval.gen.test b/tests/sched_rr_get_interval.gen.test index 493de644..02aad002 100755 --- a/tests/sched_rr_get_interval.gen.test +++ b/tests/sched_rr_get_interval.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sched_rr_get_interval -a31); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sched_rr_get_interval -a31 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a31 +run_strace_match_diff -a31 diff --git a/tests/sched_yield.gen.test b/tests/sched_yield.gen.test index 3f4542ff..4b035fd8 100755 --- a/tests/sched_yield.gen.test +++ b/tests/sched_yield.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sched_yield -a14); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sched_yield -a14 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a14 +run_strace_match_diff -a14 diff --git a/tests/select-P.c b/tests/select-P.c new file mode 100644 index 00000000..868deed6 --- /dev/null +++ b/tests/select-P.c @@ -0,0 +1,2 @@ +#define PATH_TRACING_FD 9 +#include "select.c" diff --git a/tests/select-P.gen.test b/tests/select-P.gen.test new file mode 100755 index 00000000..2f6fc7bc --- /dev/null +++ b/tests/select-P.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (select-P -a36 -e trace=select -P /dev/full 9>>/dev/full); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -a36 -e trace=select -P /dev/full 9>>/dev/full diff --git a/tests/select.gen.test b/tests/select.gen.test index cb3b8f15..23836149 100755 --- a/tests/select.gen.test +++ b/tests/select.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (select -a36); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (select -a36 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a36 +run_strace_match_diff -a36 diff --git a/tests/sendfile.gen.test b/tests/sendfile.gen.test index 433878f8..d32ef3ad 100755 --- a/tests/sendfile.gen.test +++ b/tests/sendfile.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sendfile -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sendfile -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests/sendfile64.gen.test b/tests/sendfile64.gen.test index 1655dd32..24f0746f 100755 --- a/tests/sendfile64.gen.test +++ b/tests/sendfile64.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sendfile64 -a29); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sendfile64 -a29 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a29 +run_strace_match_diff -a29 diff --git a/tests/set_ptracer_any.c b/tests/set_ptracer_any.c index 3b4ea2cb..3c112961 100644 --- a/tests/set_ptracer_any.c +++ b/tests/set_ptracer_any.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2013-2015 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2013-2017 The strace developers. + * Copyright (c) 2013-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,10 +37,16 @@ int main(int argc, char **argv) { if (argc < 2) return 99; -#if defined HAVE_PRCTL && defined PR_SET_PTRACER && defined PR_SET_PTRACER_ANY - /* Turn off restrictions on tracing if applicable. If the options +#ifdef HAVE_PRCTL + /* Turn off restrictions on tracing if applicable. If the command * aren't available on this system, that's OK too. */ - (void) prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY); +# ifndef PR_SET_PTRACER +# define PR_SET_PTRACER 0x59616d61 +# endif +# ifndef PR_SET_PTRACER_ANY +# define PR_SET_PTRACER_ANY -1UL +# endif + (void) prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY, 0, 0, 0); #endif if (write(1, "\n", 1) != 1) { perror("write"); diff --git a/tests/setdomainname.gen.test b/tests/setdomainname.gen.test index 2b12e082..1f29563f 100755 --- a/tests/setdomainname.gen.test +++ b/tests/setdomainname.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setdomainname -a24); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setdomainname -a24 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a24 +run_strace_match_diff -a24 diff --git a/tests/setfsgid.gen.test b/tests/setfsgid.gen.test index caff4012..bbb30cc1 100755 --- a/tests/setfsgid.gen.test +++ b/tests/setfsgid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setfsgid -a12); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setfsgid -a12 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a12 +run_strace_match_diff -a12 diff --git a/tests/setfsgid32.gen.test b/tests/setfsgid32.gen.test index fae29e01..63b3eca0 100755 --- a/tests/setfsgid32.gen.test +++ b/tests/setfsgid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setfsgid32 -a14); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setfsgid32 -a14 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a14 +run_strace_match_diff -a14 diff --git a/tests/setfsuid.gen.test b/tests/setfsuid.gen.test index e4c4d209..5896b303 100755 --- a/tests/setfsuid.gen.test +++ b/tests/setfsuid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setfsuid -a12); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setfsuid -a12 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a12 +run_strace_match_diff -a12 diff --git a/tests/setfsuid32.gen.test b/tests/setfsuid32.gen.test index b6cd67d7..52d0820f 100755 --- a/tests/setfsuid32.gen.test +++ b/tests/setfsuid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setfsuid32 -a14); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setfsuid32 -a14 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a14 +run_strace_match_diff -a14 diff --git a/tests/setgid.gen.test b/tests/setgid.gen.test index f10add65..be188d1f 100755 --- a/tests/setgid.gen.test +++ b/tests/setgid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setgid -a10); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setgid -a10 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a10 +run_strace_match_diff -a10 diff --git a/tests/setgid32.gen.test b/tests/setgid32.gen.test index 26f194ec..9020b809 100755 --- a/tests/setgid32.gen.test +++ b/tests/setgid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setgid32 -a12); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setgid32 -a12 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a12 +run_strace_match_diff -a12 diff --git a/tests/sethostname.gen.test b/tests/sethostname.gen.test index 2827b1dc..d68ed189 100755 --- a/tests/sethostname.gen.test +++ b/tests/sethostname.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sethostname -a22); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sethostname -a22 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a22 +run_strace_match_diff -a22 diff --git a/tests/setns.gen.test b/tests/setns.gen.test index 45fcc601..e25738bf 100755 --- a/tests/setns.gen.test +++ b/tests/setns.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setns -a21); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setns -a21 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a21 +run_strace_match_diff -a21 diff --git a/tests/setregid.gen.test b/tests/setregid.gen.test index 0125d7a9..f84b1acb 100755 --- a/tests/setregid.gen.test +++ b/tests/setregid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setregid -a15); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setregid -a15 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a15 +run_strace_match_diff -a15 diff --git a/tests/setregid32.gen.test b/tests/setregid32.gen.test index 24f1505b..7320c8cf 100755 --- a/tests/setregid32.gen.test +++ b/tests/setregid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setregid32 -a17); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setregid32 -a17 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a17 +run_strace_match_diff -a17 diff --git a/tests/setresgid.gen.test b/tests/setresgid.gen.test index ca5bc6b7..792313c2 100755 --- a/tests/setresgid.gen.test +++ b/tests/setresgid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setresgid -a19); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setresgid -a19 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a19 +run_strace_match_diff -a19 diff --git a/tests/setresgid32.gen.test b/tests/setresgid32.gen.test index a5edb905..6ecf936b 100755 --- a/tests/setresgid32.gen.test +++ b/tests/setresgid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setresgid32 -a21); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setresgid32 -a21 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a21 +run_strace_match_diff -a21 diff --git a/tests/setresuid.gen.test b/tests/setresuid.gen.test index a6e06641..a0dcb4ba 100755 --- a/tests/setresuid.gen.test +++ b/tests/setresuid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setresuid -a19); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setresuid -a19 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a19 +run_strace_match_diff -a19 diff --git a/tests/setresuid32.gen.test b/tests/setresuid32.gen.test index 3fbf36be..a9f43969 100755 --- a/tests/setresuid32.gen.test +++ b/tests/setresuid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setresuid32 -a21); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setresuid32 -a21 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a21 +run_strace_match_diff -a21 diff --git a/tests/setreuid.gen.test b/tests/setreuid.gen.test index 4c3dc930..0ecaef0b 100755 --- a/tests/setreuid.gen.test +++ b/tests/setreuid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setreuid -a15); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setreuid -a15 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a15 +run_strace_match_diff -a15 diff --git a/tests/setreuid32.gen.test b/tests/setreuid32.gen.test index d1790538..3eb0e95a 100755 --- a/tests/setreuid32.gen.test +++ b/tests/setreuid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setreuid32 -a17); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setreuid32 -a17 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a17 +run_strace_match_diff -a17 diff --git a/tests/setrlimit.gen.test b/tests/setrlimit.gen.test index dfe2da38..0d1508d3 100755 --- a/tests/setrlimit.gen.test +++ b/tests/setrlimit.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setrlimit -a27); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setrlimit -a27 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a27 +run_strace_match_diff -a27 diff --git a/tests/setugid.c b/tests/setugid.c index aba277c5..6ceec7fc 100644 --- a/tests/setugid.c +++ b/tests/setugid.c @@ -2,6 +2,7 @@ * Check decoding of setuid/setgid/setuid32/setgid32 syscalls. * * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -61,6 +62,8 @@ main(void) const unsigned int num = (unsigned UGID_TYPE) tests[i]; long expected; + errno = 0; + if (num == ugid) expected = 0; else if ((UGID_TYPE) num == (UGID_TYPE) -1U) @@ -77,8 +80,9 @@ main(void) SYSCALL_NAME, ugid, errstr); break; } - perror_msg_and_fail("%s(%#lx) != %ld", - SYSCALL_NAME, tests[i], expected); + perror_msg_and_fail("%s(%#lx) = %ld != %ld", + SYSCALL_NAME, tests[i], + rc, expected); } printf("%s(", SYSCALL_NAME); diff --git a/tests/setuid.gen.test b/tests/setuid.gen.test index 98d470fd..00aeb7a2 100755 --- a/tests/setuid.gen.test +++ b/tests/setuid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setuid -a10); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setuid -a10 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a10 +run_strace_match_diff -a10 diff --git a/tests/setuid32.gen.test b/tests/setuid32.gen.test index 7d15495c..ac8df8f2 100755 --- a/tests/setuid32.gen.test +++ b/tests/setuid32.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setuid32 -a12); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (setuid32 -a12 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a12 +run_strace_match_diff -a12 diff --git a/tests/shmxt.c b/tests/shmxt.c index 23cc7ccf..398667c8 100644 --- a/tests/shmxt.c +++ b/tests/shmxt.c @@ -18,6 +18,10 @@ cleanup(void) # define SHMAT "shmat" #endif +#ifndef SHM_EXEC +# define SHM_EXEC 0100000 +#endif + int main(void) { @@ -34,8 +38,8 @@ main(void) atexit(cleanup); rc = (long) shmat(bogus_shmid, bogus_shmaddr, bogus_shmflg); - printf("%s(%d, %p, SHM_REMAP|SHM_RDONLY|SHM_RND|%#x) = %s\n", - SHMAT, bogus_shmid, bogus_shmaddr, bogus_shmflg & ~0x7000, + printf("%s(%d, %p, SHM_RDONLY|SHM_RND|SHM_REMAP|SHM_EXEC|%#x) = %s\n", + SHMAT, bogus_shmid, bogus_shmaddr, bogus_shmflg & ~0xf000, sprintrc(rc)); shmat(id, NULL, SHM_REMAP); @@ -50,18 +54,31 @@ main(void) rc = shmdt(NULL); printf("shmdt(NULL) = %s\n", sprintrc(rc)); - if (shmdt(shmaddr)) - perror_msg_and_skip("shmdt"); - printf("shmdt(%p) = 0\n", shmaddr); + rc = shmdt(shmaddr); + printf("shmdt(%p) = %s\n", shmaddr, sprintrc(rc)); ++shmaddr; void *shmaddr2 = shmat(id, shmaddr, SHM_RND); if (shmaddr2 == (void *)(-1)) printf("%s(%d, %p, SHM_RND) = -1 %s (%m)\n", SHMAT, id, shmaddr, errno2name()); - else + else { printf("%s(%d, %p, SHM_RND) = %p\n", SHMAT, id, shmaddr, shmaddr2); + rc = shmdt(shmaddr2); + printf("shmdt(%p) = %s\n", shmaddr2, sprintrc(rc)); + } + + shmaddr = shmat(id, NULL, SHM_RDONLY|SHM_EXEC); + if (shmaddr == (void *)(-1)) + printf("%s(%d, NULL, SHM_RDONLY|SHM_EXEC) = %s\n", + SHMAT, id, sprintrc(-1)); + else { + printf("%s(%d, NULL, SHM_RDONLY|SHM_EXEC) = %p\n", + SHMAT, id, shmaddr); + rc = shmdt(shmaddr); + printf("shmdt(%p) = %s\n", shmaddr, sprintrc(rc)); + } puts("+++ exited with 0 +++"); return 0; diff --git a/tests/shutdown.gen.test b/tests/shutdown.gen.test index 3412513f..7fde46ee 100755 --- a/tests/shutdown.gen.test +++ b/tests/shutdown.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (shutdown -a24); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (shutdown -a24 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a24 +run_strace_match_diff -a24 diff --git a/tests/sigaction.gen.test b/tests/sigaction.gen.test index dee340e8..1db6b3aa 100755 --- a/tests/sigaction.gen.test +++ b/tests/sigaction.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sigaction -a31); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sigaction -a31 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a31 +run_strace_match_diff -a31 diff --git a/tests/signalfd4.gen.test b/tests/signalfd4.gen.test index e91a9fe4..dee4274c 100755 --- a/tests/signalfd4.gen.test +++ b/tests/signalfd4.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (signalfd4 ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (signalfd4 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/sigpending.gen.test b/tests/sigpending.gen.test index 0f4259a3..c061868c 100755 --- a/tests/sigpending.gen.test +++ b/tests/sigpending.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sigpending -a15); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sigpending -a15 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a15 +run_strace_match_diff -a15 diff --git a/tests/sigprocmask.gen.test b/tests/sigprocmask.gen.test index 44a508ce..065b74d7 100755 --- a/tests/sigprocmask.gen.test +++ b/tests/sigprocmask.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sigprocmask -a34); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sigprocmask -a34 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a34 +run_strace_match_diff -a34 diff --git a/tests/sigreturn.gen.test b/tests/sigreturn.gen.test index f317e893..3b67c9d0 100755 --- a/tests/sigreturn.gen.test +++ b/tests/sigreturn.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sigreturn -esignal='!USR1'); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sigreturn -esignal='!USR1' ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -esignal='!USR1' +run_strace_match_diff -esignal='!USR1' diff --git a/tests/socketcall.gen.test b/tests/socketcall.gen.test index 95c45fd7..d18b0364 100755 --- a/tests/socketcall.gen.test +++ b/tests/socketcall.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (socketcall -a20); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (socketcall -a20 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a20 +run_strace_match_diff -a20 diff --git a/tests/sockname.c b/tests/sockname.c index 58726712..bba9a892 100644 --- a/tests/sockname.c +++ b/tests/sockname.c @@ -2,7 +2,7 @@ * Check decoding of sockname family syscalls. * * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,7 +42,9 @@ # error TEST_SYSCALL_NAME must be defined #endif -#define TEST_SYSCALL_STR STRINGIFY_VAL(TEST_SYSCALL_NAME) +#ifndef TEST_SYSCALL_STR +# define TEST_SYSCALL_STR STRINGIFY_VAL(TEST_SYSCALL_NAME) +#endif #define TEST_SOCKET TEST_SYSCALL_STR ".socket" #ifdef TEST_SYSCALL_PREPARE diff --git a/tests/sockopt-sol_netlink.c b/tests/sockopt-sol_netlink.c new file mode 100644 index 00000000..066920c6 --- /dev/null +++ b/tests/sockopt-sol_netlink.c @@ -0,0 +1,213 @@ +/* + * Check decoding of getsockopt and setsockopt for SOL_NETLINK level. + * + * Copyright (c) 2017 Dmitry V. Levin <ldv@altlinux.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" +#include "netlink.h" +#include <stdio.h> + +#ifndef SOL_NETLINK +# define SOL_NETLINK 270 +#endif + +static int rc; +static const char *errstr; + +static int +get_sockopt(int fd, int name, void *val, socklen_t *len) +{ + rc = getsockopt(fd, SOL_NETLINK, name, val, len); + errstr = sprintrc(rc); + return rc; +} + +static int +set_sockopt(int fd, int name, void *val, socklen_t len) +{ + rc = setsockopt(fd, SOL_NETLINK, name, val, len); + errstr = sprintrc(rc); + return rc; +} + +int +main(void) +{ + static const struct { + int val; + const char *str; + } names[] = { +#ifdef NETLINK_ADD_MEMBERSHIP + { ARG_STR(NETLINK_ADD_MEMBERSHIP) }, +#endif +#ifdef NETLINK_DROP_MEMBERSHIP + { ARG_STR(NETLINK_DROP_MEMBERSHIP) }, +#endif +#ifdef NETLINK_PKTINFO + { ARG_STR(NETLINK_PKTINFO) }, +#endif +#ifdef NETLINK_BROADCAST_ERROR + { ARG_STR(NETLINK_BROADCAST_ERROR) }, +#endif +#ifdef NETLINK_NO_ENOBUFS + { ARG_STR(NETLINK_NO_ENOBUFS) }, +#endif +#ifdef NETLINK_RX_RING + { ARG_STR(NETLINK_RX_RING) }, +#endif +#ifdef NETLINK_TX_RING + { ARG_STR(NETLINK_TX_RING) }, +#endif +#ifdef NETLINK_LISTEN_ALL_NSID + { ARG_STR(NETLINK_LISTEN_ALL_NSID) }, +#endif +#ifdef NETLINK_LIST_MEMBERSHIPS + { ARG_STR(NETLINK_LIST_MEMBERSHIPS) }, +#endif +#ifdef NETLINK_CAP_ACK + { ARG_STR(NETLINK_CAP_ACK) }, +#endif +#ifdef NETLINK_EXT_ACK + { ARG_STR(NETLINK_EXT_ACK) }, +#endif + }; + + TAIL_ALLOC_OBJECT_CONST_PTR(int, val); + TAIL_ALLOC_OBJECT_CONST_PTR(socklen_t, len); + void *const efault = val + 1; + int fd = socket(AF_NETLINK, SOCK_RAW, 0); + if (fd < 0) + perror_msg_and_skip("socket AF_NETLINK SOCK_RAW"); + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(names); ++i) { + /* getsockopt */ + + /* classic */ + *len = sizeof(*val); + get_sockopt(fd, names[i].val, val, len); + printf("getsockopt(%d, SOL_NETLINK, %s, ", fd, names[i].str); + if (rc) + printf("%p", val); + else + printf("[%d]", *val); + printf(", [%d]) = %s\n", *len, errstr); + + /* optlen larger than necessary - shortened */ + *len = sizeof(*val) + 1; + get_sockopt(fd, names[i].val, val, len); + printf("getsockopt(%d, SOL_NETLINK, %s, ", fd, names[i].str); + if (rc) + printf("%p", val); + else + printf("[%d]", *val); + printf(", [%d", (int) sizeof(*val) + 1); + if ((int) sizeof(*val) + 1 != *len) + printf("->%d", *len); + printf("]) = %s\n", errstr); + + /* zero optlen - print returned optlen */ + *len = 0; + get_sockopt(fd, names[i].val, NULL, len); + printf("getsockopt(%d, SOL_NETLINK, %s, NULL, [0", + fd, names[i].str); + if (*len) + printf("->%d", *len); + printf("]) = %s\n", errstr); + +#ifdef NETLINK_LIST_MEMBERSHIPS + if (names[i].val != NETLINK_LIST_MEMBERSHIPS) { +#endif + /* optlen shorter than necessary - print address */ + *len = sizeof(*val) - 1; + get_sockopt(fd, names[i].val, val, len); + printf("getsockopt(%d, SOL_NETLINK, %s, %p, [%d", + fd, names[i].str, val, (int) sizeof(*val) - 1); + if ((int) sizeof(*val) - 1 != *len) + printf("->%d", *len); + printf("]) = %s\n", errstr); +#ifdef NETLINK_LIST_MEMBERSHIPS + } else { + /* optlen shorter than required for the first element */ + *len = sizeof(*val) - 1; + get_sockopt(fd, names[i].val, efault, len); + printf("getsockopt(%d, SOL_NETLINK, %s, ", + fd, names[i].str); + if (rc) + printf("%p", efault); + else + printf("[]"); + printf(", [%d", (int) sizeof(*val) - 1); + if ((int) sizeof(*val) - 1 != *len) + printf("->%d", *len); + printf("]) = %s\n", errstr); + } +#endif + + /* optval EFAULT - print address */ + *len = sizeof(*val); + get_sockopt(fd, names[i].val, efault, len); + printf("getsockopt(%d, SOL_NETLINK, %s, %p, [%d]) = %s\n", + fd, names[i].str, efault, *len, errstr); + + /* optlen EFAULT - print address */ + get_sockopt(fd, names[i].val, val, len + 1); + printf("getsockopt(%d, SOL_NETLINK, %s, %p, %p) = %s\n", + fd, names[i].str, val, len + 1, errstr); + + /* setsockopt */ + + /* classic */ + *val = 0xdefaced; + set_sockopt(fd, names[i].val, val, sizeof(*val)); + printf("setsockopt(%d, SOL_NETLINK, %s, [%d], %d) = %s\n", + fd, names[i].str, *val, (int) sizeof(*val), errstr); + + /* optlen larger than necessary - shortened */ + set_sockopt(fd, names[i].val, val, sizeof(*val) + 1); + printf("setsockopt(%d, SOL_NETLINK, %s, [%d], %d) = %s\n", + fd, names[i].str, *val, (int) sizeof(*val) + 1, errstr); + + /* optlen < 0 - print address */ + set_sockopt(fd, names[i].val, val, -1U); + printf("setsockopt(%d, SOL_NETLINK, %s, %p, -1) = %s\n", + fd, names[i].str, val, errstr); + + /* optlen smaller than necessary - print address */ + set_sockopt(fd, names[i].val, val, sizeof(*val) - 1); + printf("setsockopt(%d, SOL_NETLINK, %s, %p, %d) = %s\n", + fd, names[i].str, val, (int) sizeof(*val) - 1, errstr); + + /* optval EFAULT - print address */ + set_sockopt(fd, names[i].val, efault, sizeof(*val)); + printf("setsockopt(%d, SOL_NETLINK, %s, %p, %d) = %s\n", + fd, names[i].str, efault, (int) sizeof(*val), errstr); + } + + puts("+++ exited with 0 +++"); + return 0; +} diff --git a/tests/sockopt-sol_netlink.gen.test b/tests/sockopt-sol_netlink.gen.test new file mode 100755 index 00000000..a2ba06dd --- /dev/null +++ b/tests/sockopt-sol_netlink.gen.test @@ -0,0 +1,4 @@ +#!/bin/sh -efu +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sockopt-sol_netlink -e trace=getsockopt,setsockopt); do not edit. +. "${srcdir=.}/init.sh" +run_strace_match_diff -e trace=getsockopt,setsockopt diff --git a/tests/splice.gen.test b/tests/splice.gen.test index 83c84064..75660806 100755 --- a/tests/splice.gen.test +++ b/tests/splice.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (splice ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (splice ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/stack-fcall-0.c b/tests/stack-fcall-0.c index 12a260de..edd6d326 100644 --- a/tests/stack-fcall-0.c +++ b/tests/stack-fcall-0.c @@ -1,4 +1,4 @@ -int f1(int i); +#include "stack-fcall.h" int f0(int i) { diff --git a/tests/stack-fcall-1.c b/tests/stack-fcall-1.c index 8716702d..5d0bf0e6 100644 --- a/tests/stack-fcall-1.c +++ b/tests/stack-fcall-1.c @@ -1,4 +1,4 @@ -int f2(int i); +#include "stack-fcall.h" int f1(int i) { diff --git a/tests/stack-fcall-2.c b/tests/stack-fcall-2.c index 19f8cf83..e1643207 100644 --- a/tests/stack-fcall-2.c +++ b/tests/stack-fcall-2.c @@ -1,4 +1,4 @@ -int f3(int i); +#include "stack-fcall.h" int f2(int i) { diff --git a/tests/stack-fcall-3.c b/tests/stack-fcall-3.c index 3af1667f..98726d8f 100644 --- a/tests/stack-fcall-3.c +++ b/tests/stack-fcall-3.c @@ -1,4 +1,5 @@ #include <unistd.h> +#include "stack-fcall.h" int f3(int i) { diff --git a/tests/stack-fcall-mangled-0.c b/tests/stack-fcall-mangled-0.c new file mode 100644 index 00000000..47549401 --- /dev/null +++ b/tests/stack-fcall-mangled-0.c @@ -0,0 +1,2 @@ +#define MANGLE +#include "stack-fcall-0.c" diff --git a/tests/stack-fcall-mangled-1.c b/tests/stack-fcall-mangled-1.c new file mode 100644 index 00000000..492c562b --- /dev/null +++ b/tests/stack-fcall-mangled-1.c @@ -0,0 +1,2 @@ +#define MANGLE +#include "stack-fcall-1.c" diff --git a/tests/stack-fcall-mangled-2.c b/tests/stack-fcall-mangled-2.c new file mode 100644 index 00000000..eb7c3624 --- /dev/null +++ b/tests/stack-fcall-mangled-2.c @@ -0,0 +1,2 @@ +#define MANGLE +#include "stack-fcall-2.c" diff --git a/tests/stack-fcall-mangled-3.c b/tests/stack-fcall-mangled-3.c new file mode 100644 index 00000000..98f738b4 --- /dev/null +++ b/tests/stack-fcall-mangled-3.c @@ -0,0 +1,2 @@ +#define MANGLE +#include "stack-fcall-3.c" diff --git a/tests/stack-fcall-mangled.c b/tests/stack-fcall-mangled.c new file mode 100644 index 00000000..67862059 --- /dev/null +++ b/tests/stack-fcall-mangled.c @@ -0,0 +1,2 @@ +#define MANGLE +#include "stack-fcall.c" diff --git a/tests/stack-fcall.c b/tests/stack-fcall.c index fc9ee5f9..e0ec3b1a 100644 --- a/tests/stack-fcall.c +++ b/tests/stack-fcall.c @@ -1,4 +1,4 @@ -int f0(int i); +#include "stack-fcall.h" int main(int argc, char **argv) { diff --git a/tests/stack-fcall.h b/tests/stack-fcall.h new file mode 100644 index 00000000..1a83bad4 --- /dev/null +++ b/tests/stack-fcall.h @@ -0,0 +1,13 @@ +#ifdef MANGLE + +#define f0 _ZN2ns2f0Ei +#define f1 _ZN2ns2f1Ei +#define f2 _ZN2ns2f2Ei +#define f3 _ZN2ns2f3Ei + +#endif + +int f0(int i); +int f1(int i); +int f2(int i); +int f3(int i); diff --git a/tests/statfs.gen.test b/tests/statfs.gen.test index 19b26dd8..32204a14 100755 --- a/tests/statfs.gen.test +++ b/tests/statfs.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (statfs -a17); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (statfs -a17 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a17 +run_strace_match_diff -a17 diff --git a/tests/statfs64.gen.test b/tests/statfs64.gen.test index 66409f9c..8f6f06f7 100755 --- a/tests/statfs64.gen.test +++ b/tests/statfs64.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (statfs64 -a23); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (statfs64 -a23 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a23 +run_strace_match_diff -a23 diff --git a/tests/strace-V.test b/tests/strace-V.test index ec1ca059..eb05e865 100755 --- a/tests/strace-V.test +++ b/tests/strace-V.test @@ -39,8 +39,21 @@ config_year=$(getstr COPYRIGHT_YEAR) } option_unwind=$(getoption USE_LIBUNWIND " stack-unwind") +option_demangle=$(getoption USE_DEMANGLE " stack-demangle") -features="${option_unwind}" +option_m32= +option_mx32= +case "$STRACE_NATIVE_ARCH" in +x86_64) + option_m32=$(getoption HAVE_M32_MPERS ' m32-mpers' ' no-m32-mpers') + option_mx32=$(getoption HAVE_MX32_MPERS ' mx32-mpers' ' no-mx32-mpers') + ;; +aarch64|powerpc64|riscv|s390x|sparc64|tile|x32) + option_m32=$(getoption HAVE_M32_MPERS ' m32-mpers' ' no-m32-mpers') + ;; +esac + +features="${option_unwind}${option_demangle}${option_m32}${option_mx32}" [ -n "$features" ] || features=" (none)" cat > "$EXP" << __EOF__ diff --git a/tests/strace-k-demangle.test b/tests/strace-k-demangle.test new file mode 100755 index 00000000..1616449f --- /dev/null +++ b/tests/strace-k-demangle.test @@ -0,0 +1,7 @@ +#!/bin/sh +# Check strace -k symbol names demangling. + +test_prog=../stack-fcall-mangled +expected='getpid ns::f3(int) ns::f2(int) ns::f1(int) ns::f0(int) main ' + +. "${srcdir=.}"/strace-k.test diff --git a/tests/strace-k.test b/tests/strace-k.test index e68951e8..2a21a9db 100755 --- a/tests/strace-k.test +++ b/tests/strace-k.test @@ -38,11 +38,13 @@ check_prog sed check_prog tr -run_prog ../stack-fcall +: ${test_prog=../stack-fcall} +: ${expected='getpid f3 f2 f1 f0 main '} + +run_prog "$test_prog" run_strace -e getpid -k $args -expected='getpid f3 f2 f1 f0 main ' -result=$(sed -r -n '1,/\(main\+0x[a-f0-9]+\) .*/ s/^.*\(([^+]+)\+0x[a-f0-9]+\) .*/\1/p' "$LOG" | +result=$(sed -r -n '1,/\(main\+0x[a-f0-9]+\) .*/ s/^[^(]+\(([^+]+)\+0x[a-f0-9]+\) .*/\1/p' "$LOG" | tr '\n' ' ') test "$result" = "$expected" || { @@ -50,5 +52,3 @@ test "$result" = "$expected" || { echo "result: \"$result\"" dump_log_and_fail_with "$STRACE $args output mismatch" } - -exit 0 diff --git a/tests/symlink.gen.test b/tests/symlink.gen.test index f41668c3..8cedfbf4 100755 --- a/tests/symlink.gen.test +++ b/tests/symlink.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (symlink -a34); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (symlink -a34 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a34 +run_strace_match_diff -a34 diff --git a/tests/symlinkat.gen.test b/tests/symlinkat.gen.test index 39e624ab..12455dd9 100755 --- a/tests/symlinkat.gen.test +++ b/tests/symlinkat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (symlinkat ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (symlinkat ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/sync.gen.test b/tests/sync.gen.test index 4aaf8c7f..8436a1fa 100755 --- a/tests/sync.gen.test +++ b/tests/sync.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sync -a7); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sync -a7 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a7 +run_strace_match_diff -a7 diff --git a/tests/sync_file_range.gen.test b/tests/sync_file_range.gen.test index 0693c12e..2f41c7db 100755 --- a/tests/sync_file_range.gen.test +++ b/tests/sync_file_range.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sync_file_range ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sync_file_range ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/sync_file_range2.gen.test b/tests/sync_file_range2.gen.test index 23046b6b..d432647a 100755 --- a/tests/sync_file_range2.gen.test +++ b/tests/sync_file_range2.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sync_file_range2 ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sync_file_range2 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/syntax.sh b/tests/syntax.sh index 0a0d2a57..b1c8fdc1 100644 --- a/tests/syntax.sh +++ b/tests/syntax.sh @@ -50,13 +50,11 @@ check_exit_status_and_stderr_using_grep() "strace $* failed to print expected diagnostics" } -strace_exp="${STRACE##* }" - check_e() { local pattern="$1"; shift cat > "$EXP" << __EOF__ -$strace_exp: $pattern +$STRACE_EXE: $pattern __EOF__ check_exit_status_and_stderr "$@" } @@ -65,7 +63,7 @@ check_e_using_grep() { local pattern="$1"; shift cat > "$EXP" << __EOF__ -$strace_exp: $pattern +$STRACE_EXE: $pattern __EOF__ check_exit_status_and_stderr_using_grep "$@" } @@ -74,8 +72,8 @@ check_h() { local pattern="$1"; shift cat > "$EXP" << __EOF__ -$strace_exp: $pattern -Try '$strace_exp -h' for more information. +$STRACE_EXE: $pattern +Try '$STRACE_EXE -h' for more information. __EOF__ check_exit_status_and_stderr "$@" } diff --git a/tests/sysinfo.gen.test b/tests/sysinfo.gen.test index e6469d55..fa462376 100755 --- a/tests/sysinfo.gen.test +++ b/tests/sysinfo.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sysinfo -a14); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sysinfo -a14 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a14 +run_strace_match_diff -a14 diff --git a/tests/syslog.gen.test b/tests/syslog.gen.test index 5423d5bb..5707a3e2 100755 --- a/tests/syslog.gen.test +++ b/tests/syslog.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (syslog -a36); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (syslog -a36 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a36 +run_strace_match_diff -a36 diff --git a/tests/tee.gen.test b/tests/tee.gen.test index 2a87fae3..b5fbfc05 100755 --- a/tests/tee.gen.test +++ b/tests/tee.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (tee ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (tee ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/test_printpath.c b/tests/test_printpath.c index 5f482f25..c485a26f 100644 --- a/tests/test_printpath.c +++ b/tests/test_printpath.c @@ -2,6 +2,7 @@ * Test printpath/umovestr. * * Copyright (c) 2015-2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2017-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,10 +30,10 @@ #include "tests.h" +#include <limits.h> #include <stdio.h> #include <string.h> #include <unistd.h> -#include <sys/param.h> #include "test_ucopy.h" diff --git a/tests/test_ucopy.c b/tests/test_ucopy.c index 9ddffbca..09f809a2 100644 --- a/tests/test_ucopy.c +++ b/tests/test_ucopy.c @@ -2,6 +2,7 @@ * Test whether process_vm_readv and PTRACE_PEEKDATA work. * * Copyright (c) 2016-2017 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2017-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,10 +31,10 @@ #include "tests.h" #include <errno.h> +#include <sys/ptrace.h> #include <signal.h> #include <stdlib.h> #include <unistd.h> -#include <sys/ptrace.h> #include <sys/uio.h> #include <sys/wait.h> diff --git a/tests/tests.h b/tests/tests.h index d453e3e0..1c66c265 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2016-2017 The strace developers. + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -75,6 +75,15 @@ void error_msg_and_skip(const char *, ...) void perror_msg_and_skip(const char *, ...) ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN; +#ifndef perror_msg_and_fail +# define perror_msg_and_fail(fmt_, ...) \ + perror_msg_and_fail("%s:%d: " fmt_, __FILE__, __LINE__, ##__VA_ARGS__) +#endif +#ifndef perror_msg_and_fail +# define error_msg_and_fail(fmt_, ...) \ + error_msg_and_fail("%s:%d: " fmt_, __FILE__, __LINE__, ##__VA_ARGS__) +#endif + /* Stat the specified file and skip the test if the stat call failed. */ void skip_if_unavailable(const char *); diff --git a/tests/time.gen.test b/tests/time.gen.test index ed7ec69a..3269b164 100755 --- a/tests/time.gen.test +++ b/tests/time.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (time -a10); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (time -a10 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a10 +run_strace_match_diff -a10 diff --git a/tests/timer_create.gen.test b/tests/timer_create.gen.test index 6b4c543d..bf652612 100755 --- a/tests/timer_create.gen.test +++ b/tests/timer_create.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (timer_create ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (timer_create ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/times.gen.test b/tests/times.gen.test index ca4ebbe5..06b036fc 100755 --- a/tests/times.gen.test +++ b/tests/times.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (times -esignal=none); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (times -esignal=none ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -esignal=none +run_strace_match_diff -esignal=none diff --git a/tests/truncate.gen.test b/tests/truncate.gen.test index 0410e73d..7a631ef0 100755 --- a/tests/truncate.gen.test +++ b/tests/truncate.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (truncate ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (truncate ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/truncate64.gen.test b/tests/truncate64.gen.test index dae0fe6f..2b368f44 100755 --- a/tests/truncate64.gen.test +++ b/tests/truncate64.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (truncate64 ); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (truncate64 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff +run_strace_match_diff diff --git a/tests/ugetrlimit.gen.test b/tests/ugetrlimit.gen.test index ff27134a..a412fe6a 100755 --- a/tests/ugetrlimit.gen.test +++ b/tests/ugetrlimit.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ugetrlimit -a28); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ugetrlimit -a28 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a28 +run_strace_match_diff -a28 diff --git a/tests/umask.gen.test b/tests/umask.gen.test index 60af5e9a..5d6c3187 100755 --- a/tests/umask.gen.test +++ b/tests/umask.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (umask -a11); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (umask -a11 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a11 +run_strace_match_diff -a11 diff --git a/tests/umovestr3.c b/tests/umovestr3.c index cf2fa7d4..74f0e934 100644 --- a/tests/umovestr3.c +++ b/tests/umovestr3.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,9 +27,9 @@ */ #include "tests.h" +#include <limits.h> #include <stdio.h> #include <unistd.h> -#include <sys/param.h> int main(void) diff --git a/tests/unlink.gen.test b/tests/unlink.gen.test index 7b8522b4..63bc0c42 100755 --- a/tests/unlink.gen.test +++ b/tests/unlink.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (unlink -a24); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (unlink -a24 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a24 +run_strace_match_diff -a24 diff --git a/tests/unlinkat.gen.test b/tests/unlinkat.gen.test index 5a77c6ab..5de79084 100755 --- a/tests/unlinkat.gen.test +++ b/tests/unlinkat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (unlinkat -a35); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (unlinkat -a35 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a35 +run_strace_match_diff -a35 diff --git a/tests/unshare.gen.test b/tests/unshare.gen.test index 077a4580..782ce47a 100755 --- a/tests/unshare.gen.test +++ b/tests/unshare.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (unshare -a11); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (unshare -a11 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a11 +run_strace_match_diff -a11 diff --git a/tests/userfaultfd.gen.test b/tests/userfaultfd.gen.test index 47351466..61b6988e 100755 --- a/tests/userfaultfd.gen.test +++ b/tests/userfaultfd.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (userfaultfd -a38); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (userfaultfd -a38 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a38 +run_strace_match_diff -a38 diff --git a/tests/ustat.gen.test b/tests/ustat.gen.test index f64b28d9..2b09f7e9 100755 --- a/tests/ustat.gen.test +++ b/tests/ustat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ustat -a33); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (ustat -a33 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a33 +run_strace_match_diff -a33 diff --git a/tests/utime.gen.test b/tests/utime.gen.test index 72705566..58ebc5ac 100755 --- a/tests/utime.gen.test +++ b/tests/utime.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (utime -a16); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (utime -a16 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a16 +run_strace_match_diff -a16 diff --git a/tests/utimensat.gen.test b/tests/utimensat.gen.test index a4d6656e..07dffa37 100755 --- a/tests/utimensat.gen.test +++ b/tests/utimensat.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (utimensat -a33); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (utimensat -a33 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a33 +run_strace_match_diff -a33 diff --git a/tests/utimes.gen.test b/tests/utimes.gen.test index 37ed29cd..559243e9 100755 --- a/tests/utimes.gen.test +++ b/tests/utimes.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (utimes -a17); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (utimes -a17 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a17 +run_strace_match_diff -a17 diff --git a/tests/vhangup.gen.test b/tests/vhangup.gen.test index 7ac84e57..da192169 100755 --- a/tests/vhangup.gen.test +++ b/tests/vhangup.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (vhangup -a10); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (vhangup -a10 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a10 +run_strace_match_diff -a10 diff --git a/tests/vmsplice.gen.test b/tests/vmsplice.gen.test index fe6a07d3..0dc18b63 100755 --- a/tests/vmsplice.gen.test +++ b/tests/vmsplice.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (vmsplice -ewrite=1); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (vmsplice -ewrite=1 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -ewrite=1 +run_strace_match_diff -ewrite=1 diff --git a/tests/wait4.gen.test b/tests/wait4.gen.test index ae04915f..22a982fd 100755 --- a/tests/wait4.gen.test +++ b/tests/wait4.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (wait4 -esignal=none); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (wait4 -esignal=none ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -esignal=none +run_strace_match_diff -esignal=none diff --git a/tests/waitid.gen.test b/tests/waitid.gen.test index 59f40228..22edd673 100755 --- a/tests/waitid.gen.test +++ b/tests/waitid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (waitid -esignal=none); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (waitid -esignal=none ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -esignal=none +run_strace_match_diff -esignal=none diff --git a/tests/waitpid.gen.test b/tests/waitpid.gen.test index d91e2985..a5678a1a 100755 --- a/tests/waitpid.gen.test +++ b/tests/waitpid.gen.test @@ -1,4 +1,4 @@ #!/bin/sh -efu -# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (waitpid -a28); do not edit. +# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (waitpid -a28 ); do not edit. . "${srcdir=.}/init.sh" -run_strace_match_diff -a28 +run_strace_match_diff -a28 diff --git a/tests/xet_thread_area_x86.c b/tests/xet_thread_area_x86.c new file mode 100644 index 00000000..68f495cb --- /dev/null +++ b/tests/xet_thread_area_x86.c @@ -0,0 +1,227 @@ +/* + * Check decoding of set_thread_area and get_thread_area syscalls on x86 + * architecture. + * + * Copyright (c) 2018 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "tests.h" + +#include <asm/unistd.h> + +#if defined __NR_get_thread_area && defined __NR_set_thread_area \ + && defined HAVE_STRUCT_USER_DESC + +# include <assert.h> +# include <errno.h> +# include <stdbool.h> +# include <stdio.h> +# include <stdint.h> +# include <string.h> +# include <unistd.h> + +# include "print_user_desc.c" + +long errnum; + +static void +printptr(kernel_ulong_t ptr, const char *ptr_str) +{ + if (ptr_str) + printf("%s", ptr_str); + else + printf("%#llx", zero_extend_signed_to_ull(ptr)); +} + +/** + * Perform set_thread_area call along with printing the expected output. + * + * @param ptr_val Pointer to thread area argument. + * @param ptr_str Explicit string representation of the argument. + * @param valid Whether argument points to the valid memory and its contents + * should be decoded. + * @param entry_number_str explicit decoding of the entry_number field. + */ +static long +set_thread_area(kernel_ulong_t ptr_val, const char *ptr_str, bool valid, + const char *entry_number_str) +{ + struct user_desc *ptr = (struct user_desc *) (uintptr_t) ptr_val; + long rc = -1; + int saved_errno; + + rc = syscall(__NR_set_thread_area, ptr_val); + saved_errno = errno; + printf("set_thread_area("); + + if (valid) + print_user_desc(ptr, entry_number_str); + else + printptr(ptr_val, ptr_str); + + errno = saved_errno; + printf(") = %s", sprintrc(rc)); + if (!rc) + printf(" (entry_number=%u)", ptr->entry_number); + + puts(""); + + return rc; +} + +/** + * Perform get_thread_are call along with printing the expected output and + * checking the result against the argument of the previous set_thread_area + * call, if it had place. + * + * @param ptr_val Pointer to thread area argument. + * @param ptr_str Explicit string representation of the argument. + * @param valid Whether argument points to the valid memory and its contents + * should be decoded. + * @param set_rc Return code of the previous set_thread_area call. + * @param expected The value of the argument passed to the previous + * set_thread_area call. + */ +static void +get_thread_area(kernel_ulong_t ptr_val, const char *ptr_str, bool valid, + long set_rc, kernel_ulong_t expected) +{ + struct user_desc *ptr = (struct user_desc *) (uintptr_t) ptr_val; + struct user_desc *expected_ptr = + (struct user_desc *) (uintptr_t) expected; + int saved_errno; + long rc; + + rc = syscall(__NR_get_thread_area, ptr_val); + saved_errno = errno; + + printf("get_thread_area("); + + if (valid && !rc) { + if (!set_rc) { + assert(ptr->entry_number == expected_ptr->entry_number); + assert(ptr->base_addr == expected_ptr->base_addr); + assert(ptr->limit == expected_ptr->limit); + assert(ptr->seg_32bit == expected_ptr->seg_32bit); + assert(ptr->contents == expected_ptr->contents); + assert(ptr->read_exec_only == + expected_ptr->read_exec_only); + assert(ptr->limit_in_pages == + expected_ptr->limit_in_pages); + assert(ptr->seg_not_present == + expected_ptr->seg_not_present); + assert(ptr->useable == expected_ptr->useable); + /* + * We do not check lm as 32-bit processes ignore it, and + * only 32-bit processes can successfully execute + * get_thread_area. + */ + } + + print_user_desc(ptr, + (int) ptr->entry_number == -1 ? "-1" : NULL); + } else { + printptr(ptr_val, ptr_str); + } + + errno = saved_errno; + printf(") = %s\n", sprintrc(rc)); +} + +int main(void) +{ + struct user_desc *ta1 = tail_alloc(sizeof(*ta1)); + struct user_desc *ta2 = tail_alloc(sizeof(*ta2)); + unsigned *bogus_entry_number = tail_alloc(sizeof(*bogus_entry_number)); + + long set_rc = -1; + + /* + * Let's do some weird syscall, it will mark the beginning of our + * expected output. + */ + syscall(__NR_reboot, 0, 0, 0, 0); + + set_rc = set_thread_area((uintptr_t) ARG_STR(NULL), false, NULL); + get_thread_area((uintptr_t) ARG_STR(NULL), false, set_rc, + (uintptr_t) NULL); + + set_rc = set_thread_area(-1, NULL, false, NULL); + get_thread_area(-1, NULL, false, set_rc, -1); + + fill_memory(ta1, sizeof(*ta1)); + fill_memory_ex(ta2, sizeof(*ta2), 0xA5, 0x5A); + + set_thread_area((uintptr_t) (ta1 + 1), NULL, false, NULL); + + set_thread_area((uintptr_t) bogus_entry_number, NULL, false, NULL); + + set_thread_area((uintptr_t) ta1, NULL, true, NULL); + + ta1->entry_number = -1; + ta1->base_addr = 0; + ta1->limit = 0; + ta1->contents = 1; + ta1->seg_32bit = 1; + ta1->seg_not_present = 0; + + set_rc = set_thread_area((uintptr_t) ta1, NULL, true, "-1"); + + *bogus_entry_number = 2718281828U; + get_thread_area((uintptr_t) bogus_entry_number, + "{entry_number=2718281828, ...}", + false, set_rc, (uintptr_t) ta1); + + /* That one should return -EFAULT on i386 */ + *bogus_entry_number = 12; + get_thread_area((uintptr_t) bogus_entry_number, + "{entry_number=12, ...}", + false, set_rc, (uintptr_t) ta1); + + ta2->entry_number = 3141592653U; + get_thread_area((uintptr_t) ta2, "{entry_number=3141592653, ...}", + false, set_rc, (uintptr_t) ta1); + + ta2->entry_number = -1; + get_thread_area((uintptr_t) ta2, "{entry_number=-1, ...}", + false, set_rc, (uintptr_t) ta1); + + ta2->entry_number = ta1->entry_number; + assert(set_rc == 0 || (int) ta2->entry_number == -1); + get_thread_area((uintptr_t) ta2, "{entry_number=-1, ...}", + true, set_rc, (uintptr_t) ta1); + + puts("+++ exited with 0 +++"); + + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_get_thread_area && __NR_set_thread_area" + " && HAVE_STRUCT_USER_DESC"); + +#endif diff --git a/tests/xet_thread_area_x86.test b/tests/xet_thread_area_x86.test new file mode 100755 index 00000000..863f7e21 --- /dev/null +++ b/tests/xet_thread_area_x86.test @@ -0,0 +1,11 @@ +#!/bin/sh + +# Check decoding of set_thread_area and get_thread_area syscalls on x86. + +. "${srcdir=.}/init.sh" + +check_prog sed +run_prog > /dev/null +run_strace -a22 -e trace=reboot,/[gs]et_thread_area $args > "$EXP" +sed '0,/^reboot/d' "$LOG" > "$OUT" +match_diff "$OUT" "$EXP" diff --git a/tests/xselect.c b/tests/xselect.c index a25ebcc6..b1e37662 100644 --- a/tests/xselect.c +++ b/tests/xselect.c @@ -1,5 +1,7 @@ /* - * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org> + * Check decoding of select/_newselect syscalls. + * + * Copyright (c) 2015-2018 Dmitry V. Levin <ldv@altlinux.org> * Copyright (c) 2015-2017 The strace developers. * All rights reserved. * @@ -30,127 +32,442 @@ * Based on test by Dr. David Alan Gilbert <dave@treblig.org> */ -#include <assert.h> +#include <errno.h> +#include <limits.h> +#include <stdint.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <sys/select.h> -static fd_set set[0x1000000 / sizeof(fd_set)]; +static const char *errstr; -int main(void) +static long +xselect(const kernel_ulong_t nfds, + const kernel_ulong_t rs, + const kernel_ulong_t ws, + const kernel_ulong_t es, + const kernel_ulong_t tv) +#ifndef xselect { - TAIL_ALLOC_OBJECT_CONST_PTR(struct timeval, tv); - struct timeval tv_in; - int fds[2]; - long rc; + long rc = syscall(TEST_SYSCALL_NR, + F8ILL_KULONG_MASK | nfds, rs, ws, es, tv); + errstr = sprintrc(rc); + return rc; +} +#else + ; +#endif + +#define XSELECT(expected_, ...) \ + do { \ + long rc = xselect(__VA_ARGS__); \ + if (rc != (expected_)) \ + perror_msg_and_fail(TEST_SYSCALL_STR \ + ": expected %d" \ + ", returned %ld", \ + (expected_), rc); \ + } while (0) \ +/* End of XSELECT definition. */ + +int +main(void) +{ +#ifdef PATH_TRACING_FD + skip_if_unavailable("/proc/self/fd/"); +#endif + + for (int i = 3; i < FD_SETSIZE; ++i) { +#ifdef PATH_TRACING_FD + if (i == PATH_TRACING_FD) + continue; +#endif + (void) close(i); + } + int fds[2]; if (pipe(fds)) perror_msg_and_fail("pipe"); + static const int smallset_size = sizeof(kernel_ulong_t) * 8; + const int nfds = fds[1] + 1; + if (nfds > smallset_size) + error_msg_and_fail("nfds[%d] > smallset_size[%d]\n", + nfds, smallset_size); + + struct timeval tv_in = { 0, 123 }; + struct timeval *const tv = tail_memdup(&tv_in, sizeof(tv_in)); + const uintptr_t a_tv = (uintptr_t) tv; + + TAIL_ALLOC_OBJECT_VAR_PTR(kernel_ulong_t, l_rs); + fd_set *const rs = (void *) l_rs; + const uintptr_t a_rs = (uintptr_t) rs; + + TAIL_ALLOC_OBJECT_VAR_PTR(kernel_ulong_t, l_ws); + fd_set *const ws = (void *) l_ws; + const uintptr_t a_ws = (uintptr_t) ws; + + TAIL_ALLOC_OBJECT_VAR_PTR(kernel_ulong_t, l_es); + fd_set *const es = (void *) l_es; + const uintptr_t a_es = (uintptr_t) es; + + long rc; + /* - * Start with a nice simple select. + * An equivalent of nanosleep. */ - FD_ZERO(set); - FD_SET(fds[0], set); - FD_SET(fds[1], set); - rc = syscall(TEST_SYSCALL_NR, fds[1] + 1, set, set, set, NULL); - if (rc < 0) - perror_msg_and_skip(TEST_SYSCALL_STR); - assert(rc == 1); - printf("%s(%d, [%d %d], [%d %d], [%d %d], NULL) = 1 ()\n", - TEST_SYSCALL_STR, fds[1] + 1, fds[0], fds[1], - fds[0], fds[1], fds[0], fds[1]); + if (xselect(0, 0, 0, 0, a_tv)) { + if (errno == ENOSYS) + perror_msg_and_skip(TEST_SYSCALL_STR); + else + perror_msg_and_fail(TEST_SYSCALL_STR); + } +#ifndef PATH_TRACING_FD + printf("%s(0, NULL, NULL, NULL, {tv_sec=%lld, tv_usec=%llu})" + " = 0 (Timeout)\n", + TEST_SYSCALL_STR, (long long) tv_in.tv_sec, + zero_extend_signed_to_ull(tv_in.tv_usec)); +#endif + + /* EFAULT on tv argument */ + XSELECT(-1, 0, 0, 0, 0, a_tv + 1); +#ifndef PATH_TRACING_FD + printf("%s(0, NULL, NULL, NULL, %#lx) = %s\n", + TEST_SYSCALL_STR, (unsigned long) a_tv + 1, errstr); +#endif + + /* + * Start with a nice simple select with the same set. + */ + for (int i = nfds; i <= smallset_size; ++i) { + *l_rs = (1UL << fds[0]) | (1UL << fds[1]); + XSELECT(1, i, a_rs, a_rs, a_rs, 0); +#ifndef PATH_TRACING_FD + printf("%s(%d, [%d %d], [%d %d], [%d %d], NULL) = 1 ()\n", + TEST_SYSCALL_STR, i, fds[0], fds[1], + fds[0], fds[1], fds[0], fds[1]); +#else + *l_rs = (1UL << fds[0]) | (1UL << fds[1]) | + (1UL << PATH_TRACING_FD); + XSELECT(i > PATH_TRACING_FD ? 3 : 1, i, a_rs, a_rs, a_rs, 0); + if (i > PATH_TRACING_FD) { + printf("%s(%d, [%d %d %d], [%d %d %d], [%d %d %d]" + ", NULL) = 3 ()\n", + TEST_SYSCALL_STR, i, + fds[0], fds[1], PATH_TRACING_FD, + fds[0], fds[1], PATH_TRACING_FD, + fds[0], fds[1], PATH_TRACING_FD); + } +#endif + } /* * Odd timeout. */ - FD_SET(fds[0], set); - FD_SET(fds[1], set); - tv->tv_sec = 0xdeadbeefU; - tv->tv_usec = 0xfacefeedU; - memcpy(&tv_in, tv, sizeof(tv_in)); - rc = syscall(TEST_SYSCALL_NR, fds[1] + 1, set, set, set, tv); + *l_rs = (1UL << fds[0]) | (1UL << fds[1]); + tv_in.tv_sec = 0xdeadbeefU; + tv_in.tv_usec = 0xfacefeedU; + memcpy(tv, &tv_in, sizeof(tv_in)); + rc = xselect(nfds, a_rs, a_rs, a_rs, a_tv); if (rc < 0) { +#ifndef PATH_TRACING_FD printf("%s(%d, [%d %d], [%d %d], [%d %d]" ", {tv_sec=%lld, tv_usec=%llu}) = %s\n", - TEST_SYSCALL_STR, fds[1] + 1, fds[0], fds[1], - fds[0], fds[1], fds[0], fds[1], (long long) tv->tv_sec, - zero_extend_signed_to_ull(tv->tv_usec), sprintrc(rc)); + TEST_SYSCALL_STR, nfds, fds[0], fds[1], + fds[0], fds[1], fds[0], fds[1], + (long long) tv_in.tv_sec, + zero_extend_signed_to_ull(tv_in.tv_usec), + errstr); +#endif /* !PATH_TRACING_FD */ } else { +#ifndef PATH_TRACING_FD printf("%s(%d, [%d %d], [%d %d], [%d %d]" ", {tv_sec=%lld, tv_usec=%llu}) = %ld" " (left {tv_sec=%lld, tv_usec=%llu})\n", - TEST_SYSCALL_STR, fds[1] + 1, fds[0], fds[1], - fds[0], fds[1], fds[0], fds[1], (long long) tv_in.tv_sec, + TEST_SYSCALL_STR, nfds, fds[0], fds[1], + fds[0], fds[1], fds[0], fds[1], + (long long) tv_in.tv_sec, zero_extend_signed_to_ull(tv_in.tv_usec), rc, (long long) tv->tv_sec, zero_extend_signed_to_ull(tv->tv_usec)); +#endif /* !PATH_TRACING_FD */ } - FD_SET(fds[0], set); - FD_SET(fds[1], set); - tv->tv_sec = (time_t) 0xcafef00ddeadbeefLL; - tv->tv_usec = (suseconds_t) 0xbadc0dedfacefeedLL; - memcpy(&tv_in, tv, sizeof(tv_in)); - rc = syscall(TEST_SYSCALL_NR, fds[1] + 1, set, set, set, tv); + /* + * Very odd timeout. + */ + *l_rs = (1UL << fds[0]) | (1UL << fds[1]); + tv_in.tv_sec = (time_t) 0xcafef00ddeadbeefLL; + tv_in.tv_usec = (suseconds_t) 0xbadc0dedfacefeedLL; + memcpy(tv, &tv_in, sizeof(tv_in)); + rc = xselect(nfds, a_rs, a_rs, a_rs, a_tv); if (rc < 0) { +#ifndef PATH_TRACING_FD printf("%s(%d, [%d %d], [%d %d], [%d %d]" ", {tv_sec=%lld, tv_usec=%llu}) = %s\n", - TEST_SYSCALL_STR, fds[1] + 1, fds[0], fds[1], - fds[0], fds[1], fds[0], fds[1], (long long) tv->tv_sec, - zero_extend_signed_to_ull(tv->tv_usec), sprintrc(rc)); + TEST_SYSCALL_STR, nfds, fds[0], fds[1], + fds[0], fds[1], fds[0], fds[1], + (long long) tv_in.tv_sec, + zero_extend_signed_to_ull(tv_in.tv_usec), + errstr); +#endif /* PATH_TRACING_FD */ } else { +#ifndef PATH_TRACING_FD printf("%s(%d, [%d %d], [%d %d], [%d %d]" ", {tv_sec=%lld, tv_usec=%llu}) = %ld" " (left {tv_sec=%lld, tv_usec=%llu})\n", - TEST_SYSCALL_STR, fds[1] + 1, fds[0], fds[1], - fds[0], fds[1], fds[0], fds[1], (long long) tv_in.tv_sec, + TEST_SYSCALL_STR, nfds, fds[0], fds[1], + fds[0], fds[1], fds[0], fds[1], + (long long) tv_in.tv_sec, zero_extend_signed_to_ull(tv_in.tv_usec), rc, (long long) tv->tv_sec, zero_extend_signed_to_ull(tv->tv_usec)); +#endif /* PATH_TRACING_FD */ } /* * Another simple one, with a timeout. */ - FD_SET(1, set); - FD_SET(2, set); - FD_SET(fds[0], set); - FD_SET(fds[1], set); - tv->tv_sec = 0xc0de1; - tv->tv_usec = 0xc0de2; - memcpy(&tv_in, tv, sizeof(tv_in)); - assert(syscall(TEST_SYSCALL_NR, fds[1] + 1, NULL, set, NULL, tv) == 3); - printf("%s(%d, NULL, [1 2 %d %d], NULL, {tv_sec=%lld, tv_usec=%llu})" - " = 3 (out [1 2 %d], left {tv_sec=%lld, tv_usec=%llu})\n", - TEST_SYSCALL_STR, fds[1] + 1, fds[0], fds[1], - (long long) tv_in.tv_sec, - zero_extend_signed_to_ull(tv_in.tv_usec), - fds[1], - (long long) tv->tv_sec, - zero_extend_signed_to_ull(tv->tv_usec)); + for (int i = nfds; i <= smallset_size; ++i) { + *l_rs = (1UL << fds[0]) | (1UL << fds[1]); + *l_ws = (1UL << 1) | (1UL << 2) | + (1UL << fds[0]) | (1UL << fds[1]); + *l_es = 0; + tv_in.tv_sec = 0xc0de1; + tv_in.tv_usec = 0xc0de2; + memcpy(tv, &tv_in, sizeof(tv_in)); + XSELECT(3, i, a_rs, a_ws, a_es, a_tv); +#ifndef PATH_TRACING_FD + printf("%s(%d, [%d %d], [%d %d %d %d], []" + ", {tv_sec=%lld, tv_usec=%llu}) = 3 (out [1 2 %d]" + ", left {tv_sec=%lld, tv_usec=%llu})\n", + TEST_SYSCALL_STR, i, fds[0], fds[1], + 1, 2, fds[0], fds[1], + (long long) tv_in.tv_sec, + zero_extend_signed_to_ull(tv_in.tv_usec), + fds[1], + (long long) tv->tv_sec, + zero_extend_signed_to_ull(tv->tv_usec)); +#else + *l_rs = (1UL << fds[0]) | (1UL << fds[1]) | + (1UL << PATH_TRACING_FD); + *l_ws = (1UL << 1) | (1UL << 2) | + (1UL << fds[0]) | (1UL << fds[1]); + tv_in.tv_sec = 0xc0de1; + tv_in.tv_usec = 0xc0de2; + memcpy(tv, &tv_in, sizeof(tv_in)); + XSELECT(3 + (i > PATH_TRACING_FD), i, a_rs, a_ws, a_es, a_tv); + if (i > PATH_TRACING_FD) { + printf("%s(%d, [%d %d %d], [%d %d %d %d], []" + ", {tv_sec=%lld, tv_usec=%llu})" + " = 4 (in [%d], out [1 2 %d]" + ", left {tv_sec=%lld, tv_usec=%llu})\n", + TEST_SYSCALL_STR, i, + fds[0], fds[1], PATH_TRACING_FD, + 1, 2, fds[0], fds[1], + (long long) tv_in.tv_sec, + zero_extend_signed_to_ull(tv_in.tv_usec), + PATH_TRACING_FD, fds[1], + (long long) tv->tv_sec, + zero_extend_signed_to_ull(tv->tv_usec)); + } + + *l_rs = (1UL << fds[0]) | (1UL << fds[1]); + *l_ws = (1UL << 1) | (1UL << 2) | + (1UL << fds[0]) | (1UL << fds[1]) | + (1UL << PATH_TRACING_FD); + tv_in.tv_sec = 0xc0de1; + tv_in.tv_usec = 0xc0de2; + memcpy(tv, &tv_in, sizeof(tv_in)); + XSELECT(3 + (i > PATH_TRACING_FD), i, a_rs, a_ws, a_es, a_tv); + if (i > PATH_TRACING_FD) { + printf("%s(%d, [%d %d], [%d %d %d %d %d], []" + ", {tv_sec=%lld, tv_usec=%llu})" + " = 4 (out [1 2 %d %d]" + ", left {tv_sec=%lld, tv_usec=%llu})\n", + TEST_SYSCALL_STR, i, + fds[0], fds[1], + 1, 2, fds[0], fds[1], PATH_TRACING_FD, + (long long) tv_in.tv_sec, + zero_extend_signed_to_ull(tv_in.tv_usec), + fds[1], PATH_TRACING_FD, + (long long) tv->tv_sec, + zero_extend_signed_to_ull(tv->tv_usec)); + } + + *l_rs = (1UL << fds[0]) | (1UL << fds[1]); + *l_ws = (1UL << 1) | (1UL << 2) | + (1UL << fds[0]) | (1UL << fds[1]); + *l_es = (1UL << PATH_TRACING_FD); + tv_in.tv_sec = 0xc0de1; + tv_in.tv_usec = 0xc0de2; + memcpy(tv, &tv_in, sizeof(tv_in)); + XSELECT(3, i, a_rs, a_ws, a_es, a_tv); + if (i > PATH_TRACING_FD) { + printf("%s(%d, [%d %d], [%d %d %d %d], [%d]" + ", {tv_sec=%lld, tv_usec=%llu}) = 3 (out [1 2 %d]" + ", left {tv_sec=%lld, tv_usec=%llu})\n", + TEST_SYSCALL_STR, i, + fds[0], fds[1], + 1, 2, fds[0], fds[1], PATH_TRACING_FD, + (long long) tv_in.tv_sec, + zero_extend_signed_to_ull(tv_in.tv_usec), + fds[1], + (long long) tv->tv_sec, + zero_extend_signed_to_ull(tv->tv_usec)); + } + +#endif /* PATH_TRACING_FD */ + } /* * Now the crash case that trinity found, negative nfds * but with a pointer to a large chunk of valid memory. */ - FD_ZERO(set); + static fd_set set[0x1000000 / sizeof(fd_set)]; FD_SET(fds[1], set); - assert(syscall(TEST_SYSCALL_NR, -1, NULL, set, NULL, NULL) == -1); - printf("%s(-1, NULL, %p, NULL, NULL) = -1 EINVAL (%m)\n", - TEST_SYSCALL_STR, set); + XSELECT(-1, -1U, 0, (uintptr_t) set, 0, 0); +#ifndef PATH_TRACING_FD + printf("%s(-1, NULL, %p, NULL, NULL) = %s\n", + TEST_SYSCALL_STR, set, errstr); +#endif /* - * Another variant, with nfds exceeding FD_SETSIZE limit. + * Big sets, nfds exceeds FD_SETSIZE limit. */ - FD_ZERO(set); + const size_t big_size = sizeof(fd_set) + sizeof(long); + fd_set *const big_rs = tail_alloc(big_size); + const uintptr_t a_big_rs = (uintptr_t) big_rs; + + fd_set *const big_ws = tail_alloc(big_size); + const uintptr_t a_big_ws = (uintptr_t) big_ws; + + for (unsigned int i = FD_SETSIZE; i <= big_size * 8; ++i) { + memset(big_rs, 0, big_size); + memset(big_ws, 0, big_size); + FD_SET(fds[0], big_rs); + tv->tv_sec = 0; + tv->tv_usec = 10 + (i - FD_SETSIZE); + XSELECT(0, i, a_big_rs, a_big_ws, 0, a_tv); +#ifndef PATH_TRACING_FD + printf("%s(%d, [%d], [], NULL, {tv_sec=0, tv_usec=%d})" + " = 0 (Timeout)\n", + TEST_SYSCALL_STR, i, fds[0], 10 + (i - FD_SETSIZE)); +#else + FD_SET(fds[0], big_rs); + FD_SET(PATH_TRACING_FD, big_rs); + tv->tv_sec = 0; + tv->tv_usec = 10 + (i - FD_SETSIZE); + XSELECT(1, i, a_big_rs, a_big_ws, 0, a_tv); + printf("%s(%d, [%d %d], [], NULL, {tv_sec=0, tv_usec=%d})" + " = 1 (in [%d], left {tv_sec=0, tv_usec=%llu})\n", + TEST_SYSCALL_STR, i, fds[0], PATH_TRACING_FD, + 10 + (i - FD_SETSIZE), PATH_TRACING_FD, + zero_extend_signed_to_ull(tv->tv_usec)); +#endif /* PATH_TRACING_FD */ + } + + /* + * Huge sets, nfds equals to INT_MAX. + */ + FD_SET(fds[0], set); + FD_SET(fds[1], set); + tv->tv_sec = 0; + tv->tv_usec = 123; + XSELECT(0, INT_MAX, (uintptr_t) set, (uintptr_t) &set[1], + (uintptr_t) &set[2], a_tv); +#ifndef PATH_TRACING_FD + printf("%s(%d, [%d %d], [], [], {tv_sec=0, tv_usec=123})" + " = 0 (Timeout)\n", + TEST_SYSCALL_STR, INT_MAX, fds[0], fds[1]); +#else FD_SET(fds[0], set); + FD_SET(fds[1], set); + FD_SET(PATH_TRACING_FD, set); tv->tv_sec = 0; tv->tv_usec = 123; - assert(syscall(TEST_SYSCALL_NR, FD_SETSIZE + 1, set, set + 1, NULL, tv) == 0); - printf("%s(%d, [%d], [], NULL, {tv_sec=0, tv_usec=123}) = 0 (Timeout)\n", - TEST_SYSCALL_STR, FD_SETSIZE + 1, fds[0]); + XSELECT(1, INT_MAX, (uintptr_t) set, (uintptr_t) &set[1], + (uintptr_t) &set[2], a_tv); + printf("%s(%d, [%d %d %d], [], [], {tv_sec=0, tv_usec=123})" + " = 1 (in [%d], left {tv_sec=0, tv_usec=%llu})\n", + TEST_SYSCALL_STR, INT_MAX, fds[0], fds[1], PATH_TRACING_FD, + PATH_TRACING_FD, zero_extend_signed_to_ull(tv->tv_usec)); +#endif /* PATH_TRACING_FD */ + + /* + * Small sets, nfds exceeds FD_SETSIZE limit. + * The kernel seems to be fine with it but strace cannot follow. + */ + *l_rs = (1UL << fds[0]) | (1UL << fds[1]) +#ifdef PATH_TRACING_FD + | (1UL << PATH_TRACING_FD) +#endif + ; + *l_ws = (1UL << fds[0]); + *l_es = (1UL << fds[0]) | (1UL << fds[1]) +#ifdef PATH_TRACING_FD + | (1UL << PATH_TRACING_FD) +#endif + ; + tv->tv_sec = 0; + tv->tv_usec = 123; + rc = xselect(FD_SETSIZE + 1, a_rs, a_ws, a_es, a_tv); + if (rc < 0) { +#ifndef PATH_TRACING_FD + printf("%s(%d, %p, %p, %p, {tv_sec=0, tv_usec=123}) = %s\n", + TEST_SYSCALL_STR, FD_SETSIZE + 1, rs, ws, es, errstr); +#endif + } else { +#ifndef PATH_TRACING_FD + printf("%s(%d, %p, %p, %p, {tv_sec=0, tv_usec=123})" + " = 0 (Timeout)\n", + TEST_SYSCALL_STR, FD_SETSIZE + 1, rs, ws, es); +#endif + } + + /* + * Small sets, one of allocated descriptors exceeds smallset_size. + */ + if (dup2(fds[1], smallset_size) != smallset_size) + perror_msg_and_fail("dup2"); +#ifdef PATH_TRACING_FD + FD_SET(PATH_TRACING_FD, rs); + FD_SET(PATH_TRACING_FD, ws); + FD_SET(PATH_TRACING_FD, es); +#endif + XSELECT(-1, smallset_size + 1, a_rs, a_ws, a_es, 0); +#ifndef PATH_TRACING_FD + printf("%s(%d, %p, %p, %p, NULL) = %s\n", + TEST_SYSCALL_STR, smallset_size + 1, rs, ws, es, errstr); +#endif + + /* + * Small and big sets, + * one of allocated descriptors exceeds smallset_size. + */ + memset(big_rs, 0, big_size); + FD_SET(fds[0], big_rs); + FD_SET(smallset_size, big_rs); + memset(big_ws, 0, big_size); + FD_SET(fds[1], big_ws); + FD_SET(smallset_size, big_ws); + XSELECT(-1, smallset_size + 1, a_big_rs, a_big_ws, a_es, 0); +#ifndef PATH_TRACING_FD + printf("%s(%d, [%d %d], [%d %d], %p, NULL) = %s\n", + TEST_SYSCALL_STR, smallset_size + 1, + fds[0], smallset_size, + fds[1], smallset_size, + es, errstr); +#endif /* !PATH_TRACING_FD */ + XSELECT(-1, smallset_size + 1, a_es, a_big_ws, a_big_rs, 0); +#ifndef PATH_TRACING_FD + printf("%s(%d, %p, [%d %d], [%d %d], NULL) = %s\n", + TEST_SYSCALL_STR, smallset_size + 1, + es, + fds[1], smallset_size, + fds[0], smallset_size, + errstr); +#endif /* !PATH_TRACING_FD */ puts("+++ exited with 0 +++"); return 0; diff --git a/trace_event.h b/trace_event.h new file mode 100644 index 00000000..38883c81 --- /dev/null +++ b/trace_event.h @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2017 The strace developers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef STRACE_TRACE_EVENT_H +#define STRACE_TRACE_EVENT_H + +/* Possible trace event loop states. Returned by next_event() and dispatched by + * dispatch_event(). */ +enum trace_event { + /* Break the main loop. */ + TE_BREAK, + + /* Call next_event() again. */ + TE_NEXT, + + /* Restart the tracee with signal 0 and call next_event() again. */ + TE_RESTART, + + /* + * For all the events below, current_tcp is set to current tracee's + * tcb. All the suggested actions imply that you want to continue + * tracing of the current tracee; alternatively, you can detach it. + */ + + /* + * Syscall entry or exit. + * Restart the tracee with signal 0, or with an injected signal number. + */ + TE_SYSCALL_STOP, + + /* + * Tracee received signal with number WSTOPSIG(*pstatus); signal info + * is written to *si. Restart the tracee (with that signal number + * if you want to deliver it). + */ + TE_SIGNAL_DELIVERY_STOP, + + /* + * Tracee was killed by a signal with number WTERMSIG(*pstatus). + */ + TE_SIGNALLED, + + /* + * Tracee was stopped by a signal with number WSTOPSIG(*pstatus). + * Restart the tracee with that signal number. + */ + TE_GROUP_STOP, + + /* + * Tracee exited with status WEXITSTATUS(*pstatus). + */ + TE_EXITED, + + /* + * Tracee is going to perform execve(). + * Restart the tracee with signal 0. + */ + TE_STOP_BEFORE_EXECVE, + + /* + * Tracee is going to terminate. + * Restart the tracee with signal 0. + */ + TE_STOP_BEFORE_EXIT, +}; + +#endif /* !STRACE_TRACE_EVENT_H */ @@ -27,18 +27,13 @@ #include "defs.h" -#include <linux/ioctl.h> +#ifdef HAVE_STRUCT_UBI_ATTACH_REQ_MAX_BEB_PER1024 -/* The UBI api changes, so we have to keep a local copy */ -#include <linux/version.h> -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 7, 0) -# include "ubi-user.h" -#else +# include <linux/ioctl.h> # include <mtd/ubi-user.h> -#endif -#include "xlat/ubi_volume_types.h" -#include "xlat/ubi_volume_props.h" +# include "xlat/ubi_volume_types.h" +# include "xlat/ubi_volume_props.h" int ubi_ioctl(struct tcb *const tcp, const unsigned int code, @@ -183,12 +178,12 @@ ubi_ioctl(struct tcb *const tcp, const unsigned int code, printnum_int(tcp, arg, "%d"); break; -#ifdef UBI_IOCVOLCRBLK +# ifdef UBI_IOCVOLCRBLK case UBI_IOCVOLCRBLK: -#endif -#ifdef UBI_IOCVOLRMBLK +# endif +# ifdef UBI_IOCVOLRMBLK case UBI_IOCVOLRMBLK: -#endif +# endif /* no arguments */ break; @@ -198,3 +193,5 @@ ubi_ioctl(struct tcb *const tcp, const unsigned int code, return RVAL_IOCTL_DECODED; } + +#endif /* HAVE_STRUCT_UBI_ATTACH_REQ_MAX_BEB_PER1024 */ @@ -203,6 +203,7 @@ umovestr_peekdata(const int pid, kernel_ulong_t addr, unsigned int len, { unsigned int nread = 0; unsigned int residue = addr & (sizeof(long) - 1); + void *const orig_addr = laddr; while (len) { addr &= -sizeof(long); /* aligned address */ @@ -237,7 +238,7 @@ umovestr_peekdata(const int pid, kernel_ulong_t addr, unsigned int len, memcpy(laddr, &u.x[residue], m); while (residue < sizeof(long)) if (u.x[residue++] == '\0') - return 1; + return (laddr - orig_addr) + residue; residue = 0; addr += sizeof(long); laddr += m; @@ -252,8 +253,7 @@ umovestr_peekdata(const int pid, kernel_ulong_t addr, unsigned int len, * Like `umove' but make the additional effort of looking * for a terminating zero byte. * - * Returns < 0 on error, > 0 if NUL was seen, - * (TODO if useful: return count of bytes including NUL), + * Returns < 0 on error, strlen + 1 if NUL was seen, * else 0 if len bytes were read but no NUL byte seen. * * Note: there is no guarantee we won't overwrite some bytes @@ -289,8 +289,10 @@ umovestr(struct tcb *const tcp, kernel_ulong_t addr, unsigned int len, int r = vm_read_mem(pid, laddr, addr, chunk_len); if (r > 0) { - if (memchr(laddr, '\0', r)) - return 1; + char *nul_addr = memchr(laddr, '\0', r); + + if (nul_addr) + return (nul_addr - laddr) + 1; addr += r; laddr += r; nread += r; @@ -4,7 +4,7 @@ * Copyright (c) 1993-1996 Rick Sladkey <jrs@world.std.com> * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl> * Copyright (c) 2003-2016 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2014-2017 The strace developers. + * Copyright (c) 2014-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -55,7 +55,7 @@ #include "defs.h" #ifdef STRACE_UID_SIZE -# if !NEED_UID16_PARSERS +# if !HAVE_ARCH_UID16_SYSCALLS # undef STRACE_UID_SIZE # endif #else @@ -1,6 +1,6 @@ /* * Copyright (c) 2013 Luca Clementi <luca.clementi@gmail.com> - * Copyright (c) 2013-2017 The strace developers. + * Copyright (c) 2013-2018 The strace developers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,6 +29,16 @@ #include <limits.h> #include <libunwind-ptrace.h> +#ifdef USE_DEMANGLE +# if defined HAVE_DEMANGLE_H +# include <demangle.h> +# elif defined HAVE_LIBIBERTY_DEMANGLE_H +# include <libiberty/demangle.h> +# endif +#endif + +#include "xstring.h" + #ifdef _LARGEFILE64_SOURCE # ifdef HAVE_FOPEN64 # define fopen_for_input fopen64 @@ -39,12 +49,6 @@ # define fopen_for_input fopen #endif -#define DPRINTF(F, A, ...) \ - do { \ - if (debug_flag) \ - error_msg("[unwind(" A ")] " F, __VA_ARGS__); \ - } while (0) - /* * Keep a sorted array of cache entries, * so that we can binary search through it. @@ -96,6 +100,8 @@ static void delete_mmap_cache(struct tcb *tcp, const char *caller); static unw_addr_space_t libunwind_as; static unsigned int mmap_cache_generation; +static const char asprintf_error_str[] = "???"; + void unwind_init(void) { @@ -143,23 +149,20 @@ static void build_mmap_cache(struct tcb *tcp) { FILE *fp; - struct mmap_cache_t *cache_head; - /* start with a small dynamically-allocated array and then expand it */ - size_t cur_array_size = 10; + struct mmap_cache_t *cache_head = NULL; + size_t cur_array_size = 0; char filename[sizeof("/proc/4294967296/maps")]; char buffer[PATH_MAX + 80]; unw_flush_cache(libunwind_as, 0, 0); - sprintf(filename, "/proc/%u/maps", tcp->pid); + xsprintf(filename, "/proc/%u/maps", tcp->pid); fp = fopen_for_input(filename, "r"); if (!fp) { perror_msg("fopen: %s", filename); return; } - cache_head = xcalloc(cur_array_size, sizeof(*cache_head)); - while (fgets(buffer, sizeof(buffer), fp) != NULL) { struct mmap_cache_t *entry; unsigned long start_addr, end_addr, mmap_offset; @@ -193,17 +196,19 @@ build_mmap_cache(struct tcb *tcp) } if (start_addr <= entry->start_addr || start_addr < entry->end_addr) { - error_msg("%s: overlapping memory region", - filename); + debug_msg("%s: overlapping memory region: " + "\"%s\" [%08lx-%08lx] overlaps with " + "\"%s\" [%08lx-%08lx]", + filename, binary_path, start_addr, + end_addr, entry->binary_filename, + entry->start_addr, entry->end_addr); continue; } } - if (tcp->mmap_cache_size >= cur_array_size) { - cur_array_size *= 2; - cache_head = xreallocarray(cache_head, cur_array_size, - sizeof(*cache_head)); - } + if (tcp->mmap_cache_size >= cur_array_size) + cache_head = xgrowarray(cache_head, &cur_array_size, + sizeof(*cache_head)); entry = &cache_head[tcp->mmap_cache_size]; entry->start_addr = start_addr; @@ -216,11 +221,10 @@ build_mmap_cache(struct tcb *tcp) tcp->mmap_cache = cache_head; tcp->mmap_cache_generation = mmap_cache_generation; - DPRINTF("tgen=%u, ggen=%u, tcp=%p, cache=%p", - "cache-build", - tcp->mmap_cache_generation, - mmap_cache_generation, - tcp, tcp->mmap_cache); + debug_func_msg("tgen=%u, ggen=%u, tcp=%p, cache=%p", + tcp->mmap_cache_generation, + mmap_cache_generation, + tcp, tcp->mmap_cache); } /* deleting the cache */ @@ -229,11 +233,10 @@ delete_mmap_cache(struct tcb *tcp, const char *caller) { unsigned int i; - DPRINTF("tgen=%u, ggen=%u, tcp=%p, cache=%p, caller=%s", - "cache-delete", - tcp->mmap_cache_generation, - mmap_cache_generation, - tcp, tcp->mmap_cache, caller); + debug_func_msg("tgen=%u, ggen=%u, tcp=%p, cache=%p, caller=%s", + tcp->mmap_cache_generation, + mmap_cache_generation, + tcp, tcp->mmap_cache, caller); for (i = 0; i < tcp->mmap_cache_size; i++) { free(tcp->mmap_cache[i].binary_filename); @@ -254,10 +257,7 @@ rebuild_cache_if_invalid(struct tcb *tcp, const char *caller) if (!tcp->mmap_cache) build_mmap_cache(tcp); - if (!tcp->mmap_cache || !tcp->mmap_cache_size) - return false; - else - return true; + return tcp->mmap_cache && tcp->mmap_cache_size; } void @@ -265,16 +265,15 @@ unwind_cache_invalidate(struct tcb *tcp) { #if SUPPORTED_PERSONALITIES > 1 if (tcp->currpers != DEFAULT_PERSONALITY) { - /* disable strack trace */ + /* disable stack trace */ return; } #endif mmap_cache_generation++; - DPRINTF("tgen=%u, ggen=%u, tcp=%p, cache=%p", "increment", - tcp->mmap_cache_generation, - mmap_cache_generation, - tcp, - tcp->mmap_cache); + debug_func_msg("tgen=%u, ggen=%u, tcp=%p, cache=%p", + tcp->mmap_cache_generation, + mmap_cache_generation, + tcp, tcp->mmap_cache); } static void @@ -290,8 +289,7 @@ get_symbol_name(unw_cursor_t *cursor, char **name, *offset = 0; break; } - *name = xreallocarray(*name, 2, *size); - *size *= 2; + *name = xgrowarray(*name, size, 1); } } @@ -328,11 +326,25 @@ print_stack_frame(struct tcb *tcp, &function_offset); true_offset = ip - cur_mmap_cache->start_addr + cur_mmap_cache->mmap_offset; + +#ifdef USE_DEMANGLE + char *demangled_name = + cplus_demangle(*symbol_name, + DMGL_AUTO | DMGL_PARAMS); +#endif + call_action(data, cur_mmap_cache->binary_filename, +#ifdef USE_DEMANGLE + demangled_name ? demangled_name : +#endif *symbol_name, function_offset, true_offset); +#ifdef USE_DEMANGLE + free(demangled_name); +#endif + return 0; } else if (ip < cur_mmap_cache->start_addr) upper = mid - 1; @@ -466,8 +478,10 @@ sprint_call_or_error(const char *binary_filename, else n = asprintf(&output_line, STACK_ENTRY_BUG_FMT, __func__); - if (n < 0) - error_msg_and_die("error in asprintf"); + if (n < 0) { + perror_func_msg("asprintf"); + output_line = (char *) asprintf_error_str; + } return output_line; } @@ -540,7 +554,9 @@ queue_print(struct queue_t *queue) tprints(tmp->output_line); line_ended(); - free(tmp->output_line); + if (tmp->output_line != asprintf_error_str) + free(tmp->output_line); + tmp->output_line = NULL; tmp->next = NULL; free(tmp); @@ -555,15 +571,15 @@ unwind_print_stacktrace(struct tcb *tcp) { #if SUPPORTED_PERSONALITIES > 1 if (tcp->currpers != DEFAULT_PERSONALITY) { - /* disable strack trace */ + /* disable stack trace */ return; } #endif if (tcp->queue->head) { - DPRINTF("tcp=%p, queue=%p", "queueprint", tcp, tcp->queue->head); + debug_func_msg("head: tcp=%p, queue=%p", tcp, tcp->queue->head); queue_print(tcp->queue); } else if (rebuild_cache_if_invalid(tcp, __func__)) { - DPRINTF("tcp=%p, queue=%p", "stackprint", tcp, tcp->queue->head); + debug_func_msg("walk: tcp=%p, queue=%p", tcp, tcp->queue->head); stacktrace_walk(tcp, print_call_cb, print_error_cb, NULL); } } @@ -576,7 +592,7 @@ unwind_capture_stacktrace(struct tcb *tcp) { #if SUPPORTED_PERSONALITIES > 1 if (tcp->currpers != DEFAULT_PERSONALITY) { - /* disable strack trace */ + /* disable stack trace */ return; } #endif @@ -586,6 +602,6 @@ unwind_capture_stacktrace(struct tcb *tcp) if (rebuild_cache_if_invalid(tcp, __func__)) { stacktrace_walk(tcp, queue_put_call, queue_put_error, tcp->queue); - DPRINTF("tcp=%p, queue=%p", "captured", tcp, tcp->queue->head); + debug_func_msg("tcp=%p, queue=%p", tcp, tcp->queue->head); } } @@ -36,15 +36,16 @@ #include "ptrace.h" int -upeek(int pid, unsigned long off, kernel_ulong_t *res) +upeek(struct tcb *tcp, unsigned long off, kernel_ulong_t *res) { long val; errno = 0; - val = ptrace(PTRACE_PEEKUSER, (pid_t) pid, (void *) off, 0); + val = ptrace(PTRACE_PEEKUSER, (pid_t) tcp->pid, (void *) off, 0); if (val == -1 && errno) { if (errno != ESRCH) { - perror_msg("upeek: PTRACE_PEEKUSER pid:%d @0x%lx)", pid, off); + perror_msg("upeek: PTRACE_PEEKUSER pid:%d @0x%lx)", + tcp->pid, off); } return -1; } @@ -1,5 +1,6 @@ /* * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2016-2017 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,11 +30,12 @@ #include "ptrace.h" int -upoke(int pid, unsigned long off, kernel_ulong_t val) +upoke(struct tcb *tcp, unsigned long off, kernel_ulong_t val) { - if (ptrace(PTRACE_POKEUSER, pid, off, val)) { + if (ptrace(PTRACE_POKEUSER, tcp->pid, off, val)) { if (errno != ESRCH) - perror_msg("upoke: PTRACE_POKEUSER pid:%d @%#lx)", pid, off); + perror_msg("upoke: PTRACE_POKEUSER pid:%d @%#lx)", + tcp->pid, off); return -1; } return 0; @@ -6,7 +6,7 @@ * Copyright (c) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation * Linux for s390 port by D.J. Barrow * <barrow_dj@mail.yahoo.com,djbarrow@de.ibm.com> - * Copyright (c) 1999-2017 The strace developers. + * Copyright (c) 1999-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,13 +33,14 @@ */ #include "defs.h" -#include <sys/param.h> +#include <limits.h> #include <fcntl.h> #include <stdarg.h> #ifdef HAVE_SYS_XATTR_H # include <sys/xattr.h> #endif #include <sys/uio.h> +#include "xstring.h" int tv_nz(const struct timeval *a) @@ -344,15 +345,9 @@ sprinttime_ex(const long long sec, const unsigned long long part_sec, if (!pos) return NULL; - if (part_sec > 0) { - int ret = snprintf(buf + pos, sizeof(buf) - pos, ".%0*llu", - width, part_sec); - - if (ret < 0 || (size_t) ret >= sizeof(buf) - pos) - return NULL; - - pos += ret; - } + if (part_sec > 0) + pos += xsnprintf(buf + pos, sizeof(buf) - pos, ".%0*llu", + width, part_sec); return strftime(buf + pos, sizeof(buf) - pos, "%z", tmp) ? buf : NULL; } @@ -387,7 +382,7 @@ getfdproto(struct tcb *tcp, int fd) if (fd < 0) return SOCK_PROTO_UNKNOWN; - sprintf(path, "/proc/%u/fd/%u", tcp->pid, fd); + xsprintf(path, "/proc/%u/fd/%u", tcp->pid, fd); r = getxattr(path, "system.sockprotoname", buf, bufsize - 1); if (r <= 0) return SOCK_PROTO_UNKNOWN; @@ -502,6 +497,8 @@ string_quote(const char *instr, char *outstr, const unsigned int size, } } + if (style & QUOTE_EMIT_COMMENT) + s = stpcpy(s, " /* "); if (!(style & QUOTE_OMIT_LEADING_TRAILING_QUOTES)) *s++ = '\"'; @@ -581,6 +578,8 @@ string_quote(const char *instr, char *outstr, const unsigned int size, if (!(style & QUOTE_OMIT_LEADING_TRAILING_QUOTES)) *s++ = '\"'; + if (style & QUOTE_EMIT_COMMENT) + s = stpcpy(s, " */"); *s = '\0'; /* Return zero if we printed entire ASCIZ string (didn't truncate it) */ @@ -596,6 +595,8 @@ string_quote(const char *instr, char *outstr, const unsigned int size, asciz_ended: if (!(style & QUOTE_OMIT_LEADING_TRAILING_QUOTES)) *s++ = '\"'; + if (style & QUOTE_EMIT_COMMENT) + s = stpcpy(s, " */"); *s = '\0'; /* Return zero: we printed entire ASCIZ string (didn't truncate it) */ return 0; @@ -637,7 +638,8 @@ print_quoted_string(const char *str, unsigned int size, tprints("???"); return -1; } - alloc_size += 1 + (style & QUOTE_OMIT_LEADING_TRAILING_QUOTES ? 0 : 2); + alloc_size += 1 + (style & QUOTE_OMIT_LEADING_TRAILING_QUOTES ? 0 : 2) + + (style & QUOTE_EMIT_COMMENT ? 7 : 0); if (use_alloca(alloc_size)) { outstr = alloca(alloc_size); @@ -679,8 +681,10 @@ print_quoted_cstring(const char *str, unsigned int size) /* * Print path string specified by address `addr' and length `n'. * If path length exceeds `n', append `...' to the output. + * + * Returns the result of umovenstr. */ -void +int printpathn(struct tcb *const tcp, const kernel_ulong_t addr, unsigned int n) { char path[PATH_MAX]; @@ -688,7 +692,7 @@ printpathn(struct tcb *const tcp, const kernel_ulong_t addr, unsigned int n) if (!addr) { tprints("NULL"); - return; + return -1; } /* Cap path length to the path buffer size */ @@ -703,13 +707,15 @@ printpathn(struct tcb *const tcp, const kernel_ulong_t addr, unsigned int n) path[n++] = !nul_seen; print_quoted_cstring(path, n); } + + return nul_seen; } -void +int printpath(struct tcb *const tcp, const kernel_ulong_t addr) { /* Size must correspond to char path[] size in printpathn */ - printpathn(tcp, addr, PATH_MAX - 1); + return printpathn(tcp, addr, PATH_MAX - 1); } /* @@ -719,8 +725,11 @@ printpath(struct tcb *const tcp, const kernel_ulong_t addr) * Pass `user_style' on to `string_quote'. * Append `...' to the output if either the string length exceeds `max_strlen', * or QUOTE_0_TERMINATED bit is set and the string length exceeds `len'. + * + * Returns the result of umovenstr if style has QUOTE_0_TERMINATED, + * or the result of umoven otherwise. */ -void +int printstr_ex(struct tcb *const tcp, const kernel_ulong_t addr, const kernel_ulong_t len, const unsigned int user_style) { @@ -734,7 +743,7 @@ printstr_ex(struct tcb *const tcp, const kernel_ulong_t addr, if (!addr) { tprints("NULL"); - return; + return -1; } /* Allocate static buffers if they are not allocated yet. */ if (!str) { @@ -761,7 +770,7 @@ printstr_ex(struct tcb *const tcp, const kernel_ulong_t addr, if (rc < 0) { printaddr(addr); - return; + return rc; } if (size > max_strlen) @@ -780,6 +789,8 @@ printstr_ex(struct tcb *const tcp, const kernel_ulong_t addr, tprints(outstr); if (ellipsis) tprints("..."); + + return rc; } void @@ -1081,7 +1092,7 @@ print_abnormal_hi(const kernel_ulong_t val) #endif int -read_int_from_file(const char *const fname, int *const pvalue) +read_int_from_file(struct tcb *tcp, const char *const fname, int *const pvalue) { const int fd = open_file(fname, O_RDONLY); if (fd < 0) @@ -2,7 +2,7 @@ * Copyright (c) 2014 Philippe De Muyter <phdm@macqel.be> * Copyright (c) 2014 William Manley <will@williammanley.net> * Copyright (c) 2011 Peter Zotov <whitequark@whitequark.org> - * Copyright (c) 2014-2017 The strace developers. + * Copyright (c) 2014-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,9 +30,16 @@ #include "defs.h" +#include <stdint.h> +#include <linux/ioctl.h> +#include <linux/types.h> +#include <linux/videodev2.h> + #include DEF_MPERS_TYPE(struct_v4l2_buffer) #include DEF_MPERS_TYPE(struct_v4l2_clip) -#include DEF_MPERS_TYPE(struct_v4l2_create_buffers) +#ifdef VIDIOC_CREATE_BUFS +# include DEF_MPERS_TYPE(struct_v4l2_create_buffers) +#endif #include DEF_MPERS_TYPE(struct_v4l2_ext_control) #include DEF_MPERS_TYPE(struct_v4l2_ext_controls) #include DEF_MPERS_TYPE(struct_v4l2_format) @@ -40,14 +47,11 @@ #include DEF_MPERS_TYPE(struct_v4l2_input) #include DEF_MPERS_TYPE(struct_v4l2_standard) -#include <stdint.h> -#include <linux/ioctl.h> -#include <linux/types.h> -#include <linux/videodev2.h> - typedef struct v4l2_buffer struct_v4l2_buffer; typedef struct v4l2_clip struct_v4l2_clip; +#ifdef VIDIOC_CREATE_BUFS typedef struct v4l2_create_buffers struct_v4l2_create_buffers; +#endif typedef struct v4l2_ext_control struct_v4l2_ext_control; typedef struct v4l2_ext_controls struct_v4l2_ext_controls; typedef struct v4l2_format struct_v4l2_format; @@ -58,6 +62,7 @@ typedef struct v4l2_standard struct_v4l2_standard; #include MPERS_DEFS #include "print_fields.h" +#include "xstring.h" /* some historical constants */ #ifndef V4L2_CID_HCENTER @@ -975,7 +980,7 @@ print_v4l2_create_buffers(struct tcb *const tcp, const kernel_ulong_t arg) if (syserror(tcp) || umove(tcp, arg, &b)) return RVAL_IOCTL_DECODED; - sprintf(outstr, fmt, b.index, b.count); + xsprintf(outstr, fmt, b.index, b.count); tcp->auxstr = outstr; return RVAL_IOCTL_DECODED | RVAL_STR; @@ -7,7 +7,7 @@ * Copyright (c) 2004 Ulrich Drepper <drepper@redhat.com> * Copyright (c) 2009-2013 Denys Vlasenko <dvlasenk@redhat.com> * Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org> - * Copyright (c) 2014-2017 The strace developers. + * Copyright (c) 2014-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,6 +34,7 @@ */ #include "defs.h" +#include "ptrace.h" #include <sys/wait.h> @@ -58,7 +59,6 @@ # define W_CONTINUED 0xffff #endif -#include "ptrace.h" #include "xlat/ptrace_events.h" static int @@ -3,7 +3,7 @@ * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl> * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com> * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl> - * Copyright (c) 1999-2017 The strace developers. + * Copyright (c) 1999-2018 The strace developers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,6 +30,7 @@ */ #include "defs.h" +#include "xstring.h" #include <stdarg.h> const char * @@ -93,6 +94,20 @@ printxvals(const uint64_t val, const char *dflt, const struct xlat *xlat, ...) return 0; } +int +sprintxval(char *const buf, const size_t size, const struct xlat *const x, + const unsigned int val, const char *const dflt) +{ + const char *const str = xlookup(x, val); + + if (str) + return xsnprintf(buf, size, "%s", str); + if (dflt) + return xsnprintf(buf, size, "%#x /* %s */", val, dflt); + + return xsnprintf(buf, size, "%#x", val); +} + /** * Print entry in sorted struct xlat table, if it is there. * @@ -145,7 +160,8 @@ addflags(const struct xlat *xlat, uint64_t flags) /* * Interpret `xlat' as an array of flags. * Print to static string the entries whose bits are on in `flags' - * Return static string. + * Return static string. If 0 is provided as flags, and there is no flag that + * has the value of 0 (it should be the first in xlat table), return NULL. */ const char * sprintflags(const char *prefix, const struct xlat *xlat, uint64_t flags) @@ -172,10 +188,14 @@ sprintflags(const char *prefix, const struct xlat *xlat, uint64_t flags) break; } } + if (flags) { if (found) *outptr++ = '|'; - outptr += sprintf(outptr, "%#" PRIx64, flags); + outptr = xappendstr(outstr, outptr, "%#" PRIx64, flags); + } else { + if (!found) + return NULL; } return outstr; diff --git a/xlat/Makemodule.am b/xlat/Makemodule.am index cfcc5714..1a6fabe9 100644 --- a/xlat/Makemodule.am +++ b/xlat/Makemodule.am @@ -1,5 +1,5 @@ -XLAT_INPUT_FILES = xlat/access_flags.in xlat/addrfams.in xlat/adjtimex_modes.in xlat/adjtimex_state.in xlat/adjtimex_status.in xlat/advise.in xlat/af_packet_types.in xlat/archvals.in xlat/arp_hardware_types.in xlat/at_flags.in xlat/at_statx_sync_types.in xlat/atomic_ops.in xlat/audit_arch.in xlat/baud_options.in xlat/blkpg_ops.in xlat/bootflags1.in xlat/bootflags2.in xlat/bootflags3.in xlat/bpf_attach_flags.in xlat/bpf_attach_type.in xlat/bpf_class.in xlat/bpf_commands.in xlat/bpf_map_flags.in xlat/bpf_map_types.in xlat/bpf_map_update_elem_flags.in xlat/bpf_miscop.in xlat/bpf_mode.in xlat/bpf_op_alu.in xlat/bpf_op_jmp.in xlat/bpf_prog_flags.in xlat/bpf_prog_types.in xlat/bpf_rval.in xlat/bpf_size.in xlat/bpf_src.in xlat/bsg_flags.in xlat/bsg_protocol.in xlat/bsg_subprotocol.in xlat/bt_protocols.in xlat/btrfs_balance_args.in xlat/btrfs_balance_ctl_cmds.in xlat/btrfs_balance_flags.in xlat/btrfs_balance_state.in xlat/btrfs_compress_types.in xlat/btrfs_defrag_flags.in xlat/btrfs_dev_replace_cmds.in xlat/btrfs_dev_replace_results.in xlat/btrfs_dev_replace_state.in xlat/btrfs_dev_stats_flags.in xlat/btrfs_dev_stats_values.in xlat/btrfs_features_compat.in xlat/btrfs_features_compat_ro.in xlat/btrfs_features_incompat.in xlat/btrfs_key_types.in xlat/btrfs_qgroup_ctl_cmds.in xlat/btrfs_qgroup_inherit_flags.in xlat/btrfs_qgroup_limit_flags.in xlat/btrfs_qgroup_status_flags.in xlat/btrfs_scrub_flags.in xlat/btrfs_send_flags.in xlat/btrfs_snap_flags_v2.in xlat/btrfs_space_info_flags.in xlat/btrfs_tree_objectids.in xlat/cacheflush_scope.in xlat/cap.in xlat/cap_mask0.in xlat/cap_mask1.in xlat/cap_version.in xlat/clockflags.in xlat/clocknames.in xlat/clone_flags.in xlat/cpuclocknames.in xlat/crypto_nl_attrs.in xlat/dcb_commands.in xlat/delete_module_flags.in xlat/dirent_types.in xlat/dm_flags.in xlat/efd_flags.in xlat/epollctls.in xlat/epollevents.in xlat/epollflags.in xlat/ethernet_protocols.in xlat/evdev_abs.in xlat/evdev_autorepeat.in xlat/evdev_ev.in xlat/evdev_ff_status.in xlat/evdev_ff_types.in xlat/evdev_keycode.in xlat/evdev_leds.in xlat/evdev_misc.in xlat/evdev_mtslots.in xlat/evdev_prop.in xlat/evdev_relative_axes.in xlat/evdev_snd.in xlat/evdev_switch.in xlat/evdev_sync.in xlat/f_owner_types.in xlat/f_seals.in xlat/falloc_flags.in xlat/fan_classes.in xlat/fan_event_flags.in xlat/fan_init_flags.in xlat/fan_mark_flags.in xlat/fcntl64cmds.in xlat/fcntlcmds.in xlat/fdflags.in xlat/fib_rule_actions.in xlat/fib_rule_flags.in xlat/fiemap_extent_flags.in xlat/fiemap_flags.in xlat/flockcmds.in xlat/fsmagic.in xlat/futexops.in xlat/futexwakecmps.in xlat/futexwakeops.in xlat/getrandom_flags.in xlat/getsockipoptions.in xlat/getsockipv6options.in xlat/hci_channels.in xlat/hw_breakpoint_len.in xlat/hw_breakpoint_type.in xlat/icmpfilterflags.in xlat/if_dqblk_valid.in xlat/if_dqinfo_flags.in xlat/if_dqinfo_valid.in xlat/ifaddrflags.in xlat/iffflags.in xlat/inet_diag_attrs.in xlat/inet_diag_bytecodes.in xlat/inet_diag_extended_flags.in xlat/inet_diag_req_attrs.in xlat/inet_protocols.in xlat/inotify_flags.in xlat/inotify_init_flags.in xlat/ioctl_dirs.in xlat/ioprio_class.in xlat/ioprio_who.in xlat/ip_cmsg_types.in xlat/ip_type_of_services.in xlat/ipc_msg_flags.in xlat/ipccalls.in xlat/itimer_which.in xlat/kcmp_types.in xlat/kexec_arch_values.in xlat/kexec_file_load_flags.in xlat/kexec_load_flags.in xlat/key_perms.in xlat/key_reqkeys.in xlat/key_spec.in xlat/keyctl_commands.in xlat/lockfcmds.in xlat/loop_cmds.in xlat/loop_crypt_type_options.in xlat/loop_flags_options.in xlat/lwtunnel_encap_types.in xlat/madvise_cmds.in xlat/mbindflags.in xlat/mctl_sync.in xlat/mdb_flags.in xlat/mdb_states.in xlat/membarrier_cmds.in xlat/memfd_create_flags.in xlat/mempolicyflags.in xlat/mlock_flags.in xlat/mlockall_flags.in xlat/mmap_flags.in xlat/mmap_prot.in xlat/modem_flags.in xlat/modetypes.in xlat/module_init_flags.in xlat/mount_flags.in xlat/move_pages_flags.in xlat/mq_attr_flags.in xlat/mremap_flags.in xlat/msg_flags.in xlat/msgctl_flags.in xlat/mtd_file_mode_options.in xlat/mtd_flags_options.in xlat/mtd_mode_options.in xlat/mtd_nandecc_options.in xlat/mtd_otp_options.in xlat/mtd_type_options.in xlat/multicast_router_types.in xlat/name_to_handle_at_flags.in xlat/neighbor_cache_entry_flags.in xlat/neighbor_cache_entry_states.in xlat/netlink_ack_flags.in xlat/netlink_delete_flags.in xlat/netlink_diag_attrs.in xlat/netlink_diag_show.in xlat/netlink_flags.in xlat/netlink_get_flags.in xlat/netlink_new_flags.in xlat/netlink_protocols.in xlat/netlink_socket_flags.in xlat/netlink_states.in xlat/netlink_types.in xlat/nf_acct_msg_types.in xlat/nf_cthelper_msg_types.in xlat/nf_ctnetlink_exp_msg_types.in xlat/nf_ctnetlink_msg_types.in xlat/nf_cttimeout_msg_types.in xlat/nf_ipset_msg_types.in xlat/nf_nft_compat_msg_types.in xlat/nf_nftables_msg_types.in xlat/nf_osf_msg_types.in xlat/nf_queue_msg_types.in xlat/nf_ulog_msg_types.in xlat/nl_audit_types.in xlat/nl_crypto_types.in xlat/nl_netfilter_msg_types.in xlat/nl_netfilter_subsys_ids.in xlat/nl_route_types.in xlat/nl_selinux_types.in xlat/nl_sock_diag_types.in xlat/nl_xfrm_types.in xlat/nlmsgerr_attrs.in xlat/notifyflags.in xlat/nt_descriptor_types.in xlat/open_access_modes.in xlat/open_mode_flags.in xlat/packet_diag_attrs.in xlat/packet_diag_info_flags.in xlat/packet_diag_show.in xlat/packet_mreq_type.in xlat/perf_attr_size.in xlat/perf_branch_sample_type.in xlat/perf_event_open_flags.in xlat/perf_event_read_format.in xlat/perf_event_sample_format.in xlat/perf_hw_cache_id.in xlat/perf_hw_cache_op_id.in xlat/perf_hw_cache_op_result_id.in xlat/perf_hw_id.in xlat/perf_sw_ids.in xlat/perf_type_id.in xlat/personality_flags.in xlat/personality_types.in xlat/pkey_access.in xlat/policies.in xlat/pollflags.in xlat/pr_cap_ambient.in xlat/pr_dumpable.in xlat/pr_fp_mode.in xlat/pr_mce_kill.in xlat/pr_mce_kill_policy.in xlat/pr_set_mm.in xlat/pr_tsc.in xlat/pr_unalign_flags.in xlat/prctl_options.in xlat/priorities.in xlat/ptp_flags_options.in xlat/ptrace_cmds.in xlat/ptrace_events.in xlat/ptrace_peeksiginfo_flags.in xlat/ptrace_setoptions_flags.in xlat/quota_formats.in xlat/quotacmds.in xlat/quotatypes.in xlat/rename_flags.in xlat/resource_flags.in xlat/resources.in xlat/route_nexthop_flags.in xlat/routing_flags.in xlat/routing_protocols.in xlat/routing_scopes.in xlat/routing_table_ids.in xlat/routing_types.in xlat/rtnl_addr_attrs.in xlat/rtnl_addrlabel_attrs.in xlat/rtnl_dcb_attrs.in xlat/rtnl_ifla_brport_attrs.in xlat/rtnl_ifla_info_attrs.in xlat/rtnl_ifla_port_attrs.in xlat/rtnl_ifla_vf_port_attrs.in xlat/rtnl_ifla_xdp_attrs.in xlat/rtnl_link_attrs.in xlat/rtnl_mdb_attrs.in xlat/rtnl_mdba_mdb_attrs.in xlat/rtnl_mdba_mdb_eattr_attrs.in xlat/rtnl_mdba_mdb_entry_attrs.in xlat/rtnl_mdba_router_attrs.in xlat/rtnl_mdba_router_pattr_attrs.in xlat/rtnl_neigh_attrs.in xlat/rtnl_neightbl_attrs.in xlat/rtnl_neightbl_parms_attrs.in xlat/rtnl_netconf_attrs.in xlat/rtnl_nsid_attrs.in xlat/rtnl_route_attrs.in xlat/rtnl_rta_metrics_attrs.in xlat/rtnl_rule_attrs.in xlat/rtnl_tc_action_attrs.in xlat/rtnl_tc_attrs.in xlat/rtnl_tca_stab_attrs.in xlat/rtnl_tca_stats_attrs.in xlat/rwf_flags.in xlat/sa_handler_values.in xlat/sched_flags.in xlat/schedulers.in xlat/scmvals.in xlat/scsi_sg_commands.in xlat/secbits.in xlat/seccomp_filter_flags.in xlat/seccomp_mode.in xlat/seccomp_ops.in xlat/seccomp_ret_action.in xlat/semctl_flags.in xlat/semop_flags.in xlat/setns_types.in xlat/setsockipoptions.in xlat/setsockipv6options.in xlat/sfd_flags.in xlat/sg_io_dxfer_direction.in xlat/sg_io_flags.in xlat/sg_io_info.in xlat/sg_scsi_reset.in xlat/shm_flags.in xlat/shm_resource_flags.in xlat/shmctl_flags.in xlat/shutdown_modes.in xlat/sigact_flags.in xlat/sigaltstack_flags.in xlat/sigbus_codes.in xlat/sigchld_codes.in xlat/sigemt_codes.in xlat/sigev_value.in xlat/sigfpe_codes.in xlat/sigill_codes.in xlat/siginfo_codes.in xlat/sigpoll_codes.in xlat/sigprocmaskcmds.in xlat/sigprof_codes.in xlat/sigsegv_codes.in xlat/sigsys_codes.in xlat/sigtrap_codes.in xlat/skf_ad.in xlat/smc_diag_attrs.in xlat/smc_diag_extended_flags.in xlat/smc_link_group_roles.in xlat/smc_states.in xlat/sock_type_flags.in xlat/socketcalls.in xlat/socketlayers.in xlat/sockipoptions.in xlat/sockipv6options.in xlat/sockipxoptions.in xlat/sockoptions.in xlat/sockpacketoptions.in xlat/sockrawoptions.in xlat/socksctpoptions.in xlat/socktcpoptions.in xlat/socktypes.in xlat/splice_flags.in xlat/sram_alloc_flags.in xlat/statfs_flags.in xlat/statx_attrs.in xlat/statx_masks.in xlat/swap_flags.in xlat/sync_file_range_flags.in xlat/sysctl_kern.in xlat/sysctl_net.in xlat/sysctl_net_core.in xlat/sysctl_net_ipv4.in xlat/sysctl_net_ipv4_conf.in xlat/sysctl_net_ipv4_route.in xlat/sysctl_net_ipv6.in xlat/sysctl_net_ipv6_route.in xlat/sysctl_net_unix.in xlat/sysctl_root.in xlat/sysctl_vm.in xlat/syslog_action_type.in xlat/sysmips_operations.in xlat/tcflsh_options.in xlat/tcp_state_flags.in xlat/tcp_states.in xlat/tcxonc_options.in xlat/timerfdflags.in xlat/ubi_volume_props.in xlat/ubi_volume_types.in xlat/uffd_api_features.in xlat/uffd_api_flags.in xlat/uffd_copy_flags.in xlat/uffd_flags.in xlat/uffd_register_ioctl_flags.in xlat/uffd_register_mode_flags.in xlat/uffd_zeropage_flags.in xlat/umount_flags.in xlat/unix_diag_attrs.in xlat/unix_diag_show.in xlat/unshare_flags.in xlat/usagewho.in xlat/v4l2_buf_flags.in xlat/v4l2_buf_types.in xlat/v4l2_capture_modes.in xlat/v4l2_colorspaces.in xlat/v4l2_control_classes.in xlat/v4l2_control_flags.in xlat/v4l2_control_ids.in xlat/v4l2_control_types.in xlat/v4l2_device_capabilities_flags.in xlat/v4l2_fields.in xlat/v4l2_format_description_flags.in xlat/v4l2_frameinterval_types.in xlat/v4l2_framesize_types.in xlat/v4l2_input_types.in xlat/v4l2_memories.in xlat/v4l2_sliced_flags.in xlat/v4l2_streaming_capabilities.in xlat/v4l2_tuner_audmodes.in xlat/v4l2_tuner_capabilities.in xlat/v4l2_tuner_rxsubchanses.in xlat/v4l2_tuner_types.in xlat/v4l2_vbi_flags.in xlat/wait4_options.in xlat/waitid_types.in xlat/whence_codes.in xlat/xattrflags.in xlat/xdp_flags.in xlat/xfs_dqblk_flags.in xlat/xfs_quota_flags.in -XLAT_HEADER_FILES = xlat/access_flags.h xlat/addrfams.h xlat/adjtimex_modes.h xlat/adjtimex_state.h xlat/adjtimex_status.h xlat/advise.h xlat/af_packet_types.h xlat/archvals.h xlat/arp_hardware_types.h xlat/at_flags.h xlat/at_statx_sync_types.h xlat/atomic_ops.h xlat/audit_arch.h xlat/baud_options.h xlat/blkpg_ops.h xlat/bootflags1.h xlat/bootflags2.h xlat/bootflags3.h xlat/bpf_attach_flags.h xlat/bpf_attach_type.h xlat/bpf_class.h xlat/bpf_commands.h xlat/bpf_map_flags.h xlat/bpf_map_types.h xlat/bpf_map_update_elem_flags.h xlat/bpf_miscop.h xlat/bpf_mode.h xlat/bpf_op_alu.h xlat/bpf_op_jmp.h xlat/bpf_prog_flags.h xlat/bpf_prog_types.h xlat/bpf_rval.h xlat/bpf_size.h xlat/bpf_src.h xlat/bsg_flags.h xlat/bsg_protocol.h xlat/bsg_subprotocol.h xlat/bt_protocols.h xlat/btrfs_balance_args.h xlat/btrfs_balance_ctl_cmds.h xlat/btrfs_balance_flags.h xlat/btrfs_balance_state.h xlat/btrfs_compress_types.h xlat/btrfs_defrag_flags.h xlat/btrfs_dev_replace_cmds.h xlat/btrfs_dev_replace_results.h xlat/btrfs_dev_replace_state.h xlat/btrfs_dev_stats_flags.h xlat/btrfs_dev_stats_values.h xlat/btrfs_features_compat.h xlat/btrfs_features_compat_ro.h xlat/btrfs_features_incompat.h xlat/btrfs_key_types.h xlat/btrfs_qgroup_ctl_cmds.h xlat/btrfs_qgroup_inherit_flags.h xlat/btrfs_qgroup_limit_flags.h xlat/btrfs_qgroup_status_flags.h xlat/btrfs_scrub_flags.h xlat/btrfs_send_flags.h xlat/btrfs_snap_flags_v2.h xlat/btrfs_space_info_flags.h xlat/btrfs_tree_objectids.h xlat/cacheflush_scope.h xlat/cap.h xlat/cap_mask0.h xlat/cap_mask1.h xlat/cap_version.h xlat/clockflags.h xlat/clocknames.h xlat/clone_flags.h xlat/cpuclocknames.h xlat/crypto_nl_attrs.h xlat/dcb_commands.h xlat/delete_module_flags.h xlat/dirent_types.h xlat/dm_flags.h xlat/efd_flags.h xlat/epollctls.h xlat/epollevents.h xlat/epollflags.h xlat/ethernet_protocols.h xlat/evdev_abs.h xlat/evdev_autorepeat.h xlat/evdev_ev.h xlat/evdev_ff_status.h xlat/evdev_ff_types.h xlat/evdev_keycode.h xlat/evdev_leds.h xlat/evdev_misc.h xlat/evdev_mtslots.h xlat/evdev_prop.h xlat/evdev_relative_axes.h xlat/evdev_snd.h xlat/evdev_switch.h xlat/evdev_sync.h xlat/f_owner_types.h xlat/f_seals.h xlat/falloc_flags.h xlat/fan_classes.h xlat/fan_event_flags.h xlat/fan_init_flags.h xlat/fan_mark_flags.h xlat/fcntl64cmds.h xlat/fcntlcmds.h xlat/fdflags.h xlat/fib_rule_actions.h xlat/fib_rule_flags.h xlat/fiemap_extent_flags.h xlat/fiemap_flags.h xlat/flockcmds.h xlat/fsmagic.h xlat/futexops.h xlat/futexwakecmps.h xlat/futexwakeops.h xlat/getrandom_flags.h xlat/getsockipoptions.h xlat/getsockipv6options.h xlat/hci_channels.h xlat/hw_breakpoint_len.h xlat/hw_breakpoint_type.h xlat/icmpfilterflags.h xlat/if_dqblk_valid.h xlat/if_dqinfo_flags.h xlat/if_dqinfo_valid.h xlat/ifaddrflags.h xlat/iffflags.h xlat/inet_diag_attrs.h xlat/inet_diag_bytecodes.h xlat/inet_diag_extended_flags.h xlat/inet_diag_req_attrs.h xlat/inet_protocols.h xlat/inotify_flags.h xlat/inotify_init_flags.h xlat/ioctl_dirs.h xlat/ioprio_class.h xlat/ioprio_who.h xlat/ip_cmsg_types.h xlat/ip_type_of_services.h xlat/ipc_msg_flags.h xlat/ipccalls.h xlat/itimer_which.h xlat/kcmp_types.h xlat/kexec_arch_values.h xlat/kexec_file_load_flags.h xlat/kexec_load_flags.h xlat/key_perms.h xlat/key_reqkeys.h xlat/key_spec.h xlat/keyctl_commands.h xlat/lockfcmds.h xlat/loop_cmds.h xlat/loop_crypt_type_options.h xlat/loop_flags_options.h xlat/lwtunnel_encap_types.h xlat/madvise_cmds.h xlat/mbindflags.h xlat/mctl_sync.h xlat/mdb_flags.h xlat/mdb_states.h xlat/membarrier_cmds.h xlat/memfd_create_flags.h xlat/mempolicyflags.h xlat/mlock_flags.h xlat/mlockall_flags.h xlat/mmap_flags.h xlat/mmap_prot.h xlat/modem_flags.h xlat/modetypes.h xlat/module_init_flags.h xlat/mount_flags.h xlat/move_pages_flags.h xlat/mq_attr_flags.h xlat/mremap_flags.h xlat/msg_flags.h xlat/msgctl_flags.h xlat/mtd_file_mode_options.h xlat/mtd_flags_options.h xlat/mtd_mode_options.h xlat/mtd_nandecc_options.h xlat/mtd_otp_options.h xlat/mtd_type_options.h xlat/multicast_router_types.h xlat/name_to_handle_at_flags.h xlat/neighbor_cache_entry_flags.h xlat/neighbor_cache_entry_states.h xlat/netlink_ack_flags.h xlat/netlink_delete_flags.h xlat/netlink_diag_attrs.h xlat/netlink_diag_show.h xlat/netlink_flags.h xlat/netlink_get_flags.h xlat/netlink_new_flags.h xlat/netlink_protocols.h xlat/netlink_socket_flags.h xlat/netlink_states.h xlat/netlink_types.h xlat/nf_acct_msg_types.h xlat/nf_cthelper_msg_types.h xlat/nf_ctnetlink_exp_msg_types.h xlat/nf_ctnetlink_msg_types.h xlat/nf_cttimeout_msg_types.h xlat/nf_ipset_msg_types.h xlat/nf_nft_compat_msg_types.h xlat/nf_nftables_msg_types.h xlat/nf_osf_msg_types.h xlat/nf_queue_msg_types.h xlat/nf_ulog_msg_types.h xlat/nl_audit_types.h xlat/nl_crypto_types.h xlat/nl_netfilter_msg_types.h xlat/nl_netfilter_subsys_ids.h xlat/nl_route_types.h xlat/nl_selinux_types.h xlat/nl_sock_diag_types.h xlat/nl_xfrm_types.h xlat/nlmsgerr_attrs.h xlat/notifyflags.h xlat/nt_descriptor_types.h xlat/open_access_modes.h xlat/open_mode_flags.h xlat/packet_diag_attrs.h xlat/packet_diag_info_flags.h xlat/packet_diag_show.h xlat/packet_mreq_type.h xlat/perf_attr_size.h xlat/perf_branch_sample_type.h xlat/perf_event_open_flags.h xlat/perf_event_read_format.h xlat/perf_event_sample_format.h xlat/perf_hw_cache_id.h xlat/perf_hw_cache_op_id.h xlat/perf_hw_cache_op_result_id.h xlat/perf_hw_id.h xlat/perf_sw_ids.h xlat/perf_type_id.h xlat/personality_flags.h xlat/personality_types.h xlat/pkey_access.h xlat/policies.h xlat/pollflags.h xlat/pr_cap_ambient.h xlat/pr_dumpable.h xlat/pr_fp_mode.h xlat/pr_mce_kill.h xlat/pr_mce_kill_policy.h xlat/pr_set_mm.h xlat/pr_tsc.h xlat/pr_unalign_flags.h xlat/prctl_options.h xlat/priorities.h xlat/ptp_flags_options.h xlat/ptrace_cmds.h xlat/ptrace_events.h xlat/ptrace_peeksiginfo_flags.h xlat/ptrace_setoptions_flags.h xlat/quota_formats.h xlat/quotacmds.h xlat/quotatypes.h xlat/rename_flags.h xlat/resource_flags.h xlat/resources.h xlat/route_nexthop_flags.h xlat/routing_flags.h xlat/routing_protocols.h xlat/routing_scopes.h xlat/routing_table_ids.h xlat/routing_types.h xlat/rtnl_addr_attrs.h xlat/rtnl_addrlabel_attrs.h xlat/rtnl_dcb_attrs.h xlat/rtnl_ifla_brport_attrs.h xlat/rtnl_ifla_info_attrs.h xlat/rtnl_ifla_port_attrs.h xlat/rtnl_ifla_vf_port_attrs.h xlat/rtnl_ifla_xdp_attrs.h xlat/rtnl_link_attrs.h xlat/rtnl_mdb_attrs.h xlat/rtnl_mdba_mdb_attrs.h xlat/rtnl_mdba_mdb_eattr_attrs.h xlat/rtnl_mdba_mdb_entry_attrs.h xlat/rtnl_mdba_router_attrs.h xlat/rtnl_mdba_router_pattr_attrs.h xlat/rtnl_neigh_attrs.h xlat/rtnl_neightbl_attrs.h xlat/rtnl_neightbl_parms_attrs.h xlat/rtnl_netconf_attrs.h xlat/rtnl_nsid_attrs.h xlat/rtnl_route_attrs.h xlat/rtnl_rta_metrics_attrs.h xlat/rtnl_rule_attrs.h xlat/rtnl_tc_action_attrs.h xlat/rtnl_tc_attrs.h xlat/rtnl_tca_stab_attrs.h xlat/rtnl_tca_stats_attrs.h xlat/rwf_flags.h xlat/sa_handler_values.h xlat/sched_flags.h xlat/schedulers.h xlat/scmvals.h xlat/scsi_sg_commands.h xlat/secbits.h xlat/seccomp_filter_flags.h xlat/seccomp_mode.h xlat/seccomp_ops.h xlat/seccomp_ret_action.h xlat/semctl_flags.h xlat/semop_flags.h xlat/setns_types.h xlat/setsockipoptions.h xlat/setsockipv6options.h xlat/sfd_flags.h xlat/sg_io_dxfer_direction.h xlat/sg_io_flags.h xlat/sg_io_info.h xlat/sg_scsi_reset.h xlat/shm_flags.h xlat/shm_resource_flags.h xlat/shmctl_flags.h xlat/shutdown_modes.h xlat/sigact_flags.h xlat/sigaltstack_flags.h xlat/sigbus_codes.h xlat/sigchld_codes.h xlat/sigemt_codes.h xlat/sigev_value.h xlat/sigfpe_codes.h xlat/sigill_codes.h xlat/siginfo_codes.h xlat/sigpoll_codes.h xlat/sigprocmaskcmds.h xlat/sigprof_codes.h xlat/sigsegv_codes.h xlat/sigsys_codes.h xlat/sigtrap_codes.h xlat/skf_ad.h xlat/smc_diag_attrs.h xlat/smc_diag_extended_flags.h xlat/smc_link_group_roles.h xlat/smc_states.h xlat/sock_type_flags.h xlat/socketcalls.h xlat/socketlayers.h xlat/sockipoptions.h xlat/sockipv6options.h xlat/sockipxoptions.h xlat/sockoptions.h xlat/sockpacketoptions.h xlat/sockrawoptions.h xlat/socksctpoptions.h xlat/socktcpoptions.h xlat/socktypes.h xlat/splice_flags.h xlat/sram_alloc_flags.h xlat/statfs_flags.h xlat/statx_attrs.h xlat/statx_masks.h xlat/swap_flags.h xlat/sync_file_range_flags.h xlat/sysctl_kern.h xlat/sysctl_net.h xlat/sysctl_net_core.h xlat/sysctl_net_ipv4.h xlat/sysctl_net_ipv4_conf.h xlat/sysctl_net_ipv4_route.h xlat/sysctl_net_ipv6.h xlat/sysctl_net_ipv6_route.h xlat/sysctl_net_unix.h xlat/sysctl_root.h xlat/sysctl_vm.h xlat/syslog_action_type.h xlat/sysmips_operations.h xlat/tcflsh_options.h xlat/tcp_state_flags.h xlat/tcp_states.h xlat/tcxonc_options.h xlat/timerfdflags.h xlat/ubi_volume_props.h xlat/ubi_volume_types.h xlat/uffd_api_features.h xlat/uffd_api_flags.h xlat/uffd_copy_flags.h xlat/uffd_flags.h xlat/uffd_register_ioctl_flags.h xlat/uffd_register_mode_flags.h xlat/uffd_zeropage_flags.h xlat/umount_flags.h xlat/unix_diag_attrs.h xlat/unix_diag_show.h xlat/unshare_flags.h xlat/usagewho.h xlat/v4l2_buf_flags.h xlat/v4l2_buf_types.h xlat/v4l2_capture_modes.h xlat/v4l2_colorspaces.h xlat/v4l2_control_classes.h xlat/v4l2_control_flags.h xlat/v4l2_control_ids.h xlat/v4l2_control_types.h xlat/v4l2_device_capabilities_flags.h xlat/v4l2_fields.h xlat/v4l2_format_description_flags.h xlat/v4l2_frameinterval_types.h xlat/v4l2_framesize_types.h xlat/v4l2_input_types.h xlat/v4l2_memories.h xlat/v4l2_sliced_flags.h xlat/v4l2_streaming_capabilities.h xlat/v4l2_tuner_audmodes.h xlat/v4l2_tuner_capabilities.h xlat/v4l2_tuner_rxsubchanses.h xlat/v4l2_tuner_types.h xlat/v4l2_vbi_flags.h xlat/wait4_options.h xlat/waitid_types.h xlat/whence_codes.h xlat/xattrflags.h xlat/xdp_flags.h xlat/xfs_dqblk_flags.h xlat/xfs_quota_flags.h +XLAT_INPUT_FILES = xlat/access_flags.in xlat/addrfams.in xlat/adjtimex_modes.in xlat/adjtimex_state.in xlat/adjtimex_status.in xlat/advise.in xlat/af_packet_types.in xlat/archvals.in xlat/arp_hardware_types.in xlat/at_flags.in xlat/at_statx_sync_types.in xlat/atomic_ops.in xlat/audit_arch.in xlat/baud_options.in xlat/blkpg_ops.in xlat/bootflags1.in xlat/bootflags2.in xlat/bootflags3.in xlat/bpf_attach_flags.in xlat/bpf_attach_type.in xlat/bpf_class.in xlat/bpf_commands.in xlat/bpf_map_flags.in xlat/bpf_map_types.in xlat/bpf_map_update_elem_flags.in xlat/bpf_miscop.in xlat/bpf_mode.in xlat/bpf_op_alu.in xlat/bpf_op_jmp.in xlat/bpf_prog_flags.in xlat/bpf_prog_types.in xlat/bpf_rval.in xlat/bpf_size.in xlat/bpf_src.in xlat/bsg_flags.in xlat/bsg_protocol.in xlat/bsg_subprotocol.in xlat/bt_protocols.in xlat/btrfs_balance_args.in xlat/btrfs_balance_ctl_cmds.in xlat/btrfs_balance_flags.in xlat/btrfs_balance_state.in xlat/btrfs_compress_types.in xlat/btrfs_defrag_flags.in xlat/btrfs_dev_replace_cmds.in xlat/btrfs_dev_replace_results.in xlat/btrfs_dev_replace_state.in xlat/btrfs_dev_stats_flags.in xlat/btrfs_dev_stats_values.in xlat/btrfs_features_compat.in xlat/btrfs_features_compat_ro.in xlat/btrfs_features_incompat.in xlat/btrfs_key_types.in xlat/btrfs_qgroup_ctl_cmds.in xlat/btrfs_qgroup_inherit_flags.in xlat/btrfs_qgroup_limit_flags.in xlat/btrfs_qgroup_status_flags.in xlat/btrfs_scrub_flags.in xlat/btrfs_send_flags.in xlat/btrfs_snap_flags_v2.in xlat/btrfs_space_info_flags.in xlat/btrfs_tree_objectids.in xlat/cacheflush_scope.in xlat/cap.in xlat/cap_mask0.in xlat/cap_mask1.in xlat/cap_version.in xlat/clockflags.in xlat/clocknames.in xlat/clone_flags.in xlat/cpuclocknames.in xlat/crypto_nl_attrs.in xlat/dcb_commands.in xlat/delete_module_flags.in xlat/dirent_types.in xlat/dm_flags.in xlat/efd_flags.in xlat/epollctls.in xlat/epollevents.in xlat/epollflags.in xlat/ethernet_protocols.in xlat/evdev_abs.in xlat/evdev_autorepeat.in xlat/evdev_ev.in xlat/evdev_ff_status.in xlat/evdev_ff_types.in xlat/evdev_keycode.in xlat/evdev_leds.in xlat/evdev_misc.in xlat/evdev_mtslots.in xlat/evdev_prop.in xlat/evdev_relative_axes.in xlat/evdev_snd.in xlat/evdev_switch.in xlat/evdev_sync.in xlat/f_owner_types.in xlat/f_seals.in xlat/falloc_flags.in xlat/fan_classes.in xlat/fan_event_flags.in xlat/fan_init_flags.in xlat/fan_mark_flags.in xlat/fcntl64cmds.in xlat/fcntlcmds.in xlat/fdflags.in xlat/fib_rule_actions.in xlat/fib_rule_flags.in xlat/fiemap_extent_flags.in xlat/fiemap_flags.in xlat/flockcmds.in xlat/fsmagic.in xlat/futexops.in xlat/futexwakecmps.in xlat/futexwakeops.in xlat/getrandom_flags.in xlat/getsockipoptions.in xlat/getsockipv6options.in xlat/hci_channels.in xlat/hw_breakpoint_len.in xlat/hw_breakpoint_type.in xlat/icmpfilterflags.in xlat/if_dqblk_valid.in xlat/if_dqinfo_flags.in xlat/if_dqinfo_valid.in xlat/ifaddrflags.in xlat/iffflags.in xlat/inet_diag_attrs.in xlat/inet_diag_bytecodes.in xlat/inet_diag_extended_flags.in xlat/inet_diag_req_attrs.in xlat/inet_protocols.in xlat/inotify_flags.in xlat/inotify_init_flags.in xlat/ioctl_dirs.in xlat/ioprio_class.in xlat/ioprio_who.in xlat/ip_cmsg_types.in xlat/ip_type_of_services.in xlat/ipc_msg_flags.in xlat/ipccalls.in xlat/itimer_which.in xlat/kcmp_types.in xlat/kexec_arch_values.in xlat/kexec_file_load_flags.in xlat/kexec_load_flags.in xlat/key_perms.in xlat/key_reqkeys.in xlat/key_spec.in xlat/keyctl_commands.in xlat/kvm_mem_flags.in xlat/lockfcmds.in xlat/loop_cmds.in xlat/loop_crypt_type_options.in xlat/loop_flags_options.in xlat/lwtunnel_encap_types.in xlat/madvise_cmds.in xlat/mbindflags.in xlat/mctl_sync.in xlat/mdb_flags.in xlat/mdb_states.in xlat/membarrier_cmds.in xlat/memfd_create_flags.in xlat/mempolicyflags.in xlat/mlock_flags.in xlat/mlockall_flags.in xlat/mmap_flags.in xlat/mmap_prot.in xlat/modem_flags.in xlat/modetypes.in xlat/module_init_flags.in xlat/mount_flags.in xlat/move_pages_flags.in xlat/mq_attr_flags.in xlat/mremap_flags.in xlat/msg_flags.in xlat/msgctl_flags.in xlat/mtd_file_mode_options.in xlat/mtd_flags_options.in xlat/mtd_mode_options.in xlat/mtd_nandecc_options.in xlat/mtd_otp_options.in xlat/mtd_type_options.in xlat/multicast_router_types.in xlat/name_to_handle_at_flags.in xlat/neighbor_cache_entry_flags.in xlat/neighbor_cache_entry_states.in xlat/netlink_ack_flags.in xlat/netlink_delete_flags.in xlat/netlink_diag_attrs.in xlat/netlink_diag_show.in xlat/netlink_flags.in xlat/netlink_get_flags.in xlat/netlink_new_flags.in xlat/netlink_protocols.in xlat/netlink_socket_flags.in xlat/netlink_states.in xlat/netlink_types.in xlat/nf_acct_msg_types.in xlat/nf_cthelper_msg_types.in xlat/nf_ctnetlink_exp_msg_types.in xlat/nf_ctnetlink_msg_types.in xlat/nf_cttimeout_msg_types.in xlat/nf_ipset_msg_types.in xlat/nf_nft_compat_msg_types.in xlat/nf_nftables_msg_types.in xlat/nf_osf_msg_types.in xlat/nf_queue_msg_types.in xlat/nf_ulog_msg_types.in xlat/nl_audit_types.in xlat/nl_crypto_types.in xlat/nl_netfilter_msg_types.in xlat/nl_netfilter_subsys_ids.in xlat/nl_route_types.in xlat/nl_selinux_types.in xlat/nl_sock_diag_types.in xlat/nl_xfrm_types.in xlat/nlmsgerr_attrs.in xlat/notifyflags.in xlat/nt_descriptor_types.in xlat/open_access_modes.in xlat/open_mode_flags.in xlat/packet_diag_attrs.in xlat/packet_diag_info_flags.in xlat/packet_diag_show.in xlat/packet_mreq_type.in xlat/perf_attr_size.in xlat/perf_branch_sample_type.in xlat/perf_event_open_flags.in xlat/perf_event_read_format.in xlat/perf_event_sample_format.in xlat/perf_hw_cache_id.in xlat/perf_hw_cache_op_id.in xlat/perf_hw_cache_op_result_id.in xlat/perf_hw_id.in xlat/perf_sw_ids.in xlat/perf_type_id.in xlat/personality_flags.in xlat/personality_types.in xlat/pkey_access.in xlat/policies.in xlat/pollflags.in xlat/pr_cap_ambient.in xlat/pr_dumpable.in xlat/pr_fp_mode.in xlat/pr_mce_kill.in xlat/pr_mce_kill_policy.in xlat/pr_set_mm.in xlat/pr_tsc.in xlat/pr_unalign_flags.in xlat/prctl_options.in xlat/priorities.in xlat/ptp_flags_options.in xlat/ptrace_cmds.in xlat/ptrace_events.in xlat/ptrace_peeksiginfo_flags.in xlat/ptrace_setoptions_flags.in xlat/quota_formats.in xlat/quotacmds.in xlat/quotatypes.in xlat/rename_flags.in xlat/resource_flags.in xlat/resources.in xlat/riscv_flush_icache_flags.in xlat/route_nexthop_flags.in xlat/routing_flags.in xlat/routing_protocols.in xlat/routing_scopes.in xlat/routing_table_ids.in xlat/routing_types.in xlat/rtnl_addr_attrs.in xlat/rtnl_addrlabel_attrs.in xlat/rtnl_dcb_attrs.in xlat/rtnl_ifla_brport_attrs.in xlat/rtnl_ifla_info_attrs.in xlat/rtnl_ifla_port_attrs.in xlat/rtnl_ifla_vf_port_attrs.in xlat/rtnl_ifla_xdp_attrs.in xlat/rtnl_link_attrs.in xlat/rtnl_mdb_attrs.in xlat/rtnl_mdba_mdb_attrs.in xlat/rtnl_mdba_mdb_eattr_attrs.in xlat/rtnl_mdba_mdb_entry_attrs.in xlat/rtnl_mdba_router_attrs.in xlat/rtnl_mdba_router_pattr_attrs.in xlat/rtnl_neigh_attrs.in xlat/rtnl_neightbl_attrs.in xlat/rtnl_neightbl_parms_attrs.in xlat/rtnl_netconf_attrs.in xlat/rtnl_nsid_attrs.in xlat/rtnl_route_attrs.in xlat/rtnl_rta_metrics_attrs.in xlat/rtnl_rule_attrs.in xlat/rtnl_tc_action_attrs.in xlat/rtnl_tc_attrs.in xlat/rtnl_tca_stab_attrs.in xlat/rtnl_tca_stats_attrs.in xlat/rwf_flags.in xlat/s390_guarded_storage_commands.in xlat/s390_runtime_instr_commands.in xlat/s390_sthyi_function_codes.in xlat/sa_handler_values.in xlat/sched_flags.in xlat/schedulers.in xlat/scmvals.in xlat/scsi_sg_commands.in xlat/secbits.in xlat/seccomp_filter_flags.in xlat/seccomp_mode.in xlat/seccomp_ops.in xlat/seccomp_ret_action.in xlat/semctl_flags.in xlat/semop_flags.in xlat/setns_types.in xlat/setsockipoptions.in xlat/setsockipv6options.in xlat/sfd_flags.in xlat/sg_io_dxfer_direction.in xlat/sg_io_flags.in xlat/sg_io_info.in xlat/sg_scsi_reset.in xlat/shm_flags.in xlat/shm_resource_flags.in xlat/shmctl_flags.in xlat/shutdown_modes.in xlat/sigact_flags.in xlat/sigaltstack_flags.in xlat/sigbus_codes.in xlat/sigchld_codes.in xlat/sigemt_codes.in xlat/sigev_value.in xlat/sigfpe_codes.in xlat/sigill_codes.in xlat/siginfo_codes.in xlat/sigpoll_codes.in xlat/sigprocmaskcmds.in xlat/sigprof_codes.in xlat/sigsegv_codes.in xlat/sigsys_codes.in xlat/sigtrap_codes.in xlat/skf_ad.in xlat/smc_diag_attrs.in xlat/smc_diag_extended_flags.in xlat/smc_link_group_roles.in xlat/smc_states.in xlat/sock_type_flags.in xlat/socketcalls.in xlat/socketlayers.in xlat/sockipoptions.in xlat/sockipv6options.in xlat/sockipxoptions.in xlat/socknetlinkoptions.in xlat/sockoptions.in xlat/sockpacketoptions.in xlat/sockrawoptions.in xlat/socksctpoptions.in xlat/socktcpoptions.in xlat/socktypes.in xlat/splice_flags.in xlat/sram_alloc_flags.in xlat/statfs_flags.in xlat/statx_attrs.in xlat/statx_masks.in xlat/swap_flags.in xlat/sync_file_range_flags.in xlat/sysctl_kern.in xlat/sysctl_net.in xlat/sysctl_net_core.in xlat/sysctl_net_ipv4.in xlat/sysctl_net_ipv4_conf.in xlat/sysctl_net_ipv4_route.in xlat/sysctl_net_ipv6.in xlat/sysctl_net_ipv6_route.in xlat/sysctl_net_unix.in xlat/sysctl_root.in xlat/sysctl_vm.in xlat/syslog_action_type.in xlat/sysmips_operations.in xlat/tcflsh_options.in xlat/tcp_state_flags.in xlat/tcp_states.in xlat/tcxonc_options.in xlat/timerfdflags.in xlat/ubi_volume_props.in xlat/ubi_volume_types.in xlat/uffd_api_features.in xlat/uffd_api_flags.in xlat/uffd_copy_flags.in xlat/uffd_flags.in xlat/uffd_register_ioctl_flags.in xlat/uffd_register_mode_flags.in xlat/uffd_zeropage_flags.in xlat/umount_flags.in xlat/unix_diag_attrs.in xlat/unix_diag_show.in xlat/unshare_flags.in xlat/usagewho.in xlat/v4l2_buf_flags.in xlat/v4l2_buf_types.in xlat/v4l2_capture_modes.in xlat/v4l2_colorspaces.in xlat/v4l2_control_classes.in xlat/v4l2_control_flags.in xlat/v4l2_control_ids.in xlat/v4l2_control_types.in xlat/v4l2_device_capabilities_flags.in xlat/v4l2_fields.in xlat/v4l2_format_description_flags.in xlat/v4l2_frameinterval_types.in xlat/v4l2_framesize_types.in xlat/v4l2_input_types.in xlat/v4l2_memories.in xlat/v4l2_sliced_flags.in xlat/v4l2_streaming_capabilities.in xlat/v4l2_tuner_audmodes.in xlat/v4l2_tuner_capabilities.in xlat/v4l2_tuner_rxsubchanses.in xlat/v4l2_tuner_types.in xlat/v4l2_vbi_flags.in xlat/wait4_options.in xlat/waitid_types.in xlat/whence_codes.in xlat/xattrflags.in xlat/xdp_flags.in xlat/xfs_dqblk_flags.in xlat/xfs_quota_flags.in +XLAT_HEADER_FILES = xlat/access_flags.h xlat/addrfams.h xlat/adjtimex_modes.h xlat/adjtimex_state.h xlat/adjtimex_status.h xlat/advise.h xlat/af_packet_types.h xlat/archvals.h xlat/arp_hardware_types.h xlat/at_flags.h xlat/at_statx_sync_types.h xlat/atomic_ops.h xlat/audit_arch.h xlat/baud_options.h xlat/blkpg_ops.h xlat/bootflags1.h xlat/bootflags2.h xlat/bootflags3.h xlat/bpf_attach_flags.h xlat/bpf_attach_type.h xlat/bpf_class.h xlat/bpf_commands.h xlat/bpf_map_flags.h xlat/bpf_map_types.h xlat/bpf_map_update_elem_flags.h xlat/bpf_miscop.h xlat/bpf_mode.h xlat/bpf_op_alu.h xlat/bpf_op_jmp.h xlat/bpf_prog_flags.h xlat/bpf_prog_types.h xlat/bpf_rval.h xlat/bpf_size.h xlat/bpf_src.h xlat/bsg_flags.h xlat/bsg_protocol.h xlat/bsg_subprotocol.h xlat/bt_protocols.h xlat/btrfs_balance_args.h xlat/btrfs_balance_ctl_cmds.h xlat/btrfs_balance_flags.h xlat/btrfs_balance_state.h xlat/btrfs_compress_types.h xlat/btrfs_defrag_flags.h xlat/btrfs_dev_replace_cmds.h xlat/btrfs_dev_replace_results.h xlat/btrfs_dev_replace_state.h xlat/btrfs_dev_stats_flags.h xlat/btrfs_dev_stats_values.h xlat/btrfs_features_compat.h xlat/btrfs_features_compat_ro.h xlat/btrfs_features_incompat.h xlat/btrfs_key_types.h xlat/btrfs_qgroup_ctl_cmds.h xlat/btrfs_qgroup_inherit_flags.h xlat/btrfs_qgroup_limit_flags.h xlat/btrfs_qgroup_status_flags.h xlat/btrfs_scrub_flags.h xlat/btrfs_send_flags.h xlat/btrfs_snap_flags_v2.h xlat/btrfs_space_info_flags.h xlat/btrfs_tree_objectids.h xlat/cacheflush_scope.h xlat/cap.h xlat/cap_mask0.h xlat/cap_mask1.h xlat/cap_version.h xlat/clockflags.h xlat/clocknames.h xlat/clone_flags.h xlat/cpuclocknames.h xlat/crypto_nl_attrs.h xlat/dcb_commands.h xlat/delete_module_flags.h xlat/dirent_types.h xlat/dm_flags.h xlat/efd_flags.h xlat/epollctls.h xlat/epollevents.h xlat/epollflags.h xlat/ethernet_protocols.h xlat/evdev_abs.h xlat/evdev_autorepeat.h xlat/evdev_ev.h xlat/evdev_ff_status.h xlat/evdev_ff_types.h xlat/evdev_keycode.h xlat/evdev_leds.h xlat/evdev_misc.h xlat/evdev_mtslots.h xlat/evdev_prop.h xlat/evdev_relative_axes.h xlat/evdev_snd.h xlat/evdev_switch.h xlat/evdev_sync.h xlat/f_owner_types.h xlat/f_seals.h xlat/falloc_flags.h xlat/fan_classes.h xlat/fan_event_flags.h xlat/fan_init_flags.h xlat/fan_mark_flags.h xlat/fcntl64cmds.h xlat/fcntlcmds.h xlat/fdflags.h xlat/fib_rule_actions.h xlat/fib_rule_flags.h xlat/fiemap_extent_flags.h xlat/fiemap_flags.h xlat/flockcmds.h xlat/fsmagic.h xlat/futexops.h xlat/futexwakecmps.h xlat/futexwakeops.h xlat/getrandom_flags.h xlat/getsockipoptions.h xlat/getsockipv6options.h xlat/hci_channels.h xlat/hw_breakpoint_len.h xlat/hw_breakpoint_type.h xlat/icmpfilterflags.h xlat/if_dqblk_valid.h xlat/if_dqinfo_flags.h xlat/if_dqinfo_valid.h xlat/ifaddrflags.h xlat/iffflags.h xlat/inet_diag_attrs.h xlat/inet_diag_bytecodes.h xlat/inet_diag_extended_flags.h xlat/inet_diag_req_attrs.h xlat/inet_protocols.h xlat/inotify_flags.h xlat/inotify_init_flags.h xlat/ioctl_dirs.h xlat/ioprio_class.h xlat/ioprio_who.h xlat/ip_cmsg_types.h xlat/ip_type_of_services.h xlat/ipc_msg_flags.h xlat/ipccalls.h xlat/itimer_which.h xlat/kcmp_types.h xlat/kexec_arch_values.h xlat/kexec_file_load_flags.h xlat/kexec_load_flags.h xlat/key_perms.h xlat/key_reqkeys.h xlat/key_spec.h xlat/keyctl_commands.h xlat/kvm_mem_flags.h xlat/lockfcmds.h xlat/loop_cmds.h xlat/loop_crypt_type_options.h xlat/loop_flags_options.h xlat/lwtunnel_encap_types.h xlat/madvise_cmds.h xlat/mbindflags.h xlat/mctl_sync.h xlat/mdb_flags.h xlat/mdb_states.h xlat/membarrier_cmds.h xlat/memfd_create_flags.h xlat/mempolicyflags.h xlat/mlock_flags.h xlat/mlockall_flags.h xlat/mmap_flags.h xlat/mmap_prot.h xlat/modem_flags.h xlat/modetypes.h xlat/module_init_flags.h xlat/mount_flags.h xlat/move_pages_flags.h xlat/mq_attr_flags.h xlat/mremap_flags.h xlat/msg_flags.h xlat/msgctl_flags.h xlat/mtd_file_mode_options.h xlat/mtd_flags_options.h xlat/mtd_mode_options.h xlat/mtd_nandecc_options.h xlat/mtd_otp_options.h xlat/mtd_type_options.h xlat/multicast_router_types.h xlat/name_to_handle_at_flags.h xlat/neighbor_cache_entry_flags.h xlat/neighbor_cache_entry_states.h xlat/netlink_ack_flags.h xlat/netlink_delete_flags.h xlat/netlink_diag_attrs.h xlat/netlink_diag_show.h xlat/netlink_flags.h xlat/netlink_get_flags.h xlat/netlink_new_flags.h xlat/netlink_protocols.h xlat/netlink_socket_flags.h xlat/netlink_states.h xlat/netlink_types.h xlat/nf_acct_msg_types.h xlat/nf_cthelper_msg_types.h xlat/nf_ctnetlink_exp_msg_types.h xlat/nf_ctnetlink_msg_types.h xlat/nf_cttimeout_msg_types.h xlat/nf_ipset_msg_types.h xlat/nf_nft_compat_msg_types.h xlat/nf_nftables_msg_types.h xlat/nf_osf_msg_types.h xlat/nf_queue_msg_types.h xlat/nf_ulog_msg_types.h xlat/nl_audit_types.h xlat/nl_crypto_types.h xlat/nl_netfilter_msg_types.h xlat/nl_netfilter_subsys_ids.h xlat/nl_route_types.h xlat/nl_selinux_types.h xlat/nl_sock_diag_types.h xlat/nl_xfrm_types.h xlat/nlmsgerr_attrs.h xlat/notifyflags.h xlat/nt_descriptor_types.h xlat/open_access_modes.h xlat/open_mode_flags.h xlat/packet_diag_attrs.h xlat/packet_diag_info_flags.h xlat/packet_diag_show.h xlat/packet_mreq_type.h xlat/perf_attr_size.h xlat/perf_branch_sample_type.h xlat/perf_event_open_flags.h xlat/perf_event_read_format.h xlat/perf_event_sample_format.h xlat/perf_hw_cache_id.h xlat/perf_hw_cache_op_id.h xlat/perf_hw_cache_op_result_id.h xlat/perf_hw_id.h xlat/perf_sw_ids.h xlat/perf_type_id.h xlat/personality_flags.h xlat/personality_types.h xlat/pkey_access.h xlat/policies.h xlat/pollflags.h xlat/pr_cap_ambient.h xlat/pr_dumpable.h xlat/pr_fp_mode.h xlat/pr_mce_kill.h xlat/pr_mce_kill_policy.h xlat/pr_set_mm.h xlat/pr_tsc.h xlat/pr_unalign_flags.h xlat/prctl_options.h xlat/priorities.h xlat/ptp_flags_options.h xlat/ptrace_cmds.h xlat/ptrace_events.h xlat/ptrace_peeksiginfo_flags.h xlat/ptrace_setoptions_flags.h xlat/quota_formats.h xlat/quotacmds.h xlat/quotatypes.h xlat/rename_flags.h xlat/resource_flags.h xlat/resources.h xlat/riscv_flush_icache_flags.h xlat/route_nexthop_flags.h xlat/routing_flags.h xlat/routing_protocols.h xlat/routing_scopes.h xlat/routing_table_ids.h xlat/routing_types.h xlat/rtnl_addr_attrs.h xlat/rtnl_addrlabel_attrs.h xlat/rtnl_dcb_attrs.h xlat/rtnl_ifla_brport_attrs.h xlat/rtnl_ifla_info_attrs.h xlat/rtnl_ifla_port_attrs.h xlat/rtnl_ifla_vf_port_attrs.h xlat/rtnl_ifla_xdp_attrs.h xlat/rtnl_link_attrs.h xlat/rtnl_mdb_attrs.h xlat/rtnl_mdba_mdb_attrs.h xlat/rtnl_mdba_mdb_eattr_attrs.h xlat/rtnl_mdba_mdb_entry_attrs.h xlat/rtnl_mdba_router_attrs.h xlat/rtnl_mdba_router_pattr_attrs.h xlat/rtnl_neigh_attrs.h xlat/rtnl_neightbl_attrs.h xlat/rtnl_neightbl_parms_attrs.h xlat/rtnl_netconf_attrs.h xlat/rtnl_nsid_attrs.h xlat/rtnl_route_attrs.h xlat/rtnl_rta_metrics_attrs.h xlat/rtnl_rule_attrs.h xlat/rtnl_tc_action_attrs.h xlat/rtnl_tc_attrs.h xlat/rtnl_tca_stab_attrs.h xlat/rtnl_tca_stats_attrs.h xlat/rwf_flags.h xlat/s390_guarded_storage_commands.h xlat/s390_runtime_instr_commands.h xlat/s390_sthyi_function_codes.h xlat/sa_handler_values.h xlat/sched_flags.h xlat/schedulers.h xlat/scmvals.h xlat/scsi_sg_commands.h xlat/secbits.h xlat/seccomp_filter_flags.h xlat/seccomp_mode.h xlat/seccomp_ops.h xlat/seccomp_ret_action.h xlat/semctl_flags.h xlat/semop_flags.h xlat/setns_types.h xlat/setsockipoptions.h xlat/setsockipv6options.h xlat/sfd_flags.h xlat/sg_io_dxfer_direction.h xlat/sg_io_flags.h xlat/sg_io_info.h xlat/sg_scsi_reset.h xlat/shm_flags.h xlat/shm_resource_flags.h xlat/shmctl_flags.h xlat/shutdown_modes.h xlat/sigact_flags.h xlat/sigaltstack_flags.h xlat/sigbus_codes.h xlat/sigchld_codes.h xlat/sigemt_codes.h xlat/sigev_value.h xlat/sigfpe_codes.h xlat/sigill_codes.h xlat/siginfo_codes.h xlat/sigpoll_codes.h xlat/sigprocmaskcmds.h xlat/sigprof_codes.h xlat/sigsegv_codes.h xlat/sigsys_codes.h xlat/sigtrap_codes.h xlat/skf_ad.h xlat/smc_diag_attrs.h xlat/smc_diag_extended_flags.h xlat/smc_link_group_roles.h xlat/smc_states.h xlat/sock_type_flags.h xlat/socketcalls.h xlat/socketlayers.h xlat/sockipoptions.h xlat/sockipv6options.h xlat/sockipxoptions.h xlat/socknetlinkoptions.h xlat/sockoptions.h xlat/sockpacketoptions.h xlat/sockrawoptions.h xlat/socksctpoptions.h xlat/socktcpoptions.h xlat/socktypes.h xlat/splice_flags.h xlat/sram_alloc_flags.h xlat/statfs_flags.h xlat/statx_attrs.h xlat/statx_masks.h xlat/swap_flags.h xlat/sync_file_range_flags.h xlat/sysctl_kern.h xlat/sysctl_net.h xlat/sysctl_net_core.h xlat/sysctl_net_ipv4.h xlat/sysctl_net_ipv4_conf.h xlat/sysctl_net_ipv4_route.h xlat/sysctl_net_ipv6.h xlat/sysctl_net_ipv6_route.h xlat/sysctl_net_unix.h xlat/sysctl_root.h xlat/sysctl_vm.h xlat/syslog_action_type.h xlat/sysmips_operations.h xlat/tcflsh_options.h xlat/tcp_state_flags.h xlat/tcp_states.h xlat/tcxonc_options.h xlat/timerfdflags.h xlat/ubi_volume_props.h xlat/ubi_volume_types.h xlat/uffd_api_features.h xlat/uffd_api_flags.h xlat/uffd_copy_flags.h xlat/uffd_flags.h xlat/uffd_register_ioctl_flags.h xlat/uffd_register_mode_flags.h xlat/uffd_zeropage_flags.h xlat/umount_flags.h xlat/unix_diag_attrs.h xlat/unix_diag_show.h xlat/unshare_flags.h xlat/usagewho.h xlat/v4l2_buf_flags.h xlat/v4l2_buf_types.h xlat/v4l2_capture_modes.h xlat/v4l2_colorspaces.h xlat/v4l2_control_classes.h xlat/v4l2_control_flags.h xlat/v4l2_control_ids.h xlat/v4l2_control_types.h xlat/v4l2_device_capabilities_flags.h xlat/v4l2_fields.h xlat/v4l2_format_description_flags.h xlat/v4l2_frameinterval_types.h xlat/v4l2_framesize_types.h xlat/v4l2_input_types.h xlat/v4l2_memories.h xlat/v4l2_sliced_flags.h xlat/v4l2_streaming_capabilities.h xlat/v4l2_tuner_audmodes.h xlat/v4l2_tuner_capabilities.h xlat/v4l2_tuner_rxsubchanses.h xlat/v4l2_tuner_types.h xlat/v4l2_vbi_flags.h xlat/wait4_options.h xlat/waitid_types.h xlat/whence_codes.h xlat/xattrflags.h xlat/xdp_flags.h xlat/xfs_dqblk_flags.h xlat/xfs_quota_flags.h $(top_srcdir)/xlat/access_flags.h: $(top_srcdir)/xlat/access_flags.in $(top_srcdir)/xlat/gen.sh $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ $(top_srcdir)/xlat/addrfams.h: $(top_srcdir)/xlat/addrfams.in $(top_srcdir)/xlat/gen.sh @@ -298,6 +298,8 @@ $(top_srcdir)/xlat/key_spec.h: $(top_srcdir)/xlat/key_spec.in $(top_srcdir)/xlat $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ $(top_srcdir)/xlat/keyctl_commands.h: $(top_srcdir)/xlat/keyctl_commands.in $(top_srcdir)/xlat/gen.sh $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ +$(top_srcdir)/xlat/kvm_mem_flags.h: $(top_srcdir)/xlat/kvm_mem_flags.in $(top_srcdir)/xlat/gen.sh + $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ $(top_srcdir)/xlat/lockfcmds.h: $(top_srcdir)/xlat/lockfcmds.in $(top_srcdir)/xlat/gen.sh $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ $(top_srcdir)/xlat/loop_cmds.h: $(top_srcdir)/xlat/loop_cmds.in $(top_srcdir)/xlat/gen.sh @@ -522,6 +524,8 @@ $(top_srcdir)/xlat/resource_flags.h: $(top_srcdir)/xlat/resource_flags.in $(top_ $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ $(top_srcdir)/xlat/resources.h: $(top_srcdir)/xlat/resources.in $(top_srcdir)/xlat/gen.sh $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ +$(top_srcdir)/xlat/riscv_flush_icache_flags.h: $(top_srcdir)/xlat/riscv_flush_icache_flags.in $(top_srcdir)/xlat/gen.sh + $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ $(top_srcdir)/xlat/route_nexthop_flags.h: $(top_srcdir)/xlat/route_nexthop_flags.in $(top_srcdir)/xlat/gen.sh $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ $(top_srcdir)/xlat/routing_flags.h: $(top_srcdir)/xlat/routing_flags.in $(top_srcdir)/xlat/gen.sh @@ -590,6 +594,12 @@ $(top_srcdir)/xlat/rtnl_tca_stats_attrs.h: $(top_srcdir)/xlat/rtnl_tca_stats_att $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ $(top_srcdir)/xlat/rwf_flags.h: $(top_srcdir)/xlat/rwf_flags.in $(top_srcdir)/xlat/gen.sh $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ +$(top_srcdir)/xlat/s390_guarded_storage_commands.h: $(top_srcdir)/xlat/s390_guarded_storage_commands.in $(top_srcdir)/xlat/gen.sh + $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ +$(top_srcdir)/xlat/s390_runtime_instr_commands.h: $(top_srcdir)/xlat/s390_runtime_instr_commands.in $(top_srcdir)/xlat/gen.sh + $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ +$(top_srcdir)/xlat/s390_sthyi_function_codes.h: $(top_srcdir)/xlat/s390_sthyi_function_codes.in $(top_srcdir)/xlat/gen.sh + $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ $(top_srcdir)/xlat/sa_handler_values.h: $(top_srcdir)/xlat/sa_handler_values.in $(top_srcdir)/xlat/gen.sh $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ $(top_srcdir)/xlat/sched_flags.h: $(top_srcdir)/xlat/sched_flags.in $(top_srcdir)/xlat/gen.sh @@ -690,6 +700,8 @@ $(top_srcdir)/xlat/sockipv6options.h: $(top_srcdir)/xlat/sockipv6options.in $(to $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ $(top_srcdir)/xlat/sockipxoptions.h: $(top_srcdir)/xlat/sockipxoptions.in $(top_srcdir)/xlat/gen.sh $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ +$(top_srcdir)/xlat/socknetlinkoptions.h: $(top_srcdir)/xlat/socknetlinkoptions.in $(top_srcdir)/xlat/gen.sh + $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ $(top_srcdir)/xlat/sockoptions.h: $(top_srcdir)/xlat/sockoptions.in $(top_srcdir)/xlat/gen.sh $(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@ $(top_srcdir)/xlat/sockpacketoptions.h: $(top_srcdir)/xlat/sockpacketoptions.in $(top_srcdir)/xlat/gen.sh diff --git a/xlat/audit_arch.h b/xlat/audit_arch.h index 16d39473..7883fa8a 100644 --- a/xlat/audit_arch.h +++ b/xlat/audit_arch.h @@ -18,7 +18,7 @@ extern const struct xlat audit_arch[]; static # endif const struct xlat audit_arch[] = { -/* linux used to have linux/elf-em.h out of sync with linux/audit.h */ + #if defined(AUDIT_ARCH_AARCH64) || (defined(HAVE_DECL_AUDIT_ARCH_AARCH64) && HAVE_DECL_AUDIT_ARCH_AARCH64) XLAT(AUDIT_ARCH_AARCH64), #endif diff --git a/xlat/dm_flags.h b/xlat/dm_flags.h index 921b7b06..5573856d 100644 --- a/xlat/dm_flags.h +++ b/xlat/dm_flags.h @@ -64,7 +64,7 @@ static const struct xlat dm_flags[] = { XLAT(DM_READONLY_FLAG), XLAT(DM_SUSPEND_FLAG), -/* Defined in lvm2/libdm/ioctl/libdm-iface.c */ + XLAT(DM_EXISTS_FLAG), XLAT(DM_PERSISTENT_DEV_FLAG), XLAT(DM_STATUS_TABLE_FLAG), diff --git a/xlat/fcntl64cmds.h b/xlat/fcntl64cmds.h index e01e533c..5fef6272 100644 --- a/xlat/fcntl64cmds.h +++ b/xlat/fcntl64cmds.h @@ -17,7 +17,7 @@ static const struct xlat fcntl64cmds[] = { -/* asm-generic/fcntl.h */ + XLAT(F_GETLK64), XLAT(F_SETLK64), XLAT(F_SETLKW64), diff --git a/xlat/fcntlcmds.h b/xlat/fcntlcmds.h index 33280f33..44434f37 100644 --- a/xlat/fcntlcmds.h +++ b/xlat/fcntlcmds.h @@ -89,7 +89,7 @@ static const struct xlat fcntlcmds[] = { -/* asm-generic/fcntl.h */ + XLAT(F_DUPFD), XLAT(F_GETFD), XLAT(F_SETFD), @@ -109,7 +109,7 @@ const struct xlat fcntlcmds[] = { XLAT(F_OFD_SETLK), XLAT(F_OFD_SETLKW), -/* linux/fcntl.h */ + XLAT(F_SETLEASE), XLAT(F_GETLEASE), XLAT(F_NOTIFY), diff --git a/xlat/fsmagic.h b/xlat/fsmagic.h index 7a570466..1009e5db 100644 --- a/xlat/fsmagic.h +++ b/xlat/fsmagic.h @@ -8,7 +8,7 @@ static const struct xlat fsmagic[] = { -/* sorted by value, suitable for bsearch(3) */ + { 0x0000002f, "QNX4_SUPER_MAGIC" }, { 0x00000187, "AUTOFS_SUPER_MAGIC" }, { 0x00001373, "DEVFS_SUPER_MAGIC" }, diff --git a/xlat/gen.sh b/xlat/gen.sh index d5286d10..6db06c51 100755 --- a/xlat/gen.sh +++ b/xlat/gen.sh @@ -135,6 +135,9 @@ gen_header() # 1st pass: output directives. while read line; do LC_COLLATE=C + line=$(printf "%s" "$line" | \ + sed "s|[[:space:]]*/\*.*\*/[[:space:]]*||") + case $line in '#stop') exit 0 @@ -196,6 +199,9 @@ gen_header() # 2nd pass: output everything. while read line; do LC_COLLATE=C + line=$(printf "%s" "$line" | \ + sed "s|[[:space:]]*/\*.*\*/[[:space:]]*||") + case ${line} in '#conditional') unconditional= diff --git a/xlat/kvm_mem_flags.h b/xlat/kvm_mem_flags.h new file mode 100644 index 00000000..5a8ebee6 --- /dev/null +++ b/xlat/kvm_mem_flags.h @@ -0,0 +1,22 @@ +/* Generated by ./xlat/gen.sh from ./xlat/kvm_mem_flags.in; do not edit. */ +#if !(defined(KVM_MEM_LOG_DIRTY_PAGES) || (defined(HAVE_DECL_KVM_MEM_LOG_DIRTY_PAGES) && HAVE_DECL_KVM_MEM_LOG_DIRTY_PAGES)) +# define KVM_MEM_LOG_DIRTY_PAGES (1 << 0) +#endif +#if !(defined(KVM_MEM_READONLY) || (defined(HAVE_DECL_KVM_MEM_READONLY) && HAVE_DECL_KVM_MEM_READONLY)) +# define KVM_MEM_READONLY (1 << 1) +#endif + +#ifdef IN_MPERS + +# error static const struct xlat kvm_mem_flags in mpers mode + +#else + +static +const struct xlat kvm_mem_flags[] = { + XLAT(KVM_MEM_LOG_DIRTY_PAGES), + XLAT(KVM_MEM_READONLY), + XLAT_END +}; + +#endif /* !IN_MPERS */ diff --git a/xlat/kvm_mem_flags.in b/xlat/kvm_mem_flags.in new file mode 100644 index 00000000..82b93ba7 --- /dev/null +++ b/xlat/kvm_mem_flags.in @@ -0,0 +1,2 @@ +KVM_MEM_LOG_DIRTY_PAGES (1 << 0) +KVM_MEM_READONLY (1 << 1) diff --git a/xlat/loop_flags_options.h b/xlat/loop_flags_options.h index 1e96f462..d69f53de 100644 --- a/xlat/loop_flags_options.h +++ b/xlat/loop_flags_options.h @@ -26,13 +26,13 @@ static # endif const struct xlat loop_flags_options[] = { XLAT(LO_FLAGS_READ_ONLY), -/* Added in v2.6.11-732-gf3f28e4, Removed in v3.2-rc1~49^2~5^2~3 */ + XLAT(LO_FLAGS_USE_AOPS), -/* Added in v2.6.25-rc1~758 */ + XLAT(LO_FLAGS_AUTOCLEAR), -/* Added in v3.2-rc1~48^2~7 */ + XLAT(LO_FLAGS_PARTSCAN), -/* Added in v4.4-rc1~133^2~22 */ + XLAT(LO_FLAGS_DIRECT_IO), XLAT_END }; diff --git a/xlat/membarrier_cmds.h b/xlat/membarrier_cmds.h index 9f1c69e3..25c3e323 100644 --- a/xlat/membarrier_cmds.h +++ b/xlat/membarrier_cmds.h @@ -2,14 +2,26 @@ #if !(defined(MEMBARRIER_CMD_QUERY) || (defined(HAVE_DECL_MEMBARRIER_CMD_QUERY) && HAVE_DECL_MEMBARRIER_CMD_QUERY)) # define MEMBARRIER_CMD_QUERY 0 #endif -#if !(defined(MEMBARRIER_CMD_SHARED) || (defined(HAVE_DECL_MEMBARRIER_CMD_SHARED) && HAVE_DECL_MEMBARRIER_CMD_SHARED)) -# define MEMBARRIER_CMD_SHARED 1 +#if !(defined(MEMBARRIER_CMD_GLOBAL) || (defined(HAVE_DECL_MEMBARRIER_CMD_GLOBAL) && HAVE_DECL_MEMBARRIER_CMD_GLOBAL)) +# define MEMBARRIER_CMD_GLOBAL 1 << 0 +#endif +#if !(defined(MEMBARRIER_CMD_GLOBAL_EXPEDITED) || (defined(HAVE_DECL_MEMBARRIER_CMD_GLOBAL_EXPEDITED) && HAVE_DECL_MEMBARRIER_CMD_GLOBAL_EXPEDITED)) +# define MEMBARRIER_CMD_GLOBAL_EXPEDITED 1 << 1 +#endif +#if !(defined(MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED) || (defined(HAVE_DECL_MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED) && HAVE_DECL_MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED)) +# define MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED 1 << 2 #endif #if !(defined(MEMBARRIER_CMD_PRIVATE_EXPEDITED) || (defined(HAVE_DECL_MEMBARRIER_CMD_PRIVATE_EXPEDITED) && HAVE_DECL_MEMBARRIER_CMD_PRIVATE_EXPEDITED)) -# define MEMBARRIER_CMD_PRIVATE_EXPEDITED 8 +# define MEMBARRIER_CMD_PRIVATE_EXPEDITED 1 << 3 #endif #if !(defined(MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED) || (defined(HAVE_DECL_MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED) && HAVE_DECL_MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED)) -# define MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED 16 +# define MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED 1 << 4 +#endif +#if !(defined(MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE) || (defined(HAVE_DECL_MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE) && HAVE_DECL_MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE)) +# define MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE 1 << 5 +#endif +#if !(defined(MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE) || (defined(HAVE_DECL_MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE) && HAVE_DECL_MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE)) +# define MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE 1 << 6 #endif #ifdef IN_MPERS @@ -21,9 +33,13 @@ static const struct xlat membarrier_cmds[] = { XLAT(MEMBARRIER_CMD_QUERY), - XLAT(MEMBARRIER_CMD_SHARED), + XLAT(MEMBARRIER_CMD_GLOBAL), + XLAT(MEMBARRIER_CMD_GLOBAL_EXPEDITED), + XLAT(MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED), XLAT(MEMBARRIER_CMD_PRIVATE_EXPEDITED), XLAT(MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED), + XLAT(MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE), + XLAT(MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE), XLAT_END }; diff --git a/xlat/membarrier_cmds.in b/xlat/membarrier_cmds.in index e4fe06ac..284c7dad 100644 --- a/xlat/membarrier_cmds.in +++ b/xlat/membarrier_cmds.in @@ -1,4 +1,8 @@ -MEMBARRIER_CMD_QUERY 0 -MEMBARRIER_CMD_SHARED 1 -MEMBARRIER_CMD_PRIVATE_EXPEDITED 8 -MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED 16 +MEMBARRIER_CMD_QUERY 0 +MEMBARRIER_CMD_GLOBAL 1 << 0 +MEMBARRIER_CMD_GLOBAL_EXPEDITED 1 << 1 +MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED 1 << 2 +MEMBARRIER_CMD_PRIVATE_EXPEDITED 1 << 3 +MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED 1 << 4 +MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE 1 << 5 +MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE 1 << 6 diff --git a/xlat/mmap_flags.h b/xlat/mmap_flags.h index 9ccc87e8..f3d2cae0 100644 --- a/xlat/mmap_flags.h +++ b/xlat/mmap_flags.h @@ -18,6 +18,9 @@ const struct xlat mmap_flags[] = { #if defined(MAP_PRIVATE) || (defined(HAVE_DECL_MAP_PRIVATE) && HAVE_DECL_MAP_PRIVATE) XLAT(MAP_PRIVATE), #endif +#if defined(MAP_SHARED_VALIDATE) || (defined(HAVE_DECL_MAP_SHARED_VALIDATE) && HAVE_DECL_MAP_SHARED_VALIDATE) + XLAT(MAP_SHARED_VALIDATE), +#endif #if defined(MAP_FIXED) || (defined(HAVE_DECL_MAP_FIXED) && HAVE_DECL_MAP_FIXED) XLAT(MAP_FIXED), #endif @@ -87,7 +90,7 @@ const struct xlat mmap_flags[] = { #if defined(MAP_LOCKED) || (defined(HAVE_DECL_MAP_LOCKED) && HAVE_DECL_MAP_LOCKED) XLAT(MAP_LOCKED), #endif -/* FreeBSD ones */ + #if defined(MAP_ANON) && (!defined(MAP_ANONYMOUS) || MAP_ANON != MAP_ANONYMOUS) #if defined(MAP_ANON) || (defined(HAVE_DECL_MAP_ANON) && HAVE_DECL_MAP_ANON) XLAT(MAP_ANON), @@ -102,6 +105,9 @@ const struct xlat mmap_flags[] = { #if defined(MAP_HUGETLB) || (defined(HAVE_DECL_MAP_HUGETLB) && HAVE_DECL_MAP_HUGETLB) XLAT(MAP_HUGETLB), #endif +#if defined(MAP_SYNC) || (defined(HAVE_DECL_MAP_SYNC) && HAVE_DECL_MAP_SYNC) + XLAT(MAP_SYNC), +#endif #if defined MAP_UNINITIALIZED && MAP_UNINITIALIZED > 0 #if defined(MAP_UNINITIALIZED) || (defined(HAVE_DECL_MAP_UNINITIALIZED) && HAVE_DECL_MAP_UNINITIALIZED) XLAT(MAP_UNINITIALIZED), diff --git a/xlat/mmap_flags.in b/xlat/mmap_flags.in index e9fde440..60b74fc4 100644 --- a/xlat/mmap_flags.in +++ b/xlat/mmap_flags.in @@ -1,5 +1,6 @@ MAP_SHARED MAP_PRIVATE +MAP_SHARED_VALIDATE MAP_FIXED MAP_ANONYMOUS MAP_32BIT @@ -48,6 +49,7 @@ MAP_ANON MAP_HASSEMAPHORE MAP_STACK MAP_HUGETLB +MAP_SYNC #if defined MAP_UNINITIALIZED && MAP_UNINITIALIZED > 0 MAP_UNINITIALIZED #endif diff --git a/xlat/msg_flags.h b/xlat/msg_flags.h index f4729ba2..6518c9b0 100644 --- a/xlat/msg_flags.h +++ b/xlat/msg_flags.h @@ -2,6 +2,9 @@ #if !(defined(MSG_BATCH) || (defined(HAVE_DECL_MSG_BATCH) && HAVE_DECL_MSG_BATCH)) # define MSG_BATCH 0x40000 #endif +#if !(defined(MSG_ZEROCOPY) || (defined(HAVE_DECL_MSG_ZEROCOPY) && HAVE_DECL_MSG_ZEROCOPY)) +# define MSG_ZEROCOPY 0x20000000 +#endif #ifndef IN_MPERS @@ -58,6 +61,7 @@ const struct xlat msg_flags[] = { XLAT(MSG_WAITFORONE), #endif XLAT(MSG_BATCH), + XLAT(MSG_ZEROCOPY), #if defined(MSG_EOF) || (defined(HAVE_DECL_MSG_EOF) && HAVE_DECL_MSG_EOF) XLAT(MSG_EOF), #endif diff --git a/xlat/msg_flags.in b/xlat/msg_flags.in index cf6b83ca..1fdd8195 100644 --- a/xlat/msg_flags.in +++ b/xlat/msg_flags.in @@ -16,6 +16,7 @@ MSG_NOSIGNAL MSG_MORE MSG_WAITFORONE MSG_BATCH 0x40000 +MSG_ZEROCOPY 0x20000000 MSG_EOF MSG_FASTOPEN MSG_CMSG_CLOEXEC diff --git a/xlat/nt_descriptor_types.h b/xlat/nt_descriptor_types.h index 715c2817..edab7afc 100644 --- a/xlat/nt_descriptor_types.h +++ b/xlat/nt_descriptor_types.h @@ -1,82 +1,265 @@ /* Generated by ./xlat/gen.sh from ./xlat/nt_descriptor_types.in; do not edit. */ - -#ifdef IN_MPERS - -# error static const struct xlat nt_descriptor_types in mpers mode - -#else - -static -const struct xlat nt_descriptor_types[] = { -#if defined(NT_PRSTATUS) || (defined(HAVE_DECL_NT_PRSTATUS) && HAVE_DECL_NT_PRSTATUS) - XLAT(NT_PRSTATUS), +#if !(defined(NT_PRSTATUS) || (defined(HAVE_DECL_NT_PRSTATUS) && HAVE_DECL_NT_PRSTATUS)) +# define NT_PRSTATUS 1 +#endif +#if !(defined(NT_FPREGSET) || (defined(HAVE_DECL_NT_FPREGSET) && HAVE_DECL_NT_FPREGSET)) +# define NT_FPREGSET 2 +#endif +#if !(defined(NT_PRPSINFO) || (defined(HAVE_DECL_NT_PRPSINFO) && HAVE_DECL_NT_PRPSINFO)) +# define NT_PRPSINFO 3 +#endif +#if !(defined(NT_PRXREG) || (defined(HAVE_DECL_NT_PRXREG) && HAVE_DECL_NT_PRXREG)) +# define NT_PRXREG 4 +#endif +#if !(defined(NT_TASKSTRUCT) || (defined(HAVE_DECL_NT_TASKSTRUCT) && HAVE_DECL_NT_TASKSTRUCT)) +# define NT_TASKSTRUCT 4 +#endif +#if !(defined(NT_PLATFORM) || (defined(HAVE_DECL_NT_PLATFORM) && HAVE_DECL_NT_PLATFORM)) +# define NT_PLATFORM 5 +#endif +#if !(defined(NT_AUXV) || (defined(HAVE_DECL_NT_AUXV) && HAVE_DECL_NT_AUXV)) +# define NT_AUXV 6 +#endif +#if !(defined(NT_GWINDOWS) || (defined(HAVE_DECL_NT_GWINDOWS) && HAVE_DECL_NT_GWINDOWS)) +# define NT_GWINDOWS 7 +#endif +#if !(defined(NT_ASRS) || (defined(HAVE_DECL_NT_ASRS) && HAVE_DECL_NT_ASRS)) +# define NT_ASRS 8 +#endif +#if !(defined(NT_PSTATUS) || (defined(HAVE_DECL_NT_PSTATUS) && HAVE_DECL_NT_PSTATUS)) +# define NT_PSTATUS 10 +#endif +#if !(defined(NT_PSINFO) || (defined(HAVE_DECL_NT_PSINFO) && HAVE_DECL_NT_PSINFO)) +# define NT_PSINFO 13 +#endif +#if !(defined(NT_PRCRED) || (defined(HAVE_DECL_NT_PRCRED) && HAVE_DECL_NT_PRCRED)) +# define NT_PRCRED 14 +#endif +#if !(defined(NT_UTSNAME) || (defined(HAVE_DECL_NT_UTSNAME) && HAVE_DECL_NT_UTSNAME)) +# define NT_UTSNAME 15 +#endif +#if !(defined(NT_LWPSTATUS) || (defined(HAVE_DECL_NT_LWPSTATUS) && HAVE_DECL_NT_LWPSTATUS)) +# define NT_LWPSTATUS 16 +#endif +#if !(defined(NT_LWPSINFO) || (defined(HAVE_DECL_NT_LWPSINFO) && HAVE_DECL_NT_LWPSINFO)) +# define NT_LWPSINFO 17 +#endif +#if !(defined(NT_PRFPXREG) || (defined(HAVE_DECL_NT_PRFPXREG) && HAVE_DECL_NT_PRFPXREG)) +# define NT_PRFPXREG 20 +#endif +#if !(defined(NT_SIGINFO) || (defined(HAVE_DECL_NT_SIGINFO) && HAVE_DECL_NT_SIGINFO)) +# define NT_SIGINFO 0x53494749 +#endif +#if !(defined(NT_FILE) || (defined(HAVE_DECL_NT_FILE) && HAVE_DECL_NT_FILE)) +# define NT_FILE 0x46494c45 +#endif +#if !(defined(NT_PRXFPREG) || (defined(HAVE_DECL_NT_PRXFPREG) && HAVE_DECL_NT_PRXFPREG)) +# define NT_PRXFPREG 0x46e62b7f +#endif +#if !(defined(NT_PPC_VMX) || (defined(HAVE_DECL_NT_PPC_VMX) && HAVE_DECL_NT_PPC_VMX)) +# define NT_PPC_VMX 0x100 +#endif +#if !(defined(NT_PPC_SPE) || (defined(HAVE_DECL_NT_PPC_SPE) && HAVE_DECL_NT_PPC_SPE)) +# define NT_PPC_SPE 0x101 #endif -#if defined(NT_FPREGSET) || (defined(HAVE_DECL_NT_FPREGSET) && HAVE_DECL_NT_FPREGSET) - XLAT(NT_FPREGSET), +#if !(defined(NT_PPC_VSX) || (defined(HAVE_DECL_NT_PPC_VSX) && HAVE_DECL_NT_PPC_VSX)) +# define NT_PPC_VSX 0x102 #endif -#if defined(NT_PRPSINFO) || (defined(HAVE_DECL_NT_PRPSINFO) && HAVE_DECL_NT_PRPSINFO) - XLAT(NT_PRPSINFO), +#if !(defined(NT_PPC_TAR) || (defined(HAVE_DECL_NT_PPC_TAR) && HAVE_DECL_NT_PPC_TAR)) +# define NT_PPC_TAR 0x103 #endif -#if defined(NT_PRXREG) || (defined(HAVE_DECL_NT_PRXREG) && HAVE_DECL_NT_PRXREG) - XLAT(NT_PRXREG), +#if !(defined(NT_PPC_PPR) || (defined(HAVE_DECL_NT_PPC_PPR) && HAVE_DECL_NT_PPC_PPR)) +# define NT_PPC_PPR 0x104 #endif -#if defined(NT_TASKSTRUCT) || (defined(HAVE_DECL_NT_TASKSTRUCT) && HAVE_DECL_NT_TASKSTRUCT) - XLAT(NT_TASKSTRUCT), +#if !(defined(NT_PPC_DSCR) || (defined(HAVE_DECL_NT_PPC_DSCR) && HAVE_DECL_NT_PPC_DSCR)) +# define NT_PPC_DSCR 0x105 #endif -#if defined(NT_PLATFORM) || (defined(HAVE_DECL_NT_PLATFORM) && HAVE_DECL_NT_PLATFORM) - XLAT(NT_PLATFORM), +#if !(defined(NT_PPC_EBB) || (defined(HAVE_DECL_NT_PPC_EBB) && HAVE_DECL_NT_PPC_EBB)) +# define NT_PPC_EBB 0x106 #endif -#if defined(NT_AUXV) || (defined(HAVE_DECL_NT_AUXV) && HAVE_DECL_NT_AUXV) - XLAT(NT_AUXV), +#if !(defined(NT_PPC_PMU) || (defined(HAVE_DECL_NT_PPC_PMU) && HAVE_DECL_NT_PPC_PMU)) +# define NT_PPC_PMU 0x107 #endif -#if defined(NT_GWINDOWS) || (defined(HAVE_DECL_NT_GWINDOWS) && HAVE_DECL_NT_GWINDOWS) - XLAT(NT_GWINDOWS), +#if !(defined(NT_PPC_TM_CGPR) || (defined(HAVE_DECL_NT_PPC_TM_CGPR) && HAVE_DECL_NT_PPC_TM_CGPR)) +# define NT_PPC_TM_CGPR 0x108 #endif -#if defined(NT_ASRS) || (defined(HAVE_DECL_NT_ASRS) && HAVE_DECL_NT_ASRS) - XLAT(NT_ASRS), +#if !(defined(NT_PPC_TM_CFPR) || (defined(HAVE_DECL_NT_PPC_TM_CFPR) && HAVE_DECL_NT_PPC_TM_CFPR)) +# define NT_PPC_TM_CFPR 0x109 #endif -#if defined(NT_PSTATUS) || (defined(HAVE_DECL_NT_PSTATUS) && HAVE_DECL_NT_PSTATUS) - XLAT(NT_PSTATUS), +#if !(defined(NT_PPC_TM_CVMX) || (defined(HAVE_DECL_NT_PPC_TM_CVMX) && HAVE_DECL_NT_PPC_TM_CVMX)) +# define NT_PPC_TM_CVMX 0x10a #endif -#if defined(NT_PSINFO) || (defined(HAVE_DECL_NT_PSINFO) && HAVE_DECL_NT_PSINFO) - XLAT(NT_PSINFO), +#if !(defined(NT_PPC_TM_CVSX) || (defined(HAVE_DECL_NT_PPC_TM_CVSX) && HAVE_DECL_NT_PPC_TM_CVSX)) +# define NT_PPC_TM_CVSX 0x10b #endif -#if defined(NT_PRCRED) || (defined(HAVE_DECL_NT_PRCRED) && HAVE_DECL_NT_PRCRED) - XLAT(NT_PRCRED), +#if !(defined(NT_PPC_TM_SPR) || (defined(HAVE_DECL_NT_PPC_TM_SPR) && HAVE_DECL_NT_PPC_TM_SPR)) +# define NT_PPC_TM_SPR 0x10c #endif -#if defined(NT_UTSNAME) || (defined(HAVE_DECL_NT_UTSNAME) && HAVE_DECL_NT_UTSNAME) - XLAT(NT_UTSNAME), +#if !(defined(NT_PPC_TM_CTAR) || (defined(HAVE_DECL_NT_PPC_TM_CTAR) && HAVE_DECL_NT_PPC_TM_CTAR)) +# define NT_PPC_TM_CTAR 0x10d #endif -#if defined(NT_LWPSTATUS) || (defined(HAVE_DECL_NT_LWPSTATUS) && HAVE_DECL_NT_LWPSTATUS) - XLAT(NT_LWPSTATUS), +#if !(defined(NT_PPC_TM_CPPR) || (defined(HAVE_DECL_NT_PPC_TM_CPPR) && HAVE_DECL_NT_PPC_TM_CPPR)) +# define NT_PPC_TM_CPPR 0x10e #endif -#if defined(NT_LWPSINFO) || (defined(HAVE_DECL_NT_LWPSINFO) && HAVE_DECL_NT_LWPSINFO) - XLAT(NT_LWPSINFO), +#if !(defined(NT_PPC_TM_CDSCR) || (defined(HAVE_DECL_NT_PPC_TM_CDSCR) && HAVE_DECL_NT_PPC_TM_CDSCR)) +# define NT_PPC_TM_CDSCR 0x10f #endif -#if defined(NT_PRFPXREG) || (defined(HAVE_DECL_NT_PRFPXREG) && HAVE_DECL_NT_PRFPXREG) - XLAT(NT_PRFPXREG), +#if !(defined(NT_PPC_PKEY) || (defined(HAVE_DECL_NT_PPC_PKEY) && HAVE_DECL_NT_PPC_PKEY)) +# define NT_PPC_PKEY 0x110 #endif -#if defined(NT_PRXFPREG) || (defined(HAVE_DECL_NT_PRXFPREG) && HAVE_DECL_NT_PRXFPREG) - XLAT(NT_PRXFPREG), +#if !(defined(NT_386_TLS) || (defined(HAVE_DECL_NT_386_TLS) && HAVE_DECL_NT_386_TLS)) +# define NT_386_TLS 0x200 #endif -#if defined(NT_PPC_VMX) || (defined(HAVE_DECL_NT_PPC_VMX) && HAVE_DECL_NT_PPC_VMX) - XLAT(NT_PPC_VMX), +#if !(defined(NT_386_IOPERM) || (defined(HAVE_DECL_NT_386_IOPERM) && HAVE_DECL_NT_386_IOPERM)) +# define NT_386_IOPERM 0x201 #endif -#if defined(NT_PPC_SPE) || (defined(HAVE_DECL_NT_PPC_SPE) && HAVE_DECL_NT_PPC_SPE) - XLAT(NT_PPC_SPE), +#if !(defined(NT_X86_XSTATE) || (defined(HAVE_DECL_NT_X86_XSTATE) && HAVE_DECL_NT_X86_XSTATE)) +# define NT_X86_XSTATE 0x202 #endif -#if defined(NT_PPC_VSX) || (defined(HAVE_DECL_NT_PPC_VSX) && HAVE_DECL_NT_PPC_VSX) - XLAT(NT_PPC_VSX), +#if !(defined(NT_S390_HIGH_GPRS) || (defined(HAVE_DECL_NT_S390_HIGH_GPRS) && HAVE_DECL_NT_S390_HIGH_GPRS)) +# define NT_S390_HIGH_GPRS 0x300 #endif -#if defined(NT_386_TLS) || (defined(HAVE_DECL_NT_386_TLS) && HAVE_DECL_NT_386_TLS) - XLAT(NT_386_TLS), +#if !(defined(NT_S390_TIMER) || (defined(HAVE_DECL_NT_S390_TIMER) && HAVE_DECL_NT_S390_TIMER)) +# define NT_S390_TIMER 0x301 #endif -#if defined(NT_386_IOPERM) || (defined(HAVE_DECL_NT_386_IOPERM) && HAVE_DECL_NT_386_IOPERM) - XLAT(NT_386_IOPERM), +#if !(defined(NT_S390_TODCMP) || (defined(HAVE_DECL_NT_S390_TODCMP) && HAVE_DECL_NT_S390_TODCMP)) +# define NT_S390_TODCMP 0x302 #endif -#if defined(NT_X86_XSTATE) || (defined(HAVE_DECL_NT_X86_XSTATE) && HAVE_DECL_NT_X86_XSTATE) - XLAT(NT_X86_XSTATE), +#if !(defined(NT_S390_TODPREG) || (defined(HAVE_DECL_NT_S390_TODPREG) && HAVE_DECL_NT_S390_TODPREG)) +# define NT_S390_TODPREG 0x303 #endif +#if !(defined(NT_S390_CTRS) || (defined(HAVE_DECL_NT_S390_CTRS) && HAVE_DECL_NT_S390_CTRS)) +# define NT_S390_CTRS 0x304 +#endif +#if !(defined(NT_S390_PREFIX) || (defined(HAVE_DECL_NT_S390_PREFIX) && HAVE_DECL_NT_S390_PREFIX)) +# define NT_S390_PREFIX 0x305 +#endif +#if !(defined(NT_S390_LAST_BREAK) || (defined(HAVE_DECL_NT_S390_LAST_BREAK) && HAVE_DECL_NT_S390_LAST_BREAK)) +# define NT_S390_LAST_BREAK 0x306 +#endif +#if !(defined(NT_S390_SYSTEM_CALL) || (defined(HAVE_DECL_NT_S390_SYSTEM_CALL) && HAVE_DECL_NT_S390_SYSTEM_CALL)) +# define NT_S390_SYSTEM_CALL 0x307 +#endif +#if !(defined(NT_S390_TDB) || (defined(HAVE_DECL_NT_S390_TDB) && HAVE_DECL_NT_S390_TDB)) +# define NT_S390_TDB 0x308 +#endif +#if !(defined(NT_S390_VXRS_LOW) || (defined(HAVE_DECL_NT_S390_VXRS_LOW) && HAVE_DECL_NT_S390_VXRS_LOW)) +# define NT_S390_VXRS_LOW 0x309 +#endif +#if !(defined(NT_S390_VXRS_HIGH) || (defined(HAVE_DECL_NT_S390_VXRS_HIGH) && HAVE_DECL_NT_S390_VXRS_HIGH)) +# define NT_S390_VXRS_HIGH 0x30a +#endif +#if !(defined(NT_S390_GS_CB) || (defined(HAVE_DECL_NT_S390_GS_CB) && HAVE_DECL_NT_S390_GS_CB)) +# define NT_S390_GS_CB 0x30b +#endif +#if !(defined(NT_S390_GS_BC) || (defined(HAVE_DECL_NT_S390_GS_BC) && HAVE_DECL_NT_S390_GS_BC)) +# define NT_S390_GS_BC 0x30c +#endif +#if !(defined(NT_S390_RI_CB) || (defined(HAVE_DECL_NT_S390_RI_CB) && HAVE_DECL_NT_S390_RI_CB)) +# define NT_S390_RI_CB 0x30d +#endif +#if !(defined(NT_ARM_VFP) || (defined(HAVE_DECL_NT_ARM_VFP) && HAVE_DECL_NT_ARM_VFP)) +# define NT_ARM_VFP 0x400 +#endif +#if !(defined(NT_ARM_TLS) || (defined(HAVE_DECL_NT_ARM_TLS) && HAVE_DECL_NT_ARM_TLS)) +# define NT_ARM_TLS 0x401 +#endif +#if !(defined(NT_ARM_HW_BREAK) || (defined(HAVE_DECL_NT_ARM_HW_BREAK) && HAVE_DECL_NT_ARM_HW_BREAK)) +# define NT_ARM_HW_BREAK 0x402 +#endif +#if !(defined(NT_ARM_HW_WATCH) || (defined(HAVE_DECL_NT_ARM_HW_WATCH) && HAVE_DECL_NT_ARM_HW_WATCH)) +# define NT_ARM_HW_WATCH 0x403 +#endif +#if !(defined(NT_ARM_SYSTEM_CALL) || (defined(HAVE_DECL_NT_ARM_SYSTEM_CALL) && HAVE_DECL_NT_ARM_SYSTEM_CALL)) +# define NT_ARM_SYSTEM_CALL 0x404 +#endif +#if !(defined(NT_ARM_SVE) || (defined(HAVE_DECL_NT_ARM_SVE) && HAVE_DECL_NT_ARM_SVE)) +# define NT_ARM_SVE 0x405 +#endif +#if !(defined(NT_METAG_CBUF) || (defined(HAVE_DECL_NT_METAG_CBUF) && HAVE_DECL_NT_METAG_CBUF)) +# define NT_METAG_CBUF 0x500 +#endif +#if !(defined(NT_METAG_RPIPE) || (defined(HAVE_DECL_NT_METAG_RPIPE) && HAVE_DECL_NT_METAG_RPIPE)) +# define NT_METAG_RPIPE 0x501 +#endif +#if !(defined(NT_METAG_TLS) || (defined(HAVE_DECL_NT_METAG_TLS) && HAVE_DECL_NT_METAG_TLS)) +# define NT_METAG_TLS 0x502 +#endif +#if !(defined(NT_ARC_V2) || (defined(HAVE_DECL_NT_ARC_V2) && HAVE_DECL_NT_ARC_V2)) +# define NT_ARC_V2 0x600 +#endif + +#ifdef IN_MPERS + +# error static const struct xlat nt_descriptor_types in mpers mode + +#else + +static +const struct xlat nt_descriptor_types[] = { + XLAT(NT_PRSTATUS), + XLAT(NT_FPREGSET), + XLAT(NT_PRPSINFO), + XLAT(NT_PRXREG), + XLAT(NT_TASKSTRUCT), + XLAT(NT_PLATFORM), + XLAT(NT_AUXV), + XLAT(NT_GWINDOWS), + XLAT(NT_ASRS), + XLAT(NT_PSTATUS), + XLAT(NT_PSINFO), + XLAT(NT_PRCRED), + XLAT(NT_UTSNAME), + XLAT(NT_LWPSTATUS), + XLAT(NT_LWPSINFO), + XLAT(NT_PRFPXREG), + XLAT(NT_SIGINFO), + XLAT(NT_FILE), + XLAT(NT_PRXFPREG), + XLAT(NT_PPC_VMX), + XLAT(NT_PPC_SPE), + XLAT(NT_PPC_VSX), + XLAT(NT_PPC_TAR), + XLAT(NT_PPC_PPR), + XLAT(NT_PPC_DSCR), + XLAT(NT_PPC_EBB), + XLAT(NT_PPC_PMU), + XLAT(NT_PPC_TM_CGPR), + XLAT(NT_PPC_TM_CFPR), + XLAT(NT_PPC_TM_CVMX), + XLAT(NT_PPC_TM_CVSX), + XLAT(NT_PPC_TM_SPR), + XLAT(NT_PPC_TM_CTAR), + XLAT(NT_PPC_TM_CPPR), + XLAT(NT_PPC_TM_CDSCR), + XLAT(NT_PPC_PKEY), + XLAT(NT_386_TLS), + XLAT(NT_386_IOPERM), + XLAT(NT_X86_XSTATE), + XLAT(NT_S390_HIGH_GPRS), + XLAT(NT_S390_TIMER), + XLAT(NT_S390_TODCMP), + XLAT(NT_S390_TODPREG), + XLAT(NT_S390_CTRS), + XLAT(NT_S390_PREFIX), + XLAT(NT_S390_LAST_BREAK), + XLAT(NT_S390_SYSTEM_CALL), + XLAT(NT_S390_TDB), + XLAT(NT_S390_VXRS_LOW), + XLAT(NT_S390_VXRS_HIGH), + XLAT(NT_S390_GS_CB), + XLAT(NT_S390_GS_BC), + XLAT(NT_S390_RI_CB), + XLAT(NT_ARM_VFP), + XLAT(NT_ARM_TLS), + XLAT(NT_ARM_HW_BREAK), + XLAT(NT_ARM_HW_WATCH), + XLAT(NT_ARM_SYSTEM_CALL), + XLAT(NT_ARM_SVE), + XLAT(NT_METAG_CBUF), + XLAT(NT_METAG_RPIPE), + XLAT(NT_METAG_TLS), + XLAT(NT_ARC_V2), XLAT_END }; diff --git a/xlat/nt_descriptor_types.in b/xlat/nt_descriptor_types.in index 5e47d661..d90b8708 100644 --- a/xlat/nt_descriptor_types.in +++ b/xlat/nt_descriptor_types.in @@ -1,23 +1,63 @@ -NT_PRSTATUS -NT_FPREGSET -NT_PRPSINFO -NT_PRXREG -NT_TASKSTRUCT -NT_PLATFORM -NT_AUXV -NT_GWINDOWS -NT_ASRS -NT_PSTATUS -NT_PSINFO -NT_PRCRED -NT_UTSNAME -NT_LWPSTATUS -NT_LWPSINFO -NT_PRFPXREG -NT_PRXFPREG -NT_PPC_VMX -NT_PPC_SPE -NT_PPC_VSX -NT_386_TLS -NT_386_IOPERM -NT_X86_XSTATE +NT_PRSTATUS 1 +NT_FPREGSET 2 +NT_PRPSINFO 3 +NT_PRXREG 4 +NT_TASKSTRUCT 4 +NT_PLATFORM 5 +NT_AUXV 6 +NT_GWINDOWS 7 +NT_ASRS 8 +NT_PSTATUS 10 +NT_PSINFO 13 +NT_PRCRED 14 +NT_UTSNAME 15 +NT_LWPSTATUS 16 +NT_LWPSINFO 17 +NT_PRFPXREG 20 +NT_SIGINFO 0x53494749 +NT_FILE 0x46494c45 +NT_PRXFPREG 0x46e62b7f +NT_PPC_VMX 0x100 +NT_PPC_SPE 0x101 +NT_PPC_VSX 0x102 +NT_PPC_TAR 0x103 +NT_PPC_PPR 0x104 +NT_PPC_DSCR 0x105 +NT_PPC_EBB 0x106 +NT_PPC_PMU 0x107 +NT_PPC_TM_CGPR 0x108 +NT_PPC_TM_CFPR 0x109 +NT_PPC_TM_CVMX 0x10a +NT_PPC_TM_CVSX 0x10b +NT_PPC_TM_SPR 0x10c +NT_PPC_TM_CTAR 0x10d +NT_PPC_TM_CPPR 0x10e +NT_PPC_TM_CDSCR 0x10f +NT_PPC_PKEY 0x110 +NT_386_TLS 0x200 +NT_386_IOPERM 0x201 +NT_X86_XSTATE 0x202 +NT_S390_HIGH_GPRS 0x300 +NT_S390_TIMER 0x301 +NT_S390_TODCMP 0x302 +NT_S390_TODPREG 0x303 +NT_S390_CTRS 0x304 +NT_S390_PREFIX 0x305 +NT_S390_LAST_BREAK 0x306 +NT_S390_SYSTEM_CALL 0x307 +NT_S390_TDB 0x308 +NT_S390_VXRS_LOW 0x309 +NT_S390_VXRS_HIGH 0x30a +NT_S390_GS_CB 0x30b +NT_S390_GS_BC 0x30c +NT_S390_RI_CB 0x30d +NT_ARM_VFP 0x400 +NT_ARM_TLS 0x401 +NT_ARM_HW_BREAK 0x402 +NT_ARM_HW_WATCH 0x403 +NT_ARM_SYSTEM_CALL 0x404 +NT_ARM_SVE 0x405 +NT_METAG_CBUF 0x500 +NT_METAG_RPIPE 0x501 +NT_METAG_TLS 0x502 +NT_ARC_V2 0x600 diff --git a/xlat/open_mode_flags.h b/xlat/open_mode_flags.h index f81f16bb..1dfb186c 100644 --- a/xlat/open_mode_flags.h +++ b/xlat/open_mode_flags.h @@ -1,8 +1,6 @@ /* Generated by ./xlat/gen.sh from ./xlat/open_mode_flags.in; do not edit. */ #if defined(O_NDELAY) && (O_NDELAY != O_NONBLOCK) #endif -#if defined(O_TMPFILE) && defined(O_DIRECTORY) -#endif #ifndef IN_MPERS @@ -25,9 +23,13 @@ const struct xlat open_mode_flags[] = { #if defined(O_NONBLOCK) || (defined(HAVE_DECL_O_NONBLOCK) && HAVE_DECL_O_NONBLOCK) XLAT(O_NONBLOCK), #endif + #if defined(O_SYNC) || (defined(HAVE_DECL_O_SYNC) && HAVE_DECL_O_SYNC) XLAT(O_SYNC), #endif +#if defined(__O_SYNC) || (defined(HAVE_DECL___O_SYNC) && HAVE_DECL___O_SYNC) + XLAT(__O_SYNC), +#endif #if defined(O_ASYNC) || (defined(HAVE_DECL_O_ASYNC) && HAVE_DECL_O_ASYNC) XLAT(O_ASYNC), #endif @@ -51,9 +53,6 @@ const struct xlat open_mode_flags[] = { #if defined(O_LARGEFILE) || (defined(HAVE_DECL_O_LARGEFILE) && HAVE_DECL_O_LARGEFILE) XLAT(O_LARGEFILE), #endif -#if defined(O_DIRECTORY) || (defined(HAVE_DECL_O_DIRECTORY) && HAVE_DECL_O_DIRECTORY) - XLAT(O_DIRECTORY), -#endif #if defined(O_NOFOLLOW) || (defined(HAVE_DECL_O_NOFOLLOW) && HAVE_DECL_O_NOFOLLOW) XLAT(O_NOFOLLOW), #endif @@ -66,9 +65,15 @@ const struct xlat open_mode_flags[] = { #if defined(O_PATH) || (defined(HAVE_DECL_O_PATH) && HAVE_DECL_O_PATH) XLAT(O_PATH), #endif -#if defined(O_TMPFILE) && defined(O_DIRECTORY) -/* The kernel & C libraries often inline O_DIRECTORY */ -{ O_TMPFILE & ~O_DIRECTORY, "O_TMPFILE" }, + +#if defined(O_TMPFILE) || (defined(HAVE_DECL_O_TMPFILE) && HAVE_DECL_O_TMPFILE) + XLAT(O_TMPFILE), +#endif +#if defined(__O_TMPFILE) || (defined(HAVE_DECL___O_TMPFILE) && HAVE_DECL___O_TMPFILE) + XLAT(__O_TMPFILE), +#endif +#if defined(O_DIRECTORY) || (defined(HAVE_DECL_O_DIRECTORY) && HAVE_DECL_O_DIRECTORY) + XLAT(O_DIRECTORY), #endif #if defined(FNDELAY) || (defined(HAVE_DECL_FNDELAY) && HAVE_DECL_FNDELAY) XLAT(FNDELAY), diff --git a/xlat/open_mode_flags.in b/xlat/open_mode_flags.in index 30bed260..e2371055 100644 --- a/xlat/open_mode_flags.in +++ b/xlat/open_mode_flags.in @@ -4,7 +4,9 @@ O_NOCTTY O_TRUNC O_APPEND O_NONBLOCK +/* O_SYNC should be listed before O_DSYNC and __O_SYNC */ O_SYNC +__O_SYNC O_ASYNC O_DSYNC O_RSYNC @@ -14,15 +16,14 @@ O_NDELAY O_PRIV O_DIRECT O_LARGEFILE -O_DIRECTORY O_NOFOLLOW O_NOATIME O_CLOEXEC O_PATH -#if defined(O_TMPFILE) && defined(O_DIRECTORY) -/* The kernel & C libraries often inline O_DIRECTORY */ -{ O_TMPFILE & ~O_DIRECTORY, "O_TMPFILE" }, -#endif +/* O_TMPFILE should be listed before O_DIRECTORY and __O_TMPFILE */ +O_TMPFILE +__O_TMPFILE +O_DIRECTORY FNDELAY FAPPEND FMARK diff --git a/xlat/perf_branch_sample_type.h b/xlat/perf_branch_sample_type.h index 6d710939..7c6a5bf8 100644 --- a/xlat/perf_branch_sample_type.h +++ b/xlat/perf_branch_sample_type.h @@ -47,6 +47,9 @@ #if !(defined(PERF_SAMPLE_BRANCH_NO_CYCLES) || (defined(HAVE_DECL_PERF_SAMPLE_BRANCH_NO_CYCLES) && HAVE_DECL_PERF_SAMPLE_BRANCH_NO_CYCLES)) # define PERF_SAMPLE_BRANCH_NO_CYCLES 1 << 15 #endif +#if !(defined(PERF_SAMPLE_BRANCH_TYPE_SAVE) || (defined(HAVE_DECL_PERF_SAMPLE_BRANCH_TYPE_SAVE) && HAVE_DECL_PERF_SAMPLE_BRANCH_TYPE_SAVE)) +# define PERF_SAMPLE_BRANCH_TYPE_SAVE 1 << 16 +#endif #ifdef IN_MPERS @@ -72,6 +75,7 @@ const struct xlat perf_branch_sample_type[] = { XLAT(PERF_SAMPLE_BRANCH_CALL), XLAT(PERF_SAMPLE_BRANCH_NO_FLAGS), XLAT(PERF_SAMPLE_BRANCH_NO_CYCLES), + XLAT(PERF_SAMPLE_BRANCH_TYPE_SAVE), XLAT_END }; diff --git a/xlat/perf_branch_sample_type.in b/xlat/perf_branch_sample_type.in index 0e33d980..9370569d 100644 --- a/xlat/perf_branch_sample_type.in +++ b/xlat/perf_branch_sample_type.in @@ -14,3 +14,4 @@ PERF_SAMPLE_BRANCH_IND_JUMP 1 << 12 PERF_SAMPLE_BRANCH_CALL 1 << 13 PERF_SAMPLE_BRANCH_NO_FLAGS 1 << 14 PERF_SAMPLE_BRANCH_NO_CYCLES 1 << 15 +PERF_SAMPLE_BRANCH_TYPE_SAVE 1 << 16 diff --git a/xlat/perf_event_sample_format.h b/xlat/perf_event_sample_format.h index c4b04229..42094ba2 100644 --- a/xlat/perf_event_sample_format.h +++ b/xlat/perf_event_sample_format.h @@ -56,6 +56,9 @@ #if !(defined(PERF_SAMPLE_REGS_INTR) || (defined(HAVE_DECL_PERF_SAMPLE_REGS_INTR) && HAVE_DECL_PERF_SAMPLE_REGS_INTR)) # define PERF_SAMPLE_REGS_INTR 1 << 18 #endif +#if !(defined(PERF_SAMPLE_PHYS_ADDR) || (defined(HAVE_DECL_PERF_SAMPLE_PHYS_ADDR) && HAVE_DECL_PERF_SAMPLE_PHYS_ADDR)) +# define PERF_SAMPLE_PHYS_ADDR 1 << 19 +#endif #ifdef IN_MPERS @@ -84,6 +87,7 @@ const struct xlat perf_event_sample_format[] = { XLAT(PERF_SAMPLE_IDENTIFIER), XLAT(PERF_SAMPLE_TRANSACTION), XLAT(PERF_SAMPLE_REGS_INTR), + XLAT(PERF_SAMPLE_PHYS_ADDR), XLAT_END }; diff --git a/xlat/perf_event_sample_format.in b/xlat/perf_event_sample_format.in index 6203e174..d310754e 100644 --- a/xlat/perf_event_sample_format.in +++ b/xlat/perf_event_sample_format.in @@ -17,3 +17,4 @@ PERF_SAMPLE_DATA_SRC 1 << 15 PERF_SAMPLE_IDENTIFIER 1 << 16 PERF_SAMPLE_TRANSACTION 1 << 17 PERF_SAMPLE_REGS_INTR 1 << 18 +PERF_SAMPLE_PHYS_ADDR 1 << 19 diff --git a/xlat/personality_flags.h b/xlat/personality_flags.h index 1941e146..6c32b735 100644 --- a/xlat/personality_flags.h +++ b/xlat/personality_flags.h @@ -1,4 +1,37 @@ /* Generated by ./xlat/gen.sh from ./xlat/personality_flags.in; do not edit. */ +#if !(defined(UNAME26) || (defined(HAVE_DECL_UNAME26) && HAVE_DECL_UNAME26)) +# define UNAME26 0x0020000 +#endif +#if !(defined(ADDR_NO_RANDOMIZE) || (defined(HAVE_DECL_ADDR_NO_RANDOMIZE) && HAVE_DECL_ADDR_NO_RANDOMIZE)) +# define ADDR_NO_RANDOMIZE 0x0040000 +#endif +#if !(defined(FDPIC_FUNCPTRS) || (defined(HAVE_DECL_FDPIC_FUNCPTRS) && HAVE_DECL_FDPIC_FUNCPTRS)) +# define FDPIC_FUNCPTRS 0x0080000 +#endif +#if !(defined(MMAP_PAGE_ZERO) || (defined(HAVE_DECL_MMAP_PAGE_ZERO) && HAVE_DECL_MMAP_PAGE_ZERO)) +# define MMAP_PAGE_ZERO 0x0100000 +#endif +#if !(defined(ADDR_COMPAT_LAYOUT) || (defined(HAVE_DECL_ADDR_COMPAT_LAYOUT) && HAVE_DECL_ADDR_COMPAT_LAYOUT)) +# define ADDR_COMPAT_LAYOUT 0x0200000 +#endif +#if !(defined(READ_IMPLIES_EXEC) || (defined(HAVE_DECL_READ_IMPLIES_EXEC) && HAVE_DECL_READ_IMPLIES_EXEC)) +# define READ_IMPLIES_EXEC 0x0400000 +#endif +#if !(defined(ADDR_LIMIT_32BIT) || (defined(HAVE_DECL_ADDR_LIMIT_32BIT) && HAVE_DECL_ADDR_LIMIT_32BIT)) +# define ADDR_LIMIT_32BIT 0x0800000 +#endif +#if !(defined(SHORT_INODE) || (defined(HAVE_DECL_SHORT_INODE) && HAVE_DECL_SHORT_INODE)) +# define SHORT_INODE 0x1000000 +#endif +#if !(defined(WHOLE_SECONDS) || (defined(HAVE_DECL_WHOLE_SECONDS) && HAVE_DECL_WHOLE_SECONDS)) +# define WHOLE_SECONDS 0x2000000 +#endif +#if !(defined(STICKY_TIMEOUTS) || (defined(HAVE_DECL_STICKY_TIMEOUTS) && HAVE_DECL_STICKY_TIMEOUTS)) +# define STICKY_TIMEOUTS 0x4000000 +#endif +#if !(defined(ADDR_LIMIT_3GB) || (defined(HAVE_DECL_ADDR_LIMIT_3GB) && HAVE_DECL_ADDR_LIMIT_3GB)) +# define ADDR_LIMIT_3GB 0x8000000 +#endif #ifdef IN_MPERS diff --git a/xlat/personality_flags.in b/xlat/personality_flags.in index a8715e2f..886b5b99 100644 --- a/xlat/personality_flags.in +++ b/xlat/personality_flags.in @@ -1,12 +1,11 @@ -#unconditional -UNAME26 -ADDR_NO_RANDOMIZE -FDPIC_FUNCPTRS -MMAP_PAGE_ZERO -ADDR_COMPAT_LAYOUT -READ_IMPLIES_EXEC -ADDR_LIMIT_32BIT -SHORT_INODE -WHOLE_SECONDS -STICKY_TIMEOUTS -ADDR_LIMIT_3GB +UNAME26 0x0020000 +ADDR_NO_RANDOMIZE 0x0040000 +FDPIC_FUNCPTRS 0x0080000 +MMAP_PAGE_ZERO 0x0100000 +ADDR_COMPAT_LAYOUT 0x0200000 +READ_IMPLIES_EXEC 0x0400000 +ADDR_LIMIT_32BIT 0x0800000 +SHORT_INODE 0x1000000 +WHOLE_SECONDS 0x2000000 +STICKY_TIMEOUTS 0x4000000 +ADDR_LIMIT_3GB 0x8000000 diff --git a/xlat/personality_types.h b/xlat/personality_types.h index 859ded3d..8e1e1e2c 100644 --- a/xlat/personality_types.h +++ b/xlat/personality_types.h @@ -1,4 +1,73 @@ /* Generated by ./xlat/gen.sh from ./xlat/personality_types.in; do not edit. */ +#if !(defined(PER_LINUX) || (defined(HAVE_DECL_PER_LINUX) && HAVE_DECL_PER_LINUX)) +# define PER_LINUX 0 +#endif +#if !(defined(PER_LINUX_32BIT) || (defined(HAVE_DECL_PER_LINUX_32BIT) && HAVE_DECL_PER_LINUX_32BIT)) +# define PER_LINUX_32BIT ADDR_LIMIT_32BIT +#endif +#if !(defined(PER_LINUX_FDPIC) || (defined(HAVE_DECL_PER_LINUX_FDPIC) && HAVE_DECL_PER_LINUX_FDPIC)) +# define PER_LINUX_FDPIC FDPIC_FUNCPTRS +#endif +#if !(defined(PER_SVR4) || (defined(HAVE_DECL_PER_SVR4) && HAVE_DECL_PER_SVR4)) +# define PER_SVR4 (0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO) +#endif +#if !(defined(PER_SVR3) || (defined(HAVE_DECL_PER_SVR3) && HAVE_DECL_PER_SVR3)) +# define PER_SVR3 (0x0002 | STICKY_TIMEOUTS | SHORT_INODE) +#endif +#if !(defined(PER_SCOSVR3) || (defined(HAVE_DECL_PER_SCOSVR3) && HAVE_DECL_PER_SCOSVR3)) +# define PER_SCOSVR3 (0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE) +#endif +#if !(defined(PER_OSR5) || (defined(HAVE_DECL_PER_OSR5) && HAVE_DECL_PER_OSR5)) +# define PER_OSR5 (0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS) +#endif +#if !(defined(PER_WYSEV386) || (defined(HAVE_DECL_PER_WYSEV386) && HAVE_DECL_PER_WYSEV386)) +# define PER_WYSEV386 (0x0004 | STICKY_TIMEOUTS | SHORT_INODE) +#endif +#if !(defined(PER_ISCR4) || (defined(HAVE_DECL_PER_ISCR4) && HAVE_DECL_PER_ISCR4)) +# define PER_ISCR4 (0x0005 | STICKY_TIMEOUTS) +#endif +#if !(defined(PER_BSD) || (defined(HAVE_DECL_PER_BSD) && HAVE_DECL_PER_BSD)) +# define PER_BSD 0x0006 +#endif +#if !(defined(PER_SUNOS) || (defined(HAVE_DECL_PER_SUNOS) && HAVE_DECL_PER_SUNOS)) +# define PER_SUNOS (0x0006 | STICKY_TIMEOUTS) +#endif +#if !(defined(PER_XENIX) || (defined(HAVE_DECL_PER_XENIX) && HAVE_DECL_PER_XENIX)) +# define PER_XENIX (0x0007 | STICKY_TIMEOUTS | SHORT_INODE) +#endif +#if !(defined(PER_LINUX32) || (defined(HAVE_DECL_PER_LINUX32) && HAVE_DECL_PER_LINUX32)) +# define PER_LINUX32 0x0008 +#endif +#if !(defined(PER_LINUX32_3GB) || (defined(HAVE_DECL_PER_LINUX32_3GB) && HAVE_DECL_PER_LINUX32_3GB)) +# define PER_LINUX32_3GB (0x0008 | ADDR_LIMIT_3GB) +#endif +#if !(defined(PER_IRIX32) || (defined(HAVE_DECL_PER_IRIX32) && HAVE_DECL_PER_IRIX32)) +# define PER_IRIX32 (0x0009 | STICKY_TIMEOUTS) +#endif +#if !(defined(PER_IRIXN32) || (defined(HAVE_DECL_PER_IRIXN32) && HAVE_DECL_PER_IRIXN32)) +# define PER_IRIXN32 (0x000a | STICKY_TIMEOUTS) +#endif +#if !(defined(PER_IRIX64) || (defined(HAVE_DECL_PER_IRIX64) && HAVE_DECL_PER_IRIX64)) +# define PER_IRIX64 (0x000b | STICKY_TIMEOUTS) +#endif +#if !(defined(PER_RISCOS) || (defined(HAVE_DECL_PER_RISCOS) && HAVE_DECL_PER_RISCOS)) +# define PER_RISCOS 0x000c +#endif +#if !(defined(PER_SOLARIS) || (defined(HAVE_DECL_PER_SOLARIS) && HAVE_DECL_PER_SOLARIS)) +# define PER_SOLARIS (0x000d | STICKY_TIMEOUTS) +#endif +#if !(defined(PER_UW7) || (defined(HAVE_DECL_PER_UW7) && HAVE_DECL_PER_UW7)) +# define PER_UW7 (0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO) +#endif +#if !(defined(PER_OSF4) || (defined(HAVE_DECL_PER_OSF4) && HAVE_DECL_PER_OSF4)) +# define PER_OSF4 0x000f +#endif +#if !(defined(PER_HPUX) || (defined(HAVE_DECL_PER_HPUX) && HAVE_DECL_PER_HPUX)) +# define PER_HPUX 0x0010 +#endif +#if !(defined(PER_MASK) || (defined(HAVE_DECL_PER_MASK) && HAVE_DECL_PER_MASK)) +# define PER_MASK 0x00ff +#endif #ifdef IN_MPERS @@ -30,6 +99,7 @@ const struct xlat personality_types[] = { XLAT(PER_UW7), XLAT(PER_OSF4), XLAT(PER_HPUX), + XLAT(PER_MASK), XLAT_END }; diff --git a/xlat/personality_types.in b/xlat/personality_types.in index 6832c65d..5b2f545d 100644 --- a/xlat/personality_types.in +++ b/xlat/personality_types.in @@ -1,23 +1,23 @@ -#unconditional -PER_LINUX -PER_LINUX_32BIT -PER_LINUX_FDPIC -PER_SVR4 -PER_SVR3 -PER_SCOSVR3 -PER_OSR5 -PER_WYSEV386 -PER_ISCR4 -PER_BSD -PER_SUNOS -PER_XENIX -PER_LINUX32 -PER_LINUX32_3GB -PER_IRIX32 -PER_IRIXN32 -PER_IRIX64 -PER_RISCOS -PER_SOLARIS -PER_UW7 -PER_OSF4 -PER_HPUX +PER_LINUX 0 +PER_LINUX_32BIT ADDR_LIMIT_32BIT +PER_LINUX_FDPIC FDPIC_FUNCPTRS +PER_SVR4 (0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO) +PER_SVR3 (0x0002 | STICKY_TIMEOUTS | SHORT_INODE) +PER_SCOSVR3 (0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE) +PER_OSR5 (0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS) +PER_WYSEV386 (0x0004 | STICKY_TIMEOUTS | SHORT_INODE) +PER_ISCR4 (0x0005 | STICKY_TIMEOUTS) +PER_BSD 0x0006 +PER_SUNOS (0x0006 | STICKY_TIMEOUTS) +PER_XENIX (0x0007 | STICKY_TIMEOUTS | SHORT_INODE) +PER_LINUX32 0x0008 +PER_LINUX32_3GB (0x0008 | ADDR_LIMIT_3GB) +PER_IRIX32 (0x0009 | STICKY_TIMEOUTS) +PER_IRIXN32 (0x000a | STICKY_TIMEOUTS) +PER_IRIX64 (0x000b | STICKY_TIMEOUTS) +PER_RISCOS 0x000c +PER_SOLARIS (0x000d | STICKY_TIMEOUTS) +PER_UW7 (0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO) +PER_OSF4 0x000f +PER_HPUX 0x0010 +PER_MASK 0x00ff diff --git a/xlat/pkey_access.h b/xlat/pkey_access.h index 161c9e5d..f9f31e0c 100644 --- a/xlat/pkey_access.h +++ b/xlat/pkey_access.h @@ -5,6 +5,9 @@ #if !(defined(PKEY_DISABLE_WRITE) || (defined(HAVE_DECL_PKEY_DISABLE_WRITE) && HAVE_DECL_PKEY_DISABLE_WRITE)) # define PKEY_DISABLE_WRITE 0x2 #endif +#if !(defined(PKEY_DISABLE_EXECUTE) || (defined(HAVE_DECL_PKEY_DISABLE_EXECUTE) && HAVE_DECL_PKEY_DISABLE_EXECUTE)) +# define PKEY_DISABLE_EXECUTE 0x4 +#endif #ifdef IN_MPERS @@ -16,6 +19,7 @@ static const struct xlat pkey_access[] = { XLAT(PKEY_DISABLE_ACCESS), XLAT(PKEY_DISABLE_WRITE), + XLAT(PKEY_DISABLE_EXECUTE), XLAT_END }; diff --git a/xlat/pkey_access.in b/xlat/pkey_access.in index 37372a88..108eb3b7 100644 --- a/xlat/pkey_access.in +++ b/xlat/pkey_access.in @@ -1,2 +1,3 @@ PKEY_DISABLE_ACCESS 0x1 PKEY_DISABLE_WRITE 0x2 +PKEY_DISABLE_EXECUTE 0x4 diff --git a/xlat/pr_dumpable.h b/xlat/pr_dumpable.h index b101482e..4e625bcc 100644 --- a/xlat/pr_dumpable.h +++ b/xlat/pr_dumpable.h @@ -1,12 +1,12 @@ /* Generated by ./xlat/gen.sh from ./xlat/pr_dumpable.in; do not edit. */ #if !(defined(SUID_DUMP_DISABLE) || (defined(HAVE_DECL_SUID_DUMP_DISABLE) && HAVE_DECL_SUID_DUMP_DISABLE)) -# define SUID_DUMP_DISABLE 0 /* No setuid dumping */ +# define SUID_DUMP_DISABLE 0 #endif #if !(defined(SUID_DUMP_USER) || (defined(HAVE_DECL_SUID_DUMP_USER) && HAVE_DECL_SUID_DUMP_USER)) -# define SUID_DUMP_USER 1 /* Dump as user of process */ +# define SUID_DUMP_USER 1 #endif #if !(defined(SUID_DUMP_ROOT) || (defined(HAVE_DECL_SUID_DUMP_ROOT) && HAVE_DECL_SUID_DUMP_ROOT)) -# define SUID_DUMP_ROOT 2 /* Dump as root */ +# define SUID_DUMP_ROOT 2 #endif #ifdef IN_MPERS @@ -17,7 +17,7 @@ static const struct xlat pr_dumpable[] = { -/* Defined in include/linux/sched.h */ + XLAT(SUID_DUMP_DISABLE), XLAT(SUID_DUMP_USER), XLAT(SUID_DUMP_ROOT), diff --git a/xlat/pr_fp_mode.h b/xlat/pr_fp_mode.h index 90275021..4620c489 100644 --- a/xlat/pr_fp_mode.h +++ b/xlat/pr_fp_mode.h @@ -1,9 +1,9 @@ /* Generated by ./xlat/gen.sh from ./xlat/pr_fp_mode.in; do not edit. */ #if !(defined(PR_FP_MODE_FR) || (defined(HAVE_DECL_PR_FP_MODE_FR) && HAVE_DECL_PR_FP_MODE_FR)) -# define PR_FP_MODE_FR (1 << 0) /* 64b FP registers */ +# define PR_FP_MODE_FR (1 << 0) #endif #if !(defined(PR_FP_MODE_FRE) || (defined(HAVE_DECL_PR_FP_MODE_FRE) && HAVE_DECL_PR_FP_MODE_FRE)) -# define PR_FP_MODE_FRE (1 << 1) /* 32b compatibility */ +# define PR_FP_MODE_FRE (1 << 1) #endif #ifdef IN_MPERS diff --git a/xlat/ptrace_cmds.h b/xlat/ptrace_cmds.h index ee9ebe22..107cea41 100644 --- a/xlat/ptrace_cmds.h +++ b/xlat/ptrace_cmds.h @@ -113,7 +113,7 @@ const struct xlat ptrace_cmds[] = { #if defined(PTRACE_SECCOMP_GET_FILTER) || (defined(HAVE_DECL_PTRACE_SECCOMP_GET_FILTER) && HAVE_DECL_PTRACE_SECCOMP_GET_FILTER) XLAT(PTRACE_SECCOMP_GET_FILTER), #endif -/* arch-specific */ + #if defined(PTRACE_GET_THREAD_AREA) || (defined(HAVE_DECL_PTRACE_GET_THREAD_AREA) && HAVE_DECL_PTRACE_GET_THREAD_AREA) XLAT(PTRACE_GET_THREAD_AREA), #endif @@ -129,7 +129,7 @@ const struct xlat ptrace_cmds[] = { #if defined(PTRACE_SINGLEBLOCK) || (defined(HAVE_DECL_PTRACE_SINGLEBLOCK) && HAVE_DECL_PTRACE_SINGLEBLOCK) XLAT(PTRACE_SINGLEBLOCK), #endif -/* arm */ + #if defined(PTRACE_GETWMMXREGS) || (defined(HAVE_DECL_PTRACE_GETWMMXREGS) && HAVE_DECL_PTRACE_GETWMMXREGS) XLAT(PTRACE_GETWMMXREGS), #endif @@ -154,14 +154,14 @@ const struct xlat ptrace_cmds[] = { #if defined(PTRACE_SETHBPREGS) || (defined(HAVE_DECL_PTRACE_SETHBPREGS) && HAVE_DECL_PTRACE_SETHBPREGS) XLAT(PTRACE_SETHBPREGS), #endif -/* ia64 */ + #if defined(PTRACE_OLD_GETSIGINFO) || (defined(HAVE_DECL_PTRACE_OLD_GETSIGINFO) && HAVE_DECL_PTRACE_OLD_GETSIGINFO) XLAT(PTRACE_OLD_GETSIGINFO), #endif #if defined(PTRACE_OLD_SETSIGINFO) || (defined(HAVE_DECL_PTRACE_OLD_SETSIGINFO) && HAVE_DECL_PTRACE_OLD_SETSIGINFO) XLAT(PTRACE_OLD_SETSIGINFO), #endif -/* mips */ + #if defined(PTRACE_PEEKTEXT_3264) || (defined(HAVE_DECL_PTRACE_PEEKTEXT_3264) && HAVE_DECL_PTRACE_PEEKTEXT_3264) XLAT(PTRACE_PEEKTEXT_3264), #endif @@ -183,7 +183,7 @@ const struct xlat ptrace_cmds[] = { #if defined(PTRACE_SET_WATCH_REGS) || (defined(HAVE_DECL_PTRACE_SET_WATCH_REGS) && HAVE_DECL_PTRACE_SET_WATCH_REGS) XLAT(PTRACE_SET_WATCH_REGS), #endif -/* powerpc */ + #if defined(PTRACE_GETEVRREGS) || (defined(HAVE_DECL_PTRACE_GETEVRREGS) && HAVE_DECL_PTRACE_GETEVRREGS) XLAT(PTRACE_GETEVRREGS), #endif @@ -211,7 +211,7 @@ const struct xlat ptrace_cmds[] = { #if defined(PPC_PTRACE_DELHWDEBUG) || (defined(HAVE_DECL_PPC_PTRACE_DELHWDEBUG) && HAVE_DECL_PPC_PTRACE_DELHWDEBUG) XLAT(PPC_PTRACE_DELHWDEBUG), #endif -/* s390 */ + #if defined(PTRACE_PEEKUSR_AREA) || (defined(HAVE_DECL_PTRACE_PEEKUSR_AREA) && HAVE_DECL_PTRACE_PEEKUSR_AREA) XLAT(PTRACE_PEEKUSR_AREA), #endif @@ -248,14 +248,14 @@ const struct xlat ptrace_cmds[] = { #if defined(PTRACE_TE_ABORT_RAND) || (defined(HAVE_DECL_PTRACE_TE_ABORT_RAND) && HAVE_DECL_PTRACE_TE_ABORT_RAND) XLAT(PTRACE_TE_ABORT_RAND), #endif -/* sh */ + #if defined(PTRACE_GETDSPREGS) || (defined(HAVE_DECL_PTRACE_GETDSPREGS) && HAVE_DECL_PTRACE_GETDSPREGS) XLAT(PTRACE_GETDSPREGS), #endif #if defined(PTRACE_SETDSPREGS) || (defined(HAVE_DECL_PTRACE_SETDSPREGS) && HAVE_DECL_PTRACE_SETDSPREGS) XLAT(PTRACE_SETDSPREGS), #endif -/* sparc */ + #if defined(PTRACE_SPARC_DETACH) || (defined(HAVE_DECL_PTRACE_SPARC_DETACH) && HAVE_DECL_PTRACE_SPARC_DETACH) XLAT(PTRACE_SPARC_DETACH), #endif @@ -289,7 +289,7 @@ const struct xlat ptrace_cmds[] = { #if defined(PTRACE_SETFPREGS64) || (defined(HAVE_DECL_PTRACE_SETFPREGS64) && HAVE_DECL_PTRACE_SETFPREGS64) XLAT(PTRACE_SETFPREGS64), #endif -/* x86 */ + #if defined(PTRACE_ARCH_PRCTL) || (defined(HAVE_DECL_PTRACE_ARCH_PRCTL) && HAVE_DECL_PTRACE_ARCH_PRCTL) XLAT(PTRACE_ARCH_PRCTL), #endif @@ -299,7 +299,7 @@ const struct xlat ptrace_cmds[] = { #if defined(PTRACE_SYSEMU_SINGLESTEP) || (defined(HAVE_DECL_PTRACE_SYSEMU_SINGLESTEP) && HAVE_DECL_PTRACE_SYSEMU_SINGLESTEP) XLAT(PTRACE_SYSEMU_SINGLESTEP), #endif -/* xtensa */ + #if defined(PTRACE_GETXTREGS) || (defined(HAVE_DECL_PTRACE_GETXTREGS) && HAVE_DECL_PTRACE_GETXTREGS) XLAT(PTRACE_GETXTREGS), #endif diff --git a/xlat/ptrace_events.h b/xlat/ptrace_events.h index a466f105..a94c1004 100644 --- a/xlat/ptrace_events.h +++ b/xlat/ptrace_events.h @@ -32,7 +32,7 @@ const struct xlat ptrace_events[] = { #if defined(PTRACE_EVENT_STOP) || (defined(HAVE_DECL_PTRACE_EVENT_STOP) && HAVE_DECL_PTRACE_EVENT_STOP) XLAT(PTRACE_EVENT_STOP), #endif -/* tile */ + #if defined(PTRACE_EVENT_MIGRATE) || (defined(HAVE_DECL_PTRACE_EVENT_MIGRATE) && HAVE_DECL_PTRACE_EVENT_MIGRATE) XLAT(PTRACE_EVENT_MIGRATE), #endif diff --git a/xlat/ptrace_setoptions_flags.h b/xlat/ptrace_setoptions_flags.h index 4eaca067..d9d14cbf 100644 --- a/xlat/ptrace_setoptions_flags.h +++ b/xlat/ptrace_setoptions_flags.h @@ -38,7 +38,7 @@ const struct xlat ptrace_setoptions_flags[] = { #if defined(PTRACE_O_SUSPEND_SECCOMP) || (defined(HAVE_DECL_PTRACE_O_SUSPEND_SECCOMP) && HAVE_DECL_PTRACE_O_SUSPEND_SECCOMP) XLAT(PTRACE_O_SUSPEND_SECCOMP), #endif -/* tile */ + #if defined(PTRACE_O_TRACEMIGRATE) || (defined(HAVE_DECL_PTRACE_O_TRACEMIGRATE) && HAVE_DECL_PTRACE_O_TRACEMIGRATE) XLAT(PTRACE_O_TRACEMIGRATE), #endif diff --git a/xlat/riscv_flush_icache_flags.h b/xlat/riscv_flush_icache_flags.h new file mode 100644 index 00000000..b9a031c3 --- /dev/null +++ b/xlat/riscv_flush_icache_flags.h @@ -0,0 +1,18 @@ +/* Generated by ./xlat/gen.sh from ./xlat/riscv_flush_icache_flags.in; do not edit. */ +#if !(defined(SYS_RISCV_FLUSH_ICACHE_LOCAL) || (defined(HAVE_DECL_SYS_RISCV_FLUSH_ICACHE_LOCAL) && HAVE_DECL_SYS_RISCV_FLUSH_ICACHE_LOCAL)) +# define SYS_RISCV_FLUSH_ICACHE_LOCAL 1 +#endif + +#ifdef IN_MPERS + +# error static const struct xlat riscv_flush_icache_flags in mpers mode + +#else + +static +const struct xlat riscv_flush_icache_flags[] = { + XLAT(SYS_RISCV_FLUSH_ICACHE_LOCAL), + XLAT_END +}; + +#endif /* !IN_MPERS */ diff --git a/xlat/riscv_flush_icache_flags.in b/xlat/riscv_flush_icache_flags.in new file mode 100644 index 00000000..173da076 --- /dev/null +++ b/xlat/riscv_flush_icache_flags.in @@ -0,0 +1 @@ +SYS_RISCV_FLUSH_ICACHE_LOCAL 1 diff --git a/xlat/s390_guarded_storage_commands.h b/xlat/s390_guarded_storage_commands.h new file mode 100644 index 00000000..d2d0a36d --- /dev/null +++ b/xlat/s390_guarded_storage_commands.h @@ -0,0 +1,34 @@ +/* Generated by ./xlat/gen.sh from ./xlat/s390_guarded_storage_commands.in; do not edit. */ +#if !(defined(GS_ENABLE) || (defined(HAVE_DECL_GS_ENABLE) && HAVE_DECL_GS_ENABLE)) +# define GS_ENABLE 0 +#endif +#if !(defined(GS_DISABLE) || (defined(HAVE_DECL_GS_DISABLE) && HAVE_DECL_GS_DISABLE)) +# define GS_DISABLE 1 +#endif +#if !(defined(GS_SET_BC_CB) || (defined(HAVE_DECL_GS_SET_BC_CB) && HAVE_DECL_GS_SET_BC_CB)) +# define GS_SET_BC_CB 2 +#endif +#if !(defined(GS_CLEAR_BC_CB) || (defined(HAVE_DECL_GS_CLEAR_BC_CB) && HAVE_DECL_GS_CLEAR_BC_CB)) +# define GS_CLEAR_BC_CB 3 +#endif +#if !(defined(GS_BROADCAST) || (defined(HAVE_DECL_GS_BROADCAST) && HAVE_DECL_GS_BROADCAST)) +# define GS_BROADCAST 4 +#endif + +#ifdef IN_MPERS + +# error static const struct xlat s390_guarded_storage_commands in mpers mode + +#else + +static +const struct xlat s390_guarded_storage_commands[] = { + XLAT(GS_ENABLE), + XLAT(GS_DISABLE), + XLAT(GS_SET_BC_CB), + XLAT(GS_CLEAR_BC_CB), + XLAT(GS_BROADCAST), + XLAT_END +}; + +#endif /* !IN_MPERS */ diff --git a/xlat/s390_guarded_storage_commands.in b/xlat/s390_guarded_storage_commands.in new file mode 100644 index 00000000..410e33e7 --- /dev/null +++ b/xlat/s390_guarded_storage_commands.in @@ -0,0 +1,5 @@ +GS_ENABLE 0 +GS_DISABLE 1 +GS_SET_BC_CB 2 +GS_CLEAR_BC_CB 3 +GS_BROADCAST 4 diff --git a/xlat/s390_runtime_instr_commands.h b/xlat/s390_runtime_instr_commands.h new file mode 100644 index 00000000..5d4aefd4 --- /dev/null +++ b/xlat/s390_runtime_instr_commands.h @@ -0,0 +1,22 @@ +/* Generated by ./xlat/gen.sh from ./xlat/s390_runtime_instr_commands.in; do not edit. */ +#if !(defined(S390_RUNTIME_INSTR_START) || (defined(HAVE_DECL_S390_RUNTIME_INSTR_START) && HAVE_DECL_S390_RUNTIME_INSTR_START)) +# define S390_RUNTIME_INSTR_START 0x1 +#endif +#if !(defined(S390_RUNTIME_INSTR_STOP) || (defined(HAVE_DECL_S390_RUNTIME_INSTR_STOP) && HAVE_DECL_S390_RUNTIME_INSTR_STOP)) +# define S390_RUNTIME_INSTR_STOP 0x2 +#endif + +#ifdef IN_MPERS + +# error static const struct xlat s390_runtime_instr_commands in mpers mode + +#else + +static +const struct xlat s390_runtime_instr_commands[] = { + XLAT(S390_RUNTIME_INSTR_START), + XLAT(S390_RUNTIME_INSTR_STOP), + XLAT_END +}; + +#endif /* !IN_MPERS */ diff --git a/xlat/s390_runtime_instr_commands.in b/xlat/s390_runtime_instr_commands.in new file mode 100644 index 00000000..395afc41 --- /dev/null +++ b/xlat/s390_runtime_instr_commands.in @@ -0,0 +1,2 @@ +S390_RUNTIME_INSTR_START 0x1 +S390_RUNTIME_INSTR_STOP 0x2 diff --git a/xlat/s390_sthyi_function_codes.h b/xlat/s390_sthyi_function_codes.h new file mode 100644 index 00000000..d82b93c2 --- /dev/null +++ b/xlat/s390_sthyi_function_codes.h @@ -0,0 +1,18 @@ +/* Generated by ./xlat/gen.sh from ./xlat/s390_sthyi_function_codes.in; do not edit. */ +#if !(defined(STHYI_FC_CP_IFL_CAP) || (defined(HAVE_DECL_STHYI_FC_CP_IFL_CAP) && HAVE_DECL_STHYI_FC_CP_IFL_CAP)) +# define STHYI_FC_CP_IFL_CAP 0 +#endif + +#ifdef IN_MPERS + +# error static const struct xlat s390_sthyi_function_codes in mpers mode + +#else + +static +const struct xlat s390_sthyi_function_codes[] = { + XLAT(STHYI_FC_CP_IFL_CAP), + XLAT_END +}; + +#endif /* !IN_MPERS */ diff --git a/xlat/s390_sthyi_function_codes.in b/xlat/s390_sthyi_function_codes.in new file mode 100644 index 00000000..380cd7fc --- /dev/null +++ b/xlat/s390_sthyi_function_codes.in @@ -0,0 +1 @@ +STHYI_FC_CP_IFL_CAP 0 diff --git a/xlat/shm_flags.h b/xlat/shm_flags.h index 79e54073..59191536 100644 --- a/xlat/shm_flags.h +++ b/xlat/shm_flags.h @@ -1,4 +1,7 @@ /* Generated by ./xlat/gen.sh from ./xlat/shm_flags.in; do not edit. */ +#if !(defined(SHM_EXEC) || (defined(HAVE_DECL_SHM_EXEC) && HAVE_DECL_SHM_EXEC)) +# define SHM_EXEC 0100000 +#endif #ifdef IN_MPERS @@ -8,15 +11,16 @@ static const struct xlat shm_flags[] = { -#if defined(SHM_REMAP) || (defined(HAVE_DECL_SHM_REMAP) && HAVE_DECL_SHM_REMAP) - XLAT(SHM_REMAP), -#endif #if defined(SHM_RDONLY) || (defined(HAVE_DECL_SHM_RDONLY) && HAVE_DECL_SHM_RDONLY) XLAT(SHM_RDONLY), #endif #if defined(SHM_RND) || (defined(HAVE_DECL_SHM_RND) && HAVE_DECL_SHM_RND) XLAT(SHM_RND), #endif +#if defined(SHM_REMAP) || (defined(HAVE_DECL_SHM_REMAP) && HAVE_DECL_SHM_REMAP) + XLAT(SHM_REMAP), +#endif + XLAT(SHM_EXEC), XLAT_END }; diff --git a/xlat/shm_flags.in b/xlat/shm_flags.in index a6206347..ef39382f 100644 --- a/xlat/shm_flags.in +++ b/xlat/shm_flags.in @@ -1,3 +1,4 @@ -SHM_REMAP SHM_RDONLY SHM_RND +SHM_REMAP +SHM_EXEC 0100000 diff --git a/xlat/shm_resource_flags.h b/xlat/shm_resource_flags.h index b216b45f..11caf5ad 100644 --- a/xlat/shm_resource_flags.h +++ b/xlat/shm_resource_flags.h @@ -17,6 +17,9 @@ const struct xlat shm_resource_flags[] = { #if defined(SHM_HUGETLB) || (defined(HAVE_DECL_SHM_HUGETLB) && HAVE_DECL_SHM_HUGETLB) XLAT(SHM_HUGETLB), #endif +#if defined(SHM_NORESERVE) || (defined(HAVE_DECL_SHM_NORESERVE) && HAVE_DECL_SHM_NORESERVE) + XLAT(SHM_NORESERVE), +#endif XLAT_END }; diff --git a/xlat/shm_resource_flags.in b/xlat/shm_resource_flags.in index f3fc0dc4..1b07687e 100644 --- a/xlat/shm_resource_flags.in +++ b/xlat/shm_resource_flags.in @@ -1,3 +1,4 @@ IPC_CREAT IPC_EXCL SHM_HUGETLB +SHM_NORESERVE diff --git a/xlat/shmctl_flags.h b/xlat/shmctl_flags.h index a5e9f1b8..eac0c1da 100644 --- a/xlat/shmctl_flags.h +++ b/xlat/shmctl_flags.h @@ -1,10 +1,4 @@ /* Generated by ./xlat/gen.sh from ./xlat/shmctl_flags.in; do not edit. */ -#if !(defined(SHM_STAT) || (defined(HAVE_DECL_SHM_STAT) && HAVE_DECL_SHM_STAT)) -# define SHM_STAT 13 -#endif -#if !(defined(SHM_INFO) || (defined(HAVE_DECL_SHM_INFO) && HAVE_DECL_SHM_INFO)) -# define SHM_INFO 14 -#endif #ifdef IN_MPERS @@ -28,14 +22,18 @@ const struct xlat shmctl_flags[] = { #if defined(IPC_INFO) || (defined(HAVE_DECL_IPC_INFO) && HAVE_DECL_IPC_INFO) XLAT(IPC_INFO), #endif - XLAT(SHM_STAT), - XLAT(SHM_INFO), #if defined(SHM_LOCK) || (defined(HAVE_DECL_SHM_LOCK) && HAVE_DECL_SHM_LOCK) XLAT(SHM_LOCK), #endif #if defined(SHM_UNLOCK) || (defined(HAVE_DECL_SHM_UNLOCK) && HAVE_DECL_SHM_UNLOCK) XLAT(SHM_UNLOCK), #endif +#if defined(SHM_STAT) || (defined(HAVE_DECL_SHM_STAT) && HAVE_DECL_SHM_STAT) + XLAT(SHM_STAT), +#endif +#if defined(SHM_INFO) || (defined(HAVE_DECL_SHM_INFO) && HAVE_DECL_SHM_INFO) + XLAT(SHM_INFO), +#endif XLAT_END }; diff --git a/xlat/shmctl_flags.in b/xlat/shmctl_flags.in index 08908bb3..f22e793d 100644 --- a/xlat/shmctl_flags.in +++ b/xlat/shmctl_flags.in @@ -2,7 +2,7 @@ IPC_RMID IPC_SET IPC_STAT IPC_INFO -SHM_STAT 13 -SHM_INFO 14 SHM_LOCK SHM_UNLOCK +SHM_STAT +SHM_INFO diff --git a/xlat/sockipv6options.h b/xlat/sockipv6options.h index f3fa4cce..4309089b 100644 --- a/xlat/sockipv6options.h +++ b/xlat/sockipv6options.h @@ -191,6 +191,9 @@ const struct xlat sockipv6options[] = { #if defined(IPV6_RECVFRAGSIZE) || (defined(HAVE_DECL_IPV6_RECVFRAGSIZE) && HAVE_DECL_IPV6_RECVFRAGSIZE) XLAT(IPV6_RECVFRAGSIZE), #endif +#if defined(IPV6_FREEBIND) || (defined(HAVE_DECL_IPV6_FREEBIND) && HAVE_DECL_IPV6_FREEBIND) + XLAT(IPV6_FREEBIND), +#endif XLAT_END }; diff --git a/xlat/sockipv6options.in b/xlat/sockipv6options.in index 76b5e8b1..4f23d197 100644 --- a/xlat/sockipv6options.in +++ b/xlat/sockipv6options.in @@ -59,3 +59,4 @@ IPV6_RECVORIGDSTADDR IPV6_TRANSPARENT IPV6_UNICAST_IF IPV6_RECVFRAGSIZE +IPV6_FREEBIND diff --git a/xlat/socknetlinkoptions.h b/xlat/socknetlinkoptions.h new file mode 100644 index 00000000..e101213f --- /dev/null +++ b/xlat/socknetlinkoptions.h @@ -0,0 +1,58 @@ +/* Generated by ./xlat/gen.sh from ./xlat/socknetlinkoptions.in; do not edit. */ +#if !(defined(NETLINK_ADD_MEMBERSHIP) || (defined(HAVE_DECL_NETLINK_ADD_MEMBERSHIP) && HAVE_DECL_NETLINK_ADD_MEMBERSHIP)) +# define NETLINK_ADD_MEMBERSHIP 1 +#endif +#if !(defined(NETLINK_DROP_MEMBERSHIP) || (defined(HAVE_DECL_NETLINK_DROP_MEMBERSHIP) && HAVE_DECL_NETLINK_DROP_MEMBERSHIP)) +# define NETLINK_DROP_MEMBERSHIP 2 +#endif +#if !(defined(NETLINK_PKTINFO) || (defined(HAVE_DECL_NETLINK_PKTINFO) && HAVE_DECL_NETLINK_PKTINFO)) +# define NETLINK_PKTINFO 3 +#endif +#if !(defined(NETLINK_BROADCAST_ERROR) || (defined(HAVE_DECL_NETLINK_BROADCAST_ERROR) && HAVE_DECL_NETLINK_BROADCAST_ERROR)) +# define NETLINK_BROADCAST_ERROR 4 +#endif +#if !(defined(NETLINK_NO_ENOBUFS) || (defined(HAVE_DECL_NETLINK_NO_ENOBUFS) && HAVE_DECL_NETLINK_NO_ENOBUFS)) +# define NETLINK_NO_ENOBUFS 5 +#endif +#if !(defined(NETLINK_RX_RING) || (defined(HAVE_DECL_NETLINK_RX_RING) && HAVE_DECL_NETLINK_RX_RING)) +# define NETLINK_RX_RING 6 +#endif +#if !(defined(NETLINK_TX_RING) || (defined(HAVE_DECL_NETLINK_TX_RING) && HAVE_DECL_NETLINK_TX_RING)) +# define NETLINK_TX_RING 7 +#endif +#if !(defined(NETLINK_LISTEN_ALL_NSID) || (defined(HAVE_DECL_NETLINK_LISTEN_ALL_NSID) && HAVE_DECL_NETLINK_LISTEN_ALL_NSID)) +# define NETLINK_LISTEN_ALL_NSID 8 +#endif +#if !(defined(NETLINK_LIST_MEMBERSHIPS) || (defined(HAVE_DECL_NETLINK_LIST_MEMBERSHIPS) && HAVE_DECL_NETLINK_LIST_MEMBERSHIPS)) +# define NETLINK_LIST_MEMBERSHIPS 9 +#endif +#if !(defined(NETLINK_CAP_ACK) || (defined(HAVE_DECL_NETLINK_CAP_ACK) && HAVE_DECL_NETLINK_CAP_ACK)) +# define NETLINK_CAP_ACK 10 +#endif +#if !(defined(NETLINK_EXT_ACK) || (defined(HAVE_DECL_NETLINK_EXT_ACK) && HAVE_DECL_NETLINK_EXT_ACK)) +# define NETLINK_EXT_ACK 11 +#endif + +#ifdef IN_MPERS + +# error static const struct xlat socknetlinkoptions in mpers mode + +#else + +static +const struct xlat socknetlinkoptions[] = { + XLAT(NETLINK_ADD_MEMBERSHIP), + XLAT(NETLINK_DROP_MEMBERSHIP), + XLAT(NETLINK_PKTINFO), + XLAT(NETLINK_BROADCAST_ERROR), + XLAT(NETLINK_NO_ENOBUFS), + XLAT(NETLINK_RX_RING), + XLAT(NETLINK_TX_RING), + XLAT(NETLINK_LISTEN_ALL_NSID), + XLAT(NETLINK_LIST_MEMBERSHIPS), + XLAT(NETLINK_CAP_ACK), + XLAT(NETLINK_EXT_ACK), + XLAT_END +}; + +#endif /* !IN_MPERS */ diff --git a/xlat/socknetlinkoptions.in b/xlat/socknetlinkoptions.in new file mode 100644 index 00000000..033ffd42 --- /dev/null +++ b/xlat/socknetlinkoptions.in @@ -0,0 +1,11 @@ +NETLINK_ADD_MEMBERSHIP 1 +NETLINK_DROP_MEMBERSHIP 2 +NETLINK_PKTINFO 3 +NETLINK_BROADCAST_ERROR 4 +NETLINK_NO_ENOBUFS 5 +NETLINK_RX_RING 6 +NETLINK_TX_RING 7 +NETLINK_LISTEN_ALL_NSID 8 +NETLINK_LIST_MEMBERSHIPS 9 +NETLINK_CAP_ACK 10 +NETLINK_EXT_ACK 11 diff --git a/xlat/socksctpoptions.h b/xlat/socksctpoptions.h index 886d53d3..984718d4 100644 --- a/xlat/socksctpoptions.h +++ b/xlat/socksctpoptions.h @@ -113,7 +113,7 @@ const struct xlat socksctpoptions[] = { #if defined(SCTP_DEFAULT_SNDINFO) || (defined(HAVE_DECL_SCTP_DEFAULT_SNDINFO) && HAVE_DECL_SCTP_DEFAULT_SNDINFO) XLAT(SCTP_DEFAULT_SNDINFO), #endif -/* linux specific things */ + #if defined(SCTP_SOCKOPT_BINDX_ADD) || (defined(HAVE_DECL_SCTP_SOCKOPT_BINDX_ADD) && HAVE_DECL_SCTP_SOCKOPT_BINDX_ADD) XLAT(SCTP_SOCKOPT_BINDX_ADD), #endif diff --git a/xlat/socktcpoptions.h b/xlat/socktcpoptions.h index 836f3e24..55d6fd09 100644 --- a/xlat/socktcpoptions.h +++ b/xlat/socktcpoptions.h @@ -104,6 +104,12 @@ const struct xlat socktcpoptions[] = { #if defined(TCP_MD5SIG_EXT) || (defined(HAVE_DECL_TCP_MD5SIG_EXT) && HAVE_DECL_TCP_MD5SIG_EXT) XLAT(TCP_MD5SIG_EXT), #endif +#if defined(TCP_FASTOPEN_KEY) || (defined(HAVE_DECL_TCP_FASTOPEN_KEY) && HAVE_DECL_TCP_FASTOPEN_KEY) + XLAT(TCP_FASTOPEN_KEY), +#endif +#if defined(TCP_FASTOPEN_NO_COOKIE) || (defined(HAVE_DECL_TCP_FASTOPEN_NO_COOKIE) && HAVE_DECL_TCP_FASTOPEN_NO_COOKIE) + XLAT(TCP_FASTOPEN_NO_COOKIE), +#endif XLAT_END }; diff --git a/xlat/socktcpoptions.in b/xlat/socktcpoptions.in index 747b184c..44f1a2a8 100644 --- a/xlat/socktcpoptions.in +++ b/xlat/socktcpoptions.in @@ -30,3 +30,5 @@ TCP_REPAIR_WINDOW TCP_FASTOPEN_CONNECT TCP_ULP TCP_MD5SIG_EXT +TCP_FASTOPEN_KEY +TCP_FASTOPEN_NO_COOKIE diff --git a/xlat/tcp_state_flags.h b/xlat/tcp_state_flags.h index 20626559..34c81405 100644 --- a/xlat/tcp_state_flags.h +++ b/xlat/tcp_state_flags.h @@ -3,7 +3,7 @@ #ifndef IN_MPERS const struct xlat tcp_state_flags[] = { -/* this file should be included after xlat/tcp_states.h */ + #if defined(TCP_ESTABLISHED) || (defined(HAVE_DECL_TCP_ESTABLISHED) && HAVE_DECL_TCP_ESTABLISHED) XLAT_PAIR(1ULL<<TCP_ESTABLISHED, "1<<TCP_ESTABLISHED"), #endif diff --git a/xlat/timerfdflags.h b/xlat/timerfdflags.h index 2483df89..571f7ece 100644 --- a/xlat/timerfdflags.h +++ b/xlat/timerfdflags.h @@ -22,7 +22,7 @@ static const struct xlat timerfdflags[] = { -/* The Linux userspace headers didn't export these for a long time. */ + XLAT(TFD_TIMER_ABSTIME), XLAT(TFD_TIMER_CANCEL_ON_SET), diff --git a/xlat/v4l2_control_ids.h b/xlat/v4l2_control_ids.h index 2f740db9..ae371f84 100644 --- a/xlat/v4l2_control_ids.h +++ b/xlat/v4l2_control_ids.h @@ -140,7 +140,7 @@ const struct xlat v4l2_control_ids[] = { #if defined(V4L2_CID_ALPHA_COMPONENT) || (defined(HAVE_DECL_V4L2_CID_ALPHA_COMPONENT) && HAVE_DECL_V4L2_CID_ALPHA_COMPONENT) XLAT(V4L2_CID_ALPHA_COMPONENT), #endif -/* Camera class control IDs */ + #if defined(V4L2_CID_EXPOSURE_AUTO) || (defined(HAVE_DECL_V4L2_CID_EXPOSURE_AUTO) && HAVE_DECL_V4L2_CID_EXPOSURE_AUTO) XLAT(V4L2_CID_EXPOSURE_AUTO), #endif @@ -89,6 +89,28 @@ xreallocarray(void *ptr, size_t nmemb, size_t size) return p; } +void * +xgrowarray(void *const ptr, size_t *const nmemb, const size_t memb_size) +{ + /* this is the same value as glibc DEFAULT_MXFAST */ + enum { DEFAULT_ALLOC_SIZE = 64 * SIZEOF_LONG / 4 }; + + size_t grow_memb; + + if (ptr == NULL) + grow_memb = *nmemb ? 0 : + (DEFAULT_ALLOC_SIZE + memb_size - 1) / memb_size; + else + grow_memb = (*nmemb >> 1) + 1; + + if ((*nmemb + grow_memb) < *nmemb) + die_out_of_memory(); + + *nmemb += grow_memb; + + return xreallocarray(ptr, *nmemb, memb_size); +} + char * xstrdup(const char *str) { @@ -36,12 +36,32 @@ #include <stddef.h> #include "gcc_compat.h" +#define xcalloc strace_calloc +#define xmalloc strace_malloc + void *xcalloc(size_t nmemb, size_t size) ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE((1, 2)); void *xmalloc(size_t size) ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE((1)); void *xreallocarray(void *ptr, size_t nmemb, size_t size) ATTRIBUTE_ALLOC_SIZE((2, 3)); +/** + * Utility function for the simplification of managing various dynamic arrays. + * Knows better how to resize arrays. Dies if there's no enough memory. + * + * @param[in] ptr Pointer to the array to be resized. If ptr is NULL, + * new array is allocated. + * @param[in, out] nmemb Pointer to the current member count. If ptr is + * NULL, it specifies number of members in the newly + * created array. If ptr is NULL and nmemb is 0, + * number of members in the new array is decided by + * the function. Member count is updated by the + * function to the new value. + * @param[in] memb_size Size of array member in bytes. + * @return Pointer to the (re)allocated array. + */ +void *xgrowarray(void *ptr, size_t *nmemb, size_t memb_size); + /* * Note that the following two functions return NULL when NULL is specified * and not when allocation is failed, since, as the "x" prefix implies, diff --git a/xstring.h b/xstring.h new file mode 100644 index 00000000..16f9b179 --- /dev/null +++ b/xstring.h @@ -0,0 +1,106 @@ +#ifndef STRACE_XSTRING_H +#define STRACE_XSTRING_H + +#include <stdarg.h> +#include <stdio.h> + +#include "error_prints.h" +#include "gcc_compat.h" + +/** + * Print to static buffer and die on (really unexpected) errors and overflows. + * Shouldn't be used directly; please refer to helper macros xsnprintf and + * xsprint instead. + * + * @param str String buffer to print into. + * @param size Size of the string buffer in bytes. + * @param func Function name from which this function is called. + * @param argstr Stringified arguments (including format argument). + * @param format Format string. + * @param ... Format arguments. + * @return Number of characters printed, excluding terminating null byte + * (the same as s(n)printf). + */ +static inline int ATTRIBUTE_FORMAT((printf, 5, 6)) +xsnprintf_(char *str, size_t size, const char *func, const char *argstr, + const char *format, ...) +{ + int ret; + va_list ap; + + va_start(ap, format); + ret = vsnprintf(str, size, format, ap); + va_end(ap); + + if (ret < 0 || (unsigned int) ret >= size) + error_msg_and_die("%s: got unexpected return value %d for " + "snprintf(buf, %zu, %s)", + func, ret, size, argstr); + + return ret; +} + +/** + * snprintf that dies on (really unexpected) errors and overflows. + * + * @param str_ String buffer to print into. + * @param size_ Size of the string buffer in bytes. + * @param fmt_ Format string. + * @param ... Format arguments. + */ +#define xsnprintf(str_, size_, fmt_, ...) \ + xsnprintf_((str_), (size_), __func__, #fmt_ ", " #__VA_ARGS__, \ + (fmt_), __VA_ARGS__) + +/** + * Print to a character array buffer and die on (really unexpected) errors and + * overflows. Buffer size is obtained with sizeof(). + * + * @param str_ Character array buffer to print into. + * @param fmt_ Format string. + * @param ... Format arguments. + */ +#define xsprintf(str_, fmt_, ...) \ + xsnprintf((str_), sizeof(str_) + MUST_BE_ARRAY(str_), (fmt_), \ + __VA_ARGS__) + +static inline size_t +get_pos_diff_(char *str, size_t size, char *pos, const char *func, + const char *call) +{ + if ((str + size) < str) + error_msg_and_die("%s: string size overflow (%p+%zu) in %s", + func, str, size, call); + + if (pos > (str + size)) + error_msg_and_die("%s: got position (%p) beyond string " + "(%p+%zu) in %s", + func, pos, str, size, call); + + if (pos < str) + error_msg_and_die("%s: got position %p before string %p in %s", + func, pos, str, call); + + return pos - str; +} + +/** + * Helper function for constructing string in a character array by appending + * new formatted parts. Returns new position. Fails on error or buffer + * overflow, in line with the rest of x* functions. Obtains buffer size via + * sizeof(str_). + * + * @param str_ Character array buffer to print into. + * @param pos_ Current position. + * @param fmt_ Format string. + * @param ... Format arguments. + * @return New position. + */ +#define xappendstr(str_, pos_, fmt_, ...) \ + (xsnprintf((pos_), sizeof(str_) + MUST_BE_ARRAY(str_) - \ + get_pos_diff_((str_), sizeof(str_), (pos_), __func__, \ + "xappendstr(" #str_ ", " #pos_ ", " #fmt_ ", " \ + #__VA_ARGS__ ")"), \ + (fmt_), ##__VA_ARGS__) + (pos_)) + +#endif /* !STRACE_XSTRING_H */ |