strace/configure.ac

933 lines
24 KiB
Plaintext
Raw Normal View History

# Configure template for strace.
#
# Copyright (c) 1999-2001 Wichert Akkerman <wichert@deephackmode.org>
# Copyright (c) 2002-2009 Roland McGrath <roland@redhat.com>
# 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-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.
AC_PREREQ(2.57)
AC_INIT([strace],
m4_esyscmd([./git-version-gen .tarball-version]),
[strace-devel@lists.strace.io],
[strace],
[https://strace.io])
m4_define([copyright_year], m4_esyscmd([./copyright-year-gen .year]))
m4_define([manpage_date], m4_esyscmd([./file-date-gen strace.1.in]))
AC_COPYRIGHT([Copyright (c) 1999-]copyright_year[ The strace developers.])
AC_CONFIG_SRCDIR([strace.c])
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign nostdinc dist-xz silent-rules parallel-tests 1.13])
AM_MAINTAINER_MODE
AC_CANONICAL_HOST
RPM_CHANGELOGTIME="$(LC_TIME=C date -u '+%a %b %d %Y')"
AC_SUBST(RPM_CHANGELOGTIME)
DEB_CHANGELOGTIME="$(LC_TIME=C date -u -R)"
AC_SUBST(DEB_CHANGELOGTIME)
Add x32 support to strace X32 support is added to Linux kernel 3.4. In a nutshell, x32 is x86-64 with 32bit pointers. At system call level, x32 is also identical to x86-64, as shown by many changes like "defined(X86_64) || defined(X32)". The main differerence bewteen x32 and x86-64 is off_t in x32 is long long instead of long. This patch adds x32 support to strace. Tested on Linux/x32. * configure.ac: Support X32. * defs.h: Set SUPPORTED_PERSONALITIES to 3 for X86_64, Set PERSONALITY2_WORDSIZE to 4 for X86_64. Add tcb::ext_arg for X32. * file.c (stat): New for X32. (sys_lseek): Use 64-bit version for X32. (printstat64): Check current_personality != 1 for X86_64. * ipc.c (indirect_ipccall): Check current_personality == 1 for X86_64. * mem.c (sys_mmap64): Also use tcp->u_arg for X32. Print NULL for zero address. Call printllval for offset for X32. * pathtrace.c (pathtrace_match): Don't check sys_old_mmap for X32. * process.c (ARG_FLAGS): Defined for X32. (ARG_STACK): Likewise. (ARG_PTID): Likewise. (change_syscall): Handle X32. (struct_user_offsets): Support X32. (sys_arch_prctl): Likewise. * signal.c: Include <asm/sigcontext.h> for X32. (SA_RESTORER): Also define for X32. * syscall.c (update_personality): Support X32 for X86_64. (is_restart_error): Likewise. (syscall_fixup_on_sysenter): Likewise. (get_syscall_args): Likewise. (get_syscall_result): Likewise. (get_error): Likewise. (__X32_SYSCALL_BIT): Define if not defined. (__X32_SYSCALL_MASK): Likewise. (get_scno): Check DS register value for X32. Use __X32_SYSCALL_MASK on X32 system calls. * util.c (printllval): Use ext_arg for X32. (printcall): Support X32. (change_syscall): Likewise. (arg0_offset): Likewise. (arg1_offset): Likewise. * Makefile.am (EXTRA_DIST): Add linux/x32/errnoent.h, linux/x32/ioctlent.h.in, linux/x32/signalent.h, linux/x32/syscallent.h, linux/x86_64/errnoent2.h, linux/x86_64/ioctlent2.h, linux/x86_64/signalent2.h and linux/x86_64/syscallent2.h. * linux/x32/errnoent.h: New. * linux/x32/ioctlent.h.in: Likewise. * linux/x32/signalent.h: Likewise. * linux/x32/syscallent.h: Likewise. * linux/x86_64/errnoent2.h: Likewise. * linux/x86_64/ioctlent2.h: Likewise. * linux/x86_64/signalent2.h: Likewise. * linux/x86_64/syscallent2.h: Likewise. Signed-off-by: H.J. Lu <hongjiu.lu@intel.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-16 15:00:01 +04:00
AC_PROG_CC
AC_PROG_CC_STDC
AC_PROG_CPP
st_WARN_CFLAGS
AX_PROG_CC_FOR_BUILD
AC_PROG_INSTALL
Add mpers support Add a subsystem for semi-automatical definition of how parsers should work with personality-dependent (mpers) types of tracee's data. Create auxiliary libraries containing mpers syscall parsers and printer functions, one library for each possible nonnative target personality. Currently some parsers do not handle differences in definitions of data types between personalities, namely LP64 and ILP32. When this is the case, long integers, pointers, and all compound types containing long and pointer members may be printed incorrectly, because of differences in sizes, offsets and alignments. Since in most cases these are the only differences in desired behaviour of parsers and printers for different personalities, a correct way would be to compile one source code into multiple parsers, differing only in definitions of mpers types. To get a definition of a given type for nonnative personality a very basic .c file containing a declaration of a variable of this type is being compiled for this personality (using -m32 or -mx32 compiler flag). Information about the type is then being extracted from this binary's DWARF debug info with an awk script and put into a corresponding header file. Resulting headers are being used to compile mpers variations of syscall parsers and printer functions. In addition to syscall parsers, there can occur a need to create mpers printing functions, which then can be called from many places in the code (for example, printsiginfo_at). Such functions (printers) are marked in a special manner. For each possible nonnative target personality a library is being created, containing mpers variations of syscall parsers and printers. Only syscall parsers from files marked in a special manner and specially marked functions from such files are being recompiled and included in these libraries. generate_mpers_am.sh is called by bootstrap to find the files from strace_SOURCES which include MPERS_DEFS. During compilation, these files are being inspected for inclusions of DEF_MPERS_TYPE, and nonnative variations of each included type are being generated by an awk script. Mpers parser names are being modified during inclusions of syscallent headers for nonnative personalities. Pointers to printers are being stored in structs struct_printers, and a master pointer printers is being updated on every set_personality. * README-mpers: New README explaining how to use mpers support. * empty.h: New empty file. * generate_mpers_am.sh: New file. * mpers.awk: Likewise. * mpers.sh: Likewise. * mpers_test.sh: Likewise. * mpers_type.h: Likewise. * Makefile.am (strace_SOURCES): Add empty.h and mpers_type.h. (strace_CPPFLAGS, strace_LDFLAGS, strace_LDADD): Move to the beginning of the file. (strace_LDADD, noinst_LIBRARIES): Add libmpers-%.a. (EXTRA_DIST): Add mpers.awk, mpers.sh, mpers_test.sh. (BUILT_SOURCES, CLEANFILES): Add new generated files: native_printer_decls.h, native_printer_defs.h, printers.h, [HAVE_M32_MPERS] $(mpers_m32_targets), and [HAVE_MX32_MPERS] $(mpers_mx32_targets). (mpers_NAME, mpers_PREFIX, mpers_DEFS, mpers_INCLUDES, mpers_CPPFLAGS, mpers_sh_opts, libmpers_CPPFLAGS, libmpers_m[x]32_a_SOURCES, libmpers_m[x]32_a_CPPFLAGS, mpers_m[x]32_targets): New variables. (mpers-m[x]32.stamp, m[x]32_defs.h, m[x]32_funcs.h, printers.h, %_printer_decls.h, %_printer_defs.h, clean-local, native_printer_decls.h, native_printer_defs.h, $mpers_m[x]32_targets): New targets. * bootstrap: Add generate_mpers_am.sh. * configure.ac: Add AC_PROG_RANLIB. * m4/mpers.m4: Add HAVE_MPERS variable. Add $st_cv_mpers checks. * defs.h: Include mpers_type.h. Include printers.h, native_printer_decls.h, define MPERS_PRINTER_NAME. Redefine SYS_FUNC_NAME. Define MPERS_PRINTER_DECL. [HAVE_M32_MPERS]: define PERSONALITY1_INCLUDE_FUNCS, PERSONALITY1_INCLUDE_PRINTERS_DECLS, PERSONALITY1_INCLUDE_PRINTERS_DEFS for X86_64, X32. [HAVE_MX32_MPERS]: define PERSONALITY2_INCLUDE_FUNCS, PERSONALITY2_INCLUDE_PRINTERS_DECLS, PERSONALITY2_INCLUDE_PRINTERS_DEFS for X86_64. Add fallback definitions of PERSONALITY1_INCLUDE_FUNCS, PERSONALITY2_INCLUDE_FUNCS, PERSONALITY0_INCLUDE_PRINTERS_DECLS, PERSONALITY0_INCLUDE_PRINTERS_DEFS, PERSONALITY1_INCLUDE_PRINTERS_DECLS, PERSONALITY1_INCLUDE_PRINTERS_DEFS, PERSONALITY2_INCLUDE_PRINTERS_DECLS, PERSONALITY2_INCLUDE_PRINTERS_DEFS. * syscall.c: Include PERSONALITY1_INCLUDE_FUNCS, PERSONALITY2_INCLUDE_FUNCS, PERSONALITY0_INCLUDE_PRINTERS_DECLS, PERSONALITY0_INCLUDE_PRINTERS_DEFS, PERSONALITY1_INCLUDE_PRINTERS_DECLS, PERSONALITY1_INCLUDE_PRINTERS_DEFS, PERSONALITY2_INCLUDE_PRINTERS_DECLS, PERSONALITY2_INCLUDE_PRINTERS_DEFS. (printers): New struct. Update it when needed. * .gitignore: Add libmpers-m32.a, libmpers-mx32.a, m32_defs.h, m32_funcs.h, m32_printer_decls.h, m32_printer_defs.h, mpers-m32, mpers-m32.stamp, mpers-mx32, mpers-mx32.stamp, mpers.am, mx32_defs.h, mx32_funcs.h, mx32_printer_decls.h, mx32_printer_defs.h, native_printer_decls.h, native_printer_defs.h, and printers.h.
2015-08-04 01:47:02 +03:00
AC_PROG_RANLIB
Add x32 support to strace X32 support is added to Linux kernel 3.4. In a nutshell, x32 is x86-64 with 32bit pointers. At system call level, x32 is also identical to x86-64, as shown by many changes like "defined(X86_64) || defined(X32)". The main differerence bewteen x32 and x86-64 is off_t in x32 is long long instead of long. This patch adds x32 support to strace. Tested on Linux/x32. * configure.ac: Support X32. * defs.h: Set SUPPORTED_PERSONALITIES to 3 for X86_64, Set PERSONALITY2_WORDSIZE to 4 for X86_64. Add tcb::ext_arg for X32. * file.c (stat): New for X32. (sys_lseek): Use 64-bit version for X32. (printstat64): Check current_personality != 1 for X86_64. * ipc.c (indirect_ipccall): Check current_personality == 1 for X86_64. * mem.c (sys_mmap64): Also use tcp->u_arg for X32. Print NULL for zero address. Call printllval for offset for X32. * pathtrace.c (pathtrace_match): Don't check sys_old_mmap for X32. * process.c (ARG_FLAGS): Defined for X32. (ARG_STACK): Likewise. (ARG_PTID): Likewise. (change_syscall): Handle X32. (struct_user_offsets): Support X32. (sys_arch_prctl): Likewise. * signal.c: Include <asm/sigcontext.h> for X32. (SA_RESTORER): Also define for X32. * syscall.c (update_personality): Support X32 for X86_64. (is_restart_error): Likewise. (syscall_fixup_on_sysenter): Likewise. (get_syscall_args): Likewise. (get_syscall_result): Likewise. (get_error): Likewise. (__X32_SYSCALL_BIT): Define if not defined. (__X32_SYSCALL_MASK): Likewise. (get_scno): Check DS register value for X32. Use __X32_SYSCALL_MASK on X32 system calls. * util.c (printllval): Use ext_arg for X32. (printcall): Support X32. (change_syscall): Likewise. (arg0_offset): Likewise. (arg1_offset): Likewise. * Makefile.am (EXTRA_DIST): Add linux/x32/errnoent.h, linux/x32/ioctlent.h.in, linux/x32/signalent.h, linux/x32/syscallent.h, linux/x86_64/errnoent2.h, linux/x86_64/ioctlent2.h, linux/x86_64/signalent2.h and linux/x86_64/syscallent2.h. * linux/x32/errnoent.h: New. * linux/x32/ioctlent.h.in: Likewise. * linux/x32/signalent.h: Likewise. * linux/x32/syscallent.h: Likewise. * linux/x86_64/errnoent2.h: Likewise. * linux/x86_64/ioctlent2.h: Likewise. * linux/x86_64/signalent2.h: Likewise. * linux/x86_64/syscallent2.h: Likewise. Signed-off-by: H.J. Lu <hongjiu.lu@intel.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-16 15:00:01 +04:00
AC_USE_SYSTEM_EXTENSIONS
AX_CODE_COVERAGE
AC_DEFINE([COPYRIGHT_YEAR], "[copyright_year]", [Current copyright year.])
AC_SUBST([COPYRIGHT_YEAR], [copyright_year])
AC_DEFINE([MANPAGE_DATE], "[manpage_date]", [Date])
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.])
;;
ia64)
arch=ia64
AC_DEFINE([IA64], 1, [Define for the IA64 architecture.])
;;
m68k)
arch=m68k
AC_DEFINE([M68K], 1, [Define for the m68k 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.])
;;
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.])
AC_TRY_COMPILE(
[#ifndef __LP64__
# error 32 bit
#endif], [], arch=powerpc64, arch=powerpc)
if test "$arch" = "powerpc64"; then
arch_m32=powerpc
AC_DEFINE([POWERPC64], 1, [Define for the PowerPC64 architecture.])
fi
;;
riscv*)
arch=riscv
AC_DEFINE([RISCV], 1, [Define for the RISC-V architecture])
;;
s390)
arch=s390
AC_DEFINE([S390], 1, [Define for the S390 architecture.])
;;
s390x)
arch=s390x
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-10 23:20:06 +03:00
arch_m32=s390
cc_flags_m32=-m31
AC_DEFINE([S390X], 1, [Define for the S390x architecture.])
;;
sh64*)
arch=sh64
AC_DEFINE([SH64], 1, [Define for the SH64 architecture.])
;;
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
Add x32 support to strace X32 support is added to Linux kernel 3.4. In a nutshell, x32 is x86-64 with 32bit pointers. At system call level, x32 is also identical to x86-64, as shown by many changes like "defined(X86_64) || defined(X32)". The main differerence bewteen x32 and x86-64 is off_t in x32 is long long instead of long. This patch adds x32 support to strace. Tested on Linux/x32. * configure.ac: Support X32. * defs.h: Set SUPPORTED_PERSONALITIES to 3 for X86_64, Set PERSONALITY2_WORDSIZE to 4 for X86_64. Add tcb::ext_arg for X32. * file.c (stat): New for X32. (sys_lseek): Use 64-bit version for X32. (printstat64): Check current_personality != 1 for X86_64. * ipc.c (indirect_ipccall): Check current_personality == 1 for X86_64. * mem.c (sys_mmap64): Also use tcp->u_arg for X32. Print NULL for zero address. Call printllval for offset for X32. * pathtrace.c (pathtrace_match): Don't check sys_old_mmap for X32. * process.c (ARG_FLAGS): Defined for X32. (ARG_STACK): Likewise. (ARG_PTID): Likewise. (change_syscall): Handle X32. (struct_user_offsets): Support X32. (sys_arch_prctl): Likewise. * signal.c: Include <asm/sigcontext.h> for X32. (SA_RESTORER): Also define for X32. * syscall.c (update_personality): Support X32 for X86_64. (is_restart_error): Likewise. (syscall_fixup_on_sysenter): Likewise. (get_syscall_args): Likewise. (get_syscall_result): Likewise. (get_error): Likewise. (__X32_SYSCALL_BIT): Define if not defined. (__X32_SYSCALL_MASK): Likewise. (get_scno): Check DS register value for X32. Use __X32_SYSCALL_MASK on X32 system calls. * util.c (printllval): Use ext_arg for X32. (printcall): Support X32. (change_syscall): Likewise. (arg0_offset): Likewise. (arg1_offset): Likewise. * Makefile.am (EXTRA_DIST): Add linux/x32/errnoent.h, linux/x32/ioctlent.h.in, linux/x32/signalent.h, linux/x32/syscallent.h, linux/x86_64/errnoent2.h, linux/x86_64/ioctlent2.h, linux/x86_64/signalent2.h and linux/x86_64/syscallent2.h. * linux/x32/errnoent.h: New. * linux/x32/ioctlent.h.in: Likewise. * linux/x32/signalent.h: Likewise. * linux/x32/syscallent.h: Likewise. * linux/x86_64/errnoent2.h: Likewise. * linux/x86_64/ioctlent2.h: Likewise. * linux/x86_64/signalent2.h: Likewise. * linux/x86_64/syscallent2.h: Likewise. Signed-off-by: H.J. Lu <hongjiu.lu@intel.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-16 15:00:01 +04:00
AC_TRY_COMPILE(
[#ifndef __ILP32__
# error not x32
#endif], [], arch=x32, arch=x86_64)
if test "$arch" = "x86_64"; then
arch_mx32=x32
Add x32 support to strace X32 support is added to Linux kernel 3.4. In a nutshell, x32 is x86-64 with 32bit pointers. At system call level, x32 is also identical to x86-64, as shown by many changes like "defined(X86_64) || defined(X32)". The main differerence bewteen x32 and x86-64 is off_t in x32 is long long instead of long. This patch adds x32 support to strace. Tested on Linux/x32. * configure.ac: Support X32. * defs.h: Set SUPPORTED_PERSONALITIES to 3 for X86_64, Set PERSONALITY2_WORDSIZE to 4 for X86_64. Add tcb::ext_arg for X32. * file.c (stat): New for X32. (sys_lseek): Use 64-bit version for X32. (printstat64): Check current_personality != 1 for X86_64. * ipc.c (indirect_ipccall): Check current_personality == 1 for X86_64. * mem.c (sys_mmap64): Also use tcp->u_arg for X32. Print NULL for zero address. Call printllval for offset for X32. * pathtrace.c (pathtrace_match): Don't check sys_old_mmap for X32. * process.c (ARG_FLAGS): Defined for X32. (ARG_STACK): Likewise. (ARG_PTID): Likewise. (change_syscall): Handle X32. (struct_user_offsets): Support X32. (sys_arch_prctl): Likewise. * signal.c: Include <asm/sigcontext.h> for X32. (SA_RESTORER): Also define for X32. * syscall.c (update_personality): Support X32 for X86_64. (is_restart_error): Likewise. (syscall_fixup_on_sysenter): Likewise. (get_syscall_args): Likewise. (get_syscall_result): Likewise. (get_error): Likewise. (__X32_SYSCALL_BIT): Define if not defined. (__X32_SYSCALL_MASK): Likewise. (get_scno): Check DS register value for X32. Use __X32_SYSCALL_MASK on X32 system calls. * util.c (printllval): Use ext_arg for X32. (printcall): Support X32. (change_syscall): Likewise. (arg0_offset): Likewise. (arg1_offset): Likewise. * Makefile.am (EXTRA_DIST): Add linux/x32/errnoent.h, linux/x32/ioctlent.h.in, linux/x32/signalent.h, linux/x32/syscallent.h, linux/x86_64/errnoent2.h, linux/x86_64/ioctlent2.h, linux/x86_64/signalent2.h and linux/x86_64/syscallent2.h. * linux/x32/errnoent.h: New. * linux/x32/ioctlent.h.in: Likewise. * linux/x32/signalent.h: Likewise. * linux/x32/syscallent.h: Likewise. * linux/x86_64/errnoent2.h: Likewise. * linux/x86_64/ioctlent2.h: Likewise. * linux/x86_64/signalent2.h: Likewise. * linux/x86_64/syscallent2.h: Likewise. Signed-off-by: H.J. Lu <hongjiu.lu@intel.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-16 15:00:01 +04:00
AC_DEFINE([X86_64], 1, [Define for the 64bit AMD x86-64 architecture.])
else
AC_DEFINE([X32], 1, [Define for the 32bit AMD x86-64 architecture.])
fi
;;
xtensa*)
arch=xtensa
AC_DEFINE([XTENSA], 1, [Define for the Xtensa architecture])
;;
*)
AC_MSG_RESULT([NO!])
AC_MSG_ERROR([architecture $host_cpu is not supported by strace])
;;
esac
AC_MSG_RESULT($arch)
arch_native=$arch
test -n "$arch_m32" ||
arch_m32=$arch
test -n "$arch_mx32" ||
arch_mx32=$arch
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_FAILURE([_MIPS_SIM cannot be determined])])])
# requires GCC >= 3.4
AC_CACHE_CHECK([for MIPS ABI], [st_cv_mips_abi],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(, [[int i[_MIPS_SIM == _ABIO32 ? 1 : - 1];]])],
[st_cv_mips_abi=o32],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(, [[int i[_MIPS_SIM == _ABIN32 ? 1 : - 1];]])],
[st_cv_mips_abi=n32],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(, [[int i[_MIPS_SIM == _ABI64 ? 1 : - 1];]])],
[st_cv_mips_abi=n64],
[st_cv_mips_abi=unknown])])])])
case "$st_cv_mips_abi" in
o32) AC_DEFINE([LINUX_MIPSO32], [1], [Define for _ABIO32.]);;
n32) AC_DEFINE([LINUX_MIPSN32], [1], [Define for _ABIN32.]);;
n64) AC_DEFINE([LINUX_MIPSN64], [1], [Define for _ABI64.]);;
*) AC_MSG_ERROR([Unsupported _MIPS_SIM]);;
esac
MIPS_ABI="$st_cv_mips_abi"
fi
AC_SUBST(MIPS_ABI)
AC_ARG_ENABLE([arm-oabi],
[AS_HELP_STRING([--enable-arm-oabi],
[enable OABI support on ARM EABI])],
[], [enable_arm_oabi=no])
case "$enable_arm_oabi" in
yes) enable_arm_oabi=1 ;;
no) enable_arm_oabi=0 ;;
*) AC_MSG_ERROR([bad value $enable_arm_oabi for arm-oabi option]) ;;
esac
AC_DEFINE_UNQUOTED([ENABLE_ARM_OABI], [$enable_arm_oabi],
[Define to 1 if you want OABI support on ARM EABI.])
AC_C_BIGENDIAN
AC_C_TYPEOF
AC_TYPE_UID_T
AC_CHECK_FUNCS(m4_normalize([
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
]))
AC_CHECK_TYPES([sig_atomic_t, struct sigcontext],,, [#include <signal.h>])
AC_CHECK_TYPES([struct mmsghdr],,, [#include <sys/socket.h>])
AC_CHECK_TYPES([__kernel_long_t, __kernel_ulong_t],,,
[#include <asm/posix_types.h>])
AC_CHECK_TYPES([struct stat64, struct __old_kernel_stat],,,
[#include <sys/types.h>
#include <asm/stat.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>
#include <asm/stat.h>])
AC_CHECK_TYPES(m4_normalize([
struct pt_all_user_regs,
struct ia64_fpreg,
struct ptrace_peeksiginfo_args
]),,, [#include <sys/ptrace.h>])
AC_CHECK_TYPES(m4_normalize([
struct flock,
struct flock64,
struct __kernel_flock,
struct __kernel_flock64,
struct f_owner_ex,
struct __kernel_f_owner_ex
]),,,
[#include <sys/types.h>
#include <linux/fcntl.h>])
AC_CHECK_TYPES(m4_normalize([
struct crypto_report_aead,
struct crypto_report_blkcipher,
struct crypto_report_cipher,
struct crypto_report_hash,
struct crypto_report_rng
]),,, [#include <linux/cryptouser.h>])
AC_CHECK_TYPES(m4_normalize([
struct kcmp_epoll_slot
]),,, [#include <linux/kcmp.h>])
AC_CHECK_TYPES(m4_normalize([
struct keyctl_kdf_params
]),,, [#include <linux/keyctl.h>])
AC_CHECK_MEMBERS([struct timex.tai],,, [#include <sys/timex.h>])
AC_CHECK_MEMBERS([struct utsname.domainname],,, [#include <sys/utsname.h>])
AC_CHECK_MEMBERS(m4_normalize([
siginfo_t.si_syscall,
siginfo_t.si_timerid,
siginfo_t.si_overrun
]),,, [#include <signal.h>])
AC_CHECK_MEMBERS(m4_normalize([
struct perf_event_attr.precise_ip,
struct perf_event_attr.mmap_data,
struct perf_event_attr.sample_id_all,
struct perf_event_attr.exclude_host,
struct perf_event_attr.exclude_guest,
struct perf_event_attr.exclude_callchain_kernel,
struct perf_event_attr.exclude_callchain_user,
struct perf_event_attr.mmap2,
struct perf_event_attr.comm_exec,
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,
struct perf_event_attr.branch_sample_type,
struct perf_event_attr.sample_regs_user,
struct perf_event_attr.sample_stack_user,
struct perf_event_attr.sample_regs_intr,
struct perf_event_attr.aux_watermark,
struct perf_event_attr.sample_max_stack
]),,, [#include <linux/perf_event.h>])
AC_CHECK_HEADERS(m4_normalize([
asm/cachectl.h
asm/guarded_storage.h
asm/sysmips.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
ioctl: take all 32 bits of ioctl commands into account Historically, only 16 bits (8-bit number and 8-bit type) of 32-bit ioctl commands were used for decoding, which was the source for numerous annoying collisions like this: ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0 ioctl(0, MGSL_IOCGPARAMS or MMTIMER_GETRES or MTIOCTOP or SNDCTL_MIDI_MPUMODE, 0x7fffd47f7338) = -1 ENOTTY (Inappropriate ioctl for device) The solution is to use all 32 bits for decoding, not just "number" and "type", but also "size" and "direction". As some architectures override defaults that come from asm-generic/ and provide alternative definitions for some ioctl commands, we support per-architecture ioctl definitions and merge them with common definitions at build time. During the merge, we used to keep both generic and architecture-specific definitions, now architecture-specific definitions have precedence over generic ones -- ioctlsort omits definitions from asm-generic/ for those ioctl names that have different definitions in asm/. Additional bits of "direction" are architecture specific -- the number of bits and their values differ between architectures. To reduce architecture differences in the source code, we keep "direction" in symbolic form and compile it in ioctlsort. Additional bits of "size" are also architecture specific -- not only the number of bits differ between architectures, but sizes of many types depend on sizeof(long). To reduce architecture differences in the source code, we keep 32-bit and 64-bit versions of common ioctl definitions, and use the appropriate version for each architecture and personality. To implement this, the tools for generating ioctl definitions from kernel headers have been rewritten, and the source format of ioctl definitions has been extended. The final ioctlent*.h files that are included by syscall.c are now generated from source ioctls_inc*.h and ioctls_arch*.h files at build time with ioctlsort. * ioctl.c (ioctl_lookup): Use all 32 bits of ioctl command code. * ioctlsort.c: Rewritten. * linux/32/ioctls_inc.h: New file. * linux/64/ioctls_inc.h: New file. * linux/aarch64/ioctls_arch0.h: New file. * linux/aarch64/ioctls_arch1.h: New file. * linux/aarch64/ioctls_inc0.h: New file. * linux/aarch64/ioctls_inc1.h: New file. * linux/alpha/ioctls_arch0.h: New file. * linux/alpha/ioctls_inc0.h: New file. * linux/arc/ioctls_arch0.h: New file. * linux/arc/ioctls_inc0.h: New file. * linux/arm/ioctls_arch0.h: New file. * linux/arm/ioctls_inc0.h: New file. * linux/avr32/ioctls_arch0.h: New file. * linux/avr32/ioctls_inc0.h: New file. * linux/bfin/ioctls_arch0.h: New file. * linux/bfin/ioctls_inc0.h: New file. * linux/hppa/ioctls_arch0.h: New file. * linux/hppa/ioctls_inc0.h: New file. * linux/i386/ioctls_arch0.h: New file. * linux/i386/ioctls_inc0.h: New file. * linux/ia64/ioctls_arch0.h: New file. * linux/ia64/ioctls_inc0.h: New file. * linux/m68k/ioctls_arch0.h: New file. * linux/m68k/ioctls_inc0.h: New file. * linux/metag/ioctls_arch0.h: New file. * linux/metag/ioctls_inc0.h: New file. * linux/microblaze/ioctls_arch0.h: New file. * linux/microblaze/ioctls_inc0.h: New file. * linux/mips/ioctls_arch0.h: New file. * linux/mips/ioctls_inc0.h: New file. * linux/or1k/ioctls_arch0.h: New file. * linux/or1k/ioctls_inc0.h: New file. * linux/powerpc/ioctls_arch0.h: New file. * linux/powerpc/ioctls_inc0.h: New file. * linux/powerpc64/ioctls_arch0.h: New file. * linux/powerpc64/ioctls_arch1.h: New file. * linux/powerpc64/ioctls_inc0.h: New file. * linux/powerpc64/ioctls_inc1.h: New file. * linux/s390/ioctls_arch0.h: New file. * linux/s390/ioctls_inc0.h: New file. * linux/s390x/ioctls_arch0.h: New file. * linux/s390x/ioctls_inc0.h: New file. * linux/sh/ioctls_arch0.h: New file. * linux/sh/ioctls_inc0.h: New file. * linux/sh64/ioctls_arch0.h: New file. * linux/sh64/ioctls_inc0.h: New file. * linux/sparc/ioctls_arch0.h: New file. * linux/sparc/ioctls_inc0.h: New file. * linux/sparc64/ioctls_arch0.h: New file. * linux/sparc64/ioctls_arch2.h: New file. * linux/sparc64/ioctls_inc0.h: New file. * linux/sparc64/ioctls_inc2.h: New file. * linux/tile/ioctls_arch0.h: New file. * linux/tile/ioctls_arch1.h: New file. * linux/tile/ioctls_inc0.h: New file. * linux/tile/ioctls_inc1.h: New file. * linux/x32/ioctls_arch0.h: New file. * linux/x32/ioctls_arch1.h: New file. * linux/x32/ioctls_inc0.h: New file. * linux/x32/ioctls_inc1.h: New file. * linux/x86_64/ioctls_arch0.h: New file. * linux/x86_64/ioctls_arch1.h: New file. * linux/x86_64/ioctls_inc0.h: New file. * linux/x86_64/ioctls_inc1.h: New file. * linux/xtensa/ioctls_arch0.h: New file. * linux/xtensa/ioctls_inc0.h: New file. * linux/aarch64/ioctlent.h.in: Remove. * linux/aarch64/ioctlent1.h: Remove. * linux/alpha/ioctlent.h.in: Remove. * linux/arc/ioctlent.h.in: Remove. * linux/arm/ioctlent.h.in: Remove. * linux/avr32/ioctlent.h.in: Remove. * linux/bfin/ioctlent.h.in: Remove. * linux/hppa/ioctlent.h.in: Remove. * linux/i386/ioctlent.h.in: Remove. * linux/ia64/ioctlent.h.in: Remove. * linux/ioctlent.h.in: Remove. * linux/ioctlent.sh: Remove. * linux/m68k/ioctlent.h.in: Remove. * linux/metag/ioctlent.h.in: Remove. * linux/microblaze/ioctlent.h.in: Remove. * linux/mips/ioctlent.h.in: Remove. * linux/mips/ioctlent.sh: Remove. * linux/or1k/ioctlent.h.in: Remove. * linux/powerpc/ioctlent.h.in: Remove. * linux/powerpc64/ioctlent.h: Remove. * linux/powerpc64/ioctlent1.h: Remove. * linux/s390/ioctlent.h.in: Remove. * linux/s390x/ioctlent.h.in: Remove. * linux/sh/ioctlent.h.in: Remove. * linux/sh64/ioctlent.h.in: Remove. * linux/sparc/ioctlent.h.in: Remove. * linux/sparc64/ioctlent.h.in: Remove. * linux/sparc64/ioctlent2.h: Remove. * linux/tile/ioctlent.h.in: Remove. * linux/tile/ioctlent1.h: Remove. * linux/x32/ioctlent.h.in: Remove. * linux/x32/ioctlent1.h: Remove. * linux/x86_64/ioctlent.h.in: Remove. * linux/x86_64/ioctlent1.h: Remove. * linux/xtensa/ioctlent.h.in: Remove. * linux/x86_64/ioctlent2.h: Include ioctlent0.h instead of ioctlent.h. * syscall.c (struct_ioctlent ioctlent0): Likewise. * Makefile.am: Remove all ioctlent-related definitions. Define the list of ioctlent*.h files that have to be generated by presence of $(srcdir)/$(OS)/$(ARCH)/ioctls_inc*.h files. Add rules for ioctlent*.h files generation. (EXTRA_DIST): Update. * maint/ioctls_gen.sh: New file. * maint/ioctls_hex.sh: New file. * maint/ioctls_sym.sh: New file. * maint/print_ioctlent.c: New file. * HACKING-scripts: Update for ioctlent.sh -> ioctls_gen.sh migration. * .gitignore: Add ioctlent[012].h and ioctls_all[012].h. * configure.ac (AC_CHECK_HEADERS): Add linux/hiddev.h and linux/mmtimer.h for tests. * tests/ioctl.c: New file. * tests/ioctl.test: New test. * tests/Makefile.am (check_PROGRAMS): Add ioctl. (TESTS): Add ioctl.test. * tests/.gitignore: Add ioctl.
2015-01-19 20:02:16 +03:00
linux/hiddev.h
linux/if_addr.h
linux/if_link.h
decode extend getsockopt/setsockopt options Currently the code assumes the set of valid options between getsockopt and setsockopt are exactly the same and thus maintains one list. The kernel unfortunately does not do this -- it allows for different opts between the get and set functions. See the {g,s}et_opt{min,max} fields in the various netfilter subcores. To support this, extend the printxval function to take multiple sets of xlats as varargs. Then we add the new get/set lists, and pass them down in the net code when decoding things. A simple example is iptables; before: getsockopt(4, SOL_IP, 0x40 /* IP_??? */, ...) = 0 getsockopt(4, SOL_IP, 0x41 /* IP_??? */, ...) = 0 after: getsockopt(4, SOL_IP, IPT_SO_GET_INFO, ...) = 0 getsockopt(4, SOL_IP, IPT_SO_GET_ENTRIES, ...) = 0 If these were setsockopt calls, then 0x40 & 0x41 would be IPT_SO_SET_REPLACE & IPT_SO_SET_ADD_COUNTERS. * configure.ac: Check for netfilter headers. * defs.h (printxvals): New prototype. (printxval): Change to a define. * net.c: Include netfilter headers and new sockopts headers. (print_sockopt_fd_level_name): Add a is_getsockopt argument. Change SOL_IP and SOL_IPV6 decoding to use printxvals, and use is_getsockopt to pass more xlats down. (getsockopt): Call print_sockopt_fd_level_name with is_getsockopt as true. (setsockopt): Call print_sockopt_fd_level_name with is_getsockopt as false. * util.c (printxval): Rename to ... (printxvals): ... this. Rewrite to be varargs based. * xlat/getsockipoptions.in: New xlat list. * xlat/getsockipv6options.in, xlat/setsockipoptions.in, xlat/setsockipv6options.in: Likewise.
2015-08-19 20:29:27 +03:00
linux/ip_vs.h
linux/ipc.h
linux/kcmp.h
linux/kvm.h
linux/memfd.h
ioctl: take all 32 bits of ioctl commands into account Historically, only 16 bits (8-bit number and 8-bit type) of 32-bit ioctl commands were used for decoding, which was the source for numerous annoying collisions like this: ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0 ioctl(0, MGSL_IOCGPARAMS or MMTIMER_GETRES or MTIOCTOP or SNDCTL_MIDI_MPUMODE, 0x7fffd47f7338) = -1 ENOTTY (Inappropriate ioctl for device) The solution is to use all 32 bits for decoding, not just "number" and "type", but also "size" and "direction". As some architectures override defaults that come from asm-generic/ and provide alternative definitions for some ioctl commands, we support per-architecture ioctl definitions and merge them with common definitions at build time. During the merge, we used to keep both generic and architecture-specific definitions, now architecture-specific definitions have precedence over generic ones -- ioctlsort omits definitions from asm-generic/ for those ioctl names that have different definitions in asm/. Additional bits of "direction" are architecture specific -- the number of bits and their values differ between architectures. To reduce architecture differences in the source code, we keep "direction" in symbolic form and compile it in ioctlsort. Additional bits of "size" are also architecture specific -- not only the number of bits differ between architectures, but sizes of many types depend on sizeof(long). To reduce architecture differences in the source code, we keep 32-bit and 64-bit versions of common ioctl definitions, and use the appropriate version for each architecture and personality. To implement this, the tools for generating ioctl definitions from kernel headers have been rewritten, and the source format of ioctl definitions has been extended. The final ioctlent*.h files that are included by syscall.c are now generated from source ioctls_inc*.h and ioctls_arch*.h files at build time with ioctlsort. * ioctl.c (ioctl_lookup): Use all 32 bits of ioctl command code. * ioctlsort.c: Rewritten. * linux/32/ioctls_inc.h: New file. * linux/64/ioctls_inc.h: New file. * linux/aarch64/ioctls_arch0.h: New file. * linux/aarch64/ioctls_arch1.h: New file. * linux/aarch64/ioctls_inc0.h: New file. * linux/aarch64/ioctls_inc1.h: New file. * linux/alpha/ioctls_arch0.h: New file. * linux/alpha/ioctls_inc0.h: New file. * linux/arc/ioctls_arch0.h: New file. * linux/arc/ioctls_inc0.h: New file. * linux/arm/ioctls_arch0.h: New file. * linux/arm/ioctls_inc0.h: New file. * linux/avr32/ioctls_arch0.h: New file. * linux/avr32/ioctls_inc0.h: New file. * linux/bfin/ioctls_arch0.h: New file. * linux/bfin/ioctls_inc0.h: New file. * linux/hppa/ioctls_arch0.h: New file. * linux/hppa/ioctls_inc0.h: New file. * linux/i386/ioctls_arch0.h: New file. * linux/i386/ioctls_inc0.h: New file. * linux/ia64/ioctls_arch0.h: New file. * linux/ia64/ioctls_inc0.h: New file. * linux/m68k/ioctls_arch0.h: New file. * linux/m68k/ioctls_inc0.h: New file. * linux/metag/ioctls_arch0.h: New file. * linux/metag/ioctls_inc0.h: New file. * linux/microblaze/ioctls_arch0.h: New file. * linux/microblaze/ioctls_inc0.h: New file. * linux/mips/ioctls_arch0.h: New file. * linux/mips/ioctls_inc0.h: New file. * linux/or1k/ioctls_arch0.h: New file. * linux/or1k/ioctls_inc0.h: New file. * linux/powerpc/ioctls_arch0.h: New file. * linux/powerpc/ioctls_inc0.h: New file. * linux/powerpc64/ioctls_arch0.h: New file. * linux/powerpc64/ioctls_arch1.h: New file. * linux/powerpc64/ioctls_inc0.h: New file. * linux/powerpc64/ioctls_inc1.h: New file. * linux/s390/ioctls_arch0.h: New file. * linux/s390/ioctls_inc0.h: New file. * linux/s390x/ioctls_arch0.h: New file. * linux/s390x/ioctls_inc0.h: New file. * linux/sh/ioctls_arch0.h: New file. * linux/sh/ioctls_inc0.h: New file. * linux/sh64/ioctls_arch0.h: New file. * linux/sh64/ioctls_inc0.h: New file. * linux/sparc/ioctls_arch0.h: New file. * linux/sparc/ioctls_inc0.h: New file. * linux/sparc64/ioctls_arch0.h: New file. * linux/sparc64/ioctls_arch2.h: New file. * linux/sparc64/ioctls_inc0.h: New file. * linux/sparc64/ioctls_inc2.h: New file. * linux/tile/ioctls_arch0.h: New file. * linux/tile/ioctls_arch1.h: New file. * linux/tile/ioctls_inc0.h: New file. * linux/tile/ioctls_inc1.h: New file. * linux/x32/ioctls_arch0.h: New file. * linux/x32/ioctls_arch1.h: New file. * linux/x32/ioctls_inc0.h: New file. * linux/x32/ioctls_inc1.h: New file. * linux/x86_64/ioctls_arch0.h: New file. * linux/x86_64/ioctls_arch1.h: New file. * linux/x86_64/ioctls_inc0.h: New file. * linux/x86_64/ioctls_inc1.h: New file. * linux/xtensa/ioctls_arch0.h: New file. * linux/xtensa/ioctls_inc0.h: New file. * linux/aarch64/ioctlent.h.in: Remove. * linux/aarch64/ioctlent1.h: Remove. * linux/alpha/ioctlent.h.in: Remove. * linux/arc/ioctlent.h.in: Remove. * linux/arm/ioctlent.h.in: Remove. * linux/avr32/ioctlent.h.in: Remove. * linux/bfin/ioctlent.h.in: Remove. * linux/hppa/ioctlent.h.in: Remove. * linux/i386/ioctlent.h.in: Remove. * linux/ia64/ioctlent.h.in: Remove. * linux/ioctlent.h.in: Remove. * linux/ioctlent.sh: Remove. * linux/m68k/ioctlent.h.in: Remove. * linux/metag/ioctlent.h.in: Remove. * linux/microblaze/ioctlent.h.in: Remove. * linux/mips/ioctlent.h.in: Remove. * linux/mips/ioctlent.sh: Remove. * linux/or1k/ioctlent.h.in: Remove. * linux/powerpc/ioctlent.h.in: Remove. * linux/powerpc64/ioctlent.h: Remove. * linux/powerpc64/ioctlent1.h: Remove. * linux/s390/ioctlent.h.in: Remove. * linux/s390x/ioctlent.h.in: Remove. * linux/sh/ioctlent.h.in: Remove. * linux/sh64/ioctlent.h.in: Remove. * linux/sparc/ioctlent.h.in: Remove. * linux/sparc64/ioctlent.h.in: Remove. * linux/sparc64/ioctlent2.h: Remove. * linux/tile/ioctlent.h.in: Remove. * linux/tile/ioctlent1.h: Remove. * linux/x32/ioctlent.h.in: Remove. * linux/x32/ioctlent1.h: Remove. * linux/x86_64/ioctlent.h.in: Remove. * linux/x86_64/ioctlent1.h: Remove. * linux/xtensa/ioctlent.h.in: Remove. * linux/x86_64/ioctlent2.h: Include ioctlent0.h instead of ioctlent.h. * syscall.c (struct_ioctlent ioctlent0): Likewise. * Makefile.am: Remove all ioctlent-related definitions. Define the list of ioctlent*.h files that have to be generated by presence of $(srcdir)/$(OS)/$(ARCH)/ioctls_inc*.h files. Add rules for ioctlent*.h files generation. (EXTRA_DIST): Update. * maint/ioctls_gen.sh: New file. * maint/ioctls_hex.sh: New file. * maint/ioctls_sym.sh: New file. * maint/print_ioctlent.c: New file. * HACKING-scripts: Update for ioctlent.sh -> ioctls_gen.sh migration. * .gitignore: Add ioctlent[012].h and ioctls_all[012].h. * configure.ac (AC_CHECK_HEADERS): Add linux/hiddev.h and linux/mmtimer.h for tests. * tests/ioctl.c: New file. * tests/ioctl.test: New test. * tests/Makefile.am (check_PROGRAMS): Add ioctl. (TESTS): Add ioctl.test. * tests/.gitignore: Add ioctl.
2015-01-19 20:02:16 +03:00
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/sem.h
sys/shm.h
sys/signalfd.h
sys/xattr.h
ustat.h
]))
AC_CHECK_HEADERS([asm/sigcontext.h],,, [#include <signal.h>])
AC_CHECK_HEADERS([netinet/tcp.h netinet/udp.h],,, [#include <netinet/in.h>])
AC_CHECK_HEADERS([linux/mqueue.h],,, [#include <linux/types.h>])
AC_CHECK_HEADERS([linux/netfilter/xt_osf.h],,, [#include <linux/ip.h>
#include <linux/tcp.h>])
decode extend getsockopt/setsockopt options Currently the code assumes the set of valid options between getsockopt and setsockopt are exactly the same and thus maintains one list. The kernel unfortunately does not do this -- it allows for different opts between the get and set functions. See the {g,s}et_opt{min,max} fields in the various netfilter subcores. To support this, extend the printxval function to take multiple sets of xlats as varargs. Then we add the new get/set lists, and pass them down in the net code when decoding things. A simple example is iptables; before: getsockopt(4, SOL_IP, 0x40 /* IP_??? */, ...) = 0 getsockopt(4, SOL_IP, 0x41 /* IP_??? */, ...) = 0 after: getsockopt(4, SOL_IP, IPT_SO_GET_INFO, ...) = 0 getsockopt(4, SOL_IP, IPT_SO_GET_ENTRIES, ...) = 0 If these were setsockopt calls, then 0x40 & 0x41 would be IPT_SO_SET_REPLACE & IPT_SO_SET_ADD_COUNTERS. * configure.ac: Check for netfilter headers. * defs.h (printxvals): New prototype. (printxval): Change to a define. * net.c: Include netfilter headers and new sockopts headers. (print_sockopt_fd_level_name): Add a is_getsockopt argument. Change SOL_IP and SOL_IPV6 decoding to use printxvals, and use is_getsockopt to pass more xlats down. (getsockopt): Call print_sockopt_fd_level_name with is_getsockopt as true. (setsockopt): Call print_sockopt_fd_level_name with is_getsockopt as false. * util.c (printxval): Rename to ... (printxvals): ... this. Rewrite to be varargs based. * xlat/getsockipoptions.in: New xlat list. * xlat/getsockipv6options.in, xlat/setsockipoptions.in, xlat/setsockipv6options.in: Likewise.
2015-08-19 20:29:27 +03:00
AC_CHECK_HEADERS(m4_normalize([
linux/netfilter_arp/arp_tables.h
linux/netfilter_bridge/ebtables.h
linux/netfilter_ipv4/ip_tables.h
linux/netfilter_ipv6/ip6_tables.h
]),,, [#include <netinet/in.h>
decode extend getsockopt/setsockopt options Currently the code assumes the set of valid options between getsockopt and setsockopt are exactly the same and thus maintains one list. The kernel unfortunately does not do this -- it allows for different opts between the get and set functions. See the {g,s}et_opt{min,max} fields in the various netfilter subcores. To support this, extend the printxval function to take multiple sets of xlats as varargs. Then we add the new get/set lists, and pass them down in the net code when decoding things. A simple example is iptables; before: getsockopt(4, SOL_IP, 0x40 /* IP_??? */, ...) = 0 getsockopt(4, SOL_IP, 0x41 /* IP_??? */, ...) = 0 after: getsockopt(4, SOL_IP, IPT_SO_GET_INFO, ...) = 0 getsockopt(4, SOL_IP, IPT_SO_GET_ENTRIES, ...) = 0 If these were setsockopt calls, then 0x40 & 0x41 would be IPT_SO_SET_REPLACE & IPT_SO_SET_ADD_COUNTERS. * configure.ac: Check for netfilter headers. * defs.h (printxvals): New prototype. (printxval): Change to a define. * net.c: Include netfilter headers and new sockopts headers. (print_sockopt_fd_level_name): Add a is_getsockopt argument. Change SOL_IP and SOL_IPV6 decoding to use printxvals, and use is_getsockopt to pass more xlats down. (getsockopt): Call print_sockopt_fd_level_name with is_getsockopt as true. (setsockopt): Call print_sockopt_fd_level_name with is_getsockopt as false. * util.c (printxval): Rename to ... (printxvals): ... this. Rewrite to be varargs based. * xlat/getsockipoptions.in: New xlat list. * xlat/getsockipv6options.in, xlat/setsockipoptions.in, xlat/setsockipv6options.in: Likewise.
2015-08-19 20:29:27 +03:00
#include <net/if.h>])
AC_CHECK_HEADERS([linux/input.h], [
AC_CHECK_MEMBERS([struct input_absinfo.resolution],,, [#include <linux/input.h>])
])
tests: check bpf syscall decoder unconditionally * configure.ac (AC_CHECK_HEADERS([linux/bpf.h])): Check for struct bpf_insn. * tests/bpf.c: Remove the test guard, include "scno.h", "bpf_attr.h", "xlat.h", and "xlat/bpf_commands.h". Conditionalize inclusion of <linux/bpf.h> on HAVE_LINUX_BPF_H. Remove all HAVE_UNION_* checks. (BPF_ATTR_DATA_FIELD): New macro. (bpf_attr_data): New union. Note that it is larger than modern union bpf_attr, this allows more checks to be implemented in the future. (sizeof_attr, test_bpf_): Replace union bpf_attr with union bpf_attr_data. (DEF_BPF_INIT_FIRST): Replace union bpf_attr with the corresponding structure. (init_BPF_MAP_CREATE_attr): Replace union bpf_attr with struct BPF_MAP_CREATE_struct. (init_BPF_MAP_LOOKUP_ELEM_attr): Replace union bpf_attr with struct BPF_MAP_LOOKUP_ELEM_struct. (init_BPF_MAP_UPDATE_ELEM_attr): Replace union bpf_attr with struct BPF_MAP_UPDATE_ELEM_struct. (init_BPF_MAP_DELETE_ELEM_attr): Replace union bpf_attr with struct BPF_MAP_DELETE_ELEM_struct. (init_BPF_MAP_GET_NEXT_KEY_attr): Replace union bpf_attr with struct BPF_MAP_GET_NEXT_KEY_struct. (init_BPF_PROG_LOAD_attr): Replace union bpf_attr with struct BPF_PROG_LOAD_struct. (init_BPF_OBJ_PIN_attr): Replace union bpf_attr with struct BPF_OBJ_PIN_struct. (init_BPF_PROG_ATTACH_attr): Replace union bpf_attr with struct BPF_PROG_ATTACH_struct. (init_BPF_PROG_DETACH_attr): Replace union bpf_attr with struct BPF_PROG_DETACH_struct. (init_BPF_PROG_GET_NEXT_ID_attr): Replace union bpf_attr with struct BPF_PROG_GET_NEXT_ID_struct. (sample_BPF_PROG_TEST_RUN_attr): Change type from union bpf_attr to struct BPF_PROG_TEST_RUN_struct, all users updated. (sample_BPF_OBJ_GET_INFO_BY_FD_attr): Change type from union bpf_attr to struct BPF_OBJ_GET_INFO_BY_FD_struct, all users updated.
2018-04-03 03:35:39 +03:00
AC_CHECK_HEADERS([linux/bpf.h], [
AC_CHECK_TYPES(m4_normalize([
struct bpf_insn,
struct bpf_map_info,
struct bpf_prog_info
]),,, [#include <linux/bpf.h>])
tests: check bpf syscall decoder unconditionally * configure.ac (AC_CHECK_HEADERS([linux/bpf.h])): Check for struct bpf_insn. * tests/bpf.c: Remove the test guard, include "scno.h", "bpf_attr.h", "xlat.h", and "xlat/bpf_commands.h". Conditionalize inclusion of <linux/bpf.h> on HAVE_LINUX_BPF_H. Remove all HAVE_UNION_* checks. (BPF_ATTR_DATA_FIELD): New macro. (bpf_attr_data): New union. Note that it is larger than modern union bpf_attr, this allows more checks to be implemented in the future. (sizeof_attr, test_bpf_): Replace union bpf_attr with union bpf_attr_data. (DEF_BPF_INIT_FIRST): Replace union bpf_attr with the corresponding structure. (init_BPF_MAP_CREATE_attr): Replace union bpf_attr with struct BPF_MAP_CREATE_struct. (init_BPF_MAP_LOOKUP_ELEM_attr): Replace union bpf_attr with struct BPF_MAP_LOOKUP_ELEM_struct. (init_BPF_MAP_UPDATE_ELEM_attr): Replace union bpf_attr with struct BPF_MAP_UPDATE_ELEM_struct. (init_BPF_MAP_DELETE_ELEM_attr): Replace union bpf_attr with struct BPF_MAP_DELETE_ELEM_struct. (init_BPF_MAP_GET_NEXT_KEY_attr): Replace union bpf_attr with struct BPF_MAP_GET_NEXT_KEY_struct. (init_BPF_PROG_LOAD_attr): Replace union bpf_attr with struct BPF_PROG_LOAD_struct. (init_BPF_OBJ_PIN_attr): Replace union bpf_attr with struct BPF_OBJ_PIN_struct. (init_BPF_PROG_ATTACH_attr): Replace union bpf_attr with struct BPF_PROG_ATTACH_struct. (init_BPF_PROG_DETACH_attr): Replace union bpf_attr with struct BPF_PROG_DETACH_struct. (init_BPF_PROG_GET_NEXT_ID_attr): Replace union bpf_attr with struct BPF_PROG_GET_NEXT_ID_struct. (sample_BPF_PROG_TEST_RUN_attr): Change type from union bpf_attr to struct BPF_PROG_TEST_RUN_struct, all users updated. (sample_BPF_OBJ_GET_INFO_BY_FD_attr): Change type from union bpf_attr to struct BPF_OBJ_GET_INFO_BY_FD_struct, all users updated.
2018-04-03 03:35:39 +03:00
st_BPF_ATTR
])
AC_CHECK_HEADERS([bluetooth/bluetooth.h], [
AC_CHECK_MEMBERS([struct sockaddr_l2.l2_bdaddr_type],,,
[#include <bluetooth/bluetooth.h>
#include <bluetooth/l2cap.h>])
])
AC_CHECK_TYPES(m4_normalize([
struct br_mdb_entry,
struct br_port_msg
]),,, [#include <linux/if_bridge.h>])
AC_CHECK_MEMBERS(m4_normalize([
struct br_mdb_entry.flags,
struct br_mdb_entry.vid
]),,, [#include <linux/if_bridge.h>])
AC_CHECK_TYPES([struct dcbmsg],,, [#include <linux/dcbnl.h>])
AC_CHECK_TYPES([struct ifaddrlblmsg],,, [#include <linux/if_addrlabel.h>])
AC_CHECK_TYPES([struct netconfmsg],,, [#include <linux/netconf.h>])
AC_CHECK_TYPES(m4_normalize([
struct rta_mfc_stats,
struct rtvia
]),,, [#include <sys/socket.h>
#include <linux/rtnetlink.h>])
AC_CHECK_MEMBERS([struct ndt_stats.ndts_table_fulls],,, [#include <linux/neighbour.h>])
AC_CHECK_TYPES(m4_normalize([
struct ndt_config,
struct ndt_stats
]),,, [#include <linux/neighbour.h>])
AC_CHECK_TYPES(m4_normalize([
struct ifla_bridge_id,
struct ifla_cacheinfo,
struct ifla_port_vsi,
struct rtnl_link_stats64
]),,, [#include <sys/socket.h>
#include <linux/rtnetlink.h>])
AC_CHECK_MEMBERS(m4_normalize([
struct rtnl_link_stats.rx_nohandler,
struct rtnl_link_stats64.rx_nohandler
]),,, [#include <sys/socket.h>
#include <linux/rtnetlink.h>])
AC_CHECK_DECLS(m4_normalize([
IFLA_PORT_SELF,
IFLA_PROTINFO,
IFLA_AF_SPEC,
IFLA_XDP
]),,, [#include <sys/socket.h>
#include <linux/rtnetlink.h>])
AC_CHECK_TYPES(m4_normalize([
struct gnet_stats_basic,
struct gnet_stats_queue,
struct gnet_stats_rate_est,
struct gnet_stats_rate_est64
]),,, [#include <linux/gen_stats.h>])
AC_CHECK_TYPES([struct tc_sizespec],,, [#include <linux/types.h>
#include <linux/pkt_sched.h>])
AC_CHECK_DECLS([TCA_STAB_DATA],,, [#include <linux/types.h>
#include <linux/pkt_sched.h>])
AC_CHECK_TYPES(m4_normalize([
struct fib_rule_uid_range,
struct fib_rule_port_range
]),,, [#include <linux/fib_rules.h>])
AC_CHECK_TYPES([struct statfs], [
AC_CHECK_MEMBERS(m4_normalize([
struct statfs.f_frsize,
struct statfs.f_flags,
struct statfs.f_fsid.val,
struct statfs.f_fsid.__val
]),,, [#include <linux/types.h>
#include <asm/statfs.h>])
],, [#include <linux/types.h>
#include <asm/statfs.h>])
AC_CHECK_TYPES([struct statfs64], [
AC_CHECK_MEMBERS(m4_normalize([
struct statfs64.f_frsize,
struct statfs64.f_flags,
struct statfs64.f_fsid.val,
struct statfs64.f_fsid.__val
]),,, [#include <linux/types.h>
#include <asm/statfs.h>])
],, [#include <linux/types.h>
#include <asm/statfs.h>])
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>])
ioctl: add decoding support for btrfs ioctls * btrfs.c: New file. * file_ioctl.c: Likewise. * Makefile.am (strace_SOURCES): Add them. * configure.ac (AC_CHECK_HEADERS): Add linux/btrfs.h. (AC_CHECK_MEMBERS): Add struct btrfs_ioctl_feature_flags.compat_flags, struct btrfs_ioctl_fs_info_args.nodesize, struct btrfs_ioctl_defrag_range_args.start, and struct btrfs_ioctl_search_args_v2.buf_size. (AC_CHECK_DECLS): Add BTRFS_COMPRESS_* enums. * defs.h (btrfs_ioctl, file_ioctl): New prototypes. * ioctl.c (ioctl_decode) [HAVE_LINUX_BTRFS_H]: Use btrfs_ioctl. * xlat/btrfs_balance_args.in: New file. * xlat/btrfs_balance_ctl_cmds.in: Likewise. * xlat/btrfs_balance_flags.in: Likewise. * xlat/btrfs_balance_state.in: Likewise. * xlat/btrfs_compress_types.in: Likewise. * xlat/btrfs_defrag_flags.in: Likewise. * xlat/btrfs_dev_replace_cmds.in: Likewise. * xlat/btrfs_dev_replace_results.in: Likewise. * xlat/btrfs_dev_replace_state.in: Likewise. * xlat/btrfs_dev_stats_flags.in: Likewise. * xlat/btrfs_dev_stats_values.in: Likewise. * xlat/btrfs_features_compat.in: Likewise. * xlat/btrfs_features_compat_ro.in: Likewise. * xlat/btrfs_features_incompat.in: Likewise. * xlat/btrfs_key_types.in: Likewise. * xlat/btrfs_qgroup_ctl_cmds.in: Likewise. * xlat/btrfs_qgroup_inherit_flags.in: Likewise. * xlat/btrfs_qgroup_limit_flags.in: Likewise. * xlat/btrfs_qgroup_status_flags.in: Likewise. * xlat/btrfs_scrub_flags.in: Likewise. * xlat/btrfs_send_flags.in: Likewise. * xlat/btrfs_snap_flags_v2.in: Likewise. * xlat/btrfs_space_info_flags.in: Likewise. * xlat/btrfs_tree_objectids.in: Likewise.
2016-05-19 01:09:39 +03:00
AC_CHECK_HEADERS([linux/btrfs.h], [
AC_CHECK_MEMBERS(m4_normalize([
struct btrfs_ioctl_feature_flags.compat_flags,
struct btrfs_ioctl_fs_info_args.nodesize,
struct btrfs_ioctl_defrag_range_args.start,
struct btrfs_ioctl_search_args_v2.buf_size,
struct btrfs_ioctl_logical_ino_args.flags
ioctl: add decoding support for btrfs ioctls * btrfs.c: New file. * file_ioctl.c: Likewise. * Makefile.am (strace_SOURCES): Add them. * configure.ac (AC_CHECK_HEADERS): Add linux/btrfs.h. (AC_CHECK_MEMBERS): Add struct btrfs_ioctl_feature_flags.compat_flags, struct btrfs_ioctl_fs_info_args.nodesize, struct btrfs_ioctl_defrag_range_args.start, and struct btrfs_ioctl_search_args_v2.buf_size. (AC_CHECK_DECLS): Add BTRFS_COMPRESS_* enums. * defs.h (btrfs_ioctl, file_ioctl): New prototypes. * ioctl.c (ioctl_decode) [HAVE_LINUX_BTRFS_H]: Use btrfs_ioctl. * xlat/btrfs_balance_args.in: New file. * xlat/btrfs_balance_ctl_cmds.in: Likewise. * xlat/btrfs_balance_flags.in: Likewise. * xlat/btrfs_balance_state.in: Likewise. * xlat/btrfs_compress_types.in: Likewise. * xlat/btrfs_defrag_flags.in: Likewise. * xlat/btrfs_dev_replace_cmds.in: Likewise. * xlat/btrfs_dev_replace_results.in: Likewise. * xlat/btrfs_dev_replace_state.in: Likewise. * xlat/btrfs_dev_stats_flags.in: Likewise. * xlat/btrfs_dev_stats_values.in: Likewise. * xlat/btrfs_features_compat.in: Likewise. * xlat/btrfs_features_compat_ro.in: Likewise. * xlat/btrfs_features_incompat.in: Likewise. * xlat/btrfs_key_types.in: Likewise. * xlat/btrfs_qgroup_ctl_cmds.in: Likewise. * xlat/btrfs_qgroup_inherit_flags.in: Likewise. * xlat/btrfs_qgroup_limit_flags.in: Likewise. * xlat/btrfs_qgroup_status_flags.in: Likewise. * xlat/btrfs_scrub_flags.in: Likewise. * xlat/btrfs_send_flags.in: Likewise. * xlat/btrfs_snap_flags_v2.in: Likewise. * xlat/btrfs_space_info_flags.in: Likewise. * xlat/btrfs_tree_objectids.in: Likewise.
2016-05-19 01:09:39 +03:00
]),,, [ #include <stdio.h>
#include <linux/btrfs.h>])
AC_CHECK_DECLS(m4_normalize([BTRFS_COMPRESS_NONE, BTRFS_COMPRESS_ZLIB,
BTRFS_COMPRESS_LZO]),,,[ #include <stdio.h>
ioctl: add decoding support for btrfs ioctls * btrfs.c: New file. * file_ioctl.c: Likewise. * Makefile.am (strace_SOURCES): Add them. * configure.ac (AC_CHECK_HEADERS): Add linux/btrfs.h. (AC_CHECK_MEMBERS): Add struct btrfs_ioctl_feature_flags.compat_flags, struct btrfs_ioctl_fs_info_args.nodesize, struct btrfs_ioctl_defrag_range_args.start, and struct btrfs_ioctl_search_args_v2.buf_size. (AC_CHECK_DECLS): Add BTRFS_COMPRESS_* enums. * defs.h (btrfs_ioctl, file_ioctl): New prototypes. * ioctl.c (ioctl_decode) [HAVE_LINUX_BTRFS_H]: Use btrfs_ioctl. * xlat/btrfs_balance_args.in: New file. * xlat/btrfs_balance_ctl_cmds.in: Likewise. * xlat/btrfs_balance_flags.in: Likewise. * xlat/btrfs_balance_state.in: Likewise. * xlat/btrfs_compress_types.in: Likewise. * xlat/btrfs_defrag_flags.in: Likewise. * xlat/btrfs_dev_replace_cmds.in: Likewise. * xlat/btrfs_dev_replace_results.in: Likewise. * xlat/btrfs_dev_replace_state.in: Likewise. * xlat/btrfs_dev_stats_flags.in: Likewise. * xlat/btrfs_dev_stats_values.in: Likewise. * xlat/btrfs_features_compat.in: Likewise. * xlat/btrfs_features_compat_ro.in: Likewise. * xlat/btrfs_features_incompat.in: Likewise. * xlat/btrfs_key_types.in: Likewise. * xlat/btrfs_qgroup_ctl_cmds.in: Likewise. * xlat/btrfs_qgroup_inherit_flags.in: Likewise. * xlat/btrfs_qgroup_limit_flags.in: Likewise. * xlat/btrfs_qgroup_status_flags.in: Likewise. * xlat/btrfs_scrub_flags.in: Likewise. * xlat/btrfs_send_flags.in: Likewise. * xlat/btrfs_snap_flags_v2.in: Likewise. * xlat/btrfs_space_info_flags.in: Likewise. * xlat/btrfs_tree_objectids.in: Likewise.
2016-05-19 01:09:39 +03:00
#include <linux/btrfs.h>])])
AC_CHECK_DECLS([sys_errlist])
AC_CHECK_DECLS(m4_normalize([
PTRACE_PEEKUSER,
PTRACE_POKEUSER
]),,, [#include <sys/ptrace.h>])
AC_CHECK_DECLS(m4_normalize([
P_PID,
P_PPID,
P_PGID,
P_SID,
P_CID,
P_UID,
P_GID,
P_ALL,
P_LWPID
]),,, [#include <sys/wait.h>])
AC_CHECK_DECLS(m4_normalize([
LO_FLAGS_READ_ONLY,
LO_FLAGS_USE_AOPS,
LO_FLAGS_AUTOCLEAR,
LO_FLAGS_PARTSCAN,
LO_FLAGS_DIRECT_IO
]),,, [#include <linux/loop.h>])
AC_CHECK_DECLS(m4_normalize([
CTL_PROC,
CTL_ARLAN,
CTL_S390DBF,
CTL_SUNRPC,
CTL_PM,
CTL_FRV,
KERN_PRINTK_RATELIMIT,
KERN_PRINTK_RATELIMIT_BURST,
KERN_PTY,
KERN_NGROUPS_MAX,
KERN_SPARC_SCONS_PWROFF,
KERN_HZ_TIMER,
KERN_UNKNOWN_NMI_PANIC,
KERN_BOOTLOADER_TYPE,
KERN_RANDOMIZE,
KERN_SETUID_DUMPABLE,
KERN_SPIN_RETRY,
KERN_ACPI_VIDEO_FLAGS,
KERN_IA64_UNALIGNED,
KERN_COMPAT_LOG,
KERN_MAX_LOCK_DEPTH,
KERN_NMI_WATCHDOG,
KERN_PANIC_ON_NMI,
NET_LLC,
NET_NETFILTER,
NET_DCCP,
NET_IRDA,
NET_CORE_DESTROY_DELAY,
NET_CORE_BUDGET,
NET_CORE_AEVENT_ETIME,
NET_CORE_AEVENT_RSEQTH,
NET_CORE_WARNINGS,
NET_IPV4_IGMP_MAX_MSF,
NET_TCP_NO_METRICS_SAVE,
NET_TCP_DEFAULT_WIN_SCALE,
NET_TCP_MODERATE_RCVBUF,
NET_TCP_TSO_WIN_DIVISOR,
NET_TCP_BIC_BETA,
NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR,
NET_TCP_CONG_CONTROL,
NET_TCP_ABC,
NET_IPV4_IPFRAG_MAX_DIST,
NET_TCP_MTU_PROBING,
NET_TCP_BASE_MSS,
NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS,
NET_TCP_DMA_COPYBREAK,
NET_TCP_SLOW_START_AFTER_IDLE,
NET_CIPSOV4_CACHE_ENABLE,
NET_CIPSOV4_CACHE_BUCKET_SIZE,
NET_CIPSOV4_RBM_OPTFMT,
NET_CIPSOV4_RBM_STRICTVALID,
NET_TCP_AVAIL_CONG_CONTROL,
NET_TCP_ALLOWED_CONG_CONTROL,
NET_TCP_MAX_SSTHRESH,
NET_TCP_FRTO_RESPONSE,
NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS,
NET_IPV4_CONF_FORCE_IGMP_VERSION,
NET_IPV4_CONF_ARP_ANNOUNCE,
NET_IPV4_CONF_ARP_IGNORE,
NET_IPV4_CONF_PROMOTE_SECONDARIES,
NET_IPV4_CONF_ARP_ACCEPT,
NET_IPV4_CONF_ARP_NOTIFY,
NET_IPV6_MLD_MAX_MSF,
NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS,
VM_MAX_MAP_COUNT,
VM_LAPTOP_MODE,
VM_BLOCK_DUMP,
VM_HUGETLB_GROUP,
VM_VFS_CACHE_PRESSURE,
VM_LEGACY_VA_LAYOUT,
VM_SWAP_TOKEN_TIMEOUT
]),,,
[#include <sys/types.h>
#include <linux/sysctl.h>])
AC_CHECK_DECLS(m4_normalize([
V4L2_FIELD_ANY,
V4L2_FIELD_NONE,
V4L2_FIELD_TOP,
V4L2_FIELD_BOTTOM,
V4L2_FIELD_INTERLACED,
V4L2_FIELD_SEQ_TB,
V4L2_FIELD_SEQ_BT,
V4L2_FIELD_ALTERNATE,
V4L2_FIELD_INTERLACED_TB,
V4L2_FIELD_INTERLACED_BT,
V4L2_BUF_TYPE_VIDEO_CAPTURE,
V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
V4L2_BUF_TYPE_VIDEO_OUTPUT,
V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
V4L2_BUF_TYPE_VIDEO_OVERLAY,
V4L2_BUF_TYPE_VBI_CAPTURE,
V4L2_BUF_TYPE_VBI_OUTPUT,
V4L2_BUF_TYPE_SLICED_VBI_CAPTURE,
V4L2_BUF_TYPE_SLICED_VBI_OUTPUT,
V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY,
V4L2_BUF_TYPE_SDR_CAPTURE,
V4L2_BUF_TYPE_SDR_OUTPUT,
V4L2_TUNER_RADIO,
V4L2_TUNER_ANALOG_TV,
V4L2_TUNER_DIGITAL_TV,
V4L2_MEMORY_MMAP,
V4L2_MEMORY_USERPTR,
V4L2_MEMORY_OVERLAY,
V4L2_MEMORY_DMABUF,
V4L2_COLORSPACE_SMPTE170M,
V4L2_COLORSPACE_SMPTE240M,
V4L2_COLORSPACE_REC709,
V4L2_COLORSPACE_BT878,
V4L2_COLORSPACE_470_SYSTEM_M,
V4L2_COLORSPACE_470_SYSTEM_BG,
V4L2_COLORSPACE_JPEG,
V4L2_COLORSPACE_SRGB,
V4L2_PRIORITY_UNSET,
V4L2_PRIORITY_BACKGROUND,
V4L2_PRIORITY_INTERACTIVE,
V4L2_PRIORITY_RECORD,
V4L2_FRMSIZE_TYPE_DISCRETE,
V4L2_FRMSIZE_TYPE_CONTINUOUS,
V4L2_FRMSIZE_TYPE_STEPWISE,
V4L2_FRMIVAL_TYPE_DISCRETE,
V4L2_FRMIVAL_TYPE_CONTINUOUS,
V4L2_FRMIVAL_TYPE_STEPWISE,
V4L2_CTRL_TYPE_INTEGER,
V4L2_CTRL_TYPE_BOOLEAN,
V4L2_CTRL_TYPE_MENU,
V4L2_CTRL_TYPE_BUTTON,
V4L2_CTRL_TYPE_INTEGER64,
V4L2_CTRL_TYPE_CTRL_CLASS,
V4L2_CTRL_TYPE_STRING,
V4L2_CTRL_TYPE_BITMASK,
V4L2_CTRL_TYPE_INTEGER_MENU
]),,, [#include <sys/time.h>
#include <linux/ioctl.h>
#include <linux/types.h>
#include <linux/videodev2.h>])
AC_CHECK_MEMBERS(m4_normalize([
struct v4l2_window.global_alpha,
struct v4l2_sdr_format.buffersize
]),,, [#include <sys/time.h>
#include <linux/ioctl.h>
#include <linux/types.h>
#include <linux/videodev2.h>])
AC_CACHE_CHECK([for BLKGETSIZE64], [ac_cv_have_blkgetsize64],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#include <stdlib.h>
#include <linux/fs.h>], [return !BLKGETSIZE64;])],
[ac_cv_have_blkgetsize64=yes], [ac_cv_have_blkgetsize64=no])]
if test $ac_cv_have_blkgetsize64 = yes; then
AC_DEFINE([HAVE_BLKGETSIZE64], [1], [Define to 1 if you 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 - |
grep '^[0-9]')"
test -n "$st_cv_SIGRTMIN" || st_cv_SIGRTMIN=no]])
if test "x$st_cv_SIGRTMIN" != xno; then
AC_DEFINE_UNQUOTED([ASM_SIGRTMIN], [$st_cv_SIGRTMIN],
[SIGRTMIN defined in <asm/signal.h>])
fi
AC_CACHE_CHECK([for SA_RESTORER], [st_cv_SA_RESTORER],
[st_cv_SA_RESTORER="$(echo SA_RESTORER |
$CPP $CPPFLAGS -P -imacros asm/signal.h - |
grep ^0x)"
test -n "$st_cv_SA_RESTORER" || st_cv_SA_RESTORER=no])
if test "x$st_cv_SA_RESTORER" != xno; then
AC_DEFINE_UNQUOTED([ASM_SA_RESTORER], [$st_cv_SA_RESTORER],
[SA_RESTORER defined in <asm/signal.h>])
fi
AC_CACHE_CHECK([for __builtin_popcount], [st_cv_have___builtin_popcount],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([], [__builtin_popcount(0)])],
[st_cv_have___builtin_popcount=yes],
[st_cv_have___builtin_popcount=no])])
if test "x$st_cv_have___builtin_popcount" = xyes; then
AC_DEFINE([HAVE___BUILTIN_POPCOUNT], [1],
[Define to 1 if the system provides __builtin_popcount function])
fi
AC_CACHE_CHECK([for program_invocation_name], [st_cv_have_program_invocation_name],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <errno.h>]],
[[return !*program_invocation_name]])],
[st_cv_have_program_invocation_name=yes],
[st_cv_have_program_invocation_name=no])])
if test "x$st_cv_have_program_invocation_name" = xyes; then
AC_DEFINE([HAVE_PROGRAM_INVOCATION_NAME], [1],
[Define to 1 if the system provides program_invocation_name variable])
fi
AC_CACHE_CHECK([for static_assert], [st_cv_have_static_assert],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <assert.h>]],
[[static_assert(1,"")]]
)
],
[st_cv_have_static_assert=yes],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([],
[[_Static_assert(1,"")]]
)
],
[st_cv_have_static_assert=_Static_assert],
[st_cv_have_static_assert=no]
)
]
)
]
)
case "x$st_cv_have_static_assert" in
xyes)
AC_DEFINE([HAVE_STATIC_ASSERT], [1],
[Define to 1 if the system provides static_assert])
;;
x_Static_assert)
AC_DEFINE([HAVE__STATIC_ASSERT], [1],
[Define to 1 if the system provides _Static_assert])
;;
esac
AC_CHECK_LIB([dl], [dladdr], [dl_LIBS='-ldl'], [dl_LIBS=])
if test "x$ac_cv_lib_dl_dladdr" = xyes; then
AC_DEFINE([HAVE_DLADDR], [1], [Define to 1 if the system provides dladdr])
fi
AC_SUBST(dl_LIBS)
Implement delay injection Add -e inject=SET:delay_enter= and -e inject=SET:delay_exit= options. * configure.ac (AC_SEARCH_LIBS): Check for timer_create -lrt. * delay.c: New file. * Makefile.am (strace_SOURCES): Add it. (strace_LDADD): Add $(timer_LIBS). * defs.h (INJECT_F_DELAY_ENTER, INJECT_F_DELAY_EXIT, TCB_INJECT_DELAY_EXIT, TCB_DELAYED, inject_delay_exit, syscall_delayed): New macros. (alloc_delay_data, fill_delay_data, is_delay_timer_created, arm_delay_timer, delay_tcb): New prototypes. (struct inject_data): Replace reserved field with delay_idx. (struct tcb): Add delay_expiration_time field. * filter_qualify.c (parse_delay_token): New function. (parse_inject_token): Use it. (qualify_inject_common): Initialize struct inject_opts.data.delay_idx. * strace.c: Include <setjmp.h> (timer_jmp_buf, timer_set): New static variables. (timer_sighandler, restart_delayed_tcb, restart_delayed_tcbs): New functions. (init): Block SIGALRM, set SIGALRM handler. (dispatch_event): Do not restart delayed syscalls. (next_event): Unblock SIGALRM during wait4 invocation. * syscall.c (tamper_with_syscall_entering): Arm delay timer if INJECT_F_DELAY_ENTER injection flag is set, set TCB_INJECT_DELAY_EXIT flag if INJECT_F_DELAY_EXIT injection flag is set. tamper_with_syscall_exiting): Arm delay timer if inject_delay_exit. (syscall_exiting_trace): Call tamper_with_syscall_exiting in case of inject_delay_exit. (syscall_exiting_finish): Clear TCB_INJECT_DELAY_EXIT flag. * strace.1.in: Document delay injection. * NEWS: Mention this improvement. Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-02-18 23:21:48 +03:00
saved_LIBS="$LIBS"
AC_SEARCH_LIBS([timer_create], [rt])
LIBS="$saved_LIBS"
case "$ac_cv_search_timer_create" in
no) AC_MSG_FAILURE([failed to find timer_create]) ;;
-l*) timer_LIBS="$ac_cv_search_timer_create" ;;
*) timer_LIBS= ;;
esac
AC_SUBST(timer_LIBS)
saved_LIBS="$LIBS"
AC_SEARCH_LIBS([clock_gettime], [rt])
LIBS="$saved_LIBS"
case "$ac_cv_search_clock_gettime" in
no) AC_MSG_FAILURE([failed to find clock_gettime]) ;;
-l*) clock_LIBS="$ac_cv_search_clock_gettime" ;;
*) clock_LIBS= ;;
esac
AC_SUBST(clock_LIBS)
saved_LIBS="$LIBS"
AC_SEARCH_LIBS([mq_open], [rt])
LIBS="$saved_LIBS"
case "$ac_cv_search_mq_open" in
-l*) mq_LIBS="$ac_cv_search_mq_open" ;;
*) mq_LIBS= ;;
esac
AC_SUBST(mq_LIBS)
AC_PATH_PROG([PERL], [perl])
AC_CHECK_TOOL([READELF], [readelf])
st_STACKTRACE
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. Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2017-12-18 07:24:55 +03:00
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_ERROR([Failed to generate syscallent stubs])
fi
fi
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])
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-10 23:20:06 +03:00
st_MPERS([m32], [aarch64|powerpc64|riscv|s390x|sparc64|tile|x32|x86_64])
st_MPERS([mx32], [x86_64])
AX_VALGRIND_DFLT([sgcheck], [off])
AX_VALGRIND_CHECK
AC_CONFIG_FILES([Makefile
tests/Makefile
tests-m32/Makefile
tests-mx32/Makefile
strace.1
strace-log-merge.1
strace.spec
debian/changelog])
AC_OUTPUT