Commit Graph

4458 Commits

Author SHA1 Message Date
b2dd46398f zero_extend_signed_to_ull: add short int support
* defs.h (zero_extend_signed_to_ull): Add short int support.
* tests/tests.h: Likewise.
2016-08-23 00:24:17 +00:00
031fc80059 Rename widen_to_ull to zero_extend_signed_to_ull
* defs.h (widen_to_ull): Rename to zero_extend_signed_to_ull.
All callers changed.
* tests/tests.h: Likewise.
2016-08-23 00:24:10 +00:00
3cac5ddd01 sparc, sparc64: remove obsolete code
Remove remains of solaris personality support.
This complements commit v4.10-45-gdf4dd8b.

* file.c [SPARC || SPARC64] (SYS_FUNC(xstat), SYS_FUNC(fxstat)): Remove.
2016-08-23 00:24:03 +00:00
5f5fd0d6e2 sparc64: fix decoding of struct stat64 related syscalls
For some reason, struct stat and struct stat64 are different on sparc64.
This change fixes decoding of struct stat64 related syscalls for sparc64
personality, sparc32 personality on sparc64 needs more work.

* file.c (printstat64) [SPARC64]: Do not use printstat.
(SYS_FUNC(newfstatat)): Likewise.
2016-08-22 09:35:13 +00:00
Eugene Syromyatnikov
bce8163937 tests: fill old_value argument in timer{,fd}_xettime tests
This is needed in order to differentiate it from the value returned
by the call.  As a consequence, it enables revealing possible bugs
in syscall parsers, for example, when the value read on syscall
entering and not on syscall exiting, as it was the case with
timerfd_settime parser.

* tests/timer_xettime.c (main): Fill old.its field with value different
from the expected one upon call return.
* tests/timerfd_xettime.c: Likewise.
2016-08-22 09:32:47 +00:00
Eugene Syromyatnikov
b53f546d3e Fix old_value argument retrieval in timerfd_settime parser
This is done similar to timer_settime syscall parser.

* time.c (SYS_FUNC(timerfd_settime)): Retrieve old_value argument
on exiting and not on entering.  Return 0 instead of RVAL_DECODED
since the call hasn't been decoded in full on entering.
2016-08-22 09:32:47 +00:00
Richard W.M. Jones
d8f673568b Add RISC-V architecture support
The original port of strace was done by Palmer Dabbelt
(eecs.berkeley.edu), based on strace 4.9.

* configure.ac: Define RISCV for riscv*.
* clone.c [RISCV]: Define ARG_* macros as for OR1K.
* defs.h [RISCV] (SUPPORTED_PERSONALITIES): Define to 2.
[RISCV] (NEED_UID16_PARSERS): Define to 1.
* linux/riscv/arch_regs.c: New file.
* linux/riscv/errnoent1.h: Likewise.
* linux/riscv/get_error.c: Likewise.
* linux/riscv/get_scno.c: Likewise.
* linux/riscv/get_syscall_args.c: Likewise.
* linux/riscv/ioctls_arch0.h: Likewise.
* linux/riscv/ioctls_arch1.h: Likewise.
* linux/riscv/ioctls_inc0.h: Likewise.
* linux/riscv/ioctls_inc1.h: Likewise.
* linux/riscv/signalent1.h: Likewise.
* linux/riscv/stat32.h: Likewise.
* linux/riscv/syscallent.h: Likewise.
* linux/riscv/syscallent1.h: Likewise.
* Makefile.am (EXTRA_DIST): Add them.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
2016-08-21 22:03:05 +00:00
Eugene Syromyatnikov
714a162048 Move SH-specific argument number calculation to getllval
This change prevents scattering of ll-related hacks and simplifies
pread/pwrite syscalls parsers' logic a bit.

* util.c (getllval): Add fixup for arg_no for SuperH when argument
number is equal to 3.
* io.c (PREAD_OFFSET_ARG): Remove.
(SYS_FUNC(pread)): Always use argument number 3 for "count" argument
printing.
(SYS_FUNC(pwrite)): Likewise.
2016-08-21 22:02:20 +00:00
ae5feb49c2 sparc64: fix sigreturn decoding for sparc personality
* linux/sparc/arch_sigreturn.c (arch_sigreturn): Parametrize
member types of struct signal_frame.
* linux/sparc64/arch_sigreturn.c (sparc64_arch_sigreturn,
sparc32_arch_sigreturn): New functions.
(arch_sigreturn): Use them.
2016-08-21 22:02:09 +00:00
aa0c46ffed Fix compat decoding of struct sigaction.sa_mask on big endian architectures
* signal.c (decode_new_sigaction) [SUPPORTED_PERSONALITIES > 1 &&
SIZEOF_LONG > 4]: Use LONG_LONG to convert sa_mask from 32-bit
struct sigaction to 64-bit struct sigaction.
2016-08-20 00:08:10 +00:00
3dfed0ef4e Fix decoding of indirect shmat's return code for non-native personalities
* ipc_shm.c (SYS_FUNC(shmat)): Fetch current_wordsize bytes of data
to obtain return code of indirect shmat subcall.
2016-08-19 22:57:27 +00:00
a48bbc70e8 sparc64: fix sparc personality decoding of mmap64's offset argument
* linux/sparc64/syscallent1.h: Remove redirection of sys_mmap_4koff.
2016-08-18 22:33:12 +00:00
1a6470fc80 sparc64: fix decoding of the forth argument of semctl syscall
On sparc64, unlike all other architectures where semctl is an indirect
ipc subcall, the forth argument is passed directly.

* ipc_sem.c (SYS_FUNC(semctl)) [SPARC64]: Print 4th argument without
indirection in case of native personality.
2016-08-19 22:11:46 +00:00
4b69c4736c Add sparc64 specific ptrace constants
* xlat/ptrace_cmds.in: Add PTRACE_GETREGS64, PTRACE_SETREGS64,
PTRACE_GETFPREGS64, and PTRACE_SETFPREGS64.
2016-08-16 09:15:44 +00:00
daa04830aa sparc64: fix sign extension bug of syscall args for sparc personality
* linux/sparc64/get_syscall_args.c (get_syscall_args): Zero-extend
syscall args from 32 bit for sparc personality.
2016-08-16 09:15:36 +00:00
23a51410ba sparc64: fix tty ioctl numbers
The structures defined in asm/termbits.h have the same size
on sparc and sparc64.

* linux/sparc64/ioctls_arch0.h (TCGETS, TCGETS2, TCSETS, TCSETS2,
TCSETSF, TCSETSF2, TCSETSW, TCSETSW2): Sync with
linux/sparc/ioctls_arch0.h
2016-08-16 09:15:24 +00:00
7af5e6593f evdev.c: fix typo in comment 2016-08-15 21:08:56 +00:00
7e2fe5029a Drop support of dummy members of struct stat
As st_flags, st_fstype, and st_gen members of struct stat are not filled
by the kernel, there is no use supporting them.

* configure.ac (AC_CHECK_MEMBERS): Remove struct stat.st_flags,
struct stat.st_fstype, and struct stat.st_gen.
* file.c [STAT32_PERSONALITY, HAVE_STRUCT_STAT64]: Do not undefine
HAVE_STRUCT_STAT_ST_FLAGS, HAVE_STRUCT_STAT_ST_FSTYPE,
and HAVE_STRUCT_STAT_ST_GEN.
* printstat.h (DO_PRINTSTAT): Do not check for
HAVE_STRUCT_STAT_ST_FLAGS, HAVE_STRUCT_STAT_ST_FSTYPE,
and HAVE_STRUCT_STAT_ST_GEN.
2016-08-15 19:09:24 +00:00
18cac625e5 Assume that struct stat contains st_blksize, st_blocks, and st_rdev
Our test suite already assumes that struct stat contains st_blksize,
st_blocks, and st_rdev members, and there haven't been any complaints.

* configure.ac (AC_CHECK_MEMBERS): Remove struct stat.st_blksize,
struct stat.st_blocks, and struct stat.st_rdev.
* printstat.h (DO_PRINTSTAT): Do not check for
HAVE_STRUCT_STAT_ST_BLKSIZE, HAVE_STRUCT_STAT_ST_BLOCKS,
and HAVE_STRUCT_STAT_ST_RDEV.
2016-08-15 22:06:06 +03:00
472ce30535 tests: fix pause.test when pause syscall is not available
* tests/pause.c (main): Fix expected output when pause syscall
is not available.
2016-08-15 22:06:06 +03:00
aaa7a77b5f powerpc64, sparc64: fix redefinitions of ARCH_PC_REG
This fixes compilation warning that ARCH_PC_REG is redefined.

* linux/powerpc64/arch_regs.c (ARCH_PC_REG): Undefine before
the new definition.
* linux/sparc64/arch_regs.c (ARCH_PC_REG): Likewise.
2016-08-14 00:03:03 +00:00
8e982692d4 s390x, x32: remove redundant definitions of ARCH_PC_REG
* linux/s390x/arch_regs.c (ARCH_PC_REG): Remove, it is already defined
in just included linux/s390/arch_regs.c.
* linux/x32/arch_regs.c (ARCH_PC_REG): Remove, it is already defined
in just included linux/x86_64/arch_regs.c.
2016-08-14 00:02:55 +00:00
7c6e8f1490 tests: check for leaks of placeholder descriptors
* tests/redirect-fds.c: New file.
* tests/redirect-fds.test: New test.
* tests/.gitignore: Add redirect-fds.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add redirect-fds.test.
2016-08-13 22:05:28 +00:00
e4e9df2259 tests/init.sh: print exit code of failed commands
* init.sh (run_prog, run_prog_skip_if_failed): When the program fails,
add its exit code to the diagnostic message.
(run_strace): When strace fails, add its exit code to the diagnostic
message.
(run_strace_merge): When strace-log-merge fails, add its exit code
to the diagnostic message.
2016-08-13 22:05:20 +00:00
559ec3e06d Fix leakage of placeholder descriptors to tracees
As a side effect of commit v4.11-211-g0736d4e, strace used to leak
placeholders for standard descriptors to tracees thus affecting their
behaviour.  Fix this by setting close-on-exec flag on placeholder
descriptors.

* strace.c (open_dummy_desc): Set close-on-exec flag on the descriptor
that is going to be returned to the caller.
(fd_is_placeholder): New array.
(ensure_standard_fds_opened, redirect_standard_fds): New functions.
(startup_child): Use redirect_standard_fds.
(init): Use ensure_standard_fds_opened.
2016-08-13 22:04:59 +00:00
c65e6b9989 sparc64: fix decoding of uid and gid-related syscalls
sparc64 has no native 16-bit uid/gid syscalls.

* linux/sparc64/syscallent.h (chown, lchown, setuid, getuid, setgid,
getgid, geteuid, getegid, getgroups, setgroups, fchown, setreuid,
setregid, setfsuid, setfsgid): Change handlers from 16-bit to 32-bit.
2016-08-12 01:00:04 +00:00
ad109aba29 tests: fix *stat64 tests on alpha
On some architectures including alpha, <asm/stat.h> provides a
definition of struct stat that has no st_atime_nsec, st_mtime_nsec, and
st_ctime_nsec fields.  At the same time, struct stat64 always has these
fields.  Fix tests to take this difference into account.

* tests/fstat64.c (STRUCT_STAT_IS_STAT64): New macro, defined to 1.
* tests/lstat64.c (STRUCT_STAT_IS_STAT64): Likewise.
* tests/stat64.c (STRUCT_STAT_IS_STAT64): Likewise.
* tests/xstatx.c [!STRUCT_STAT] (STRUCT_STAT_IS_STAT64): New macro,
defined to 0.
[USE_ASM_STAT && STRUCT_STAT_IS_STAT64]:
(HAVE_STRUCT_STAT_ST_ATIME_NSEC, HAVE_STRUCT_STAT_ST_CTIME_NSEC,
HAVE_STRUCT_STAT_ST_MTIME_NSEC): Redefine to 1.
2016-08-12 00:07:54 +00:00
67ee3d6184 tests: skip rt_tgsigqueueinfo.test when the syscall is not available
* tests/rt_tgsigqueueinfo.c (main): Skip the test when the syscall
is not available.
2016-08-11 17:58:09 +00:00
James Cowgill
a9147beeb0 tests/fcntl.c: fix fcntl test on mips64
On mips64 the F_GETLK and F_SETLKW64 constants have identical values which
causes the "wrong" constant to be printed by strace.

tests/fcntl.c (test_flock64): Do not test F_SETLKW64 on mips64.
2016-08-11 16:48:12 +00:00
James Cowgill
468dccf59d tests/nsyscalls.test: only trace the "syscall" syscall on mips o32
The "syscall" syscall only exists on o32 and causes strace to error out on
64-bit mips ABIs. Pass MIPS_ABI from the configure script through to
nsyscalls.test so the MIPS ABI can be checked.

* configure.ac (MIPS_ABI): Substitute into output files.
* tests/Makefile.am (MIPS_ABI): Export via AM_TEST_LOG_FLAGS.
* tests/nsyscalls.test: Restrict special mips handling to mips o32.
2016-08-11 16:47:29 +00:00
James Cowgill
3fb84bfc79 tests/xstatx.c: fix stat syscall tests on mips64
For historical reasons the kernel struct stat represents times as unsigned
32-bit integers on mips64. Therefore, while it's possible to give a file a
timestamp before 1970 with futimens, reading the same timestamp through
struct stat will give a positive time (around 2106).
Workaround by using positive timestamps for testing on mips64.

* tests/xstatx.c (create_sample): Use positive timestamps on mips64.
2016-08-11 16:45:23 +00:00
0bc735e5aa tests/mlock2.c: fix test failure on mips64
* tests/mlock2.c (main): Pass unsigned long arguments to mlock2 syscall
explicitly, to avoid unwanted sign extension issues.

Based on patch by James Cowgill <james410@cowgill.org.uk>
2016-08-11 11:18:56 +00:00
6a2f43ce64 Use <asm/unistd.h> instead of <sys/syscall.h>
There are no users of SYS_* macros provided by <sys/syscall.h>,
and definitions of __NR_* macros could be obtained directly
from <asm/unistd.h>.

* defs.h: Include <asm/unistd.h> instead of <sys/syscall.h>.
* test/seccomp.c: Likewise.
* test/threaded_execve.c: Likewise.
* test/x32_lseek.c: Likewise.
* test/x32_mmap.c: Likewise.
* tests/_newselect.c: Likewise.
* tests/access.c: Likewise.
* tests/acct.c: Likewise.
* tests/aio.c: Likewise.
* tests/alarm.c: Likewise.
* tests/attach-f-p.c: Likewise.
* tests/bpf.c: Likewise.
* tests/brk.c: Likewise.
* tests/chmod.c: Likewise.
* tests/chown.c: Likewise.
* tests/chown32.c: Likewise.
* tests/chroot.c: Likewise.
* tests/clock_adjtime.c: Likewise.
* tests/clock_nanosleep.c: Likewise.
* tests/clock_xettime.c: Likewise.
* tests/copy_file_range.c: Likewise.
* tests/creat.c: Likewise.
* tests/dup2.c: Likewise.
* tests/dup3.c: Likewise.
* tests/epoll_create.c: Likewise.
* tests/epoll_create1.c: Likewise.
* tests/epoll_ctl.c: Likewise.
* tests/epoll_pwait.c: Likewise.
* tests/epoll_wait.c: Likewise.
* tests/eventfd.c: Likewise.
* tests/execveat.c: Likewise.
* tests/faccessat.c: Likewise.
* tests/fchdir.c: Likewise.
* tests/fchmod.c: Likewise.
* tests/fchmodat.c: Likewise.
* tests/fchown.c: Likewise.
* tests/fchown32.c: Likewise.
* tests/fchownat.c: Likewise.
* tests/fcntl.c: Likewise.
* tests/fcntl64.c: Likewise.
* tests/fdatasync.c: Likewise.
* tests/flock.c: Likewise.
* tests/fstat.c: Likewise.
* tests/fstat64.c: Likewise.
* tests/fstatat64.c: Likewise.
* tests/fstatfs.c: Likewise.
* tests/fstatfs64.c: Likewise.
* tests/fsync.c: Likewise.
* tests/ftruncate.c: Likewise.
* tests/ftruncate64.c: Likewise.
* tests/futimesat.c: Likewise.
* tests/get_mempolicy.c: Likewise.
* tests/getcwd.c: Likewise.
* tests/getdents.c: Likewise.
* tests/getdents64.c: Likewise.
* tests/getegid.c: Likewise.
* tests/getegid32.c: Likewise.
* tests/geteuid.c: Likewise.
* tests/geteuid32.c: Likewise.
* tests/getgid.c: Likewise.
* tests/getgid32.c: Likewise.
* tests/getgroups.c: Likewise.
* tests/getgroups32.c: Likewise.
* tests/getpgrp.c: Likewise.
* tests/getrandom.c: Likewise.
* tests/getresgid.c: Likewise.
* tests/getresgid32.c: Likewise.
* tests/getresuid.c: Likewise.
* tests/getresuid32.c: Likewise.
* tests/getrlimit.c: Likewise.
* tests/getrusage.c: Likewise.
* tests/getuid.c: Likewise.
* tests/getuid32.c: Likewise.
* tests/getxxid.c: Likewise.
* tests/ioctl_uffdio.c: Likewise.
* tests/ioperm.c: Likewise.
* tests/iopl.c: Likewise.
* tests/ipc.c: Likewise.
* tests/kill.c: Likewise.
* tests/lchown.c: Likewise.
* tests/lchown32.c: Likewise.
* tests/libmmsg.c: Likewise.
* tests/libsocketcall.c: Likewise.
* tests/link.c: Likewise.
* tests/linkat.c: Likewise.
* tests/llseek.c: Likewise.
* tests/lseek.c: Likewise.
* tests/lstat.c: Likewise.
* tests/lstat64.c: Likewise.
* tests/mbind.c: Likewise.
* tests/membarrier.c: Likewise.
* tests/memfd_create.c: Likewise.
* tests/migrate_pages.c: Likewise.
* tests/mkdir.c: Likewise.
* tests/mkdirat.c: Likewise.
* tests/mknod.c: Likewise.
* tests/mknodat.c: Likewise.
* tests/mlock.c: Likewise.
* tests/mlock2.c: Likewise.
* tests/move_pages.c: Likewise.
* tests/newfstatat.c: Likewise.
* tests/nsyscalls.c: Likewise.
* tests/old_mmap.c: Likewise.
* tests/oldselect.c: Likewise.
* tests/open.c: Likewise.
* tests/openat.c: Likewise.
* tests/pause.c: Likewise.
* tests/poll.c: Likewise.
* tests/prctl-seccomp-filter-v.c: Likewise.
* tests/prctl-seccomp-strict.c: Likewise.
* tests/preadv2-pwritev2.c: Likewise.
* tests/prlimit64.c: Likewise.
* tests/pselect6.c: Likewise.
* tests/ptrace.c: Likewise.
* tests/readdir.c: Likewise.
* tests/readlink.c: Likewise.
* tests/readlinkat.c: Likewise.
* tests/reboot.c: Likewise.
* tests/remap_file_pages.c: Likewise.
* tests/rename.c: Likewise.
* tests/renameat.c: Likewise.
* tests/renameat2.c: Likewise.
* tests/rmdir.c: Likewise.
* tests/rt_sigpending.c: Likewise.
* tests/rt_sigprocmask.c: Likewise.
* tests/rt_sigsuspend.c: Likewise.
* tests/rt_sigtimedwait.c: Likewise.
* tests/rt_tgsigqueueinfo.c: Likewise.
* tests/sched_get_priority_mxx.c: Likewise.
* tests/sched_rr_get_interval.c: Likewise.
* tests/sched_xetaffinity.c: Likewise.
* tests/sched_xetattr.c: Likewise.
* tests/sched_xetparam.c: Likewise.
* tests/sched_xetscheduler.c: Likewise.
* tests/sched_yield.c: Likewise.
* tests/seccomp-filter-v.c: Likewise.
* tests/seccomp-filter.c: Likewise.
* tests/seccomp-strict.c: Likewise.
* tests/select.c: Likewise.
* tests/sendfile.c: Likewise.
* tests/sendfile64.c: Likewise.
* tests/set_mempolicy.c: Likewise.
* tests/setdomainname.c: Likewise.
* tests/setfsgid.c: Likewise.
* tests/setfsgid32.c: Likewise.
* tests/setfsuid.c: Likewise.
* tests/setfsuid32.c: Likewise.
* tests/setgid.c: Likewise.
* tests/setgid32.c: Likewise.
* tests/setgroups.c: Likewise.
* tests/setgroups32.c: Likewise.
* tests/sethostname.c: Likewise.
* tests/setregid.c: Likewise.
* tests/setregid32.c: Likewise.
* tests/setresgid.c: Likewise.
* tests/setresgid32.c: Likewise.
* tests/setresuid.c: Likewise.
* tests/setresuid32.c: Likewise.
* tests/setreuid.c: Likewise.
* tests/setreuid32.c: Likewise.
* tests/setrlimit.c: Likewise.
* tests/setuid.c: Likewise.
* tests/setuid32.c: Likewise.
* tests/signalfd4.c: Likewise.
* tests/socketcall.c: Likewise.
* tests/splice.c: Likewise.
* tests/stat.c: Likewise.
* tests/stat64.c: Likewise.
* tests/statfs.c: Likewise.
* tests/statfs64.c: Likewise.
* tests/swap.c: Likewise.
* tests/symlink.c: Likewise.
* tests/symlinkat.c: Likewise.
* tests/sync.c: Likewise.
* tests/sync_file_range.c: Likewise.
* tests/sync_file_range2.c: Likewise.
* tests/syslog.c: Likewise.
* tests/tee.c: Likewise.
* tests/time.c: Likewise.
* tests/timer_create.c: Likewise.
* tests/timer_xettime.c: Likewise.
* tests/timerfd_xettime.c: Likewise.
* tests/times-fail.c: Likewise.
* tests/times.c: Likewise.
* tests/truncate.c: Likewise.
* tests/truncate64.c: Likewise.
* tests/ugetrlimit.c: Likewise.
* tests/umount.c: Likewise.
* tests/umount2.c: Likewise.
* tests/uname.c: Likewise.
* tests/unix-pair-send-recv.c: Likewise.
* tests/unlink.c: Likewise.
* tests/unlinkat.c: Likewise.
* tests/userfaultfd.c: Likewise.
* tests/utimes.c: Likewise.
* tests/vhangup.c: Likewise.
* tests/vmsplice.c: Likewise.
* tests/waitid.c: Likewise.
* tests/waitpid.c: Likewise.
* tests/xet_robust_list.c: Likewise.
* tests/xetpgid.c: Likewise.
* tests/xetpriority.c: Likewise.
* tests/xettimeofday.c: Likewise.
2016-08-09 14:38:29 +00:00
38d854e425 ia64: replace SYS_clone2 with __NR_clone2
Migrate to __NR_* the last user of SYS_* macros provided
by <sys/syscall.h>.

* clone.c [IA64] (ARG_STACKSIZE, ARG_PTID, ARG_CTID, ARG_TLS): Replace
SYS_clone2 with __NR_clone2.
2016-08-09 14:35:06 +00:00
e3dfc5901f Make sure that tcp->s_ent and tcp->s_prev_ent do not point to freed memory
This complements commit v4.13-33-g60d7ec8.

* syscall.c (sysent_buf): New structure.
(free_sysent_buf): New function.
(get_scno): Use them.
2016-08-09 10:34:09 +00:00
09dee9ab25 file.c: move definitions of struct stat32 to separate files
* linux/aarch64/stat32.h: New file.
* linux/powerpc64/stat32.h: Likewise.
* linux/sparc64/stat32.h: Likewise.
* linux/tile/stat32.h: Likewise.
* linux/x32/stat32.h: Likewise.
* linux/x86_64/stat32.h: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
* file.c [SUPPORTED_PERSONALITIES > 1]: Remove arch specific definitions
of struct stat32, include "stat32.h" instead.
2016-08-09 10:27:50 +00:00
5179183b49 sparc, sparc64: remove obsolete code
Remove remains of solaris personality support.
This complements commit v4.10-45-gdf4dd8b.

* file.c [SPARC || SPARC64]: Remove the code related to struct solstat.
(printstat, printoldstat) [SPARC || SPARC64]: Remove.
2016-08-09 09:21:46 +00:00
deb3bce1a2 sparc64: fix decoding of stat family syscalls
This complements commit v4.13-28-gaebfe83.

* file.c [SPARC64]: Change STAT32_PERSONALITY to 1.
2016-08-09 09:14:11 +00:00
60d7ec80d9 Fix decoding of invalid syscalls mapped to indirect subcalls
When the syscall number returned by arch_get_scno is a mapped indirect
subcall (i.e. mapped subcall of socketcall or ipc syscall), do not
mistakenly treat it as a valid indirect subcall.

* defs.h (SCNO_IS_VALID): Treat scno with TRACE_INDIRECT_SUBCALL flag
as invalid.
* syscall.c (syscall_name): Do no shuffle scno.
(trace_syscall_entering, trace_syscall_exiting): Use
tcp->s_ent->sys_name instead of syscall_name.
(get_scno): In case of invalid syscall, allocate a dynamic struct sysent
containing an appropriate .sys_name.
* tests/nsyscalls.c (main) [SYS_socket_subcall]: Check decoding
of direct syscall number SYS_socket_subcall+1.
(main) [SYS_ipc_subcall]: Check decoding of direct syscall number
SYS_ipc_subcall+1.
2016-08-09 01:13:24 +00:00
c61dd7f4d2 linux/subcall.h: remove redundant definitions
* linux/subcall.h: Remove definitions of non-existent socket
and ipc subcalls.
2016-08-08 23:43:50 +00:00
f2107d57e4 defs.h: simplify SUPPORTED_PERSONALITIES definition
* defs.h: Group definition of SUPPORTED_PERSONALITIES by value.
2016-08-08 23:28:29 +00:00
abfc0a6d59 defs.h: simplify PERSONALITY1_WORDSIZE definition
Move definition of PERSONALITY1_WORDSIZE macro outside arch specific
ifdefs.

* defs.h [SPARC64 || X86_64 || X32 || AARCH64 || POWERPC64 || TILE]
(PERSONALITY1_WORDSIZE): Remove.
[SUPPORTED_PERSONALITIES > 1] (PERSONALITY1_WORDSIZE): Define to 4
unconditionally.
2016-08-08 23:28:29 +00:00
8d92151c66 defs.h: simplify PERSONALITY0_WORDSIZE definition
Move definition of PERSONALITY0_WORDSIZE macro outside arch specific
ifdefs.

* defs.h (PERSONALITY0_WORDSIZE): Define to SIZEOF_LONG unconditionally.
2016-08-08 23:28:29 +00:00
aebfe832b8 sparc64: swap personality numbers
Fix inconsistency between syscall and ioctl entries on sparc64.
Make layout of personalities on sparc64 the same as on other
architectures that support two personalities.

* defs.h [SPARC64] (PERSONALITY0_WORDSIZE): Change to 8.
[SPARC64] (PERSONALITY1_WORDSIZE): Change to 4.
* linux/sparc64/get_scno.c (arch_get_scno): Swap personality numbers.
* linux/sparc64/ioctls_arch1.h: Rename to ioctls_arch0.h.
* linux/sparc64/ioctls_arch0.h: Rename to ioctls_arch1.h.
* linux/sparc64/ioctls_inc0.h: Rename to ioctls_inc1.h.
* linux/sparc64/ioctls_inc1.h: Rename to ioctls_inc0.h.
2016-08-08 23:27:08 +00:00
90a65a4aab defs.h: cleanup personality specific macro definitions
Move the code that defines PERSONALITY[12]_INCLUDE_FUNCS,
PERSONALITY[12]_INCLUDE_PRINTERS_DECLS,
PERSONALITY[12]_INCLUDE_PRINTERS_DEFS, and MPERS_{m,mx}32_IOCTL_MACROS
macros outside arch specific ifdefs.

* defs.h [SPARC] (PERSONALITY0_WORDSIZE): Remove.
[SPARC64 && HAVE_M32_MPERS]: Remove.
[X86_64 && HAVE_M32_MPERS]: Remove.
[X86_64 && HAVE_MX32_MPERS]: Remove.
[X32 && HAVE_M32_MPERS]: Remove.
[AARCH64 && HAVE_M32_MPERS]: Remove.
[POWERPC64 && HAVE_M32_MPERS]: Remove.
[TILE && HAVE_M32_MPERS]: Remove.
(PERSONALITY0_INCLUDE_PRINTERS_DECLS,
PERSONALITY0_INCLUDE_PRINTERS_DEFS): Define unconditionally.
[SUPPORTED_PERSONALITIES > 1 && HAVE_M32_MPERS]
(PERSONALITY1_INCLUDE_PRINTERS_DECLS,
PERSONALITY1_INCLUDE_PRINTERS_DEFS, PERSONALITY1_INCLUDE_FUNCS,
MPERS_m32_IOCTL_MACROS): Define for
[SUPPORTED_PERSONALITIES > 1 && HAVE_M32_MPERS] case.
(PERSONALITY2_INCLUDE_PRINTERS_DECLS,
PERSONALITY2_INCLUDE_PRINTERS_DEFS, PERSONALITY2_INCLUDE_FUNCS,
MPERS_mx32_IOCTL_MACROS): Define for
[SUPPORTED_PERSONALITIES > 2 && HAVE_MX32_MPERS] case.
2016-08-08 21:11:47 +00:00
42ceb0fd7f Change #include guard trailing part comments
* defs.h: Change comment of the trailing part of #include guard.
* flock.h: Likewise.
* gcc_compat.h: Likewise.
* ipc_defs.h: Likewise.
* kernel_types.h: Likewise.
* mpers_type.h: Likewise.
* msghdr.h: Likewise.
* printsiginfo.h: Likewise.
* ptrace.h: Likewise.
* regs.h: Likewise.
* seccomp_fprog.h: Likewise.
* sigevent.h: Likewise.
* statfs.h: Likewise.
* xlat.h: Likewise.
2016-08-07 22:02:46 +00:00
Eugene Syromyatnikov
18907920bb Unify usage of #include guards
This commit is an attempt to unify usage of include guards (in top-level
headers, at least).  As a side note, different files with *.h extension
have different semantics: for example, printargs.h is included multiple
times in order to generate slightly varying code depending on values of
macro definitions - maybe it's better to change extension of such files
to something like *.inc.

* defs.h: Add #include guard.
* flock.h: Likewise.
* ipc_defs.h: Likewise.
* mpers_type.h: Likewise.
* printsiginfo.h: Likewise.
* ptrace.h: Likewise.
* regs.h: Likewise.
* seccomp_fprog.h: Likewise.
* gcc_compat.h: Rename the macro used for #include guard.
* msghdr.h: Likewise.
* sigevent.h: Likewise.
* kernel_types.h: Comment the trailing part of #include guard.
* xlat.h: Add missing macro definition for #include guard.
2016-08-08 09:54:01 +00:00
7b1401e965 tests: add #include guards
* tests/tests.h: Add #include guard.
2016-08-06 21:51:29 +00:00
3c8149a0f2 linux: add #include guards
* linux/dummy.h: Add #include guard.
* linux/inet_diag.h: Likewise.
* linux/netlink_diag.h: Likewise.
* linux/sock_diag.h: Likewise.
* linux/syscall.h: Likewise.
* linux/unix_diag.h: Likewise.
2016-08-05 15:06:43 +00:00
08601fdc68 tests/umode_t.c: guard against libc printf format errors
* tests/umode_t.c (test_syscall): Use different printf format specifiers
to detect libc printf format errors.
2016-08-04 12:11:19 +00:00